@xopcai/xopc 0.0.450 → 0.0.454

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 (436) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-Tn5McYcg.js → activity-store-BKH-qNPt.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BX5HhrTI.js → agent-avatar-dicebear-DY6IWy0_.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-display-C7Dx9nt1.js → agent-avatar-display-tnAtQOAZ.js} +2 -2
  6. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-AAJsxEjB.js → agent-defaults-settings-panel-BLQ2N_dY.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BhtzU8qr.js → agent-plugin-dialog-Bfsm4GOs.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agents-CbGYb9WI.js → agents-CDNiLv0W.js} +3 -3
  9. package/dist/gateway/static/root/assets/{agents-admin-api-CShyoj9I.js → agents-admin-api-DGZsm8U4.js} +1 -1
  10. package/dist/gateway/static/root/assets/{api-BET9vZ1l.js → api-Bbj5k-7e.js} +1 -1
  11. package/dist/gateway/static/root/assets/api-BhipC15e.js +1 -0
  12. package/dist/gateway/static/root/assets/{app-link-CdD448kS.js → app-link-CCZ-LmVT.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-BxOShFPO.js → app-management-settings-panel-fwhXHKxt.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-L450QlMW.js → appearance-settings-BHkl-vFO.js} +1 -1
  15. package/dist/gateway/static/root/assets/{apps-page-Bz6_fyMs.js → apps-page-DtCWwdsK.js} +1 -1
  16. package/dist/gateway/static/root/assets/{archive-plugin-BCXEOal7.js → archive-plugin-B9xaxa7V.js} +1 -1
  17. package/dist/gateway/static/root/assets/arrow-up-right-T72JbQ1Q.js +1 -0
  18. package/dist/gateway/static/root/assets/{automation-api-B3Jnoa2G.js → automation-api-BHMjSwcy.js} +1 -1
  19. package/dist/gateway/static/root/assets/{automation-result-state-BHAKc5QI.js → automation-result-state-BgAjEoNV.js} +1 -1
  20. package/dist/gateway/static/root/assets/automation-run-list-D3Eon5C0.js +1 -0
  21. package/dist/gateway/static/root/assets/{automation-task-card-Clf0fe_n.js → automation-task-card-DJRg72t-.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automations-page-BEG5xLew.js → automations-page-DdAzXb7s.js} +1 -1
  23. package/dist/gateway/static/root/assets/{automations-workspace-Cfq1C6XB.js → automations-workspace-D0nNat6N.js} +2 -2
  24. package/dist/gateway/static/root/assets/{binary-plugins-B7tuUWzS.js → binary-plugins-CgsjdprR.js} +1 -1
  25. package/dist/gateway/static/root/assets/{block-editor-D-YHASZr.js → block-editor-r6vj6dZO.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-settings-page-DdMMia7Y.js → browser-settings-page-APCGT8Yr.js} +1 -1
  27. package/dist/gateway/static/root/assets/{capabilities-YfkMBZCb.js → capabilities-0gYkjdax.js} +1 -1
  28. package/dist/gateway/static/root/assets/{capabilities-Cxh3nYa6.js → capabilities-BgBwcqvY.js} +1 -1
  29. package/dist/gateway/static/root/assets/capabilities-page-B1x3TwdV.js +2 -0
  30. package/dist/gateway/static/root/assets/capabilities-settings-panel-CZ78ckHR.js +8 -0
  31. package/dist/gateway/static/root/assets/capability-navigation-QtHJxxW2.js +1 -0
  32. package/dist/gateway/static/root/assets/{channels-DdSEH-R2.js → channels-8Y08v4Q2.js} +1 -1
  33. package/dist/gateway/static/root/assets/{chat-agents-api-CgasFAm4.js → chat-agents-api-BRQDNNI5.js} +1 -1
  34. package/dist/gateway/static/root/assets/{chat-chart-block-Cgks7rH3.js → chat-chart-block-qMGhfeQZ.js} +1 -1
  35. package/dist/gateway/static/root/assets/chat-page-CSTyfO9c.js +71 -0
  36. package/dist/gateway/static/root/assets/{chat-terminal-dock-aCu4X5Jo.js → chat-terminal-dock-0PJ9dURQ.js} +1 -1
  37. package/dist/gateway/static/root/assets/{command-palette-api-Bku_h283.js → command-palette-api-C4U_-rDo.js} +1 -1
  38. package/dist/gateway/static/root/assets/composer-model-config-control-B9Q40ptH.js +1 -0
  39. package/dist/gateway/static/root/assets/composer-notifications-ByuA8h5Z.js +1 -0
  40. package/dist/gateway/static/root/assets/composer-payload-handoff-zr1JDn3p.js +1 -0
  41. package/dist/gateway/static/root/assets/{computer-settings-page-zvWUPPAr.js → computer-settings-page-D2F1quZR.js} +1 -1
  42. package/dist/gateway/static/root/assets/{confirm-dialog-D7dQJytv.js → confirm-dialog-DrA5mTQp.js} +1 -1
  43. package/dist/gateway/static/root/assets/connected-providers-grid-CgULhOBZ.js +1 -0
  44. package/dist/gateway/static/root/assets/{connection-usage-guide-DL2T6cSN.js → connection-usage-guide-DkDsHm_l.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connector-service-page-a0gQC-nc.js → connector-service-page-1AcvESmp.js} +1 -1
  46. package/dist/gateway/static/root/assets/{connectors-api-DNVUmf9M.js → connectors-api-C1OML7OO.js} +1 -1
  47. package/dist/gateway/static/root/assets/connectors-page-CMIY0Zj_.js +1 -0
  48. package/dist/gateway/static/root/assets/{date-picker-E0cqnNlR.js → date-picker-D1eFhoMI.js} +1 -1
  49. package/dist/gateway/static/root/assets/{date-time-picker-CrC_VKpw.js → date-time-picker-CqplKVk6.js} +1 -1
  50. package/dist/gateway/static/root/assets/{desktop-pet-D1MkNl5F.js → desktop-pet-UmrjWSq-.js} +1 -1
  51. package/dist/gateway/static/root/assets/{desktop-pet-settings-BA6u5Md-.js → desktop-pet-settings-DRRDJMu6.js} +1 -1
  52. package/dist/gateway/static/root/assets/{dev-view-store-DnqJb6NS.js → dev-view-store-CtKJMK52.js} +1 -1
  53. package/dist/gateway/static/root/assets/{device-pairing-wizard-Ba3d606o.js → device-pairing-wizard-C4aSCbqo.js} +1 -1
  54. package/dist/gateway/static/root/assets/{directory-picker-path-field-lcps-hsZ.js → directory-picker-path-field-D9U9yfnb.js} +1 -1
  55. package/dist/gateway/static/root/assets/{discussion-annotation-sync-BmvCn1Xn.js → discussion-annotation-sync-D-eGt1_L.js} +1 -1
  56. package/dist/gateway/static/root/assets/dist-CY7CS_D3.js +1 -0
  57. package/dist/gateway/static/root/assets/extension-authoritative-grants-8ONVOjPW.js +1 -0
  58. package/dist/gateway/static/root/assets/{extension-debug-page-BOJbNj9D.js → extension-debug-page-BTLcC8-r.js} +1 -1
  59. package/dist/gateway/static/root/assets/extension-iframe-host-D0-OvFV2.js +1 -0
  60. package/dist/gateway/static/root/assets/{extension-marketplace-api-BrLsjJLA.js → extension-marketplace-api-DLRCNlej.js} +1 -1
  61. package/dist/gateway/static/root/assets/extension-message-router-DboLTCVp.js +1 -0
  62. package/dist/gateway/static/root/assets/extension-page-CdpI-Plq.js +1 -0
  63. package/dist/gateway/static/root/assets/extension-provider-DUDaMvQg.js +1 -0
  64. package/dist/gateway/static/root/assets/{extension-settings-page-BuV-Vuvb.js → extension-settings-page-biWCnMGr.js} +1 -1
  65. package/dist/gateway/static/root/assets/{file-preview-surface-B3nLuoQO.js → file-preview-surface-CnBRiQo8.js} +1 -1
  66. package/dist/gateway/static/root/assets/{gateway-config-swr-CtZy1Qw0.js → gateway-config-swr-BV5fpBSK.js} +1 -1
  67. package/dist/gateway/static/root/assets/{gateway-realtime-CG65gHUY.js → gateway-realtime-CIqLQXlm.js} +1 -1
  68. package/dist/gateway/static/root/assets/gateway-realtime-store-B6T1Xzag.js +1 -0
  69. package/dist/gateway/static/root/assets/{gateway-restart-Cr5xtfZU.js → gateway-restart-DBkfCzT5.js} +1 -1
  70. package/dist/gateway/static/root/assets/{gateway-settings-BwMwdwXh.js → gateway-settings-DTzXUm9f.js} +1 -1
  71. package/dist/gateway/static/root/assets/{gateway-startup-retry-DztAHGru.js → gateway-startup-retry-B49N_Ngm.js} +1 -1
  72. package/dist/gateway/static/root/assets/{global-defaults-api-yHc-ZfjU.js → global-defaults-api-DVpxe45P.js} +1 -1
  73. package/dist/gateway/static/root/assets/home-page-DvaxBrjG.js +3 -0
  74. package/dist/gateway/static/root/assets/{image-generation-api-D5eo_stq.js → image-generation-api-CAKYslID.js} +1 -1
  75. package/dist/gateway/static/root/assets/imports-page-C2KmQJ2H.js +1 -0
  76. package/dist/gateway/static/root/assets/index-B49yIcMR.css +1 -0
  77. package/dist/gateway/static/root/assets/index-BpzvsoS1.js +11 -0
  78. package/dist/gateway/static/root/assets/{install-connector-dialog-B-v1FT3P.js → install-connector-dialog-CmNvZt8M.js} +1 -1
  79. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BLBASsCP.js → keyboard-shortcuts-settings-syG2KRr2.js} +1 -1
  80. package/dist/gateway/static/root/assets/local-app-workbench-page-DGA4EHGm.js +1 -0
  81. package/dist/gateway/static/root/assets/local-apps-CB-MZAaL.js +1 -0
  82. package/dist/gateway/static/root/assets/{local-apps-page-Db93n4Zy.js → local-apps-page-I0O2ybpp.js} +1 -1
  83. package/dist/gateway/static/root/assets/{local-session-drafts-C6oPrCYY.js → local-session-drafts-DsPDloiq.js} +1 -1
  84. package/dist/gateway/static/root/assets/{locale-store-CQcW9_qA.js → locale-store-D3c8DIm-.js} +1 -1
  85. package/dist/gateway/static/root/assets/logs-page-u9FTZaTh.js +2 -0
  86. package/dist/gateway/static/root/assets/{management-api-Dh2r5GrQ.js → management-api-uxRxRX-6.js} +1 -1
  87. package/dist/gateway/static/root/assets/{management-settings-Fj25fafb.js → management-settings-BCbDfM7f.js} +1 -1
  88. package/dist/gateway/static/root/assets/{markdown-view-CkihBz06.js → markdown-view-ohhExTMC.js} +1 -1
  89. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-jh3dwNfg.js → mcp-conversation-setup-page-382BGqQC.js} +1 -1
  90. package/dist/gateway/static/root/assets/{media-plugins-BUapXtQZ.js → media-plugins-B5wtLz3Z.js} +1 -1
  91. package/dist/gateway/static/root/assets/messages-DPLud9GK.js +3 -0
  92. package/dist/gateway/static/root/assets/{model-selector-DYxgKUju.js → model-selector-CoKcq0AZ.js} +1 -1
  93. package/dist/gateway/static/root/assets/{models-hub-cache-D2cdb8nZ.js → models-hub-cache-CtooMAQW.js} +1 -1
  94. package/dist/gateway/static/root/assets/{note-detail-panel-BMtKrv-J.js → note-detail-panel-DiGQtSD0.js} +3 -3
  95. package/dist/gateway/static/root/assets/note-image-lightbox-Ds4M9fJJ.js +1 -0
  96. package/dist/gateway/static/root/assets/{notes-api-BhRyWe3S.js → notes-api-Cvet94d8.js} +1 -1
  97. package/dist/gateway/static/root/assets/{notes-page-DcmRJJbt.js → notes-page-DwlmKweX.js} +2 -2
  98. package/dist/gateway/static/root/assets/{oauth-api-D5iBtOid.js → oauth-api-BHp5dVNh.js} +1 -1
  99. package/dist/gateway/static/root/assets/{oauth-provider-connect-CmHsHynu.js → oauth-provider-connect-cvxtmf3C.js} +1 -1
  100. package/dist/gateway/static/root/assets/{open-capability-settings-Cvb65hQB.js → open-capability-settings-DQsmJxI7.js} +1 -1
  101. package/dist/gateway/static/root/assets/{page-context-capture-button-CTHQWfG6.js → page-context-capture-button-BwsK2uDe.js} +1 -1
  102. package/dist/gateway/static/root/assets/{page-context-draft-aApa5ApP.js → page-context-draft-ieK9IN3R.js} +1 -1
  103. package/dist/gateway/static/root/assets/page-header-store-Xe8CP_4a.js +1 -0
  104. package/dist/gateway/static/root/assets/personal-avatar-BZSC0BLP.js +1 -0
  105. package/dist/gateway/static/root/assets/personal-page-CbiD8Wn7.js +1 -0
  106. package/dist/gateway/static/root/assets/personal-profile-settings-KvdNnaNv.js +1 -0
  107. package/dist/gateway/static/root/assets/personal-settings-panel-_cxSzWsN.js +1 -0
  108. package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +1 -0
  109. package/dist/gateway/static/root/assets/{phone-dependencies-card-BBk6k0t0.js → phone-dependencies-card-C2OWtG2B.js} +1 -1
  110. package/dist/gateway/static/root/assets/{phone-model-connection-QJt8SAb7.js → phone-model-connection-CqmafRhr.js} +1 -1
  111. package/dist/gateway/static/root/assets/{phone-model-picker-CRxUxJNZ.js → phone-model-picker-BwYQtl_5.js} +1 -1
  112. package/dist/gateway/static/root/assets/{phone-settings-page-Df64khPY.js → phone-settings-page-CPteZZWu.js} +1 -1
  113. package/dist/gateway/static/root/assets/{phone-workspace-store-DAuPd2ie.js → phone-workspace-store-ReUEjG9m.js} +1 -1
  114. package/dist/gateway/static/root/assets/{plugin-details-dialog-Bcer4RC3.js → plugin-details-dialog-BlNVtbEU.js} +1 -1
  115. package/dist/gateway/static/root/assets/{preference-select-fields-DdV7q9Bd.js → preference-select-fields-BbA-g7Zq.js} +1 -1
  116. package/dist/gateway/static/root/assets/{product-automation-feedback-uKndNxpU.js → product-automation-feedback-DcPY76PG.js} +1 -1
  117. package/dist/gateway/static/root/assets/{product-delivery-DRyD9_Xq.js → product-delivery-2Ks17_OH.js} +1 -1
  118. package/dist/gateway/static/root/assets/{product-open-page-A7lyoXVv.js → product-open-page-BBJ7glAm.js} +1 -1
  119. package/dist/gateway/static/root/assets/{product-preview-content-BrdvkWOg.js → product-preview-content-UTOSc_ii.js} +1 -1
  120. package/dist/gateway/static/root/assets/{product-preview-modal-BxHKejcX.js → product-preview-modal-Q1RZqeMo.js} +2 -2
  121. package/dist/gateway/static/root/assets/project-detail-page-BlrtsEZK.js +7 -0
  122. package/dist/gateway/static/root/assets/{project-understanding-BVhSoQHu.js → project-understanding-B35f5MkG.js} +1 -1
  123. package/dist/gateway/static/root/assets/{projects-page-DSPoyFda.js → projects-page-CBH-sHOU.js} +1 -1
  124. package/dist/gateway/static/root/assets/{providers-api-B47s6_9Q.js → providers-api-BSmKlQ8K.js} +1 -1
  125. package/dist/gateway/static/root/assets/{recording-upload-B-IHTsVC.js → recording-upload-P1WcsdEY.js} +1 -1
  126. package/dist/gateway/static/root/assets/{registry-api-Bo8YiUE0.js → registry-api-DnVlwJ6M.js} +1 -1
  127. package/dist/gateway/static/root/assets/{remote-access-hub-BRf9znLV.js → remote-access-hub-CVEj3p0J.js} +1 -1
  128. package/dist/gateway/static/root/assets/{resource-unavailable-CAljzZx8.js → resource-unavailable-B_S1dFze.js} +1 -1
  129. package/dist/gateway/static/root/assets/route-preload-DGmrxJSb.js +2 -0
  130. package/dist/gateway/static/root/assets/runtime-health-zDkHcOZO.js +1 -0
  131. package/dist/gateway/static/root/assets/{runtime-tools-api-C28pB9__.js → runtime-tools-api-970sp5zI.js} +1 -1
  132. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-XYeadnhL.js → runtime-tools-settings-panel-au6vZ0sL.js} +1 -1
  133. package/dist/gateway/static/root/assets/{schema-form-CtRM41Re.js → schema-form-C9TYGa0_.js} +1 -1
  134. package/dist/gateway/static/root/assets/secret-input-DsjfQmDn.js +1 -0
  135. package/dist/gateway/static/root/assets/{service-recommendation-list-C6ydoBSU.js → service-recommendation-list-XeRFtJ-Z.js} +1 -1
  136. package/dist/gateway/static/root/assets/{session-api-D7FWdG43.js → session-api-CuT7EPI0.js} +1 -1
  137. package/dist/gateway/static/root/assets/session-channel-icon-BzkFo-Ci.js +1 -0
  138. package/dist/gateway/static/root/assets/{session-identity-label-BP7OIYth.js → session-identity-label-D5SAi0Uh.js} +1 -1
  139. package/dist/gateway/static/root/assets/session-manager-CyZHiuWY.js +25 -0
  140. package/dist/gateway/static/root/assets/{sessions-page-CyYkCsfy.js → sessions-page-BIxDwAIX.js} +1 -1
  141. package/dist/gateway/static/root/assets/settings-advanced-gate-Cy7xeKmH.js +1 -0
  142. package/dist/gateway/static/root/assets/{settings-advanced-section-3HwfHbqz.js → settings-advanced-section-nbkGHQ_4.js} +1 -1
  143. package/dist/gateway/static/root/assets/{settings-mode-store-BVvIXZlg.js → settings-mode-store-EQHfksdV.js} +1 -1
  144. package/dist/gateway/static/root/assets/{settings-page-C6ypo-jn.js → settings-page-D6RNHRHq.js} +1 -1
  145. package/dist/gateway/static/root/assets/{settings-page-header-CheboxIM.js → settings-page-header-19GJ_a45.js} +1 -1
  146. package/dist/gateway/static/root/assets/{settings-page-layout-CPFMZaLF.js → settings-page-layout-B2WCzSel.js} +1 -1
  147. package/dist/gateway/static/root/assets/{setup-interaction-page-BbCzYq9S.js → setup-interaction-page-C5i7y_pM.js} +1 -1
  148. package/dist/gateway/static/root/assets/{setup-status-panel-DUNgVqtz.js → setup-status-panel-Cwp8YKdT.js} +1 -1
  149. package/dist/gateway/static/root/assets/{share-link-dialog-0P9ghttc.js → share-link-dialog-DDsVTMZ-.js} +1 -1
  150. package/dist/gateway/static/root/assets/share-preview-page-C1S_gWGf.js +2 -0
  151. package/dist/gateway/static/root/assets/{shares-api-iiw4F-ra.js → shares-api-CepTFl1f.js} +1 -1
  152. package/dist/gateway/static/root/assets/{shares-settings-BQ1qXAJn.js → shares-settings-Cv-tdcAN.js} +1 -1
  153. package/dist/gateway/static/root/assets/{skill-api-CLtIjE8K.js → skill-api-CsT-iHnl.js} +1 -1
  154. package/dist/gateway/static/root/assets/{skill-list-api-DY0rRlUk.js → skill-list-api-CMJTjvSo.js} +1 -1
  155. package/dist/gateway/static/root/assets/{skill-reload-api-DJC8uWLu.js → skill-reload-api-S6B7P9ur.js} +1 -1
  156. package/dist/gateway/static/root/assets/{skills-page-CQYf7s9f.js → skills-page-BKcsJtYx.js} +1 -1
  157. package/dist/gateway/static/root/assets/sliding-segmented-CgQ3BFdb.js +1 -0
  158. package/dist/gateway/static/root/assets/{system-settings-panel-DdBmyc93.js → system-settings-panel-DhHPM5qU.js} +1 -1
  159. package/dist/gateway/static/root/assets/{task-detail-page-Bb1R4QsJ.js → task-detail-page-BHH2_Z9_.js} +3 -3
  160. package/dist/gateway/static/root/assets/{task-input-card-Xl4xFjCn.js → task-input-card-D_2rNF31.js} +1 -1
  161. package/dist/gateway/static/root/assets/{terminal-panel-store-B1EVdx4L.js → terminal-panel-store-CcUWpqvC.js} +1 -1
  162. package/dist/gateway/static/root/assets/{theme-store-BTkYFJOE.js → theme-store-D9pquJiM.js} +1 -1
  163. package/dist/gateway/static/root/assets/{tracing-settings-page-h-gbBAtl.js → tracing-settings-page-CjNrKILr.js} +1 -1
  164. package/dist/gateway/static/root/assets/{tunnel-api-BDoegsWD.js → tunnel-api-GtLO40pc.js} +1 -1
  165. package/dist/gateway/static/root/assets/{understanding-activity-store-DyFJDqHy.js → understanding-activity-store-BhB5wAbq.js} +1 -1
  166. package/dist/gateway/static/root/assets/{understanding-refresh-store-C0SRcgyd.js → understanding-refresh-store-BxtpXRfV.js} +1 -1
  167. package/dist/gateway/static/root/assets/{usage-page-CbJsT3zT.js → usage-page-CZa_a6_7.js} +1 -1
  168. package/dist/gateway/static/root/assets/{use-autosave-CB2B4NMO.js → use-autosave-BtOp6W9H.js} +1 -1
  169. package/dist/gateway/static/root/assets/use-composer-attachments-BTQZx8Nj.js +2 -0
  170. package/dist/gateway/static/root/assets/use-file-preview-expanded-B7nscYS4.js +15 -0
  171. package/dist/gateway/static/root/assets/{use-personal-profile-r0OuOlBJ.js → use-personal-profile-Cj7WGOfv.js} +1 -1
  172. package/dist/gateway/static/root/assets/use-realtime-voice-BS1rygyV.js +1 -0
  173. package/dist/gateway/static/root/assets/{use-workspace-tree-B9Bmg8LV.js → use-workspace-tree-DYosm4Gz.js} +1 -1
  174. package/dist/gateway/static/root/assets/{user-model-page-BudrJ73l.js → user-model-page-DmmJODQ4.js} +1 -1
  175. package/dist/gateway/static/root/assets/voice-CDlC6XMH.js +1 -0
  176. package/dist/gateway/static/root/assets/{voice-api-key-field-C8wd8ijq.js → voice-api-key-field-8voN8dQG.js} +1 -1
  177. package/dist/gateway/static/root/assets/voice-call-context-BM2A4bLz.js +1 -0
  178. package/dist/gateway/static/root/assets/voice-config-api-CrZd2aqw.js +1 -0
  179. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-TAmJNcsN.js → voice-input-shortcut-events-DcFp_fy4.js} +1 -1
  180. package/dist/gateway/static/root/assets/voice-settings-AckvhNnP.js +1 -0
  181. package/dist/gateway/static/root/assets/{work-discovery-overlay-DsyYo1p0.js → work-discovery-overlay-DAIk5csp.js} +1 -1
  182. package/dist/gateway/static/root/assets/{work-discovery-page-BJ9VN5Zd.js → work-discovery-page-CJeixeWQ.js} +1 -1
  183. package/dist/gateway/static/root/assets/{working-directory-picker-modal-CFj-ZOJE.js → working-directory-picker-modal-BW76VaD5.js} +1 -1
  184. package/dist/gateway/static/root/assets/workspace-api-Cu2gzmVn.js +2 -0
  185. package/dist/gateway/static/root/assets/workspace-editor-agent-store-pVOYuH7u.js +1 -0
  186. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DyqI793w.js +1 -0
  187. package/dist/gateway/static/root/assets/workspace-open-location-menu-DTYkApy8.js +1 -0
  188. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DN4DdOWZ.js → xopc-cloud-account-card-Rytp_NWV.js} +1 -1
  189. package/dist/gateway/static/root/index.html +106 -99
  190. package/dist/package.js +1 -1
  191. package/dist/packages/gateway-contract/src/extension-capabilities.js +26 -4
  192. package/dist/packages/gateway-contract/src/index.js +3 -1
  193. package/dist/packages/gateway-contract/src/local-app-delegation.js +22 -0
  194. package/dist/packages/gateway-contract/src/local-apps.js +35 -4
  195. package/dist/packages/realtime-protocol/src/voice.js +37 -3
  196. package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
  197. package/dist/src/agent/agent-manager.d.ts +1 -0
  198. package/dist/src/agent/agent-manager.js +11 -2
  199. package/dist/src/agent/background-review/prompts.js +2 -0
  200. package/dist/src/agent/background-review/run-background-review.js +13 -7
  201. package/dist/src/agent/context/execution-context.js +1 -1
  202. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  203. package/dist/src/agent/embedded/run-for-session.js +66 -9
  204. package/dist/src/agent/embedded/run-turn.js +35 -1
  205. package/dist/src/agent/embedded/runs.d.ts +1 -0
  206. package/dist/src/agent/embedded/runs.js +13 -0
  207. package/dist/src/agent/embedded/types.d.ts +2 -0
  208. package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
  209. package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
  210. package/dist/src/agent/prompt/system-prompt.js +7 -6
  211. package/dist/src/agent/prompt/types.d.ts +2 -1
  212. package/dist/src/agent/prompt/voice-history.d.ts +9 -0
  213. package/dist/src/agent/prompt/voice-history.js +35 -0
  214. package/dist/src/agent/prompt/voice-presentation.d.ts +1 -1
  215. package/dist/src/agent/prompt/voice-presentation.js +1 -0
  216. package/dist/src/agent/service.js +1 -1
  217. package/dist/src/agent/tasks/task-judge-service.js +1 -1
  218. package/dist/src/agent/tools/factory.js +1 -1
  219. package/dist/src/agent/tools/image-generate-tool.js +5 -1
  220. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  221. package/dist/src/agent/tools/personal-task-tool.js +3 -1
  222. package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
  223. package/dist/src/agent/tools/task-evidence.js +6 -15
  224. package/dist/src/agent/tools/task-result-tool.js +1 -1
  225. package/dist/src/agent/tools/user-context-tool.js +1 -1
  226. package/dist/src/agent/tools/xopc-use-tool.js +6 -5
  227. package/dist/src/agent-config/schema.d.ts +45 -0
  228. package/dist/src/agent-config/schema.js +3 -1
  229. package/dist/src/capabilities/runtime/dispatcher.d.ts +11 -0
  230. package/dist/src/capabilities/runtime/dispatcher.js +22 -6
  231. package/dist/src/capabilities/runtime/product.js +2 -0
  232. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  233. package/dist/src/computer/evaluation-comparison.d.ts +4 -0
  234. package/dist/src/computer/evaluation-comparison.js +16 -1
  235. package/dist/src/computer/keyboard.js +1 -1
  236. package/dist/src/computer/model-adapter.js +18 -14
  237. package/dist/src/config/schema.d.ts +52 -2
  238. package/dist/src/config/schema.js +29 -5
  239. package/dist/src/gateway/hono/lib/safe-voice-config.d.ts +1 -0
  240. package/dist/src/gateway/hono/lib/safe-voice-config.js +10 -2
  241. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +107 -12
  242. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  243. package/dist/src/gateway/hono/routes/imports.js +1 -1
  244. package/dist/src/gateway/hono/routes/lazy-bundles.js +16 -0
  245. package/dist/src/gateway/hono/routes/local-app-capabilities.js +16 -5
  246. package/dist/src/gateway/hono/routes/local-app-development.d.ts +3 -0
  247. package/dist/src/gateway/hono/routes/local-app-development.js +13 -0
  248. package/dist/src/gateway/hono/routes/local-app-previews.d.ts +3 -0
  249. package/dist/src/gateway/hono/routes/local-app-previews.js +86 -0
  250. package/dist/src/gateway/hono/routes/local-apps.js +3 -2
  251. package/dist/src/gateway/hono/routes/models.js +4 -0
  252. package/dist/src/gateway/hono/routes/personal-agent.js +9 -1
  253. package/dist/src/gateway/hono/routes/projects.js +1 -1
  254. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  255. package/dist/src/gateway/hono/routes/user-model.js +2 -2
  256. package/dist/src/gateway/hono/routes/voice.js +108 -14
  257. package/dist/src/gateway/security/gateway-scopes.js +1 -1
  258. package/dist/src/gateway/security/local-app-delegation-access.d.ts +5 -0
  259. package/dist/src/gateway/security/local-app-delegation-access.js +22 -0
  260. package/dist/src/gateway/service/config-coordinator.d.ts +11 -2
  261. package/dist/src/gateway/service/run-gateway-agent.js +7 -6
  262. package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
  263. package/dist/src/gateway/service/session-input-coordinator.js +6 -2
  264. package/dist/src/gateway/service.js +52 -19
  265. package/dist/src/gateway/xopc-cloud-capability-setup.js +2 -2
  266. package/dist/src/home-intelligence/host.js +2 -2
  267. package/dist/src/imports/inventory.js +11 -3
  268. package/dist/src/infra/update-restart.js +1 -1
  269. package/dist/src/local-apps/access-audit.d.ts +17 -0
  270. package/dist/src/local-apps/access-audit.js +42 -0
  271. package/dist/src/local-apps/capabilities/contracts.js +2 -0
  272. package/dist/src/local-apps/capabilities/delegate.d.ts +3 -0
  273. package/dist/src/local-apps/capabilities/delegate.js +166 -0
  274. package/dist/src/local-apps/capabilities/projections.d.ts +265 -0
  275. package/dist/src/local-apps/capabilities/projections.js +53 -0
  276. package/dist/src/local-apps/capabilities/resource-policy.d.ts +3 -0
  277. package/dist/src/local-apps/capabilities/resource-policy.js +43 -0
  278. package/dist/src/local-apps/capabilities/runtime.d.ts +2 -1
  279. package/dist/src/local-apps/capabilities/runtime.js +108 -39
  280. package/dist/src/local-apps/fix-guidance.js +4 -1
  281. package/dist/src/local-apps/preview-fixtures.d.ts +20 -0
  282. package/dist/src/local-apps/preview-fixtures.js +52 -0
  283. package/dist/src/local-apps/preview-runtime-bridge.d.ts +1 -1
  284. package/dist/src/local-apps/preview-runtime-bridge.js +41 -18
  285. package/dist/src/local-apps/preview-sessions.d.ts +52 -0
  286. package/dist/src/local-apps/preview-sessions.js +316 -0
  287. package/dist/src/local-apps/preview-worker.d.ts +1 -0
  288. package/dist/src/local-apps/preview-worker.js +108 -0
  289. package/dist/src/local-apps/public-assets.d.ts +2 -0
  290. package/dist/src/local-apps/public-assets.js +42 -0
  291. package/dist/src/local-apps/scaffold.js +1 -1
  292. package/dist/src/local-apps/service.d.ts +48 -5
  293. package/dist/src/local-apps/service.js +136 -15
  294. package/dist/src/local-apps/store.d.ts +3 -0
  295. package/dist/src/local-apps/store.js +42 -16
  296. package/dist/src/local-apps/types.d.ts +2 -0
  297. package/dist/src/memory-learning/repository.js +3 -2
  298. package/dist/src/memory-learning/service.js +4 -13
  299. package/dist/src/memory-learning/transcript-source.d.ts +9 -0
  300. package/dist/src/memory-learning/transcript-source.js +31 -0
  301. package/dist/src/notes/capabilities/read.js +11 -2
  302. package/dist/src/notes/capabilities/write.js +10 -1
  303. package/dist/src/notes/types.d.ts +2 -0
  304. package/dist/src/personal-agent/communication.d.ts +2 -1
  305. package/dist/src/personal-agent/communication.js +3 -1
  306. package/dist/src/personal-agent/prompt-context.js +15 -23
  307. package/dist/src/personal-agent/prompts.js +3 -2
  308. package/dist/src/personal-agent/reply-composer.js +2 -2
  309. package/dist/src/personal-agent/repository.d.ts +2 -3
  310. package/dist/src/personal-agent/request-access.js +1 -1
  311. package/dist/src/personal-agent/request-delivery.js +1 -1
  312. package/dist/src/personal-agent/request-service.js +1 -1
  313. package/dist/src/personal-agent/service.d.ts +3 -6
  314. package/dist/src/personal-agent/service.js +12 -1
  315. package/dist/src/phone/contracts.d.ts +1 -1
  316. package/dist/src/phone/model-adapter.d.ts +1 -1
  317. package/dist/src/phone/runtime.d.ts +1 -1
  318. package/dist/src/process/fork-worker.d.ts +2 -0
  319. package/dist/src/process/fork-worker.js +7 -0
  320. package/dist/src/providers/model-catalog-persistence.js +2 -2
  321. package/dist/src/providers/setup/voice.js +9 -4
  322. package/dist/src/providers/xopc-cloud-model-source.js +2 -2
  323. package/dist/src/realtime/broker.js +1 -1
  324. package/dist/src/session/client-history.js +12 -1
  325. package/dist/src/session/session-context-for-llm.js +10 -3
  326. package/dist/src/session/store.d.ts +1 -0
  327. package/dist/src/session/store.js +2 -1
  328. package/dist/src/session/stored-rows-to-file-entries.js +1 -1
  329. package/dist/src/session/transcript-outline.js +9 -0
  330. package/dist/src/session/voice-transcript.d.ts +14 -0
  331. package/dist/src/session/voice-transcript.js +19 -2
  332. package/dist/src/storage/sqlite/notes-repository.js +7 -0
  333. package/dist/src/storage/sqlite/resource-scope.d.ts +10 -0
  334. package/dist/src/storage/sqlite/resource-scope.js +31 -0
  335. package/dist/src/storage/sqlite/transcript-repository.d.ts +3 -0
  336. package/dist/src/storage/sqlite/transcript-repository.js +43 -7
  337. package/dist/src/tasks/capabilities/read.js +21 -3
  338. package/dist/src/tasks/task-allocation-service.js +1 -1
  339. package/dist/src/tasks/task-application-service.js +3 -3
  340. package/dist/src/tasks/task-context-assembler.js +1 -1
  341. package/dist/src/tasks/task-evidence-tools.d.ts +2 -0
  342. package/dist/src/tasks/task-evidence-tools.js +22 -0
  343. package/dist/src/tasks/task-main-update-delivery.js +2 -0
  344. package/dist/src/tasks/task-repository.d.ts +2 -0
  345. package/dist/src/tasks/task-repository.js +7 -0
  346. package/dist/src/tasks/task-research-result.js +8 -21
  347. package/dist/src/tasks/task-result-delivery-repository.d.ts +6 -0
  348. package/dist/src/tasks/task-result-delivery-repository.js +26 -0
  349. package/dist/src/tasks/task-result-delivery-service.js +3 -3
  350. package/dist/src/tasks/task-run-coordinator.js +1 -1
  351. package/dist/src/usage/scenario-registry.js +5 -0
  352. package/dist/src/user-model/index.js +3 -3
  353. package/dist/src/user-model/profile.d.ts +8 -0
  354. package/dist/src/user-model/profile.js +19 -1
  355. package/dist/src/voice/platform-settings.d.ts +5 -0
  356. package/dist/src/voice/platform-settings.js +16 -3
  357. package/dist/src/voice/platform-streams.d.ts +7 -3
  358. package/dist/src/voice/platform-streams.js +90 -18
  359. package/dist/src/voice/realtime/agentBroker.d.ts +12 -1
  360. package/dist/src/voice/realtime/agentBroker.js +22 -5
  361. package/dist/src/voice/realtime/agentEngine.js +104 -12
  362. package/dist/src/voice/realtime/chat-publication.d.ts +24 -0
  363. package/dist/src/voice/realtime/chat-publication.js +61 -0
  364. package/dist/src/voice/realtime/conversation-context.d.ts +7 -1
  365. package/dist/src/voice/realtime/conversation-context.js +54 -16
  366. package/dist/src/voice/realtime/engine.d.ts +2 -0
  367. package/dist/src/voice/realtime/identity-grounding.d.ts +8 -0
  368. package/dist/src/voice/realtime/identity-grounding.js +34 -0
  369. package/dist/src/voice/realtime/memory-context.js +48 -14
  370. package/dist/src/voice/realtime/naturalAgentTools.d.ts +90 -0
  371. package/dist/src/voice/realtime/naturalAgentTools.js +275 -0
  372. package/dist/src/voice/realtime/omniEngine.d.ts +9 -0
  373. package/dist/src/voice/realtime/omniEngine.js +425 -54
  374. package/dist/src/voice/realtime/omniRoute.d.ts +6 -2
  375. package/dist/src/voice/realtime/omniRoute.js +50 -5
  376. package/dist/src/voice/realtime/runtime.d.ts +1 -0
  377. package/dist/src/voice/realtime/runtime.js +155 -50
  378. package/dist/src/voice/realtime/runtime.types.d.ts +3 -1
  379. package/dist/src/voice/realtime/speakable-segmenter.d.ts +2 -1
  380. package/dist/src/voice/realtime/speakable-segmenter.js +7 -2
  381. package/dist/src/voice/realtime/turnPolicy.d.ts +1 -2
  382. package/dist/src/voice/realtime/turnPolicy.js +4 -6
  383. package/dist/src/voice/realtime/user-context.d.ts +14 -0
  384. package/dist/src/voice/realtime/user-context.js +63 -0
  385. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +29 -23
  386. package/dist/src/voice/tts/speak-core.js +1 -0
  387. package/dist/src/voice/tts/speech-provider-types.d.ts +2 -0
  388. package/dist/src/work-discovery/service.js +1 -1
  389. package/package.json +2 -1
  390. package/skills/engineering/build-xopc-local-app/SKILL.md +5 -1
  391. package/skills/engineering/build-xopc-local-app/references/app-contract.md +43 -2
  392. package/dist/gateway/static/root/assets/api-B3M6ifoo.js +0 -1
  393. package/dist/gateway/static/root/assets/automation-run-list-De7gini_.js +0 -1
  394. package/dist/gateway/static/root/assets/capabilities-page-CSBeVda0.js +0 -2
  395. package/dist/gateway/static/root/assets/capabilities-settings-panel-C56aelvp.js +0 -8
  396. package/dist/gateway/static/root/assets/chat-page-BKLyj4IP.js +0 -71
  397. package/dist/gateway/static/root/assets/clipboard-copy-DuJk5WD6.js +0 -1
  398. package/dist/gateway/static/root/assets/composer-payload-handoff-D1xUYD5M.js +0 -1
  399. package/dist/gateway/static/root/assets/connected-providers-grid-w3htbAyh.js +0 -1
  400. package/dist/gateway/static/root/assets/connectors-page-D1VzTxON.js +0 -1
  401. package/dist/gateway/static/root/assets/dist-BGTk37IG.js +0 -1
  402. package/dist/gateway/static/root/assets/extension-iframe-host-pbU7DAfE.js +0 -1
  403. package/dist/gateway/static/root/assets/extension-page-BrX4Hy9P.js +0 -1
  404. package/dist/gateway/static/root/assets/extension-provider-DUzhV5_a.js +0 -1
  405. package/dist/gateway/static/root/assets/gateway-realtime-store-Vl3uKAHV.js +0 -1
  406. package/dist/gateway/static/root/assets/home-page-DYkEc3Qb.js +0 -3
  407. package/dist/gateway/static/root/assets/imports-page-CLbpRE5i.js +0 -1
  408. package/dist/gateway/static/root/assets/index-CIeY0yyg.js +0 -11
  409. package/dist/gateway/static/root/assets/index-D1EDrkUo.css +0 -1
  410. package/dist/gateway/static/root/assets/local-app-workbench-page-3J9ABnCu.js +0 -1
  411. package/dist/gateway/static/root/assets/local-apps-Ck6kACsY.js +0 -1
  412. package/dist/gateway/static/root/assets/logs-page-Dtoheh2t.js +0 -2
  413. package/dist/gateway/static/root/assets/messages-orB1BMgI.js +0 -3
  414. package/dist/gateway/static/root/assets/note-image-lightbox-C6aTUp-c.js +0 -1
  415. package/dist/gateway/static/root/assets/page-header-store-B2Ahfm0W.js +0 -1
  416. package/dist/gateway/static/root/assets/personal-avatar-Dp5LHjk3.js +0 -1
  417. package/dist/gateway/static/root/assets/personal-page-CpKBzGIk.js +0 -1
  418. package/dist/gateway/static/root/assets/personal-proactivity-DaRnbB1f.js +0 -1
  419. package/dist/gateway/static/root/assets/personal-settings-panel-CtJL6qIN.js +0 -1
  420. package/dist/gateway/static/root/assets/project-detail-page-CobfHZo0.js +0 -7
  421. package/dist/gateway/static/root/assets/route-preload-C0oV8og1.js +0 -2
  422. package/dist/gateway/static/root/assets/runtime-health-D2TDFLLq.js +0 -1
  423. package/dist/gateway/static/root/assets/secret-input-Dryrns2s.js +0 -1
  424. package/dist/gateway/static/root/assets/session-channel-icon-D1ktvt1P.js +0 -1
  425. package/dist/gateway/static/root/assets/session-manager-C1T7WiP7.js +0 -25
  426. package/dist/gateway/static/root/assets/settings-advanced-gate-B3rOBkm_.js +0 -1
  427. package/dist/gateway/static/root/assets/share-preview-page-BoLq3kSO.js +0 -2
  428. package/dist/gateway/static/root/assets/use-composer-attachments-BPMn8eY_.js +0 -2
  429. package/dist/gateway/static/root/assets/use-file-preview-expanded-4SKLb9Fh.js +0 -15
  430. package/dist/gateway/static/root/assets/voice-call-context-CJ1ZiJWR.js +0 -1
  431. package/dist/gateway/static/root/assets/voice-config-api-yBcUSvvn.js +0 -1
  432. package/dist/gateway/static/root/assets/voice-transcribe-api-D4eyeSdG.js +0 -1
  433. package/dist/gateway/static/root/assets/workspace-api-DYFy9__S.js +0 -2
  434. package/dist/gateway/static/root/assets/workspace-editor-agent-store-2Lt7rQfw.js +0 -1
  435. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DhqlVzSI.js +0 -1
  436. package/dist/gateway/static/root/assets/workspace-open-location-menu-C-ItyXwL.js +0 -1
@@ -1 +1 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-CQcW9_qA.js";import{t as s}from"./messages-orB1BMgI.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BGTk37IG.js";import{t as m}from"./chevron-right-BweFrslA.js";import{t as h}from"./circle-check-C23XjkUj.js";import{t as g}from"./clock-3-DnrAnuyZ.js";import{t as _}from"./download-Dk-ZjtO6.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./laptop-CI3hBVrl.js";import{t as b}from"./panel-right-CFGrHTsD.js";import{t as x}from"./smartphone-DSSsQFqA.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{i as w}from"./vendor-swr-CdRzEUwF.js";import{t as T}from"./button-Cc4hUNTt.js";import{a as E,i as D,o as O,s as k}from"./dist-GJ8-1PAx.js";import{a as A,i as te,o as ne}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as j}from"./app-link-CdD448kS.js";import{t as M}from"./use-async-resource-BHFGZCY2.js";import{t as N}from"./copy-text-row-CpiRzq4G.js";import{a as re,n as P,r as F}from"./oauth-api-D5iBtOid.js";import{n as ie,r as I,t as L}from"./oauth-authorization-window-o6URRos4.js";import{_ as ae,a as R,b as oe,d as z,f as se,g as ce,h as le,i as ue,l as B,m as de,n as fe,p as pe,r as V,s as H,t as U,u as me,v as he,y as ge}from"./tunnel-api-BDoegsWD.js";import{t as _e}from"./mobile-pair-qr-CuIbmw5x.js";var W=r(),G=e(n(),1),K=i();function ve(){let e=s(o(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=w(`tunnel-status`,fe,{refreshInterval:1500}),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!0),[m,h]=(0,G.useState)(`idle`),[g,_]=(0,G.useState)(null),[y,b]=(0,G.useState)(``),[x,ee]=(0,G.useState)(``),S=(0,G.useRef)(!0);(0,G.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,G.useEffect)(()=>{r?.state===`connected`&&(_(null),b(``))},[r?.state]);let E=g?g===`registration-rejected`:r?.state===`error`&&se(Error(r.lastError??``)),D=g?g===`recovery-rejected`:r?.state===`error`&&z(Error(r.lastError??``)),O=async()=>{if(!r)return;if(r.consentRequired&&!c){d(!0);return}let e=E||!r.registrationSecret?.configured,t=e?I():null,n,i=!1;_(null),b(``);try{if(r.consentRequired&&await R(),e){h(`provisioning`),E&&await V({registrationSecret:null});let e=!1;try{await ue()}catch(t){if(!me(t))throw t;e=!0}if(e){h(`authorizing`);let e=sessionStorage.getItem(`device-pairing-oauth`),r=e?JSON.parse(e):null;n=r&&r.expiresAt>Date.now()?r.sessionId:(await re(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:n,expiresAt:r&&r.expiresAt>Date.now()?r.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;S.current&&Date.now()<o;){let e=await F(n);if(e.authUrl&&e.authUrl!==a&&(a=e.authUrl,await ie(a,t)||ee(a)),e.status===`completed`){s=!0,i=!0;break}if(e.status===`failed`||e.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!S.current)return;if(!s)throw Error(`Authorization expired`);await ue()}await a()}if(!S.current)return;h(`starting`),await H(D?{recoverActiveLease:!0}:void 0),f&&await V({autoStart:!0}),await a(),i=!0}catch(e){i=!0,S.current&&(_(B(e)===`tunnel_key_limit_reached`?`key-limit`:se(e)?`registration-rejected`:z(e)?`recovery-rejected`:`failed`),b(e instanceof Error?e.message:``))}finally{L(t),i&&(sessionStorage.removeItem(`device-pairing-oauth`),n&&P(n).catch(()=>{})),S.current&&(h(`idle`),ee(``))}};if(!r&&!i)return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(C,{className:`h-5 w-4/5`}),(0,K.jsx)(C,{className:`h-24 w-full`})]});let k=m===`provisioning`||m===`starting`||r?.state===`connecting`||r?.state===`reconnecting`,A=m===`idle`&&!k&&(g||i||r?.state===`error`),te=y||(i instanceof Error?i.message:``)||(r?.state===`error`?r.lastError:``);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:k?t.preparingHint:m===`authorizing`?t.authorizing:t.enableHint}),x&&m===`authorizing`?(0,K.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,k?(0,K.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,K.jsx)(C,{className:`h-2 w-full`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(u||r?.consentRequired)&&m===`idle`?(0,K.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,K.jsxs)(`details`,{open:u,className:`text-sm text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,K.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,K.jsx)(`li`,{children:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,A&&g===`key-limit`?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-3`,onClick:()=>void j(U),children:[t.manageTunnelKeys,(0,K.jsx)(v,{className:`size-3`})]})]}):A?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:i&&!r?t.readinessFailed:E?t.routeAuthorizationRequired:D?t.routeRecoveryRequired:t.routeSetupFailed}),te?(0,K.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`break-words whitespace-pre-wrap`,children:te})]}):null]}):null,(0,K.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:f,disabled:m!==`idle`,onChange:e=>p(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),i&&!r?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void a().catch(()=>{}),children:t.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:!r||m!==`idle`||k||u&&!c,onClick:()=>void O(),children:m===`authorizing`?t.authorizing:k?t.preparing:E?t.authorize:D?t.recoverRoute:A?t.retry:t.enable})]})}var q=t({DevicePairingWizard:()=>J});function J(e){let t=(0,W.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,G.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,G.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let m=f,h;t[6]!==m||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(h=n?c?(0,K.jsx)(Z,{targetKind:c,onClose:()=>m(!1),onPaired:i}):(0,K.jsx)(X,{onChoose:l,onChooseLocalBrowser:()=>{m(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>m(!1)}):null,t[6]=m,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==n||t[14]!==h?(g=(0,K.jsx)(p,{open:n,onOpenChange:m,children:h}),t[12]=m,t[13]=n,t[14]=h,t[15]=g):g=t[15],g}function Y(e){let t=(0,W.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,K.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,K.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(m,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,K.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function X(e){let t=(0,W.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=o(ye),p;t[0]===a?p=t[1]:(p=s(a),t[0]=a,t[1]=p);let m=p.endpointToolsSettings.deviceAccess,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=_):_=t[4];let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ee,{className:`size-4`}),t[5]=v):v=t[5];let C;t[6]!==m.cancel||t[7]!==i?(C=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[_,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.cancel,onClick:i,children:v})]}),t[6]=m.cancel,t[7]=i,t[8]=C):C=t[8];let w;t[9]===m.chooseTitle?w=t[10]:(w=(0,K.jsx)(f,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:m.chooseTitle}),t[9]=m.chooseTitle,t[10]=w);let T;t[11]===m.chooseHint?T=t[12]:(T=(0,K.jsx)(l,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:m.chooseHint}),t[11]=m.chooseHint,t[12]=T);let E;t[13]!==m.localBrowserHint||t[14]!==m.localBrowserTitle||t[15]!==r?(E=(0,K.jsx)(Y,{icon:y,title:m.localBrowserTitle,hint:m.localBrowserHint,onClick:r}),t[13]=m.localBrowserHint,t[14]=m.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let O;t[19]!==m.mobileHint||t[20]!==m.mobileTitle||t[21]!==D?(O=(0,K.jsx)(Y,{icon:x,title:m.mobileTitle,hint:m.mobileHint,onClick:D}),t[19]=m.mobileHint,t[20]=m.mobileTitle,t[21]=D,t[22]=O):O=t[22];let k;t[23]===n?k=t[24]:(k=()=>n(`browser`),t[23]=n,t[24]=k);let A;t[25]!==m.remoteBrowserHint||t[26]!==m.remoteBrowserTitle||t[27]!==k?(A=(0,K.jsx)(Y,{icon:b,title:m.remoteBrowserTitle,hint:m.remoteBrowserHint,onClick:k}),t[25]=m.remoteBrowserHint,t[26]=m.remoteBrowserTitle,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==O||t[30]!==A||t[31]!==E?(j=(0,K.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,O,A]}),t[29]=O,t[30]=A,t[31]=E,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[w,T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N;return t[37]!==M||t[38]!==C?(N=(0,K.jsxs)(u,{children:[h,(0,K.jsxs)(d,{className:g,children:[C,M]})]}),t[37]=M,t[38]=C,t[39]=N):N=t[39],N}function ye(e){return e.language}function Z({targetKind:e,onClose:t,onPaired:n}){let r=o(e=>e.language),i=s(r),a=i.endpointToolsSettings.deviceAccess,p=a.flow,[y,b]=(0,G.useState)(e===`mobile`),[x,re]=(0,G.useState)(!1),P=w(y?`device-pairing-readiness`:null,ae,{refreshInterval:1500}),[F,ie]=(0,G.useState)(),[I,L]=(0,G.useState)(null),[R,z]=(0,G.useState)(!1),[se,ue]=(0,G.useState)(Date.now()),[B,fe]=(0,G.useState)(null),V=(0,G.useRef)(!0),H=(0,G.useRef)(null),U=(0,G.useRef)(!1),me=(0,G.useRef)(!1),W=w(F?[`device-pairing-setup`,F.id]:null,()=>he(F.id),{refreshInterval:1500}),q=W.data?.request,J=q?.status===`completed`,Y=J&&q.connectedAt!==void 0,X=w(Y&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),ye=F?.targetKind===`mobile`?F.universalLink:``,Z=M(()=>_e(ye),[ye],{enabled:!!ye,initial:null,errorData:null}),be=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,xe=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,Se=M(()=>_e(be),[be],{enabled:x&&e===`mobile`,initial:null,errorData:null});(0,G.useEffect)(()=>{V.current=!0;let e=setInterval(()=>ue(Date.now()),1e3);return()=>{V.current=!1,clearInterval(e),H.current&&pe(H.current).catch(()=>{})}},[]);let Ce=(0,G.useCallback)(async()=>{if(!U.current){U.current=!0,z(!0),L(null);try{H.current&&await pe(H.current),H.current=null,ie(void 0);let t=await de(e);if(t.kind===`ready`){if(!V.current){await pe(t.setup.id);return}H.current=t.setup.id,ie(t.setup)}else await P.mutate()}catch{V.current&&L(`create`)}finally{U.current=!1,V.current&&z(!1)}}},[P,e]);(0,G.useEffect)(()=>{P.data?.ready&&!F&&I!==`create`&&!U.current&&Ce()},[P.data,F,I,Ce]),(0,G.useEffect)(()=>{Y&&!me.current&&(me.current=!0,n?.())},[Y,n]);let we=async e=>{if(q){z(!0),L(null);try{await le(q,e),await W.mutate()}catch{L(`decision`),await W.mutate()}finally{V.current&&z(!1)}}},Te=(0,G.useRef)(0);(0,G.useEffect)(()=>{W.data&&(Te.current=W.data.serverTime-Date.now())},[W.data]);let Q=se+Te.current,Ee=F&&Q>=F.expiresAt&&!q,De=q&&[`expired`,`rejected`,`cancelled`].includes(q.status),Oe=F?F.expiresAt-Q<6e4:!1,ke=F?Oe?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ae=a.browserPrepareTitle,je=a.browserPrepareHint,Me=y?Y?$.success:q?.status===`pending`?$.allowTitle:J||q?.status===`approved`?p.waiting:F?$.connect:p.title:Ae,Ne=I===`create`?p.createFailed:I===`decision`?p.decisionFailed:I===`background`?p.backgroundFailed:I===`download`?a.browserDownloadFailed:null,Pe=async()=>{z(!0),L(null);try{await ce()}catch{L(`download`)}finally{V.current&&z(!1)}};return(0,K.jsxs)(u,{children:[(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),(0,K.jsxs)(d,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`mobile`?(0,K.jsxs)(O,{open:x,onOpenChange:re,children:[(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(T,{variant:`ghost`,className:`min-h-10`,children:[(0,K.jsx)(_,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownloadAction]})}),(0,K.jsx)(E,{children:(0,K.jsxs)(D,{align:`end`,sideOffset:8,"aria-label":a.mobileDownloadAction,className:S(`w-[min(26rem,calc(100vw-2rem))] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-6 sm:p-7 shadow-elevated`,A),children:[(0,K.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a.mobileDownloadAction}),(0,K.jsx)(`div`,{className:`my-6 flex justify-center`,children:Se.data?(0,K.jsx)(`img`,{src:Se.data,alt:a.mobileDownloadQrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):Se.error?(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:p.qrFailed}):(0,K.jsx)(C,{className:`size-[216px] max-w-full`})}),(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:a.mobileDownloadHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void j(be),children:[(0,K.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownload]})]})})]}):null,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p.cancel,onClick:t,children:(0,K.jsx)(ee,{className:`size-4`,"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[Y?(0,K.jsx)(h,{className:`mb-5 size-7 text-success`}):null,(0,K.jsx)(f,{className:`text-xl font-semibold tracking-tight text-fg`,children:Me}),(0,K.jsx)(l,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:y?Y?$.successHint:J?p.waitingForDevice:q?q.displayName:F?$.connectHint:p.intro:je}),Ne?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ne}):null,y&&P.error?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p.readinessFailed}):null,y&&W.error?(0,K.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:p.statusUnavailable}):null,y?P.data?Y?(0,K.jsxs)(K.Fragment,{children:[X.data?(0,K.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,K.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":X.data.runInBackground??!1,disabled:!X.data.backgroundSupported,checked:X.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>X.mutate(e.behavior)).catch(()=>L(`background`))}})]}):null,(0,K.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):De||Ee?(0,K.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Ee||q?.status===`expired`?p.expired:p.declined}),(0,K.jsx)(T,{variant:`primary`,onClick:()=>void Ce(),disabled:R,children:p.refresh})]}):q?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:p.scope}),(0,K.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[q.confirmationCode.slice(0,3),` `,q.confirmationCode.slice(3)]}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:p.compare}),(0,K.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:p.access}),(0,K.jsx)(`p`,{children:p.accessHint})]})]}):F?.targetKind===`mobile`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,K.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,K.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Z.data?(0,K.jsx)(`img`,{src:Z.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Z.error?null:(0,K.jsx)(C,{className:`size-[240px] rounded-xl`})})}),Z.error?null:(0,K.jsxs)(`p`,{className:S(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,Oe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,K.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),ke]})]}),Z.error?(0,K.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:p.qrFailed}):null,Z.error?(0,K.jsx)(`div`,{className:`mt-5`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,K.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(`span`,{children:p.fallback}),(0,K.jsx)(m,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(N,{text:F.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:F.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid})]}):P.data.ready?(0,K.jsx)(`div`,{className:`mt-8`,children:(0,K.jsx)(C,{className:`mx-auto size-[216px]`})}):(0,K.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[B===`tailscale`?(0,K.jsx)(oe,{embedded:!0}):B===`https`?(0,K.jsx)(ge,{}):B===`choices`?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`tailscale`),children:a.useTailscale}),(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`https`),children:a.useOwnHttps})]}):(0,K.jsx)(ve,{}),(0,K.jsx)(T,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>fe(B?null:`choices`),children:B?p.back:p.existing})]}):(0,K.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,K.jsx)(C,{className:`h-5 w-3/4`}),(0,K.jsx)(C,{className:`h-40 w-full`})]}):(0,K.jsxs)(`div`,{className:`mt-7`,children:[(0,K.jsxs)(T,{variant:`secondary`,className:`w-full`,disabled:R,onClick:()=>void Pe(),children:[(0,K.jsx)(_,{className:`size-4`}),a.browserDownload]}),(0,K.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,K.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void j(xe),children:[a.browserInstallHelp,(0,K.jsx)(v,{className:`size-3`})]})]})]}),!y||P.error||Y||q?.status===`pending`||I===`create`||I===`decision`?(0,K.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:y?Y?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:t,children:p.done}):q?.status===`pending`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void we(`approve`),children:p.allow}),(0,K.jsx)(T,{className:`w-full`,variant:`ghost`,disabled:R,onClick:()=>void we(`reject`),children:p.cancel})]}):P.error?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void P.mutate(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void Ce(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>{L(null),b(!0)},children:a.browserReady})}):null]})]})}export{q as n,J as t};
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-D3c8DIm-.js";import{t as s}from"./messages-DPLud9GK.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./chevron-right-BweFrslA.js";import{t as h}from"./circle-check-C23XjkUj.js";import{t as g}from"./clock-3-DnrAnuyZ.js";import{t as _}from"./download-Dk-ZjtO6.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./laptop-CI3hBVrl.js";import{t as b}from"./panel-right-CFGrHTsD.js";import{t as x}from"./smartphone-DSSsQFqA.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{i as w}from"./vendor-swr-CdRzEUwF.js";import{t as T}from"./button-Cc4hUNTt.js";import{a as E,i as D,o as O,s as k}from"./dist-GJ8-1PAx.js";import{a as A,i as te,o as ne}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as j}from"./app-link-CCZ-LmVT.js";import{t as M}from"./use-async-resource-BHFGZCY2.js";import{t as N}from"./copy-text-row-CpiRzq4G.js";import{a as re,n as P,r as F}from"./oauth-api-BHp5dVNh.js";import{n as ie,r as I,t as L}from"./oauth-authorization-window-o6URRos4.js";import{_ as ae,a as R,b as oe,d as z,f as se,g as ce,h as le,i as ue,l as B,m as de,n as fe,p as pe,r as V,s as H,t as U,u as me,v as he,y as ge}from"./tunnel-api-GtLO40pc.js";import{t as _e}from"./mobile-pair-qr-CuIbmw5x.js";var W=r(),G=e(n(),1),K=i();function ve(){let e=s(o(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=w(`tunnel-status`,fe,{refreshInterval:1500}),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!0),[m,h]=(0,G.useState)(`idle`),[g,_]=(0,G.useState)(null),[y,b]=(0,G.useState)(``),[x,ee]=(0,G.useState)(``),S=(0,G.useRef)(!0);(0,G.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,G.useEffect)(()=>{r?.state===`connected`&&(_(null),b(``))},[r?.state]);let E=g?g===`registration-rejected`:r?.state===`error`&&se(Error(r.lastError??``)),D=g?g===`recovery-rejected`:r?.state===`error`&&z(Error(r.lastError??``)),O=async()=>{if(!r)return;if(r.consentRequired&&!c){d(!0);return}let e=E||!r.registrationSecret?.configured,t=e?I():null,n,i=!1;_(null),b(``);try{if(r.consentRequired&&await R(),e){h(`provisioning`),E&&await V({registrationSecret:null});let e=!1;try{await ue()}catch(t){if(!me(t))throw t;e=!0}if(e){h(`authorizing`);let e=sessionStorage.getItem(`device-pairing-oauth`),r=e?JSON.parse(e):null;n=r&&r.expiresAt>Date.now()?r.sessionId:(await re(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:n,expiresAt:r&&r.expiresAt>Date.now()?r.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;S.current&&Date.now()<o;){let e=await F(n);if(e.authUrl&&e.authUrl!==a&&(a=e.authUrl,await ie(a,t)||ee(a)),e.status===`completed`){s=!0,i=!0;break}if(e.status===`failed`||e.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!S.current)return;if(!s)throw Error(`Authorization expired`);await ue()}await a()}if(!S.current)return;h(`starting`),await H(D?{recoverActiveLease:!0}:void 0),f&&await V({autoStart:!0}),await a(),i=!0}catch(e){i=!0,S.current&&(_(B(e)===`tunnel_key_limit_reached`?`key-limit`:se(e)?`registration-rejected`:z(e)?`recovery-rejected`:`failed`),b(e instanceof Error?e.message:``))}finally{L(t),i&&(sessionStorage.removeItem(`device-pairing-oauth`),n&&P(n).catch(()=>{})),S.current&&(h(`idle`),ee(``))}};if(!r&&!i)return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(C,{className:`h-5 w-4/5`}),(0,K.jsx)(C,{className:`h-24 w-full`})]});let k=m===`provisioning`||m===`starting`||r?.state===`connecting`||r?.state===`reconnecting`,A=m===`idle`&&!k&&(g||i||r?.state===`error`),te=y||(i instanceof Error?i.message:``)||(r?.state===`error`?r.lastError:``);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:k?t.preparingHint:m===`authorizing`?t.authorizing:t.enableHint}),x&&m===`authorizing`?(0,K.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,k?(0,K.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,K.jsx)(C,{className:`h-2 w-full`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(u||r?.consentRequired)&&m===`idle`?(0,K.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,K.jsxs)(`details`,{open:u,className:`text-sm text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,K.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,K.jsx)(`li`,{children:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,A&&g===`key-limit`?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-3`,onClick:()=>void j(U),children:[t.manageTunnelKeys,(0,K.jsx)(v,{className:`size-3`})]})]}):A?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:i&&!r?t.readinessFailed:E?t.routeAuthorizationRequired:D?t.routeRecoveryRequired:t.routeSetupFailed}),te?(0,K.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`break-words whitespace-pre-wrap`,children:te})]}):null]}):null,(0,K.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:f,disabled:m!==`idle`,onChange:e=>p(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),i&&!r?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void a().catch(()=>{}),children:t.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:!r||m!==`idle`||k||u&&!c,onClick:()=>void O(),children:m===`authorizing`?t.authorizing:k?t.preparing:E?t.authorize:D?t.recoverRoute:A?t.retry:t.enable})]})}var q=t({DevicePairingWizard:()=>J});function J(e){let t=(0,W.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,G.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,G.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let m=f,h;t[6]!==m||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(h=n?c?(0,K.jsx)(Z,{targetKind:c,onClose:()=>m(!1),onPaired:i}):(0,K.jsx)(X,{onChoose:l,onChooseLocalBrowser:()=>{m(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>m(!1)}):null,t[6]=m,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==n||t[14]!==h?(g=(0,K.jsx)(p,{open:n,onOpenChange:m,children:h}),t[12]=m,t[13]=n,t[14]=h,t[15]=g):g=t[15],g}function Y(e){let t=(0,W.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,K.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,K.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(m,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,K.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function X(e){let t=(0,W.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=o(ye),p;t[0]===a?p=t[1]:(p=s(a),t[0]=a,t[1]=p);let m=p.endpointToolsSettings.deviceAccess,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=_):_=t[4];let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ee,{className:`size-4`}),t[5]=v):v=t[5];let C;t[6]!==m.cancel||t[7]!==i?(C=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[_,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.cancel,onClick:i,children:v})]}),t[6]=m.cancel,t[7]=i,t[8]=C):C=t[8];let w;t[9]===m.chooseTitle?w=t[10]:(w=(0,K.jsx)(f,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:m.chooseTitle}),t[9]=m.chooseTitle,t[10]=w);let T;t[11]===m.chooseHint?T=t[12]:(T=(0,K.jsx)(l,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:m.chooseHint}),t[11]=m.chooseHint,t[12]=T);let E;t[13]!==m.localBrowserHint||t[14]!==m.localBrowserTitle||t[15]!==r?(E=(0,K.jsx)(Y,{icon:y,title:m.localBrowserTitle,hint:m.localBrowserHint,onClick:r}),t[13]=m.localBrowserHint,t[14]=m.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let O;t[19]!==m.mobileHint||t[20]!==m.mobileTitle||t[21]!==D?(O=(0,K.jsx)(Y,{icon:x,title:m.mobileTitle,hint:m.mobileHint,onClick:D}),t[19]=m.mobileHint,t[20]=m.mobileTitle,t[21]=D,t[22]=O):O=t[22];let k;t[23]===n?k=t[24]:(k=()=>n(`browser`),t[23]=n,t[24]=k);let A;t[25]!==m.remoteBrowserHint||t[26]!==m.remoteBrowserTitle||t[27]!==k?(A=(0,K.jsx)(Y,{icon:b,title:m.remoteBrowserTitle,hint:m.remoteBrowserHint,onClick:k}),t[25]=m.remoteBrowserHint,t[26]=m.remoteBrowserTitle,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==O||t[30]!==A||t[31]!==E?(j=(0,K.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,O,A]}),t[29]=O,t[30]=A,t[31]=E,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[w,T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N;return t[37]!==M||t[38]!==C?(N=(0,K.jsxs)(u,{children:[h,(0,K.jsxs)(d,{className:g,children:[C,M]})]}),t[37]=M,t[38]=C,t[39]=N):N=t[39],N}function ye(e){return e.language}function Z({targetKind:e,onClose:t,onPaired:n}){let r=o(e=>e.language),i=s(r),a=i.endpointToolsSettings.deviceAccess,p=a.flow,[y,b]=(0,G.useState)(e===`mobile`),[x,re]=(0,G.useState)(!1),P=w(y?`device-pairing-readiness`:null,ae,{refreshInterval:1500}),[F,ie]=(0,G.useState)(),[I,L]=(0,G.useState)(null),[R,z]=(0,G.useState)(!1),[se,ue]=(0,G.useState)(Date.now()),[B,fe]=(0,G.useState)(null),V=(0,G.useRef)(!0),H=(0,G.useRef)(null),U=(0,G.useRef)(!1),me=(0,G.useRef)(!1),W=w(F?[`device-pairing-setup`,F.id]:null,()=>he(F.id),{refreshInterval:1500}),q=W.data?.request,J=q?.status===`completed`,Y=J&&q.connectedAt!==void 0,X=w(Y&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),ye=F?.targetKind===`mobile`?F.universalLink:``,Z=M(()=>_e(ye),[ye],{enabled:!!ye,initial:null,errorData:null}),be=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,xe=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,Se=M(()=>_e(be),[be],{enabled:x&&e===`mobile`,initial:null,errorData:null});(0,G.useEffect)(()=>{V.current=!0;let e=setInterval(()=>ue(Date.now()),1e3);return()=>{V.current=!1,clearInterval(e),H.current&&pe(H.current).catch(()=>{})}},[]);let Ce=(0,G.useCallback)(async()=>{if(!U.current){U.current=!0,z(!0),L(null);try{H.current&&await pe(H.current),H.current=null,ie(void 0);let t=await de(e);if(t.kind===`ready`){if(!V.current){await pe(t.setup.id);return}H.current=t.setup.id,ie(t.setup)}else await P.mutate()}catch{V.current&&L(`create`)}finally{U.current=!1,V.current&&z(!1)}}},[P,e]);(0,G.useEffect)(()=>{P.data?.ready&&!F&&I!==`create`&&!U.current&&Ce()},[P.data,F,I,Ce]),(0,G.useEffect)(()=>{Y&&!me.current&&(me.current=!0,n?.())},[Y,n]);let we=async e=>{if(q){z(!0),L(null);try{await le(q,e),await W.mutate()}catch{L(`decision`),await W.mutate()}finally{V.current&&z(!1)}}},Te=(0,G.useRef)(0);(0,G.useEffect)(()=>{W.data&&(Te.current=W.data.serverTime-Date.now())},[W.data]);let Q=se+Te.current,Ee=F&&Q>=F.expiresAt&&!q,De=q&&[`expired`,`rejected`,`cancelled`].includes(q.status),Oe=F?F.expiresAt-Q<6e4:!1,ke=F?Oe?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ae=a.browserPrepareTitle,je=a.browserPrepareHint,Me=y?Y?$.success:q?.status===`pending`?$.allowTitle:J||q?.status===`approved`?p.waiting:F?$.connect:p.title:Ae,Ne=I===`create`?p.createFailed:I===`decision`?p.decisionFailed:I===`background`?p.backgroundFailed:I===`download`?a.browserDownloadFailed:null,Pe=async()=>{z(!0),L(null);try{await ce()}catch{L(`download`)}finally{V.current&&z(!1)}};return(0,K.jsxs)(u,{children:[(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),(0,K.jsxs)(d,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`mobile`?(0,K.jsxs)(O,{open:x,onOpenChange:re,children:[(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(T,{variant:`ghost`,className:`min-h-10`,children:[(0,K.jsx)(_,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownloadAction]})}),(0,K.jsx)(E,{children:(0,K.jsxs)(D,{align:`end`,sideOffset:8,"aria-label":a.mobileDownloadAction,className:S(`w-[min(26rem,calc(100vw-2rem))] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-6 sm:p-7 shadow-elevated`,A),children:[(0,K.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a.mobileDownloadAction}),(0,K.jsx)(`div`,{className:`my-6 flex justify-center`,children:Se.data?(0,K.jsx)(`img`,{src:Se.data,alt:a.mobileDownloadQrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):Se.error?(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:p.qrFailed}):(0,K.jsx)(C,{className:`size-[216px] max-w-full`})}),(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:a.mobileDownloadHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void j(be),children:[(0,K.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownload]})]})})]}):null,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p.cancel,onClick:t,children:(0,K.jsx)(ee,{className:`size-4`,"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[Y?(0,K.jsx)(h,{className:`mb-5 size-7 text-success`}):null,(0,K.jsx)(f,{className:`text-xl font-semibold tracking-tight text-fg`,children:Me}),(0,K.jsx)(l,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:y?Y?$.successHint:J?p.waitingForDevice:q?q.displayName:F?$.connectHint:p.intro:je}),Ne?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ne}):null,y&&P.error?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p.readinessFailed}):null,y&&W.error?(0,K.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:p.statusUnavailable}):null,y?P.data?Y?(0,K.jsxs)(K.Fragment,{children:[X.data?(0,K.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,K.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":X.data.runInBackground??!1,disabled:!X.data.backgroundSupported,checked:X.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>X.mutate(e.behavior)).catch(()=>L(`background`))}})]}):null,(0,K.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):De||Ee?(0,K.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Ee||q?.status===`expired`?p.expired:p.declined}),(0,K.jsx)(T,{variant:`primary`,onClick:()=>void Ce(),disabled:R,children:p.refresh})]}):q?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:p.scope}),(0,K.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[q.confirmationCode.slice(0,3),` `,q.confirmationCode.slice(3)]}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:p.compare}),(0,K.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:p.access}),(0,K.jsx)(`p`,{children:p.accessHint})]})]}):F?.targetKind===`mobile`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,K.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,K.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Z.data?(0,K.jsx)(`img`,{src:Z.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Z.error?null:(0,K.jsx)(C,{className:`size-[240px] rounded-xl`})})}),Z.error?null:(0,K.jsxs)(`p`,{className:S(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,Oe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,K.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),ke]})]}),Z.error?(0,K.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:p.qrFailed}):null,Z.error?(0,K.jsx)(`div`,{className:`mt-5`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,K.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(`span`,{children:p.fallback}),(0,K.jsx)(m,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(N,{text:F.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:F.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid})]}):P.data.ready?(0,K.jsx)(`div`,{className:`mt-8`,children:(0,K.jsx)(C,{className:`mx-auto size-[216px]`})}):(0,K.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[B===`tailscale`?(0,K.jsx)(oe,{embedded:!0}):B===`https`?(0,K.jsx)(ge,{}):B===`choices`?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`tailscale`),children:a.useTailscale}),(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`https`),children:a.useOwnHttps})]}):(0,K.jsx)(ve,{}),(0,K.jsx)(T,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>fe(B?null:`choices`),children:B?p.back:p.existing})]}):(0,K.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,K.jsx)(C,{className:`h-5 w-3/4`}),(0,K.jsx)(C,{className:`h-40 w-full`})]}):(0,K.jsxs)(`div`,{className:`mt-7`,children:[(0,K.jsxs)(T,{variant:`secondary`,className:`w-full`,disabled:R,onClick:()=>void Pe(),children:[(0,K.jsx)(_,{className:`size-4`}),a.browserDownload]}),(0,K.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,K.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void j(xe),children:[a.browserInstallHelp,(0,K.jsx)(v,{className:`size-3`})]})]})]}),!y||P.error||Y||q?.status===`pending`||I===`create`||I===`decision`?(0,K.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:y?Y?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:t,children:p.done}):q?.status===`pending`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void we(`approve`),children:p.allow}),(0,K.jsx)(T,{className:`w-full`,variant:`ghost`,disabled:R,onClick:()=>void we(`reject`),children:p.cancel})]}):P.error?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void P.mutate(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void Ce(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>{L(null),b(!0)},children:a.browserReady})}):null]})]})}export{q as n,J as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-CFj-ZOJE.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./interaction-BdhHBbYa.js";import{n as o,t as s}from"./use-directory-picker-C4p7AgWY.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:r,onPick:s,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h!==void 0&&h,y,b;t[0]!==d||t[1]!==r?(b=r.trim(),y=b?o(b):d??``,t[0]=d,t[1]=r,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=i(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,a.transition,a.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==s?(O=e=>{e.stopPropagation(),u||s()},t[9]=u,t[10]=s,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=i(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(n,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:n,onChange:a,disabled:o,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==a||t[1]!==n?(_={initialPath:n,onPicked:a},t[0]=a,t[1]=n,t[2]=_):_=t[2];let v=s(_),y;t[3]===n?y=t[4]:(y=n.trim(),t[3]=n,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=i(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=o||v.picking,w;t[7]===a?w=t[8]:(w=e=>void a(e.target.value),t[7]=a,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==n?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:n,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=n,t[16]=E):E=t[16];let D=o||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==n||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:n,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=n,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(r,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-BW76VaD5.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./interaction-BdhHBbYa.js";import{n as o,t as s}from"./use-directory-picker-C4p7AgWY.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:r,onPick:s,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h!==void 0&&h,y,b;t[0]!==d||t[1]!==r?(b=r.trim(),y=b?o(b):d??``,t[0]=d,t[1]=r,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=i(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,a.transition,a.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==s?(O=e=>{e.stopPropagation(),u||s()},t[9]=u,t[10]=s,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=i(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(n,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:n,onChange:a,disabled:o,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==a||t[1]!==n?(_={initialPath:n,onPicked:a},t[0]=a,t[1]=n,t[2]=_):_=t[2];let v=s(_),y;t[3]===n?y=t[4]:(y=n.trim(),t[3]=n,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=i(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=o||v.picking,w;t[7]===a?w=t[8]:(w=e=>void a(e.target.value),t[7]=a,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==n?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:n,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=n,t[16]=E):E=t[16];let D=o||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==n||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:n,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=n,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(r,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-CQcW9_qA.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./chevron-down-ccbiQQz_.js";import{t as o}from"./button-Cc4hUNTt.js";var s=i(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),c=i(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),l=i(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]);function u(e){let t=e.audioAvailable&&!e.audioDeleted,n=`sync_pending`,r=`none`;return e.audioDeleted?n=`audio_deleted`:e.localSave===`saving`?n=`local_saving`:e.localSave===`failed`?n=`save_failed`:e.localSave===`partial`?(n=`local_partial`,r=`recover`):t?e.serverStatus===`cancelled`?n=`cancelled`:e.serverStatus===`needs_attention`?(n=e.failureStage===`organization`?`analysis_failed`:`transcription_failed`,r=`pipeline`):e.serverStatus===`completed`?e.noteAvailable?e.analysisStale?(n=`analysis_stale`,r=`analyze`):n=`ready`:(n=`analysis_missing`,r=`regenerate`):n=e.serverStatus===`organizing`?e.retryScheduled?`analysis_retrying`:`organizing`:e.retryScheduled?`transcription_retrying`:`transcribing`:e.jobState===`failed`?(n=`verify_failed`,r=`pipeline`):e.jobState===`queued`||e.jobState===`running`||e.sync===`verifying`?n=`verifying`:e.sync===`offline`||e.sync===`failed`?(n=`sync_failed`,r=e.localSave===`complete`?`sync`:`none`):e.localSave!==`complete`&&e.serverStatus===`needs_attention`&&(n=`source_missing`),{stage:n,leave:e.localSave===`saving`?`hold`:t?`cloud`:e.localSave===`complete`?`local`:`hold`,retry:r,audio:t,text:e.textAvailable,note:e.noteAvailable,stale:e.analysisStale}}var d=`open-discussion-capture`;function f(e){window.dispatchEvent(new CustomEvent(d,{detail:e?{projectId:e}:{}}))}var p=e(),m={save_failed:[`录音未能保存`,`Recording could not be saved`,`尚未确认可恢复的原音。请检查麦克风权限和可用存储空间后重新录制。`,`No recoverable audio has been confirmed. Check microphone permission and available storage before recording again.`],cancelled:[`已停止整理`,`Processing stopped`,`已有原音、文字和笔记仍可使用。`,`Existing audio, text and notes remain available.`],local_saving:[`正在保存录音`,`Saving recording`,`请稍候,确认保存完成前请留在此页面。`,`Please stay on this page until saving is confirmed.`],local_partial:[`已保留部分录音`,`Part of the recording was retained`,`本次录音未完整保存。请先恢复或导出已保存部分,确认缺失范围。`,`This recording was not saved completely. Recover or export the saved portion and review the missing parts.`],sync_pending:[`正在同步原音`,`Syncing original audio`,`已完成的文字和笔记可先使用。原音确认可用后,会继续整理。`,`Available text and notes can be used now. Processing continues once the original audio is confirmed.`],sync_failed:[`原音同步未完成`,`Audio sync incomplete`,`已保存的内容仍保留在录制设备。连接网络后可重试同步,无需重新录音。`,`Saved content remains on the recording device. Reconnect and retry sync without recording again.`],verifying:[`原音已上传,正在确认`,`Confirming uploaded audio`,`上传完成后,还需确认原音可用。已有文字可以先查看。`,`Uploaded audio is being checked. Existing text can be read now.`],verify_failed:[`原音确认未完成`,`Audio confirmation incomplete`,`上传内容已保留,可重试确认原音。已有文字和笔记仍可使用。`,`Uploaded content is retained. Retry audio confirmation; existing text and notes remain available.`],transcribing:[`正在整理文字`,`Preparing transcript`,`原音已可回听,已完成的文字可先搜索和查看。文字完成后继续生成笔记。`,`Play the original audio and search available text now. Notes will follow the transcript.`],transcription_retrying:[`正在重试整理文字`,`Retrying transcription`,`原音和处理进度已保留,系统稍后自动重试。已有文字仍可使用。`,`Audio and progress are retained. An automatic retry is scheduled; existing text remains available.`],transcription_failed:[`文字整理未完成`,`Transcription incomplete`,`原音和已有文字均保留。重试会从已保存进度继续,无需重新录音。`,`Audio and existing text are retained. Retry from saved progress without recording again.`],organizing:[`正在生成笔记`,`Preparing notes`,`可以先回听原音、查找原话。笔记完成后可查看重点、结论和行动建议。`,`Play audio and find original statements now. Highlights, conclusions and suggested actions will follow.`],analysis_retrying:[`正在重试生成笔记`,`Retrying notes`,`原音、文字和已有笔记均保留,系统稍后自动重试。`,`Audio, text and existing notes are retained. An automatic retry is scheduled.`],analysis_failed:[`笔记生成未完成`,`Notes incomplete`,`原音、文字和已有笔记均保留。重试只继续整理,不会重新录音或创建重复笔记。`,`Audio, text and existing notes are retained. Retry continues processing without recording again or creating another note.`],ready:[`录音与笔记已就绪`,`Recording and notes are ready`,`现在可以回听原音、查找原话,并回顾重要信息。`,`Play the audio, find original statements and review important information.`],analysis_missing:[`暂未生成笔记`,`Notes are not available yet`,`原音和已有文字仍可使用,可以从原音重新生成文字与笔记。`,`Audio and existing text remain available. Regenerate text and notes from the original audio.`],analysis_stale:[`原文已更新`,`Transcript updated`,`当前笔记基于修改前的原文,可保留查看,也可按新版原文重新整理。`,`Existing notes use an earlier transcript. Keep them or generate notes from the updated text.`],source_missing:[`原音尚不可用`,`Original audio is not available yet`,`请到录制设备的待恢复录音中继续同步。已有文字和笔记仍可查看。`,`Continue sync from recoverable recordings on the recording device. Existing text and notes remain readable.`],audio_deleted:[`原音已删除`,`Original audio was deleted`,`已有文字和笔记仍可查看;重新生成需要重新导入原音。`,`Existing text and notes remain readable. Import the original audio again to regenerate.`]},h={leave_local:[`录音已在本机保存,可以离开当前页面。`,`Recording saved on this device. You can leave this page.`],leave_cloud:[`原音已同步,可以离开当前页面。`,`Original audio synced. You can leave this page.`],leave_hold:[`请先确认保存结果,再离开当前页面。`,`Confirm the recording is saved before leaving this page.`],local_hint:[`关闭应用后,可在待恢复录音中继续同步。请保留本机录音数据。`,`After closing the app, continue sync from recoverable recordings. Keep the recording data on this device.`],cloud_hint:[`后续转写与笔记整理在后台继续;失败时可在这条笔记中重试。`,`Transcription and notes continue on the server. Retry here if processing fails.`],retry_sync:[`重试同步`,`Retry sync`],retry_pipeline:[`继续处理`,`Resume processing`],retry_analysis_failed:[`重试生成笔记`,`Retry notes`],retry_transcription_failed:[`继续整理文字`,`Resume transcription`],retry_verify_failed:[`重试确认原音`,`Retry audio confirmation`],retry_recover:[`恢复已录内容`,`Recover saved audio`],retry_regenerate:[`从原音重新生成`,`Regenerate from audio`],retry_analyze:[`按新版原文整理`,`Update notes from transcript`],audio:[`原音`,`Audio`],text:[`文字`,`Transcript`],note:[`笔记`,`Notes`],available:[`可用`,`Available`],pending:[`尚未完成`,`Not ready`],old_note:[`旧版可用`,`Earlier version available`],open:[`打开笔记`,`Open note`],recover:[`待恢复录音`,`Recoverable recordings`],export:[`导出已录内容`,`Export saved audio`],close:[`稍后查看`,`View later`],annotation_failed:[`重点同步未完成,原音和笔记处理不受影响。`,`Highlights are not synced yet. Audio and note processing are unaffected.`],retry_annotation:[`重试重点同步`,`Retry highlights`]},g=t();function _(e,t=`unknown`,n=`pending`){return{localSave:t,sync:n,serverStatus:e?.discussion.status??``,failureStage:e?.discussion.failureStage??``,jobState:e?.recordingJob?.state??``,retryScheduled:!!e?.processing?.nextAttemptAt,audioAvailable:!!e?.discussion.audioAttachmentId,audioDeleted:!!e?.discussion.audioDeletedAt,textAvailable:!!e?.transcript?.text?.trim()||!!e?.discussion.canonicalTranscript?.trim(),noteAvailable:!!e?.organization?.organization,analysisStale:!!e?.organization&&e.organization.transcriptRevision!==e.transcript?.revision}}function v(e){let t=(0,p.c)(61),{input:n,zh:r,compact:i,busy:s,onRetry:c,children:l,nextAttemptAt:d,context:f}=e,_=i!==void 0&&i,v=s!==void 0&&s,y=f===void 0?`capture`:f,b,x,S,C,w,T,E,D,O,k,A,j,M;if(t[0]!==y||t[1]!==n||t[2]!==r){C=u(n),S=m[C.stage];let e;t[16]===r?e=t[17]:(e=e=>h[e][+!r],t[16]=r,t[17]=e),b=e,x=`retry_${[`analysis_failed`,`transcription_failed`,`verify_failed`].includes(C.stage)?C.stage:C.retry}`,M=`polite`,w=C.stage,T=y===`note`?`mx-auto w-full max-w-[46rem] text-fg`:`rounded-xl bg-surface-inset p-3 text-fg`,E=y===`capture`?(0,g.jsx)(`p`,{className:`mb-1 text-sm font-medium`,children:b(`leave_${C.leave}`)}):null,k=`group`,A=y,j=y===`note`&&(C.stage.endsWith(`_failed`)||C.stage.includes(`retry`)||C.stage===`local_partial`)?!0:void 0,O=`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-lg text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,D=C.stage.endsWith(`_failed`)||C.stage===`local_partial`?`bg-danger`:`bg-accent`,t[0]=y,t[1]=n,t[2]=r,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=w,t[8]=T,t[9]=E,t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j,t[15]=M}else b=t[3],x=t[4],S=t[5],C=t[6],w=t[7],T=t[8],E=t[9],D=t[10],O=t[11],k=t[12],A=t[13],j=t[14],M=t[15];let N=`size-1.5 shrink-0 rounded-full ${D}`,P;t[18]===N?P=t[19]:(P=(0,g.jsx)(`span`,{className:N,"aria-hidden":!0}),t[18]=N,t[19]=P);let F=S[+!r],I;t[20]===F?I=t[21]:(I=(0,g.jsx)(`span`,{className:`min-w-0 flex-1`,children:F}),t[20]=F,t[21]=I);let L;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(a,{className:`size-3.5 shrink-0 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0}),t[22]=L):L=t[22];let R;t[23]!==P||t[24]!==I||t[25]!==O?(R=(0,g.jsxs)(`summary`,{className:O,children:[P,I,L]}),t[23]=P,t[24]=I,t[25]=O,t[26]=R):R=t[26];let z;t[27]!==y||t[28]!==b||t[29]!==C.leave?(z=y===`note`?(0,g.jsx)(`p`,{children:b(`leave_${C.leave}`)}):null,t[27]=y,t[28]=b,t[29]=C.leave,t[30]=z):z=t[30];let B;t[31]!==_||t[32]!==d||t[33]!==b||t[34]!==S||t[35]!==C||t[36]!==r?(B=_?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{children:S[r?2:3]}),d&&Number.isFinite(d)?(0,g.jsxs)(`p`,{children:[r?`下次自动重试时间:`:`Next automatic retry: `,new Date(d).toLocaleTimeString(r?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}):null,C.leave===`local`?(0,g.jsx)(`p`,{children:b(`local_hint`)}):null,(0,g.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1`,"aria-label":r?`已可用内容`:`Available content`,children:[`audio`,`text`,`note`].map(e=>(0,g.jsxs)(`li`,{children:[b(e),` · `,e===`note`&&C.note&&C.stale?b(`old_note`):b(C[e]?`available`:`pending`)]},e))})]}),t[31]=_,t[32]=d,t[33]=b,t[34]=S,t[35]=C,t[36]=r,t[37]=B):B=t[37];let V;t[38]!==z||t[39]!==B?(V=(0,g.jsxs)(`div`,{className:`space-y-2 pb-3 text-xs leading-5 text-fg-muted`,children:[z,B]}),t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]!==R||t[42]!==V||t[43]!==k||t[44]!==A||t[45]!==j?(H=(0,g.jsxs)(`details`,{className:k,open:j,children:[R,V]},A),t[41]=R,t[42]=V,t[43]=k,t[44]=A,t[45]=j,t[46]=H):H=t[46];let U;t[47]!==v||t[48]!==c||t[49]!==b||t[50]!==x||t[51]!==C.retry?(U=C.retry!==`none`&&c?(0,g.jsx)(o,{className:`min-h-11`,disabled:v,onClick:()=>c(C.retry),children:b(x)}):null,t[47]=v,t[48]=c,t[49]=b,t[50]=x,t[51]=C.retry,t[52]=U):U=t[52];let W;return t[53]!==l||t[54]!==w||t[55]!==T||t[56]!==E||t[57]!==H||t[58]!==U||t[59]!==M?(W=(0,g.jsxs)(`section`,{"aria-live":M,"data-recording-outcome":w,className:T,children:[E,H,U,l]}),t[53]=l,t[54]=w,t[55]=T,t[56]=E,t[57]=H,t[58]=U,t[59]=M,t[60]=W):W=t[60],W}function y(){return r(n(`/api/discussion-capture/settings`))}function b(e){return r(n(`/api/discussion-capture/settings`),{method:`PUT`,body:JSON.stringify({consentPolicyVersion:e})})}async function x(e){return r(n(`/api/discussions`),{method:`POST`,body:JSON.stringify(e)})}function S(e){return r(n(`/api/discussions/${encodeURIComponent(e)}`))}async function C(e){try{return await r(n(`/api/discussions/by-note/${encodeURIComponent(e)}`))}catch(e){if(e.status===404)return null;throw e}}function w(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/transcript`))}function T(e,t,i){let a=new FormData;return a.set(`file`,i.blob,`segment-${t}.wav`),a.set(`startedAtMs`,String(i.startedAtMs)),a.set(`endedAtMs`,String(i.endedAtMs)),a.set(`sha256`,i.sha256),r(n(`/api/discussions/${encodeURIComponent(e)}/segments/${t}`),{method:`PUT`,body:a})}function E(e,t=`resume`){return r(n(`/api/discussions/${encodeURIComponent(e)}/retry`),{method:`POST`,body:JSON.stringify({mode:t})})}function D(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/project`),{method:`DELETE`})}function O(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks`))}function k(e,t,i,a){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks/${t}`),{method:`PUT`,headers:{"Content-Type":`application/octet-stream`,"x-audio-sha256":a},body:i})}function A(e,t){return r(n(`/api/discussions/${encodeURIComponent(e)}/capture/seal`),{method:`POST`,body:JSON.stringify(t)})}function j(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/job`))}var M=()=>window.dispatchEvent(new Event(`discussion-annotations-changed`));async function N(){return new Promise((e,t)=>{let n=indexedDB.open(`xopc-note-annotations`,1);n.onupgradeneeded=()=>{n.result.createObjectStore(`annotations`,{keyPath:[`recordingId`,`annotation.id`]}).createIndex(`recordingId`,`recordingId`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function P(e,t){let n=await N();try{return await new Promise((r,i)=>{let a=n.transaction(`annotations`,e?`readwrite`:`readonly`,{durability:`strict`}),o,s;a.oncomplete=()=>r(o),a.onabort=()=>i(s??a.error??Error(`Annotation save failed`)),a.onerror=()=>i(a.error);try{t(a.objectStore(`annotations`),e=>{o=e},e=>{s=e,a.abort()})}catch(e){a.abort(),i(e)}})}finally{n.close()}}async function F(e){return P(!1,(t,n)=>{let r=t.index(`recordingId`).getAll(e);r.onsuccess=()=>n(r.result)})}async function I(e,t,n){await P(!0,(r,i,a)=>{let o=r.get([e,t.id]);o.onsuccess=()=>{let s=o.result;if(n!==void 0&&(n===null?s&&s.state!==`synced`:s?.nonce!==n)){a(Error(`Annotation changed in another tab. Your editor content is retained; reload before saving.`));return}r.put({recordingId:e,annotation:t,nonce:crypto.randomUUID(),state:`pending`}),i()}}),M()}function L(e,t=`highlight`){let n=Date.now();return{id:crypto.randomUUID(),kind:t,text:``,anchor:e,revision:0,deleted:!1,createdAt:n,updatedAt:n}}async function R(e,t,n){await P(!0,(r,i)=>{let a=r.get([e,t]);a.onsuccess=()=>{let e=a.result;e&&e.annotation.anchor.offsetMs===void 0&&r.put({...e,nonce:crypto.randomUUID(),state:`pending`,annotation:{...e.annotation,anchor:{...e.annotation.anchor,offsetMs:n}}}),i()}}),M()}async function z(e,t,n=!1){await P(!0,(r,i)=>{let a=r.get([e.recordingId,e.annotation.id]);a.onsuccess=()=>{let o=a.result;o&&(o.nonce===e.nonce?r.put({...o,annotation:t??o.annotation,state:n?`conflict`:`synced`}):t&&o.annotation.revision===e.annotation.revision&&r.put({...o,annotation:{...o.annotation,revision:t.revision}})),i()}}),M()}var B=new Map;function V(e,t){let i=`${e}:${t}`;if(B.has(i))return B.get(i);let a=(async()=>{for(let i=0;i<5;i++){let i=(await F(e)).filter(e=>e.state===`pending`);if(!i.length)return;for(let e of i){if(e.state!==`pending`)continue;let i=e.annotation;try{await z(e,await r(n(`/api/discussions/${encodeURIComponent(t)}/annotations/${encodeURIComponent(i.id)}`),{method:`PUT`,signal:AbortSignal.timeout(15e3),body:JSON.stringify({id:i.id,kind:i.kind,text:i.text,anchor:i.anchor,expectedRevision:i.revision,deleted:i.deleted})}))}catch(t){throw t.status===409&&await z(e,void 0,!0),t}}}throw Error(`Highlights are still being updated. Saved local changes will sync on retry.`)})().finally(()=>B.delete(i));return B.set(i,a),a}export{f as C,s as E,d as S,c as T,D as _,R as a,v as b,x as c,C as d,w as f,A as g,E as h,L as i,S as l,j as m,z as n,I as o,O as p,F as r,b as s,V as t,y as u,T as v,l as w,_ as x,k as y};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-D3c8DIm-.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./chevron-down-ccbiQQz_.js";import{t as o}from"./button-Cc4hUNTt.js";var s=i(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),c=i(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),l=i(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]);function u(e){let t=e.audioAvailable&&!e.audioDeleted,n=`sync_pending`,r=`none`;return e.audioDeleted?n=`audio_deleted`:e.localSave===`saving`?n=`local_saving`:e.localSave===`failed`?n=`save_failed`:e.localSave===`partial`?(n=`local_partial`,r=`recover`):t?e.serverStatus===`cancelled`?n=`cancelled`:e.serverStatus===`needs_attention`?(n=e.failureStage===`organization`?`analysis_failed`:`transcription_failed`,r=`pipeline`):e.serverStatus===`completed`?e.noteAvailable?e.analysisStale?(n=`analysis_stale`,r=`analyze`):n=`ready`:(n=`analysis_missing`,r=`regenerate`):n=e.serverStatus===`organizing`?e.retryScheduled?`analysis_retrying`:`organizing`:e.retryScheduled?`transcription_retrying`:`transcribing`:e.jobState===`failed`?(n=`verify_failed`,r=`pipeline`):e.jobState===`queued`||e.jobState===`running`||e.sync===`verifying`?n=`verifying`:e.sync===`offline`||e.sync===`failed`?(n=`sync_failed`,r=e.localSave===`complete`?`sync`:`none`):e.localSave!==`complete`&&e.serverStatus===`needs_attention`&&(n=`source_missing`),{stage:n,leave:e.localSave===`saving`?`hold`:t?`cloud`:e.localSave===`complete`?`local`:`hold`,retry:r,audio:t,text:e.textAvailable,note:e.noteAvailable,stale:e.analysisStale}}var d=`open-discussion-capture`;function f(e){window.dispatchEvent(new CustomEvent(d,{detail:e?{projectId:e}:{}}))}var p=e(),m={save_failed:[`录音未能保存`,`Recording could not be saved`,`尚未确认可恢复的原音。请检查麦克风权限和可用存储空间后重新录制。`,`No recoverable audio has been confirmed. Check microphone permission and available storage before recording again.`],cancelled:[`已停止整理`,`Processing stopped`,`已有原音、文字和笔记仍可使用。`,`Existing audio, text and notes remain available.`],local_saving:[`正在保存录音`,`Saving recording`,`请稍候,确认保存完成前请留在此页面。`,`Please stay on this page until saving is confirmed.`],local_partial:[`已保留部分录音`,`Part of the recording was retained`,`本次录音未完整保存。请先恢复或导出已保存部分,确认缺失范围。`,`This recording was not saved completely. Recover or export the saved portion and review the missing parts.`],sync_pending:[`正在同步原音`,`Syncing original audio`,`已完成的文字和笔记可先使用。原音确认可用后,会继续整理。`,`Available text and notes can be used now. Processing continues once the original audio is confirmed.`],sync_failed:[`原音同步未完成`,`Audio sync incomplete`,`已保存的内容仍保留在录制设备。连接网络后可重试同步,无需重新录音。`,`Saved content remains on the recording device. Reconnect and retry sync without recording again.`],verifying:[`原音已上传,正在确认`,`Confirming uploaded audio`,`上传完成后,还需确认原音可用。已有文字可以先查看。`,`Uploaded audio is being checked. Existing text can be read now.`],verify_failed:[`原音确认未完成`,`Audio confirmation incomplete`,`上传内容已保留,可重试确认原音。已有文字和笔记仍可使用。`,`Uploaded content is retained. Retry audio confirmation; existing text and notes remain available.`],transcribing:[`正在整理文字`,`Preparing transcript`,`原音已可回听,已完成的文字可先搜索和查看。文字完成后继续生成笔记。`,`Play the original audio and search available text now. Notes will follow the transcript.`],transcription_retrying:[`正在重试整理文字`,`Retrying transcription`,`原音和处理进度已保留,系统稍后自动重试。已有文字仍可使用。`,`Audio and progress are retained. An automatic retry is scheduled; existing text remains available.`],transcription_failed:[`文字整理未完成`,`Transcription incomplete`,`原音和已有文字均保留。重试会从已保存进度继续,无需重新录音。`,`Audio and existing text are retained. Retry from saved progress without recording again.`],organizing:[`正在生成笔记`,`Preparing notes`,`可以先回听原音、查找原话。笔记完成后可查看重点、结论和行动建议。`,`Play audio and find original statements now. Highlights, conclusions and suggested actions will follow.`],analysis_retrying:[`正在重试生成笔记`,`Retrying notes`,`原音、文字和已有笔记均保留,系统稍后自动重试。`,`Audio, text and existing notes are retained. An automatic retry is scheduled.`],analysis_failed:[`笔记生成未完成`,`Notes incomplete`,`原音、文字和已有笔记均保留。重试只继续整理,不会重新录音或创建重复笔记。`,`Audio, text and existing notes are retained. Retry continues processing without recording again or creating another note.`],ready:[`录音与笔记已就绪`,`Recording and notes are ready`,`现在可以回听原音、查找原话,并回顾重要信息。`,`Play the audio, find original statements and review important information.`],analysis_missing:[`暂未生成笔记`,`Notes are not available yet`,`原音和已有文字仍可使用,可以从原音重新生成文字与笔记。`,`Audio and existing text remain available. Regenerate text and notes from the original audio.`],analysis_stale:[`原文已更新`,`Transcript updated`,`当前笔记基于修改前的原文,可保留查看,也可按新版原文重新整理。`,`Existing notes use an earlier transcript. Keep them or generate notes from the updated text.`],source_missing:[`原音尚不可用`,`Original audio is not available yet`,`请到录制设备的待恢复录音中继续同步。已有文字和笔记仍可查看。`,`Continue sync from recoverable recordings on the recording device. Existing text and notes remain readable.`],audio_deleted:[`原音已删除`,`Original audio was deleted`,`已有文字和笔记仍可查看;重新生成需要重新导入原音。`,`Existing text and notes remain readable. Import the original audio again to regenerate.`]},h={leave_local:[`录音已在本机保存,可以离开当前页面。`,`Recording saved on this device. You can leave this page.`],leave_cloud:[`原音已同步,可以离开当前页面。`,`Original audio synced. You can leave this page.`],leave_hold:[`请先确认保存结果,再离开当前页面。`,`Confirm the recording is saved before leaving this page.`],local_hint:[`关闭应用后,可在待恢复录音中继续同步。请保留本机录音数据。`,`After closing the app, continue sync from recoverable recordings. Keep the recording data on this device.`],cloud_hint:[`后续转写与笔记整理在后台继续;失败时可在这条笔记中重试。`,`Transcription and notes continue on the server. Retry here if processing fails.`],retry_sync:[`重试同步`,`Retry sync`],retry_pipeline:[`继续处理`,`Resume processing`],retry_analysis_failed:[`重试生成笔记`,`Retry notes`],retry_transcription_failed:[`继续整理文字`,`Resume transcription`],retry_verify_failed:[`重试确认原音`,`Retry audio confirmation`],retry_recover:[`恢复已录内容`,`Recover saved audio`],retry_regenerate:[`从原音重新生成`,`Regenerate from audio`],retry_analyze:[`按新版原文整理`,`Update notes from transcript`],audio:[`原音`,`Audio`],text:[`文字`,`Transcript`],note:[`笔记`,`Notes`],available:[`可用`,`Available`],pending:[`尚未完成`,`Not ready`],old_note:[`旧版可用`,`Earlier version available`],open:[`打开笔记`,`Open note`],recover:[`待恢复录音`,`Recoverable recordings`],export:[`导出已录内容`,`Export saved audio`],close:[`稍后查看`,`View later`],annotation_failed:[`重点同步未完成,原音和笔记处理不受影响。`,`Highlights are not synced yet. Audio and note processing are unaffected.`],retry_annotation:[`重试重点同步`,`Retry highlights`]},g=t();function _(e,t=`unknown`,n=`pending`){return{localSave:t,sync:n,serverStatus:e?.discussion.status??``,failureStage:e?.discussion.failureStage??``,jobState:e?.recordingJob?.state??``,retryScheduled:!!e?.processing?.nextAttemptAt,audioAvailable:!!e?.discussion.audioAttachmentId,audioDeleted:!!e?.discussion.audioDeletedAt,textAvailable:!!e?.transcript?.text?.trim()||!!e?.discussion.canonicalTranscript?.trim(),noteAvailable:!!e?.organization?.organization,analysisStale:!!e?.organization&&e.organization.transcriptRevision!==e.transcript?.revision}}function v(e){let t=(0,p.c)(61),{input:n,zh:r,compact:i,busy:s,onRetry:c,children:l,nextAttemptAt:d,context:f}=e,_=i!==void 0&&i,v=s!==void 0&&s,y=f===void 0?`capture`:f,b,x,S,C,w,T,E,D,O,k,A,j,M;if(t[0]!==y||t[1]!==n||t[2]!==r){C=u(n),S=m[C.stage];let e;t[16]===r?e=t[17]:(e=e=>h[e][+!r],t[16]=r,t[17]=e),b=e,x=`retry_${[`analysis_failed`,`transcription_failed`,`verify_failed`].includes(C.stage)?C.stage:C.retry}`,M=`polite`,w=C.stage,T=y===`note`?`mx-auto w-full max-w-[46rem] text-fg`:`rounded-xl bg-surface-inset p-3 text-fg`,E=y===`capture`?(0,g.jsx)(`p`,{className:`mb-1 text-sm font-medium`,children:b(`leave_${C.leave}`)}):null,k=`group`,A=y,j=y===`note`&&(C.stage.endsWith(`_failed`)||C.stage.includes(`retry`)||C.stage===`local_partial`)?!0:void 0,O=`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-lg text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,D=C.stage.endsWith(`_failed`)||C.stage===`local_partial`?`bg-danger`:`bg-accent`,t[0]=y,t[1]=n,t[2]=r,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=w,t[8]=T,t[9]=E,t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j,t[15]=M}else b=t[3],x=t[4],S=t[5],C=t[6],w=t[7],T=t[8],E=t[9],D=t[10],O=t[11],k=t[12],A=t[13],j=t[14],M=t[15];let N=`size-1.5 shrink-0 rounded-full ${D}`,P;t[18]===N?P=t[19]:(P=(0,g.jsx)(`span`,{className:N,"aria-hidden":!0}),t[18]=N,t[19]=P);let F=S[+!r],I;t[20]===F?I=t[21]:(I=(0,g.jsx)(`span`,{className:`min-w-0 flex-1`,children:F}),t[20]=F,t[21]=I);let L;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(a,{className:`size-3.5 shrink-0 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0}),t[22]=L):L=t[22];let R;t[23]!==P||t[24]!==I||t[25]!==O?(R=(0,g.jsxs)(`summary`,{className:O,children:[P,I,L]}),t[23]=P,t[24]=I,t[25]=O,t[26]=R):R=t[26];let z;t[27]!==y||t[28]!==b||t[29]!==C.leave?(z=y===`note`?(0,g.jsx)(`p`,{children:b(`leave_${C.leave}`)}):null,t[27]=y,t[28]=b,t[29]=C.leave,t[30]=z):z=t[30];let B;t[31]!==_||t[32]!==d||t[33]!==b||t[34]!==S||t[35]!==C||t[36]!==r?(B=_?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{children:S[r?2:3]}),d&&Number.isFinite(d)?(0,g.jsxs)(`p`,{children:[r?`下次自动重试时间:`:`Next automatic retry: `,new Date(d).toLocaleTimeString(r?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}):null,C.leave===`local`?(0,g.jsx)(`p`,{children:b(`local_hint`)}):null,(0,g.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1`,"aria-label":r?`已可用内容`:`Available content`,children:[`audio`,`text`,`note`].map(e=>(0,g.jsxs)(`li`,{children:[b(e),` · `,e===`note`&&C.note&&C.stale?b(`old_note`):b(C[e]?`available`:`pending`)]},e))})]}),t[31]=_,t[32]=d,t[33]=b,t[34]=S,t[35]=C,t[36]=r,t[37]=B):B=t[37];let V;t[38]!==z||t[39]!==B?(V=(0,g.jsxs)(`div`,{className:`space-y-2 pb-3 text-xs leading-5 text-fg-muted`,children:[z,B]}),t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]!==R||t[42]!==V||t[43]!==k||t[44]!==A||t[45]!==j?(H=(0,g.jsxs)(`details`,{className:k,open:j,children:[R,V]},A),t[41]=R,t[42]=V,t[43]=k,t[44]=A,t[45]=j,t[46]=H):H=t[46];let U;t[47]!==v||t[48]!==c||t[49]!==b||t[50]!==x||t[51]!==C.retry?(U=C.retry!==`none`&&c?(0,g.jsx)(o,{className:`min-h-11`,disabled:v,onClick:()=>c(C.retry),children:b(x)}):null,t[47]=v,t[48]=c,t[49]=b,t[50]=x,t[51]=C.retry,t[52]=U):U=t[52];let W;return t[53]!==l||t[54]!==w||t[55]!==T||t[56]!==E||t[57]!==H||t[58]!==U||t[59]!==M?(W=(0,g.jsxs)(`section`,{"aria-live":M,"data-recording-outcome":w,className:T,children:[E,H,U,l]}),t[53]=l,t[54]=w,t[55]=T,t[56]=E,t[57]=H,t[58]=U,t[59]=M,t[60]=W):W=t[60],W}function y(){return r(n(`/api/discussion-capture/settings`))}function b(e){return r(n(`/api/discussion-capture/settings`),{method:`PUT`,body:JSON.stringify({consentPolicyVersion:e})})}async function x(e){return r(n(`/api/discussions`),{method:`POST`,body:JSON.stringify(e)})}function S(e){return r(n(`/api/discussions/${encodeURIComponent(e)}`))}async function C(e){try{return await r(n(`/api/discussions/by-note/${encodeURIComponent(e)}`))}catch(e){if(e.status===404)return null;throw e}}function w(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/transcript`))}function T(e,t,i){let a=new FormData;return a.set(`file`,i.blob,`segment-${t}.wav`),a.set(`startedAtMs`,String(i.startedAtMs)),a.set(`endedAtMs`,String(i.endedAtMs)),a.set(`sha256`,i.sha256),r(n(`/api/discussions/${encodeURIComponent(e)}/segments/${t}`),{method:`PUT`,body:a})}function E(e,t=`resume`){return r(n(`/api/discussions/${encodeURIComponent(e)}/retry`),{method:`POST`,body:JSON.stringify({mode:t})})}function D(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/project`),{method:`DELETE`})}function O(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks`))}function k(e,t,i,a){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/chunks/${t}`),{method:`PUT`,headers:{"Content-Type":`application/octet-stream`,"x-audio-sha256":a},body:i})}function A(e,t){return r(n(`/api/discussions/${encodeURIComponent(e)}/capture/seal`),{method:`POST`,body:JSON.stringify(t)})}function j(e){return r(n(`/api/discussions/${encodeURIComponent(e)}/recording/job`))}var M=()=>window.dispatchEvent(new Event(`discussion-annotations-changed`));async function N(){return new Promise((e,t)=>{let n=indexedDB.open(`xopc-note-annotations`,1);n.onupgradeneeded=()=>{n.result.createObjectStore(`annotations`,{keyPath:[`recordingId`,`annotation.id`]}).createIndex(`recordingId`,`recordingId`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function P(e,t){let n=await N();try{return await new Promise((r,i)=>{let a=n.transaction(`annotations`,e?`readwrite`:`readonly`,{durability:`strict`}),o,s;a.oncomplete=()=>r(o),a.onabort=()=>i(s??a.error??Error(`Annotation save failed`)),a.onerror=()=>i(a.error);try{t(a.objectStore(`annotations`),e=>{o=e},e=>{s=e,a.abort()})}catch(e){a.abort(),i(e)}})}finally{n.close()}}async function F(e){return P(!1,(t,n)=>{let r=t.index(`recordingId`).getAll(e);r.onsuccess=()=>n(r.result)})}async function I(e,t,n){await P(!0,(r,i,a)=>{let o=r.get([e,t.id]);o.onsuccess=()=>{let s=o.result;if(n!==void 0&&(n===null?s&&s.state!==`synced`:s?.nonce!==n)){a(Error(`Annotation changed in another tab. Your editor content is retained; reload before saving.`));return}r.put({recordingId:e,annotation:t,nonce:crypto.randomUUID(),state:`pending`}),i()}}),M()}function L(e,t=`highlight`){let n=Date.now();return{id:crypto.randomUUID(),kind:t,text:``,anchor:e,revision:0,deleted:!1,createdAt:n,updatedAt:n}}async function R(e,t,n){await P(!0,(r,i)=>{let a=r.get([e,t]);a.onsuccess=()=>{let e=a.result;e&&e.annotation.anchor.offsetMs===void 0&&r.put({...e,nonce:crypto.randomUUID(),state:`pending`,annotation:{...e.annotation,anchor:{...e.annotation.anchor,offsetMs:n}}}),i()}}),M()}async function z(e,t,n=!1){await P(!0,(r,i)=>{let a=r.get([e.recordingId,e.annotation.id]);a.onsuccess=()=>{let o=a.result;o&&(o.nonce===e.nonce?r.put({...o,annotation:t??o.annotation,state:n?`conflict`:`synced`}):t&&o.annotation.revision===e.annotation.revision&&r.put({...o,annotation:{...o.annotation,revision:t.revision}})),i()}}),M()}var B=new Map;function V(e,t){let i=`${e}:${t}`;if(B.has(i))return B.get(i);let a=(async()=>{for(let i=0;i<5;i++){let i=(await F(e)).filter(e=>e.state===`pending`);if(!i.length)return;for(let e of i){if(e.state!==`pending`)continue;let i=e.annotation;try{await z(e,await r(n(`/api/discussions/${encodeURIComponent(t)}/annotations/${encodeURIComponent(i.id)}`),{method:`PUT`,signal:AbortSignal.timeout(15e3),body:JSON.stringify({id:i.id,kind:i.kind,text:i.text,anchor:i.anchor,expectedRevision:i.revision,deleted:i.deleted})}))}catch(t){throw t.status===409&&await z(e,void 0,!0),t}}}throw Error(`Highlights are still being updated. Saved local changes will sync on retry.`)})().finally(()=>B.delete(i));return B.set(i,a),a}export{f as C,s as E,d as S,c as T,D as _,R as a,v as b,x as c,C as d,w as f,A as g,E as h,L as i,S as l,j as m,z as n,I as o,O as p,F as r,b as s,V as t,y as u,T as v,l as w,_ as x,k as y};
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,c as a,f as o,g as s,h as c,i as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./es2015-DBLcMg5B.js";import{i as _,n as v}from"./dist-CxGUk8J-.js";var y=t({Close:()=>J,Content:()=>z,Description:()=>K,Dialog:()=>D,DialogClose:()=>J,DialogContent:()=>z,DialogDescription:()=>K,DialogOverlay:()=>F,DialogPortal:()=>N,DialogTitle:()=>W,DialogTrigger:()=>k,Overlay:()=>F,Portal:()=>N,Root:()=>D,Title:()=>W,Trigger:()=>k,WarningProvider:()=>Y,createDialogScope:()=>w}),b=e(n(),1),x=r(),S=`Dialog`,[C,w]=c(S),[T,E]=C(S),D=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:s=!0}=e,c=b.useRef(null),l=b.useRef(null),[u,d]=o({prop:r,defaultProp:i??!1,onChange:a,caller:S});return(0,x.jsx)(T,{scope:t,triggerRef:c,contentRef:l,contentId:f(),titleId:f(),descriptionId:f(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:s,children:n})};D.displayName=S;var O=`DialogTrigger`,k=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(O,n),a=_(t,i.triggerRef);return(0,x.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":X(i.open),...r,ref:a,onClick:s(e.onClick,i.onOpenToggle)})});k.displayName=O;var A=`DialogPortal`,[j,M]=C(A,{forceMount:void 0}),N=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=E(A,t);return(0,x.jsx)(j,{scope:t,forceMount:n,children:b.Children.map(r,e=>(0,x.jsx)(l,{present:n||o.open,children:(0,x.jsx)(i,{asChild:!0,container:a,children:e})}))})};N.displayName=A;var P=`DialogOverlay`,F=b.forwardRef((e,t)=>{let n=M(P,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=E(P,e.__scopeDialog);return a.modal?(0,x.jsx)(l,{present:r||a.open,children:(0,x.jsx)(L,{...i,ref:t})}):null});F.displayName=P;var I=v(`DialogOverlay.RemoveScroll`),L=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(P,n),o=_(t,a());return(0,x.jsx)(u,{as:I,allowPinchZoom:!0,shards:[i.contentRef],children:(0,x.jsx)(g.div,{"data-state":X(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})}),R=`DialogContent`,z=b.forwardRef((e,t)=>{let n=M(R,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=E(R,e.__scopeDialog);return(0,x.jsx)(l,{present:r||a.open,children:a.modal?(0,x.jsx)(B,{...i,ref:t}):(0,x.jsx)(V,{...i,ref:t})})});z.displayName=R;var B=b.forwardRef((e,t)=>{let n=E(R,e.__scopeDialog),r=b.useRef(null),i=_(t,n.contentRef,r);return b.useEffect(()=>{let e=r.current;if(e)return h(e)},[]),(0,x.jsx)(H,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault())})}),V=b.forwardRef((e,t)=>{let n=E(R,e.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return(0,x.jsx)(H,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),H=b.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=E(R,n);return p(),(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(d,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,x.jsx)(m,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":X(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),U=`DialogTitle`,W=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(U,n);return(0,x.jsx)(g.h2,{id:i.titleId,...r,ref:t})});W.displayName=U;var G=`DialogDescription`,K=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(G,n);return(0,x.jsx)(g.p,{id:i.descriptionId,...r,ref:t})});K.displayName=G;var q=`DialogClose`,J=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(q,n);return(0,x.jsx)(g.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});J.displayName=q;var Y=e=>e.children;function X(e){return e?`open`:`closed`}export{F as a,k as c,K as i,y as l,J as n,N as o,z as r,W as s,D as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-D3c8DIm-.js";import{t as s}from"./messages-DPLud9GK.js";import{a as c,l,n as u}from"./dist-CY7CS_D3.js";import{i as d,n as f,r as p}from"./popover-select-CLsphyzA.js";import{t as m}from"./skeleton-DzdOeGYz.js";import{c as h}from"./local-apps-CB-MZAaL.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";var _=e(t(),1),v=n(),y={"capability:xopc.agent.delegate":`Delegate bounded text reasoning to the configured model (may incur costs)`,"capability:xopc.notes.create":`Create notes within the approved scope`,"capability:xopc.notes.update":`Change approved notes at an exact revision`,"capability:xopc.notes.append":`Append content to approved notes`,"capability:xopc.notes.get":`Read approved notes by ID`,"capability:xopc.notes.list":`Search and list approved notes`,"capability:xopc.tasks.get":`Read approved task summaries`,"capability:xopc.tasks.list":`Search and list approved task summaries`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},b={"capability:xopc.agent.delegate":`委托已配置模型执行有预算限制的文本推理(可能产生费用)`,"capability:xopc.notes.create":`在授权范围内创建笔记`,"capability:xopc.notes.update":`按精确版本修改授权范围内的笔记`,"capability:xopc.notes.append":`向授权范围内的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取授权范围内的笔记`,"capability:xopc.notes.list":`搜索和列出授权范围内的笔记`,"capability:xopc.tasks.get":`读取授权范围内的任务摘要`,"capability:xopc.tasks.list":`搜索和列出授权范围内的任务摘要`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function x(e,t){let n=y[e];return t===`zh`&&b[e]?b[e]:n??e}var S=r();function C(e){let t=(0,v.c)(19),{extensionId:n,kind:r,values:i,onChange:a,zh:o}=e,[s,c]=(0,_.useState)(``),{data:l,error:u,isLoading:f}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=${r}&search=${encodeURIComponent(s)}`,T),p=r===`notes`?o?`笔记`:`Notes`:r===`tasks`?o?`任务`:`Tasks`:o?`项目`:`Projects`,h;if(t[0]!==l?.items||t[1]!==i){h=(l?.items??[]).map(w);for(let e of i)h.some(t=>t.value===e)||h.push({value:e,label:e});t[0]=l?.items,t[1]=i,t[2]=h}else h=t[2];let y=o?`搜索${p}`:`Search ${p}`,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>c(e.target.value),t[3]=b):b=t[3];let x=o?`搜索${p}(最多显示 100 项)`:`Search ${p} (up to 100 results)`,C;t[4]!==s||t[5]!==y||t[6]!==x?(C=(0,S.jsx)(`input`,{"aria-label":y,value:s,onChange:b,placeholder:x,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[4]=s,t[5]=y,t[6]=x,t[7]=C):C=t[7];let E;t[8]!==u||t[9]!==f||t[10]!==p||t[11]!==a||t[12]!==h||t[13]!==i||t[14]!==o?(E=(0,S.jsx)(`div`,{className:`mt-1 max-h-36 overflow-y-auto`,children:f?(0,S.jsx)(m,{className:`h-16`}):u?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:o?`无法加载,请重试`:`Could not load resources`}):(0,S.jsx)(d,{ariaLabel:p,multiple:!0,options:h,values:i,onChange:a})}),t[8]=u,t[9]=f,t[10]=p,t[11]=a,t[12]=h,t[13]=i,t[14]=o,t[15]=E):E=t[15];let D;return t[16]!==C||t[17]!==E?(D=(0,S.jsxs)(`div`,{className:`mt-2 rounded-lg border border-edge p-2`,children:[C,E]}),t[16]=C,t[17]=E,t[18]=D):D=t[18],D}function w(e){return{value:e.id,label:e.title}}function T(e){return o(i(e))}function E(e){let t=(0,v.c)(35),{extensionId:n,permissions:r,value:i,onChange:a,zh:o}=e,s=o?`读取笔记的范围`:`Notes this app may read`,c;t[0]===r?c=t[1]:(c=r.some(A),t[0]=r,t[1]=c);let l;t[2]!==s||t[3]!==c?(l={key:`notesRead`,label:s,kind:`notes`,visible:c},t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=o?`修改与创建笔记的范围`:`Notes this app may change or create`,d;t[5]===r?d=t[6]:(d=r.some(k),t[5]=r,t[6]=d);let m;t[7]!==u||t[8]!==d?(m={key:`notesWrite`,label:u,kind:`notes`,visible:d},t[7]=u,t[8]=d,t[9]=m):m=t[9];let h=o?`读取任务的范围`:`Tasks this app may read`,g;t[10]===r?g=t[11]:(g=r.some(O),t[10]=r,t[11]=g);let _;t[12]!==h||t[13]!==g?(_={key:`tasksRead`,label:h,kind:`tasks`,visible:g},t[12]=h,t[13]=g,t[14]=_):_=t[14];let y;t[15]!==l||t[16]!==m||t[17]!==_?(y=[l,m,_],t[15]=l,t[16]=m,t[17]=_,t[18]=y):y=t[18];let b=y,x;t[19]!==a||t[20]!==r||t[21]!==i||t[22]!==o?(x=r.includes(`capability:xopc.agent.delegate`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`受限 Agent 委托`:`Restricted Agent delegation`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.agentDelegate,onChange:e=>a({...i,agentDelegate:e.target.checked})}),o?`允许发送应用指令、上下文和授权引用到已配置的模型`:`Allow sending app instructions, context and approved references to the configured model`]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`可能产生模型费用。每应用每小时最多 20 次,每次最多 30 秒、1024 输出 token。无聊天历史、记忆、文件、工具或自动写入权限。预览不运行真实委托。`:`May incur model costs. Up to 20 calls per app per hour, 30 seconds and 1024 output tokens per call. No chat history, memory, files, tools or automatic writes. Unavailable in previews.`})]}):null,t[19]=a,t[20]=r,t[21]=i,t[22]=o,t[23]=x):x=t[23];let w;t[24]===b?w=t[25]:(w=b.filter(D),t[24]=b,t[25]=w);let T;t[26]!==n||t[27]!==a||t[28]!==w||t[29]!==i||t[30]!==o?(T=w.map(e=>{let t=i[e.key],r=t=>a({...i,[e.key]:t});return(0,S.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,S.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:e.label}),(0,S.jsxs)(f,{"aria-label":e.label,value:t.mode,onChange:e=>r(e.target.value===`selected`?{mode:`selected`,ids:[],projectIds:[],includeCreated:!1}:{mode:e.target.value}),children:[(0,S.jsx)(p,{value:`none`,children:o?`不允许`:`No access`}),(0,S.jsx)(p,{value:`selected`,children:o?`仅选择的记录或项目`:`Selected records or projects`}),(0,S.jsx)(p,{value:`workspace`,children:o?`整个工作区(包含所有记录)`:`Entire workspace (all records)`})]}),t.mode===`workspace`?(0,S.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:o?`这会授权访问整个工作区,请确认符合此工具的用途。`:`This grants workspace-wide access. Check that this matches the tool’s purpose.`}):null,t.mode===`selected`?(0,S.jsxs)(S.Fragment,{children:[e.kind===`notes`?(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:t.includeCreated,onChange:e=>r({...t,includeCreated:e.target.checked})}),o?`包括此应用创建的笔记`:`Include notes created by this app`]}):null,(0,S.jsx)(C,{extensionId:n,kind:e.kind,values:t.ids,onChange:e=>r({...t,ids:e}),zh:o}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`也可授权以下项目中的记录,包括以后加入项目的记录。`:`You may also allow records in these projects, including future additions.`}),(0,S.jsx)(C,{extensionId:n,kind:`projects`,values:t.projectIds,onChange:e=>r({...t,projectIds:e}),zh:o})]}):null]},e.key)}),t[26]=n,t[27]=a,t[28]=w,t[29]=i,t[30]=o,t[31]=T):T=t[31];let E;return t[32]!==x||t[33]!==T?(E=(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[x,T]}),t[32]=x,t[33]=T,t[34]=E):E=t[34],E}function D(e){return e.visible}function O(e){return/capability:xopc.tasks.(get|list)$/.test(e)}function k(e){return/capability:xopc.notes.(create|update|append)$/.test(e)}function A(e){return/capability:xopc.notes.(get|list)$/.test(e)}function j(e){let t=(0,v.c)(63),{open:n,onOpenChange:r,extensionId:i,extensionName:o,permissions:d,onConfirm:f,confirmDisabled:p,localApp:m,resourceScopes:g,error:y}=e,b=a(N),C=s(b).extensionUi,w;t[0]===g?w=t[1]:(w=()=>h.parse(g??{}),t[0]=g,t[1]=w);let[T,D]=(0,_.useState)(w),O;t[2]!==g||t[3]!==D?(O=()=>D(h.parse(g??{})),t[2]=g,t[3]=D,t[4]=O):O=t[4];let k;t[5]!==i||t[6]!==g?(k=[g,i],t[5]=i,t[6]=g,t[7]=k):k=t[7],(0,_.useEffect)(O,k);let A=l,j=l,P;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,S.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[8]=P):P=t[8];let F=l,I=M,L=l,R=C.permissionTitle.replace(`{{name}}`,o),z;t[9]!==L.Title||t[10]!==R?(z=(0,S.jsx)(L.Title,{className:`text-base font-semibold text-fg`,children:R}),t[9]=L.Title,t[10]=R,t[11]=z):z=t[11];let B;t[12]===i?B=t[13]:(B=(0,S.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[12]=i,t[13]=B);let V;t[14]!==C.permissionSubtitle||t[15]!==B?(V=(0,S.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[C.permissionSubtitle,` `,B]}),t[14]=C.permissionSubtitle,t[15]=B,t[16]=V):V=t[16];let H;t[17]!==b||t[18]!==d||t[19]!==C.permissionsNone?(H=d.length===0?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:C.permissionsNone}):(0,S.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:d.map(e=>(0,S.jsx)(`li`,{children:x(e,b)},e))}),t[17]=b,t[18]=d,t[19]=C.permissionsNone,t[20]=H):H=t[20];let U;t[21]!==i||t[22]!==b||t[23]!==m||t[24]!==d||t[25]!==T||t[26]!==D?(U=m?(0,S.jsx)(E,{extensionId:i,permissions:d,value:T,onChange:D,zh:b===`zh`}):null,t[21]=i,t[22]=b,t[23]=m,t[24]=d,t[25]=T,t[26]=D,t[27]=U):U=t[27];let W;t[28]!==H||t[29]!==U?(W=(0,S.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[H,U]}),t[28]=H,t[29]=U,t[30]=W):W=t[30];let G;t[31]===y?G=t[32]:(G=y?(0,S.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:y}):null,t[31]=y,t[32]=G);let K;t[33]===C.deny?K=t[34]:(K=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:C.deny})}),t[33]=C.deny,t[34]=K);let q;t[35]!==m||t[36]!==f||t[37]!==T?(q=()=>{f(m?T:void 0)},t[35]=m,t[36]=f,t[37]=T,t[38]=q):q=t[38];let J;t[39]!==p||t[40]!==C.allow||t[41]!==q?(J=(0,S.jsx)(`button`,{type:`button`,disabled:p,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:q,children:C.allow}),t[39]=p,t[40]=C.allow,t[41]=q,t[42]=J):J=t[42];let Y;t[43]!==K||t[44]!==J?(Y=(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[K,J]}),t[43]=K,t[44]=J,t[45]=Y):Y=t[45];let X;t[46]!==z||t[47]!==V||t[48]!==W||t[49]!==G||t[50]!==Y||t[51]!==F.Content||t[52]!==I?(X=(0,S.jsxs)(F.Content,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,onOpenAutoFocus:I,children:[z,V,W,G,Y]}),t[46]=z,t[47]=V,t[48]=W,t[49]=G,t[50]=Y,t[51]=F.Content,t[52]=I,t[53]=X):X=t[53];let Z;t[54]!==X||t[55]!==j.Portal||t[56]!==P?(Z=(0,S.jsxs)(j.Portal,{children:[P,X]}),t[54]=X,t[55]=j.Portal,t[56]=P,t[57]=Z):Z=t[57];let Q;return t[58]!==r||t[59]!==n||t[60]!==Z||t[61]!==A.Root?(Q=(0,S.jsx)(A.Root,{open:n,onOpenChange:r,children:Z}),t[58]=r,t[59]=n,t[60]=Z,t[61]=A.Root,t[62]=Q):Q=t[62],Q}function M(e){return e.preventDefault()}function N(e){return e.language}async function P(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function F(e,t,n){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t,resourceScopes:n})})).grant}export{E as i,P as n,j as r,F as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-CQcW9_qA.js";import{t as i}from"./messages-orB1BMgI.js";import{r as a}from"./extension-provider-DUzhV5_a.js";import{n as o,t as s}from"./settings-page-header-CheboxIM.js";import"./settings-page-layout-CPFMZaLF.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=r(p),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-D3c8DIm-.js";import{t as i}from"./messages-DPLud9GK.js";import{r as a}from"./extension-provider-DUDaMvQg.js";import{n as o,t as s}from"./settings-page-header-19GJ_a45.js";import"./settings-page-layout-B2WCzSel.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=r(p),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,l as a,n as ee}from"./locale-store-D3c8DIm-.js";import{t as te}from"./messages-DPLud9GK.js";import{i as ne}from"./theme-store-D9pquJiM.js";import{n as re}from"./extension-provider-DUDaMvQg.js";import{r as ie}from"./extension-message-router-DboLTCVp.js";import{r as ae}from"./settings-form-draft-Dy10ldo8.js";import{n as oe,r as se,t as ce}from"./extension-authoritative-grants-8ONVOjPW.js";var o=e(t(),1),le=n();function s(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function ue(e,t){let n=s(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var c=r(),de=48,fe=2e3,pe=`allow-scripts allow-forms allow-popups`;function me(e){let t=(0,le.c)(123),{extensionId:n,extensionName:r,entrypoint:i,permissions:s,title:me,className:l,fixedHeight:u,maxHeight:ye,minHeight:be,initialData:d}=e,f=ye===void 0?fe:ye,p=be===void 0?de:be,m=ee(ve),h;t[0]===m?h=t[1]:(h=te(m),t[0]=m,t[1]=h);let g=h.extensionUi,_=re(),v=a(_e),y=a(ge),b=(0,o.useRef)(0),x=(0,o.useRef)(!1),[S,xe]=(0,o.useState)(null),Se=(0,o.useRef)(null),Ce=ne(he),C;t[2]!==n||t[3]!==r?(C=r?.trim()||n,t[2]=n,t[3]=r,t[4]=C):C=t[4];let we=C,w;t[5]!==n||t[6]!==me?(w=me?.trim()||`Extension ${n}`,t[5]=n,t[6]=me,t[7]=w):w=t[7];let Te=w,T;t[8]===s?T=t[9]:(T=JSON.stringify(Array.from(s??[]).toSorted()),t[8]=s,t[9]=T);let Ee=T,E;t[10]===Ee?E=t[11]:(E=JSON.parse(Ee),t[10]=Ee,t[11]=E);let De=E,Oe=u??Math.min(f,Math.max(p,320)),D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[12]=D):D=t[12];let O;t[13]===Oe?O=t[14]:(O={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:Oe,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:D},t[13]=Oe,t[14]=O);let[k,A]=(0,o.useReducer)(ae,O),{allowed:j,dialogOpen:M,reloadKey:N,loadError:ke,dynamicHeight:Ae,grantResolved:je,grantError:P}=k,F;t[15]===n?F=t[16]:(F=()=>{let e=!0;return x.current=!1,xe(null),A({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),oe(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);A({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions,grantRevision:t.grantRevision,localApp:!!t.appId,resourceScopes:t.resourceScopes}})}}).catch(t=>{e&&A({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,b.current+=1}},t[15]=n,t[16]=F);let I;t[17]!==n||t[18]!==v||t[19]!==y||t[20]!==De||t[21]!==N?(I=[n,De,v,y,N],t[17]=n,t[18]=v,t[19]=y,t[20]=De,t[21]=N,t[22]=I):I=t[22],(0,o.useEffect)(F,I);let L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>A({type:`patch`,patch:{dialogOpen:e}}),t[23]=L):L=t[23];let Me=L,R,z;t[24]!==n||t[25]!==v||t[26]!==y||t[27]!==g.loadFailed?(R=()=>{let e=e=>{if(e.detail?.extensionId!==n)return;let t=b.current;oe(n).then(e=>{t!==b.current||a.getState().baseUrl!==v||a.getState().conversationId!==y||(xe(e),A({type:`patch`,patch:{dialogOpen:!0,grantError:null}}))}).catch(()=>A({type:`patch`,patch:{grantError:g.loadFailed}}))};return window.addEventListener(`extension-review-permissions`,e),()=>window.removeEventListener(`extension-review-permissions`,e)},z=[n,v,y,g.loadFailed],t[24]=n,t[25]=v,t[26]=y,t[27]=g.loadFailed,t[28]=R,t[29]=z):(R=t[28],z=t[29]),(0,o.useEffect)(R,z);let B;t[30]!==i||t[31]!==n?(B=ue(n,i),t[30]=i,t[31]=n,t[32]=B):B=t[32];let Ne=B,V;t[33]!==j||t[34]!==n||t[35]!==u||t[36]!==f||t[37]!==p||t[38]!==_||t[39]!==k.grantRevision||t[40]!==k.grantedPermissions||t[41]!==k.localApp||t[42]!==k.manifestDigest?(V=()=>{if(!j)return;let e=Se.current;if(!e)return;k.localApp?_.registerIframe(n,e,k.grantedPermissions,k.manifestDigest??void 0,k.grantRevision,!0):_.registerIframe(n,e,k.grantedPermissions,k.manifestDigest??void 0);let t=_.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&u===void 0&&A({type:`patch`,patch:{dynamicHeight:Math.min(f,Math.max(p,t))}})});return()=>{t(),_.unregisterIframe(n)}},t[33]=j,t[34]=n,t[35]=u,t[36]=f,t[37]=p,t[38]=_,t[39]=k.grantRevision,t[40]=k.grantedPermissions,t[41]=k.localApp,t[42]=k.manifestDigest,t[43]=V):V=t[43];let H;t[44]!==j||t[45]!==n||t[46]!==u||t[47]!==f||t[48]!==p||t[49]!==N||t[50]!==_||t[51]!==k.grantRevision||t[52]!==k.grantedPermissions||t[53]!==k.localApp||t[54]!==k.manifestDigest?(H=[j,n,u,f,p,k.grantedPermissions,k.manifestDigest,k.grantRevision,k.localApp,_,N],t[44]=j,t[45]=n,t[46]=u,t[47]=f,t[48]=p,t[49]=N,t[50]=_,t[51]=k.grantRevision,t[52]=k.grantedPermissions,t[53]=k.localApp,t[54]=k.manifestDigest,t[55]=H):H=t[55],(0,o.useLayoutEffect)(V,H);let U,W;t[56]!==j||t[57]!==n||t[58]!==Ce||t[59]!==_?(U=()=>{if(!j)return;let e=ie(Ce);_.sendEvent(n,`theme.changed`,e)},W=[j,n,Ce,_],t[56]=j,t[57]=n,t[58]=Ce,t[59]=_,t[60]=U,t[61]=W):(U=t[60],W=t[61]),(0,o.useEffect)(U,W);let G;t[62]!==Ae||t[63]!==u?(G=u===void 0?{width:`100%`,height:Ae,border:`none`}:{width:`100%`,height:u,border:`none`},t[62]=Ae,t[63]=u,t[64]=G):G=t[64];let Pe=G,K;t[65]!==j||t[66]!==n||t[67]!==v||t[68]!==y||t[69]!==N||t[70]!==S?.manifestDigest||t[71]!==k.localApp||t[72]!==k.manifestDigest?(K=e=>{let t=S?.manifestDigest??k.manifestDigest;if(x.current||!t)return;x.current=!0;let r=b.current,i=()=>b.current===r&&a.getState().baseUrl===v&&a.getState().conversationId===y;(k.localApp?ce(n,t,e):ce(n,t)).then(e=>{if(i()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==t)throw Error(`Permission grant was not persisted`);xe(null),A({type:`patch`,patch:{allowed:!0,dialogOpen:!1,grantError:null,manifestDigest:e.manifestDigest,grantedPermissions:e.permissions,grantRevision:e.grantRevision,resourceScopes:e.resourceScopes,reloadKey:j?N+1:N}})}}).catch(e=>{i()&&A({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{i()&&(x.current=!1)})},t[65]=j,t[66]=n,t[67]=v,t[68]=y,t[69]=N,t[70]=S?.manifestDigest,t[71]=k.localApp,t[72]=k.manifestDigest,t[73]=K):K=t[73];let Fe=K,Ie=S?.permissions??k.grantedPermissions,Le=S?.resourceScopes??k.resourceScopes,Re=!(S?.manifestDigest??k.manifestDigest),q;t[74]!==M||t[75]!==we||t[76]!==n||t[77]!==P||t[78]!==Fe||t[79]!==Ie||t[80]!==Le||t[81]!==Re||t[82]!==k.localApp?(q=(0,c.jsx)(se,{open:M,onOpenChange:Me,extensionId:n,extensionName:we,permissions:Ie,localApp:k.localApp,resourceScopes:Le,error:P,confirmDisabled:Re,onConfirm:Fe}),t[74]=M,t[75]=we,t[76]=n,t[77]=P,t[78]=Fe,t[79]=Ie,t[80]=Le,t[81]=Re,t[82]=k.localApp,t[83]=q):q=t[83];let J=q;if(!je){let e=`${l??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[84]===e?n=t[85]:(n=(0,c.jsx)(`div`,{className:e}),t[84]=e,t[85]=n),n}if(!j){let e;t[86]!==l||t[87]!==M||t[88]!==P||t[89]!==N||t[90]!==g.deniedHint||t[91]!==g.reviewPermissions?(e=M?null:(0,c.jsxs)(`div`,{className:l?`${l} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[P?(0,c.jsx)(`p`,{className:`mb-2 text-danger`,children:P}):null,(0,c.jsx)(`p`,{children:g.deniedHint}),(0,c.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>A({type:`patch`,patch:{reloadKey:N+1}}),children:g.reviewPermissions})]}),t[86]=l,t[87]=M,t[88]=P,t[89]=N,t[90]=g.deniedHint,t[91]=g.reviewPermissions,t[92]=e):e=t[92];let n;return t[93]!==J||t[94]!==e?(n=(0,c.jsxs)(c.Fragment,{children:[J,e]}),t[93]=J,t[94]=e,t[95]=n):n=t[95],n}let Y;t[96]===P?Y=t[97]:(Y=P?(0,c.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:P}):null,t[96]=P,t[97]=Y);let X;t[98]!==ke||t[99]!==N||t[100]!==g.loadFailed||t[101]!==g.loadFailedConnectionHint||t[102]!==g.retryLoad?(X=ke?(0,c.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,c.jsx)(`p`,{children:g.loadFailed}),(0,c.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:g.loadFailedConnectionHint}),(0,c.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{A({type:`patch`,patch:{loadError:!1,reloadKey:N+1}})},children:g.retryLoad})]}):null,t[98]=ke,t[99]=N,t[100]=g.loadFailed,t[101]=g.loadFailedConnectionHint,t[102]=g.retryLoad,t[103]=X):X=t[103];let ze=`${n}-${i}-${N}`,Be=k.localApp?`allow-scripts`:pe,Z;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Z=()=>A({type:`patch`,patch:{loadError:!0}}),t[104]=Z):Z=t[104];let Q;t[105]!==n||t[106]!==d||t[107]!==m||t[108]!==_?(Q=()=>{A({type:`patch`,patch:{loadError:!1}}),_.sendInit(n,ie(ne.getState().resolved),m),d!==void 0&&_.sendEvent(n,`widget.data`,d)},t[105]=n,t[106]=d,t[107]=m,t[108]=_,t[109]=Q):Q=t[109];let $;t[110]!==l||t[111]!==Te||t[112]!==Ne||t[113]!==Pe||t[114]!==ze||t[115]!==Be||t[116]!==Q?($=(0,c.jsx)(`iframe`,{ref:Se,className:l,title:Te,src:Ne,style:Pe,sandbox:Be,referrerPolicy:`no-referrer`,onError:Z,onLoad:Q},ze),t[110]=l,t[111]=Te,t[112]=Ne,t[113]=Pe,t[114]=ze,t[115]=Be,t[116]=Q,t[117]=$):$=t[117];let Ve;return t[118]!==J||t[119]!==Y||t[120]!==X||t[121]!==$?(Ve=(0,c.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[J,Y,X,$]}),t[118]=J,t[119]=Y,t[120]=X,t[121]=$,t[122]=Ve):Ve=t[122],Ve}function he(e){return e.resolved}function ge(e){return e.conversationId}function _e(e){return e.baseUrl}function ve(e){return e.language}export{me as t};
@@ -1 +1 @@
1
- import{a as e,i as t}from"./locale-store-CQcW9_qA.js";async function n(n=``){let i=await e(t(`/api/marketplace${n.trim()?`?q=${encodeURIComponent(n.trim())}`:``}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!Array.isArray(a.extensions))throw Error(a.error??`Invalid response`);return a.extensions}async function r(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function i(n){let i=await e(t(`/api/marketplace/packages/${encodeURIComponent(n.trim())}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.id)throw Error(a.error??`Invalid response`);return a.payload}async function a(n){let i=await e(t(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.extensionId)throw Error(a.error??`Invalid response`);return a.payload}async function o(n){let i=await e(t(`/api/extensions/${encodeURIComponent(n.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:n.enabled})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error?.message??`Invalid response`);return a.payload}async function s(n){let i=await e(t(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:n})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error??`Invalid response`);return a.payload}export{s as a,o as i,i as n,a as r,n as t};
1
+ import{a as e,i as t}from"./locale-store-D3c8DIm-.js";async function n(n=``){let i=await e(t(`/api/marketplace${n.trim()?`?q=${encodeURIComponent(n.trim())}`:``}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!Array.isArray(a.extensions))throw Error(a.error??`Invalid response`);return a.extensions}async function r(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function i(n){let i=await e(t(`/api/marketplace/packages/${encodeURIComponent(n.trim())}`),{cache:`no-store`});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.id)throw Error(a.error??`Invalid response`);return a.payload}async function a(n){let i=await e(t(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload?.extensionId)throw Error(a.error??`Invalid response`);return a.payload}async function o(n){let i=await e(t(`/api/extensions/${encodeURIComponent(n.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:n.enabled})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error?.message??`Invalid response`);return a.payload}async function s(n){let i=await e(t(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:n})});if(!i.ok)throw Error(await r(i));let a=await i.json();if(!a.ok||!a.payload)throw Error(a.error??`Invalid response`);return a.payload}export{s as a,o as i,i as n,a as r,n as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,l as n,n as r,o as i}from"./locale-store-D3c8DIm-.js";import{p as a}from"./schemas-CCWMleym.js";import{s as o}from"./local-apps-CB-MZAaL.js";import{d as s,i as c,t as l}from"./session-manager-CyZHiuWY.js";import{t as u}from"./capabilities-BgBwcqvY.js";import{t as d}from"./activity-store-BKH-qNPt.js";import{i as f}from"./theme-store-D9pquJiM.js";var p=function(e){return e[e.PermissionDenied=4001]=`PermissionDenied`,e[e.InvalidRequest=4002]=`InvalidRequest`,e[e.MethodNotFound=4003]=`MethodNotFound`,e[e.InternalError=4004]=`InternalError`,e[e.Timeout=4005]=`Timeout`,e[e.ExtensionNotFound=4006]=`ExtensionNotFound`,e[e.RateLimited=4007]=`RateLimited`,e}({});async function m(e,t,n){let r=new l,i=await r.loadSessionAgentConfig(e);await r.loadSession(e),s(e,i),await new c().send(t,e,n,i.thinkingLevel)}var h=[`--color-surface-base`,`--color-surface-panel`,`--color-surface-hover`,`--color-fg`,`--color-fg-muted`,`--color-fg-subtle`,`--color-accent`,`--color-accent-hover`,`--color-accent-soft`,`--color-edge`,`--color-edge-subtle`,`--color-danger`,`--color-success`,`--color-warning`,`--radius-sm`,`--radius-lg`,`--radius-xl`];function g(e){let t=getComputedStyle(document.documentElement),n={};for(let e of h){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return{mode:e,tokens:n,fontFamily:t.getPropertyValue(`font-family`).trim(),fontFamilyMono:t.getPropertyValue(`--font-mono`).trim()}}var _={"ui.navigate":null,"ui.reviewPermissions":null,"agent.sendMessage":`agent.send`,"session.list":`session.read`,"session.navigate":`session.read`,"config.get":`config.read`,"config.set":`config.write`,"storage.get":`storage`,"storage.set":`storage`,"storage.remove":`storage`,"storage.keys":`storage`,"ui.notification":`notification`,"theme.get":`theme`},v=class{iframes=new Map;byContentWindow=new WeakMap;handlers=new Map;extensionPermissions=new Map;releaseBindings=new Map;requestBudgets=new Map;delegationControllers=new Map;unsubscribeGateway;eventSubscribers=new Map;agentStreamSubscriptions=new Map;boundListener=e=>{this.onWindowMessage(e)};constructor(){window.addEventListener(`message`,this.boundListener),this.unsubscribeGateway=n.subscribe((e,t)=>{if(e.baseUrl!==t.baseUrl||e.conversationId!==t.conversationId)for(let e of this.delegationControllers.values())e.abort()})}dispose(){this.unsubscribeGateway();for(let e of this.delegationControllers.values())e.abort();this.delegationControllers.clear(),window.removeEventListener(`message`,this.boundListener),this.iframes.clear(),this.handlers.clear(),this.extensionPermissions.clear(),this.releaseBindings.clear(),this.requestBudgets.clear(),this.eventSubscribers.clear(),this.agentStreamSubscriptions.clear()}registerIframe(e,t,r,i,a,o=!1,s){this.delegationControllers.get(e)?.abort(),this.delegationControllers.set(e,new AbortController);let c=this.iframes.get(e);if(c&&c!==t&&c.contentWindow&&this.byContentWindow.delete(c.contentWindow),this.iframes.set(e,t),this.extensionPermissions.set(e,new Set(r)),this.releaseBindings.delete(e),i){let t=n.getState();this.releaseBindings.set(e,{digest:i,grantRevision:a,previewSessionId:s,localApp:o,baseUrl:t.baseUrl,namespace:t.conversationId})}this.rememberIframeWindow(e,t)}unregisterIframe(e){this.delegationControllers.get(e)?.abort(),this.delegationControllers.delete(e);let t=this.iframes.get(e);this.sendEvent(e,`panel.dispose`),t?.contentWindow&&this.byContentWindow.delete(t.contentWindow),this.iframes.delete(e),this.extensionPermissions.delete(e),this.releaseBindings.delete(e),this.agentStreamSubscriptions.delete(e),this.requestBudgets.delete(e)}rememberIframeWindow(e,t){let n=t.contentWindow;n&&this.byContentWindow.set(n,{extensionId:e,iframe:t})}subscribeAgentStream(e,t){let n=this.agentStreamSubscriptions.get(e);n||(n=new Set,this.agentStreamSubscriptions.set(e,n)),n.add(t)}unsubscribeAgentStream(e,t){this.agentStreamSubscriptions.get(e)?.delete(t)}forwardAgentStreamEvent(e,t){for(let[n,r]of this.agentStreamSubscriptions)r.has(e)&&this.sendEvent(n,`agent.stream.${e}`,t)}broadcastExtensionEvent(e,t,n){if(this.releaseBindings.get(e)?.localApp)return;let r=t.startsWith(`ext.`)?t:`ext.${t}`;for(let[t]of this.iframes)t!==e&&!this.releaseBindings.get(t)?.localApp&&this.sendEvent(t,r,n)}handleExtensionEvent(e,t,n){if(t.startsWith(`ext.`)){let r=t.slice(4);this.broadcastExtensionEvent(e,r,n);return}if(t===`agent.subscribe`||t===`agent.unsubscribe`){if(!(this.extensionPermissions.get(e)??new Set).has(`agent.subscribe`))return;let{conversationId:r}=n??{};if(typeof r!=`string`||!r.trim())return;let i=r.trim();t===`agent.subscribe`?this.subscribeAgentStream(e,i):this.unsubscribeAgentStream(e,i)}}registerMethod(e,t){this.handlers.set(e,t)}getReleaseDigest(e){let t=this.releaseBindings.get(e),r=n.getState();if(!t||t.baseUrl!==r.baseUrl||t.namespace!==r.conversationId)throw Error(`Extension release authorization is unavailable`);return t.digest}getGrantRevision(e){return this.getReleaseDigest(e),this.releaseBindings.get(e)?.grantRevision}delegationSignal(e){this.getReleaseDigest(e);let t=this.delegationControllers.get(e);if(!t)throw Error(`Delegation frame unavailable`);return t.signal}storageHeaders(e){let t=this.getGrantRevision(e);return{"X-Xopc-Extension-Manifest":this.getReleaseDigest(e),...t?{"X-Xopc-Extension-Grant":t}:{}}}isPreview(e){return!!this.releaseBindings.get(e)?.previewSessionId}async previewRequest(e,n,r){this.getReleaseDigest(e);let a=this.releaseBindings.get(e)?.previewSessionId;if(!a)throw Error(`Preview session unavailable`);return(await i(t(`/api/local-app-previews/sessions/${encodeURIComponent(a)}/requests`),{method:`POST`,body:JSON.stringify({method:n,params:r})})).value}async whenIdle(e){let t=Date.now()+8e3;do{if(!this.iframes.has(e))throw Error(`Preview frame was replaced`);if(!this.requestBudgets.get(e)?.pending&&(await new Promise(e=>setTimeout(e,0)),!this.requestBudgets.get(e)?.pending))return;await new Promise(e=>setTimeout(e,20))}while(Date.now()<t);throw Error(`Preview initialization did not settle`)}async assertGrantCurrent(e){let n=this.releaseBindings.get(e);if(!n?.localApp)return;if(n.previewSessionId){let{session:e}=await i(t(`/api/local-app-previews/sessions/${encodeURIComponent(n.previewSessionId)}`));if(e.id!==n.previewSessionId||e.sourceHash!==n.digest)throw Error(`Preview authorization changed`);return}let{grant:r}=await i(t(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));if(!r.granted||r.manifestDigest!==n.digest||r.grantRevision!==n.grantRevision)throw Error(`Local app authorization changed; review permissions again`)}subscribeExtensionEvents(e,t){let n=this.eventSubscribers.get(e);return n||(n=new Set,this.eventSubscribers.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this.eventSubscribers.delete(e)}}sendInit(e,t,n){let r=this.iframes.get(e);if(!r?.contentWindow)return;this.rememberIframeWindow(e,r);let i=[...this.extensionPermissions.get(e)??[]];r.contentWindow.postMessage({source:`xopc-host`,type:`init`,extensionId:e,permissions:i,theme:t,locale:n},`*`)}sendEvent(e,t,n){let r=this.iframes.get(e);r?.contentWindow&&r.contentWindow.postMessage({source:`xopc-host`,type:`event`,event:t,data:n},`*`)}broadcastEvent(e,t){for(let[,n]of this.iframes)n.contentWindow?.postMessage({source:`xopc-host`,type:`event`,event:e,data:t},`*`)}postResponse(e,t,n,r,i){let a=e.contentWindow,o={source:`xopc-host`,type:`response`,requestId:n,result:r,error:i};!a||a!==t?.source||a.postMessage(o,`*`)}async onWindowMessage(e){let t=e.data;if(!t||t.source!==`xopc-extension`||!e.source)return;let i=this.byContentWindow.get(e.source);if(!i)return;let{iframe:a,extensionId:o}=i;if(this.iframes.get(o)!==a||a.contentWindow!==e.source)return;try{if(JSON.stringify(t).length>21e5)return}catch{return}let s=this.requestBudgets.get(o)??{start:Date.now(),count:0,pending:0};if(this.requestBudgets.set(o,s),Date.now()-s.start>6e4&&(s.start=Date.now(),s.count=0),++s.count>120||s.pending>=8)return;if(t.type===`event`){if(typeof t.event!=`string`||t.event.length>200)return;if(t.event===`ui.connect`){this.sendInit(o,g(f.getState().resolved),r.getState().language);return}if(this.releaseBindings.get(o)?.localApp&&t.event!==`ui.resize`)return;this.handleExtensionEvent(o,t.event,t.data);let e=this.eventSubscribers.get(o);if(e){let n={event:t.event,data:t.data};for(let t of e)try{t(n)}catch{}}return}if(t.type!==`request`)return;let{requestId:c,method:l,params:u}=t;if(typeof c!=`string`||c.length>200||typeof l!=`string`||l.length>200)return;let d=this.handlers.get(l);if(!d){this.postResponse(a,e,c,void 0,{code:p.MethodNotFound,message:`Unknown method: ${l}`});return}let m=u&&typeof u==`object`&&`id`in u?u.id:void 0,h=l===`capability.describe`||l===`capability.call`?`capability:${typeof m==`string`?m:``}`:_[l],v=this.extensionPermissions.get(o)??new Set;if(h===void 0||h&&!v.has(h)){this.postResponse(a,e,c,void 0,{code:p.PermissionDenied,message:`Missing permission: ${h}`});return}let y=n.getState(),b=()=>this.iframes.get(o)===a&&a.contentWindow===e.source&&this.extensionPermissions.get(o)===v&&n.getState().baseUrl===y.baseUrl&&n.getState().conversationId===y.conversationId;try{if(s.pending++,t.method!==`ui.reviewPermissions`&&await this.assertGrantCurrent(o),!b())return;let n=await d(o,u);if(t.method!==`ui.reviewPermissions`&&await this.assertGrantCurrent(o),!b())return;this.postResponse(a,e,c,n)}catch(t){if(!b())return;let n=t instanceof Error?t.message:String(t);this.postResponse(a,e,c,void 0,{code:p.InternalError,message:n})}finally{s.pending--}}};function y(n){let r=a({id:o.shape.id}),s=r.extend({call:u});n.registerMethod(`capability.describe`,async(e,a)=>{let{id:o}=r.parse(a);if(n.isPreview(e))return n.previewRequest(e,`capability.describe`,{id:o});let s=n.getReleaseDigest(e),c=n.getGrantRevision(e),l=(await i(t(`/api/local-app-capabilities/${encodeURIComponent(e)}?manifestDigest=${encodeURIComponent(s)}&grantRevision=${encodeURIComponent(c??``)}`))).capabilities.find(e=>e.id===o);if(!l)throw Error(`Capability is unavailable for this release`);return l}),n.registerMethod(`capability.call`,async(e,r)=>{let{id:a,call:o}=s.parse(r);if(n.isPreview(e))return n.previewRequest(e,`capability.call`,{id:a,call:o});let c=n.getReleaseDigest(e),l=n.getGrantRevision(e);return i(t(`/api/local-app-capabilities/${encodeURIComponent(e)}/${encodeURIComponent(a)}/invocations`),{method:`POST`,body:JSON.stringify({manifestDigest:c,grantRevision:l,call:o}),...a===`xopc.agent.delegate`?{signal:n.delegationSignal(e)}:{}})}),n.registerMethod(`theme.get`,async()=>g(f.getState().resolved)),n.registerMethod(`ui.navigate`,async(e,t)=>{if(n.isPreview(e))throw Error(`Host navigation is disabled in preview`);let r=t&&typeof t==`object`&&t&&`path`in t?String(t.path??``):``;if(r){let e=r.startsWith(`/`)?r:`/${r}`;window.location.hash=`#${e}`}}),n.registerMethod(`ui.reviewPermissions`,async e=>{if(n.isPreview(e))throw Error(`Permission review is unavailable in previews`);return n.getReleaseDigest(e),window.dispatchEvent(new CustomEvent(`extension-review-permissions`,{detail:{extensionId:e}})),{opened:!0}}),n.registerMethod(`ui.notification`,async(e,t)=>{if(n.isPreview(e)||!t||typeof t!=`object`)return;let r=t,i=typeof r.title==`string`?r.title.trim():``;i&&d({tone:r.type===`success`||r.type===`warning`||r.type===`error`||r.type===`info`?r.type:`info`,title:i,message:typeof r.message==`string`?r.message:void 0,source:e,dedupeKey:`extension:${e}:${i}`})}),n.registerMethod(`session.navigate`,async(e,t)=>{let n=t&&typeof t==`object`&&t&&`conversationId`in t?String(t.conversationId??``):``;n&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:n},bubbles:!0}))}),n.registerMethod(`session.list`,async()=>{let n=await e(t(`/api/sessions`));if(!n.ok)throw Error(`Failed to list sessions: ${n.status}`);return((await n.json()).items??[]).map(e=>({conversationId:e.key,title:e.name,lastMessageAt:e.updatedAt??e.lastAccessedAt,messageCount:e.messageCount}))}),n.registerMethod(`agent.sendMessage`,async(e,t)=>{let{message:n,conversationId:r,newSession:i}=t,a=r?.trim()||``;return(i||!a)&&(a=(await new l().createSession()).key),await m(a,n),{conversationId:a}}),n.registerMethod(`config.get`,async n=>{let r=await e(t(`/api/extensions/${encodeURIComponent(n)}/config`));if(!r.ok)throw Error(`Failed to get config: ${r.status}`);return r.json()}),n.registerMethod(`config.set`,async(n,r)=>{let i=r&&typeof r==`object`&&r&&!Array.isArray(r)?r:{},a=await e(t(`/api/extensions/${encodeURIComponent(n)}/config`),{method:`PATCH`,body:JSON.stringify(i)});if(!a.ok)throw Error(`Failed to set config: ${a.status}`)}),n.registerMethod(`storage.get`,async(r,i)=>{if(n.isPreview(r))return n.previewRequest(r,`storage.get`,i);let a=i&&typeof i==`object`&&i&&`key`in i?String(i.key??``):``,o=await e(t(`/api/extensions/${encodeURIComponent(r)}/storage/${encodeURIComponent(a)}`),{headers:n.storageHeaders(r)});if(o.status!==404){if(!o.ok)throw Error(`Failed to get storage key: ${o.status}`);return(await o.json()).value}}),n.registerMethod(`storage.set`,async(r,i)=>{if(n.isPreview(r))return n.previewRequest(r,`storage.set`,i);let a=i,o=a&&typeof a.key==`string`?a.key:``,s=await e(t(`/api/extensions/${encodeURIComponent(r)}/storage/${encodeURIComponent(o)}`),{method:`PUT`,headers:n.storageHeaders(r),body:JSON.stringify({value:a?.value})});if(!s.ok)throw Error(`Failed to set storage key: ${s.status}`)}),n.registerMethod(`storage.remove`,async(r,i)=>{if(n.isPreview(r))return n.previewRequest(r,`storage.remove`,i);let a=i&&typeof i==`object`&&i&&`key`in i?String(i.key??``):``,o=await e(t(`/api/extensions/${encodeURIComponent(r)}/storage/${encodeURIComponent(a)}`),{method:`DELETE`,headers:n.storageHeaders(r)});if(o.status!==404&&!o.ok)throw Error(`Failed to remove storage key: ${o.status}`)}),n.registerMethod(`storage.keys`,async r=>{if(n.isPreview(r))return n.previewRequest(r,`storage.keys`);let i=await e(t(`/api/extensions/${encodeURIComponent(r)}/storage`),{headers:n.storageHeaders(r)});if(!i.ok)throw Error(`Failed to list storage keys: ${i.status}`);return(await i.json()).keys??[]})}export{m as i,y as n,g as r,v as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-B_S1dFze.js";import{t as o}from"./page-header-store-Xe8CP_4a.js";import{r as s,s as c}from"./extension-provider-DUDaMvQg.js";import{t as l}from"./extension-iframe-host-D0-OvFV2.js";var u=n(),d=e(t(),1),f=r();function p(){let e=(0,u.c)(24),{extensionId:t,pageId:n}=i(),r=s(),p=o(h),g=o(m),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&c(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==p?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return p({startExtra:null,main:(0,f.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,f.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,p],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=p,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,d.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[13]=t):t=e[13],t}if(!_){let n=r.some(e=>e.id===t)?`plugin-page`:`plugin`,i;return e[14]===n?i=e[15]:(i=(0,f.jsx)(a,{kind:n,backTo:`/capabilities/extensions`}),e[14]=n,e[15]=i),i}if(!v?.length){let t;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin-page`,backTo:`/capabilities/extensions`}),e[16]=t):t=e[16],t}if(!b){let t;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[17]=t):t=e[17],t}let C=_.ui?.permissions,w;return e[18]!==_.name||e[19]!==t||e[20]!==b.entrypoint||e[21]!==b.title||e[22]!==C?(w=(0,f.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,f.jsx)(l,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[18]=_.name,e[19]=t,e[20]=b.entrypoint,e[21]=b.title,e[22]=C,e[23]=w):w=e[23],w}function m(e){return e.clearPageHeader}function h(e){return e.setPageHeader}export{p as ExtensionPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,o as s}from"./locale-store-D3c8DIm-.js";import{i as c}from"./vendor-swr-CdRzEUwF.js";import{a as l}from"./gateway-realtime-CIqLQXlm.js";import{i as u}from"./theme-store-D9pquJiM.js";import{n as d,r as f,t as p}from"./extension-message-router-DboLTCVp.js";var m=e(t(),1),h=n(),g=`agent-stream-event`;function _(e){return e===`off`||e===`on`||e===`stream`}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.conversationId==`string`?t.conversationId.trim():``,r=typeof t.runId==`string`?t.runId.trim():``;return n&&r?{conversationId:n,runId:r}:null}function y(e,t,n){return t&&typeof t==`object`&&!Array.isArray(t)?{...t,seq:n}:{type:e,seq:n,payload:t}}async function b(e){try{let t=await i(a(`/api/sessions/${encodeURIComponent(e)}/agent-config`));if(!t.ok)return`on`;let n=await t.json(),r=n.payload?.activityDetail?.effective;if(_(r))return r;let o=n.payload?.activityDetail?.default;return _(o)?o:`on`}catch{return`on`}}function x(e){window.dispatchEvent(new CustomEvent(g,{detail:e}))}function S(e={}){let t=e.subscribe??l,n=e.loadActivityDetailLevel??b,r=e.dispatch??x,i=new Map,a=!1,o=e=>{let o=v(e.detail);if(!o||i.has(o.runId))return;let s=`on`,c=!1,l,u=!1,d=!1,f=()=>{},p=()=>{u||(u=!0,f(),i.get(o.runId)===p&&i.delete(o.runId))},m=e=>{a||u||r({conversationId:o.conversationId,event:e,activityDetailLevel:s})};n(o.conversationId).then(e=>{s=e,c=!0,e===`stream`&&l&&!d&&m(l),l=void 0}),f=t(`run:${o.runId}`,{onEvent:e=>{if(u||d)return;let t=y(e.event,e.data,e.seq);e.event===`thinking_delta`&&!c?l=t:m(t),e.event===`run_end`&&(d=!0,l=void 0,queueMicrotask(p))},onGap:e=>{e.recoverable||p()}},0),i.set(o.runId,p)},s=e=>{let t=v(e.detail);t&&i.get(t.runId)?.()};return window.addEventListener(`run-started`,o),window.addEventListener(`run-completed`,s),window.addEventListener(`agent-run-ended`,s),()=>{a=!0,window.removeEventListener(`run-started`,o),window.removeEventListener(`run-completed`,s),window.removeEventListener(`agent-run-ended`,s);for(let e of[...i.values()])e()}}function C(e){return e.active||e.activationEligible===!0}function w(e){let t=e.ui?.contributions;return t?Array.isArray(t.pages)&&t.pages.length>0||Array.isArray(t.settingsPanels)&&t.settingsPanels.length>0||Array.isArray(t.chatWidgets)&&t.chatWidgets.length>0:!1}function T(e){return e.source===`bundled`&&e.hasUi===!0&&w(e)}function E(e){return e.kind===`image-generation`||e.kind===`media-provider`}function D(e){return C(e)?e.hasConfigSchema||E(e)?!0:e.hasUi?w(e):!1:!1}function O(e){return D(e)||T(e)}var k=r(),A=(0,m.createContext)(null);function j({children:e}){let t=(0,m.useRef)(null);if(!t.current){let e=new p;d(e),t.current=e}let n=t.current,{data:r,isLoading:i,mutate:l}=c(o(e=>!!e.conversationId)?`gateway-extensions-list`:null,()=>s(a(`/api/extensions`)),{revalidateOnFocus:!1}),h=r?.extensions??[],_=u(e=>e.resolved);(0,m.useEffect)(()=>{let e=()=>{l()};return window.addEventListener(`config-reload`,e),window.addEventListener(`registry-updated`,e),()=>{window.removeEventListener(`config-reload`,e),window.removeEventListener(`registry-updated`,e)}},[l]);let v=(0,m.useCallback)(e=>{let t=e.detail;t?.conversationId&&n.forwardAgentStreamEvent(t.conversationId,t.event??t)},[n]),y=(0,m.useRef)(v);y.current=v,(0,m.useEffect)(()=>{let e=e=>{y.current(e)};return window.addEventListener(g,e),()=>{window.removeEventListener(g,e)}},[]),(0,m.useEffect)(()=>{let e=f(_);n.broadcastEvent(`theme.changed`,e)},[_,n]);let b=(0,m.useRef)(n);b.current=n,(0,m.useEffect)(()=>()=>{b.current.dispose(),t.current=null},[]);let x=(0,m.useMemo)(()=>({router:n,extensions:h,loading:i}),[n,h,i]);return(0,k.jsx)(A.Provider,{value:x,children:e})}function M(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionRouter must be used within ExtensionProvider`);return e.router}function N(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensions must be used within ExtensionProvider`);return e.extensions}function P(){let e=(0,h.c)(2),t=N(),n;return e[0]===t?n=e[1]:(n=t.filter(D),e[0]=t,e[1]=n),n}function F(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionsLoading must be used within ExtensionProvider`);return e.loading}export{P as a,g as c,F as i,S as l,M as n,E as o,N as r,O as s,j as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-CQcW9_qA.js";import{t as d}from"./messages-orB1BMgI.js";import{t as f}from"./resource-unavailable-CAljzZx8.js";import{n as p,r as m}from"./popover-select-CLsphyzA.js";import{t as h}from"./cn-0WouolD0.js";import{r as g}from"./extension-provider-DUzhV5_a.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{t as v}from"./button-Cc4hUNTt.js";import{a as y,o as b,s as x}from"./form-field-width-DJw_jULe.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-pbU7DAfE.js";import{t as w}from"./settings-loading-skeleton-CAoOV17i.js";import{n as T,t as E}from"./settings-page-header-CheboxIM.js";import"./settings-page-layout-CPFMZaLF.js";import{n as D,t as O}from"./use-autosave-CB2B4NMO.js";import{a as k,c as A,o as j}from"./voice-config-api-yBcUSvvn.js";import{t as M}from"./voice-api-key-field-C8wd8ijq.js";import{t as N}from"./schema-form-CtRM41Re.js";var P=e(t(),1),F=n(),I=r();function L(e){let t=(0,F.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,I.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(b,y)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,x,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=_(s(`/api/voice/stt-providers`),j,{revalidateOnFocus:!1}),u=(0,P.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,g=u?.models??[],v=g[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,P.useMemo)(()=>V(t,e,v),[v,e,t]),x=(0,P.useRef)(!1),[C,w]=(0,P.useState)(null),T=C??b,E=(0,P.useRef)(T);E.current=T;let k=b,N=O({value:T,dirty:T.apiKey!==k.apiKey||T.model!==k.model,onSave:(0,P.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await A(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),F=g.length>0?[...g].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:N.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:N.status,error:N.error}),(0,I.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,y),children:[(0,I.jsx)(L,{children:i.stt.apiKey}),(0,I.jsx)(M,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,y),children:[(0,I.jsx)(L,{children:i.stt.model}),F.length>0?(0,I.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),N.saveNow({...T,model:e.target.value})},children:F.map(e=>(0,I.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,I.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,F.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=_(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:g,isLoading:v}=_(i?`voice-settings-ext-stt`:null,k,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,I.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==g||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,I.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:g},y),t[8]=g,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=_(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=_(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,P.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,P.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,P.useReducer)(J,{localValues:{},isDirty:!1}),g=(0,P.useRef)(!1),y=(0,P.useRef)(m.localValues);y.current=m.localValues;let b=(0,P.useRef)(p);!g.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,P.useCallback)(e=>{g.current=!0,h({type:`change`,value:e})},[]),S=(0,P.useCallback)(()=>{!d||d.type!==`object`||(g.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,P.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),g.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,I.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:w.status,error:w.error}),(0,I.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,I.jsx)(N,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,F.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=g();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,_=!!(h&&u.ui),v=!!u.hasConfigSchema,y=u.kind===`media-provider`;if(!v&&!_&&!y){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let b=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),x;e[13]===b?x=e[14]:(x=(0,I.jsx)(E,{title:b}),e[13]=b,e[14]=x);let S;e[15]!==y||e[16]!==r?(S=y?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,I.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=y,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==y?(w=y?(0,I.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=y,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==v?(D=v?(0,I.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=v,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==_||e[28]!==h?(O=_&&h&&u.ui?(0,I.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,I.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=_,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==x||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,I.jsxs)(T,{gap:`gap-5`,children:[x,S,w,D,O]}),e[30]=x,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-D3c8DIm-.js";import{t as d}from"./messages-DPLud9GK.js";import{t as f}from"./resource-unavailable-B_S1dFze.js";import{n as p,r as m}from"./popover-select-CLsphyzA.js";import{t as h}from"./cn-0WouolD0.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-Cc4hUNTt.js";import{a as v,o as y,s as b}from"./form-field-width-DJw_jULe.js";import{r as x}from"./extension-provider-DUDaMvQg.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-D0-OvFV2.js";import{t as w}from"./settings-loading-skeleton-CAoOV17i.js";import{n as T,t as E}from"./settings-page-header-19GJ_a45.js";import"./settings-page-layout-B2WCzSel.js";import{n as D,t as O}from"./use-autosave-BtOp6W9H.js";import{c as k,s as A,u as j}from"./voice-config-api-CrZd2aqw.js";import{t as M}from"./voice-api-key-field-8voN8dQG.js";import{t as N}from"./schema-form-C9TYGa0_.js";var P=e(t(),1),F=n(),I=r();function L(e){let t=(0,F.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,I.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(y,v)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=g(s(`/api/voice/stt-providers`),k,{revalidateOnFocus:!1}),u=(0,P.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,_=u?.models??[],y=_[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,P.useMemo)(()=>V(t,e,y),[y,e,t]),x=(0,P.useRef)(!1),[C,w]=(0,P.useState)(null),T=C??b,E=(0,P.useRef)(T);E.current=T;let A=b,N=O({value:T,dirty:T.apiKey!==A.apiKey||T.model!==A.model,onSave:(0,P.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await j(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),F=_.length>0?[..._].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:N.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:N.status,error:N.error}),(0,I.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,I.jsx)(L,{children:i.stt.apiKey}),(0,I.jsx)(M,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,I.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,I.jsx)(L,{children:i.stt.model}),F.length>0?(0,I.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),N.saveNow({...T,model:e.target.value})},children:F.map(e=>(0,I.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,I.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,F.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=g(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:_,isLoading:v}=g(i?`voice-settings-ext-stt`:null,A,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,I.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==_||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,I.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:_},y),t[8]=_,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=g(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=g(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,P.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,P.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,P.useReducer)(J,{localValues:{},isDirty:!1}),v=(0,P.useRef)(!1),y=(0,P.useRef)(m.localValues);y.current=m.localValues;let b=(0,P.useRef)(p);!v.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,P.useCallback)(e=>{v.current=!0,h({type:`change`,value:e})},[]),S=(0,P.useCallback)(()=>{!d||d.type!==`object`||(v.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,P.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,I.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(D,{status:w.status,error:w.error}),(0,I.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,I.jsx)(N,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,F.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=x();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,g=!!(h&&u.ui),_=!!u.hasConfigSchema,v=u.kind===`media-provider`;if(!_&&!g&&!v){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let y=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),b;e[13]===y?b=e[14]:(b=(0,I.jsx)(E,{title:y}),e[13]=y,e[14]=b);let S;e[15]!==v||e[16]!==r?(S=v?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,I.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=v,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==v?(w=v?(0,I.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=v,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==_?(D=_?(0,I.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=_,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==g||e[28]!==h?(O=g&&h&&u.ui?(0,I.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,I.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=g,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==b||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,I.jsxs)(T,{gap:`gap-5`,children:[b,S,w,D,O]}),e[30]=b,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,p as a}from"./locale-store-CQcW9_qA.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./phone-workspace-store-DAuPd2ie.js";import{n as c}from"./electron-env-DHOGevH3.js";import{a as l}from"./shares-api-iiw4F-ra.js";var u=`xopc:right-workspace:v1`,d={open:!1,tabs:[],activeId:null},f={panes:{},width:0,treeWidth:240,fileTreeOpen:!1,sideTreeOpen:!1};function p(){try{let e=JSON.parse(sessionStorage.getItem(u)||`null`);if(!e||e.version!==1||typeof e.panes!=`object`||!e.panes||e.identity!==i.getState().conversationId||e.gateway!==i.getState().baseUrl)return f;let t={};for(let[n,r]of Object.entries(e.panes)){let e=r;if(!e||!Array.isArray(e.tabs))continue;let i=e.tabs.filter(e=>e&&typeof e.id==`string`&&typeof e.title==`string`&&(e.kind===`file`&&typeof e.path==`string`||e.kind===`sidechat`&&typeof e.sideChatId==`string`||e.kind===`home`||e.kind===`files`));t[n]={open:e.open===!0&&i.length>0,tabs:i,activeId:i.some(t=>t.id===e.activeId)?e.activeId:i[0]?.id??null}}return{...f,panes:t}}catch{return f}}function m(e,t){try{let n=Number(localStorage.getItem(e));return n>0&&Number.isFinite(n)?n:t}catch{return t}}function h(e){try{let t=Object.fromEntries(Object.entries(e.panes).map(([e,t])=>[e,{...t,tabs:t.tabs.filter(e=>e.kind!==`browser`&&(e.kind!==`file`||!e.attachment)).map(e=>({...e}))}]));sessionStorage.setItem(u,JSON.stringify({version:1,identity:i.getState().conversationId,gateway:i.getState().baseUrl,panes:t}))}catch{}}var g=new WeakMap;function _(e){return e?e.id||e.uri?e.id||e.uri:(g.has(e)||g.set(e,crypto.randomUUID()),g.get(e)):``}function v(e){return e.replace(/\\/g,`/`).split(`/`).filter(e=>e!==`.`).join(`/`)}function y(e){let t=e.projectId?`project:${e.projectId}`:e.conversationId?`session:${e.conversationId}`:`agent:${e.agentId??``}`;return JSON.stringify([t,e.path?v(e.path):_(e.attachment)])}var b=a((e,t)=>{let n=(n,r)=>{e(e=>({panes:{...e.panes,[n]:r(e.panes[n]??d)}})),h(t())};return{...p(),width:m(`xopc:workspace-width`,0),treeWidth:m(`xopc:workspace-tree-width`,240),notices:{},setNotice:(t,n)=>e(e=>({notices:{...e.notices,[t]:n}})),fileStatus:{},setFileStatus:(n,r)=>{r&&t().keepFileOpen(n),e(e=>({fileStatus:{...e.fileStatus,[n]:r??``}}))},keepFileOpen:e=>{for(let[r,i]of Object.entries(t().panes))i.tabs.some(t=>t.id===e&&t.kind===`file`&&t.preview)&&n(r,t=>({...t,tabs:t.tabs.map(t=>t.id===e?{...t,preview:!1}:t)}))},scope:`new`,setScope:t=>e({scope:t}),migrateScope:(n,r)=>{let i=t().panes[n];if(!i||n===r)return;let a=t().panes[r]??d,o={...t().panes,[r]:{open:i.open||a.open,tabs:[...a.tabs,...i.tabs.filter(e=>!a.tabs.some(t=>t.id===e.id))],activeId:i.activeId??a.activeId}};delete o[n],e({panes:o,scope:t().scope===n?r:t().scope}),h(t())},openPhone:(e,t,r,i=!0,a=!0)=>{let o=`phone:${e}`;n(r,n=>({open:i||n.open,activeId:i?o:n.activeId,tabs:n.tabs.some(e=>e.id===o)?n.tabs.map(e=>e.id===o?{...e,title:t}:e):[...n.tabs,{id:o,kind:`phone`,phoneSessionId:e,title:t,visitedAt:Date.now()}]})),a&&s.getState().show(e,i,/^[\da-f]{8}-[\da-f-]{27}$/i.test(r)?r:void 0)},openTools:(e=t().scope)=>{let r=crypto.randomUUID();return n(e,e=>{let t=[...e.tabs];return t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,{id:r,kind:`home`,title:`New tab`,visitedAt:Date.now()}),{open:!0,tabs:t,activeId:r}}),r},openBrowser:(e,r=t().scope,i)=>{let a=t().panes[r]??d,o=a.tabs.find(e=>e.id===a.activeId&&e.kind===`home`)?.id??crypto.randomUUID(),s={id:o,kind:`browser`,title:`Browser`,initialUrl:e,visitedAt:Date.now(),returnTo:i??a.activeId??void 0};return n(r,e=>{let t=[...e.tabs],n=t.findIndex(e=>e.id===o);return n>=0?t[n]=s:t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,s),{open:!0,activeId:o,tabs:t}}),o},updateBrowserTitle:(e,r)=>{for(let[i,a]of Object.entries(t().panes))a.tabs.some(t=>t.id===e&&t.kind===`browser`&&t.title!==r)&&n(i,t=>({...t,tabs:t.tabs.map(t=>t.id===e?{...t,title:r.slice(0,200)}:t)}))},openFiles:(e=t().scope)=>{let r=t().panes[e]??d,i=r.tabs.find(e=>e.kind===`files`);if(i){t().activate(i.id,e);return}let a=r.tabs.find(e=>e.id===r.activeId&&e.kind===`home`),o=a?.id??crypto.randomUUID();n(e,e=>({open:!0,activeId:o,tabs:a?e.tabs.map(e=>e.id===o?{...e,kind:`files`,title:`Files`}:e):[...e.tabs,{id:o,kind:`files`,title:`Files`,visitedAt:Date.now()}]}))},setOpen:(e,r=t().scope)=>{if(e&&!t().panes[r]?.tabs.length){t().openTools(r);return}n(r,t=>({...t,open:e,activeId:t.activeId??t.tabs[0]?.id??null}))},activate:(e,r=t().scope)=>{let i=t().panes[r]?.tabs.find(t=>t.id===e);i?.kind===`phone`&&(s.getState().setDisplayMode(`docked`),s.getState().show(i.phoneSessionId,!0,/^[\da-f]{8}-[\da-f-]{27}$/i.test(r)?r:void 0)),n(r,t=>({...t,open:!!(e&&t.tabs.some(t=>t.id===e)),activeId:e&&t.tabs.some(t=>t.id===e)?e:t.activeId,tabs:t.tabs.map(t=>t.id===e?{...t,visitedAt:Date.now()}:t)}))},openFile:(e,r=t().scope)=>{let i=t().panes[r]??d,a=i.tabs.find(t=>t.kind===`file`&&(y(t)===y(e)||t.aliases?.includes(y(e)))),o=!a&&e.preview!==!1?i.tabs.find(e=>e.kind===`file`&&e.preview&&!t().fileStatus[e.id]):void 0,s=a?.id??crypto.randomUUID(),c={...a?.kind===`file`?a:{},...e,preview:a?.kind===`file`?a.preview===!0:e.preview!==!1,id:s,kind:`file`,title:e.path?.replace(/\\/g,`/`).split(`/`).pop()||e.attachment?.name||`File`,visitedAt:Date.now(),returnTo:a?.returnTo??(o?o.returnTo:i.activeId??void 0)};return n(r,e=>{let t=[...e.tabs],n=t.findIndex(e=>e.id===s);return n>=0?t[n]=c:o?t[t.findIndex(e=>e.id===o.id)]=c:t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,c),{open:!0,tabs:t,activeId:s}}),s},addSideChat:(e,t,r,i=!0)=>n(r,n=>{let r=`side:${e}`;if(n.tabs.some(e=>e.id===r))return i?{...n,open:!0,activeId:r}:n;let a=i?n.tabs.findIndex(e=>e.id===n.activeId&&e.kind===`home`):-1,o=[...n.tabs];return a>=0&&o.splice(a,1),o.splice(a>=0?a:Math.max(0,o.findIndex(e=>e.id===n.activeId)+1),0,{id:r,kind:`sidechat`,sideChatId:e,title:t,visitedAt:Date.now()}),{tabs:o,activeId:i?r:n.activeId,open:i||n.open}}),resolveFileIdentity:(e,r)=>{for(let[i,a]of Object.entries(t().panes)){let o=a.tabs.find(t=>t.kind===`file`&&t.id===e);if(!o||o.resourceId===r)continue;let s=a.tabs.find(t=>t.kind===`file`&&t.id!==e&&t.resourceId===r);n(i,n=>!s||t().fileStatus[e]?{...n,tabs:n.tabs.map(t=>t.id===e?{...t,resourceId:r}:t)}:{...n,activeId:n.activeId===e?s.id:n.activeId,tabs:n.tabs.filter(t=>t.id!==e).map(e=>e.id===s.id?{...s,preview:s.preview===!0&&o.preview===!0,aliases:[...new Set([...s.aliases??[],y(o)])],line:o.line??s.line}:e)})}},replaceSideChat:(e,t,r)=>n(r,n=>({...n,activeId:n.activeId===`side:${e}`?`side:${t}`:n.activeId,tabs:n.tabs.map(n=>n.id===`side:${e}`?{...n,id:`side:${t}`,kind:`sidechat`,sideChatId:t}:n)})),remove:(e,r=t().scope)=>n(r,t=>{let n=t.tabs.find(t=>t.id===e),r=t.tabs.filter(t=>t.id!==e),i=r.find(e=>e.id===n?.returnTo)??[...r].sort((e,t)=>t.visitedAt-e.visitedAt)[0];return{...t,open:t.open&&r.length>0,tabs:r,activeId:t.activeId===e?i?.id??null:t.activeId}}),setWidth:t=>{e({width:t});try{localStorage.setItem(`xopc:workspace-width`,String(t))}catch{}},setTreeWidth:n=>{e({treeWidth:Math.max(200,Math.min(320,n))});try{localStorage.setItem(`xopc:workspace-tree-width`,String(t().treeWidth))}catch{}},setTreeOpen:(t,n)=>e(t===`file`?{fileTreeOpen:n}:{sideTreeOpen:n}),reset:()=>{e({panes:{},fileStatus:{},notices:{},scope:`new`}),h(t())}}});i.subscribe((e,t)=>{e.baseUrl!==t.baseUrl||t.conversationId!==void 0&&e.conversationId!==t.conversationId?b.getState().reset():e.conversationId&&!t.conversationId&&b.setState({panes:p().panes})});var x=e(t(),1);function S(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(null),[c,u]=(0,x.useState)(null),d=(0,x.useCallback)(e=>{t(!0),u(e),a(null),s(null)},[]),f=(0,x.useCallback)(async e=>{if(!c||n)return null;r(!0),s(null);try{let t=await l({...c,...e});return a(t.payload),t.payload}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),null}finally{r(!1)}},[n,c]),p=(0,x.useCallback)(()=>{a(null),s(null),r(!1),u(null)},[]);return{dialogOpen:e,loading:n,result:i,error:o,pendingParams:c,createShareLink:d,confirmShareLink:f,handleOpenChange:(0,x.useCallback)(e=>{t(e),e||p()},[p])}}var C=e(n(),1);function w(){return c()&&window.electronAPI?.platform===`darwin`}function T(){return c()&&window.electronAPI?.platform===`win32`}function E(){return T()?`windows-preview-viewport`:``}var D=r();function O({expanded:e,children:t}){let n=(0,x.useRef)(null),r=e?n.current?.closest(`.app-main-surface`)??document.querySelector(`.app-main-surface`):null,i=(0,D.jsx)(`div`,{"data-file-preview-expanded":e||void 0,"data-browser-occluder":e||void 0,className:o(`file-preview-surface flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden [&_.markdown-body_h1]:border-b-0! [&_.markdown-body_h2]:border-b-0!`,e&&(r?`absolute inset-0 z-[115]`:`fixed inset-0 z-[115] h-[100dvh] w-screen`),e&&!r&&E()),children:t});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{ref:n,hidden:!0,"aria-hidden":!0}),e?(0,C.createPortal)(i,r??document.body):i]})}export{S as a,T as i,E as n,d as o,w as r,b as s,O as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,p as a}from"./locale-store-D3c8DIm-.js";import{t as o}from"./cn-0WouolD0.js";import{t as s}from"./phone-workspace-store-ReUEjG9m.js";import{n as c}from"./electron-env-DHOGevH3.js";import{a as l}from"./shares-api-CepTFl1f.js";var u=`xopc:right-workspace:v1`,d={open:!1,tabs:[],activeId:null},f={panes:{},width:0,treeWidth:240,fileTreeOpen:!1,sideTreeOpen:!1};function p(){try{let e=JSON.parse(sessionStorage.getItem(u)||`null`);if(!e||e.version!==1||typeof e.panes!=`object`||!e.panes||e.identity!==i.getState().conversationId||e.gateway!==i.getState().baseUrl)return f;let t={};for(let[n,r]of Object.entries(e.panes)){let e=r;if(!e||!Array.isArray(e.tabs))continue;let i=e.tabs.filter(e=>e&&typeof e.id==`string`&&typeof e.title==`string`&&(e.kind===`file`&&typeof e.path==`string`||e.kind===`sidechat`&&typeof e.sideChatId==`string`||e.kind===`home`||e.kind===`files`));t[n]={open:e.open===!0&&i.length>0,tabs:i,activeId:i.some(t=>t.id===e.activeId)?e.activeId:i[0]?.id??null}}return{...f,panes:t}}catch{return f}}function m(e,t){try{let n=Number(localStorage.getItem(e));return n>0&&Number.isFinite(n)?n:t}catch{return t}}function h(e){try{let t=Object.fromEntries(Object.entries(e.panes).map(([e,t])=>[e,{...t,tabs:t.tabs.filter(e=>e.kind!==`browser`&&(e.kind!==`file`||!e.attachment)).map(e=>({...e}))}]));sessionStorage.setItem(u,JSON.stringify({version:1,identity:i.getState().conversationId,gateway:i.getState().baseUrl,panes:t}))}catch{}}var g=new WeakMap;function _(e){return e?e.id||e.uri?e.id||e.uri:(g.has(e)||g.set(e,crypto.randomUUID()),g.get(e)):``}function v(e){return e.replace(/\\/g,`/`).split(`/`).filter(e=>e!==`.`).join(`/`)}function y(e){let t=e.projectId?`project:${e.projectId}`:e.conversationId?`session:${e.conversationId}`:`agent:${e.agentId??``}`;return JSON.stringify([t,e.path?v(e.path):_(e.attachment)])}var b=a((e,t)=>{let n=(n,r)=>{e(e=>({panes:{...e.panes,[n]:r(e.panes[n]??d)}})),h(t())};return{...p(),width:m(`xopc:workspace-width`,0),treeWidth:m(`xopc:workspace-tree-width`,240),notices:{},setNotice:(t,n)=>e(e=>({notices:{...e.notices,[t]:n}})),fileStatus:{},setFileStatus:(n,r)=>{r&&t().keepFileOpen(n),e(e=>({fileStatus:{...e.fileStatus,[n]:r??``}}))},keepFileOpen:e=>{for(let[r,i]of Object.entries(t().panes))i.tabs.some(t=>t.id===e&&t.kind===`file`&&t.preview)&&n(r,t=>({...t,tabs:t.tabs.map(t=>t.id===e?{...t,preview:!1}:t)}))},scope:`new`,setScope:t=>e({scope:t}),migrateScope:(n,r)=>{let i=t().panes[n];if(!i||n===r)return;let a=t().panes[r]??d,o={...t().panes,[r]:{open:i.open||a.open,tabs:[...a.tabs,...i.tabs.filter(e=>!a.tabs.some(t=>t.id===e.id))],activeId:i.activeId??a.activeId}};delete o[n],e({panes:o,scope:t().scope===n?r:t().scope}),h(t())},openPhone:(e,t,r,i=!0,a=!0)=>{let o=`phone:${e}`;n(r,n=>({open:i||n.open,activeId:i?o:n.activeId,tabs:n.tabs.some(e=>e.id===o)?n.tabs.map(e=>e.id===o?{...e,title:t}:e):[...n.tabs,{id:o,kind:`phone`,phoneSessionId:e,title:t,visitedAt:Date.now()}]})),a&&s.getState().show(e,i,/^[\da-f]{8}-[\da-f-]{27}$/i.test(r)?r:void 0)},openTools:(e=t().scope)=>{let r=crypto.randomUUID();return n(e,e=>{let t=[...e.tabs];return t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,{id:r,kind:`home`,title:`New tab`,visitedAt:Date.now()}),{open:!0,tabs:t,activeId:r}}),r},openBrowser:(e,r=t().scope,i)=>{let a=t().panes[r]??d,o=a.tabs.find(e=>e.id===a.activeId&&e.kind===`home`)?.id??crypto.randomUUID(),s={id:o,kind:`browser`,title:`Browser`,initialUrl:e,visitedAt:Date.now(),returnTo:i??a.activeId??void 0};return n(r,e=>{let t=[...e.tabs],n=t.findIndex(e=>e.id===o);return n>=0?t[n]=s:t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,s),{open:!0,activeId:o,tabs:t}}),o},updateBrowserTitle:(e,r)=>{for(let[i,a]of Object.entries(t().panes))a.tabs.some(t=>t.id===e&&t.kind===`browser`&&t.title!==r)&&n(i,t=>({...t,tabs:t.tabs.map(t=>t.id===e?{...t,title:r.slice(0,200)}:t)}))},openFiles:(e=t().scope)=>{let r=t().panes[e]??d,i=r.tabs.find(e=>e.kind===`files`);if(i){t().activate(i.id,e);return}let a=r.tabs.find(e=>e.id===r.activeId&&e.kind===`home`),o=a?.id??crypto.randomUUID();n(e,e=>({open:!0,activeId:o,tabs:a?e.tabs.map(e=>e.id===o?{...e,kind:`files`,title:`Files`}:e):[...e.tabs,{id:o,kind:`files`,title:`Files`,visitedAt:Date.now()}]}))},setOpen:(e,r=t().scope)=>{if(e&&!t().panes[r]?.tabs.length){t().openTools(r);return}n(r,t=>({...t,open:e,activeId:t.activeId??t.tabs[0]?.id??null}))},activate:(e,r=t().scope)=>{let i=t().panes[r]?.tabs.find(t=>t.id===e);i?.kind===`phone`&&(s.getState().setDisplayMode(`docked`),s.getState().show(i.phoneSessionId,!0,/^[\da-f]{8}-[\da-f-]{27}$/i.test(r)?r:void 0)),n(r,t=>({...t,open:!!(e&&t.tabs.some(t=>t.id===e)),activeId:e&&t.tabs.some(t=>t.id===e)?e:t.activeId,tabs:t.tabs.map(t=>t.id===e?{...t,visitedAt:Date.now()}:t)}))},openFile:(e,r=t().scope)=>{let i=t().panes[r]??d,a=i.tabs.find(t=>t.kind===`file`&&(y(t)===y(e)||t.aliases?.includes(y(e)))),o=!a&&e.preview!==!1?i.tabs.find(e=>e.kind===`file`&&e.preview&&!t().fileStatus[e.id]):void 0,s=a?.id??crypto.randomUUID(),c={...a?.kind===`file`?a:{},...e,preview:a?.kind===`file`?a.preview===!0:e.preview!==!1,id:s,kind:`file`,title:e.path?.replace(/\\/g,`/`).split(`/`).pop()||e.attachment?.name||`File`,visitedAt:Date.now(),returnTo:a?.returnTo??(o?o.returnTo:i.activeId??void 0)};return n(r,e=>{let t=[...e.tabs],n=t.findIndex(e=>e.id===s);return n>=0?t[n]=c:o?t[t.findIndex(e=>e.id===o.id)]=c:t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,c),{open:!0,tabs:t,activeId:s}}),s},addSideChat:(e,t,r,i=!0)=>n(r,n=>{let r=`side:${e}`;if(n.tabs.some(e=>e.id===r))return i?{...n,open:!0,activeId:r}:n;let a=i?n.tabs.findIndex(e=>e.id===n.activeId&&e.kind===`home`):-1,o=[...n.tabs];return a>=0&&o.splice(a,1),o.splice(a>=0?a:Math.max(0,o.findIndex(e=>e.id===n.activeId)+1),0,{id:r,kind:`sidechat`,sideChatId:e,title:t,visitedAt:Date.now()}),{tabs:o,activeId:i?r:n.activeId,open:i||n.open}}),resolveFileIdentity:(e,r)=>{for(let[i,a]of Object.entries(t().panes)){let o=a.tabs.find(t=>t.kind===`file`&&t.id===e);if(!o||o.resourceId===r)continue;let s=a.tabs.find(t=>t.kind===`file`&&t.id!==e&&t.resourceId===r);n(i,n=>!s||t().fileStatus[e]?{...n,tabs:n.tabs.map(t=>t.id===e?{...t,resourceId:r}:t)}:{...n,activeId:n.activeId===e?s.id:n.activeId,tabs:n.tabs.filter(t=>t.id!==e).map(e=>e.id===s.id?{...s,preview:s.preview===!0&&o.preview===!0,aliases:[...new Set([...s.aliases??[],y(o)])],line:o.line??s.line}:e)})}},replaceSideChat:(e,t,r)=>n(r,n=>({...n,activeId:n.activeId===`side:${e}`?`side:${t}`:n.activeId,tabs:n.tabs.map(n=>n.id===`side:${e}`?{...n,id:`side:${t}`,kind:`sidechat`,sideChatId:t}:n)})),remove:(e,r=t().scope)=>n(r,t=>{let n=t.tabs.find(t=>t.id===e),r=t.tabs.filter(t=>t.id!==e),i=r.find(e=>e.id===n?.returnTo)??[...r].sort((e,t)=>t.visitedAt-e.visitedAt)[0];return{...t,open:t.open&&r.length>0,tabs:r,activeId:t.activeId===e?i?.id??null:t.activeId}}),setWidth:t=>{e({width:t});try{localStorage.setItem(`xopc:workspace-width`,String(t))}catch{}},setTreeWidth:n=>{e({treeWidth:Math.max(200,Math.min(320,n))});try{localStorage.setItem(`xopc:workspace-tree-width`,String(t().treeWidth))}catch{}},setTreeOpen:(t,n)=>e(t===`file`?{fileTreeOpen:n}:{sideTreeOpen:n}),reset:()=>{e({panes:{},fileStatus:{},notices:{},scope:`new`}),h(t())}}});i.subscribe((e,t)=>{e.baseUrl!==t.baseUrl||t.conversationId!==void 0&&e.conversationId!==t.conversationId?b.getState().reset():e.conversationId&&!t.conversationId&&b.setState({panes:p().panes})});var x=e(t(),1);function S(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(null),[c,u]=(0,x.useState)(null),d=(0,x.useCallback)(e=>{t(!0),u(e),a(null),s(null)},[]),f=(0,x.useCallback)(async e=>{if(!c||n)return null;r(!0),s(null);try{let t=await l({...c,...e});return a(t.payload),t.payload}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),null}finally{r(!1)}},[n,c]),p=(0,x.useCallback)(()=>{a(null),s(null),r(!1),u(null)},[]);return{dialogOpen:e,loading:n,result:i,error:o,pendingParams:c,createShareLink:d,confirmShareLink:f,handleOpenChange:(0,x.useCallback)(e=>{t(e),e||p()},[p])}}var C=e(n(),1);function w(){return c()&&window.electronAPI?.platform===`darwin`}function T(){return c()&&window.electronAPI?.platform===`win32`}function E(){return T()?`windows-preview-viewport`:``}var D=r();function O({expanded:e,children:t}){let n=(0,x.useRef)(null),r=e?n.current?.closest(`.app-main-surface`)??document.querySelector(`.app-main-surface`):null,i=(0,D.jsx)(`div`,{"data-file-preview-expanded":e||void 0,"data-browser-occluder":e||void 0,className:o(`file-preview-surface flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden [&_.markdown-body_h1]:border-b-0! [&_.markdown-body_h2]:border-b-0!`,e&&(r?`absolute inset-0 z-[115]`:`fixed inset-0 z-[115] h-[100dvh] w-screen`),e&&!r&&E()),children:t});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{ref:n,hidden:!0,"aria-hidden":!0}),e?(0,C.createPortal)(i,r??document.body):i]})}export{S as a,T as i,E as n,d as o,w as r,b as s,O as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-CQcW9_qA.js";import{i as a,o}from"./vendor-swr-CdRzEUwF.js";var s=e(t(),1),c=n();function l(e){if(!(!e||typeof e!=`object`||!(`section`in e)))return e.section}function u(e){return l(e)===`skills`}function d(){return r(`/api/config`)}var f=null;async function p(){return f||(f=i(d()).finally(()=>{f=null}),f)}function m(e){let t=(0,c.c)(6),n;t[0]===e?n=t[1]:(n=e?d():null,t[0]=e,t[1]=n);let r=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={revalidateOnFocus:!1},t[2]=i):i=t[2];let l=a(r,p,i),f,m;return t[3]===e?(f=t[4],m=t[5]):(f=()=>{if(!e)return;let t=d(),n=e=>{u(e.detail)||o(t)};return window.addEventListener(`config-reload`,n),()=>window.removeEventListener(`config-reload`,n)},m=[e],t[3]=e,t[4]=f,t[5]=m),(0,s.useEffect)(f,m),l}function h(){return o(d())}export{u as a,l as i,h as n,m as r,p as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-D3c8DIm-.js";import{i as a,o}from"./vendor-swr-CdRzEUwF.js";var s=e(t(),1),c=n();function l(e){if(!(!e||typeof e!=`object`||!(`section`in e)))return e.section}function u(e){return l(e)===`skills`}function d(){return r(`/api/config`)}var f=null;async function p(){return f||(f=i(d()).finally(()=>{f=null}),f)}function m(e){let t=(0,c.c)(6),n;t[0]===e?n=t[1]:(n=e?d():null,t[0]=e,t[1]=n);let r=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={revalidateOnFocus:!1},t[2]=i):i=t[2];let l=a(r,p,i),f,m;return t[3]===e?(f=t[4],m=t[5]):(f=()=>{if(!e)return;let t=d(),n=e=>{u(e.detail)||o(t)};return window.addEventListener(`config-reload`,n),()=>window.removeEventListener(`config-reload`,n)},m=[e],t[3]=e,t[4]=f,t[5]=m),(0,s.useEffect)(f,m),l}function h(){return o(d())}export{u as a,l as i,h as n,m as r,p as t};