@vellumai/web 0.12.4-staging.2 → 0.12.4-staging.3

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 (204) hide show
  1. package/dist/assets/{a2a-invite-DizlchNv.js → a2a-invite-FVKbTs7U.js} +1 -1
  2. package/dist/assets/{about-page-Y8a--p-0.js → about-page-BOgOqskJ.js} +1 -1
  3. package/dist/assets/{account-page-oXqvFuC5.js → account-page-CIpiaQdA.js} +1 -1
  4. package/dist/assets/{account-shell-BW5fY_u7.js → account-shell-DF353qm4.js} +1 -1
  5. package/dist/assets/{acp-run-detail-panel-CViUQ4Gg.js → acp-run-detail-panel-AnETmSXc.js} +1 -1
  6. package/dist/assets/{activation-list-route-swzAPcaY.js → activation-list-route-DD4LlouQ.js} +1 -1
  7. package/dist/assets/{activity-redirect-page-Wc2DZYeP.js → activity-redirect-page-B3gcwFtq.js} +1 -1
  8. package/dist/assets/{activity-steps-panel--otugh_6.js → activity-steps-panel-C6t9bncj.js} +1 -1
  9. package/dist/assets/{add-credits-modal-ZnKmvy6V.js → add-credits-modal-BHp9z7-k.js} +1 -1
  10. package/dist/assets/add-credits-modal-CFAKrqtS.js +1 -0
  11. package/dist/assets/{ai-page-BMR6BEti.js → ai-page-BYItH10R.js} +1 -1
  12. package/dist/assets/{android-billing-handoff-6shikm2k.js → android-billing-handoff-BtlRm2Gd.js} +1 -1
  13. package/dist/assets/{api-key-screen-CbnUNlGK.js → api-key-screen-ByV-2-g7.js} +1 -1
  14. package/dist/assets/{app-D8sMVA0h.js → app-DENERwru.js} +15 -15
  15. package/dist/assets/{app-info-z1hPo0V6.js → app-info-Df8Zh1Ev.js} +1 -1
  16. package/dist/assets/{archive-redirect-page-DEdZNQal.js → archive-redirect-page-BNPy7AD-.js} +1 -1
  17. package/dist/assets/{assistant-handle-modal-Rx01AWRM.js → assistant-handle-modal-CdAetGEu.js} +1 -1
  18. package/dist/assets/{assistant-inbox-page-route-CWfD1nW8.js → assistant-inbox-page-route-B8fD8gXz.js} +1 -1
  19. package/dist/assets/{assistant-inbox-upgrade-body-DnzMfD6M.js → assistant-inbox-upgrade-body-CXoZZXrZ.js} +1 -1
  20. package/dist/assets/{assistant-status-panel-Cox-mezz.js → assistant-status-panel-BPk7Kxlr.js} +1 -1
  21. package/dist/assets/auth-store-CE1eUA2L.js +1 -0
  22. package/dist/assets/{auth-welcome-screen-Bwm2MF1q.js → auth-welcome-screen-BxOOugV8.js} +1 -1
  23. package/dist/assets/avatar-bundled-components-zLu_3oxr.js +1 -0
  24. package/dist/assets/{avatar-random-DenoKEgP.js → avatar-random-BWf-lGuD.js} +2 -2
  25. package/dist/assets/{await-org-header-settled-BxLRQCmZ.js → await-org-header-settled-5KgElVC2.js} +1 -1
  26. package/dist/assets/{background-task-detail-panel-COBZw2lg.js → background-task-detail-panel-CoLWVbVP.js} +1 -1
  27. package/dist/assets/{billing-page-DfUj1I0G.js → billing-page-u3iPL5iM.js} +3 -3
  28. package/dist/assets/{billing-redirect-page-DKyiR6MR.js → billing-redirect-page-8P-IMyWs.js} +1 -1
  29. package/dist/assets/{bookmarks-page-CFEE1Uxr.js → bookmarks-page-CMs-USGy.js} +1 -1
  30. package/dist/assets/{bundle-confirm-page-B-d41LNa.js → bundle-confirm-page-Bivz7uCg.js} +1 -1
  31. package/dist/assets/{channel-transcript-panel-CmHEsFMk.js → channel-transcript-panel-CoCDuR4w.js} +1 -1
  32. package/dist/assets/{channels-page-route-CuAKuwQD.js → channels-page-route-CWW2AV7d.js} +1 -1
  33. package/dist/assets/{chat-info-panel-oH5Oyl38.js → chat-info-panel-DxgKF0-Z.js} +1 -1
  34. package/dist/assets/{checkout-continuation-C7ALmXXi.js → checkout-continuation-CoIAcRA6.js} +1 -1
  35. package/dist/assets/{checkout-page-BiKD4JLD.js → checkout-page-v01Qo0gF.js} +1 -1
  36. package/dist/assets/checkout-return-target-BEXPg1Xm.js +1 -0
  37. package/dist/assets/{command-palette-BlZE0DtA.js → command-palette-Dr8VDM0a.js} +1 -1
  38. package/dist/assets/command-palette-mO8-mIXR.js +1 -0
  39. package/dist/assets/{command-palette-window-page-B_vTgfMk.js → command-palette-window-page-DmpKHCvv.js} +1 -1
  40. package/dist/assets/{community-page-h4SSKpvs.js → community-page-5Koh1Pf6.js} +1 -1
  41. package/dist/assets/{companion-accent-CpX6aNlW.js → companion-accent-CUR6gi0-.js} +1 -1
  42. package/dist/assets/{companion-dock-zones-page-VmKgW5GB.js → companion-dock-zones-page-9SQJH2mx.js} +1 -1
  43. package/dist/assets/{companion-layout-TXE0PA9f.js → companion-layout-BwBXhmuK.js} +1 -1
  44. package/dist/assets/{companion-popover-C-jOy9ph.js → companion-popover-CoN3gFAQ.js} +1 -1
  45. package/dist/assets/{companion-popover-page-BroQfXvM.js → companion-popover-page-xU8NzRUt.js} +1 -1
  46. package/dist/assets/{companion-surface-DOIgH-bV.js → companion-surface-DciMeSdX.js} +1 -1
  47. package/dist/assets/{companion-surface-page-DRLXSLvn.js → companion-surface-page-BXNkpFnL.js} +1 -1
  48. package/dist/assets/{companion-tour-entry-B1IsGYch.js → companion-tour-entry-DpBBpsTm.js} +1 -1
  49. package/dist/assets/{companion-watch-frame-page-BrtR8aJG.js → companion-watch-frame-page-De2eR--u.js} +1 -1
  50. package/dist/assets/{connect-page-yTAoyfL3.js → connect-page-BY9XNM70.js} +1 -1
  51. package/dist/assets/{consent-controls-n1HIl_Qh.js → consent-controls-DA4_WXMW.js} +1 -1
  52. package/dist/assets/{contacts-gateway-CnUI-BQ8.js → contacts-gateway-CHhmYG8l.js} +1 -1
  53. package/dist/assets/{contacts-page-route-BeTKJ0wU.js → contacts-page-route-CC0cMZb-.js} +1 -1
  54. package/dist/assets/{copy-button-zFMI1aRE.js → copy-button-Dqj9pgai.js} +1 -1
  55. package/dist/assets/{credential-entry-page-BX5tgHs-.js → credential-entry-page-E0skRjEq.js} +1 -1
  56. package/dist/assets/{credentials-page-DO12GLZa.js → credentials-page-Bbv5IdF2.js} +1 -1
  57. package/dist/assets/{csv-preview-DTvQhodp.js → csv-preview-BZvGLQt-.js} +1 -1
  58. package/dist/assets/{danger-zone-redirect-page-CKPdbPhO.js → danger-zone-redirect-page-C3qhfYKv.js} +1 -1
  59. package/dist/assets/{debug-page-KaXTLZ3j.js → debug-page-C-Ywh5nC.js} +1 -1
  60. package/dist/assets/deploy-dialogs-CZ-O-8sD.js +1 -0
  61. package/dist/assets/{deploy-dialogs-D1N0Mx60.js → deploy-dialogs-D5Qdi1vH.js} +1 -1
  62. package/dist/assets/{desktop-preview-content-BGP-Q4ES.js → desktop-preview-content-Xi711BL9.js} +2 -2
  63. package/dist/assets/{desktop-status-DhhVXu3M.js → desktop-status-BbT1c7b_.js} +1 -1
  64. package/dist/assets/{desktop-viewer-BS0GRBKw.js → desktop-viewer-lMZgr2r9.js} +1 -1
  65. package/dist/assets/{detail-card-5ja97d__.js → detail-card-DDxZkd-7.js} +1 -1
  66. package/dist/assets/{detail-panel-stop-button-C_TanbFS.js → detail-panel-stop-button-DyvekPdW.js} +1 -1
  67. package/dist/assets/{detail-primitives-DlHfs3NY.js → detail-primitives-xBJj2j5D.js} +1 -1
  68. package/dist/assets/{developer-page-Ia_M--jA.js → developer-page-BlR6sar3.js} +1 -1
  69. package/dist/assets/{devices-redirect-page-Dicfe-Xh.js → devices-redirect-page-C8Qz95f9.js} +1 -1
  70. package/dist/assets/{dictation-overlay-page-DLKil78N.js → dictation-overlay-page-DDxg0QzC.js} +1 -1
  71. package/dist/assets/document-load-CG8Q8LRf.js +1 -0
  72. package/dist/assets/{document-load-D7lS0Qam.js → document-load-GN11Lnmr.js} +1 -1
  73. package/dist/assets/{document-viewer-page-Bvnx2eMP.js → document-viewer-page-B2wKfrx7.js} +1 -1
  74. package/dist/assets/{emails-page-D3O_HhPG.js → emails-page-Ci9aUWrH.js} +1 -1
  75. package/dist/assets/{file-diff-view-D1j-t0cs.js → file-diff-view-C4U-n-O9.js} +1 -1
  76. package/dist/assets/{file-editor-CDuPINUR.js → file-editor--R6096fM.js} +1 -1
  77. package/dist/assets/{general-page-CsElCUdU.js → general-page-CqCp6Me6.js} +1 -1
  78. package/dist/assets/{hatching-screen-DAfWJUbK.js → hatching-screen-7pDOoqwh.js} +1 -1
  79. package/dist/assets/{hosting-screen-AXFQL3em.js → hosting-screen-CHSZgQLi.js} +1 -1
  80. package/dist/assets/{identity-page-route-DAr3l3g4.js → identity-page-route-DpQvcDHq.js} +1 -1
  81. package/dist/assets/{inspect-page-EGAIWdPZ.js → inspect-page-b7igjrsV.js} +3 -3
  82. package/dist/assets/{integrations-page-BOgg6KK3.js → integrations-page-Cz7Y5vMl.js} +1 -1
  83. package/dist/assets/{intelligence-layout-BPa8zuju.js → intelligence-layout-DnjbMbDE.js} +1 -1
  84. package/dist/assets/intelligence-layout-slots-store-BfLm_A1U.js +1 -0
  85. package/dist/assets/{keyboard-shortcuts-redirect-page-3JddlI6I.js → keyboard-shortcuts-redirect-page-BfTGiMBu.js} +1 -1
  86. package/dist/assets/{latest-assistant-text-fShWplU9.js → latest-assistant-text-rUBCqKvi.js} +1 -1
  87. package/dist/assets/{library-detail-page-CqqXK7mJ.js → library-detail-page-DNzuWZto.js} +1 -1
  88. package/dist/assets/{library-page-Db5rMvEu.js → library-page-oq9n8kJD.js} +1 -1
  89. package/dist/assets/local-mode-BMtnOCcG.js +1 -0
  90. package/dist/assets/{login-page-BbfY1JYR.js → login-page-CKRIURnO.js} +1 -1
  91. package/dist/assets/{logout-page-DoibQ_Ri.js → logout-page-DZPABSW1.js} +1 -1
  92. package/dist/assets/{logs-layout-Dobrj5WD.js → logs-layout-DPlXp8Rh.js} +1 -1
  93. package/dist/assets/{markdown-preview-CNgPT8Ns.js → markdown-preview-CwbBTBu2.js} +1 -1
  94. package/dist/assets/{media-preview-BB_3EZbz.js → media-preview-B6tAR_x0.js} +1 -1
  95. package/dist/assets/{memory-page-route-DLi_ptkl.js → memory-page-route-BUS5CbQs.js} +1 -1
  96. package/dist/assets/{memory-router-playground-page-DozE3X0H.js → memory-router-playground-page-BFhyMSjo.js} +1 -1
  97. package/dist/assets/{message-files-panel-BPTDooXh.js → message-files-panel-B694eW_k.js} +1 -1
  98. package/dist/assets/{metric-card-D0M85__8.js → metric-card-fY2ytHE4.js} +1 -1
  99. package/dist/assets/native-attachment-pickers-DHZmHnSA.js +1 -0
  100. package/dist/assets/native-file-CclvrIb0.js +1 -0
  101. package/dist/assets/{notifications-page-Ysp5efLW.js → notifications-page-C7HhfTeF.js} +1 -1
  102. package/dist/assets/{oauth-complete-page-CDxvG_L-.js → oauth-complete-page-DFCMLqQ6.js} +1 -1
  103. package/dist/assets/{oauth-popup-complete-page-CwJxBm2S.js → oauth-popup-complete-page-DRFAcmAw.js} +1 -1
  104. package/dist/assets/{old-chats-page-route-BcqodIdi.js → old-chats-page-route-hErpZLlC.js} +1 -1
  105. package/dist/assets/paired-platform-identity-RifmymbD.js +1 -0
  106. package/dist/assets/{pairing-page-DIcQb9OJ.js → pairing-page-riPEbJey.js} +1 -1
  107. package/dist/assets/password-reset-page-CbBkAgmg.js +1 -0
  108. package/dist/assets/{pdf-file-preview-DX0ZQoVT.js → pdf-file-preview-BtiyDYWM.js} +1 -1
  109. package/dist/assets/{personality-page-D4cC26jw.js → personality-page-6Gpjy7yv.js} +1 -1
  110. package/dist/assets/{personality-page-BFiUCJ1L.js → personality-page-DNnwdm8u.js} +1 -1
  111. package/dist/assets/{personality-sliders-BM4di6t9.js → personality-sliders-CBzy0hBL.js} +1 -1
  112. package/dist/assets/{plans-page-miRpUo-U.js → plans-page-N7GVXOjn.js} +1 -1
  113. package/dist/assets/{platform-loopback-page-CCG5On-e.js → platform-loopback-page-BgOWVvMY.js} +1 -1
  114. package/dist/assets/{plugin-detail-page-Dt5XsCxQ.js → plugin-detail-page-D5JZqJNP.js} +1 -1
  115. package/dist/assets/{plugins-page-B_d5EVPw.js → plugins-page-Cm6aC5cD.js} +1 -1
  116. package/dist/assets/plugins-surface-DFlmJdMv.js +1 -0
  117. package/dist/assets/{preview-error-DoWnZxU0.js → preview-error-72bCczYp.js} +1 -1
  118. package/dist/assets/{privacy-page-BmyUhMnI.js → privacy-page-OnCEFV_L.js} +1 -1
  119. package/dist/assets/{privacy-screen-CuOvxzA8.js → privacy-screen-CfWOYhCe.js} +1 -1
  120. package/dist/assets/{profile-card-DSHsAWzC.js → profile-card-BsnTkBKo.js} +1 -1
  121. package/dist/assets/{provider-callback-page-BVSe9lzW.js → provider-callback-page-D9yWa1A0.js} +1 -1
  122. package/dist/assets/{provider-key-Dn1NaLjs.js → provider-key-CZzjiAkE.js} +1 -1
  123. package/dist/assets/{provider-signup-page-B8wHDvGe.js → provider-signup-page-BvfntdQM.js} +1 -1
  124. package/dist/assets/{quick-input-page-BcTqo_SA.js → quick-input-page-B83Kz5SJ.js} +1 -1
  125. package/dist/assets/{referral-modal-CXPg4U-L.js → referral-modal-1pjnqBsD.js} +1 -1
  126. package/dist/assets/referral-modal-DtcanVzv.js +1 -0
  127. package/dist/assets/{research-mock-page-lCKcSGWS.js → research-mock-page-CjTYNTUe.js} +1 -1
  128. package/dist/assets/{research-onboarding-route-CXMe3vp7.js → research-onboarding-route-BJOH_84-.js} +1 -1
  129. package/dist/assets/{review-terms-screen-CcKEKn6x.js → review-terms-screen-Cx8K_F-E.js} +1 -1
  130. package/dist/assets/routes-B6d_2LBB.js +1 -0
  131. package/dist/assets/{schedules-C862mQ95.js → schedules-AatsZCvw.js} +1 -1
  132. package/dist/assets/{schedules-page-Vm7pjI-3.js → schedules-page-t9TH0x4P.js} +1 -1
  133. package/dist/assets/{security-redirect-page-Cf6N-pAp.js → security-redirect-page-qJHlofPo.js} +1 -1
  134. package/dist/assets/{select-assistant-screen-DmC81TOi.js → select-assistant-screen-Cv2HoXMC.js} +1 -1
  135. package/dist/assets/{self-hosted-servers-CuhcBUtc.js → self-hosted-servers-o6yBM9bM.js} +1 -1
  136. package/dist/assets/{service-form-controls-Q1QYmu0R.js → service-form-controls-B9ObOv9F.js} +1 -1
  137. package/dist/assets/{setting-row-bAvkY8qq.js → setting-row-B0LsP9pN.js} +1 -1
  138. package/dist/assets/{settings-divider-JNNvLiiq.js → settings-divider-Dt6RBWfk.js} +1 -1
  139. package/dist/assets/{settings-layout-kZQ0T-wh.js → settings-layout-B3ruc4iH.js} +1 -1
  140. package/dist/assets/share-feedback-modal-BpIQNjHK.js +1 -0
  141. package/dist/assets/{share-feedback-modal-C1NM5ZQA.js → share-feedback-modal-veiYaAaT.js} +1 -1
  142. package/dist/assets/{sidebar-tree-C31ptvb9.js → sidebar-tree-DIHisqCB.js} +1 -1
  143. package/dist/assets/{signup-page-BgeUPiLo.js → signup-page-DYr4nTuo.js} +1 -1
  144. package/dist/assets/{signup-shell-qd7yOKsi.js → signup-shell-C9bZrGxl.js} +1 -1
  145. package/dist/assets/{skill-detail-page-Cx1j6Kur.js → skill-detail-page-z8BBDq_s.js} +1 -1
  146. package/dist/assets/{skill-detail-panel-CEblhGiR.js → skill-detail-panel-DM-_Rsdq.js} +1 -1
  147. package/dist/assets/{skill-removal-dialog-sFJ2FlXs.js → skill-removal-dialog-BXFlN95X.js} +1 -1
  148. package/dist/assets/{skills-page-DwaV4t6G.js → skills-page-CRqoCQYQ.js} +1 -1
  149. package/dist/assets/{sounds-page-DIwns3JM.js → sounds-page-Dl8_dJCl.js} +1 -1
  150. package/dist/assets/{start-screen-Bhe95rpT.js → start-screen-HN8at0TN.js} +1 -1
  151. package/dist/assets/{stt-language-picker-modal-6st6DWoq.js → stt-language-picker-modal-B8piSfB-.js} +1 -1
  152. package/dist/assets/{subagent-detail-panel-zJtzbOlF.js → subagent-detail-panel-DYp4YRs_.js} +1 -1
  153. package/dist/assets/{superpowers-page-Cpl22-6n.js → superpowers-page-DbUzITGO.js} +1 -1
  154. package/dist/assets/{system-events-page-C2YAEfJf.js → system-events-page-BTsJ2sdd.js} +1 -1
  155. package/dist/assets/{system-events-redirect-page-CVuxUaY0.js → system-events-redirect-page-BVFwY_c3.js} +1 -1
  156. package/dist/assets/{text-preview-BO6RkCx5.js → text-preview-JHCp9h9-.js} +1 -1
  157. package/dist/assets/{theme-stage-page-DhT0XNI2.js → theme-stage-page-CRKRHAb2.js} +1 -1
  158. package/dist/assets/{tiptap-document-editor-BcLk_m4Z.js → tiptap-document-editor-CKe5wwrN.js} +1 -1
  159. package/dist/assets/{tool-detail-panel-DgLms60D.js → tool-detail-panel-41qEO2UV.js} +1 -1
  160. package/dist/assets/tool-detail-panel-joFGH16p.js +1 -0
  161. package/dist/assets/{trait-cycle-row-DaQ1Ws3F.js → trait-cycle-row-CjHGJs48.js} +1 -1
  162. package/dist/assets/{upgrade-cancel-page-CA1adXlD.js → upgrade-cancel-page-DPSwre2I.js} +1 -1
  163. package/dist/assets/{upgrade-success-page-DQgW1mUo.js → upgrade-success-page-BlBU0-WD.js} +1 -1
  164. package/dist/assets/{usage-redirect-page-CUIv8k9u.js → usage-redirect-page-BVH_EQJk.js} +1 -1
  165. package/dist/assets/{use-app-delete-rBDVuftC.js → use-app-delete-D4RAWVu5.js} +1 -1
  166. package/dist/assets/{use-assistant-identity-details-IZ1p17bP.js → use-assistant-identity-details-C3KGgDiz.js} +1 -1
  167. package/dist/assets/{use-checkout-dismiss-refresh-CPok4Xxh.js → use-checkout-dismiss-refresh-Bn3vk9HQ.js} +1 -1
  168. package/dist/assets/{use-edge-swipe-back-C6D5cD0V.js → use-edge-swipe-back-CIvyTWTH.js} +1 -1
  169. package/dist/assets/{use-hotkey-recorder-CQ81x0jZ.js → use-hotkey-recorder-G8nr82pe.js} +1 -1
  170. package/dist/assets/{use-invite-link-dialog-CEz7AGhb.js → use-invite-link-dialog-UQY5waWL.js} +1 -1
  171. package/dist/assets/{use-plugins-list-D7kaVDLa.js → use-plugins-list-39Vnyb74.js} +1 -1
  172. package/dist/assets/{use-return-to-short-circuit-B3O40EpG.js → use-return-to-short-circuit-BqroTbAZ.js} +1 -1
  173. package/dist/assets/{use-side-list-room-jwL301KF.js → use-side-list-room-CPXqXrjy.js} +1 -1
  174. package/dist/assets/{use-skill-actions-10SaGQ2V.js → use-skill-actions-DPdCCsXT.js} +1 -1
  175. package/dist/assets/{use-skill-detail-files-OgBPzm48.js → use-skill-detail-files-DzrOeNuu.js} +1 -1
  176. package/dist/assets/use-supports-credentials-settings-B1wPMmZz.js +1 -0
  177. package/dist/assets/{use-transcript-message-by-id-Iq7GcnGe.js → use-transcript-message-by-id-DwROz3Zz.js} +1 -1
  178. package/dist/assets/{voice-page-CaiYChec.js → voice-page-BKNPhRE9.js} +1 -1
  179. package/dist/assets/{wake-detail-panel-CT3DYLQZ.js → wake-detail-panel-hDNZoZAE.js} +1 -1
  180. package/dist/assets/{weather-forecast-display-BFdH_k1K.js → weather-forecast-display-yIsnynMo.js} +1 -1
  181. package/dist/assets/{welcome-screen-CqkJbp4o.js → welcome-screen-DwnVIgZJ.js} +1 -1
  182. package/dist/assets/{workflow-detail-panel-C-eS7Dvm.js → workflow-detail-panel-t97vD08W.js} +1 -1
  183. package/dist/assets/{workspace-page-BlTW2cBW.js → workspace-page-D9Wv2-tf.js} +1 -1
  184. package/dist/index.html +1 -1
  185. package/package.json +1 -1
  186. package/dist/assets/add-credits-modal-8XswoyyE.js +0 -1
  187. package/dist/assets/auth-store-Cl64mEJk.js +0 -1
  188. package/dist/assets/avatar-bundled-components-D5UflXXI.js +0 -1
  189. package/dist/assets/checkout-return-target-DMdfJOOA.js +0 -1
  190. package/dist/assets/command-palette-w64ApCdQ.js +0 -1
  191. package/dist/assets/deploy-dialogs-CRJiVPdx.js +0 -1
  192. package/dist/assets/document-load-DSIq6Sq0.js +0 -1
  193. package/dist/assets/intelligence-layout-slots-store-BJaDjomF.js +0 -1
  194. package/dist/assets/local-mode-D_3DvD-d.js +0 -1
  195. package/dist/assets/native-attachment-pickers-CwbujgDo.js +0 -1
  196. package/dist/assets/native-file-D0pwPgoW.js +0 -1
  197. package/dist/assets/paired-platform-identity-T0oJWAAF.js +0 -1
  198. package/dist/assets/password-reset-page-C7NkRhLd.js +0 -1
  199. package/dist/assets/plugins-surface-BxV_0iuU.js +0 -1
  200. package/dist/assets/referral-modal-CI2bBp4q.js +0 -1
  201. package/dist/assets/routes-QuWxfGvc.js +0 -1
  202. package/dist/assets/share-feedback-modal-C1e2jpWO.js +0 -1
  203. package/dist/assets/tool-detail-panel-BmOzPhuv.js +0 -1
  204. package/dist/assets/use-supports-credentials-settings-DuYuJNsF.js +0 -1
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-DwZucAaM.js","assets/react-B9IgSVeK.js","assets/rolldown-runtime-BM3Ffeng.js","assets/vendor-DEhKVoiV.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$S as t,$b as n,$d as r,$u as i,AC as a,AS as o,Ax as s,B as c,B_ as l,Bx as u,Cd as d,Cu as f,Da as p,Dr as m,EC as h,Ea as g,Eg as _,Eu as v,Fc as y,Fi as b,Fx as x,Gb as S,Gg as C,IS as w,Ib as T,Ih as E,Im as D,JS as O,J_ as k,Jg as A,Jx as j,KS as M,Kh as N,Ko as P,Ld as ee,M as F,M_ as I,Mm as te,Mx as ne,N as re,Nm as ie,OS as ae,Oh as oe,Ou as se,P as ce,PS as le,P_ as ue,QS as de,Qb as fe,Qx as pe,Ri as me,SC as he,SS as ge,S_ as _e,Sd as ve,Su as ye,Sx as be,Ta as xe,Td as Se,Tg as Ce,Tu as we,Uh as Te,V as Ee,WS as De,Wb as Oe,XS as ke,Xb as Ae,Xg as je,Zg as Me,_a as Ne,_f as Pe,_g as Fe,aS as Ie,ba as Le,bd as Re,bg as ze,bu as Be,by as Ve,cC as He,cx as Ue,dg as We,eS as L,ef as Ge,fC as Ke,fg as qe,fp as Je,gS as Ye,gg as Xe,gn as Ze,h_ as Qe,hd as $e,hg as et,jm as tt,jo as nt,k_ as rt,ko as it,ku as at,kx as ot,lS as R,lg as st,mC as ct,m_ as lt,md as ut,mg as dt,mn as ft,nC as pt,nS as mt,nf as ht,ng as gt,nt as _t,nv as z,nx as vt,oC as yt,pC as B,pg as bt,pn as xt,pu as St,qS as V,q_ as Ct,rx as wt,sS as Tt,s_ as Et,sg as Dt,tC as Ot,tS as kt,td as At,tf as jt,tg as Mt,uS as Nt,ud as Pt,ug as Ft,ux as It,vy as Lt,wS as Rt,wa as zt,wd as Bt,wg as Vt,wu as Ht,wx as Ut,x_ as Wt,xd as Gt,xg as Kt,xi as qt,xu as Jt,yS as Yt,ya as Xt,yn as H,yu as Zt,yy as Qt,z_ as $t,zm as en}from"./app-D8sMVA0h.js";import{$ as tn,E as nn,I as U,N as rn,Qn as W,Yn as an,j as G,k as on,tr as K}from"./vendor-DEhKVoiV.js";import{_ as sn,f as cn,n as ln,t as un,v as dn,x as fn}from"./react-B9IgSVeK.js";import{$ as pn,At as mn,D as hn,Dt as gn,Et as _n,Ji as vn,V as yn,Ya as bn,Yn as q,_r as xn,i as Sn,li as Cn,qi as wn,rt as Tn,vn as En,wa as Dn,xr as On,yn as kn,zi as An}from"./icons-C0wyat6T.js";import{t as J}from"./detail-card-5ja97d__.js";import{n as jn}from"./profile-card-DSHsAWzC.js";import{t as Mn}from"./app-info-z1hPo0V6.js";import{a as Nn,i as Pn,l as Fn,o as In}from"./machine-sizes-BWbhowrp.js";import{t as Ln}from"./format-countdown-D18PVUfL.js";import{a as Rn,i as zn,n as Bn,r as Vn,t as Hn}from"./assistant-status-panel-Cox-mezz.js";import{t as Un}from"./trait-cycle-row-DaQ1Ws3F.js";import{n as Wn,r as Gn,t as Kn}from"./settings-divider-JNNvLiiq.js";import{t as qn}from"./use-hotkey-recorder-CQ81x0jZ.js";var Jn=bn(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Yn=bn(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Xn=bn(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),Y=e(fn(),1),X=un();function Zn(){let{t:e}=G(`settings`),t=z.use.velvet(),{theme:n,setThemePreference:r}=b(),i=[{value:`system`,label:e(`themePicker.system`),icon:(0,X.jsx)(kn,{className:`h-4 w-4`})},{value:`light`,label:e(`themePicker.light`),icon:(0,X.jsx)(yn,{className:`h-4 w-4`})},{value:`dark`,label:e(`themePicker.dark`),icon:(0,X.jsx)(En,{className:`h-4 w-4`})},...t?[{value:`velvet`,label:e(`themePicker.velvet`),icon:(0,X.jsx)(xn,{className:`h-4 w-4`})}]:[]];return(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`themePicker.title`)}),(0,X.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,X.jsx)(ke,{ariaLabel:e(`themePicker.ariaLabel`),value:n,onChange:r,items:i})})]})}var Qn=.5,$n={dazed:.55,bashful:.4},er=.224,tr=`var(--surface-sunken)`,nr=64;function rr(e){return $n[e]??Qn}function ir(e,t,n,r){let i=e?.eyeStyles.find(e=>e.id===t);if(!i||i.paths.length===0)return null;let a=Le(i.paths.map(e=>Xt(e.svgPath)));if(a.w<=0||a.h<=0)return null;let o=n*(r?Qn:rr(t)),s=Math.min(o/a.w,o/a.h),c=n/2-(a.x+a.w/2)*s,l=n/2-(a.y+a.h/2)*s;return{paths:i.paths,transform:`matrix(${s},0,0,${s},${c},${l})`}}function ar({components:e,eyeStyle:t,color:n,primary:r=!1,fieldColor:i,size:a=nr,className:o}){let s=(0,Y.useMemo)(()=>ir(e,t,a,r),[e,t,a,r]),c=e?.colors.find(e=>e.id===n)?.hex,l=i??c,u=a*er;return(0,X.jsxs)(`svg`,{"aria-hidden":`true`,"data-testid":`app-icon-preview`,className:o,width:a,height:a,viewBox:`0 0 ${a} ${a}`,style:{display:`block`,flexShrink:0},children:[(0,X.jsx)(`rect`,{"data-testid":`app-icon-preview-field`,width:a,height:a,rx:u,ry:u,fill:l??tr}),s?(0,X.jsx)(`g`,{"data-testid":`app-icon-preview-eyes`,transform:s.transform,children:s.paths.map((e,t)=>(0,X.jsx)(`path`,{d:e.svgPath,fill:e.color},t))}):null]})}var or={production:`#4C9B50`,staging:`#E9C91A`,dev:`#FF88C9`};Ne.eyeStyles.find(e=>e.id===`quirky`);var sr=`avatar-eyes-`,cr={eyeStyle:`quirky`,color:`green`};function lr(e,t){return`${sr}${e}-${t}`}function ur(e){if(e===null||e.kind!==`character`)return null;let t=e.traits;return Te(t)?lr(t.eyeStyle,t.color):null}function dr(e){return e!==null&&e.startsWith(sr)}function fr(e){if(e===null||!dr(e))return null;let t=e.slice(12),n=t.indexOf(`-`);return n<=0||n===t.length-1?null:{eyeStyle:t.slice(0,n),color:t.slice(n+1)}}function pr(e,t){let n=ur(e);return{target:n,availableMatch:t.supported&&n!==null&&t.available.includes(n)}}var mr=160;function hr(e,t,n){return t<=0?0:(e+n+t)%t}function gr(e,t){let n=e?.findIndex(e=>e.id===t)??-1;return n>=0?n:0}function _r({open:e,onClose:t,components:n,currentIcon:r,targetIcon:i,canSyncAvatar:a,availableIcons:o,onApply:s,onReset:c}){let{t:l}=G(`settings`),u=et(),[d,f]=(0,Y.useState)(0),[p,m]=(0,Y.useState)(0),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(!1),b=a?fr(i):null;(0,Y.useEffect)(()=>{if(!e)return;let t=fr(r)??fr(i)??cr;f(gr(n?.eyeStyles,t.eyeStyle)),m(gr(n?.colors,t.color)),y(!1)},[e,n,r,i]);let x=n?.eyeStyles[d],S=n?.colors[p],C=x?.id??cr.eyeStyle,w=S?.id??cr.color,T=lr(C,w),E=T!==r&&o.includes(T),D=async e=>{_(!0),y(!1);try{await e()?t():y(!0)}finally{_(!1)}};return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(O.Content,{size:`sm`,"data-testid":`app-icon-modal`,children:[(0,X.jsx)(O.Header,{children:(0,X.jsx)(O.Title,{children:l(`appIcon.title`)})}),(0,X.jsxs)(O.Body,{className:`space-y-4`,children:[(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(`div`,{className:`rounded-2xl bg-[var(--surface-sunken)] p-6`,children:(0,X.jsx)(ar,{components:n,eyeStyle:C,color:w,size:mr})})}),(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(Un,{label:l(`appIcon.eyes`),value:C,onPrev:()=>f(hr(d,n?.eyeStyles.length??0,-1)),onNext:()=>f(hr(d,n?.eyeStyles.length??0,1))}),(0,X.jsx)(Un,{label:l(`appIcon.color`),value:w,colorHex:S?.hex,onPrev:()=>m(hr(p,n?.colors.length??0,-1)),onNext:()=>m(hr(p,n?.colors.length??0,1))})]}),b===null?null:(0,X.jsx)(h,{type:`button`,variant:`outlined`,fullWidth:!0,disabled:g,onClick:()=>{b!==null&&(f(gr(n?.eyeStyles,b.eyeStyle)),m(gr(n?.colors,b.color)),y(!1))},children:l(`appIcon.matchAvatar`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:l(u?`appIcon.androidApplyNote`:`appIcon.note`)}),v?(0,X.jsx)(`p`,{role:`alert`,className:`text-body-small-lighter text-[color:var(--system-negative-strong)]`,children:l(u?`appIcon.androidError`:`appIcon.error`)}):null]}),(0,X.jsxs)(O.Footer,{children:[r===null?null:(0,X.jsx)(h,{type:`button`,variant:`outlined`,disabled:g,onClick:()=>void D(c),children:l(`appIcon.reset`)}),(0,X.jsx)(h,{type:`button`,variant:`primary`,disabled:g||!E,onClick:()=>void D(()=>s(T)),children:l(`appIcon.apply`)})]})]})})}var vr=`AppIcon`,yr=on(vr);function br(){return{supported:!1,current:null,available:[]}}function xr(){return st()&&nn.isPluginAvailable(vr)}async function Sr(){if(!xr())return br();try{let{supported:e,current:t,available:n}=await yr.getState();return{supported:e===!0,current:typeof t==`string`?t:null,available:n??[]}}catch(e){return R(e,{context:`app_icon_get_state`,bestEffort:!0}),br()}}async function Cr(e){if(!xr())return!1;try{let{ok:t,error:n}=await yr.set({name:e});return t===!0?!0:(R(Error(n??`setAlternateIconName failed`),{context:`app_icon_set`,bestEffort:!0}),!1)}catch(e){return R(e,{context:`app_icon_set`,bestEffort:!0}),!1}}var wr={supported:!1,current:null,available:[]};function Tr(e,t){return e.supported===t.supported&&e.current===t.current&&e.available.length===t.available.length&&e.available.every((e,n)=>e===t.available[n])}var Er=o(tn()((e,t)=>({snapshot:wr,setSnapshot:n=>{Tr(t().snapshot,n)||e({snapshot:n})}}))),Dr=[];function Or(e){let t=Xe(),n=et(),r=z.use.androidAvatarAppIcon(),i=t||n&&r,{state:a}=oe(e),o=Er.use.snapshot(),s=Er.use.setSnapshot(),c=(0,Y.useCallback)(async()=>{if(!i)return s(wr),wr;let e=await Sr();return s(e),e},[i,s]);(0,Y.useEffect)(()=>{c()},[c]),ee(`app.resume`,()=>{c()});let l=i&&o.supported,{target:u,availableMatch:d}=pr(a,o),f=d&&u!==o.current,p=o.available,m=(0,Y.useCallback)(async e=>{if(!l||!p.includes(e))return!1;await Cr(e);let t=await c();return t.supported&&t.current===e},[l,p,c]),h=(0,Y.useCallback)(async()=>{if(!l)return!1;await Cr(null);let e=await c();return e.supported&&e.current===null},[l,c]);return{enabled:l,currentIcon:l?o.current:null,targetIcon:l?u:null,availableIcons:l?p:Dr,canSyncAvatar:f,apply:m,reset:h}}var kr=[`ai.vocify-inc.vellum-assistant-ios`,`ai.vellum.assistant`],Ar={"":`production`,".staging":`staging`,".dev":`dev`};function jr(e){for(let t of kr){if(!e.startsWith(t))continue;let n=Ar[e.slice(t.length)];if(n)return n}return null}async function Mr(){try{let{App:e}=await dn(async()=>{let{App:e}=await import(`./esm-DwZucAaM.js`);return{App:e}},__vite__mapDeps([0,1,2,3])),{id:t}=await e.getInfo();return jr(t)}catch(e){return console.debug(`[shell-environment] no native shell identity:`,e),null}}function Nr(){let[e,t]=(0,Y.useState)();return(0,Y.useEffect)(()=>{let e=!0;return Mr().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}var Pr=32,Fr={dev:{displayP3:`color(display-p3 0.9387 0.55755 0.7777)`,srgb:or.dev},staging:{displayP3:`color(display-p3 0.89313 0.79283 0.2841)`,srgb:or.staging}},Ir={local:`dev`,dev:`dev`,staging:`staging`};function Lr(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`color`,`color(display-p3 1 1 1)`)}function Rr(e){if(e)return Lr()?e.displayP3:e.srgb}function zr(e){if(e)return e;if(e===null)return Ir.local}function Br(e,t){let n=zr(e);if(!n)return;let r=Fr[n];return t?r?.srgb:Rr(r)}function Vr(){let e=T.use.activeAssistantId(),t=Or(e);return t.enabled?(0,X.jsx)(Hr,{assistantId:e,sync:t}):null}function Hr({assistantId:e,sync:t}){let{t:n}=G(`settings`),{components:r}=oe(e),i=qt(),a=Nr(),o=et(),[s,c]=(0,Y.useState)(!1),l=r??i,u=fr(t.currentIcon),d=u??cr,f=u===null;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:n(`appIcon.title`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:n(`appIcon.description`)})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,X.jsx)(ar,{components:l,eyeStyle:d.eyeStyle,color:d.color,primary:f,fieldColor:f?Br(a,o):void 0,size:Pr}),(0,X.jsx)(h,{variant:`outlined`,onClick:()=>c(!0),children:n(`appIcon.change`)})]})]}),(0,X.jsx)(_r,{open:s,onClose:()=>c(!1),components:l,currentIcon:t.currentIcon,targetIcon:t.targetIcon,canSyncAvatar:t.canSyncAvatar,availableIcons:t.availableIcons,onApply:t.apply,onReset:t.reset})]})}var Ur=St({query:{hosting:`platform`}});function Wr(){let{t:e}=G(`settings`),t=_t(),n=W(Ur),r=n.data?.results??[];return n.isPending||r.length<2?null:(0,X.jsx)(J,{title:e(`assistantPicker.title`),subtitle:e(`assistantPicker.subtitle`),children:(0,X.jsx)(`div`,{className:`space-y-2`,children:r.map(n=>{let r=n.id===t;return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${r?`border-[var(--border-active)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-base)]`}`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(kn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:n.name||e(`assistantPicker.unnamed`)}),n.status!==`active`&&(0,X.jsx)(He,{tone:`warning`,children:n.status})]})})]}),(0,X.jsx)(`div`,{className:`shrink-0`,children:r?(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,X.jsx)(vn,{className:`h-4 w-4`}),e(`assistantPicker.active`)]}):(0,X.jsx)(h,{variant:`outlined`,size:`compact`,disabled:n.status!==`active`,onClick:()=>{A(n.id),V.success(e(`assistantPicker.switchedToast`))},children:e(`assistantPicker.switch`)})})]},n.id)})})})}var Gr=[0,300,600,3600,10800,86400,259200,604800,1209600,2592e3],Kr=new Set([300,600]);function qr(e,t){if(e===0)return t(`assistantSleepPolicy.neverSleep`);let n=Math.floor(e/86400),r=Math.floor(e%86400/3600);if(n>0&&r>0)return t(`assistantSleepPolicy.daysHours`,{days:n,hours:r});if(n>0)return t(`assistantSleepPolicy.days`,{days:n});if(r>0)return t(`assistantSleepPolicy.hours`,{hours:r});let i=Math.floor(e/60);return i>0?t(`assistantSleepPolicy.minutes`,{minutes:i}):t(`assistantSleepPolicy.seconds`,{seconds:e})}function Jr(e,t){switch(e){case 0:return t(`assistantSleepPolicy.presetNever`);case 300:return t(`assistantSleepPolicy.preset5Min`);case 600:return t(`assistantSleepPolicy.preset10Min`);case 3600:return t(`assistantSleepPolicy.preset1Hour`);case 10800:return t(`assistantSleepPolicy.preset3Hours`);case 86400:return t(`assistantSleepPolicy.preset1Day`);case 259200:return t(`assistantSleepPolicy.preset3Days`);case 604800:return t(`assistantSleepPolicy.preset7Days`);case 1209600:return t(`assistantSleepPolicy.preset14Days`);case 2592e3:return t(`assistantSleepPolicy.preset30Days`);default:return qr(e,t)}}function Yr({assistantId:e}){let{t}=G(`settings`),n=K(),r=me.use.isNonProduction(),i=(0,Y.useMemo)(()=>Gr.filter(e=>!Kr.has(e)||r),[r]),{data:a,isLoading:o,isError:s}=W(we({path:{id:e}})),c=(0,Y.useMemo)(()=>a?.idle_timeout_seconds??259200,[a]),[l,u]=(0,Y.useState)(null),d=l??c,f=l!==null,p=$e({onSuccess:()=>{V.success(t(`assistantSleepPolicy.savedToast`)),u(null),n.invalidateQueries({queryKey:v({path:{id:e}})})},onError:()=>{V.error(t(`assistantSleepPolicy.saveErrorToast`))}});return o?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),t(`assistantSleepPolicy.loading`)]}):s?(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`assistantSleepPolicy.loadError`)}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:t(`assistantSleepPolicy.idleTimeout`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.idleTimeoutDescription`)}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:i.map(e=>(0,X.jsx)(h,{variant:`outlined`,active:d===e,onClick:()=>u(e),children:Jr(e,t)},e))}),(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.current`,{duration:qr(d,t)})})]}),f&&(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(h,{variant:`primary`,loading:p.isPending,onClick:()=>p.mutate({path:{id:e},body:{idle_timeout_seconds:d}}),disabled:p.isPending,children:t(`assistantSleepPolicy.save`)}),(0,X.jsx)(h,{variant:`outlined`,onClick:()=>u(null),disabled:p.isPending,children:t(`assistantSleepPolicy.cancel`)})]})]})}function Xr(e,t,n){let r=[e.version];return e.version===n&&r.push(U(`settings:assistantUpgrades.latestSuffix`)),t&&e.version===t&&r.push(U(`settings:assistantUpgrades.currentSuffix`)),r.join(` `)}var Zr=3e3;function Qr({version:e,assistantId:t}){let{onTap:n,message:r}=zn(t);return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,X.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-positive-strong)]`,children:r})]})}function $r({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let{t:i}=G(`settings`),a=Pe.use.rollbackEnabled(),o=z.use.previewChannel(),s=K(),c=xe(n,o),l=c===`preview`,[u,d]=(0,Y.useState)(!1),p=(0,Y.useRef)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(null),C=e=>e&&p.current&&e===p.current?(queueMicrotask(()=>{S(i(y?`assistantUpgrades.successRolledBack`:`assistantUpgrades.successUpdated`,{version:p.current})),d(!1),p.current=null,g(null),V.success(i(y?`assistantUpgrades.toastRollbackComplete`:`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):Zr;W({...f({path:{id:e}}),refetchInterval:u?e=>C(e.state.data?.current_release_version):!1});let{data:w,isLoading:T}=W(Pt({query:{channel:c}})),E=w?.find(e=>e.is_stable!==!1)??w?.[0],D=m??E?.version??null,O=(0,Y.useMemo)(()=>{if(!a||!D||!t)return!1;let e=Ce(D),n=Ce(t);return!e||!n?!1:Vt(e,n)<0},[a,D,t]),k=(0,Y.useMemo)(()=>{if(!D)return!1;if(!t)return!0;let e=Ce(D),n=Ce(t);if(!e||!n)return D!==t;let r=Vt(e,n);return a?r!==0:r>0},[a,D,t]),A=an({mutationFn:async t=>{let{data:n}=await $t({path:{id:e},body:t,throwOnError:!0});return n}}),j=an({mutationFn:async t=>{let{data:n}=await ue({path:{id:e},body:t,throwOnError:!0});return n}}),N=async()=>{v(!1),S(null);let t=a?D??void 0:void 0;try{if(O){let e=await j.mutateAsync({version:t});p.current=e.version??t??null,V.success(e.detail||i(`assistantUpgrades.toastRollbackInitiated`,{version:t}))}else{let e=await A.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){V.warning(e.detail);return}p.current=e.version??t??null,V.success(e.detail||i(`assistantUpgrades.toastUpdateInitiated`,{version:e.version??t??i(`assistantUpgrades.latest`)}))}b(O),d(!0),s.invalidateQueries({queryKey:Ht({path:{id:e}})})}catch{V.error(i(O?`assistantUpgrades.toastRollbackFailed`:`assistantUpgrades.toastUpdateFailed`))}},P=i(l?`assistantUpgrades.previewRelease`:k?O?`assistantUpgrades.rollbackTo`:`assistantUpgrades.updateTo`:`assistantUpgrades.selected`);return(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i(`assistantUpgrades.current`)}),(0,X.jsx)(Qr,{version:t,assistantId:e})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:P}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-center md:gap-4`,children:[(0,X.jsx)(`span`,{className:`block min-w-0 flex-1`,children:T?(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`}),i(`assistantUpgrades.loading`)]}):w&&w.length>0?a?(0,X.jsx)(De,{value:D??``,onChange:e=>g(e===E?.version?null:e),disabled:u||A.isPending||j.isPending,options:w.map(e=>({value:e.version,label:Xr(e,t,E?.version)}))}):(0,X.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:E?Xr(E,t,E.version):`—`}):i(`assistantUpgrades.noReleases`)}),(0,X.jsx)(h,{variant:O?`outlined`:`primary`,className:`min-w-[160px] shrink-0`,loading:A.isPending||j.isPending||u,leftIcon:(0,X.jsx)(mn,{}),onClick:()=>v(!0),disabled:!k||A.isPending||j.isPending||u||T||!w?.length,children:i(u?y?`assistantUpgrades.rollingBack`:`assistantUpgrades.updating`:O?`assistantUpgrades.rollback`:l?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`)})]})]})]}),l&&(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:(0,X.jsx)(rn,{ns:`settings`,i18nKey:`assistantUpgrades.usingPreviewReleases`,components:{stableLink:(0,X.jsx)(`a`,{href:`#preview-release-channel`,className:yt()})}})}),!k&&t&&D&&!T&&(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:x??i(`assistantUpgrades.alreadyOnVersion`)}),(0,X.jsx)(M,{open:_,title:i(O?`assistantUpgrades.confirmRollbackTitle`:l?`assistantUpgrades.confirmPreviewTitle`:`assistantUpgrades.confirmUpdateTitle`),message:O?i(`assistantUpgrades.confirmRollbackMessage`,{version:D??i(`assistantUpgrades.unknown`)}):i(l?`assistantUpgrades.confirmPreviewMessage`:`assistantUpgrades.confirmUpdateMessage`,{version:D??i(`assistantUpgrades.latest`)}),confirmLabel:i(O?`assistantUpgrades.rollback`:l?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`),onConfirm:N,onCancel:()=>v(!1)})]})}function ei({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let{t:r}=G(`settings`),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),{data:c,isLoading:l}=W(Pt({query:{stable:!0,limit:100}})),u=(0,Y.useMemo)(()=>zt(c),[c]),d=u?.version,f=t?g(t,d):!!d,m=p({assistantId:e,targetVersion:d});return(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.current`)}),(0,X.jsx)(Qr,{version:t,assistantId:e})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.updateTo`)}),(0,X.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?r(`assistantUpgrades.loading`):d&&u?Xr(u,t,d):r(`assistantUpgrades.noReleases`)})]})]}),(0,X.jsx)(h,{variant:`primary`,className:`min-w-[160px]`,loading:m.isPending,leftIcon:(0,X.jsx)(mn,{}),onClick:()=>a(!0),disabled:m.isPending||l||!d||!f,children:m.isPending?r(`assistantUpgrades.updating`):d?r(`assistantUpgrades.updateToVersion`,{version:d}):r(`assistantUpgrades.update`)}),o&&(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:o}),!o&&!f&&d&&!l&&(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:r(`assistantUpgrades.alreadyOnVersion`)}),(0,X.jsx)(M,{open:i,title:r(`assistantUpgrades.confirmUpdateTitle`),message:r(`assistantUpgrades.confirmUpdateMessage`,{version:d??r(`assistantUpgrades.latest`)}),confirmLabel:r(`assistantUpgrades.update`),onConfirm:async()=>{a(!1),s(null);try{s(r(`assistantUpgrades.successUpdated`,{version:(await m.upgrade()).version??d??r(`assistantUpgrades.latest`)})),V.success(r(`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){V.error(e instanceof Error?e.message:r(`assistantUpgrades.toastUpdateFailed`))}},onCancel:()=>a(!1)})]})}function ti(){let{t:e}=G(`settings`),t=ie({platformHostedOnly:!0}),n=te(),r=D.use.user()?.id??null,i=D.use.logout(),[a,o]=(0,Y.useState)(!1),s=Re({onSuccess:async()=>{V.success(e(`deleteAccountSection.toastRequested`)),N(r),await i(),y(L.account.login)},onError:()=>{V.error(e(`deleteAccountSection.toastFailed`))}}),c=t===`full`&&n;return(0,Y.useEffect)(()=>{c&&a&&o(!1)},[c,a]),t===`gated`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`deleteAccountSection.title`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`deleteAccountSection.description`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:t===`disabled`?(0,X.jsx)(H,{children:e(`deleteAccountSection.platformLoginNotice`)}):(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(h,{variant:`dangerOutline`,onClick:()=>o(!0),disabled:s.isPending||c,className:`self-start`,children:e(`deleteAccountSection.deleteMyAccount`)}),c&&(0,X.jsx)(q,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,X.jsx)(M,{open:a,title:e(`deleteAccountSection.confirmTitle`),message:e(`deleteAccountSection.confirmMessage`),confirmLabel:e(`deleteAccountSection.confirmLabel`),destructive:!0,onConfirm:()=>{if(c){o(!1);return}o(!1),s.mutate({})},onCancel:()=>o(!1)})]})}function ni({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,X.jsx)(J,{title:e,subtitle:t,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,X.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,X.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,X.jsx)(h,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function ri({promotion:e}){let{t}=G(`settings`),{appName:n,target:r}=e;return(0,Y.useEffect)(()=>{ft(`settings`,r)},[r]),(0,X.jsx)(ni,{title:n===null?t(`nativeAppCard.titleGeneric`):t(`nativeAppCard.title`,{appName:n}),subtitle:n===null?t(`nativeAppCard.subtitleGeneric`):t(`nativeAppCard.subtitle`,{appName:n}),benefits:[{icon:Dn,text:t(`nativeAppCard.benefitPush`)},{icon:Jn,text:t(`nativeAppCard.benefitBiometric`)},{icon:Xn,text:t(`nativeAppCard.benefitHaptics`)},{icon:Tn,text:t(`nativeAppCard.benefitHomeScreen`)}],ctaLabel:t(`nativeAppCard.download`),ctaLeftIcon:(0,X.jsx)(Tn,{size:16}),onAction:()=>{xt(`click`,`settings`,r),ce(r),F(r)}})}function ii(){let e=bt(),t=qe(),n=We(),r=dt();return!e&&!t&&!n&&!r?null:(0,X.jsx)(ri,{promotion:re(e||t?`ios`:n?`android`:null)})}var ai=`0.10.0`;function oi(){return Kt(ai)}var si=`/v1/remote-web/pairing-challenge`,ci=`/v1/remote-web/pairing-verification`,li=`/v1/remote-web/pairing-requests`,ui=`${li}/approve`,di=`${li}/deny`;function fi(){return U(`settings:pairDeviceClient.connectivityHint`)}var Z=class extends Error{hint;status;code;constructor(e,t={}){super(e),this.name=`PairDeviceError`,this.hint=t.hint,this.status=t.status,this.code=t.code}},pi=5e3;function mi(){if(typeof window>`u`)return null;let e=n(),t=S(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function hi(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}function gi(e){let t=e?.error?.code;return typeof t==`string`&&t?t:void 0}async function _i(e,t,n,r){let i;try{i=await fetch(e,{...t,signal:n})}catch(e){throw Nt(e)?e:new Z(U(`settings:pairDeviceClient.networkError`))}let a=await i.json().catch(()=>null);if(!i.ok)throw new Z(hi(a)??U(`settings:pairDeviceClient.httpError`,{status:i.status}),{hint:r,status:i.status,code:gi(a)});if(typeof a!=`object`||!a)throw new Z(U(`settings:pairDeviceClient.unexpectedResponse`));return a}function vi(e,t,n,r){return _i(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)},n,r)}async function yi(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await vi(`${t}${si}`,{publicBaseUrl:n},r,fi());try{await vi(`${t}${ci}`,{userCode:i.userCode},r,fi())}catch(e){let n=AbortSignal.timeout(pi);throw Nt(e)?bi(t,i.userCode,n):await bi(t,i.userCode,r?AbortSignal.any([r,n]):n),e}return{pairUrl:Rt(i),expiresAt:i.expiresAt}}async function bi(e,t,n){try{let r=(await xi({base:e,signal:n})).find(e=>e.userCode===t);r&&await wi({base:e,requestId:r.requestId,signal:n})}catch(e){if(Nt(e))return;R(e,{context:`pair-device-orphan-cleanup`,bestEffort:!0})}}async function xi(e){let t=await _i(`${e.base}${li}`,{method:`GET`},e.signal);return Array.isArray(t.requests)?t.requests:[]}async function Si(e,t){await vi(`${t.base}${e}`,{requestId:t.requestId},t.signal)}function Ci(e){return Si(ui,e)}function wi(e){return Si(di,e)}var Ti=Object.defineProperty,Ei=Object.getOwnPropertySymbols,Di=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,ki=(e,t,n)=>t in e?Ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ai=(e,t)=>{for(var n in t||={})Di.call(t,n)&&ki(e,n,t[n]);if(Ei)for(var n of Ei(t))Oi.call(t,n)&&ki(e,n,t[n]);return e},ji=(e,t)=>{var n={};for(var r in e)Di.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ei)for(var r of Ei(e))t.indexOf(r)<0&&Oi.call(e,r)&&(n[r]=e[r]);return n},Mi;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(Mi||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Mi||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Mi||={});var Ni=Mi,Pi={L:Ni.QrCode.Ecc.LOW,M:Ni.QrCode.Ecc.MEDIUM,Q:Ni.QrCode.Ecc.QUARTILE,H:Ni.QrCode.Ecc.HIGH},Fi=128,Ii=`L`,Li=`#FFFFFF`,Ri=`#000000`,zi=!1,Bi=1,Vi=4,Hi=0,Ui=.1;function Wi(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function Gi(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function Ki(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*Ui),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function qi(e,t){return t==null?e?Vi:Hi:Math.max(Math.floor(t),0)}function Ji({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Y.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Ni.QrSegment.makeSegments(t)),e),[]);return Ni.QrCode.encodeSegments(r,Pi[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Y.useMemo(()=>{let e=c.getModules(),t=qi(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Ki(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Yi=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Xi=Y.forwardRef(function(e,t){let n=e,{value:r,size:i=Fi,level:a=Ii,bgColor:o=Li,fgColor:s=Ri,includeMargin:c=zi,minVersion:l=Bi,boostLevel:u,marginSize:d,imageSettings:f}=n,p=ji(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=ji(p,[`style`]),g=f?.src,_=Y.useRef(null),v=Y.useRef(null),y=Y.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Y.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=Ji({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Y.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=Gi(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Yi?t.fill(new Path2D(Wi(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Y.useEffect(()=>{x(!1)},[g]);let E=Ai({height:i,width:i},m),D=null;return g!=null&&(D=Y.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Y.createElement(Y.Fragment,null,Y.createElement(`canvas`,Ai({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Xi.displayName=`QRCodeCanvas`;var Zi=Y.forwardRef(function(e,t){let n=e,{value:r,size:i=Fi,level:a=Ii,bgColor:o=Li,fgColor:s=Ri,includeMargin:c=zi,minVersion:l=Bi,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=ji(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=Ji({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=Gi(g,v.excavation)),b=Y.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=Wi(y,h);return Y.createElement(`svg`,Ai({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Y.createElement(`title`,null,d),Y.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Y.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});Zi.displayName=`QRCodeSVG`;function Qi(e,t){return!Number.isFinite(t)||t<=0?e(`pairDeviceReady.singleUse`):e(`pairDeviceReady.expiresIn`,{time:Ln(t)})}function $i({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){let{t:a}=G(`settings`);return n?(0,X.jsx)(B,{tone:`warning`,title:a(`pairDeviceReady.expiredTitle`),children:a(`pairDeviceReady.expiredBody`)}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,X.jsx)(Zi,{value:e,size:192,level:`M`,title:a(`pairDeviceReady.qrTitle`)})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,X.jsx)(h,{variant:`outlined`,size:`compact`,leftIcon:r?(0,X.jsx)(vn,{}):(0,X.jsx)(Cn,{}),onClick:()=>i(e),children:a(r?`pairDeviceReady.copiedButton`:`pairDeviceReady.copyButton`)})]}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:Qi(a,t)})]})}function ea(e){return/iPhone|iPod/.test(e)?`iPhone`:/iPad/.test(e)||/Macintosh/.test(e)&&/Mobile/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Macintosh|Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/CrOS/.test(e)?`ChromeOS`:/Linux/.test(e)?`Linux`:null}function ta(e){return/Edg\/|EdgA\/|EdgiOS\//.test(e)?`Edge`:/OPR\/|OPiOS\//.test(e)?`Opera`:/Firefox\/|FxiOS\//.test(e)?`Firefox`:/Chrome\/|CriOS\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:null}function na(e){if(!e||e.trim()===``)return null;let t=ea(e),n=ta(e);return t===null&&n===null?null:{browser:n,os:t}}var ra=5e3,ia=6e4;function aa({pollWhilePairing:e=!1,revalidateKey:t,isExpanded:r=!1}={}){let[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),f=(0,Y.useRef)(!0),p=(0,Y.useRef)(0);(0,Y.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let m=(0,Y.useCallback)((e=n()?.assistantId)=>{if(!e)return;a(t=>t&&t.assistantId!==e?null:t);let t=++p.current;ne(e).then(n=>{!f.current||t!==p.current||a(n.ok?{assistantId:e,devices:n.devices}:null)})},[]),h=T.use.selectedAssistantId()??n()?.assistantId;(0,Y.useEffect)(()=>{s(null),d(null),m(h)},[h,m]);let g=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{t!==g.current&&(g.current=t,m(h))},[t,h,m]);let _=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{if(e&&!c){_.current=!0;let e=setInterval(()=>m(),ra);return()=>clearInterval(e)}!e&&_.current&&(_.current=!1,m())},[e,c,m]);let v=(i?.devices.length??0)>0;(0,Y.useEffect)(()=>{if(!r||!v||e||c)return;let t=setInterval(()=>m(),ia);return()=>clearInterval(t)},[r,v,e,c,m]);let y=(0,Y.useCallback)(e=>{d(null),s(e)},[]),b=(0,Y.useCallback)(()=>{s(null),d(null)},[]),S=(0,Y.useCallback)(()=>{!i||!o||c||(l(!0),d(null),x(i.assistantId,o.hashedDeviceId).then(e=>{f.current&&(l(!1),e.ok?(s(null),m()):d(e.error))}))},[i,o,c,m]);return{devices:i?.devices??null,confirmTarget:o,isRevoking:c,revokeError:u,requestRevoke:y,cancelRevoke:b,confirmRevoke:S}}var oa=600*1e3,sa=`paired-devices`;function ca(e){return e.slice(0,12)}function la(e,t){return t?t.charAt(0).toUpperCase()+t.slice(1):e(`pairedDevicesSection.platformUnknown`)}function ua(e,t){if(typeof t.clientReportedName==`string`&&t.clientReportedName.trim()!==``)return{name:t.clientReportedName,isRealIdentity:!0};let n=na(t.pairingUserAgent);if(n!==null){let{browser:t,os:r}=n;return t!==null&&r!==null?{name:e(`pairedDevicesSection.browserOnOs`,{browser:t,os:r}),isRealIdentity:!0}:{name:t??r??``,isRealIdentity:!0}}return{name:la(e,t.platform),isRealIdentity:!1}}function da(e,t){return t===null?e(`pairedDevicesSection.dateUnknown`):new Date(t).toLocaleDateString(mt())}function fa(e,t){let n=da(e,t.issuedAt);return t.lastUsedAt===null?e(`pairedDevicesSection.pairedLine`,{paired:n}):Date.now()-t.lastUsedAt<=oa?e(`pairedDevicesSection.pairedActiveLine`,{paired:n}):e(`pairedDevicesSection.pairedAndUsedLine`,{paired:n,lastUsed:Wn(t.lastUsedAt)})}function pa({pollWhilePairing:e=!1,revalidateKey:t}={}){let{t:n}=G(`settings`),[r,i]=(0,Y.useState)(!1),a=aa({pollWhilePairing:e,revalidateKey:t,isExpanded:r}),{devices:o,confirmTarget:s}=a;Gn(o?.some(e=>e.lastUsedAt!==null)??!1);let c=(0,Y.useMemo)(()=>o===null?null:[...o].sort((e,t)=>(t.lastUsedAt??0)-(e.lastUsedAt??0)),[o]);return c===null||c.length===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(w.Root,{type:`multiple`,value:r?[sa]:[],onValueChange:e=>i(e.includes(sa)),children:(0,X.jsxs)(w.Item,{value:sa,children:[(0,X.jsxs)(w.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`pairedDevicesSection.title`,{count:c.length})}),(0,X.jsx)(wn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,X.jsx)(w.Content,{children:(0,X.jsx)(`div`,{className:`mt-3 flex flex-col gap-3`,children:c.map(e=>{let t=ua(n,e);return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,title:t.isRealIdentity?e.hashedDeviceId:void 0,children:t.name}),!t.isRealIdentity&&(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[var(--content-tertiary)]`,title:e.hashedDeviceId,children:ca(e.hashedDeviceId)}),e.isCurrentHost&&(0,X.jsx)(`span`,{className:`shrink-0 text-[var(--content-tertiary)]`,children:`· ${n(`pairedDevicesSection.thisMachine`)}`})]}),(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:fa(n,e)})]}),(0,X.jsx)(h,{variant:`dangerOutline`,size:`compact`,className:`shrink-0`,disabled:e.isCurrentHost===!0,title:e.isCurrentHost?n(`pairedDevicesSection.hostRevokeDisabledTitle`):void 0,onClick:()=>a.requestRevoke(e),children:n(`pairedDevicesSection.revokeButton`)})]},e.hashedDeviceId)})})})]})}),(0,X.jsx)(M,{open:s!==null,title:n(`pairedDevicesSection.confirmTitle`),message:s&&(0,X.jsxs)(X.Fragment,{children:[n(`pairedDevicesSection.confirmMessageNamed`,{name:ua(n,s).name,hash:ca(s.hashedDeviceId)}),a.revokeError&&(0,X.jsx)(`span`,{className:`mt-2 block text-[var(--system-negative-strong)]`,children:a.revokeError})]}),confirmLabel:n(`pairedDevicesSection.revokeButton`),destructive:!0,isPending:a.isRevoking,onConfirm:a.confirmRevoke,onCancel:a.cancelRevoke})]})}var ma=5e3;function ha(e,t){return e.length===t.length&&t.every((t,n)=>e[n]?.requestId===t.requestId)}function ga(e,t){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=(0,Y.useRef)(null),[f,p]=(0,Y.useState)(e);e!==f&&(p(e),r([]),a(null),s(null),l(null)),(0,Y.useEffect)(()=>()=>{d.current?.abort(),d.current=null},[e]),(0,Y.useEffect)(()=>{let t=async()=>{u.current?.abort();let t=new AbortController;u.current=t;try{let n=await xi({base:e,signal:t.signal});if(t.signal.aborted)return;r(e=>ha(e,n)?e:n),l(e=>e&&!e.sticky&&!n.some(t=>t.requestId===e.requestId)?null:e),s(null)}catch(e){if(t.signal.aborted)return;if(e instanceof Z){s(e.message);return}R(e,{context:`pair-device-pending-requests-poll`}),s(U(`settings:usePendingPairingRequests.pollErrorFallback`))}};t();let n=setInterval(()=>void t(),ma);return()=>{clearInterval(n),u.current?.abort()}},[e]);let m=(0,Y.useCallback)(async(n,i)=>{if(d.current)return;let o=new AbortController;d.current=o,a({requestId:n,action:i}),l(null);let s=()=>{u.current?.abort(),r(e=>e.filter(e=>e.requestId!==n))};try{if(await(i===`approve`?Ci:wi)({base:e,requestId:n,signal:o.signal}),o.signal.aborted)return;s(),i===`approve`&&t?.()}catch(e){if(o.signal.aborted)return;e instanceof Z?i===`deny`&&e.status===409&&e.code===`ALREADY_APPROVED`?(s(),t?.(),l({requestId:n,message:U(`settings:usePendingPairingRequests.denyAlreadyApproved`),sticky:!0})):e.status===404||e.status===410?s():l({requestId:n,message:e.message}):(R(e,{context:`pair-device-pending-request-action`}),l({requestId:n,message:U(`settings:usePendingPairingRequests.actionErrorFallback`)}))}finally{d.current===o&&(d.current=null),o.signal.aborted||a(null)}},[e,t]),h=(0,Y.useCallback)(e=>m(e,`approve`),[m]),g=(0,Y.useCallback)(e=>m(e,`deny`),[m]);return{requests:n,actingOn:i,error:c?.message??o,approve:h,deny:g}}function _a({base:e,onApproved:t}){let{t:n}=G(`settings`),{requests:r,actingOn:i,error:o,approve:s,deny:c}=ga(e,t);return Gn(r.length>0),r.length===0&&!o?null:(0,X.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-[var(--border-element)] pt-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`pendingPairingRequests.title`)}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`pendingPairingRequests.instruction`)})]}),o&&(0,X.jsx)(B,{tone:`error`,title:o}),r.length>0&&(0,X.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=i!==null&&i.requestId===e.requestId?i.action:null,r=t===`approve`,o=t===`deny`;return(0,X.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-lg border border-[var(--border-element)] p-3`,children:[(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`w-fit px-2.5 py-1.5 text-title-medium tracking-wide text-[color:var(--content-emphasised)]`),children:e.userCode}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.viaEdgeProxy===!1?n(`pendingPairingRequests.requestedMetaHost`,{when:Wn(e.requestedAt)}):n(`pendingPairingRequests.requestedMeta`,{when:Wn(e.requestedAt),ip:e.requesterIp})}),e.requesterUserAgent&&(0,X.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,title:e.requesterUserAgent,children:e.requesterUserAgent})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(h,{variant:`primary`,size:`compact`,disabled:i!==null,"aria-busy":r||void 0,loading:r,onClick:()=>void s(e.requestId),children:n(`pendingPairingRequests.approveButton`)}),(0,X.jsx)(h,{variant:`dangerOutline`,size:`compact`,disabled:i!==null,"aria-busy":o||void 0,loading:o,onClick:()=>void c(e.requestId),children:n(`pendingPairingRequests.denyButton`)})]})]},e.requestId)})})]})}function va({onRefresh:e,isRefreshing:t,labelled:n=!1}){let{t:r}=G(`settings`),i=r(`tunnelStatusRow.refreshLabel`),a=(0,X.jsx)(mn,{className:t?`animate-spin`:void 0});return n?(0,X.jsx)(h,{variant:`outlined`,size:`compact`,leftIcon:a,disabled:t,onClick:e,children:i}):(0,X.jsx)(h,{variant:`ghost`,size:`compact`,iconOnly:a,"aria-label":i,disabled:t,onClick:e})}function ya(e){return`publicBaseUrl`in e&&e.publicBaseUrl?e.publicBaseUrl:null}function ba(e){return`checkedAt`in e&&e.checkedAt?e.checkedAt:null}function xa(e,t){let n=t?.trim();return n?`vellum tunnel ${Ca(n)} --provider ${e}`:`vellum tunnel --provider ${e}`}var Sa=/^[A-Za-z0-9._-]+$/;function Ca(e){return Sa.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}var wa={checking:`var(--content-tertiary)`,stopped:`var(--content-tertiary)`,healthy:`var(--system-positive-strong)`,unpairable:`var(--system-mid-strong)`,unreachable:`var(--system-mid-strong)`,foreign:`var(--system-negative-strong)`},Ta=`text-body-small-default text-[var(--content-tertiary)]`,Ea=`truncate ${Ta}`;function Da({status:e,onRefresh:t,isRefreshing:n,assistantName:r=null}){let{t:i}=G(`settings`);if(e.kind===`unconfigured`||e.kind===`unavailable`)return null;let o=ba(e),s=ya(e),c=`provider`in e?e.provider:void 0,l=`detail`in e?e.detail:void 0;return(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border border-[var(--border-element)] px-3 py-2.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`mt-1.5 inline-block h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:wa[e.kind]}}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)]`,children:Oa(e,i)}),l&&(0,X.jsx)(`p`,{className:Ea,title:l,children:l}),c&&(0,X.jsx)(`p`,{className:Ta,children:(0,X.jsx)(rn,{i18nKey:e.kind===`stopped`?`tunnelStatusRow.stoppedRestart`:`tunnelStatusRow.restartHint`,ns:`settings`,values:{command:xa(c,r)},components:{code:(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`px-1.5 py-0.5`)})}})}),s&&(0,X.jsx)(`p`,{className:Ea,title:s,children:s}),o&&(0,X.jsx)(`p`,{className:Ta,children:i(`tunnelStatusRow.checkedAt`,{when:Wn(o)})})]}),(0,X.jsx)(va,{onRefresh:t,isRefreshing:n})]})}function Oa(e,t){switch(e.kind){case`checking`:return t(`tunnelStatusRow.checkingStatus`);case`stopped`:return t(`tunnelStatusRow.stoppedStatus`);case`healthy`:return t(`tunnelStatusRow.healthyStatus`);case`unpairable`:return t(`tunnelStatusRow.unpairableStatus`);case`unreachable`:return t(`tunnelStatusRow.unreachableStatus`);case`foreign`:return e.servingAssistantName?t(`tunnelStatusRow.foreignStatusNamed`,{name:e.servingAssistantName}):t(`tunnelStatusRow.foreignStatus`)}}var ka=`vellum:pair-device:public-base-url`;function Aa(e){let t=e?.trim();if(t)return{url:t,source:`tunnel`};let n=Yt(ka,``).trim();return n?{url:n,source:`stored`}:{url:``,source:`none`}}function ja(e,t){let n=(0,Y.useMemo)(()=>Aa(t),[t]),[r,i]=(0,Y.useState)(null),a=r??n.url,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)({kind:`idle`}),[u,d]=(0,Y.useState)(()=>Date.now()),f=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>f.current?.abort(),[]),(0,Y.useEffect)(()=>{if(c.kind!==`ready`)return;d(Date.now());let e=setInterval(()=>d(Date.now()),1e3);return()=>clearInterval(e)},[c]);let p=(0,Y.useCallback)(e=>{i(e),s(null)},[]),m=(0,Y.useCallback)(()=>{if(!e)return;let t=a.trim(),n=ae(t);if(!n.ok){s(j(n.reason,t));return}s(null),f.current?.abort();let r=new AbortController;f.current=r,l({kind:`minting`}),(async()=>{try{let t=await yi({base:e,publicBaseUrl:n.url,signal:r.signal});if(r.signal.aborted)return;ge(ka,n.url),l({kind:`ready`,pairUrl:t.pairUrl,expiresAtMs:Date.parse(t.expiresAt)})}catch(e){if(r.signal.aborted)return;if(e instanceof Z){l({kind:`error`,message:e.message,hint:e.hint});return}R(e,{context:`pair-device-mint`}),l({kind:`error`,message:U(`settings:usePairDevice.mintErrorFallback`)})}})()},[e,a]),h=c.kind===`ready`?Math.max(0,c.expiresAtMs-u):0,g=c.kind===`ready`&&h<=0;return{publicBaseUrl:a,setPublicBaseUrl:p,prefillSource:n.source,inputError:o,phase:c,remainingMs:h,expired:g,generate:m}}var Ma=`0.11.6`;function Na(e){return ze(Ma,e)}function Pa(e){let t=_t(),n=Na(t),r=E(),i=e&&n&&r,{data:a,isFetching:o,refetch:s}=W({...Je({path:{assistant_id:t}}),enabled:i,staleTime:0,refetchOnWindowFocus:!1}),c=(0,Y.useCallback)(()=>{i&&s()},[i,s]);return{status:Fa(a,o),isRefreshing:o,refresh:c}}function Fa(e,t){if(!e)return t?{kind:`checking`}:{kind:`unavailable`};let{lastTunnel:n}=e,r=e.publicBaseUrl??``,i=e.checkedAt??``,a=n?{provider:n.provider}:{};switch(e.state){case`unconfigured`:return{kind:`unconfigured`};case`stopped`:return{kind:`stopped`,...a,...n?{publicBaseUrl:n.publicBaseUrl}:{}};case`healthy`:return{kind:`healthy`,publicBaseUrl:r,checkedAt:i};case`unpairable`:case`unreachable`:return{kind:e.state,publicBaseUrl:r,checkedAt:i,...e.detail?{detail:e.detail}:{},...a};case`foreign`:return{kind:`foreign`,publicBaseUrl:r,checkedAt:i,...e.servingAssistantName?{servingAssistantName:e.servingAssistantName}:{},...a};default:return{kind:`unavailable`}}}var Ia=`tailscale`,La=`public-url`,Ra=new Set([`unpairable`,`unreachable`,`foreign`]),za=`vellum tunnel --help`,Ba=pe(L.docs.pairADevice);function Va(){let{t:e}=G(`settings`),t=mi(),n=oi(),r=z.use.pairedDevicesUI(),i=Pa(n&&t!==null),o=i.status.kind!==`unavailable`;ee(`app.resume`,()=>{i.refresh()}),Gn(ba(i.status)!==null);let s=i.status.kind===`stopped`?null:ya(i.status),c=ja(t?.base??null,o?s:t?.ingressUrl??null),[l,u]=(0,Y.useState)(0),[d,f]=(0,Y.useState)(!1),{copy:p,copied:m}=Lt({errorMessage:e(`pairDeviceCard.copyError`)});if(!t||!n)return null;let g=t.assistantName??e(`pairDeviceCard.subtitleFallbackName`),{phase:_}=c,v=_.kind===`minting`,y=_.kind===`ready`,b=c.prefillSource===`tunnel`,x=o?i.status.kind===`unconfigured`:c.prefillSource===`none`&&c.publicBaseUrl.trim()===``,S=x&&o,C=o&&Ra.has(i.status.kind),T=e(v?`pairDeviceCard.generateButtonMinting`:y?`pairDeviceCard.generateButtonRegenerate`:C?`pairDeviceCard.generateButtonWarned`:`pairDeviceCard.generateButton`),E=o&&s!==null,D=d||c.inputError!==null,O=(0,X.jsx)(h,{variant:C?`outlined`:`primary`,className:`self-start`,disabled:v||c.publicBaseUrl.trim()===``,onClick:c.generate,children:T}),k=(0,X.jsx)(pt,{label:e(`pairDeviceCard.publicUrlLabel`),fullWidth:!0,placeholder:e(`pairDeviceCard.publicUrlPlaceholder`),helperText:e(b?`pairDeviceCard.publicUrlHelperTunnel`:`pairDeviceCard.publicUrlHelper`),value:c.publicBaseUrl,errorText:c.inputError??void 0,disabled:v,onChange:e=>{f(!0),c.setPublicBaseUrl(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c.generate())}});return(0,X.jsx)(J,{title:e(`pairDeviceCard.title`),subtitle:e(`pairDeviceCard.subtitle`,{name:g}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[x&&(0,X.jsx)(B,{tone:`info`,title:e(`pairDeviceCard.noTunnelTitle`),actions:S?(0,X.jsx)(va,{onRefresh:i.refresh,isRefreshing:i.isRefreshing,labelled:!0}):void 0,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelWhy`,{name:g})}),(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`w-fit max-w-full overflow-x-auto px-2.5 py-1.5`),children:xa(Ia,t.assistantName)}),(0,X.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelNext`)}),(0,X.jsx)(`p`,{children:(0,X.jsx)(rn,{i18nKey:`pairDeviceCard.noTunnelMore`,ns:`settings`,values:{command:za},components:{code:(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`px-1.5 py-0.5`)})}})})]})}),(0,X.jsx)(Da,{status:i.status,onRefresh:i.refresh,isRefreshing:i.isRefreshing,assistantName:t.assistantName}),(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:E?(0,X.jsxs)(X.Fragment,{children:[O,(0,X.jsx)(w.Root,{type:`single`,collapsible:!0,value:D?La:``,onValueChange:e=>f(e===La),children:(0,X.jsxs)(w.Item,{value:La,children:[(0,X.jsxs)(w.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e(`pairDeviceCard.publicUrlDisclosure`)}),(0,X.jsx)(wn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,X.jsx)(w.Content,{children:(0,X.jsx)(`div`,{className:`mt-3`,children:k})})]})})]}):(0,X.jsxs)(X.Fragment,{children:[k,O]})}),_.kind===`error`&&(0,X.jsx)(B,{tone:`error`,title:_.message,children:_.hint}),y&&(0,X.jsx)($i,{pairUrl:_.pairUrl,remainingMs:c.remainingMs,expired:c.expired,copied:m,onCopy:p}),(0,X.jsx)(_a,{base:t.base,onApproved:()=>u(e=>e+1)}),r&&(0,X.jsx)(pa,{pollWhilePairing:y&&!c.expired,revalidateKey:l}),(0,X.jsx)(Ve,{href:Ba,tone:`quiet`,glyph:!1,className:`self-start text-body-medium-default text-[var(--content-tertiary)]`,children:e(`pairDeviceCard.learnMore`)})]})})}function Ha(e){return[{scope:`global`,title:e(`shortcutsSections.globalTitle`),description:e(`shortcutsSections.globalDescription`)},{scope:`menu`,title:e(`shortcutsSections.appTitle`),description:e(`shortcutsSections.appDescription`)}]}function Ua({hotkey:e,recording:t,conflictLabel:n,alternateBinding:r,onStartRecording:i,onCancelRecording:a,onReset:o,onRemove:s}){let{t:c}=G(`settings`),l=e.accelerator===``,u=e.override!==null;return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,X.jsx)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c(`shortcutsSections.alreadyUsedBy`,{label:n})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r,t?(0,X.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:c(`shortcutsSections.recordingHint`)}):l?(0,X.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:c(`shortcutsSections.none`)}):(0,X.jsx)(he,{accelerator:e.accelerator}),t?(0,X.jsx)(h,{variant:`ghost`,size:`compact`,onClick:a,children:c(`shortcutsSections.cancel`)}):(0,X.jsx)(h,{variant:`outlined`,size:`compact`,onClick:i,"aria-label":c(`shortcutsSections.recordShortcutAriaLabel`,{label:e.label}),children:c(`shortcutsSections.record`)}),(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:!u,leftIcon:(0,X.jsx)(_n,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":c(`shortcutsSections.resetShortcutAriaLabel`,{label:e.label})}),(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:l,leftIcon:(0,X.jsx)(Sn,{className:`h-3.5 w-3.5`}),onClick:s,"aria-label":c(`shortcutsSections.removeBindingAriaLabel`,{label:e.label})})]})]})}function Wa(){let{t:e}=G(`settings`),{catalog:t,recordingKey:n,conflict:r,startRecording:i,stopRecording:a,resetHotkey:o,removeHotkey:s}=qn(),c=(0,Y.useMemo)(()=>Ha(e).map(e=>({...e,commands:t.filter(t=>t.rebindable&&t.scope===e.scope)})).filter(e=>e.commands.length>0),[t,e]);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[r!==null&&(0,X.jsxs)(B,{tone:`warning`,children:[e(`shortcutsSections.conflictNoticePrefix`,{label:r.label}),` `,e(n===null?`shortcutsSections.conflictResetHint`:`shortcutsSections.conflictRecordingHint`)]}),c.map(e=>(0,X.jsxs)(ct,{bordered:!0,children:[(0,X.jsxs)(`div`,{className:`mb-2`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.title}),(0,X.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,X.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,X.jsx)(Ua,{hotkey:e,recording:n===e.key,conflictLabel:r!==null&&r.key===e.key?r.label:null,onStartRecording:()=>i(e.key),onCancelRecording:a,onReset:()=>o(e.key),onRemove:()=>s(e.key)},e.key))})]},e.scope))]})}async function Ga(){if(!kt())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function Ka(e){if(!kt())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function qa(){let{t:e}=G(`settings`),t=c.useValue(),n=Ee.useValue(),r=!P(),i=Dt();return(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.composerTitle`)}),(0,X.jsxs)(`div`,{className:`mt-2 space-y-4`,children:[r&&(0,X.jsx)(Ot,{checked:t,onChange:c.save,label:e(i?`preferencesModal.sendWithCmdEnter`:`preferencesModal.sendWithCtrlEnter`),helperText:e(i?`preferencesModal.sendWithCmdEnterHelper`:`preferencesModal.sendWithCtrlEnterHelper`)}),(0,X.jsx)(Ot,{checked:n,onChange:Ee.save,label:e(`preferencesModal.showContextWindow`),helperText:e(`preferencesModal.showContextWindowHelper`)})]})]})}function Ja(){let{t:e}=G(`settings`),[t,n]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{Ga().then(n)},[]);let r=async e=>{n(e);try{await Ka(e)}catch{n(!e)}};return(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.launchAtLoginTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(Ft()===`windows`?`preferencesModal.launchAtLoginDescriptionWindows`:`preferencesModal.launchAtLoginDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,children:(0,X.jsx)(Ot,{checked:t,onChange:e=>void r(e),"aria-label":e(`preferencesModal.launchAtLoginAriaLabel`)})})]})}function Ya({open:e,onClose:t}){let{t:n}=G(`settings`);return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(O.Content,{size:`lg`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:n(`preferencesModal.title`)}),(0,X.jsx)(O.Description,{children:n(`preferencesModal.description`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`space-y-6`,children:[kt()&&(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`preferencesModal.keyboardShortcutsTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n(`preferencesModal.keyboardShortcutsDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,children:(0,X.jsx)(Wa,{})})]}),(0,X.jsx)(qa,{}),kt()&&(0,X.jsx)(Ja,{})]})})]})})}function Xa(e){return e===`preview`?`preview`:`stable`}function Za(e,t){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Qa(e){return e.filter(e=>e.ready_to_use)}function $a(e){return e?.feature_enabled===!1}function eo({assistantId:e,onComplete:t}){let{t:n}=G(`settings`),r=z.use.previewChannel(),i=K(),[a,o]=(0,Y.useState)(),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(`restore_backup`),[p,m]=(0,Y.useState)(``),h=Jt({path:{assistant_id:e}}),g=ye({path:{assistant_id:e}}),_=Ht({path:{id:e}}),{data:v,isLoading:y,isError:b}=W({...h,enabled:r,retry:!1}),x=(0,Y.useMemo)(()=>Qa(v?.preview_backups??[]),[v?.preview_backups]),S=x[0],C=x.find(e=>e.snapshot_name===p)??S,T=()=>{i.invalidateQueries({queryKey:g}),i.invalidateQueries({queryKey:_}),t?.()},E=an(Zt()),D=an(Be()),O=Xa(v?.current_channel),k=E.isPending||D.isPending,A=k||$a(v)||!v?.latest_preview_release,j=d===`restore_backup`&&!C;if((0,Y.useEffect)(()=>{o(O===`preview`?`release-channel`:void 0)},[O]),!r)return null;let M=v?.standard_upgrade_available??!1;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(w.Root,{type:`single`,collapsible:!0,value:a,onValueChange:e=>o(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,X.jsxs)(w.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,X.jsxs)(w.Trigger,{className:`group justify-between gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`previewReleaseChannel.title`)}),v&&(0,X.jsx)(He,{tone:O===`preview`?`warning`:`neutral`,children:n(O===`preview`?`previewReleaseChannel.preview`:`previewReleaseChannel.stable`)})]}),(0,X.jsx)(wn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,X.jsx)(w.Content,{children:(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[y&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),n(`previewReleaseChannel.loading`)]}),b&&(0,X.jsx)(B,{tone:`error`,title:n(`previewReleaseChannel.loadErrorTitle`),children:n(`previewReleaseChannel.loadErrorBody`)}),v&&(0,X.jsxs)(X.Fragment,{children:[$a(v)&&(0,X.jsx)(B,{tone:`neutral`,title:n(`previewReleaseChannel.unavailableTitle`),children:n(`previewReleaseChannel.unavailableBody`)}),O===`stable`?(0,X.jsx)(to,{status:v,isChangingChannel:k,optInDisabled:A,onOptIn:()=>c(!0)}):(0,X.jsx)(no,{status:v,isChangingChannel:k,onOptOut:()=>{let e=S;m(e?.snapshot_name??``),f(e?`restore_backup`:M?`standard_upgrade`:`restore_backup`),u(!0)}})]})]})})]})}),(0,X.jsx)(io,{open:s,isPending:E.isPending,previewVersion:v?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await E.mutateAsync({path:{assistant_id:e}});V.success(t.detail||n(`previewReleaseChannel.previewEnabledToast`)),c(!1),T()}catch(e){V.error(Ye(e,void 0,n(`previewReleaseChannel.previewEnableFailedToast`)))}},onCancel:()=>c(!1)}),(0,X.jsx)(ao,{open:l,backups:x,mode:d,selectedSnapshotName:C?.snapshot_name??``,isPending:D.isPending,restoreModeDisabled:j,standardUpgradeAvailable:M,onModeChange:f,onSnapshotChange:m,onConfirm:async()=>{if(!j)try{let t=await D.mutateAsync({path:{assistant_id:e},body:d===`restore_backup`?{mode:`restore_backup`,snapshot_name:C?.snapshot_name}:{mode:`standard_upgrade`}});V.success(t.detail||n(`previewReleaseChannel.stableEnabledToast`)),u(!1),T()}catch(e){V.error(Ye(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>u(!1)})]})}function to({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){let{t:i}=G(`settings`);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(ro,{status:e}),!e.latest_preview_release&&(0,X.jsx)(B,{tone:`neutral`,title:i(`previewReleaseChannel.noPreviewTitle`),children:i(`previewReleaseChannel.noPreviewBody`)}),(0,X.jsx)(h,{variant:`outlined`,loading:t,leftIcon:(0,X.jsx)(gn,{}),disabled:n,onClick:r,children:i(`previewReleaseChannel.optIn`)})]})}function no({status:e,isChangingChannel:t,onOptOut:n}){let{t:r}=G(`settings`);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(ro,{status:e}),(0,X.jsx)(h,{variant:`outlined`,loading:t,leftIcon:(0,X.jsx)(_n,{}),disabled:t,onClick:n,children:r(`previewReleaseChannel.switchBack`)})]})}function ro({status:e}){let{t}=G(`settings`);return(0,X.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestStable`)}),(0,X.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??t(`previewReleaseChannel.none`)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestPreview`)}),(0,X.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??t(`previewReleaseChannel.none`)})]})]})}function io({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){let{t:a}=G(`settings`);return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,X.jsxs)(O.Content,{size:`md`,hideCloseButton:t,children:[(0,X.jsxs)(O.Header,{icon:hn,children:[(0,X.jsx)(O.Title,{children:a(`previewReleaseChannel.optInTitle`)}),(0,X.jsx)(O.Description,{children:a(`previewReleaseChannel.optInDescription`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(B,{tone:`warning`,title:a(`previewReleaseChannel.dataLossTitle`),children:a(`previewReleaseChannel.dataLossBody`)}),(0,X.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,X.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep1`)}),(0,X.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep2`,{version:n??a(`previewReleaseChannel.latest`)})}),(0,X.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep3`)})]})]})}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`outlined`,disabled:t,onClick:i,children:a(`previewReleaseChannel.cancel`)}),(0,X.jsx)(h,{variant:`primary`,disabled:t,loading:t,leftIcon:(0,X.jsx)(gn,{}),onClick:r,children:a(t?`previewReleaseChannel.switching`:`previewReleaseChannel.takeBackupAndSwitch`)})]})]})})}function ao({open:e,backups:n,mode:r,selectedSnapshotName:i,isPending:a,restoreModeDisabled:o,standardUpgradeAvailable:s,onModeChange:c,onSnapshotChange:l,onConfirm:u,onCancel:d}){let{t:f}=G(`settings`),p=f(`previewReleaseChannel.unknownDate`);return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,X.jsxs)(O.Content,{size:`md`,hideCloseButton:a,children:[(0,X.jsxs)(O.Header,{icon:hn,children:[(0,X.jsx)(O.Title,{children:f(`previewReleaseChannel.optOutTitle`)}),(0,X.jsx)(O.Description,{children:f(`previewReleaseChannel.optOutDescription`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(t,{value:r,onValueChange:c,disabled:a,"aria-label":f(`previewReleaseChannel.returnMethodAriaLabel`),children:[(0,X.jsx)(de,{value:`restore_backup`,disabled:n.length===0,label:f(`previewReleaseChannel.restoreBackupLabel`),helperText:f(`previewReleaseChannel.restoreBackupHelper`)}),(0,X.jsx)(de,{value:`standard_upgrade`,disabled:!s,label:f(`previewReleaseChannel.standardUpgradeLabel`),helperText:f(s?`previewReleaseChannel.standardUpgradeHelper`:`previewReleaseChannel.standardUpgradeUnavailable`)})]}),r===`restore_backup`&&n.length>0&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[f(`previewReleaseChannel.safetyBackup`),(0,X.jsx)(De,{value:i,onChange:l,disabled:a,options:n.map(e=>{let t=e.source_release_version?f(`previewReleaseChannel.stableBackupLabel`,{version:e.source_release_version}):e.snapshot_name;return{value:e.snapshot_name,label:f(`previewReleaseChannel.backupOptionLabel`,{name:t,date:Za(e.created_at,p)})}})})]}),r===`restore_backup`&&n.length===0&&!s&&(0,X.jsx)(B,{tone:`error`,title:f(`previewReleaseChannel.requiresBackupTitle`),children:f(`previewReleaseChannel.requiresBackupBody`)}),r===`standard_upgrade`&&(0,X.jsx)(B,{tone:`error`,title:f(`previewReleaseChannel.mayNotSurviveTitle`),children:f(`previewReleaseChannel.mayNotSurviveBody`)})]})}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`outlined`,disabled:a,onClick:d,children:f(`previewReleaseChannel.cancel`)}),(0,X.jsx)(h,{variant:r===`standard_upgrade`?`danger`:`primary`,disabled:a||o||r===`standard_upgrade`&&!s,loading:a,leftIcon:(0,X.jsx)(mn,{}),onClick:u,children:f(a?`previewReleaseChannel.switching`:`previewReleaseChannel.switchToStable`)})]})]})})}function oo(){let{t:e}=G(`settings`),t=D.use.user(),n=(0,Y.useCallback)(e=>{jt(e),window.location.reload()},[]);if(!ht(t))return null;let i=Ge(),a=r(),o=a.version??e(`previewUiChannel.versionUnknown`);return(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`previewUiChannel.title`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.description`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(a.channel===`preview`?`previewUiChannel.runningPreview`:`previewUiChannel.runningStable`,{version:o})}),i&&a.channel===`stable`&&(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.unavailableHint`)})]}),(0,X.jsx)(`div`,{className:`shrink-0`,children:(0,X.jsx)(Ot,{checked:i,onChange:n,"aria-label":e(i?`previewUiChannel.onAriaLabel`:`previewUiChannel.offAriaLabel`)})})]})}var so=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function co(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&so.has(e.error)?`That size isn't available on your plan.`:Ye(e,void 0,t)}function lo({assistant:e,healthz:t,healthzLoading:n,healthzFetching:r,healthzPolling:o,refetch:s,refetchUntilResized:c}){let{t:l}=G(`settings`),u=cn(),d=W(At()),f=d.data,p=!e.is_local,m=f?.plan_id===`pro`,g=W({...i(),enabled:m}),_=e.machine_size||`small`,v=Nn(g.data?.max_machine_tier??null),y=(0,Y.useMemo)(()=>In(v,_,(0,X.jsx)(He,{tone:`positive`,children:l(`resizeCard.current`)})),[v,_,l]),b=g.data?.selected_storage_gib??null,[x,S]=(0,Y.useState)(!1),C=v.length>0?v[v.length-1]:null,[w,T]=(0,Y.useState)(null),E=w??C??_,[D,k]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(null),M=ut({onSuccess:(e,n)=>{V.success(l(`resizeCard.toastStarted`),{id:`assistant-resize`}),j(null),T(null),S(!1),n.body?.machine_size==null?s():c(t)},onError:e=>{j(co(e,l(`resizeCard.resizeFailed`)))}});if(d.isError&&f==null)return(0,X.jsx)(J,{id:`storage-resources`,title:l(`resizeCard.title`),subtitle:l(`resizeCard.subtitle`),children:(0,X.jsx)(B,{tone:`error`,children:l(`resizeCard.subscriptionLoadError`)})});let N=m&&v.includes(E)&&E!==_?E:null,P=m&&b!=null&&!0,ee=m&&v.length>0&&Fn(_)<Fn(v[v.length-1]),F=M.isPending||o,I=b==null?t?.disk?.totalMb??null:b*1024,te=t?.disk&&I!=null?{value:t.disk.usedMb,max:I,caption:l(`resizeCard.usedOf`,{used:Hn(t.disk.usedMb),total:Hn(I)})}:null,ne=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,re=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:l(`resizeCard.usedOf`,{used:Hn(t.memory.currentMb),total:Hn(t.memory.maxMb)})}:null,ie=(0,X.jsx)(h,{variant:`ghost`,size:`compact`,onClick:()=>k(!0),children:l(`resizeCard.resize`)}),ae=p?m?P?(0,X.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,X.jsx)(pn,{className:`h-3.5 w-3.5`}),l(`resizeCard.increaseStorage`)]}):(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:l(`resizeCard.resize`)}):ie:null,oe=p?m?ee?(0,X.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,X.jsx)(pn,{className:`h-3.5 w-3.5`}),l(`resizeCard.increaseSize`)]}):(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:l(`resizeCard.resize`)}):ie:null;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(J,{id:`storage-resources`,title:l(`resizeCard.title`),subtitle:l(`resizeCard.subtitle`),compactAccessory:!0,accessory:(0,X.jsx)(h,{variant:`ghost`,size:`compact`,loading:r||o,iconOnly:(0,X.jsx)(mn,{}),tooltip:l(o?`resizeCard.applyingResize`:`resizeCard.refreshMetrics`),"aria-label":l(`resizeCard.refreshMetrics`),disabled:r||o,onClick:()=>void s()}),children:(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,X.jsx)(On,{className:`h-3.5 w-3.5`})}),(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.disk`)})]}),ae]}),(0,X.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.storage`)}),te?(0,X.jsx)(Rn,{value:te.value,max:te.max,caption:te.caption}):n?(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`})}):(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.unavailable`)})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,X.jsx)(Yn,{className:`h-3.5 w-3.5`})}),(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.machine`)}),(0,X.jsx)(He,{tone:`neutral`,children:Pn[_]})]}),oe]}),(0,X.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.cpu`)}),ne?(0,X.jsx)(Rn,{value:ne.value,max:ne.max,caption:ne.caption}):n?(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`})}):(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.memory`)}),re?(0,X.jsx)(Rn,{value:re.value,max:re.max,caption:re.caption}):n?(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`})}):(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,X.jsx)(O.Root,{open:D,onOpenChange:e=>{e||k(!1)},children:(0,X.jsxs)(O.Content,{size:`sm`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:l(`resizeCard.upgradeTitle`)}),(0,X.jsx)(O.Description,{children:l(`resizeCard.upgradeDescription`)})]}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`ghost`,onClick:()=>k(!1),children:l(`resizeCard.cancel`)}),(0,X.jsx)(h,{onClick:()=>{k(!1),u(L.plans)},children:l(`resizeCard.upgrade`)})]})]})}),(0,X.jsx)(O.Root,{open:x,onOpenChange:e=>{e||(S(!1),T(null),j(null))},children:(0,X.jsxs)(O.Content,{size:`sm`,children:[(0,X.jsxs)(O.Header,{icon:Yn,children:[(0,X.jsx)(O.Title,{children:l(`resizeCard.modalTitle`)}),(0,X.jsx)(O.Description,{children:l(`resizeCard.modalDescription`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v.length===0?(0,X.jsx)(B,{tone:`warning`,children:l(`resizeCard.noMachineTier`)}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:l(`resizeCard.machineSize`)}),(0,X.jsx)(De,{options:y,value:E,onChange:T,"aria-label":l(`resizeCard.machineSizeAriaLabel`),"data-testid":`resize-machine-size`})]}),P?(0,X.jsx)(B,{tone:`info`,children:l(`resizeCard.storageExpandTo`,{to:b})}):(0,X.jsx)(B,{tone:`neutral`,children:l(`resizeCard.storageUnchanged`)}),A&&(0,X.jsx)(B,{tone:`error`,children:A})]})}),(0,X.jsxs)(O.Footer,{className:`items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:(0,X.jsx)(rn,{ns:`settings`,i18nKey:`resizeCard.needMore`,components:{upgradeLink:(0,X.jsx)(ln,{to:L.plans,className:a(yt({tone:`quiet`}),`text-[var(--content-secondary)] decoration-[var(--border-element)] underline-offset-2`),onClick:()=>S(!1)})}})}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(h,{variant:`ghost`,onClick:()=>{S(!1),T(null),j(null)},children:l(`resizeCard.cancel`)}),(0,X.jsx)(h,{disabled:N==null&&!P||F,loading:F,onClick:()=>{j(null);let t={};N!=null&&(t.machine_size=N),P&&b!=null&&(t.storage_gib=b),M.mutate({path:{id:e.id},body:t})},children:l(A?`resizeCard.retry`:`resizeCard.apply`)})]})]})]})})]})}function uo({assistantId:e}){let{t}=G(`settings`),n=cn(),r=K(),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(h,{variant:`dangerOutline`,onClick:()=>a(!0),className:`shrink-0`,children:t(`retireAssistant.button`)}),(0,X.jsx)(it,{open:i,isPending:o,onConfirm:async()=>{s(!0);let t=await nt(r,e);if(t.ok){a(!1),n(t.nextRoute,{replace:!0});return}V.error(t.error),s(!1),a(!1)},onCancel:()=>a(!1)})]})}var fo=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function po(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...fo].sort()}function mo(e,t,n){let r=parseInt(n??`0`,10);if(r>59)return null;let i=parseInt(t??`0`,10)*60+r;return(e===`-`?-1:1)*i}function ho(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);n&&(i=mo(n[1],n[2],n[3])??0)}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function go(){return po().map(e=>ho(e)).filter(e=>e!==null)}function _o(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function vo(e,t){if(!e)return t;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}function yo(e){if(e===`utc`||e===`gmt`)return 0;let t=e.match(/^(?:utc|gmt)?\s*([+-])(\d{1,2})(?::?(\d{2}))?$/);if(!t)return null;let n=mo(t[1],t[2],t[3]);return n!==null&&Math.abs(n)<=840?n:null}var bo=200,xo=[];function So({value:e,onChange:t}){let{t:n}=G(`settings`),[r,i]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(!1),c=(0,Y.useMemo)(()=>o?go():xo,[o]),l=r.trim().toLowerCase(),u=(0,Y.useMemo)(()=>{let e=yo(l);return(l?c.filter(t=>e===null?t.city.toLowerCase().includes(l)||t.region.toLowerCase().includes(l)||t.offsetLabel.toLowerCase().includes(l)||t.identifier.toLowerCase().includes(l):t.offsetMinutes===e):c).slice(0,bo)},[c,l]),d=(0,Y.useMemo)(()=>u.map(e=>e.identifier),[u]),f=(0,Y.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]);return(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.timezone`)}),(0,X.jsxs)(le.Root,{className:`w-full md:max-w-[280px]`,options:d,value:e,onSelect:t,onOpenChange:e=>{if(e){s(!0);return}i(``)},autoActivateFirst:l.length>0,children:[(0,X.jsx)(le.Input,{type:`text`,"aria-label":n(`timezonePicker.timezone`),value:r,placeholder:f||n(`timezonePicker.searchPlaceholder`),onChange:e=>i(e.target.value),fullWidth:!0}),(0,X.jsx)(le.List,{"aria-label":n(`timezonePicker.timezonesAriaLabel`),className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,emptyState:(0,X.jsx)(`p`,{className:`px-3 py-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.noMatches`)}),children:u.map(e=>(0,X.jsxs)(le.Option,{value:e.identifier,className:a(`flex w-full items-center justify-between gap-3 px-3 py-2`,`text-body-medium-lighter text-[var(--content-default)] transition-colors`,`hover:bg-[var(--surface-active)]`,`data-[active]:bg-[var(--surface-active)] aria-selected:bg-[var(--surface-active)]`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate text-body-medium-default`,children:e.city}),e.region&&(0,X.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.region})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,X.jsx)(`span`,{children:_o(e.identifier)}),(0,X.jsx)(`span`,{children:e.offsetLabel})]})]},e.identifier))})]})]}),(0,X.jsx)(Kn,{}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.zoneName`)}),(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:vo(e,n(`timezonePicker.notSet`))})]})]})}function Co(){let{t:e}=G(`settings`),t=T.use.activeAssistantId(),[n,r]=(0,Y.useState)(()=>Ie(`timezone`,``)),i=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{i.current=t},[t]);let a=(0,Y.useRef)(!1),o=(0,Y.useRef)(null),s=(0,Y.useRef)(()=>{}),c=e=>{if(a.current){o.current=e;return}let t=i.current;if(!t){o.current=null;return}a.current=!0,o.current=null,k.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{R(e,{context:`settings-timezone-override`})}).finally(()=>{a.current=!1;let e=o.current;o.current=null,e!==null&&s.current(e)})};return(0,Y.useEffect)(()=>{s.current=c}),(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`timezoneSection.title`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`timezoneSection.description`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(So,{value:n,onChange:e=>{r(e),Tt(`timezone`,e),c(e)}})})]})}var wo=[0,1,2,3,4,5,6];function To(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function Eo(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function Do(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function Oo(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:To(t),windowEnd:To(n)}}function ko({assistantId:e}){let{t}=G(`settings`),n=K(),r=[t(`updateWindowPolicy.dayMon`),t(`updateWindowPolicy.dayTue`),t(`updateWindowPolicy.dayWed`),t(`updateWindowPolicy.dayThu`),t(`updateWindowPolicy.dayFri`),t(`updateWindowPolicy.daySat`),t(`updateWindowPolicy.daySun`)],{data:i,isLoading:a,isError:o}=W(se({path:{id:e}})),s=(0,Y.useMemo)(()=>Oo(i),[i]),[c,u]=(0,Y.useState)(null),d=c??s,f=c!==null,p=(0,Y.useMemo)(()=>Do(),[]),[m,g]=(0,Y.useState)(null),_=m??d.daysOfMonth.join(`, `),v=an({mutationFn:async t=>{let{data:n}=await l({path:{id:e},body:t,throwOnError:!0});return n}}),y=e=>{u(t=>({...t??s,...e}))},b=e=>{y({daysOfWeek:d.daysOfWeek.includes(e)?d.daysOfWeek.filter(t=>t!==e):[...d.daysOfWeek,e].sort((e,t)=>e-t)})},x=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return a?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),t(`updateWindowPolicy.loading`)]}):o?(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`updateWindowPolicy.loadError`)}):(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(Ot,{checked:d.enabled,onChange:e=>y({enabled:e}),label:t(`updateWindowPolicy.automaticUpdates`),helperText:t(`updateWindowPolicy.automaticUpdatesHelper`)}),d.enabled&&(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.frequency`)}),(0,X.jsx)(`div`,{className:`max-w-[400px]`,children:(0,X.jsx)(ke,{ariaLabel:t(`updateWindowPolicy.frequency`),value:d.frequency,onChange:e=>{e!==`monthly`&&g(null),y({frequency:e})},items:[{value:`daily`,label:t(`updateWindowPolicy.daily`)},{value:`weekly`,label:t(`updateWindowPolicy.weekly`)},{value:`monthly`,label:t(`updateWindowPolicy.monthly`)}]})})]}),d.frequency===`weekly`&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.daysOfWeek`)}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:wo.map(e=>(0,X.jsx)(h,{variant:`outlined`,size:`compact`,active:d.daysOfWeek.includes(e),onClick:()=>b(e),children:r[e]},e))})]}),d.frequency===`monthly`&&(0,X.jsx)(pt,{label:t(`updateWindowPolicy.daysOfMonth`),type:`text`,value:_,onChange:e=>g(e.target.value),onBlur:e=>{let t=x(e.target.value);y({daysOfMonth:t}),g(t.join(`, `))},placeholder:t(`updateWindowPolicy.daysOfMonthPlaceholder`),helperText:t(`updateWindowPolicy.daysOfMonthHelper`),className:`w-48`}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:p?t(`updateWindowPolicy.updateWindowWithTz`,{tz:p}):t(`updateWindowPolicy.updateWindow`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(pt,{type:`time`,value:d.windowStart,onChange:e=>y({windowStart:e.target.value})}),(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t(`updateWindowPolicy.to`)}),(0,X.jsx)(pt,{type:`time`,value:d.windowEnd,onChange:e=>y({windowEnd:e.target.value})})]})]})]}),(0,X.jsx)(h,{variant:`primary`,loading:v.isPending,onClick:async()=>{let r=d.frequency===`monthly`&&m!==null?x(m):d.daysOfMonth;try{await v.mutateAsync({enabled:d.enabled,timezone:`UTC`,schedule:{frequency:d.frequency,days_of_week:d.frequency===`weekly`?d.daysOfWeek:[],days_of_month:d.frequency===`monthly`?r:[],window:{start:Eo(d.windowStart),end:Eo(d.windowEnd)}}}),V.success(t(`updateWindowPolicy.toastSaved`)),u(null),g(null),n.invalidateQueries({queryKey:at({path:{id:e}})})}catch{V.error(t(`updateWindowPolicy.toastSaveFailed`))}},disabled:v.isPending||!f,children:t(`updateWindowPolicy.savePolicy`)})]})}function Ao({assistantId:e,open:t,onClose:n}){let{t:r}=G(`settings`);return(0,X.jsx)(O.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(O.Content,{size:`md`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:r(`updateWindowModal.title`)}),(0,X.jsx)(O.Description,{children:r(`updateWindowModal.description`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsx)(ko,{assistantId:e})})]})})}function jo(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function Mo({open:e,onOpenChange:t}){let{t:n}=G(`settings`),r=K(),[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(!1),f=(0,Y.useRef)(e),p=()=>r.invalidateQueries({queryKey:Se()}),m=e=>{Ct({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},g=Gt({onSuccess:e=>{if(!f.current){m(e.factor_id);return}a(e)},onError:e=>{let r=jo(e);r===`no_workos_account`?V.error(n(`enrollTotpModal.toastNoWorkosAccount`)):r===`throttled`||r===`workos_rate_limited`?V.error(n(`enrollTotpModal.toastThrottled`)):r===`factor_limit_reached`?V.error(n(`enrollTotpModal.toastFactorLimitReached`)):V.error(n(`enrollTotpModal.toastStartFailed`)),t(!1)}}),_=d({onSuccess:e=>{e.valid?(u.current=!0,V.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1)):l(n(`enrollTotpModal.errorCodeMismatch`))},onError:e=>{let r=jo(e);if(r===`challenge_already_verified`){u.current=!0,V.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1);return}if(r===`challenge_expired`||r===`challenge_not_found`){i&&m(i.factor_id),a(null),s(``),l(n(`enrollTotpModal.errorSessionExpired`)),g.mutate({});return}if(r===`throttled`||r===`workos_rate_limited`){l(n(`enrollTotpModal.errorThrottledInline`));return}l(n(`enrollTotpModal.errorVerifyFailed`))}});(0,Y.useEffect)(()=>{f.current=e,e&&(u.current=!1,a(null),s(``),l(null),g.mutate({}))},[e]);let v=e=>{!e&&_.isPending||(!e&&i&&!u.current&&m(i.factor_id),t(e))},y=()=>{i&&Qt(i.secret,{successMessage:n(`enrollTotpModal.copySuccess`),errorMessage:n(`enrollTotpModal.copyError`)})},b=()=>{!i||o.length!==6||_.isPending||(l(null),_.mutate({body:{challenge_id:i.challenge_id,code:o}}))};return(0,X.jsx)(O.Root,{open:e,onOpenChange:v,children:(0,X.jsxs)(O.Content,{size:`sm`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:n(`enrollTotpModal.title`)}),(0,X.jsx)(O.Description,{children:n(`enrollTotpModal.description`)})]}),(0,X.jsx)(O.Body,{children:i===null?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,X.jsx)(q,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,X.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,X.jsx)(`img`,{src:i.qr_code,alt:n(`enrollTotpModal.qrCodeAlt`),className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.manualKeyHint`)}),(0,X.jsxs)(`button`,{type:`button`,onClick:y,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,X.jsx)(`span`,{className:`break-all text-left`,children:i.secret}),(0,X.jsx)(Cn,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,X.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.codeLabel`)}),(0,X.jsx)(pt,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:n(`enrollTotpModal.codePlaceholder`),value:o,onChange:e=>s(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,X.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`outlined`,onClick:()=>v(!1),disabled:_.isPending,children:n(`enrollTotpModal.cancel`)}),(0,X.jsx)(h,{onClick:b,disabled:i===null||o.length!==6||_.isPending,children:_.isPending?n(`enrollTotpModal.verifying`):n(`enrollTotpModal.verify`)})]})]})})}function No(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Po(){let{t:e}=G(`settings`),t=K(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(null),o=W({...Bt()}),s=o.data??[],c=()=>t.invalidateQueries({queryKey:Se()}),l=ve({onSuccess:()=>{V.success(e(`twoFactorSection.toastRemoved`)),c()},onError:t=>{if(jo(t)===`factor_not_found`){c();return}V.error(e(`twoFactorSection.toastRemoveFailed`))}});return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.isPending?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),(0,X.jsx)(`span`,{className:`text-body-medium-default`,children:e(`twoFactorSection.loading`)})]}):o.isError?(0,X.jsx)(B,{tone:`error`,children:(0,X.jsx)(rn,{ns:`settings`,i18nKey:`twoFactorSection.loadError`,components:{retryButton:(0,X.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void o.refetch()})}})}):s.length===0?(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`twoFactorSection.emptyDescription`)}):(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:s.map(t=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(Tn,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`twoFactorSection.authenticatorApp`)}),(0,X.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[t.user,t.created_at?e(`twoFactorSection.addedOn`,{date:No(t.created_at)}):``]})]})]}),(0,X.jsx)(h,{variant:`dangerOutline`,onClick:()=>a(t),disabled:l.isPending,children:e(`twoFactorSection.remove`)})]},t.id))}),!o.isPending&&!o.isError&&s.length===0&&(0,X.jsx)(h,{onClick:()=>r(!0),className:`self-start`,children:e(`twoFactorSection.addAuthenticatorApp`)}),(0,X.jsx)(Mo,{open:n,onOpenChange:r}),(0,X.jsx)(M,{open:i!==null,title:e(`twoFactorSection.removeDialogTitle`),message:e(`twoFactorSection.removeDialogMessage`),confirmLabel:e(`twoFactorSection.removeDialogConfirm`),destructive:!0,onConfirm:()=>{i&&l.mutate({path:{id:i.id}}),a(null)},onCancel:()=>a(null)})]})}var Q=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Fo=`local`,Io=`docker`,Lo=`vellum`;function Ro(e){switch((e??``).toLowerCase()){case Fo:return`local`;case Io:return`docker`;case Lo:return`managed`;default:return`other`}}function zo(e){let t=Ro(e);return t===`managed`?`local`:t===`local`?`platform`:null}function Bo(e){switch(e){case`docker`:return`teleportCard.moveToDocker`;case`platform`:return`teleportCard.moveToPlatform`;case`local`:return`teleportCard.moveToLocal`}}var Vo={macos:`Macos`,windows:`Windows`,linux:`Linux`};function Ho(e,t=`macos`){switch(e){case`docker`:return`teleportCard.dockerDescription${Vo[t]}`;case`platform`:return`teleportCard.platformDescription`;case`local`:return`teleportCard.localDescription${Vo[t]}`}}function Uo(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}var Wo=3600*1e3;function Go(e,t=Date.now(),n=Wo){for(let r of e){if(!r)continue;let e=Date.parse(r);if(Number.isNaN(e))continue;let i=t-e;if(i>=0&&i<=n)return!0}return!1}function Ko(e){return e.filter(e=>e.ready_to_use!==!1).map(e=>e.created_at)}function qo(e,t){return e.some(e=>e.snapshot_name===t&&e.ready_to_use===!0)}async function Jo(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function Yo(e){let t=S(e);if(!t)throw new Q(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function Xo(e,t){let n=await ot(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function Zo(e,t){let n=Yo(e),r=await Xo(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new Q(`export_failed`,`Export failed (HTTP ${i.status}).`);return Jo(i,t)}async function Qo(e,t){let n=Yo(e),r=await Xo(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new Q(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await ns(i);if(a&&a.success===!1)throw new Q(`import_failed`,a.error??`Import reported failure`)}async function $o(e){let t=Yo(e),n=await Xo(e,t),r=await fetch(`${t}/v1/backups/create`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`backup_failed`,U(`settings:teleportCard.backupLocalFailed`,{status:r.status}));let i=await ns(r);if(i&&i.success===!1)throw new Q(`backup_failed`,U(`settings:teleportCard.backupLocalReportedFailure`))}async function es(e,t){let{data:n,response:r}=await k.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new Q(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new Q(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function ts(e,t){let{data:n,response:r}=await k.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new Q(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new Q(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function ns(e){try{return await e.json()}catch{return null}}async function rs(e,t={}){let n=Ro(e.cloud);if(n===`managed`)return os(e.assistantId,t);if(n===`local`)return $o(e);throw new Q(`backup_failed`,U(`settings:teleportCard.backupUnsupported`))}async function is(e){let t=await _e({path:{assistant_id:e},throwOnError:!1});if(!(t.response?.ok??!1))throw new Q(`backup_failed`,U(`settings:teleportCard.backupListFailed`,{status:t.response?.status??0}));let n=t.data?.backups;return Array.isArray(n)?n:[]}var as=e=>new Promise(t=>setTimeout(t,e));async function os(e,t){if(Go(Ko(await is(e))))return;let n=await Wt({path:{assistant_id:e},throwOnError:!1});if(!(n.response?.ok??!1))throw new Q(`backup_failed`,U(`settings:teleportCard.backupCreateFailed`,{status:n.response?.status??0}));let r=n.data,i=r?.snapshot_name;if(!i)throw new Q(`backup_failed`,U(`settings:teleportCard.backupNoSnapshotName`));if(r?.ready_to_use===!0)return;let a=t.readyTimeoutMs??6e5,o=t.readyPollIntervalMs??5e3,s=Date.now()+a;for(;Date.now()<s;)if(await as(o),qo(await is(e),i))return;throw new Q(`backup_failed`,U(`settings:teleportCard.backupNotReady`,{snapshot:i,seconds:Math.round(a/1e3)}))}async function ss(e){if(e.kind===`managed`)return e.id;try{let t=await gt(e.id,{allowGatewayRepair:!1});return C(t)?t:null}catch(e){return e instanceof _?e.platformAssistantId:null}}var cs=new Set([500,502,503,504]),$=3,ls=e=>new Promise(t=>setTimeout(t,e));async function us(e,t=new Set){for(let n=0;n<=$;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<$&&cs.has(o)&&!t.has(o)){await ls(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new Q(`unknown`,`Unexpected retry loop exit`)}async function ds(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await us(()=>k.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new Q(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new Q(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function fs(e,t){let{status:n,data:r,error:i}=await us(()=>k.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=Uo(i);if(e)throw new Q(`version_mismatch`,e)}if(n!==200&&n!==201)throw new Q(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function ps(e,t,n){for(let r=0;r<=$;r++){let i=await ms(e,t,n);if(r<$&&cs.has(i)){await ls(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new Q(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function ms(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new Q(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new Q(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function hs(e,t){for(let n=0;n<=$;n++){let r=await fetch(e,{method:`GET`});if(n<$&&cs.has(r.status)){await ls(2**n*1e3),t?.(0);continue}if(!r.ok)throw new Q(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return Jo(r,t)}throw new Q(`import_failed`,`Unexpected retry loop exit`)}async function gs(e){let{status:t,data:n,error:r}=await us(()=>k.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function _s(e){let{status:t,data:n}=await us(()=>k.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new Q(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var vs=5e3,ys=36e5,bs=5*6e4,xs=30,Ss=e=>new Promise(t=>setTimeout(t,e));function Cs(){let e=cn(),t=K(),r=n(),i=zo(r?.cloud),[a,o]=(0,Y.useState)({kind:`idle`}),[s,c]=(0,Y.useState)(!1),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=(0,Y.useCallback)(e=>{o({kind:`transferring`,step:e,progress:null})},[]),f=(0,Y.useCallback)(e=>{o(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,Y.useCallback)(async()=>{if(!(!r||!i)){u.current={id:r.assistantId,kind:Ro(r.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(d(U(`settings:teleportCard.backupStep`)),await rs(r),i===`platform`)await ws(r,d,f,l);else if(i===`local`)await Ts(r,d,f,l);else throw new Q(`unknown`,U(`settings:teleportCard.unsupportedDestination`));o({kind:`verifying`})}catch(e){o({kind:`failed`,error:U(`settings:teleportCard.teleportFailed`,{message:e instanceof Q||e instanceof Error?e.message:U(`settings:teleportCard.teleportFailedUnknown`)})}),R(e,{context:`teleport-execute`}),await Ds(t,l.current,u.current,`teleport-execute-cleanup`),l.current=null}}},[r,i,d,f,t]),m=(0,Y.useCallback)(()=>c(!0),[]),h=(0,Y.useCallback)(()=>c(!1),[]),g=(0,Y.useCallback)(()=>{c(!1),p()},[p]),_=(0,Y.useCallback)(()=>{l.current=null,u.current=null,o({kind:`idle`})},[]);return{destination:i,phase:a,confirmOpen:s,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,Y.useCallback)(()=>{let n=l.current,r=u.current;n&&(d(U(`settings:teleportCard.switchingStep`)),(async()=>{let i=null;try{let e=D.getState();n.kind===`managed`?await e.connectPlatformAssistant(n.id):await e.connectLocalAssistant(n.id),i=await ss(n),n.kind===`local`&&(i===null&&R(Error(`teleport successor could not be resolved`),{context:`teleport-successor-unresolved`}),Mt(n.id,{onError:e=>R(e,{context:`teleport-inject-platform-identity`})}))}catch(e){o({kind:`failed`,error:U(`settings:teleportCard.switchFailed`,{message:e instanceof Error?e.message:U(`settings:teleportCard.switchFailedUnknown`)})}),R(e,{context:`teleport-confirm-switch`});return}r&&nt(t,r.id,{successorAssistantId:i??void 0}).then(e=>{e.ok||R(Error(e.error),{context:`teleport-retire-source`})}),_(),e(L.assistant,{replace:!0})})())},[e,_,t,d]),cancelTeleport:(0,Y.useCallback)(()=>{let e=l.current,n=u.current;l.current=null,u.current=null,o({kind:`idle`}),Ds(t,e,n,`teleport-cancel-retire-target`)},[t]),reset:_}}async function ws(e,t,n,r){t(U(`settings:teleportCard.stepExportingLocal`));let i=await Zo(e,n);t(U(`settings:teleportCard.stepResolvingOrganization`));let a=await ks();t(U(`settings:teleportCard.stepCheckingExisting`));let o=(await rt({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new Q(`existing_platform_assistant`,U(`settings:teleportCard.existingPlatformAssistant`,{id:o.id}));t(U(`settings:teleportCard.stepUploading`));let s=await ds(e.resources?.runtimeVersion);await ps(s.url,i,n),t(U(`settings:teleportCard.stepSettingUpCloud`));let c=await Qe(void 0,`create`);if(!c.ok)throw new Q(`import_failed`,U(`settings:teleportCard.cloudSetupFailed`));if(c.status===200)throw new Q(`existing_platform_assistant`,U(`settings:teleportCard.existingPlatformAssistant`,{id:c.data.id}));let l=c.data.id;await be({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:u(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await Ut(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(U(`settings:teleportCard.stepFinalizingCloud`)),await As(l),t(U(`settings:teleportCard.stepImportingToCloud`));let d=await gs(s.bundleKey);if(d.status<200||d.status>=300){let e=d.body;throw new Q(`import_failed`,e?.error??U(`settings:teleportCard.importFailedHttp`,{status:d.status}))}if(d.status===202){let e=d.body?.job_id;if(!e)throw new Q(`import_failed`,U(`settings:teleportCard.importNoJobId`));await js(e)}else{let e=d.body;if(e&&e.success===!1)throw new Q(`import_failed`,e.error??U(`settings:teleportCard.importReportedFailure`))}}async function Ts(e,t,n,r){t(U(`settings:teleportCard.stepPreparingExport`));let i=await ds(await Os(e.assistantId),`runtime`);t(U(`settings:teleportCard.stepExportingCloud`));let a=await es(e.assistantId,i.url);await Ms(e.assistantId,a),t(U(`settings:teleportCard.stepPreparingLocal`));let{assistant:o,createdFresh:s}=await Ns();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Es(o,s);if(!c)throw new Q(`local_assistant_not_found`,U(`settings:teleportCard.localRuntimeVersionUnknown`));t(U(`settings:teleportCard.stepPreparingImport`));let l=await fs(i.bundleKey,c);t(U(`settings:teleportCard.stepDownloading`));let u=await hs(l,n);t(U(`settings:teleportCard.stepImporting`)),await Fs(o,u),await Ut(e.assistantId)}async function Es(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await Mn())?.version??void 0}async function Ds(e,t,n,r){if(t?.createdFresh){let n=await nt(e,t.id);n.ok||R(Error(n.error),{context:r})}n&&await Ut(n.id)}async function Os(e){let t=await lt(e);return t.ok?t.data.version??void 0:void 0}async function ks(){let e=Me.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=Me.getState().organizations,n=je();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new Q(`no_organizations`,U(`settings:teleportCard.noOrganizations`));if(t.length>1)throw new Q(`multiple_organizations`,U(`settings:teleportCard.multipleOrganizations`));let r=t[0].id;return Me.getState().setCurrentOrganizationId(r),r}async function As(e){let t=Date.now();for(;Date.now()-t<bs;){let{data:t,response:n}=await I({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await Ss(vs)}}async function js(e){let t=Date.now();for(;Date.now()-t<ys;){await Ss(vs);let t=await _s(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new Q(`import_failed`,t.error??U(`settings:teleportCard.importJobFailed`))}throw new Q(`import_failed`,U(`settings:teleportCard.importTimedOut`))}async function Ms(e,t){let n=Date.now();for(;Date.now()-n<ys;)if(await Ss(vs),await ts(e,t)===`complete`)return;throw new Q(`export_timed_out`,U(`settings:teleportCard.exportTimedOut`))}async function Ns(){let e=await s(void 0,void 0);if(!e.ok)throw new Q(`local_assistant_not_found`,e.error??U(`settings:teleportCard.localCreateFailed`));await It();let t=e.assistantId?Oe().find(t=>t.assistantId===e.assistantId):Ps();if(!t)throw new Q(`local_assistant_not_found`,U(`settings:teleportCard.localNotFound`));return{assistant:t,createdFresh:!0}}function Ps(){return Oe().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function Fs(e,t){let n;for(let r=0;r<xs;r++)try{await Qo(e,t);return}catch(e){n=e,await Ss(1e3)}throw n instanceof Error?n:new Q(`import_failed`,U(`settings:teleportCard.importFailed`))}function Is(){let{t:e}=G(`settings`),t=Cs(),{destination:n,phase:r}=t,i=ie();return!n||i===`gated`?null:(0,X.jsxs)(J,{title:e(`teleportCard.title`),subtitle:e(`teleportCard.subtitle`),children:[r.kind===`idle`&&i===`disabled`&&(0,X.jsx)(H,{children:e(`teleportCard.loginNotice`)}),r.kind===`idle`&&i===`full`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(Ho(n,Ft()))}),(0,X.jsx)(h,{variant:`outlined`,className:`self-start`,onClick:t.requestTeleport,children:e(Bo(n))})]}),r.kind===`transferring`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r.progress==null&&(0,X.jsx)(q,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r.step})]}),r.progress!=null&&(0,X.jsx)(Ke,{value:r.progress,"aria-label":e(`teleportCard.progressAriaLabel`),className:`max-w-[240px]`})]}),r.kind===`verifying`&&(0,X.jsx)(B,{tone:`success`,icon:(0,X.jsx)(An,{className:`h-4 w-4`}),title:e(`teleportCard.verifyTitle`),actions:(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(h,{variant:`primary`,onClick:t.confirmAndSwitch,children:e(`teleportCard.confirmAndSwitch`)}),(0,X.jsx)(h,{variant:`outlined`,onClick:t.cancelTeleport,children:e(`teleportCard.cancel`)})]})}),r.kind===`failed`&&(0,X.jsx)(B,{tone:`error`,title:r.error,actions:(0,X.jsx)(h,{variant:`outlined`,onClick:t.reset,children:e(`teleportCard.tryAgain`)})}),(0,X.jsx)(M,{open:t.confirmOpen,title:e(Bo(n)),message:e(`teleportCard.confirmMessage`),confirmLabel:e(`teleportCard.confirmLabel`),onConfirm:t.confirm,onCancel:t.cancelConfirm})]})}function Ls(){let{t:e}=G(`settings`),{assistant:t,healthz:r,healthzLoading:i,healthzFetching:a,healthzPolling:o,refetch:s,refetchUntilResized:c}=Bn(),l=z.use.multiPlatformAssistant(),u=z.use.accountMfa(),d=Pe.use.settingsSleepPolicy(),f=en(),p=Fe(),g=wt()||f||Ue()||p,_=cn(),v=ie(),y=ie({platformHostedOnly:!0}),b=tt(),x=m({assistantId:t?.id??null,enabled:y===`full`&&b}),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[E,D]=sn();(0,Y.useEffect)(()=>{if(E.get(`preferences`)!==`open`)return;let e=new URLSearchParams(E);e.delete(`preferences`),D(e,{replace:!0}),T(!0)},[E,D]);let O=t?.is_local&&!wt()?null:t,k=n(),A=wt()&&!!t&&!!k&&vt(k),j=A,M=A&&!Ue(),N=y===`full`&&!!O||M&&!!t;(0,Y.useEffect)(()=>{!t||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[t]);let P=r?.version??t?.current_release_version??null,ee=()=>{let e=fe();if(Ue()&&!p&&e){let t=new URLSearchParams({register:Et()}),n=Ae();n&&t.set(`name`,n);let r=new URL(e).origin;window.location.assign(`${r}${L.selectAssistant}?${t.toString()}`);return}_(`${L.selectAssistant}?noAutoSkip=1`)},F=(v===`full`||j)&&!!O||v===`disabled`&&!j,I=y!==`gated`;return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[x.status&&x.mode!==`inactive`&&(0,X.jsx)(Ze,{status:x.status,mode:x.mode,isAcknowledging:x.isAcknowledging,acknowledgeError:x.acknowledgeError?.message??null,onAcknowledge:()=>void x.acknowledge(),onReviewWorkspaceData:()=>void _(`${L.workspace}?sort=size`),onUpgradeStorage:y===`full`?()=>void _(L.plans):null}),(0,X.jsxs)(jn,{assistant:b?O:null,showHandles:f&&v===`full`,children:[(0,X.jsx)(Co,{}),u&&v!==`gated`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.twoFactorTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.twoFactorDescription`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:v===`disabled`?(0,X.jsx)(H,{children:e(`generalPage.twoFactorLoginNotice`)}):(0,X.jsx)(Po,{})})]})]})]}),(0,X.jsx)(J,{title:e(`generalPage.versionTitle`),subtitle:e(`generalPage.versionSubtitle`),accessory:y===`full`&&O?(0,X.jsx)(h,{variant:`outlined`,onClick:()=>C(!0),children:e(`generalPage.updateWindow`)}):void 0,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[y===`full`&&O&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($r,{assistantId:O.id,currentVersion:P,releaseChannel:O.release_channel,onUpgradeComplete:()=>{s()}}),(0,X.jsx)(eo,{assistantId:O.id,onComplete:()=>{s()}})]}),M&&t&&(0,X.jsx)(ei,{assistantId:t.id,currentVersion:P,onUpgradeComplete:()=>{s()}}),!N&&t&&(0,X.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.current`)}),(0,X.jsx)(Vn,{version:P,loading:i&&!t.current_release_version,assistantId:t.id??null})]}),y===`disabled`&&!M&&(0,X.jsx)(H,{children:e(`generalPage.updatesLoginNotice`)}),(0,X.jsx)(oo,{})]})}),y===`full`&&O&&(0,X.jsx)(Ao,{assistantId:O.id,open:S,onClose:()=>C(!1)}),y===`full`&&t&&(0,X.jsx)(lo,{assistant:t,healthz:r,healthzLoading:i,healthzFetching:a,healthzPolling:o,refetch:s,refetchUntilResized:c}),y===`disabled`&&(0,X.jsx)(J,{id:`storage-resources`,title:e(`generalPage.computeResourcesTitle`),subtitle:e(`generalPage.computeResourcesSubtitle`),children:(0,X.jsx)(H,{children:e(`generalPage.computeResourcesLoginNotice`)})}),(0,X.jsx)(J,{title:e(`generalPage.preferencesTitle`),subtitle:e(`generalPage.preferencesSubtitle`),accessory:(0,X.jsx)(h,{variant:`outlined`,onClick:()=>T(!0),children:e(`generalPage.customize`)}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsx)(Zn,{}),(0,X.jsx)(Vr,{})]})}),(0,X.jsx)(Ya,{open:w,onClose:()=>T(!1)}),(0,X.jsx)(ii,{}),(0,X.jsx)(Va,{}),y===`full`&&O&&d&&(0,X.jsx)(J,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,X.jsx)(Yr,{assistantId:O.id})}),y===`disabled`&&d&&(0,X.jsx)(J,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,X.jsx)(H,{children:e(`generalPage.sleepPolicyLoginNotice`)})}),l&&!g&&(0,X.jsx)(Wr,{}),g&&(0,X.jsx)(J,{title:e(`generalPage.switchAssistantTitle`),subtitle:e(`generalPage.switchAssistantSubtitle`),accessory:(0,X.jsx)(h,{variant:`outlined`,onClick:ee,children:e(`generalPage.chooseAssistant`)})}),kt()&&(0,X.jsx)(Is,{}),(F||I)&&(0,X.jsx)(J,{variant:`danger`,title:e(`generalPage.dangerZoneTitle`),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[F&&(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.retireAssistantTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.retireAssistantDescription`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:(v===`full`||j)&&O?(0,X.jsx)(uo,{assistantId:O.id}):(0,X.jsx)(H,{children:e(`generalPage.retireAssistantLoginNotice`)})})]}),F&&I&&(0,X.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,X.jsx)(ti,{})]})})]})}export{Ls as GeneralPage};
2
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$S as t,$b as n,$d as r,$u as i,AC as a,AS as o,Ax as s,B as c,B_ as l,Bx as u,Cd as d,Cu as f,Da as p,Dr as m,EC as h,Ea as g,Eg as _,Eu as v,Fc as y,Fi as b,Fx as x,Gb as S,Gg as C,IS as w,Ib as T,Ih as E,Im as D,JS as O,J_ as k,Jg as A,Jx as j,KS as M,Kh as N,Ko as P,Ld as ee,M as F,M_ as I,Mm as te,Mx as ne,N as re,Nm as ie,OS as ae,Oh as oe,Ou as se,P as ce,PS as le,P_ as ue,QS as de,Qb as fe,Qx as pe,Ri as me,SC as he,SS as ge,S_ as _e,Sd as ve,Su as ye,Sx as be,Ta as xe,Td as Se,Tg as Ce,Tu as we,Uh as Te,V as Ee,WS as De,Wb as Oe,XS as ke,Xb as Ae,Xg as je,Zg as Me,_a as Ne,_f as Pe,_g as Fe,aS as Ie,ba as Le,bd as Re,bg as ze,bu as Be,by as Ve,cC as He,cx as Ue,dg as We,eS as L,ef as Ge,fC as Ke,fg as qe,fp as Je,gS as Ye,gg as Xe,gn as Ze,h_ as Qe,hd as $e,hg as et,jm as tt,jo as nt,k_ as rt,ko as it,ku as at,kx as ot,lS as R,lg as st,mC as ct,m_ as lt,md as ut,mg as dt,mn as ft,nC as pt,nS as mt,nf as ht,ng as gt,nt as _t,nv as z,nx as vt,oC as yt,pC as B,pg as bt,pn as xt,pu as St,qS as V,q_ as Ct,rx as wt,sS as Tt,s_ as Et,sg as Dt,tC as Ot,tS as kt,td as At,tf as jt,tg as Mt,uS as Nt,ud as Pt,ug as Ft,ux as It,vy as Lt,wS as Rt,wa as zt,wd as Bt,wg as Vt,wu as Ht,wx as Ut,x_ as Wt,xd as Gt,xg as Kt,xi as qt,xu as Jt,yS as Yt,ya as Xt,yn as H,yu as Zt,yy as Qt,z_ as $t,zm as en}from"./app-DENERwru.js";import{$ as tn,E as nn,I as U,N as rn,Qn as W,Yn as an,j as G,k as on,tr as K}from"./vendor-DEhKVoiV.js";import{_ as sn,f as cn,n as ln,t as un,v as dn,x as fn}from"./react-B9IgSVeK.js";import{$ as pn,At as mn,D as hn,Dt as gn,Et as _n,Ji as vn,V as yn,Ya as bn,Yn as q,_r as xn,i as Sn,li as Cn,qi as wn,rt as Tn,vn as En,wa as Dn,xr as On,yn as kn,zi as An}from"./icons-C0wyat6T.js";import{t as J}from"./detail-card-DDxZkd-7.js";import{n as jn}from"./profile-card-BsnTkBKo.js";import{t as Mn}from"./app-info-Df8Zh1Ev.js";import{a as Nn,i as Pn,l as Fn,o as In}from"./machine-sizes-BWbhowrp.js";import{t as Ln}from"./format-countdown-D18PVUfL.js";import{a as Rn,i as zn,n as Bn,r as Vn,t as Hn}from"./assistant-status-panel-BPk7Kxlr.js";import{t as Un}from"./trait-cycle-row-CjHGJs48.js";import{n as Wn,r as Gn,t as Kn}from"./settings-divider-Dt6RBWfk.js";import{t as qn}from"./use-hotkey-recorder-G8nr82pe.js";var Jn=bn(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Yn=bn(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Xn=bn(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),Y=e(fn(),1),X=un();function Zn(){let{t:e}=G(`settings`),t=z.use.velvet(),{theme:n,setThemePreference:r}=b(),i=[{value:`system`,label:e(`themePicker.system`),icon:(0,X.jsx)(kn,{className:`h-4 w-4`})},{value:`light`,label:e(`themePicker.light`),icon:(0,X.jsx)(yn,{className:`h-4 w-4`})},{value:`dark`,label:e(`themePicker.dark`),icon:(0,X.jsx)(En,{className:`h-4 w-4`})},...t?[{value:`velvet`,label:e(`themePicker.velvet`),icon:(0,X.jsx)(xn,{className:`h-4 w-4`})}]:[]];return(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`themePicker.title`)}),(0,X.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,X.jsx)(ke,{ariaLabel:e(`themePicker.ariaLabel`),value:n,onChange:r,items:i})})]})}var Qn=.5,$n={dazed:.55,bashful:.4},er=.224,tr=`var(--surface-sunken)`,nr=64;function rr(e){return $n[e]??Qn}function ir(e,t,n,r){let i=e?.eyeStyles.find(e=>e.id===t);if(!i||i.paths.length===0)return null;let a=Le(i.paths.map(e=>Xt(e.svgPath)));if(a.w<=0||a.h<=0)return null;let o=n*(r?Qn:rr(t)),s=Math.min(o/a.w,o/a.h),c=n/2-(a.x+a.w/2)*s,l=n/2-(a.y+a.h/2)*s;return{paths:i.paths,transform:`matrix(${s},0,0,${s},${c},${l})`}}function ar({components:e,eyeStyle:t,color:n,primary:r=!1,fieldColor:i,size:a=nr,className:o}){let s=(0,Y.useMemo)(()=>ir(e,t,a,r),[e,t,a,r]),c=e?.colors.find(e=>e.id===n)?.hex,l=i??c,u=a*er;return(0,X.jsxs)(`svg`,{"aria-hidden":`true`,"data-testid":`app-icon-preview`,className:o,width:a,height:a,viewBox:`0 0 ${a} ${a}`,style:{display:`block`,flexShrink:0},children:[(0,X.jsx)(`rect`,{"data-testid":`app-icon-preview-field`,width:a,height:a,rx:u,ry:u,fill:l??tr}),s?(0,X.jsx)(`g`,{"data-testid":`app-icon-preview-eyes`,transform:s.transform,children:s.paths.map((e,t)=>(0,X.jsx)(`path`,{d:e.svgPath,fill:e.color},t))}):null]})}var or={production:`#4C9B50`,staging:`#E9C91A`,dev:`#FF88C9`};Ne.eyeStyles.find(e=>e.id===`quirky`);var sr=`avatar-eyes-`,cr={eyeStyle:`quirky`,color:`green`};function lr(e,t){return`${sr}${e}-${t}`}function ur(e){if(e===null||e.kind!==`character`)return null;let t=e.traits;return Te(t)?lr(t.eyeStyle,t.color):null}function dr(e){return e!==null&&e.startsWith(sr)}function fr(e){if(e===null||!dr(e))return null;let t=e.slice(12),n=t.indexOf(`-`);return n<=0||n===t.length-1?null:{eyeStyle:t.slice(0,n),color:t.slice(n+1)}}function pr(e,t){let n=ur(e);return{target:n,availableMatch:t.supported&&n!==null&&t.available.includes(n)}}var mr=160;function hr(e,t,n){return t<=0?0:(e+n+t)%t}function gr(e,t){let n=e?.findIndex(e=>e.id===t)??-1;return n>=0?n:0}function _r({open:e,onClose:t,components:n,currentIcon:r,targetIcon:i,canSyncAvatar:a,availableIcons:o,onApply:s,onReset:c}){let{t:l}=G(`settings`),u=et(),[d,f]=(0,Y.useState)(0),[p,m]=(0,Y.useState)(0),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(!1),b=a?fr(i):null;(0,Y.useEffect)(()=>{if(!e)return;let t=fr(r)??fr(i)??cr;f(gr(n?.eyeStyles,t.eyeStyle)),m(gr(n?.colors,t.color)),y(!1)},[e,n,r,i]);let x=n?.eyeStyles[d],S=n?.colors[p],C=x?.id??cr.eyeStyle,w=S?.id??cr.color,T=lr(C,w),E=T!==r&&o.includes(T),D=async e=>{_(!0),y(!1);try{await e()?t():y(!0)}finally{_(!1)}};return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(O.Content,{size:`sm`,"data-testid":`app-icon-modal`,children:[(0,X.jsx)(O.Header,{children:(0,X.jsx)(O.Title,{children:l(`appIcon.title`)})}),(0,X.jsxs)(O.Body,{className:`space-y-4`,children:[(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(`div`,{className:`rounded-2xl bg-[var(--surface-sunken)] p-6`,children:(0,X.jsx)(ar,{components:n,eyeStyle:C,color:w,size:mr})})}),(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(Un,{label:l(`appIcon.eyes`),value:C,onPrev:()=>f(hr(d,n?.eyeStyles.length??0,-1)),onNext:()=>f(hr(d,n?.eyeStyles.length??0,1))}),(0,X.jsx)(Un,{label:l(`appIcon.color`),value:w,colorHex:S?.hex,onPrev:()=>m(hr(p,n?.colors.length??0,-1)),onNext:()=>m(hr(p,n?.colors.length??0,1))})]}),b===null?null:(0,X.jsx)(h,{type:`button`,variant:`outlined`,fullWidth:!0,disabled:g,onClick:()=>{b!==null&&(f(gr(n?.eyeStyles,b.eyeStyle)),m(gr(n?.colors,b.color)),y(!1))},children:l(`appIcon.matchAvatar`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:l(u?`appIcon.androidApplyNote`:`appIcon.note`)}),v?(0,X.jsx)(`p`,{role:`alert`,className:`text-body-small-lighter text-[color:var(--system-negative-strong)]`,children:l(u?`appIcon.androidError`:`appIcon.error`)}):null]}),(0,X.jsxs)(O.Footer,{children:[r===null?null:(0,X.jsx)(h,{type:`button`,variant:`outlined`,disabled:g,onClick:()=>void D(c),children:l(`appIcon.reset`)}),(0,X.jsx)(h,{type:`button`,variant:`primary`,disabled:g||!E,onClick:()=>void D(()=>s(T)),children:l(`appIcon.apply`)})]})]})})}var vr=`AppIcon`,yr=on(vr);function br(){return{supported:!1,current:null,available:[]}}function xr(){return st()&&nn.isPluginAvailable(vr)}async function Sr(){if(!xr())return br();try{let{supported:e,current:t,available:n}=await yr.getState();return{supported:e===!0,current:typeof t==`string`?t:null,available:n??[]}}catch(e){return R(e,{context:`app_icon_get_state`,bestEffort:!0}),br()}}async function Cr(e){if(!xr())return!1;try{let{ok:t,error:n}=await yr.set({name:e});return t===!0?!0:(R(Error(n??`setAlternateIconName failed`),{context:`app_icon_set`,bestEffort:!0}),!1)}catch(e){return R(e,{context:`app_icon_set`,bestEffort:!0}),!1}}var wr={supported:!1,current:null,available:[]};function Tr(e,t){return e.supported===t.supported&&e.current===t.current&&e.available.length===t.available.length&&e.available.every((e,n)=>e===t.available[n])}var Er=o(tn()((e,t)=>({snapshot:wr,setSnapshot:n=>{Tr(t().snapshot,n)||e({snapshot:n})}}))),Dr=[];function Or(e){let t=Xe(),n=et(),r=z.use.androidAvatarAppIcon(),i=t||n&&r,{state:a}=oe(e),o=Er.use.snapshot(),s=Er.use.setSnapshot(),c=(0,Y.useCallback)(async()=>{if(!i)return s(wr),wr;let e=await Sr();return s(e),e},[i,s]);(0,Y.useEffect)(()=>{c()},[c]),ee(`app.resume`,()=>{c()});let l=i&&o.supported,{target:u,availableMatch:d}=pr(a,o),f=d&&u!==o.current,p=o.available,m=(0,Y.useCallback)(async e=>{if(!l||!p.includes(e))return!1;await Cr(e);let t=await c();return t.supported&&t.current===e},[l,p,c]),h=(0,Y.useCallback)(async()=>{if(!l)return!1;await Cr(null);let e=await c();return e.supported&&e.current===null},[l,c]);return{enabled:l,currentIcon:l?o.current:null,targetIcon:l?u:null,availableIcons:l?p:Dr,canSyncAvatar:f,apply:m,reset:h}}var kr=[`ai.vocify-inc.vellum-assistant-ios`,`ai.vellum.assistant`],Ar={"":`production`,".staging":`staging`,".dev":`dev`};function jr(e){for(let t of kr){if(!e.startsWith(t))continue;let n=Ar[e.slice(t.length)];if(n)return n}return null}async function Mr(){try{let{App:e}=await dn(async()=>{let{App:e}=await import(`./esm-DwZucAaM.js`);return{App:e}},__vite__mapDeps([0,1,2,3])),{id:t}=await e.getInfo();return jr(t)}catch(e){return console.debug(`[shell-environment] no native shell identity:`,e),null}}function Nr(){let[e,t]=(0,Y.useState)();return(0,Y.useEffect)(()=>{let e=!0;return Mr().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}var Pr=32,Fr={dev:{displayP3:`color(display-p3 0.9387 0.55755 0.7777)`,srgb:or.dev},staging:{displayP3:`color(display-p3 0.89313 0.79283 0.2841)`,srgb:or.staging}},Ir={local:`dev`,dev:`dev`,staging:`staging`};function Lr(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`color`,`color(display-p3 1 1 1)`)}function Rr(e){if(e)return Lr()?e.displayP3:e.srgb}function zr(e){if(e)return e;if(e===null)return Ir.local}function Br(e,t){let n=zr(e);if(!n)return;let r=Fr[n];return t?r?.srgb:Rr(r)}function Vr(){let e=T.use.activeAssistantId(),t=Or(e);return t.enabled?(0,X.jsx)(Hr,{assistantId:e,sync:t}):null}function Hr({assistantId:e,sync:t}){let{t:n}=G(`settings`),{components:r}=oe(e),i=qt(),a=Nr(),o=et(),[s,c]=(0,Y.useState)(!1),l=r??i,u=fr(t.currentIcon),d=u??cr,f=u===null;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:n(`appIcon.title`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:n(`appIcon.description`)})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,X.jsx)(ar,{components:l,eyeStyle:d.eyeStyle,color:d.color,primary:f,fieldColor:f?Br(a,o):void 0,size:Pr}),(0,X.jsx)(h,{variant:`outlined`,onClick:()=>c(!0),children:n(`appIcon.change`)})]})]}),(0,X.jsx)(_r,{open:s,onClose:()=>c(!1),components:l,currentIcon:t.currentIcon,targetIcon:t.targetIcon,canSyncAvatar:t.canSyncAvatar,availableIcons:t.availableIcons,onApply:t.apply,onReset:t.reset})]})}var Ur=St({query:{hosting:`platform`}});function Wr(){let{t:e}=G(`settings`),t=_t(),n=W(Ur),r=n.data?.results??[];return n.isPending||r.length<2?null:(0,X.jsx)(J,{title:e(`assistantPicker.title`),subtitle:e(`assistantPicker.subtitle`),children:(0,X.jsx)(`div`,{className:`space-y-2`,children:r.map(n=>{let r=n.id===t;return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${r?`border-[var(--border-active)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-base)]`}`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(kn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:n.name||e(`assistantPicker.unnamed`)}),n.status!==`active`&&(0,X.jsx)(He,{tone:`warning`,children:n.status})]})})]}),(0,X.jsx)(`div`,{className:`shrink-0`,children:r?(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,X.jsx)(vn,{className:`h-4 w-4`}),e(`assistantPicker.active`)]}):(0,X.jsx)(h,{variant:`outlined`,size:`compact`,disabled:n.status!==`active`,onClick:()=>{A(n.id),V.success(e(`assistantPicker.switchedToast`))},children:e(`assistantPicker.switch`)})})]},n.id)})})})}var Gr=[0,300,600,3600,10800,86400,259200,604800,1209600,2592e3],Kr=new Set([300,600]);function qr(e,t){if(e===0)return t(`assistantSleepPolicy.neverSleep`);let n=Math.floor(e/86400),r=Math.floor(e%86400/3600);if(n>0&&r>0)return t(`assistantSleepPolicy.daysHours`,{days:n,hours:r});if(n>0)return t(`assistantSleepPolicy.days`,{days:n});if(r>0)return t(`assistantSleepPolicy.hours`,{hours:r});let i=Math.floor(e/60);return i>0?t(`assistantSleepPolicy.minutes`,{minutes:i}):t(`assistantSleepPolicy.seconds`,{seconds:e})}function Jr(e,t){switch(e){case 0:return t(`assistantSleepPolicy.presetNever`);case 300:return t(`assistantSleepPolicy.preset5Min`);case 600:return t(`assistantSleepPolicy.preset10Min`);case 3600:return t(`assistantSleepPolicy.preset1Hour`);case 10800:return t(`assistantSleepPolicy.preset3Hours`);case 86400:return t(`assistantSleepPolicy.preset1Day`);case 259200:return t(`assistantSleepPolicy.preset3Days`);case 604800:return t(`assistantSleepPolicy.preset7Days`);case 1209600:return t(`assistantSleepPolicy.preset14Days`);case 2592e3:return t(`assistantSleepPolicy.preset30Days`);default:return qr(e,t)}}function Yr({assistantId:e}){let{t}=G(`settings`),n=K(),r=me.use.isNonProduction(),i=(0,Y.useMemo)(()=>Gr.filter(e=>!Kr.has(e)||r),[r]),{data:a,isLoading:o,isError:s}=W(we({path:{id:e}})),c=(0,Y.useMemo)(()=>a?.idle_timeout_seconds??259200,[a]),[l,u]=(0,Y.useState)(null),d=l??c,f=l!==null,p=$e({onSuccess:()=>{V.success(t(`assistantSleepPolicy.savedToast`)),u(null),n.invalidateQueries({queryKey:v({path:{id:e}})})},onError:()=>{V.error(t(`assistantSleepPolicy.saveErrorToast`))}});return o?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),t(`assistantSleepPolicy.loading`)]}):s?(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`assistantSleepPolicy.loadError`)}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:t(`assistantSleepPolicy.idleTimeout`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.idleTimeoutDescription`)}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:i.map(e=>(0,X.jsx)(h,{variant:`outlined`,active:d===e,onClick:()=>u(e),children:Jr(e,t)},e))}),(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.current`,{duration:qr(d,t)})})]}),f&&(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(h,{variant:`primary`,loading:p.isPending,onClick:()=>p.mutate({path:{id:e},body:{idle_timeout_seconds:d}}),disabled:p.isPending,children:t(`assistantSleepPolicy.save`)}),(0,X.jsx)(h,{variant:`outlined`,onClick:()=>u(null),disabled:p.isPending,children:t(`assistantSleepPolicy.cancel`)})]})]})}function Xr(e,t,n){let r=[e.version];return e.version===n&&r.push(U(`settings:assistantUpgrades.latestSuffix`)),t&&e.version===t&&r.push(U(`settings:assistantUpgrades.currentSuffix`)),r.join(` `)}var Zr=3e3;function Qr({version:e,assistantId:t}){let{onTap:n,message:r}=zn(t);return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,X.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-positive-strong)]`,children:r})]})}function $r({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let{t:i}=G(`settings`),a=Pe.use.rollbackEnabled(),o=z.use.previewChannel(),s=K(),c=xe(n,o),l=c===`preview`,[u,d]=(0,Y.useState)(!1),p=(0,Y.useRef)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(null),C=e=>e&&p.current&&e===p.current?(queueMicrotask(()=>{S(i(y?`assistantUpgrades.successRolledBack`:`assistantUpgrades.successUpdated`,{version:p.current})),d(!1),p.current=null,g(null),V.success(i(y?`assistantUpgrades.toastRollbackComplete`:`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):Zr;W({...f({path:{id:e}}),refetchInterval:u?e=>C(e.state.data?.current_release_version):!1});let{data:w,isLoading:T}=W(Pt({query:{channel:c}})),E=w?.find(e=>e.is_stable!==!1)??w?.[0],D=m??E?.version??null,O=(0,Y.useMemo)(()=>{if(!a||!D||!t)return!1;let e=Ce(D),n=Ce(t);return!e||!n?!1:Vt(e,n)<0},[a,D,t]),k=(0,Y.useMemo)(()=>{if(!D)return!1;if(!t)return!0;let e=Ce(D),n=Ce(t);if(!e||!n)return D!==t;let r=Vt(e,n);return a?r!==0:r>0},[a,D,t]),A=an({mutationFn:async t=>{let{data:n}=await $t({path:{id:e},body:t,throwOnError:!0});return n}}),j=an({mutationFn:async t=>{let{data:n}=await ue({path:{id:e},body:t,throwOnError:!0});return n}}),N=async()=>{v(!1),S(null);let t=a?D??void 0:void 0;try{if(O){let e=await j.mutateAsync({version:t});p.current=e.version??t??null,V.success(e.detail||i(`assistantUpgrades.toastRollbackInitiated`,{version:t}))}else{let e=await A.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){V.warning(e.detail);return}p.current=e.version??t??null,V.success(e.detail||i(`assistantUpgrades.toastUpdateInitiated`,{version:e.version??t??i(`assistantUpgrades.latest`)}))}b(O),d(!0),s.invalidateQueries({queryKey:Ht({path:{id:e}})})}catch{V.error(i(O?`assistantUpgrades.toastRollbackFailed`:`assistantUpgrades.toastUpdateFailed`))}},P=i(l?`assistantUpgrades.previewRelease`:k?O?`assistantUpgrades.rollbackTo`:`assistantUpgrades.updateTo`:`assistantUpgrades.selected`);return(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i(`assistantUpgrades.current`)}),(0,X.jsx)(Qr,{version:t,assistantId:e})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:P}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-center md:gap-4`,children:[(0,X.jsx)(`span`,{className:`block min-w-0 flex-1`,children:T?(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`}),i(`assistantUpgrades.loading`)]}):w&&w.length>0?a?(0,X.jsx)(De,{value:D??``,onChange:e=>g(e===E?.version?null:e),disabled:u||A.isPending||j.isPending,options:w.map(e=>({value:e.version,label:Xr(e,t,E?.version)}))}):(0,X.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:E?Xr(E,t,E.version):`—`}):i(`assistantUpgrades.noReleases`)}),(0,X.jsx)(h,{variant:O?`outlined`:`primary`,className:`min-w-[160px] shrink-0`,loading:A.isPending||j.isPending||u,leftIcon:(0,X.jsx)(mn,{}),onClick:()=>v(!0),disabled:!k||A.isPending||j.isPending||u||T||!w?.length,children:i(u?y?`assistantUpgrades.rollingBack`:`assistantUpgrades.updating`:O?`assistantUpgrades.rollback`:l?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`)})]})]})]}),l&&(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:(0,X.jsx)(rn,{ns:`settings`,i18nKey:`assistantUpgrades.usingPreviewReleases`,components:{stableLink:(0,X.jsx)(`a`,{href:`#preview-release-channel`,className:yt()})}})}),!k&&t&&D&&!T&&(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:x??i(`assistantUpgrades.alreadyOnVersion`)}),(0,X.jsx)(M,{open:_,title:i(O?`assistantUpgrades.confirmRollbackTitle`:l?`assistantUpgrades.confirmPreviewTitle`:`assistantUpgrades.confirmUpdateTitle`),message:O?i(`assistantUpgrades.confirmRollbackMessage`,{version:D??i(`assistantUpgrades.unknown`)}):i(l?`assistantUpgrades.confirmPreviewMessage`:`assistantUpgrades.confirmUpdateMessage`,{version:D??i(`assistantUpgrades.latest`)}),confirmLabel:i(O?`assistantUpgrades.rollback`:l?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`),onConfirm:N,onCancel:()=>v(!1)})]})}function ei({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let{t:r}=G(`settings`),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),{data:c,isLoading:l}=W(Pt({query:{stable:!0,limit:100}})),u=(0,Y.useMemo)(()=>zt(c),[c]),d=u?.version,f=t?g(t,d):!!d,m=p({assistantId:e,targetVersion:d});return(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.current`)}),(0,X.jsx)(Qr,{version:t,assistantId:e})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.updateTo`)}),(0,X.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?r(`assistantUpgrades.loading`):d&&u?Xr(u,t,d):r(`assistantUpgrades.noReleases`)})]})]}),(0,X.jsx)(h,{variant:`primary`,className:`min-w-[160px]`,loading:m.isPending,leftIcon:(0,X.jsx)(mn,{}),onClick:()=>a(!0),disabled:m.isPending||l||!d||!f,children:m.isPending?r(`assistantUpgrades.updating`):d?r(`assistantUpgrades.updateToVersion`,{version:d}):r(`assistantUpgrades.update`)}),o&&(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:o}),!o&&!f&&d&&!l&&(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:r(`assistantUpgrades.alreadyOnVersion`)}),(0,X.jsx)(M,{open:i,title:r(`assistantUpgrades.confirmUpdateTitle`),message:r(`assistantUpgrades.confirmUpdateMessage`,{version:d??r(`assistantUpgrades.latest`)}),confirmLabel:r(`assistantUpgrades.update`),onConfirm:async()=>{a(!1),s(null);try{s(r(`assistantUpgrades.successUpdated`,{version:(await m.upgrade()).version??d??r(`assistantUpgrades.latest`)})),V.success(r(`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){V.error(e instanceof Error?e.message:r(`assistantUpgrades.toastUpdateFailed`))}},onCancel:()=>a(!1)})]})}function ti(){let{t:e}=G(`settings`),t=ie({platformHostedOnly:!0}),n=te(),r=D.use.user()?.id??null,i=D.use.logout(),[a,o]=(0,Y.useState)(!1),s=Re({onSuccess:async()=>{V.success(e(`deleteAccountSection.toastRequested`)),N(r),await i(),y(L.account.login)},onError:()=>{V.error(e(`deleteAccountSection.toastFailed`))}}),c=t===`full`&&n;return(0,Y.useEffect)(()=>{c&&a&&o(!1)},[c,a]),t===`gated`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`deleteAccountSection.title`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`deleteAccountSection.description`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:t===`disabled`?(0,X.jsx)(H,{children:e(`deleteAccountSection.platformLoginNotice`)}):(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(h,{variant:`dangerOutline`,onClick:()=>o(!0),disabled:s.isPending||c,className:`self-start`,children:e(`deleteAccountSection.deleteMyAccount`)}),c&&(0,X.jsx)(q,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,X.jsx)(M,{open:a,title:e(`deleteAccountSection.confirmTitle`),message:e(`deleteAccountSection.confirmMessage`),confirmLabel:e(`deleteAccountSection.confirmLabel`),destructive:!0,onConfirm:()=>{if(c){o(!1);return}o(!1),s.mutate({})},onCancel:()=>o(!1)})]})}function ni({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,X.jsx)(J,{title:e,subtitle:t,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,X.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,X.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,X.jsx)(h,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function ri({promotion:e}){let{t}=G(`settings`),{appName:n,target:r}=e;return(0,Y.useEffect)(()=>{ft(`settings`,r)},[r]),(0,X.jsx)(ni,{title:n===null?t(`nativeAppCard.titleGeneric`):t(`nativeAppCard.title`,{appName:n}),subtitle:n===null?t(`nativeAppCard.subtitleGeneric`):t(`nativeAppCard.subtitle`,{appName:n}),benefits:[{icon:Dn,text:t(`nativeAppCard.benefitPush`)},{icon:Jn,text:t(`nativeAppCard.benefitBiometric`)},{icon:Xn,text:t(`nativeAppCard.benefitHaptics`)},{icon:Tn,text:t(`nativeAppCard.benefitHomeScreen`)}],ctaLabel:t(`nativeAppCard.download`),ctaLeftIcon:(0,X.jsx)(Tn,{size:16}),onAction:()=>{xt(`click`,`settings`,r),ce(r),F(r)}})}function ii(){let e=bt(),t=qe(),n=We(),r=dt();return!e&&!t&&!n&&!r?null:(0,X.jsx)(ri,{promotion:re(e||t?`ios`:n?`android`:null)})}var ai=`0.10.0`;function oi(){return Kt(ai)}var si=`/v1/remote-web/pairing-challenge`,ci=`/v1/remote-web/pairing-verification`,li=`/v1/remote-web/pairing-requests`,ui=`${li}/approve`,di=`${li}/deny`;function fi(){return U(`settings:pairDeviceClient.connectivityHint`)}var Z=class extends Error{hint;status;code;constructor(e,t={}){super(e),this.name=`PairDeviceError`,this.hint=t.hint,this.status=t.status,this.code=t.code}},pi=5e3;function mi(){if(typeof window>`u`)return null;let e=n(),t=S(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function hi(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}function gi(e){let t=e?.error?.code;return typeof t==`string`&&t?t:void 0}async function _i(e,t,n,r){let i;try{i=await fetch(e,{...t,signal:n})}catch(e){throw Nt(e)?e:new Z(U(`settings:pairDeviceClient.networkError`))}let a=await i.json().catch(()=>null);if(!i.ok)throw new Z(hi(a)??U(`settings:pairDeviceClient.httpError`,{status:i.status}),{hint:r,status:i.status,code:gi(a)});if(typeof a!=`object`||!a)throw new Z(U(`settings:pairDeviceClient.unexpectedResponse`));return a}function vi(e,t,n,r){return _i(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)},n,r)}async function yi(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await vi(`${t}${si}`,{publicBaseUrl:n},r,fi());try{await vi(`${t}${ci}`,{userCode:i.userCode},r,fi())}catch(e){let n=AbortSignal.timeout(pi);throw Nt(e)?bi(t,i.userCode,n):await bi(t,i.userCode,r?AbortSignal.any([r,n]):n),e}return{pairUrl:Rt(i),expiresAt:i.expiresAt}}async function bi(e,t,n){try{let r=(await xi({base:e,signal:n})).find(e=>e.userCode===t);r&&await wi({base:e,requestId:r.requestId,signal:n})}catch(e){if(Nt(e))return;R(e,{context:`pair-device-orphan-cleanup`,bestEffort:!0})}}async function xi(e){let t=await _i(`${e.base}${li}`,{method:`GET`},e.signal);return Array.isArray(t.requests)?t.requests:[]}async function Si(e,t){await vi(`${t.base}${e}`,{requestId:t.requestId},t.signal)}function Ci(e){return Si(ui,e)}function wi(e){return Si(di,e)}var Ti=Object.defineProperty,Ei=Object.getOwnPropertySymbols,Di=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,ki=(e,t,n)=>t in e?Ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ai=(e,t)=>{for(var n in t||={})Di.call(t,n)&&ki(e,n,t[n]);if(Ei)for(var n of Ei(t))Oi.call(t,n)&&ki(e,n,t[n]);return e},ji=(e,t)=>{var n={};for(var r in e)Di.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ei)for(var r of Ei(e))t.indexOf(r)<0&&Oi.call(e,r)&&(n[r]=e[r]);return n},Mi;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(Mi||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Mi||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Mi||={});var Ni=Mi,Pi={L:Ni.QrCode.Ecc.LOW,M:Ni.QrCode.Ecc.MEDIUM,Q:Ni.QrCode.Ecc.QUARTILE,H:Ni.QrCode.Ecc.HIGH},Fi=128,Ii=`L`,Li=`#FFFFFF`,Ri=`#000000`,zi=!1,Bi=1,Vi=4,Hi=0,Ui=.1;function Wi(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function Gi(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function Ki(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*Ui),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function qi(e,t){return t==null?e?Vi:Hi:Math.max(Math.floor(t),0)}function Ji({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Y.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Ni.QrSegment.makeSegments(t)),e),[]);return Ni.QrCode.encodeSegments(r,Pi[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Y.useMemo(()=>{let e=c.getModules(),t=qi(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Ki(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Yi=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Xi=Y.forwardRef(function(e,t){let n=e,{value:r,size:i=Fi,level:a=Ii,bgColor:o=Li,fgColor:s=Ri,includeMargin:c=zi,minVersion:l=Bi,boostLevel:u,marginSize:d,imageSettings:f}=n,p=ji(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=ji(p,[`style`]),g=f?.src,_=Y.useRef(null),v=Y.useRef(null),y=Y.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Y.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=Ji({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Y.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=Gi(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Yi?t.fill(new Path2D(Wi(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Y.useEffect(()=>{x(!1)},[g]);let E=Ai({height:i,width:i},m),D=null;return g!=null&&(D=Y.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Y.createElement(Y.Fragment,null,Y.createElement(`canvas`,Ai({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Xi.displayName=`QRCodeCanvas`;var Zi=Y.forwardRef(function(e,t){let n=e,{value:r,size:i=Fi,level:a=Ii,bgColor:o=Li,fgColor:s=Ri,includeMargin:c=zi,minVersion:l=Bi,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=ji(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=Ji({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=Gi(g,v.excavation)),b=Y.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=Wi(y,h);return Y.createElement(`svg`,Ai({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Y.createElement(`title`,null,d),Y.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Y.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});Zi.displayName=`QRCodeSVG`;function Qi(e,t){return!Number.isFinite(t)||t<=0?e(`pairDeviceReady.singleUse`):e(`pairDeviceReady.expiresIn`,{time:Ln(t)})}function $i({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){let{t:a}=G(`settings`);return n?(0,X.jsx)(B,{tone:`warning`,title:a(`pairDeviceReady.expiredTitle`),children:a(`pairDeviceReady.expiredBody`)}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,X.jsx)(Zi,{value:e,size:192,level:`M`,title:a(`pairDeviceReady.qrTitle`)})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,X.jsx)(h,{variant:`outlined`,size:`compact`,leftIcon:r?(0,X.jsx)(vn,{}):(0,X.jsx)(Cn,{}),onClick:()=>i(e),children:a(r?`pairDeviceReady.copiedButton`:`pairDeviceReady.copyButton`)})]}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:Qi(a,t)})]})}function ea(e){return/iPhone|iPod/.test(e)?`iPhone`:/iPad/.test(e)||/Macintosh/.test(e)&&/Mobile/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Macintosh|Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/CrOS/.test(e)?`ChromeOS`:/Linux/.test(e)?`Linux`:null}function ta(e){return/Edg\/|EdgA\/|EdgiOS\//.test(e)?`Edge`:/OPR\/|OPiOS\//.test(e)?`Opera`:/Firefox\/|FxiOS\//.test(e)?`Firefox`:/Chrome\/|CriOS\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:null}function na(e){if(!e||e.trim()===``)return null;let t=ea(e),n=ta(e);return t===null&&n===null?null:{browser:n,os:t}}var ra=5e3,ia=6e4;function aa({pollWhilePairing:e=!1,revalidateKey:t,isExpanded:r=!1}={}){let[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),f=(0,Y.useRef)(!0),p=(0,Y.useRef)(0);(0,Y.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let m=(0,Y.useCallback)((e=n()?.assistantId)=>{if(!e)return;a(t=>t&&t.assistantId!==e?null:t);let t=++p.current;ne(e).then(n=>{!f.current||t!==p.current||a(n.ok?{assistantId:e,devices:n.devices}:null)})},[]),h=T.use.selectedAssistantId()??n()?.assistantId;(0,Y.useEffect)(()=>{s(null),d(null),m(h)},[h,m]);let g=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{t!==g.current&&(g.current=t,m(h))},[t,h,m]);let _=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{if(e&&!c){_.current=!0;let e=setInterval(()=>m(),ra);return()=>clearInterval(e)}!e&&_.current&&(_.current=!1,m())},[e,c,m]);let v=(i?.devices.length??0)>0;(0,Y.useEffect)(()=>{if(!r||!v||e||c)return;let t=setInterval(()=>m(),ia);return()=>clearInterval(t)},[r,v,e,c,m]);let y=(0,Y.useCallback)(e=>{d(null),s(e)},[]),b=(0,Y.useCallback)(()=>{s(null),d(null)},[]),S=(0,Y.useCallback)(()=>{!i||!o||c||(l(!0),d(null),x(i.assistantId,o.hashedDeviceId).then(e=>{f.current&&(l(!1),e.ok?(s(null),m()):d(e.error))}))},[i,o,c,m]);return{devices:i?.devices??null,confirmTarget:o,isRevoking:c,revokeError:u,requestRevoke:y,cancelRevoke:b,confirmRevoke:S}}var oa=600*1e3,sa=`paired-devices`;function ca(e){return e.slice(0,12)}function la(e,t){return t?t.charAt(0).toUpperCase()+t.slice(1):e(`pairedDevicesSection.platformUnknown`)}function ua(e,t){if(typeof t.clientReportedName==`string`&&t.clientReportedName.trim()!==``)return{name:t.clientReportedName,isRealIdentity:!0};let n=na(t.pairingUserAgent);if(n!==null){let{browser:t,os:r}=n;return t!==null&&r!==null?{name:e(`pairedDevicesSection.browserOnOs`,{browser:t,os:r}),isRealIdentity:!0}:{name:t??r??``,isRealIdentity:!0}}return{name:la(e,t.platform),isRealIdentity:!1}}function da(e,t){return t===null?e(`pairedDevicesSection.dateUnknown`):new Date(t).toLocaleDateString(mt())}function fa(e,t){let n=da(e,t.issuedAt);return t.lastUsedAt===null?e(`pairedDevicesSection.pairedLine`,{paired:n}):Date.now()-t.lastUsedAt<=oa?e(`pairedDevicesSection.pairedActiveLine`,{paired:n}):e(`pairedDevicesSection.pairedAndUsedLine`,{paired:n,lastUsed:Wn(t.lastUsedAt)})}function pa({pollWhilePairing:e=!1,revalidateKey:t}={}){let{t:n}=G(`settings`),[r,i]=(0,Y.useState)(!1),a=aa({pollWhilePairing:e,revalidateKey:t,isExpanded:r}),{devices:o,confirmTarget:s}=a;Gn(o?.some(e=>e.lastUsedAt!==null)??!1);let c=(0,Y.useMemo)(()=>o===null?null:[...o].sort((e,t)=>(t.lastUsedAt??0)-(e.lastUsedAt??0)),[o]);return c===null||c.length===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(w.Root,{type:`multiple`,value:r?[sa]:[],onValueChange:e=>i(e.includes(sa)),children:(0,X.jsxs)(w.Item,{value:sa,children:[(0,X.jsxs)(w.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`pairedDevicesSection.title`,{count:c.length})}),(0,X.jsx)(wn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,X.jsx)(w.Content,{children:(0,X.jsx)(`div`,{className:`mt-3 flex flex-col gap-3`,children:c.map(e=>{let t=ua(n,e);return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,title:t.isRealIdentity?e.hashedDeviceId:void 0,children:t.name}),!t.isRealIdentity&&(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[var(--content-tertiary)]`,title:e.hashedDeviceId,children:ca(e.hashedDeviceId)}),e.isCurrentHost&&(0,X.jsx)(`span`,{className:`shrink-0 text-[var(--content-tertiary)]`,children:`· ${n(`pairedDevicesSection.thisMachine`)}`})]}),(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:fa(n,e)})]}),(0,X.jsx)(h,{variant:`dangerOutline`,size:`compact`,className:`shrink-0`,disabled:e.isCurrentHost===!0,title:e.isCurrentHost?n(`pairedDevicesSection.hostRevokeDisabledTitle`):void 0,onClick:()=>a.requestRevoke(e),children:n(`pairedDevicesSection.revokeButton`)})]},e.hashedDeviceId)})})})]})}),(0,X.jsx)(M,{open:s!==null,title:n(`pairedDevicesSection.confirmTitle`),message:s&&(0,X.jsxs)(X.Fragment,{children:[n(`pairedDevicesSection.confirmMessageNamed`,{name:ua(n,s).name,hash:ca(s.hashedDeviceId)}),a.revokeError&&(0,X.jsx)(`span`,{className:`mt-2 block text-[var(--system-negative-strong)]`,children:a.revokeError})]}),confirmLabel:n(`pairedDevicesSection.revokeButton`),destructive:!0,isPending:a.isRevoking,onConfirm:a.confirmRevoke,onCancel:a.cancelRevoke})]})}var ma=5e3;function ha(e,t){return e.length===t.length&&t.every((t,n)=>e[n]?.requestId===t.requestId)}function ga(e,t){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=(0,Y.useRef)(null),[f,p]=(0,Y.useState)(e);e!==f&&(p(e),r([]),a(null),s(null),l(null)),(0,Y.useEffect)(()=>()=>{d.current?.abort(),d.current=null},[e]),(0,Y.useEffect)(()=>{let t=async()=>{u.current?.abort();let t=new AbortController;u.current=t;try{let n=await xi({base:e,signal:t.signal});if(t.signal.aborted)return;r(e=>ha(e,n)?e:n),l(e=>e&&!e.sticky&&!n.some(t=>t.requestId===e.requestId)?null:e),s(null)}catch(e){if(t.signal.aborted)return;if(e instanceof Z){s(e.message);return}R(e,{context:`pair-device-pending-requests-poll`}),s(U(`settings:usePendingPairingRequests.pollErrorFallback`))}};t();let n=setInterval(()=>void t(),ma);return()=>{clearInterval(n),u.current?.abort()}},[e]);let m=(0,Y.useCallback)(async(n,i)=>{if(d.current)return;let o=new AbortController;d.current=o,a({requestId:n,action:i}),l(null);let s=()=>{u.current?.abort(),r(e=>e.filter(e=>e.requestId!==n))};try{if(await(i===`approve`?Ci:wi)({base:e,requestId:n,signal:o.signal}),o.signal.aborted)return;s(),i===`approve`&&t?.()}catch(e){if(o.signal.aborted)return;e instanceof Z?i===`deny`&&e.status===409&&e.code===`ALREADY_APPROVED`?(s(),t?.(),l({requestId:n,message:U(`settings:usePendingPairingRequests.denyAlreadyApproved`),sticky:!0})):e.status===404||e.status===410?s():l({requestId:n,message:e.message}):(R(e,{context:`pair-device-pending-request-action`}),l({requestId:n,message:U(`settings:usePendingPairingRequests.actionErrorFallback`)}))}finally{d.current===o&&(d.current=null),o.signal.aborted||a(null)}},[e,t]),h=(0,Y.useCallback)(e=>m(e,`approve`),[m]),g=(0,Y.useCallback)(e=>m(e,`deny`),[m]);return{requests:n,actingOn:i,error:c?.message??o,approve:h,deny:g}}function _a({base:e,onApproved:t}){let{t:n}=G(`settings`),{requests:r,actingOn:i,error:o,approve:s,deny:c}=ga(e,t);return Gn(r.length>0),r.length===0&&!o?null:(0,X.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-[var(--border-element)] pt-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`pendingPairingRequests.title`)}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`pendingPairingRequests.instruction`)})]}),o&&(0,X.jsx)(B,{tone:`error`,title:o}),r.length>0&&(0,X.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=i!==null&&i.requestId===e.requestId?i.action:null,r=t===`approve`,o=t===`deny`;return(0,X.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-lg border border-[var(--border-element)] p-3`,children:[(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`w-fit px-2.5 py-1.5 text-title-medium tracking-wide text-[color:var(--content-emphasised)]`),children:e.userCode}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.viaEdgeProxy===!1?n(`pendingPairingRequests.requestedMetaHost`,{when:Wn(e.requestedAt)}):n(`pendingPairingRequests.requestedMeta`,{when:Wn(e.requestedAt),ip:e.requesterIp})}),e.requesterUserAgent&&(0,X.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,title:e.requesterUserAgent,children:e.requesterUserAgent})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(h,{variant:`primary`,size:`compact`,disabled:i!==null,"aria-busy":r||void 0,loading:r,onClick:()=>void s(e.requestId),children:n(`pendingPairingRequests.approveButton`)}),(0,X.jsx)(h,{variant:`dangerOutline`,size:`compact`,disabled:i!==null,"aria-busy":o||void 0,loading:o,onClick:()=>void c(e.requestId),children:n(`pendingPairingRequests.denyButton`)})]})]},e.requestId)})})]})}function va({onRefresh:e,isRefreshing:t,labelled:n=!1}){let{t:r}=G(`settings`),i=r(`tunnelStatusRow.refreshLabel`),a=(0,X.jsx)(mn,{className:t?`animate-spin`:void 0});return n?(0,X.jsx)(h,{variant:`outlined`,size:`compact`,leftIcon:a,disabled:t,onClick:e,children:i}):(0,X.jsx)(h,{variant:`ghost`,size:`compact`,iconOnly:a,"aria-label":i,disabled:t,onClick:e})}function ya(e){return`publicBaseUrl`in e&&e.publicBaseUrl?e.publicBaseUrl:null}function ba(e){return`checkedAt`in e&&e.checkedAt?e.checkedAt:null}function xa(e,t){let n=t?.trim();return n?`vellum tunnel ${Ca(n)} --provider ${e}`:`vellum tunnel --provider ${e}`}var Sa=/^[A-Za-z0-9._-]+$/;function Ca(e){return Sa.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}var wa={checking:`var(--content-tertiary)`,stopped:`var(--content-tertiary)`,healthy:`var(--system-positive-strong)`,unpairable:`var(--system-mid-strong)`,unreachable:`var(--system-mid-strong)`,foreign:`var(--system-negative-strong)`},Ta=`text-body-small-default text-[var(--content-tertiary)]`,Ea=`truncate ${Ta}`;function Da({status:e,onRefresh:t,isRefreshing:n,assistantName:r=null}){let{t:i}=G(`settings`);if(e.kind===`unconfigured`||e.kind===`unavailable`)return null;let o=ba(e),s=ya(e),c=`provider`in e?e.provider:void 0,l=`detail`in e?e.detail:void 0;return(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border border-[var(--border-element)] px-3 py-2.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`mt-1.5 inline-block h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:wa[e.kind]}}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)]`,children:Oa(e,i)}),l&&(0,X.jsx)(`p`,{className:Ea,title:l,children:l}),c&&(0,X.jsx)(`p`,{className:Ta,children:(0,X.jsx)(rn,{i18nKey:e.kind===`stopped`?`tunnelStatusRow.stoppedRestart`:`tunnelStatusRow.restartHint`,ns:`settings`,values:{command:xa(c,r)},components:{code:(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`px-1.5 py-0.5`)})}})}),s&&(0,X.jsx)(`p`,{className:Ea,title:s,children:s}),o&&(0,X.jsx)(`p`,{className:Ta,children:i(`tunnelStatusRow.checkedAt`,{when:Wn(o)})})]}),(0,X.jsx)(va,{onRefresh:t,isRefreshing:n})]})}function Oa(e,t){switch(e.kind){case`checking`:return t(`tunnelStatusRow.checkingStatus`);case`stopped`:return t(`tunnelStatusRow.stoppedStatus`);case`healthy`:return t(`tunnelStatusRow.healthyStatus`);case`unpairable`:return t(`tunnelStatusRow.unpairableStatus`);case`unreachable`:return t(`tunnelStatusRow.unreachableStatus`);case`foreign`:return e.servingAssistantName?t(`tunnelStatusRow.foreignStatusNamed`,{name:e.servingAssistantName}):t(`tunnelStatusRow.foreignStatus`)}}var ka=`vellum:pair-device:public-base-url`;function Aa(e){let t=e?.trim();if(t)return{url:t,source:`tunnel`};let n=Yt(ka,``).trim();return n?{url:n,source:`stored`}:{url:``,source:`none`}}function ja(e,t){let n=(0,Y.useMemo)(()=>Aa(t),[t]),[r,i]=(0,Y.useState)(null),a=r??n.url,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)({kind:`idle`}),[u,d]=(0,Y.useState)(()=>Date.now()),f=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>f.current?.abort(),[]),(0,Y.useEffect)(()=>{if(c.kind!==`ready`)return;d(Date.now());let e=setInterval(()=>d(Date.now()),1e3);return()=>clearInterval(e)},[c]);let p=(0,Y.useCallback)(e=>{i(e),s(null)},[]),m=(0,Y.useCallback)(()=>{if(!e)return;let t=a.trim(),n=ae(t);if(!n.ok){s(j(n.reason,t));return}s(null),f.current?.abort();let r=new AbortController;f.current=r,l({kind:`minting`}),(async()=>{try{let t=await yi({base:e,publicBaseUrl:n.url,signal:r.signal});if(r.signal.aborted)return;ge(ka,n.url),l({kind:`ready`,pairUrl:t.pairUrl,expiresAtMs:Date.parse(t.expiresAt)})}catch(e){if(r.signal.aborted)return;if(e instanceof Z){l({kind:`error`,message:e.message,hint:e.hint});return}R(e,{context:`pair-device-mint`}),l({kind:`error`,message:U(`settings:usePairDevice.mintErrorFallback`)})}})()},[e,a]),h=c.kind===`ready`?Math.max(0,c.expiresAtMs-u):0,g=c.kind===`ready`&&h<=0;return{publicBaseUrl:a,setPublicBaseUrl:p,prefillSource:n.source,inputError:o,phase:c,remainingMs:h,expired:g,generate:m}}var Ma=`0.11.6`;function Na(e){return ze(Ma,e)}function Pa(e){let t=_t(),n=Na(t),r=E(),i=e&&n&&r,{data:a,isFetching:o,refetch:s}=W({...Je({path:{assistant_id:t}}),enabled:i,staleTime:0,refetchOnWindowFocus:!1}),c=(0,Y.useCallback)(()=>{i&&s()},[i,s]);return{status:Fa(a,o),isRefreshing:o,refresh:c}}function Fa(e,t){if(!e)return t?{kind:`checking`}:{kind:`unavailable`};let{lastTunnel:n}=e,r=e.publicBaseUrl??``,i=e.checkedAt??``,a=n?{provider:n.provider}:{};switch(e.state){case`unconfigured`:return{kind:`unconfigured`};case`stopped`:return{kind:`stopped`,...a,...n?{publicBaseUrl:n.publicBaseUrl}:{}};case`healthy`:return{kind:`healthy`,publicBaseUrl:r,checkedAt:i};case`unpairable`:case`unreachable`:return{kind:e.state,publicBaseUrl:r,checkedAt:i,...e.detail?{detail:e.detail}:{},...a};case`foreign`:return{kind:`foreign`,publicBaseUrl:r,checkedAt:i,...e.servingAssistantName?{servingAssistantName:e.servingAssistantName}:{},...a};default:return{kind:`unavailable`}}}var Ia=`tailscale`,La=`public-url`,Ra=new Set([`unpairable`,`unreachable`,`foreign`]),za=`vellum tunnel --help`,Ba=pe(L.docs.pairADevice);function Va(){let{t:e}=G(`settings`),t=mi(),n=oi(),r=z.use.pairedDevicesUI(),i=Pa(n&&t!==null),o=i.status.kind!==`unavailable`;ee(`app.resume`,()=>{i.refresh()}),Gn(ba(i.status)!==null);let s=i.status.kind===`stopped`?null:ya(i.status),c=ja(t?.base??null,o?s:t?.ingressUrl??null),[l,u]=(0,Y.useState)(0),[d,f]=(0,Y.useState)(!1),{copy:p,copied:m}=Lt({errorMessage:e(`pairDeviceCard.copyError`)});if(!t||!n)return null;let g=t.assistantName??e(`pairDeviceCard.subtitleFallbackName`),{phase:_}=c,v=_.kind===`minting`,y=_.kind===`ready`,b=c.prefillSource===`tunnel`,x=o?i.status.kind===`unconfigured`:c.prefillSource===`none`&&c.publicBaseUrl.trim()===``,S=x&&o,C=o&&Ra.has(i.status.kind),T=e(v?`pairDeviceCard.generateButtonMinting`:y?`pairDeviceCard.generateButtonRegenerate`:C?`pairDeviceCard.generateButtonWarned`:`pairDeviceCard.generateButton`),E=o&&s!==null,D=d||c.inputError!==null,O=(0,X.jsx)(h,{variant:C?`outlined`:`primary`,className:`self-start`,disabled:v||c.publicBaseUrl.trim()===``,onClick:c.generate,children:T}),k=(0,X.jsx)(pt,{label:e(`pairDeviceCard.publicUrlLabel`),fullWidth:!0,placeholder:e(`pairDeviceCard.publicUrlPlaceholder`),helperText:e(b?`pairDeviceCard.publicUrlHelperTunnel`:`pairDeviceCard.publicUrlHelper`),value:c.publicBaseUrl,errorText:c.inputError??void 0,disabled:v,onChange:e=>{f(!0),c.setPublicBaseUrl(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c.generate())}});return(0,X.jsx)(J,{title:e(`pairDeviceCard.title`),subtitle:e(`pairDeviceCard.subtitle`,{name:g}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[x&&(0,X.jsx)(B,{tone:`info`,title:e(`pairDeviceCard.noTunnelTitle`),actions:S?(0,X.jsx)(va,{onRefresh:i.refresh,isRefreshing:i.isRefreshing,labelled:!0}):void 0,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelWhy`,{name:g})}),(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`w-fit max-w-full overflow-x-auto px-2.5 py-1.5`),children:xa(Ia,t.assistantName)}),(0,X.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelNext`)}),(0,X.jsx)(`p`,{children:(0,X.jsx)(rn,{i18nKey:`pairDeviceCard.noTunnelMore`,ns:`settings`,values:{command:za},components:{code:(0,X.jsx)(`code`,{className:a(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-default)]`,`px-1.5 py-0.5`)})}})})]})}),(0,X.jsx)(Da,{status:i.status,onRefresh:i.refresh,isRefreshing:i.isRefreshing,assistantName:t.assistantName}),(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:E?(0,X.jsxs)(X.Fragment,{children:[O,(0,X.jsx)(w.Root,{type:`single`,collapsible:!0,value:D?La:``,onValueChange:e=>f(e===La),children:(0,X.jsxs)(w.Item,{value:La,children:[(0,X.jsxs)(w.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e(`pairDeviceCard.publicUrlDisclosure`)}),(0,X.jsx)(wn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,X.jsx)(w.Content,{children:(0,X.jsx)(`div`,{className:`mt-3`,children:k})})]})})]}):(0,X.jsxs)(X.Fragment,{children:[k,O]})}),_.kind===`error`&&(0,X.jsx)(B,{tone:`error`,title:_.message,children:_.hint}),y&&(0,X.jsx)($i,{pairUrl:_.pairUrl,remainingMs:c.remainingMs,expired:c.expired,copied:m,onCopy:p}),(0,X.jsx)(_a,{base:t.base,onApproved:()=>u(e=>e+1)}),r&&(0,X.jsx)(pa,{pollWhilePairing:y&&!c.expired,revalidateKey:l}),(0,X.jsx)(Ve,{href:Ba,tone:`quiet`,glyph:!1,className:`self-start text-body-medium-default text-[var(--content-tertiary)]`,children:e(`pairDeviceCard.learnMore`)})]})})}function Ha(e){return[{scope:`global`,title:e(`shortcutsSections.globalTitle`),description:e(`shortcutsSections.globalDescription`)},{scope:`menu`,title:e(`shortcutsSections.appTitle`),description:e(`shortcutsSections.appDescription`)}]}function Ua({hotkey:e,recording:t,conflictLabel:n,alternateBinding:r,onStartRecording:i,onCancelRecording:a,onReset:o,onRemove:s}){let{t:c}=G(`settings`),l=e.accelerator===``,u=e.override!==null;return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,X.jsx)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c(`shortcutsSections.alreadyUsedBy`,{label:n})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r,t?(0,X.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:c(`shortcutsSections.recordingHint`)}):l?(0,X.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:c(`shortcutsSections.none`)}):(0,X.jsx)(he,{accelerator:e.accelerator}),t?(0,X.jsx)(h,{variant:`ghost`,size:`compact`,onClick:a,children:c(`shortcutsSections.cancel`)}):(0,X.jsx)(h,{variant:`outlined`,size:`compact`,onClick:i,"aria-label":c(`shortcutsSections.recordShortcutAriaLabel`,{label:e.label}),children:c(`shortcutsSections.record`)}),(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:!u,leftIcon:(0,X.jsx)(_n,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":c(`shortcutsSections.resetShortcutAriaLabel`,{label:e.label})}),(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:l,leftIcon:(0,X.jsx)(Sn,{className:`h-3.5 w-3.5`}),onClick:s,"aria-label":c(`shortcutsSections.removeBindingAriaLabel`,{label:e.label})})]})]})}function Wa(){let{t:e}=G(`settings`),{catalog:t,recordingKey:n,conflict:r,startRecording:i,stopRecording:a,resetHotkey:o,removeHotkey:s}=qn(),c=(0,Y.useMemo)(()=>Ha(e).map(e=>({...e,commands:t.filter(t=>t.rebindable&&t.scope===e.scope)})).filter(e=>e.commands.length>0),[t,e]);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[r!==null&&(0,X.jsxs)(B,{tone:`warning`,children:[e(`shortcutsSections.conflictNoticePrefix`,{label:r.label}),` `,e(n===null?`shortcutsSections.conflictResetHint`:`shortcutsSections.conflictRecordingHint`)]}),c.map(e=>(0,X.jsxs)(ct,{bordered:!0,children:[(0,X.jsxs)(`div`,{className:`mb-2`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.title}),(0,X.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,X.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,X.jsx)(Ua,{hotkey:e,recording:n===e.key,conflictLabel:r!==null&&r.key===e.key?r.label:null,onStartRecording:()=>i(e.key),onCancelRecording:a,onReset:()=>o(e.key),onRemove:()=>s(e.key)},e.key))})]},e.scope))]})}async function Ga(){if(!kt())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function Ka(e){if(!kt())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function qa(){let{t:e}=G(`settings`),t=c.useValue(),n=Ee.useValue(),r=!P(),i=Dt();return(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.composerTitle`)}),(0,X.jsxs)(`div`,{className:`mt-2 space-y-4`,children:[r&&(0,X.jsx)(Ot,{checked:t,onChange:c.save,label:e(i?`preferencesModal.sendWithCmdEnter`:`preferencesModal.sendWithCtrlEnter`),helperText:e(i?`preferencesModal.sendWithCmdEnterHelper`:`preferencesModal.sendWithCtrlEnterHelper`)}),(0,X.jsx)(Ot,{checked:n,onChange:Ee.save,label:e(`preferencesModal.showContextWindow`),helperText:e(`preferencesModal.showContextWindowHelper`)})]})]})}function Ja(){let{t:e}=G(`settings`),[t,n]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{Ga().then(n)},[]);let r=async e=>{n(e);try{await Ka(e)}catch{n(!e)}};return(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.launchAtLoginTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(Ft()===`windows`?`preferencesModal.launchAtLoginDescriptionWindows`:`preferencesModal.launchAtLoginDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,children:(0,X.jsx)(Ot,{checked:t,onChange:e=>void r(e),"aria-label":e(`preferencesModal.launchAtLoginAriaLabel`)})})]})}function Ya({open:e,onClose:t}){let{t:n}=G(`settings`);return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(O.Content,{size:`lg`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:n(`preferencesModal.title`)}),(0,X.jsx)(O.Description,{children:n(`preferencesModal.description`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`space-y-6`,children:[kt()&&(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`preferencesModal.keyboardShortcutsTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n(`preferencesModal.keyboardShortcutsDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,children:(0,X.jsx)(Wa,{})})]}),(0,X.jsx)(qa,{}),kt()&&(0,X.jsx)(Ja,{})]})})]})})}function Xa(e){return e===`preview`?`preview`:`stable`}function Za(e,t){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Qa(e){return e.filter(e=>e.ready_to_use)}function $a(e){return e?.feature_enabled===!1}function eo({assistantId:e,onComplete:t}){let{t:n}=G(`settings`),r=z.use.previewChannel(),i=K(),[a,o]=(0,Y.useState)(),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(`restore_backup`),[p,m]=(0,Y.useState)(``),h=Jt({path:{assistant_id:e}}),g=ye({path:{assistant_id:e}}),_=Ht({path:{id:e}}),{data:v,isLoading:y,isError:b}=W({...h,enabled:r,retry:!1}),x=(0,Y.useMemo)(()=>Qa(v?.preview_backups??[]),[v?.preview_backups]),S=x[0],C=x.find(e=>e.snapshot_name===p)??S,T=()=>{i.invalidateQueries({queryKey:g}),i.invalidateQueries({queryKey:_}),t?.()},E=an(Zt()),D=an(Be()),O=Xa(v?.current_channel),k=E.isPending||D.isPending,A=k||$a(v)||!v?.latest_preview_release,j=d===`restore_backup`&&!C;if((0,Y.useEffect)(()=>{o(O===`preview`?`release-channel`:void 0)},[O]),!r)return null;let M=v?.standard_upgrade_available??!1;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(w.Root,{type:`single`,collapsible:!0,value:a,onValueChange:e=>o(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,X.jsxs)(w.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,X.jsxs)(w.Trigger,{className:`group justify-between gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`previewReleaseChannel.title`)}),v&&(0,X.jsx)(He,{tone:O===`preview`?`warning`:`neutral`,children:n(O===`preview`?`previewReleaseChannel.preview`:`previewReleaseChannel.stable`)})]}),(0,X.jsx)(wn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,X.jsx)(w.Content,{children:(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[y&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),n(`previewReleaseChannel.loading`)]}),b&&(0,X.jsx)(B,{tone:`error`,title:n(`previewReleaseChannel.loadErrorTitle`),children:n(`previewReleaseChannel.loadErrorBody`)}),v&&(0,X.jsxs)(X.Fragment,{children:[$a(v)&&(0,X.jsx)(B,{tone:`neutral`,title:n(`previewReleaseChannel.unavailableTitle`),children:n(`previewReleaseChannel.unavailableBody`)}),O===`stable`?(0,X.jsx)(to,{status:v,isChangingChannel:k,optInDisabled:A,onOptIn:()=>c(!0)}):(0,X.jsx)(no,{status:v,isChangingChannel:k,onOptOut:()=>{let e=S;m(e?.snapshot_name??``),f(e?`restore_backup`:M?`standard_upgrade`:`restore_backup`),u(!0)}})]})]})})]})}),(0,X.jsx)(io,{open:s,isPending:E.isPending,previewVersion:v?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await E.mutateAsync({path:{assistant_id:e}});V.success(t.detail||n(`previewReleaseChannel.previewEnabledToast`)),c(!1),T()}catch(e){V.error(Ye(e,void 0,n(`previewReleaseChannel.previewEnableFailedToast`)))}},onCancel:()=>c(!1)}),(0,X.jsx)(ao,{open:l,backups:x,mode:d,selectedSnapshotName:C?.snapshot_name??``,isPending:D.isPending,restoreModeDisabled:j,standardUpgradeAvailable:M,onModeChange:f,onSnapshotChange:m,onConfirm:async()=>{if(!j)try{let t=await D.mutateAsync({path:{assistant_id:e},body:d===`restore_backup`?{mode:`restore_backup`,snapshot_name:C?.snapshot_name}:{mode:`standard_upgrade`}});V.success(t.detail||n(`previewReleaseChannel.stableEnabledToast`)),u(!1),T()}catch(e){V.error(Ye(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>u(!1)})]})}function to({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){let{t:i}=G(`settings`);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(ro,{status:e}),!e.latest_preview_release&&(0,X.jsx)(B,{tone:`neutral`,title:i(`previewReleaseChannel.noPreviewTitle`),children:i(`previewReleaseChannel.noPreviewBody`)}),(0,X.jsx)(h,{variant:`outlined`,loading:t,leftIcon:(0,X.jsx)(gn,{}),disabled:n,onClick:r,children:i(`previewReleaseChannel.optIn`)})]})}function no({status:e,isChangingChannel:t,onOptOut:n}){let{t:r}=G(`settings`);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(ro,{status:e}),(0,X.jsx)(h,{variant:`outlined`,loading:t,leftIcon:(0,X.jsx)(_n,{}),disabled:t,onClick:n,children:r(`previewReleaseChannel.switchBack`)})]})}function ro({status:e}){let{t}=G(`settings`);return(0,X.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestStable`)}),(0,X.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??t(`previewReleaseChannel.none`)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestPreview`)}),(0,X.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??t(`previewReleaseChannel.none`)})]})]})}function io({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){let{t:a}=G(`settings`);return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,X.jsxs)(O.Content,{size:`md`,hideCloseButton:t,children:[(0,X.jsxs)(O.Header,{icon:hn,children:[(0,X.jsx)(O.Title,{children:a(`previewReleaseChannel.optInTitle`)}),(0,X.jsx)(O.Description,{children:a(`previewReleaseChannel.optInDescription`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(B,{tone:`warning`,title:a(`previewReleaseChannel.dataLossTitle`),children:a(`previewReleaseChannel.dataLossBody`)}),(0,X.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,X.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep1`)}),(0,X.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep2`,{version:n??a(`previewReleaseChannel.latest`)})}),(0,X.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep3`)})]})]})}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`outlined`,disabled:t,onClick:i,children:a(`previewReleaseChannel.cancel`)}),(0,X.jsx)(h,{variant:`primary`,disabled:t,loading:t,leftIcon:(0,X.jsx)(gn,{}),onClick:r,children:a(t?`previewReleaseChannel.switching`:`previewReleaseChannel.takeBackupAndSwitch`)})]})]})})}function ao({open:e,backups:n,mode:r,selectedSnapshotName:i,isPending:a,restoreModeDisabled:o,standardUpgradeAvailable:s,onModeChange:c,onSnapshotChange:l,onConfirm:u,onCancel:d}){let{t:f}=G(`settings`),p=f(`previewReleaseChannel.unknownDate`);return(0,X.jsx)(O.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,X.jsxs)(O.Content,{size:`md`,hideCloseButton:a,children:[(0,X.jsxs)(O.Header,{icon:hn,children:[(0,X.jsx)(O.Title,{children:f(`previewReleaseChannel.optOutTitle`)}),(0,X.jsx)(O.Description,{children:f(`previewReleaseChannel.optOutDescription`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(t,{value:r,onValueChange:c,disabled:a,"aria-label":f(`previewReleaseChannel.returnMethodAriaLabel`),children:[(0,X.jsx)(de,{value:`restore_backup`,disabled:n.length===0,label:f(`previewReleaseChannel.restoreBackupLabel`),helperText:f(`previewReleaseChannel.restoreBackupHelper`)}),(0,X.jsx)(de,{value:`standard_upgrade`,disabled:!s,label:f(`previewReleaseChannel.standardUpgradeLabel`),helperText:f(s?`previewReleaseChannel.standardUpgradeHelper`:`previewReleaseChannel.standardUpgradeUnavailable`)})]}),r===`restore_backup`&&n.length>0&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[f(`previewReleaseChannel.safetyBackup`),(0,X.jsx)(De,{value:i,onChange:l,disabled:a,options:n.map(e=>{let t=e.source_release_version?f(`previewReleaseChannel.stableBackupLabel`,{version:e.source_release_version}):e.snapshot_name;return{value:e.snapshot_name,label:f(`previewReleaseChannel.backupOptionLabel`,{name:t,date:Za(e.created_at,p)})}})})]}),r===`restore_backup`&&n.length===0&&!s&&(0,X.jsx)(B,{tone:`error`,title:f(`previewReleaseChannel.requiresBackupTitle`),children:f(`previewReleaseChannel.requiresBackupBody`)}),r===`standard_upgrade`&&(0,X.jsx)(B,{tone:`error`,title:f(`previewReleaseChannel.mayNotSurviveTitle`),children:f(`previewReleaseChannel.mayNotSurviveBody`)})]})}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`outlined`,disabled:a,onClick:d,children:f(`previewReleaseChannel.cancel`)}),(0,X.jsx)(h,{variant:r===`standard_upgrade`?`danger`:`primary`,disabled:a||o||r===`standard_upgrade`&&!s,loading:a,leftIcon:(0,X.jsx)(mn,{}),onClick:u,children:f(a?`previewReleaseChannel.switching`:`previewReleaseChannel.switchToStable`)})]})]})})}function oo(){let{t:e}=G(`settings`),t=D.use.user(),n=(0,Y.useCallback)(e=>{jt(e),window.location.reload()},[]);if(!ht(t))return null;let i=Ge(),a=r(),o=a.version??e(`previewUiChannel.versionUnknown`);return(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`previewUiChannel.title`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.description`)}),(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(a.channel===`preview`?`previewUiChannel.runningPreview`:`previewUiChannel.runningStable`,{version:o})}),i&&a.channel===`stable`&&(0,X.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.unavailableHint`)})]}),(0,X.jsx)(`div`,{className:`shrink-0`,children:(0,X.jsx)(Ot,{checked:i,onChange:n,"aria-label":e(i?`previewUiChannel.onAriaLabel`:`previewUiChannel.offAriaLabel`)})})]})}var so=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function co(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&so.has(e.error)?`That size isn't available on your plan.`:Ye(e,void 0,t)}function lo({assistant:e,healthz:t,healthzLoading:n,healthzFetching:r,healthzPolling:o,refetch:s,refetchUntilResized:c}){let{t:l}=G(`settings`),u=cn(),d=W(At()),f=d.data,p=!e.is_local,m=f?.plan_id===`pro`,g=W({...i(),enabled:m}),_=e.machine_size||`small`,v=Nn(g.data?.max_machine_tier??null),y=(0,Y.useMemo)(()=>In(v,_,(0,X.jsx)(He,{tone:`positive`,children:l(`resizeCard.current`)})),[v,_,l]),b=g.data?.selected_storage_gib??null,[x,S]=(0,Y.useState)(!1),C=v.length>0?v[v.length-1]:null,[w,T]=(0,Y.useState)(null),E=w??C??_,[D,k]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(null),M=ut({onSuccess:(e,n)=>{V.success(l(`resizeCard.toastStarted`),{id:`assistant-resize`}),j(null),T(null),S(!1),n.body?.machine_size==null?s():c(t)},onError:e=>{j(co(e,l(`resizeCard.resizeFailed`)))}});if(d.isError&&f==null)return(0,X.jsx)(J,{id:`storage-resources`,title:l(`resizeCard.title`),subtitle:l(`resizeCard.subtitle`),children:(0,X.jsx)(B,{tone:`error`,children:l(`resizeCard.subscriptionLoadError`)})});let N=m&&v.includes(E)&&E!==_?E:null,P=m&&b!=null&&!0,ee=m&&v.length>0&&Fn(_)<Fn(v[v.length-1]),F=M.isPending||o,I=b==null?t?.disk?.totalMb??null:b*1024,te=t?.disk&&I!=null?{value:t.disk.usedMb,max:I,caption:l(`resizeCard.usedOf`,{used:Hn(t.disk.usedMb),total:Hn(I)})}:null,ne=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,re=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:l(`resizeCard.usedOf`,{used:Hn(t.memory.currentMb),total:Hn(t.memory.maxMb)})}:null,ie=(0,X.jsx)(h,{variant:`ghost`,size:`compact`,onClick:()=>k(!0),children:l(`resizeCard.resize`)}),ae=p?m?P?(0,X.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,X.jsx)(pn,{className:`h-3.5 w-3.5`}),l(`resizeCard.increaseStorage`)]}):(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:l(`resizeCard.resize`)}):ie:null,oe=p?m?ee?(0,X.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,X.jsx)(pn,{className:`h-3.5 w-3.5`}),l(`resizeCard.increaseSize`)]}):(0,X.jsx)(h,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:l(`resizeCard.resize`)}):ie:null;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(J,{id:`storage-resources`,title:l(`resizeCard.title`),subtitle:l(`resizeCard.subtitle`),compactAccessory:!0,accessory:(0,X.jsx)(h,{variant:`ghost`,size:`compact`,loading:r||o,iconOnly:(0,X.jsx)(mn,{}),tooltip:l(o?`resizeCard.applyingResize`:`resizeCard.refreshMetrics`),"aria-label":l(`resizeCard.refreshMetrics`),disabled:r||o,onClick:()=>void s()}),children:(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,X.jsx)(On,{className:`h-3.5 w-3.5`})}),(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.disk`)})]}),ae]}),(0,X.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.storage`)}),te?(0,X.jsx)(Rn,{value:te.value,max:te.max,caption:te.caption}):n?(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`})}):(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.unavailable`)})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,X.jsx)(Yn,{className:`h-3.5 w-3.5`})}),(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.machine`)}),(0,X.jsx)(He,{tone:`neutral`,children:Pn[_]})]}),oe]}),(0,X.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.cpu`)}),ne?(0,X.jsx)(Rn,{value:ne.value,max:ne.max,caption:ne.caption}):n?(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`})}):(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:l(`resizeCard.memory`)}),re?(0,X.jsx)(Rn,{value:re.value,max:re.max,caption:re.caption}):n?(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,X.jsx)(q,{className:`h-3 w-3 animate-spin`})}):(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,X.jsx)(O.Root,{open:D,onOpenChange:e=>{e||k(!1)},children:(0,X.jsxs)(O.Content,{size:`sm`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:l(`resizeCard.upgradeTitle`)}),(0,X.jsx)(O.Description,{children:l(`resizeCard.upgradeDescription`)})]}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`ghost`,onClick:()=>k(!1),children:l(`resizeCard.cancel`)}),(0,X.jsx)(h,{onClick:()=>{k(!1),u(L.plans)},children:l(`resizeCard.upgrade`)})]})]})}),(0,X.jsx)(O.Root,{open:x,onOpenChange:e=>{e||(S(!1),T(null),j(null))},children:(0,X.jsxs)(O.Content,{size:`sm`,children:[(0,X.jsxs)(O.Header,{icon:Yn,children:[(0,X.jsx)(O.Title,{children:l(`resizeCard.modalTitle`)}),(0,X.jsx)(O.Description,{children:l(`resizeCard.modalDescription`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v.length===0?(0,X.jsx)(B,{tone:`warning`,children:l(`resizeCard.noMachineTier`)}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:l(`resizeCard.machineSize`)}),(0,X.jsx)(De,{options:y,value:E,onChange:T,"aria-label":l(`resizeCard.machineSizeAriaLabel`),"data-testid":`resize-machine-size`})]}),P?(0,X.jsx)(B,{tone:`info`,children:l(`resizeCard.storageExpandTo`,{to:b})}):(0,X.jsx)(B,{tone:`neutral`,children:l(`resizeCard.storageUnchanged`)}),A&&(0,X.jsx)(B,{tone:`error`,children:A})]})}),(0,X.jsxs)(O.Footer,{className:`items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:(0,X.jsx)(rn,{ns:`settings`,i18nKey:`resizeCard.needMore`,components:{upgradeLink:(0,X.jsx)(ln,{to:L.plans,className:a(yt({tone:`quiet`}),`text-[var(--content-secondary)] decoration-[var(--border-element)] underline-offset-2`),onClick:()=>S(!1)})}})}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(h,{variant:`ghost`,onClick:()=>{S(!1),T(null),j(null)},children:l(`resizeCard.cancel`)}),(0,X.jsx)(h,{disabled:N==null&&!P||F,loading:F,onClick:()=>{j(null);let t={};N!=null&&(t.machine_size=N),P&&b!=null&&(t.storage_gib=b),M.mutate({path:{id:e.id},body:t})},children:l(A?`resizeCard.retry`:`resizeCard.apply`)})]})]})]})})]})}function uo({assistantId:e}){let{t}=G(`settings`),n=cn(),r=K(),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(h,{variant:`dangerOutline`,onClick:()=>a(!0),className:`shrink-0`,children:t(`retireAssistant.button`)}),(0,X.jsx)(it,{open:i,isPending:o,onConfirm:async()=>{s(!0);let t=await nt(r,e);if(t.ok){a(!1),n(t.nextRoute,{replace:!0});return}V.error(t.error),s(!1),a(!1)},onCancel:()=>a(!1)})]})}var fo=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function po(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...fo].sort()}function mo(e,t,n){let r=parseInt(n??`0`,10);if(r>59)return null;let i=parseInt(t??`0`,10)*60+r;return(e===`-`?-1:1)*i}function ho(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);n&&(i=mo(n[1],n[2],n[3])??0)}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function go(){return po().map(e=>ho(e)).filter(e=>e!==null)}function _o(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function vo(e,t){if(!e)return t;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}function yo(e){if(e===`utc`||e===`gmt`)return 0;let t=e.match(/^(?:utc|gmt)?\s*([+-])(\d{1,2})(?::?(\d{2}))?$/);if(!t)return null;let n=mo(t[1],t[2],t[3]);return n!==null&&Math.abs(n)<=840?n:null}var bo=200,xo=[];function So({value:e,onChange:t}){let{t:n}=G(`settings`),[r,i]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(!1),c=(0,Y.useMemo)(()=>o?go():xo,[o]),l=r.trim().toLowerCase(),u=(0,Y.useMemo)(()=>{let e=yo(l);return(l?c.filter(t=>e===null?t.city.toLowerCase().includes(l)||t.region.toLowerCase().includes(l)||t.offsetLabel.toLowerCase().includes(l)||t.identifier.toLowerCase().includes(l):t.offsetMinutes===e):c).slice(0,bo)},[c,l]),d=(0,Y.useMemo)(()=>u.map(e=>e.identifier),[u]),f=(0,Y.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]);return(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.timezone`)}),(0,X.jsxs)(le.Root,{className:`w-full md:max-w-[280px]`,options:d,value:e,onSelect:t,onOpenChange:e=>{if(e){s(!0);return}i(``)},autoActivateFirst:l.length>0,children:[(0,X.jsx)(le.Input,{type:`text`,"aria-label":n(`timezonePicker.timezone`),value:r,placeholder:f||n(`timezonePicker.searchPlaceholder`),onChange:e=>i(e.target.value),fullWidth:!0}),(0,X.jsx)(le.List,{"aria-label":n(`timezonePicker.timezonesAriaLabel`),className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,emptyState:(0,X.jsx)(`p`,{className:`px-3 py-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.noMatches`)}),children:u.map(e=>(0,X.jsxs)(le.Option,{value:e.identifier,className:a(`flex w-full items-center justify-between gap-3 px-3 py-2`,`text-body-medium-lighter text-[var(--content-default)] transition-colors`,`hover:bg-[var(--surface-active)]`,`data-[active]:bg-[var(--surface-active)] aria-selected:bg-[var(--surface-active)]`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate text-body-medium-default`,children:e.city}),e.region&&(0,X.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.region})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,X.jsx)(`span`,{children:_o(e.identifier)}),(0,X.jsx)(`span`,{children:e.offsetLabel})]})]},e.identifier))})]})]}),(0,X.jsx)(Kn,{}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.zoneName`)}),(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:vo(e,n(`timezonePicker.notSet`))})]})]})}function Co(){let{t:e}=G(`settings`),t=T.use.activeAssistantId(),[n,r]=(0,Y.useState)(()=>Ie(`timezone`,``)),i=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{i.current=t},[t]);let a=(0,Y.useRef)(!1),o=(0,Y.useRef)(null),s=(0,Y.useRef)(()=>{}),c=e=>{if(a.current){o.current=e;return}let t=i.current;if(!t){o.current=null;return}a.current=!0,o.current=null,k.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{R(e,{context:`settings-timezone-override`})}).finally(()=>{a.current=!1;let e=o.current;o.current=null,e!==null&&s.current(e)})};return(0,Y.useEffect)(()=>{s.current=c}),(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`timezoneSection.title`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`timezoneSection.description`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(So,{value:n,onChange:e=>{r(e),Tt(`timezone`,e),c(e)}})})]})}var wo=[0,1,2,3,4,5,6];function To(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function Eo(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function Do(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function Oo(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:To(t),windowEnd:To(n)}}function ko({assistantId:e}){let{t}=G(`settings`),n=K(),r=[t(`updateWindowPolicy.dayMon`),t(`updateWindowPolicy.dayTue`),t(`updateWindowPolicy.dayWed`),t(`updateWindowPolicy.dayThu`),t(`updateWindowPolicy.dayFri`),t(`updateWindowPolicy.daySat`),t(`updateWindowPolicy.daySun`)],{data:i,isLoading:a,isError:o}=W(se({path:{id:e}})),s=(0,Y.useMemo)(()=>Oo(i),[i]),[c,u]=(0,Y.useState)(null),d=c??s,f=c!==null,p=(0,Y.useMemo)(()=>Do(),[]),[m,g]=(0,Y.useState)(null),_=m??d.daysOfMonth.join(`, `),v=an({mutationFn:async t=>{let{data:n}=await l({path:{id:e},body:t,throwOnError:!0});return n}}),y=e=>{u(t=>({...t??s,...e}))},b=e=>{y({daysOfWeek:d.daysOfWeek.includes(e)?d.daysOfWeek.filter(t=>t!==e):[...d.daysOfWeek,e].sort((e,t)=>e-t)})},x=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return a?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),t(`updateWindowPolicy.loading`)]}):o?(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`updateWindowPolicy.loadError`)}):(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(Ot,{checked:d.enabled,onChange:e=>y({enabled:e}),label:t(`updateWindowPolicy.automaticUpdates`),helperText:t(`updateWindowPolicy.automaticUpdatesHelper`)}),d.enabled&&(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.frequency`)}),(0,X.jsx)(`div`,{className:`max-w-[400px]`,children:(0,X.jsx)(ke,{ariaLabel:t(`updateWindowPolicy.frequency`),value:d.frequency,onChange:e=>{e!==`monthly`&&g(null),y({frequency:e})},items:[{value:`daily`,label:t(`updateWindowPolicy.daily`)},{value:`weekly`,label:t(`updateWindowPolicy.weekly`)},{value:`monthly`,label:t(`updateWindowPolicy.monthly`)}]})})]}),d.frequency===`weekly`&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.daysOfWeek`)}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:wo.map(e=>(0,X.jsx)(h,{variant:`outlined`,size:`compact`,active:d.daysOfWeek.includes(e),onClick:()=>b(e),children:r[e]},e))})]}),d.frequency===`monthly`&&(0,X.jsx)(pt,{label:t(`updateWindowPolicy.daysOfMonth`),type:`text`,value:_,onChange:e=>g(e.target.value),onBlur:e=>{let t=x(e.target.value);y({daysOfMonth:t}),g(t.join(`, `))},placeholder:t(`updateWindowPolicy.daysOfMonthPlaceholder`),helperText:t(`updateWindowPolicy.daysOfMonthHelper`),className:`w-48`}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:p?t(`updateWindowPolicy.updateWindowWithTz`,{tz:p}):t(`updateWindowPolicy.updateWindow`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(pt,{type:`time`,value:d.windowStart,onChange:e=>y({windowStart:e.target.value})}),(0,X.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t(`updateWindowPolicy.to`)}),(0,X.jsx)(pt,{type:`time`,value:d.windowEnd,onChange:e=>y({windowEnd:e.target.value})})]})]})]}),(0,X.jsx)(h,{variant:`primary`,loading:v.isPending,onClick:async()=>{let r=d.frequency===`monthly`&&m!==null?x(m):d.daysOfMonth;try{await v.mutateAsync({enabled:d.enabled,timezone:`UTC`,schedule:{frequency:d.frequency,days_of_week:d.frequency===`weekly`?d.daysOfWeek:[],days_of_month:d.frequency===`monthly`?r:[],window:{start:Eo(d.windowStart),end:Eo(d.windowEnd)}}}),V.success(t(`updateWindowPolicy.toastSaved`)),u(null),g(null),n.invalidateQueries({queryKey:at({path:{id:e}})})}catch{V.error(t(`updateWindowPolicy.toastSaveFailed`))}},disabled:v.isPending||!f,children:t(`updateWindowPolicy.savePolicy`)})]})}function Ao({assistantId:e,open:t,onClose:n}){let{t:r}=G(`settings`);return(0,X.jsx)(O.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(O.Content,{size:`md`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:r(`updateWindowModal.title`)}),(0,X.jsx)(O.Description,{children:r(`updateWindowModal.description`)})]}),(0,X.jsx)(O.Body,{children:(0,X.jsx)(ko,{assistantId:e})})]})})}function jo(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function Mo({open:e,onOpenChange:t}){let{t:n}=G(`settings`),r=K(),[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(!1),f=(0,Y.useRef)(e),p=()=>r.invalidateQueries({queryKey:Se()}),m=e=>{Ct({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},g=Gt({onSuccess:e=>{if(!f.current){m(e.factor_id);return}a(e)},onError:e=>{let r=jo(e);r===`no_workos_account`?V.error(n(`enrollTotpModal.toastNoWorkosAccount`)):r===`throttled`||r===`workos_rate_limited`?V.error(n(`enrollTotpModal.toastThrottled`)):r===`factor_limit_reached`?V.error(n(`enrollTotpModal.toastFactorLimitReached`)):V.error(n(`enrollTotpModal.toastStartFailed`)),t(!1)}}),_=d({onSuccess:e=>{e.valid?(u.current=!0,V.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1)):l(n(`enrollTotpModal.errorCodeMismatch`))},onError:e=>{let r=jo(e);if(r===`challenge_already_verified`){u.current=!0,V.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1);return}if(r===`challenge_expired`||r===`challenge_not_found`){i&&m(i.factor_id),a(null),s(``),l(n(`enrollTotpModal.errorSessionExpired`)),g.mutate({});return}if(r===`throttled`||r===`workos_rate_limited`){l(n(`enrollTotpModal.errorThrottledInline`));return}l(n(`enrollTotpModal.errorVerifyFailed`))}});(0,Y.useEffect)(()=>{f.current=e,e&&(u.current=!1,a(null),s(``),l(null),g.mutate({}))},[e]);let v=e=>{!e&&_.isPending||(!e&&i&&!u.current&&m(i.factor_id),t(e))},y=()=>{i&&Qt(i.secret,{successMessage:n(`enrollTotpModal.copySuccess`),errorMessage:n(`enrollTotpModal.copyError`)})},b=()=>{!i||o.length!==6||_.isPending||(l(null),_.mutate({body:{challenge_id:i.challenge_id,code:o}}))};return(0,X.jsx)(O.Root,{open:e,onOpenChange:v,children:(0,X.jsxs)(O.Content,{size:`sm`,children:[(0,X.jsxs)(O.Header,{children:[(0,X.jsx)(O.Title,{children:n(`enrollTotpModal.title`)}),(0,X.jsx)(O.Description,{children:n(`enrollTotpModal.description`)})]}),(0,X.jsx)(O.Body,{children:i===null?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,X.jsx)(q,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,X.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,X.jsx)(`img`,{src:i.qr_code,alt:n(`enrollTotpModal.qrCodeAlt`),className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.manualKeyHint`)}),(0,X.jsxs)(`button`,{type:`button`,onClick:y,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,X.jsx)(`span`,{className:`break-all text-left`,children:i.secret}),(0,X.jsx)(Cn,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,X.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.codeLabel`)}),(0,X.jsx)(pt,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:n(`enrollTotpModal.codePlaceholder`),value:o,onChange:e=>s(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,X.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,X.jsxs)(O.Footer,{children:[(0,X.jsx)(h,{variant:`outlined`,onClick:()=>v(!1),disabled:_.isPending,children:n(`enrollTotpModal.cancel`)}),(0,X.jsx)(h,{onClick:b,disabled:i===null||o.length!==6||_.isPending,children:_.isPending?n(`enrollTotpModal.verifying`):n(`enrollTotpModal.verify`)})]})]})})}function No(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Po(){let{t:e}=G(`settings`),t=K(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(null),o=W({...Bt()}),s=o.data??[],c=()=>t.invalidateQueries({queryKey:Se()}),l=ve({onSuccess:()=>{V.success(e(`twoFactorSection.toastRemoved`)),c()},onError:t=>{if(jo(t)===`factor_not_found`){c();return}V.error(e(`twoFactorSection.toastRemoveFailed`))}});return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.isPending?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,X.jsx)(q,{className:`h-4 w-4 animate-spin`}),(0,X.jsx)(`span`,{className:`text-body-medium-default`,children:e(`twoFactorSection.loading`)})]}):o.isError?(0,X.jsx)(B,{tone:`error`,children:(0,X.jsx)(rn,{ns:`settings`,i18nKey:`twoFactorSection.loadError`,components:{retryButton:(0,X.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void o.refetch()})}})}):s.length===0?(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`twoFactorSection.emptyDescription`)}):(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:s.map(t=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(Tn,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`twoFactorSection.authenticatorApp`)}),(0,X.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[t.user,t.created_at?e(`twoFactorSection.addedOn`,{date:No(t.created_at)}):``]})]})]}),(0,X.jsx)(h,{variant:`dangerOutline`,onClick:()=>a(t),disabled:l.isPending,children:e(`twoFactorSection.remove`)})]},t.id))}),!o.isPending&&!o.isError&&s.length===0&&(0,X.jsx)(h,{onClick:()=>r(!0),className:`self-start`,children:e(`twoFactorSection.addAuthenticatorApp`)}),(0,X.jsx)(Mo,{open:n,onOpenChange:r}),(0,X.jsx)(M,{open:i!==null,title:e(`twoFactorSection.removeDialogTitle`),message:e(`twoFactorSection.removeDialogMessage`),confirmLabel:e(`twoFactorSection.removeDialogConfirm`),destructive:!0,onConfirm:()=>{i&&l.mutate({path:{id:i.id}}),a(null)},onCancel:()=>a(null)})]})}var Q=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Fo=`local`,Io=`docker`,Lo=`vellum`;function Ro(e){switch((e??``).toLowerCase()){case Fo:return`local`;case Io:return`docker`;case Lo:return`managed`;default:return`other`}}function zo(e){let t=Ro(e);return t===`managed`?`local`:t===`local`?`platform`:null}function Bo(e){switch(e){case`docker`:return`teleportCard.moveToDocker`;case`platform`:return`teleportCard.moveToPlatform`;case`local`:return`teleportCard.moveToLocal`}}var Vo={macos:`Macos`,windows:`Windows`,linux:`Linux`};function Ho(e,t=`macos`){switch(e){case`docker`:return`teleportCard.dockerDescription${Vo[t]}`;case`platform`:return`teleportCard.platformDescription`;case`local`:return`teleportCard.localDescription${Vo[t]}`}}function Uo(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}var Wo=3600*1e3;function Go(e,t=Date.now(),n=Wo){for(let r of e){if(!r)continue;let e=Date.parse(r);if(Number.isNaN(e))continue;let i=t-e;if(i>=0&&i<=n)return!0}return!1}function Ko(e){return e.filter(e=>e.ready_to_use!==!1).map(e=>e.created_at)}function qo(e,t){return e.some(e=>e.snapshot_name===t&&e.ready_to_use===!0)}async function Jo(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function Yo(e){let t=S(e);if(!t)throw new Q(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function Xo(e,t){let n=await ot(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function Zo(e,t){let n=Yo(e),r=await Xo(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new Q(`export_failed`,`Export failed (HTTP ${i.status}).`);return Jo(i,t)}async function Qo(e,t){let n=Yo(e),r=await Xo(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new Q(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await ns(i);if(a&&a.success===!1)throw new Q(`import_failed`,a.error??`Import reported failure`)}async function $o(e){let t=Yo(e),n=await Xo(e,t),r=await fetch(`${t}/v1/backups/create`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`backup_failed`,U(`settings:teleportCard.backupLocalFailed`,{status:r.status}));let i=await ns(r);if(i&&i.success===!1)throw new Q(`backup_failed`,U(`settings:teleportCard.backupLocalReportedFailure`))}async function es(e,t){let{data:n,response:r}=await k.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new Q(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new Q(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function ts(e,t){let{data:n,response:r}=await k.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new Q(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new Q(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function ns(e){try{return await e.json()}catch{return null}}async function rs(e,t={}){let n=Ro(e.cloud);if(n===`managed`)return os(e.assistantId,t);if(n===`local`)return $o(e);throw new Q(`backup_failed`,U(`settings:teleportCard.backupUnsupported`))}async function is(e){let t=await _e({path:{assistant_id:e},throwOnError:!1});if(!(t.response?.ok??!1))throw new Q(`backup_failed`,U(`settings:teleportCard.backupListFailed`,{status:t.response?.status??0}));let n=t.data?.backups;return Array.isArray(n)?n:[]}var as=e=>new Promise(t=>setTimeout(t,e));async function os(e,t){if(Go(Ko(await is(e))))return;let n=await Wt({path:{assistant_id:e},throwOnError:!1});if(!(n.response?.ok??!1))throw new Q(`backup_failed`,U(`settings:teleportCard.backupCreateFailed`,{status:n.response?.status??0}));let r=n.data,i=r?.snapshot_name;if(!i)throw new Q(`backup_failed`,U(`settings:teleportCard.backupNoSnapshotName`));if(r?.ready_to_use===!0)return;let a=t.readyTimeoutMs??6e5,o=t.readyPollIntervalMs??5e3,s=Date.now()+a;for(;Date.now()<s;)if(await as(o),qo(await is(e),i))return;throw new Q(`backup_failed`,U(`settings:teleportCard.backupNotReady`,{snapshot:i,seconds:Math.round(a/1e3)}))}async function ss(e){if(e.kind===`managed`)return e.id;try{let t=await gt(e.id,{allowGatewayRepair:!1});return C(t)?t:null}catch(e){return e instanceof _?e.platformAssistantId:null}}var cs=new Set([500,502,503,504]),$=3,ls=e=>new Promise(t=>setTimeout(t,e));async function us(e,t=new Set){for(let n=0;n<=$;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<$&&cs.has(o)&&!t.has(o)){await ls(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new Q(`unknown`,`Unexpected retry loop exit`)}async function ds(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await us(()=>k.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new Q(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new Q(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function fs(e,t){let{status:n,data:r,error:i}=await us(()=>k.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=Uo(i);if(e)throw new Q(`version_mismatch`,e)}if(n!==200&&n!==201)throw new Q(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function ps(e,t,n){for(let r=0;r<=$;r++){let i=await ms(e,t,n);if(r<$&&cs.has(i)){await ls(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new Q(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function ms(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new Q(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new Q(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function hs(e,t){for(let n=0;n<=$;n++){let r=await fetch(e,{method:`GET`});if(n<$&&cs.has(r.status)){await ls(2**n*1e3),t?.(0);continue}if(!r.ok)throw new Q(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return Jo(r,t)}throw new Q(`import_failed`,`Unexpected retry loop exit`)}async function gs(e){let{status:t,data:n,error:r}=await us(()=>k.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function _s(e){let{status:t,data:n}=await us(()=>k.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new Q(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var vs=5e3,ys=36e5,bs=5*6e4,xs=30,Ss=e=>new Promise(t=>setTimeout(t,e));function Cs(){let e=cn(),t=K(),r=n(),i=zo(r?.cloud),[a,o]=(0,Y.useState)({kind:`idle`}),[s,c]=(0,Y.useState)(!1),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=(0,Y.useCallback)(e=>{o({kind:`transferring`,step:e,progress:null})},[]),f=(0,Y.useCallback)(e=>{o(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,Y.useCallback)(async()=>{if(!(!r||!i)){u.current={id:r.assistantId,kind:Ro(r.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(d(U(`settings:teleportCard.backupStep`)),await rs(r),i===`platform`)await ws(r,d,f,l);else if(i===`local`)await Ts(r,d,f,l);else throw new Q(`unknown`,U(`settings:teleportCard.unsupportedDestination`));o({kind:`verifying`})}catch(e){o({kind:`failed`,error:U(`settings:teleportCard.teleportFailed`,{message:e instanceof Q||e instanceof Error?e.message:U(`settings:teleportCard.teleportFailedUnknown`)})}),R(e,{context:`teleport-execute`}),await Ds(t,l.current,u.current,`teleport-execute-cleanup`),l.current=null}}},[r,i,d,f,t]),m=(0,Y.useCallback)(()=>c(!0),[]),h=(0,Y.useCallback)(()=>c(!1),[]),g=(0,Y.useCallback)(()=>{c(!1),p()},[p]),_=(0,Y.useCallback)(()=>{l.current=null,u.current=null,o({kind:`idle`})},[]);return{destination:i,phase:a,confirmOpen:s,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,Y.useCallback)(()=>{let n=l.current,r=u.current;n&&(d(U(`settings:teleportCard.switchingStep`)),(async()=>{let i=null;try{let e=D.getState();n.kind===`managed`?await e.connectPlatformAssistant(n.id):await e.connectLocalAssistant(n.id),i=await ss(n),n.kind===`local`&&(i===null&&R(Error(`teleport successor could not be resolved`),{context:`teleport-successor-unresolved`}),Mt(n.id,{onError:e=>R(e,{context:`teleport-inject-platform-identity`})}))}catch(e){o({kind:`failed`,error:U(`settings:teleportCard.switchFailed`,{message:e instanceof Error?e.message:U(`settings:teleportCard.switchFailedUnknown`)})}),R(e,{context:`teleport-confirm-switch`});return}r&&nt(t,r.id,{successorAssistantId:i??void 0}).then(e=>{e.ok||R(Error(e.error),{context:`teleport-retire-source`})}),_(),e(L.assistant,{replace:!0})})())},[e,_,t,d]),cancelTeleport:(0,Y.useCallback)(()=>{let e=l.current,n=u.current;l.current=null,u.current=null,o({kind:`idle`}),Ds(t,e,n,`teleport-cancel-retire-target`)},[t]),reset:_}}async function ws(e,t,n,r){t(U(`settings:teleportCard.stepExportingLocal`));let i=await Zo(e,n);t(U(`settings:teleportCard.stepResolvingOrganization`));let a=await ks();t(U(`settings:teleportCard.stepCheckingExisting`));let o=(await rt({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new Q(`existing_platform_assistant`,U(`settings:teleportCard.existingPlatformAssistant`,{id:o.id}));t(U(`settings:teleportCard.stepUploading`));let s=await ds(e.resources?.runtimeVersion);await ps(s.url,i,n),t(U(`settings:teleportCard.stepSettingUpCloud`));let c=await Qe(void 0,`create`);if(!c.ok)throw new Q(`import_failed`,U(`settings:teleportCard.cloudSetupFailed`));if(c.status===200)throw new Q(`existing_platform_assistant`,U(`settings:teleportCard.existingPlatformAssistant`,{id:c.data.id}));let l=c.data.id;await be({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:u(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await Ut(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(U(`settings:teleportCard.stepFinalizingCloud`)),await As(l),t(U(`settings:teleportCard.stepImportingToCloud`));let d=await gs(s.bundleKey);if(d.status<200||d.status>=300){let e=d.body;throw new Q(`import_failed`,e?.error??U(`settings:teleportCard.importFailedHttp`,{status:d.status}))}if(d.status===202){let e=d.body?.job_id;if(!e)throw new Q(`import_failed`,U(`settings:teleportCard.importNoJobId`));await js(e)}else{let e=d.body;if(e&&e.success===!1)throw new Q(`import_failed`,e.error??U(`settings:teleportCard.importReportedFailure`))}}async function Ts(e,t,n,r){t(U(`settings:teleportCard.stepPreparingExport`));let i=await ds(await Os(e.assistantId),`runtime`);t(U(`settings:teleportCard.stepExportingCloud`));let a=await es(e.assistantId,i.url);await Ms(e.assistantId,a),t(U(`settings:teleportCard.stepPreparingLocal`));let{assistant:o,createdFresh:s}=await Ns();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Es(o,s);if(!c)throw new Q(`local_assistant_not_found`,U(`settings:teleportCard.localRuntimeVersionUnknown`));t(U(`settings:teleportCard.stepPreparingImport`));let l=await fs(i.bundleKey,c);t(U(`settings:teleportCard.stepDownloading`));let u=await hs(l,n);t(U(`settings:teleportCard.stepImporting`)),await Fs(o,u),await Ut(e.assistantId)}async function Es(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await Mn())?.version??void 0}async function Ds(e,t,n,r){if(t?.createdFresh){let n=await nt(e,t.id);n.ok||R(Error(n.error),{context:r})}n&&await Ut(n.id)}async function Os(e){let t=await lt(e);return t.ok?t.data.version??void 0:void 0}async function ks(){let e=Me.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=Me.getState().organizations,n=je();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new Q(`no_organizations`,U(`settings:teleportCard.noOrganizations`));if(t.length>1)throw new Q(`multiple_organizations`,U(`settings:teleportCard.multipleOrganizations`));let r=t[0].id;return Me.getState().setCurrentOrganizationId(r),r}async function As(e){let t=Date.now();for(;Date.now()-t<bs;){let{data:t,response:n}=await I({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await Ss(vs)}}async function js(e){let t=Date.now();for(;Date.now()-t<ys;){await Ss(vs);let t=await _s(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new Q(`import_failed`,t.error??U(`settings:teleportCard.importJobFailed`))}throw new Q(`import_failed`,U(`settings:teleportCard.importTimedOut`))}async function Ms(e,t){let n=Date.now();for(;Date.now()-n<ys;)if(await Ss(vs),await ts(e,t)===`complete`)return;throw new Q(`export_timed_out`,U(`settings:teleportCard.exportTimedOut`))}async function Ns(){let e=await s(void 0,void 0);if(!e.ok)throw new Q(`local_assistant_not_found`,e.error??U(`settings:teleportCard.localCreateFailed`));await It();let t=e.assistantId?Oe().find(t=>t.assistantId===e.assistantId):Ps();if(!t)throw new Q(`local_assistant_not_found`,U(`settings:teleportCard.localNotFound`));return{assistant:t,createdFresh:!0}}function Ps(){return Oe().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function Fs(e,t){let n;for(let r=0;r<xs;r++)try{await Qo(e,t);return}catch(e){n=e,await Ss(1e3)}throw n instanceof Error?n:new Q(`import_failed`,U(`settings:teleportCard.importFailed`))}function Is(){let{t:e}=G(`settings`),t=Cs(),{destination:n,phase:r}=t,i=ie();return!n||i===`gated`?null:(0,X.jsxs)(J,{title:e(`teleportCard.title`),subtitle:e(`teleportCard.subtitle`),children:[r.kind===`idle`&&i===`disabled`&&(0,X.jsx)(H,{children:e(`teleportCard.loginNotice`)}),r.kind===`idle`&&i===`full`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(Ho(n,Ft()))}),(0,X.jsx)(h,{variant:`outlined`,className:`self-start`,onClick:t.requestTeleport,children:e(Bo(n))})]}),r.kind===`transferring`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r.progress==null&&(0,X.jsx)(q,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r.step})]}),r.progress!=null&&(0,X.jsx)(Ke,{value:r.progress,"aria-label":e(`teleportCard.progressAriaLabel`),className:`max-w-[240px]`})]}),r.kind===`verifying`&&(0,X.jsx)(B,{tone:`success`,icon:(0,X.jsx)(An,{className:`h-4 w-4`}),title:e(`teleportCard.verifyTitle`),actions:(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(h,{variant:`primary`,onClick:t.confirmAndSwitch,children:e(`teleportCard.confirmAndSwitch`)}),(0,X.jsx)(h,{variant:`outlined`,onClick:t.cancelTeleport,children:e(`teleportCard.cancel`)})]})}),r.kind===`failed`&&(0,X.jsx)(B,{tone:`error`,title:r.error,actions:(0,X.jsx)(h,{variant:`outlined`,onClick:t.reset,children:e(`teleportCard.tryAgain`)})}),(0,X.jsx)(M,{open:t.confirmOpen,title:e(Bo(n)),message:e(`teleportCard.confirmMessage`),confirmLabel:e(`teleportCard.confirmLabel`),onConfirm:t.confirm,onCancel:t.cancelConfirm})]})}function Ls(){let{t:e}=G(`settings`),{assistant:t,healthz:r,healthzLoading:i,healthzFetching:a,healthzPolling:o,refetch:s,refetchUntilResized:c}=Bn(),l=z.use.multiPlatformAssistant(),u=z.use.accountMfa(),d=Pe.use.settingsSleepPolicy(),f=en(),p=Fe(),g=wt()||f||Ue()||p,_=cn(),v=ie(),y=ie({platformHostedOnly:!0}),b=tt(),x=m({assistantId:t?.id??null,enabled:y===`full`&&b}),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[E,D]=sn();(0,Y.useEffect)(()=>{if(E.get(`preferences`)!==`open`)return;let e=new URLSearchParams(E);e.delete(`preferences`),D(e,{replace:!0}),T(!0)},[E,D]);let O=t?.is_local&&!wt()?null:t,k=n(),A=wt()&&!!t&&!!k&&vt(k),j=A,M=A&&!Ue(),N=y===`full`&&!!O||M&&!!t;(0,Y.useEffect)(()=>{!t||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[t]);let P=r?.version??t?.current_release_version??null,ee=()=>{let e=fe();if(Ue()&&!p&&e){let t=new URLSearchParams({register:Et()}),n=Ae();n&&t.set(`name`,n);let r=new URL(e).origin;window.location.assign(`${r}${L.selectAssistant}?${t.toString()}`);return}_(`${L.selectAssistant}?noAutoSkip=1`)},F=(v===`full`||j)&&!!O||v===`disabled`&&!j,I=y!==`gated`;return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[x.status&&x.mode!==`inactive`&&(0,X.jsx)(Ze,{status:x.status,mode:x.mode,isAcknowledging:x.isAcknowledging,acknowledgeError:x.acknowledgeError?.message??null,onAcknowledge:()=>void x.acknowledge(),onReviewWorkspaceData:()=>void _(`${L.workspace}?sort=size`),onUpgradeStorage:y===`full`?()=>void _(L.plans):null}),(0,X.jsxs)(jn,{assistant:b?O:null,showHandles:f&&v===`full`,children:[(0,X.jsx)(Co,{}),u&&v!==`gated`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.twoFactorTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.twoFactorDescription`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:v===`disabled`?(0,X.jsx)(H,{children:e(`generalPage.twoFactorLoginNotice`)}):(0,X.jsx)(Po,{})})]})]})]}),(0,X.jsx)(J,{title:e(`generalPage.versionTitle`),subtitle:e(`generalPage.versionSubtitle`),accessory:y===`full`&&O?(0,X.jsx)(h,{variant:`outlined`,onClick:()=>C(!0),children:e(`generalPage.updateWindow`)}):void 0,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[y===`full`&&O&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($r,{assistantId:O.id,currentVersion:P,releaseChannel:O.release_channel,onUpgradeComplete:()=>{s()}}),(0,X.jsx)(eo,{assistantId:O.id,onComplete:()=>{s()}})]}),M&&t&&(0,X.jsx)(ei,{assistantId:t.id,currentVersion:P,onUpgradeComplete:()=>{s()}}),!N&&t&&(0,X.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.current`)}),(0,X.jsx)(Vn,{version:P,loading:i&&!t.current_release_version,assistantId:t.id??null})]}),y===`disabled`&&!M&&(0,X.jsx)(H,{children:e(`generalPage.updatesLoginNotice`)}),(0,X.jsx)(oo,{})]})}),y===`full`&&O&&(0,X.jsx)(Ao,{assistantId:O.id,open:S,onClose:()=>C(!1)}),y===`full`&&t&&(0,X.jsx)(lo,{assistant:t,healthz:r,healthzLoading:i,healthzFetching:a,healthzPolling:o,refetch:s,refetchUntilResized:c}),y===`disabled`&&(0,X.jsx)(J,{id:`storage-resources`,title:e(`generalPage.computeResourcesTitle`),subtitle:e(`generalPage.computeResourcesSubtitle`),children:(0,X.jsx)(H,{children:e(`generalPage.computeResourcesLoginNotice`)})}),(0,X.jsx)(J,{title:e(`generalPage.preferencesTitle`),subtitle:e(`generalPage.preferencesSubtitle`),accessory:(0,X.jsx)(h,{variant:`outlined`,onClick:()=>T(!0),children:e(`generalPage.customize`)}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsx)(Zn,{}),(0,X.jsx)(Vr,{})]})}),(0,X.jsx)(Ya,{open:w,onClose:()=>T(!1)}),(0,X.jsx)(ii,{}),(0,X.jsx)(Va,{}),y===`full`&&O&&d&&(0,X.jsx)(J,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,X.jsx)(Yr,{assistantId:O.id})}),y===`disabled`&&d&&(0,X.jsx)(J,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,X.jsx)(H,{children:e(`generalPage.sleepPolicyLoginNotice`)})}),l&&!g&&(0,X.jsx)(Wr,{}),g&&(0,X.jsx)(J,{title:e(`generalPage.switchAssistantTitle`),subtitle:e(`generalPage.switchAssistantSubtitle`),accessory:(0,X.jsx)(h,{variant:`outlined`,onClick:ee,children:e(`generalPage.chooseAssistant`)})}),kt()&&(0,X.jsx)(Is,{}),(F||I)&&(0,X.jsx)(J,{variant:`danger`,title:e(`generalPage.dangerZoneTitle`),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[F&&(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.retireAssistantTitle`)}),(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.retireAssistantDescription`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:(v===`full`||j)&&O?(0,X.jsx)(uo,{assistantId:O.id}):(0,X.jsx)(H,{children:e(`generalPage.retireAssistantLoginNotice`)})})]}),F&&I&&(0,X.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,X.jsx)(ti,{})]})})]})}export{Ls as GeneralPage};