@xopcai/xopc 0.0.466 → 0.0.468
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CdEua6PR.js → activity-store-DKP2sWTJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-l8GQ4I9J.js → agent-avatar-dicebear-BR85bT1W.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BO1bqKlR.js → agent-avatar-display-CIsejg_E.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Dj_H2kDD.js → agent-defaults-settings-panel-CxLUEl0V.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BQA2brAU.js → agent-plugin-dialog-Cvj04Ckm.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-C5C5l13A.js → agents-CIV2R_El.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DZ1lLnrj.js → agents-admin-api-BL8lN8gP.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DDWYNF7I.js → api-Cl08_xtM.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DVXcGKP-.js → api-V4P8zfkJ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B5-7E03Z.js → app-management-settings-panel-CAEry5Vu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-E_BcjEDM.js → appearance-settings-CphsmJgM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BjB_mjXu.js → apps-page-CncU5JvR.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-MvSiDvxK.js → archive-plugin-DS6JWBPZ.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-24NjW7qG.js → automation-api-GcRQ9wM4.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-C94Q3OEL.js → automation-result-state-Dcp0JX0w.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-BShRirWV.js → automation-run-list-BLejrWpG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-Bgq5Plux.js → automation-task-card-sR61FFLn.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-_apIsCPT.js → automations-page-BNzj3R7A.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-WmcQUi9O.js → automations-workspace-BWpA-X_S.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-C7i5pqkO.js → binary-plugins-BjEE5sVq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DAWXPErA.js → block-editor-B4Yqbxab.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DI2PYAPC.js → browser-settings-page-Dd2eTtvL.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Dyw8xW90.js → capabilities-CBSMm_jo.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CFWTer_v.js → capabilities-EmBa4Blq.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-C2RB9fzC.js → capabilities-page-BQf7oyqc.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-hlByP8SE.js +8 -0
- package/dist/gateway/static/root/assets/{channels-DiDfjON8.js → channels-oyMymJDx.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BksS0CNy.js → chat-agents-api-Bim8--J9.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-aZIklMNN.js → chat-chart-block-CS-cORJt.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-hcsqrv-7.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B4HoRIzf.js → chat-terminal-dock-D6LH3W5H.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-VhBEUFmw.js → command-palette-api-DPtCt8Je.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-BhRAbdPW.js → composer-model-config-control-BF9PPSiu.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-nT-U6jcc.js → composer-notifications-B0IZsy8x.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-xEFHDnLo.js → composer-payload-handoff-CRCz17sd.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DXlH96m6.js → computer-settings-page-CtfitoMZ.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-D8vBFsbY.js → connected-providers-grid-CxeXJKxg.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-C8jPm7QO.js → connection-usage-guide-CM5qgMcK.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-B42yWHxS.js → connector-service-page-Bsec3-eZ.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-so2a7xrD.js → connectors-api-BUdH4tZQ.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-yhOZIiUZ.js → connectors-page-C0ZCUtxF.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-UEh3JM7r.js → date-picker-DRSq2kDz.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-Dci0LfAU.js → date-time-picker--LGC1D3b.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BAU_GuBe.js → desktop-pet-1oXlQvjH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CYE2eTTf.js → desktop-pet-settings-GdOjz7W9.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-C7v4CIlF.js → dev-view-store-DnQ2nBtV.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-7NDkYmiZ.js → device-pairing-wizard-diuSsk-H.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DmRZY8kg.js → directory-picker-path-field-DBe_paLy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-DIeg1mg8.js → extension-authoritative-grants-CVQ7q0DU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D8TAJgZ_.js → extension-debug-page-DrpE2lQ3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CjfRKtQ4.js → extension-iframe-host-hr60GwXQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-V1oFBxVi.js → extension-marketplace-api-baFXdV56.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-DZahH1Hd.js → extension-message-router-aoF3x4-X.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMuHBIHa.js → extension-page-BfM8zli6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-lqJ1zIkA.js → extension-provider-BcSgVeKW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D5IfKVff.js → extension-settings-page-Db5t2Mz0.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-B7B9qXm9.js → file-preview-surface-CeFFZo3a.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Dk3FtNv1.js → gateway-config-swr-DVXDJNCI.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DMvo4pAc.js → gateway-realtime-BnwNxbyc.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BpnGXAhi.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-C2h5R1eP.js → gateway-restart-Bws2Shaz.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DGPaikv5.js → gateway-settings-BU5Cp4Bw.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-yZn7ShiP.js → gateway-startup-retry-2jU7zCyx.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-gsAa0Kj9.js → global-defaults-api-CNyJ0dGb.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-Dgopm60U.js → home-page-DsS2UT08.js} +3 -3
- package/dist/gateway/static/root/assets/{image-generation-api-DPn1SBMH.js → image-generation-api-CiqQSx5j.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Cc48Uq20.js → imports-page-B9JMNXwt.js} +1 -1
- package/dist/gateway/static/root/assets/index-DFa0pZhC.js +11 -0
- package/dist/gateway/static/root/assets/index-DHPaL7Ku.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-QkJMw_uW.js → install-connector-dialog-0_PeJJqO.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BZXqXuI4.js → keyboard-shortcuts-settings-A37hYJtR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-wekatwet.js → local-app-workbench-page-OSinc6m6.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-D-bRvlZY.js → local-apps-page-yBqRl5Bi.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CZ19DRRK.js → local-session-drafts-CgAuYyKi.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DIBIYLnI.js → locale-store-Cit_aHqC.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CukseY3k.js → logs-page-BJxQ_Jd5.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-EG5duPec.js → management-api-DG-yZnHK.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-B7RWHrwo.js → management-settings-D9HGIYXx.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-C30KvTaE.js → markdown-view-CiGdWuN3.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-BZ1PDTYY.js → mcp-conversation-setup-page-YvPXchDz.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DlMEwcS8.js → media-plugins-C2lp7UmI.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DQveK9sk.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-COGICRIG.js → model-selector-Cg2kTsE7.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-aRYHi2dh.js → models-hub-cache-CmdULYFt.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-yAPC_cZU.js → note-detail-panel-CVEG1JdF.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-WA8FiHsm.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BXevQivV.js → notes-api-BQXOYFQ5.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CUMhjKKd.js → notes-page-Cc-c1Yhg.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-enDU_32p.js → oauth-api-Bz_PU9R_.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-C2pfvPOI.js → oauth-provider-connect-BW7zcXfb.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BaSooYGv.js → page-context-capture-button-Cw58-5P3.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-4-3RtO0q.js → page-context-draft-BjbX5zd7.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-DwFwq_lI.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-BPQpvC34.js → personal-avatar-B-Oes3ef.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-DWPu-iwK.js +1 -0
- package/dist/gateway/static/root/assets/{personal-profile-settings-DwMdjQ6H.js → personal-profile-settings-CDrzvI35.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-DiNpP_g3.js → personal-settings-panel-CoZ3qWSr.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DUT-qRLZ.js → phone-dependencies-card-CJ3ovsW1.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-pvOciDNo.js → phone-model-connection-UHVwbC3H.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CD97E6C5.js → phone-model-picker-CNTcpY1A.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-BUZ1dh7s.js → phone-settings-page-fS2IT-dK.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BwilERgv.js → phone-workspace-store-CKOW55gy.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-C_uOVmJv.js → plugin-details-dialog-BDoSffLO.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-BSUgcO7-.js → preference-select-fields-BKmzpfHq.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-BlwtlUY7.js → product-automation-feedback-DrBclzH1.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dy6D5exJ.js → product-open-page-BMJ2x5m3.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DEUPAilo.js → product-preview-content-lkkZPvMa.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-C4TV9RUd.js → product-preview-modal-DtUBJGs5.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-BjOzJyw1.js → project-detail-page-DGFUj6jS.js} +1 -1
- package/dist/gateway/static/root/assets/{project-understanding-lOJ5Tz2V.js → project-understanding-Dv26vu9S.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-B3aGdPHy.js → projects-page-Dua6taaG.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-C26HgxZY.js → providers-api-B6eZLEnh.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-BJkXktA-.js → recording-upload-DXxD6grq.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-pQ0eInzG.js → registry-api-BEnvt9-6.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CjWrYzjf.js → remote-access-hub-Dy3-oGK1.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-Y9WRHOnz.js → resource-unavailable-fk26VrOL.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-DHHyicqQ.js → right-workspace-store-BzXnZDK5.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-8KCgPcjp.js +2 -0
- package/dist/gateway/static/root/assets/{routine-panel-DSNsdpy8.js → routine-panel-BALhliq6.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-BoJQ3u5o.js → runtime-tools-api-CL6CG-qq.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DB7cfLrX.js → runtime-tools-settings-panel-CdvQRxCR.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-_rFmwIwY.js → service-recommendation-list-CsU74h1b.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-a6wb0_Gf.js → session-api-CkOliupg.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-Cby6Nkib.js +25 -0
- package/dist/gateway/static/root/assets/{sessions-page-dEupc-3A.js → sessions-page-CN9ESZdY.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BYrXsPjK.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CnGJr2xp.js → settings-advanced-section-Zex2dJo7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-DWRhupcY.js → settings-mode-store-Dk0bZQgo.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-u-U9D9qT.js → settings-page-ByFNIBfp.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-wL2jvs-y.js → settings-page-header-B9Y_eGcH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BkUQVmyY.js → settings-page-layout-D1MgJ5zP.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-D238tuw-.js → setup-interaction-page-Bsn4Wa4p.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DXvYjIu3.js → setup-status-panel-CstjOb7g.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-DFDJyl3N.js → share-link-dialog-BxFk4-4u.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BYPdlPIb.js → share-preview-page-9pOnypJv.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-CfFiW03g.js → shares-api-ChBHTPKN.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-B85XIDFv.js → shares-settings-CJdVDQqf.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-CWRhFSkA.js → skill-api-TQAyWHGS.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-CmPp2czp.js → skill-list-api-D4eokPXx.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BGsSq3dj.js → skill-reload-api-Bm-8vhsQ.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DqD0FPeH.js → skills-page-CkkHufmv.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-aw9C86I8.js → system-settings-panel-CvL5G2w1.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BPHt6S1V.js → task-detail-page-BjBkKeIf.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-C-zIBpzi.js → task-result-evidence-dtN1sSjU.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-CgPqgrm7.js → terminal-panel-store-B1bAD5Xf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DxF7S6I2.js → theme-store-C1MxmBg7.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-Dvlunx28.js → tracing-settings-page-CvXDgIJQ.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CIte6n0U.js → tunnel-api-BkhCBt38.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-C2RHmRo8.js → understanding-activity-store-BYGCmCVb.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-CPeQIXS_.js → understanding-refresh-store-DaLVsdYS.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DPUjEj39.js → usage-page-C-NM6vtY.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-xX2KrbXw.js → use-autosave-CvjQMyY8.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-UhypPQH_.js → use-composer-attachments-BEYkb8cs.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BvEF3yHL.js → use-file-preview-expanded-CQeo2Ztn.js} +3 -3
- package/dist/gateway/static/root/assets/{use-personal-profile-BJgaheR4.js → use-personal-profile-CKm5FaTl.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-RQW5KnIN.js → use-realtime-voice-lRHVixh4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-B6QFV5gR.js → use-workspace-tree-DrWnW1aA.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-hKnsTcMk.js → user-model-page-Bw1_PGdD.js} +1 -1
- package/dist/gateway/static/root/assets/video-generation-D08uZbsu.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BeEF7Thh.js → voice-api-key-field-M7KB_Gl1.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-vbBoKnqd.js → voice-config-api-BLGbUq3v.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CKn6X3qL.js → voice-input-shortcut-events-CxH3RDXi.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-BUrk4mwV.js → voice-settings-CssuMBjt.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Ddvqu02U.js → work-discovery-overlay-DcZS4OMj.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BdBpri6P.js → work-discovery-page-CZF9iWPT.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DStgfCzQ.js → working-directory-picker-modal-W2QiUVjN.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-CscTRODe.js → workspace-api-BfApIXLw.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-DwpWKogz.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BRQIf4sc.js → workspace-file-preview-dialog-BRhsCs1S.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CBHFZ2iQ.js → workspace-open-location-menu-Dh0TvTkH.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-DNLnuHlf.js → workspace-preview-store-BrofEVle.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Cm0Saa8B.js → xopc-cloud-account-card-DGAGXbGI.js} +1 -1
- package/dist/gateway/static/root/index.html +89 -90
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/music-generation.js +9 -0
- package/dist/src/agent/background-review/prompts.js +5 -1
- package/dist/src/agent/inbound/attachment-pipeline.d.ts +1 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +5 -1
- package/dist/src/agent/prompt/sections/tooling.js +4 -0
- package/dist/src/agent/tools/factory.js +14 -1
- package/dist/src/agent/tools/music-generation-tool.d.ts +11 -0
- package/dist/src/agent/tools/music-generation-tool.js +70 -0
- package/dist/src/agent/tools/personal-memory-tool.js +12 -10
- package/dist/src/agent/tools/toolExposure.js +2 -0
- package/dist/src/agent/tools/video-draft-tool.d.ts +13 -0
- package/dist/src/agent/tools/video-draft-tool.js +79 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -1
- package/dist/src/gateway/hono/routes/media.js +1 -20
- package/dist/src/gateway/hono/routes/memory-learning.js +19 -3
- package/dist/src/gateway/hono/routes/models.js +7 -0
- package/dist/src/gateway/hono/routes/music-generation.d.ts +3 -0
- package/dist/src/gateway/hono/routes/music-generation.js +80 -0
- package/dist/src/gateway/hono/routes/video-generation.js +51 -26
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +4 -1
- package/dist/src/media-shared/http/byte-range.d.ts +6 -0
- package/dist/src/media-shared/http/byte-range.js +23 -0
- package/dist/src/memory-learning/work-capture.js +2 -1
- package/dist/src/memory-learning/work-review.d.ts +2 -0
- package/dist/src/memory-learning/work-review.js +25 -2
- package/dist/src/music-generation/artifact.d.ts +5 -0
- package/dist/src/music-generation/artifact.js +105 -0
- package/dist/src/music-generation/mureka.d.ts +3 -0
- package/dist/src/music-generation/mureka.js +96 -0
- package/dist/src/music-generation/provider.d.ts +34 -0
- package/dist/src/music-generation/provider.js +9 -0
- package/dist/src/music-generation/providers.d.ts +28 -0
- package/dist/src/music-generation/providers.js +68 -0
- package/dist/src/music-generation/repository.d.ts +52 -0
- package/dist/src/music-generation/repository.js +106 -0
- package/dist/src/music-generation/settings.d.ts +7 -0
- package/dist/src/music-generation/settings.js +24 -0
- package/dist/src/music-generation/tencent-mps.d.ts +11 -0
- package/dist/src/music-generation/tencent-mps.js +151 -0
- package/dist/src/music-generation/worker.d.ts +8 -0
- package/dist/src/music-generation/worker.js +126 -0
- package/dist/src/personal-agent/policy.d.ts +1 -1
- package/dist/src/personal-agent/policy.js +3 -1
- package/dist/src/personal-agent/prompts.js +3 -1
- package/dist/src/session/store.js +9 -2
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +32 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/transcript-repository.js +8 -1
- package/dist/src/storage/sqlite/upgrades/277_music_generation.sql +30 -0
- package/dist/src/storage/sqlite/upgrades/278_music_job_error_code.sql +6 -0
- package/dist/src/user-model/action-rule-suggestions.js +4 -3
- package/dist/src/user-model/capture/evidence-policy.d.ts +7 -1
- package/dist/src/user-model/capture/evidence-policy.js +68 -2
- package/dist/src/user-model/capture/executor.js +62 -14
- package/dist/src/video-generation/drafts.d.ts +18 -0
- package/dist/src/video-generation/drafts.js +91 -0
- package/dist/src/video-generation/repository.d.ts +5 -3
- package/dist/src/video-generation/repository.js +22 -7
- package/dist/src/video-generation/worker.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/api-CG-SjNfw.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DuQGhgAl.js +0 -8
- package/dist/gateway/static/root/assets/chat-page-BMZwIVXH.js +0 -71
- package/dist/gateway/static/root/assets/gateway-realtime-store-CJf-qaHZ.js +0 -1
- package/dist/gateway/static/root/assets/index-BE3XMuQI.js +0 -11
- package/dist/gateway/static/root/assets/index-CY5vdQcc.css +0 -1
- package/dist/gateway/static/root/assets/messages-BDBGlBKh.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-CxXu_Tkh.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-C2ydtnXa.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-POCG1_kK.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-DjYsRhY1.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-D5g6LOU-.js +0 -25
- package/dist/gateway/static/root/assets/settings-advanced-gate-DjyibJZ1.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-CyPjTDSx.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{t as u}from"./skeleton-DzdOeGYz.js";import{i as d}from"./vendor-swr-CdRzEUwF.js";import{t as f}from"./button-Cc4hUNTt.js";var p=e(t(),1),m=n(),h=e=>a(`/api/projects/${encodeURIComponent(e)}/understanding`);function g(e){return c(h(e))}function _(e){return c(h(e),{method:`POST`})}function v(e,t){return c(h(e),{method:`PATCH`,body:JSON.stringify({content:t})})}function y(e){return e===`queued`||e===`probing`||e===`analyzing`}var b=r();function x(){let e=(0,m.c)(2),t=s(S),n;return e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n),n.projectsPage.understanding}function S(e){return e.language}function C(e){let t=(0,m.c)(18),{checked:n,onChange:r,disabled:i}=e,a=x(),o=(0,p.useId)(),s;t[0]===r?s=t[1]:(s=e=>r(e.target.checked),t[0]=r,t[1]=s);let c;t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==s?(c=(0,b.jsx)(`input`,{type:`checkbox`,"aria-describedby":o,className:`mt-1 accent-accent`,checked:n,disabled:i,onChange:s}),t[2]=n,t[3]=i,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===a.auto?l=t[8]:(l=(0,b.jsx)(`span`,{children:a.auto}),t[7]=a.auto,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2.5 text-sm text-fg`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==a.hint||t[13]!==o?(d=(0,b.jsx)(`p`,{id:o,className:`mt-1 pl-6 text-xs leading-5 text-fg-subtle`,children:a.hint}),t[12]=a.hint,t[13]=o,t[14]=d):d=t[14];let f;return t[15]!==u||t[16]!==d?(f=(0,b.jsxs)(`div`,{children:[u,d]}),t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function w(e){let t=(0,m.c)(11),n=o(D),r=o(E),i;t[0]!==r||t[1]!==n||t[2]!==e?(i=r?[`project-understanding`,n,r,e]:null,t[0]=r,t[1]=n,t[2]=e,t[3]=i):i=t[3];let a;t[4]===e?a=t[5]:(a=()=>g(e),t[4]=e,t[5]=a);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:T,revalidateOnFocus:!1},t[6]=s):s=t[6];let c=d(i,a,s),{mutate:l}=c,u,f;return t[7]!==l||t[8]!==e?(u=()=>{let t=t=>{t.detail?.id===e&&l()};return window.addEventListener(`project-updated`,t),()=>window.removeEventListener(`project-updated`,t)},f=[l,e],t[7]=l,t[8]=e,t[9]=u,t[10]=f):(u=t[9],f=t[10]),(0,p.useEffect)(u,f),c}function T(e){return y(e?.status)?3e3:0}function E(e){return e.conversationId}function D(e){return e.baseUrl}function O({projectId:e,hasProjectFolder:t,onStarted:n,className:r}){let i=x(),{data:a,mutate:o}=w(e),[s,c]=(0,p.useState)(!1),[l,u]=(0,p.useState)(!1),d=y(a?.status),f=async()=>{c(!0),u(!1);try{await _(e),await o(),n?.()}catch{u(!0)}finally{c(!1)}};return t?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`button`,{type:`button`,className:r??`text-xs text-fg-muted hover:text-fg disabled:opacity-50`,disabled:s||d,onClick:()=>void f(),children:d||s?i.running:a?.status===`failed`||a?.status===`canceled`?i.retry:a?.status===`completed`?i.refresh:i.start}),l?(0,b.jsx)(`p`,{role:`alert`,className:`px-2 text-xs text-danger`,children:i.failed}):null]}):(0,b.jsx)(A,{projectId:e})}function k({projectId:e,hasProjectFolder:t}){let n=x(),{data:r,error:i,isLoading:a,mutate:o}=w(e),[s,c]=(0,p.useState)(!1),[l,d]=(0,p.useState)(``),[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(!1),S=async()=>{h(!0),_(!1);try{await v(e,l),await o(),c(!1)}catch{_(!0)}finally{h(!1)}};return t?a?(0,b.jsx)(u,{className:`h-12 w-full rounded-xl`}):(0,b.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-panel px-5 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-fg-subtle`,children:[(0,b.jsx)(`span`,{children:y(r?.status)?n.running:r?.status===`failed`||r?.status===`canceled`||i?n.failed:n.title}),y(r?.status)?null:(0,b.jsx)(O,{projectId:e,hasProjectFolder:t})]}),r?.overview?(0,b.jsxs)(`details`,{className:`mt-2`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg-muted`,children:n.view}),s?(0,b.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,b.jsx)(`textarea`,{"aria-label":n.title,className:`min-h-48 w-full rounded-lg border border-edge bg-surface-base p-3 text-sm text-fg`,value:l,onChange:e=>d(e.target.value),maxLength:6e3,disabled:m}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(f,{onClick:()=>void S(),disabled:m||!l.trim(),children:n.save}),(0,b.jsx)(f,{variant:`ghost`,disabled:m,onClick:()=>c(!1),children:n.cancel})]}),g?(0,b.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:n.saveFailed}):null]}):(0,b.jsxs)(`div`,{className:`mt-3`,children:[(0,b.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:r.overview}),(0,b.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-fg-subtle hover:text-fg`,onClick:()=>{d(r.overview??``),c(!0)},children:n.edit})]})]}):null]}):(0,b.jsx)(`section`,{className:`rounded-xl border border-edge p-4`,children:(0,b.jsx)(A,{projectId:e})})}function A(e){let t=(0,m.c)(8),{projectId:n}=e,r=s(j)===`zh`,a=r?`未绑定项目文件夹`:`No project folder linked`,o;t[0]===a?o=t[1]:(o=(0,b.jsx)(`span`,{className:`text-fg-muted`,children:a}),t[0]=a,t[1]=o);let c=`/projects/${encodeURIComponent(n)}/settings`,l=r?`绑定文件夹`:`Link a folder`,u;t[2]!==c||t[3]!==l?(u=(0,b.jsx)(i,{className:`text-accent-fg hover:underline`,to:c,children:l}),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d;return t[5]!==o||t[6]!==u?(d=(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs leading-5`,children:[o,u]}),t[5]=o,t[6]=u,t[7]=d):d=t[7],d}function j(e){return e.language}export{C as n,k as r,O as t};
|
package/dist/gateway/static/root/assets/{projects-page-B3aGdPHy.js → projects-page-Dua6taaG.js}
RENAMED
|
@@ -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{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-DIBIYLnI.js";import{t as ee}from"./messages-BDBGlBKh.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./archive-Dz0hferG.js";import{t as m}from"./arrow-right-DSSvoX71.js";import{t as h}from"./working-directory-picker-modal-DStgfCzQ.js";import{n as g,r as _}from"./popover-select-CLsphyzA.js";import{t as te}from"./folder-kanban-CpLlFI1o.js";import{t as v}from"./folder-open-CyzJ19I9.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{n as b,t as x}from"./pin-off-BMRv-Kxr.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as ne}from"./rotate-ccw-JM1TBLpp.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./x-B_N4OPjy.js";import{t as T}from"./cn-0WouolD0.js";import{t as E}from"./skeleton-DzdOeGYz.js";import{_ as D,d as O,f as k,m as A,n as j,t as M}from"./api-DDWYNF7I.js";import{t as N}from"./button-Cc4hUNTt.js";import{t as P}from"./page-header-store-C2ydtnXa.js";import{n as re}from"./project-understanding-lOJ5Tz2V.js";import{t as ie}from"./use-directory-picker-C4p7AgWY.js";import{t as F}from"./date-formatters-DukWSVwc.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(E,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:o,onToggleArchive:s}=e,c=a(V),l,u,d,f,h,g,_,v;if(t[0]!==c||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(c).projectsPage;l=e.management,_=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),s;t[20]===o?s=t[21]:(s=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=s);let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(m,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=p):p=t[22];let y;t[23]===s?y=t[24]:(y=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[s,p]}),t[23]=s,t[24]=y),v=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[y,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),g=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,h=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),u=`mt-1`,d=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=c,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=h,t[14]=g,t[15]=_,t[16]=v}else l=t[9],u=t[10],d=t[11],f=t[12],h=t[13],g=t[14],_=t[15],v=t[16];let y;t[25]!==u||t[26]!==d?(y=(0,R.jsx)(`p`,{className:u,children:d}),t[25]=u,t[26]=d,t[27]=y):y=t[27];let S;t[28]!==f||t[29]!==h||t[30]!==y?(S=(0,R.jsxs)(`div`,{className:f,children:[h,y]}),t[28]=f,t[29]=h,t[30]=y,t[31]=S):S=t[31];let C=n.pinnedAt?l.unpin:l.pin,w=n.pinnedAt?l.unpin:l.pin,T;t[32]===n.pinnedAt?T=t[33]:(T=n.pinnedAt?(0,R.jsx)(x,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=T);let E;t[34]!==r||t[35]!==o||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":C,title:w,children:T}),t[34]=r,t[35]=o,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D=n.status===`archived`?l.restore:l.archive,O=n.status===`archived`?l.restore:l.archive,k;t[40]===n.status?k=t[41]:(k=n.status===`archived`?(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=k);let A;t[42]!==r||t[43]!==s||t[44]!==D||t[45]!==O||t[46]!==k?(A=(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:s,"aria-label":D,title:O,children:k}),t[42]=r,t[43]=s,t[44]=D,t[45]=O,t[46]=k,t[47]=A):A=t[47];let j;t[48]!==E||t[49]!==A?(j=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[E,A]}),t[48]=E,t[49]=A,t[50]=j):j=t[50];let M;t[51]!==j||t[52]!==g||t[53]!==S?(M=(0,R.jsxs)(`div`,{className:g,children:[S,j]}),t[51]=j,t[52]=g,t[53]=S,t[54]=M):M=t[54];let P;return t[55]!==M||t[56]!==_||t[57]!==v?(P=(0,R.jsxs)(`article`,{className:_,children:[v,M]}),t[55]=M,t[56]=_,t[57]=v,t[58]=P):P=t[58],P}function V(e){return e.language}function H(){let e=a(e=>e.language),t=ee(e),n=t.projectsPage,r=n.management,i=t.chat.workingDirectory,p=P(e=>e.setPageHeader),m=P(e=>e.clearPageHeader),[b,x]=(0,L.useState)([]),[ne,E]=(0,L.useState)(!0),[F,I]=(0,L.useState)(null),[z,B]=(0,L.useState)(``),[V,H]=(0,L.useState)(!1),[U,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,W]=(0,L.useState)(!1),[fe,G]=(0,L.useState)(null),[K,pe]=(0,L.useState)(!1),[q,me]=(0,L.useState)(!1),[J,he]=(0,L.useState)(``),[Y,ge]=(0,L.useState)(``),[X,_e]=(0,L.useState)(``),Z=ie({initialPath:X,onPicked:_e}),Q=(0,L.useRef)(0),$=(0,L.useCallback)(async(e=!1)=>{let t=++Q.current;e||(E(!0),I(null));try{let e=await O({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Q.current&&x(ae(e.items))}catch(n){!e&&t===Q.current&&I(n instanceof Error?n.message:String(n))}finally{t===Q.current&&E(!1)}},[]);(0,L.useEffect)(()=>($(),()=>{Q.current++}),[$]),(0,L.useEffect)(()=>{let e=()=>{$(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[$]);let ve=(0,L.useMemo)(()=>{let e=z.trim().toLocaleLowerCase();return b.filter(e=>U===`all`||e.status===U).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[U,b,z]),ye=(0,L.useMemo)(()=>(0,R.jsxs)(N,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>W(!0),children:[(0,R.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.create]}),[n.create]);(0,L.useLayoutEffect)(()=>(p({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title}),end:ye}),()=>m()),[m,ye,r.title,p]);let be=(0,L.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||K)){pe(!0),G(null);try{let e=await j({autoUnderstand:!!X.trim()&&q,name:t,...Y.trim()?{description:Y.trim()}:{},...n?{workspaceRoot:n}:{}});x(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!1),W(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){G(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[K,Y,J,X,q]),xe=(0,L.useCallback)(async(e,t)=>{ue(e.id),I(null);try{let n;n=t===`pin`?e.pinnedAt?await D(e.id,e.version):await k(e.id,e.version):e.status===`archived`?await A(e.id,e.version):await M(e.id,e.version),x(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){I(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),Se=[{id:`active`,label:n.statuses.active},{id:`paused`,label:n.statuses.paused},{id:`archived`,label:n.statuses.archived},{id:`all`,label:n.all}],Ce=Se.find(e=>e.id===U)?.label??n.all,we=r.resultCount.replace(`{{status}}`,Ce).replace(`{{count}}`,String(ve.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,R.jsx)(f,{open:de,onOpenChange:e=>{W(e),e||G(null)},children:(0,R.jsxs)(l,{children:[(0,R.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(u,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(d,{className:`text-base font-semibold text-fg`,children:n.createTitle}),(0,R.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:n.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:be,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[r.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:r.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Z.pick,disabled:K||Z.picking,children:[Z.picking?(0,R.jsx)(y,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(v,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?i.chooseFolder:i.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:T(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||n.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-muted`,children:n.workspaceSelectionHint})]}),(0,R.jsx)(re,{checked:q,onChange:me,disabled:K||!X.trim()}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(c,{asChild:!0,children:(0,R.jsx)(N,{type:`button`,variant:`ghost`,children:n.cancel})}),(0,R.jsx)(N,{type:`submit`,variant:`primary`,disabled:K||!J.trim(),children:K?n.home.creating:n.create})]})]})]})]})}),Z.hasNativePicker?null:(0,R.jsx)(h,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:i}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":r.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:we}),(0,R.jsxs)(`div`,{className:T(`ml-auto flex min-w-0 items-center justify-end gap-2`,V&&`w-full sm:w-auto`),children:[V?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:z,onChange:e=>B(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{B(``),H(!1)},"aria-label":r.clearSearch,title:r.clearSearch,children:(0,R.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>H(!0),"aria-label":n.searchPlaceholder,title:n.searchPlaceholder,children:(0,R.jsx)(C,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(g,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:U,"aria-label":r.filterLabel,onChange:e=>ce(e.target.value),children:Se.map(e=>(0,R.jsx)(_,{value:e.id,children:e.label},e.id))})]})]}),F?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:F}),(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:n.home.retry})]}):null,ne?(0,R.jsx)(oe,{}):ve.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ve.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void xe(e,`pin`),onToggleArchive:()=>void xe(e,`archive`)},e.id))}):F?null:(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(te,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:b.length===0?e===`zh`?`创建第一个项目`:`Create your first project`:r.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:b.length===0?e===`zh`?`把相关对话、任务和资料放在一起。`:`Keep related conversations, tasks and materials together.`:r.emptyHint}),(0,R.jsx)(N,{className:`mt-4`,onClick:()=>{b.length===0?W(!0):(B(``),ce(`all`))},children:b.length===0?n.create:e===`zh`?`清除筛选`:`Clear filters`})]})]})}export{H as ProjectsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-Cit_aHqC.js";import{t as ee}from"./messages-DQveK9sk.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./archive-Dz0hferG.js";import{t as m}from"./arrow-right-DSSvoX71.js";import{t as h}from"./working-directory-picker-modal-W2QiUVjN.js";import{n as g,r as _}from"./popover-select-CLsphyzA.js";import{t as te}from"./folder-kanban-CpLlFI1o.js";import{t as v}from"./folder-open-CyzJ19I9.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{n as b,t as x}from"./pin-off-BMRv-Kxr.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as ne}from"./rotate-ccw-JM1TBLpp.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./x-B_N4OPjy.js";import{t as T}from"./cn-0WouolD0.js";import{t as E}from"./skeleton-DzdOeGYz.js";import{_ as D,d as O,f as k,m as A,n as j,t as M}from"./api-Cl08_xtM.js";import{t as N}from"./button-Cc4hUNTt.js";import{t as P}from"./page-header-store-DwFwq_lI.js";import{n as re}from"./project-understanding-Dv26vu9S.js";import{t as ie}from"./use-directory-picker-C4p7AgWY.js";import{t as F}from"./date-formatters-DukWSVwc.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(E,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:o,onToggleArchive:s}=e,c=a(V),l,u,d,f,h,g,_,v;if(t[0]!==c||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(c).projectsPage;l=e.management,_=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),s;t[20]===o?s=t[21]:(s=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=s);let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(m,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=p):p=t[22];let y;t[23]===s?y=t[24]:(y=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[s,p]}),t[23]=s,t[24]=y),v=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[y,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),g=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,h=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),u=`mt-1`,d=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=c,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=h,t[14]=g,t[15]=_,t[16]=v}else l=t[9],u=t[10],d=t[11],f=t[12],h=t[13],g=t[14],_=t[15],v=t[16];let y;t[25]!==u||t[26]!==d?(y=(0,R.jsx)(`p`,{className:u,children:d}),t[25]=u,t[26]=d,t[27]=y):y=t[27];let S;t[28]!==f||t[29]!==h||t[30]!==y?(S=(0,R.jsxs)(`div`,{className:f,children:[h,y]}),t[28]=f,t[29]=h,t[30]=y,t[31]=S):S=t[31];let C=n.pinnedAt?l.unpin:l.pin,w=n.pinnedAt?l.unpin:l.pin,T;t[32]===n.pinnedAt?T=t[33]:(T=n.pinnedAt?(0,R.jsx)(x,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=T);let E;t[34]!==r||t[35]!==o||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":C,title:w,children:T}),t[34]=r,t[35]=o,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D=n.status===`archived`?l.restore:l.archive,O=n.status===`archived`?l.restore:l.archive,k;t[40]===n.status?k=t[41]:(k=n.status===`archived`?(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=k);let A;t[42]!==r||t[43]!==s||t[44]!==D||t[45]!==O||t[46]!==k?(A=(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:s,"aria-label":D,title:O,children:k}),t[42]=r,t[43]=s,t[44]=D,t[45]=O,t[46]=k,t[47]=A):A=t[47];let j;t[48]!==E||t[49]!==A?(j=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[E,A]}),t[48]=E,t[49]=A,t[50]=j):j=t[50];let M;t[51]!==j||t[52]!==g||t[53]!==S?(M=(0,R.jsxs)(`div`,{className:g,children:[S,j]}),t[51]=j,t[52]=g,t[53]=S,t[54]=M):M=t[54];let P;return t[55]!==M||t[56]!==_||t[57]!==v?(P=(0,R.jsxs)(`article`,{className:_,children:[v,M]}),t[55]=M,t[56]=_,t[57]=v,t[58]=P):P=t[58],P}function V(e){return e.language}function H(){let e=a(e=>e.language),t=ee(e),n=t.projectsPage,r=n.management,i=t.chat.workingDirectory,p=P(e=>e.setPageHeader),m=P(e=>e.clearPageHeader),[b,x]=(0,L.useState)([]),[ne,E]=(0,L.useState)(!0),[F,I]=(0,L.useState)(null),[z,B]=(0,L.useState)(``),[V,H]=(0,L.useState)(!1),[U,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,W]=(0,L.useState)(!1),[fe,G]=(0,L.useState)(null),[K,pe]=(0,L.useState)(!1),[q,me]=(0,L.useState)(!1),[J,he]=(0,L.useState)(``),[Y,ge]=(0,L.useState)(``),[X,_e]=(0,L.useState)(``),Z=ie({initialPath:X,onPicked:_e}),Q=(0,L.useRef)(0),$=(0,L.useCallback)(async(e=!1)=>{let t=++Q.current;e||(E(!0),I(null));try{let e=await O({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Q.current&&x(ae(e.items))}catch(n){!e&&t===Q.current&&I(n instanceof Error?n.message:String(n))}finally{t===Q.current&&E(!1)}},[]);(0,L.useEffect)(()=>($(),()=>{Q.current++}),[$]),(0,L.useEffect)(()=>{let e=()=>{$(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[$]);let ve=(0,L.useMemo)(()=>{let e=z.trim().toLocaleLowerCase();return b.filter(e=>U===`all`||e.status===U).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[U,b,z]),ye=(0,L.useMemo)(()=>(0,R.jsxs)(N,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>W(!0),children:[(0,R.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.create]}),[n.create]);(0,L.useLayoutEffect)(()=>(p({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title}),end:ye}),()=>m()),[m,ye,r.title,p]);let be=(0,L.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||K)){pe(!0),G(null);try{let e=await j({autoUnderstand:!!X.trim()&&q,name:t,...Y.trim()?{description:Y.trim()}:{},...n?{workspaceRoot:n}:{}});x(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!1),W(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){G(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[K,Y,J,X,q]),xe=(0,L.useCallback)(async(e,t)=>{ue(e.id),I(null);try{let n;n=t===`pin`?e.pinnedAt?await D(e.id,e.version):await k(e.id,e.version):e.status===`archived`?await A(e.id,e.version):await M(e.id,e.version),x(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){I(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),Se=[{id:`active`,label:n.statuses.active},{id:`paused`,label:n.statuses.paused},{id:`archived`,label:n.statuses.archived},{id:`all`,label:n.all}],Ce=Se.find(e=>e.id===U)?.label??n.all,we=r.resultCount.replace(`{{status}}`,Ce).replace(`{{count}}`,String(ve.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,R.jsx)(f,{open:de,onOpenChange:e=>{W(e),e||G(null)},children:(0,R.jsxs)(l,{children:[(0,R.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(u,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(d,{className:`text-base font-semibold text-fg`,children:n.createTitle}),(0,R.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:n.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:be,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[r.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:r.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Z.pick,disabled:K||Z.picking,children:[Z.picking?(0,R.jsx)(y,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(v,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?i.chooseFolder:i.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:T(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||n.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-muted`,children:n.workspaceSelectionHint})]}),(0,R.jsx)(re,{checked:q,onChange:me,disabled:K||!X.trim()}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(c,{asChild:!0,children:(0,R.jsx)(N,{type:`button`,variant:`ghost`,children:n.cancel})}),(0,R.jsx)(N,{type:`submit`,variant:`primary`,disabled:K||!J.trim(),children:K?n.home.creating:n.create})]})]})]})]})}),Z.hasNativePicker?null:(0,R.jsx)(h,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:i}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":r.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:we}),(0,R.jsxs)(`div`,{className:T(`ml-auto flex min-w-0 items-center justify-end gap-2`,V&&`w-full sm:w-auto`),children:[V?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:z,onChange:e=>B(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{B(``),H(!1)},"aria-label":r.clearSearch,title:r.clearSearch,children:(0,R.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>H(!0),"aria-label":n.searchPlaceholder,title:n.searchPlaceholder,children:(0,R.jsx)(C,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(g,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:U,"aria-label":r.filterLabel,onChange:e=>ce(e.target.value),children:Se.map(e=>(0,R.jsx)(_,{value:e.id,children:e.label},e.id))})]})]}),F?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:F}),(0,R.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:n.home.retry})]}):null,ne?(0,R.jsx)(oe,{}):ve.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ve.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void xe(e,`pin`),onToggleArchive:()=>void xe(e,`archive`)},e.id))}):F?null:(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(te,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:b.length===0?e===`zh`?`创建第一个项目`:`Create your first project`:r.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:b.length===0?e===`zh`?`把相关对话、任务和资料放在一起。`:`Keep related conversations, tasks and materials together.`:r.emptyHint}),(0,R.jsx)(N,{className:`mt-4`,onClick:()=>{b.length===0?W(!0):(B(``),ce(`all`))},children:b.length===0?n.create:e===`zh`?`清除筛选`:`Clear filters`})]})]})}export{H as ProjectsPage};
|
package/dist/gateway/static/root/assets/{providers-api-C26HgxZY.js → providers-api-B6eZLEnh.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t}from"./locale-store-
|
|
1
|
+
import{i as e,o as t}from"./locale-store-Cit_aHqC.js";import"./registry-api-BEnvt9-6.js";import{n}from"./is-masked-secret-DOkL5b_X.js";import{i as r}from"./models-hub-cache-CmdULYFt.js";function i(e){return n(e)}async function a(){return(await t(e(`/api/providers/meta`))).payload?.providers??[]}function o(e){if(!e||typeof e!=`object`||!(`providers`in e))return{};let t=e.providers;if(!t||typeof t!=`object`||Array.isArray(t))return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&(n[e]=r);return n}function s(e,t,n){let r=new Set(n.map(e=>e.provider));return e.map(e=>({...e,configured:e.configured||r.has(e.id),apiKey:t[e.id]??([`agent`,`gateway`,`models_json`].includes(e.activeKeySource??e.authMode??``)?`••••••••••••`:``)}))}async function c(n){await t(e(`/api/config`),{method:`PATCH`,body:JSON.stringify({providers:n})}),await r()}async function l(n){await t(e(`/api/providers/${encodeURIComponent(n)}/key`),{method:`DELETE`}),await r()}async function u(n){let r=await t(e(`/api/providers/${encodeURIComponent(n)}/reveal-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!r.ok||!r.payload)throw Error(r.error?.message??`Reveal failed`);return r.payload}export{c as a,s as i,a as n,o,i as r,u as s,l 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-DIBIYLnI.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`}]]),u=7200*1e3,d=1024*1024*1024,f=8*1024*1024;function p(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 m=`open-discussion-capture`;function h(e){window.dispatchEvent(new CustomEvent(m,{detail:e?{projectId:e}:{}}))}var ee=e(),te={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.`]},ne={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,ee.c)(61),{input:n,zh:r,compact:i,busy:s,onRetry:c,children:l,nextAttemptAt:u,context:d}=e,f=i!==void 0&&i,m=s!==void 0&&s,h=d===void 0?`capture`:d,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[0]!==h||t[1]!==n||t[2]!==r){b=p(n),y=te[b.stage];let e;t[16]===r?e=t[17]:(e=e=>ne[e][+!r],t[16]=r,t[17]=e),_=e,v=`retry_${[`analysis_failed`,`transcription_failed`,`verify_failed`].includes(b.stage)?b.stage:b.retry}`,k=`polite`,x=b.stage,S=h===`note`?`mx-auto w-full max-w-[46rem] text-fg`:`rounded-xl bg-surface-inset p-3 text-fg`,C=h===`capture`?(0,g.jsx)(`p`,{className:`mb-1 text-sm font-medium`,children:_(`leave_${b.leave}`)}):null,E=`group`,D=h,O=h===`note`&&(b.stage.endsWith(`_failed`)||b.stage.includes(`retry`)||b.stage===`local_partial`)?!0:void 0,T=`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`,w=b.stage.endsWith(`_failed`)||b.stage===`local_partial`?`bg-danger`:`bg-accent`,t[0]=h,t[1]=n,t[2]=r,t[3]=_,t[4]=v,t[5]=y,t[6]=b,t[7]=x,t[8]=S,t[9]=C,t[10]=w,t[11]=T,t[12]=E,t[13]=D,t[14]=O,t[15]=k}else _=t[3],v=t[4],y=t[5],b=t[6],x=t[7],S=t[8],C=t[9],w=t[10],T=t[11],E=t[12],D=t[13],O=t[14],k=t[15];let A=`size-1.5 shrink-0 rounded-full ${w}`,j;t[18]===A?j=t[19]:(j=(0,g.jsx)(`span`,{className:A,"aria-hidden":!0}),t[18]=A,t[19]=j);let M=y[+!r],N;t[20]===M?N=t[21]:(N=(0,g.jsx)(`span`,{className:`min-w-0 flex-1`,children:M}),t[20]=M,t[21]=N);let P;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(P=(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]=P):P=t[22];let F;t[23]!==j||t[24]!==N||t[25]!==T?(F=(0,g.jsxs)(`summary`,{className:T,children:[j,N,P]}),t[23]=j,t[24]=N,t[25]=T,t[26]=F):F=t[26];let I;t[27]!==h||t[28]!==_||t[29]!==b.leave?(I=h===`note`?(0,g.jsx)(`p`,{children:_(`leave_${b.leave}`)}):null,t[27]=h,t[28]=_,t[29]=b.leave,t[30]=I):I=t[30];let L;t[31]!==f||t[32]!==u||t[33]!==_||t[34]!==y||t[35]!==b||t[36]!==r?(L=f?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{children:y[r?2:3]}),u&&Number.isFinite(u)?(0,g.jsxs)(`p`,{children:[r?`下次自动重试时间:`:`Next automatic retry: `,new Date(u).toLocaleTimeString(r?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}):null,b.leave===`local`?(0,g.jsx)(`p`,{children:_(`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:[_(e),` · `,e===`note`&&b.note&&b.stale?_(`old_note`):_(b[e]?`available`:`pending`)]},e))})]}),t[31]=f,t[32]=u,t[33]=_,t[34]=y,t[35]=b,t[36]=r,t[37]=L):L=t[37];let R;t[38]!==I||t[39]!==L?(R=(0,g.jsxs)(`div`,{className:`space-y-2 pb-3 text-xs leading-5 text-fg-muted`,children:[I,L]}),t[38]=I,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==F||t[42]!==R||t[43]!==E||t[44]!==D||t[45]!==O?(z=(0,g.jsxs)(`details`,{className:E,open:O,children:[F,R]},D),t[41]=F,t[42]=R,t[43]=E,t[44]=D,t[45]=O,t[46]=z):z=t[46];let B;t[47]!==m||t[48]!==c||t[49]!==_||t[50]!==v||t[51]!==b.retry?(B=b.retry!==`none`&&c?(0,g.jsx)(o,{className:`min-h-11`,disabled:m,onClick:()=>c(b.retry),children:_(v)}):null,t[47]=m,t[48]=c,t[49]=_,t[50]=v,t[51]=b.retry,t[52]=B):B=t[52];let V;return t[53]!==l||t[54]!==x||t[55]!==S||t[56]!==C||t[57]!==z||t[58]!==B||t[59]!==k?(V=(0,g.jsxs)(`section`,{"aria-live":k,"data-recording-outcome":x,className:S,children:[C,z,B,l]}),t[53]=l,t[54]=x,t[55]=S,t[56]=C,t[57]=z,t[58]=B,t[59]=k,t[60]=V):V=t[60],V}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`))}function M(e){if((e?.epochs?.length??0)>1){let t=e?.epochs?.[0]?.savedThroughMs;return Number.isFinite(t)&&t>=0?t:null}let t=e?.mediaCoverage;return t?.version===1&&t.committedChunkCount===e?.chunkCount&&Number.isFinite(t.verifiedThroughMs)&&t.verifiedThroughMs>=0&&Number.isFinite(t.observedThroughMs)&&t.observedThroughMs>=t.verifiedThroughMs?t.verifiedThroughMs:null}function N(e){let{phase:t,detail:n}=e,r=e.draft??e.locallyFinalized,i=r?.saveOutcome===`interrupted`,a=t===`recording`?`recording`:t===`paused`?`paused`:t===`requesting_permission`||t===`waiting_for_audio`?`waitingAudio`:t===`stopping`?`stopping`:t===`error`||i?`interrupted`:`stopped`,o=M(r),s=!!r?.chunkCount&&r.state!==`recording`&&r.saveOutcome===`complete`&&(t===`stopped`||t===`idle`),c=t===`error`||r?.saveOutcome===`incomplete`?`saveFailed`:s?`localComplete`:o!==null&&o>0?`savedThrough`:r?.chunkCount?`savedUnknown`:`saving`,l=!!n?.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,u=n?.discussion.audioDeletedAt?`failed`:l?`available`:e.online?e.syncStage:`offline`,d=n?.discussion.status,f=d===`completed`?`aiComplete`:d===`needs_attention`?`aiFailed`:n?.processing?.nextAttemptAt?`aiRetrying`:d===`organizing`?`analyzing`:d===`sealing`?`transcribing`:a===`recording`&&(!e.liveAvailable||e.pendingText>0||(e.transcript?.stats?.failed??0)>0)?`textDelayed`:a===`recording`?`liveText`:`waitingSource`,p=!!r?.chunkCount&&(o===null||r?.mediaCoverage?.status!==`verified`);return{capture:a,save:c,sync:u,ai:f,hasInterruptions:(r?.epochs?.length??0)>1,savedThroughMs:o,localComplete:s,interrupted:i,timingUncertain:p}}var P=new Set([408125543,357149030,374648427,174,524531317,160]),F=16*1024*1024;function I(e,t,n=!1){if(t>=e.length)return;let r=1;for(;r<=8&&!(e[t]&128>>r-1);)r++;if(r>(n?4:8))throw Error(`Invalid EBML integer`);if(t+r>e.length)return;let i=n?e[t]:e[t]&255>>r,a=!n&&i===255>>r;for(let n=1;n<r;n++)i=i*256+e[t+n],a&&=e[t+n]===255;if(!a&&!Number.isSafeInteger(i))throw Error(`Oversized EBML integer`);return{value:i,width:r,unknown:a}}function L(e){if(!e.length||e.length>6)throw Error(`Invalid media timestamp`);return e.reduce((e,t)=>e*256+t,0)}var R=class{mimeType;pending=new Uint8Array;offset=0;stack=[];timeScaleMs=1;clusterTime=0;track=0;trackType=0;opus=!1;audioTrack=0;observed=0;decoded=0;lastStart=-1/0;prefix=0;failed=!1;gap=!1;constructor(e){this.mimeType=e}snapshot(){return{version:1,verifiedThroughMs:Math.floor(this.prefix),observedThroughMs:Math.floor(this.observed),status:this.gap?`gap`:this.failed||!this.audioTrack||!this.observed?`unknown`:`verified`}}packetClock(){return{durationMs:Math.floor(this.decoded),verified:!this.failed&&!!this.audioTrack&&this.decoded>0}}append(e){if(this.failed||!this.mimeType.includes(`webm`))return this.failed=!0,this.snapshot();let t=new Uint8Array(this.pending.length+e.length);t.set(this.pending),t.set(e,this.pending.length),this.pending=t;let n=0;try{for(;n<t.length;){let e=this.offset+n;for(;this.stack.length&&e>=this.stack.at(-1).end;)this.stack.pop();let r=I(t,n,!0);if(!r)break;let i=I(t,n+r.width);if(!i)break;let a=n+r.width+i.width;if(this.stack.length&&this.offset+a+(i.unknown?0:i.value)>this.stack.at(-1).end)throw Error(`Element exceeds its container`);if(P.has(r.value)){if(r.value===160)throw Error(`BlockGroup padding needs separate verification`);if(r.value===524531317){let e=this.stack.findIndex(e=>e.id===524531317);e>=0&&(this.stack.length=e),this.clusterTime=0}if(r.value===174&&(this.track=0,this.trackType=0,this.opus=!1),this.stack.length>12)throw Error(`Excessive media nesting`);this.stack.push({id:r.value,end:i.unknown?1/0:this.offset+a+i.value}),n=a;continue}if(i.unknown||i.value>F)throw Error(`Unsupported media element`);if(a+i.value>t.length)break;let o=t.subarray(a,a+i.value);if(r.value===2807729&&(this.timeScaleMs=L(o)/1e6,!this.timeScaleMs))throw Error(`Invalid media time scale`);if(r.value===22186&&L(o)!==0)throw Error(`Codec delay needs separate verification`);if(r.value===215&&(this.track=L(o)),r.value===131&&(this.trackType=L(o)),r.value===134&&(this.opus=new TextDecoder().decode(o)===`A_OPUS`),this.track&&this.trackType===2&&this.opus){if(this.audioTrack&&this.audioTrack!==this.track)throw Error(`Multiple audio tracks`);this.audioTrack=this.track}r.value===231&&(this.clusterTime=L(o)),(r.value===163||r.value===161)&&this.block(o),n=a+i.value}if(t.length-n>F)throw Error(`Incomplete oversized media element`)}catch{this.failed=!0}return this.offset+=n,this.pending=this.failed?new Uint8Array:t.slice(n),this.snapshot()}block(e){let t=I(e,0);if(!t||e.length<t.width+4||t.value!==this.audioTrack)throw Error(`Unsupported media block`);let n=t.width;if(e[n+2]&6)throw Error(`Laced audio needs separate verification`);let r=new DataView(e.buffer,e.byteOffset+n,2).getInt16(0),i=e.subarray(n+3),a=i[0]>>3,o=a>=16?2.5*2**(a&3):a>=12?10*2**(a&1):[10,20,40,60][a&3],s=i[0]&3,c=s===0?1:s===3?(i[1]??0)&63:2,l=o*c;if(!c||l>120||s===3&&i.length<2)throw Error(`Invalid Opus packet`);let u=(this.clusterTime+r)*this.timeScaleMs,d=u+l;if(!Number.isFinite(d)||u<0||u<=this.lastStart)throw Error(`Non-monotonic media time`);let f=Math.min(1,this.timeScaleMs),p=u-this.decoded;(p>0||p<-f)&&(this.gap=!0),this.lastStart=u,this.decoded+=l,this.observed=Math.max(this.observed,d),this.gap||(this.prefix=Math.min(this.decoded,this.observed))}},z=`xopc-discussion-drafts`,B=2,V=`drafts`,H=`chunks`,U=`segments`;function W(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error??Error(`IndexedDB request failed`))})}function G(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onabort=()=>n(e.error??Error(`IndexedDB transaction aborted`)),e.onerror=()=>n(e.error??Error(`IndexedDB transaction failed`))})}function K(){return typeof indexedDB>`u`?Promise.reject(Error(`Local recording storage is unavailable`)):new Promise((e,t)=>{let n=indexedDB.open(z,B);n.onupgradeneeded=e=>{if(e.oldVersion!==0){n.transaction?.abort(),t(Error(`Unsupported recording database version`));return}let r=n.result;r.objectStoreNames.contains(V)||r.createObjectStore(V,{keyPath:`id`}),r.objectStoreNames.contains(H)||r.createObjectStore(H,{keyPath:[`draftId`,`index`]}).createIndex(`draftId`,`draftId`),r.objectStoreNames.contains(U)||r.createObjectStore(U,{keyPath:[`draftId`,`sequence`]}).createIndex(`draftId`,`draftId`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`Could not open local recording storage`))})}async function q(e){let t=await K();try{let n=t.transaction(V,`readwrite`,{durability:`strict`});n.objectStore(V).put(e),await G(n)}finally{t.close()}}async function J(e,t){let n=await K();try{let r=n.transaction(t?[H,V]:[H],`readwrite`,{durability:`strict`}),i=G(r);try{r.objectStore(H).add(e),t&&r.objectStore(V).put(t),await i}catch(e){try{r.abort()}catch{}throw await i.catch(()=>void 0),e}}finally{n.close()}}async function re(){let e=await K();try{let t=e.transaction(V,`readonly`),n=G(t),r=await W(t.objectStore(V).getAll());return await n,r.sort((e,t)=>t.updatedAt-e.updatedAt)}finally{e.close()}}async function ie(e,t){let n=await K();try{let r=n.transaction(H,`readonly`),i=G(r),a=await W(r.objectStore(H).get([e,t]));return await i,a}finally{n.close()}}async function ae(e){let t=await K();try{let n=t.transaction(U,`readwrite`);n.objectStore(U).put(e),await G(n)}finally{t.close()}}async function oe(e){let t=await K();try{let n=t.transaction(U,`readonly`),r=G(n),i=await W(n.objectStore(U).index(`draftId`).getAll(e));return await r,i.sort((e,t)=>e.sequence-t.sequence)}finally{t.close()}}async function se(e,t){let n=await K();try{let r=n.transaction(U,`readwrite`);r.objectStore(U).delete([e,t]),await G(r)}finally{n.close()}}async function ce(e){let t=await K();try{let n=t.transaction([V,H,U],`readwrite`);n.objectStore(V).delete(e);let r=n.objectStore(H),i=r.index(`draftId`).openKeyCursor(IDBKeyRange.only(e));i.onsuccess=()=>{let e=i.result;e&&(r.delete(e.primaryKey),e.continue())};let a=n.objectStore(U),o=a.index(`draftId`).openKeyCursor(IDBKeyRange.only(e));o.onsuccess=()=>{let e=o.result;e&&(a.delete(e.primaryKey),e.continue())},await G(n)}finally{t.close()}}async function le(e){let t=await K();try{let n=t.transaction([V,H],`readonly`),r=G(n),i=n.objectStore(V).get(e),a=n.objectStore(H).index(`draftId`).openKeyCursor(IDBKeyRange.only(e)),o=0,s=!1,c=new Promise((e,t)=>{a.onerror=()=>t(a.error),a.onsuccess=()=>{let t=a.result;if(!t){e();return}let[,n]=t.primaryKey;n!==o&&(s=!0),o+=1,t.continue()}}),[l]=await Promise.all([W(i),c,r]);if(!l)throw Error(`The recording draft is missing`);if(s||o!==l.chunkCount)throw Error(`Local recording has missing chunks. Retained audio has not been deleted.`);if(!o)throw Error(`No audio was saved before the recording stopped`);let u=M(l)===null?void 0:l.mediaCoverage,d=l.epochs;if(l.mediaCoverage?.status===`gap`||(d?.length??0)>1){let n=(d?.length?d:[{firstChunk:0,mimeType:l.mimeType,startedAt:l.startedAt}]).map(e=>({...e}));for(let r=0;r<n.length;r++){let i=n[r],a=n[r+1]?.firstChunk??o;if(!Number.isInteger(i.firstChunk)||r===0&&i.firstChunk!==0||i.firstChunk<0||i.firstChunk>a||a>o)throw Error(`Local recording has invalid audio boundaries. Retained audio has not been deleted.`);let s=new R(i.mimeType);for(let n=i.firstChunk;n<a;n++){let r=t.transaction(H,`readonly`),i=G(r),a=await W(r.objectStore(H).get([e,n]));if(await i,!a)throw Error(`Local recording has missing chunks. Retained audio has not been deleted.`);s.append(new Uint8Array(await a.blob.arrayBuffer()))}r<n.length-1?i.savedThroughMs=s.snapshot().verifiedThroughMs:u={...s.snapshot(),committedChunkCount:o}}d?.length&&(d=n)}return{...l,epochs:d,mediaCoverage:u,saveOutcome:l.state===`recording`?`interrupted`:l.saveOutcome}}finally{t.close()}}var Y=()=>window.dispatchEvent(new Event(`discussion-annotations-changed`));async function ue(){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 X(e,t){let n=await ue();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 de(e){return X(!1,(t,n)=>{let r=t.index(`recordingId`).getAll(e);r.onsuccess=()=>n(r.result)})}async function fe(e,t,n){await X(!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()}}),Y()}function pe(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 me(e,t,n){await X(!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()}}),Y()}async function Z(e,t,n=!1){await X(!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()}}),Y()}var Q=new Map;function he(e,t){let i=`${e}:${t}`;if(Q.has(i))return Q.get(i);let a=(async()=>{for(let i=0;i<5;i++){let i=(await de(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(()=>Q.delete(i));return Q.set(i,a),a}async function ge(e){let t=await crypto.subtle.digest(`SHA-256`,await e.arrayBuffer());return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}async function $(e,t){let n=t,r=performance.now()+5*6e4;for(;n.state===`queued`||n.state===`running`;){if(performance.now()>=r)throw Error(`Recording is still processing. Your draft is saved; retry to check its result.`);await new Promise(e=>setTimeout(e,1e3)),n=await j(e)}if(n.state!==`completed`)throw Error(n.error??`Recording processing was cancelled`);return S(e)}async function _e(e,t,n,r=!0,i){if(i?.(`uploading`),r){let e=await S(t);if(e.discussion.audioDeletedAt)throw Error(`Original recording was deleted`);if(e.discussion.audioAttachmentId)return i?.(`available`),e;if(e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`){i?.(`verifying`);let n=await $(t,e.recordingJob);if(!n.discussion.audioAttachmentId||n.discussion.audioDeletedAt)throw Error(`Original audio attachment is not confirmed`);return i?.(`available`),n}}let a=new Map((await O(t)).map(e=>[e.sequence,e]));for(let r=0;r<e.chunkCount;r+=1){let i=await ie(e.id,r);if(!i)throw Error(`Missing local recording chunk ${r}`);if(i.blob.size>8388608)throw Error(`Recording chunk exceeds the supported size`);let o=await ge(i.blob);if(a.has(r)&&a.get(r).sha256!==o)throw Error(`Stored recording differs from this draft`);a.has(r)||await k(t,r,i.blob,o),n(Math.round((r+1)/e.chunkCount*100))}if(r){i?.(`verifying`),await q({...e,serverDiscussionId:t,sealRequested:!0});let n=await $(t,await A(t,{lastSequence:e.lastSequence,chunkCount:e.chunkCount,...e.epochs&&(e.epochs.length>1||e.fileName)?{epochs:e.epochs}:{},mimeType:e.mimeType,fileName:e.fileName??`meeting-${e.startedAt}.${e.mimeType.includes(`mp4`)?`m4a`:e.mimeType.includes(`ogg`)?`ogg`:`webm`}`}));if(!n.discussion.audioAttachmentId||n.discussion.audioDeletedAt)throw Error(`Original audio attachment is not confirmed`);return i?.(`available`),n}i?.(`pending`)}async function ve(e,t){let n=await navigator.storage?.estimate?.();if(n?.quota&&n.usage!==void 0&&n.quota-n.usage<e.size*1.1)throw Error(`Not enough local storage to safely import this recording`);let r={mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`,mp4:`audio/mp4`,ogg:`audio/ogg`,webm:`audio/webm`},i=e.name.split(`.`).pop()?.toLowerCase()??``,a=e.type.toLowerCase().split(`;`)[0],o=r[i]??(a===`audio/x-wav`?`audio/wav`:a);if(!Object.values(r).includes(o))throw Error(`Unsupported audio format`);let s=Date.now(),c={id:t,mimeType:o,fileName:e.name,startedAt:s,updatedAt:s,durationMs:0,epochs:[{firstChunk:0,startedAt:s,mimeType:o}],chunkCount:0,lastSequence:-1,state:`stopped`};try{for(let n=0;n<e.size;n+=f)await J({draftId:t,index:c.chunkCount,blob:e.slice(n,n+f),createdAt:Date.now()}),c.chunkCount+=1;return await q(c),c}catch(e){throw await ce(t),e}}export{v as A,S as C,E as D,w as E,f as F,u as I,l as L,m as M,h as N,D as O,d as P,c as R,x as S,C as T,ae as _,de as a,M as b,fe as c,ie as d,re as f,J as g,q as h,Z as i,_ as j,T as k,ce as l,le as m,_e as n,pe as o,oe as p,he as r,me as s,ve as t,se as u,R as v,y as w,b as x,N as y,s as z};
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-Cit_aHqC.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`}]]),u=7200*1e3,d=1024*1024*1024,f=8*1024*1024;function p(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 m=`open-discussion-capture`;function h(e){window.dispatchEvent(new CustomEvent(m,{detail:e?{projectId:e}:{}}))}var ee=e(),te={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.`]},ne={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,ee.c)(61),{input:n,zh:r,compact:i,busy:s,onRetry:c,children:l,nextAttemptAt:u,context:d}=e,f=i!==void 0&&i,m=s!==void 0&&s,h=d===void 0?`capture`:d,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[0]!==h||t[1]!==n||t[2]!==r){b=p(n),y=te[b.stage];let e;t[16]===r?e=t[17]:(e=e=>ne[e][+!r],t[16]=r,t[17]=e),_=e,v=`retry_${[`analysis_failed`,`transcription_failed`,`verify_failed`].includes(b.stage)?b.stage:b.retry}`,k=`polite`,x=b.stage,S=h===`note`?`mx-auto w-full max-w-[46rem] text-fg`:`rounded-xl bg-surface-inset p-3 text-fg`,C=h===`capture`?(0,g.jsx)(`p`,{className:`mb-1 text-sm font-medium`,children:_(`leave_${b.leave}`)}):null,E=`group`,D=h,O=h===`note`&&(b.stage.endsWith(`_failed`)||b.stage.includes(`retry`)||b.stage===`local_partial`)?!0:void 0,T=`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`,w=b.stage.endsWith(`_failed`)||b.stage===`local_partial`?`bg-danger`:`bg-accent`,t[0]=h,t[1]=n,t[2]=r,t[3]=_,t[4]=v,t[5]=y,t[6]=b,t[7]=x,t[8]=S,t[9]=C,t[10]=w,t[11]=T,t[12]=E,t[13]=D,t[14]=O,t[15]=k}else _=t[3],v=t[4],y=t[5],b=t[6],x=t[7],S=t[8],C=t[9],w=t[10],T=t[11],E=t[12],D=t[13],O=t[14],k=t[15];let A=`size-1.5 shrink-0 rounded-full ${w}`,j;t[18]===A?j=t[19]:(j=(0,g.jsx)(`span`,{className:A,"aria-hidden":!0}),t[18]=A,t[19]=j);let M=y[+!r],N;t[20]===M?N=t[21]:(N=(0,g.jsx)(`span`,{className:`min-w-0 flex-1`,children:M}),t[20]=M,t[21]=N);let P;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(P=(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]=P):P=t[22];let F;t[23]!==j||t[24]!==N||t[25]!==T?(F=(0,g.jsxs)(`summary`,{className:T,children:[j,N,P]}),t[23]=j,t[24]=N,t[25]=T,t[26]=F):F=t[26];let I;t[27]!==h||t[28]!==_||t[29]!==b.leave?(I=h===`note`?(0,g.jsx)(`p`,{children:_(`leave_${b.leave}`)}):null,t[27]=h,t[28]=_,t[29]=b.leave,t[30]=I):I=t[30];let L;t[31]!==f||t[32]!==u||t[33]!==_||t[34]!==y||t[35]!==b||t[36]!==r?(L=f?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{children:y[r?2:3]}),u&&Number.isFinite(u)?(0,g.jsxs)(`p`,{children:[r?`下次自动重试时间:`:`Next automatic retry: `,new Date(u).toLocaleTimeString(r?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}):null,b.leave===`local`?(0,g.jsx)(`p`,{children:_(`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:[_(e),` · `,e===`note`&&b.note&&b.stale?_(`old_note`):_(b[e]?`available`:`pending`)]},e))})]}),t[31]=f,t[32]=u,t[33]=_,t[34]=y,t[35]=b,t[36]=r,t[37]=L):L=t[37];let R;t[38]!==I||t[39]!==L?(R=(0,g.jsxs)(`div`,{className:`space-y-2 pb-3 text-xs leading-5 text-fg-muted`,children:[I,L]}),t[38]=I,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==F||t[42]!==R||t[43]!==E||t[44]!==D||t[45]!==O?(z=(0,g.jsxs)(`details`,{className:E,open:O,children:[F,R]},D),t[41]=F,t[42]=R,t[43]=E,t[44]=D,t[45]=O,t[46]=z):z=t[46];let B;t[47]!==m||t[48]!==c||t[49]!==_||t[50]!==v||t[51]!==b.retry?(B=b.retry!==`none`&&c?(0,g.jsx)(o,{className:`min-h-11`,disabled:m,onClick:()=>c(b.retry),children:_(v)}):null,t[47]=m,t[48]=c,t[49]=_,t[50]=v,t[51]=b.retry,t[52]=B):B=t[52];let V;return t[53]!==l||t[54]!==x||t[55]!==S||t[56]!==C||t[57]!==z||t[58]!==B||t[59]!==k?(V=(0,g.jsxs)(`section`,{"aria-live":k,"data-recording-outcome":x,className:S,children:[C,z,B,l]}),t[53]=l,t[54]=x,t[55]=S,t[56]=C,t[57]=z,t[58]=B,t[59]=k,t[60]=V):V=t[60],V}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`))}function M(e){if((e?.epochs?.length??0)>1){let t=e?.epochs?.[0]?.savedThroughMs;return Number.isFinite(t)&&t>=0?t:null}let t=e?.mediaCoverage;return t?.version===1&&t.committedChunkCount===e?.chunkCount&&Number.isFinite(t.verifiedThroughMs)&&t.verifiedThroughMs>=0&&Number.isFinite(t.observedThroughMs)&&t.observedThroughMs>=t.verifiedThroughMs?t.verifiedThroughMs:null}function N(e){let{phase:t,detail:n}=e,r=e.draft??e.locallyFinalized,i=r?.saveOutcome===`interrupted`,a=t===`recording`?`recording`:t===`paused`?`paused`:t===`requesting_permission`||t===`waiting_for_audio`?`waitingAudio`:t===`stopping`?`stopping`:t===`error`||i?`interrupted`:`stopped`,o=M(r),s=!!r?.chunkCount&&r.state!==`recording`&&r.saveOutcome===`complete`&&(t===`stopped`||t===`idle`),c=t===`error`||r?.saveOutcome===`incomplete`?`saveFailed`:s?`localComplete`:o!==null&&o>0?`savedThrough`:r?.chunkCount?`savedUnknown`:`saving`,l=!!n?.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,u=n?.discussion.audioDeletedAt?`failed`:l?`available`:e.online?e.syncStage:`offline`,d=n?.discussion.status,f=d===`completed`?`aiComplete`:d===`needs_attention`?`aiFailed`:n?.processing?.nextAttemptAt?`aiRetrying`:d===`organizing`?`analyzing`:d===`sealing`?`transcribing`:a===`recording`&&(!e.liveAvailable||e.pendingText>0||(e.transcript?.stats?.failed??0)>0)?`textDelayed`:a===`recording`?`liveText`:`waitingSource`,p=!!r?.chunkCount&&(o===null||r?.mediaCoverage?.status!==`verified`);return{capture:a,save:c,sync:u,ai:f,hasInterruptions:(r?.epochs?.length??0)>1,savedThroughMs:o,localComplete:s,interrupted:i,timingUncertain:p}}var P=new Set([408125543,357149030,374648427,174,524531317,160]),F=16*1024*1024;function I(e,t,n=!1){if(t>=e.length)return;let r=1;for(;r<=8&&!(e[t]&128>>r-1);)r++;if(r>(n?4:8))throw Error(`Invalid EBML integer`);if(t+r>e.length)return;let i=n?e[t]:e[t]&255>>r,a=!n&&i===255>>r;for(let n=1;n<r;n++)i=i*256+e[t+n],a&&=e[t+n]===255;if(!a&&!Number.isSafeInteger(i))throw Error(`Oversized EBML integer`);return{value:i,width:r,unknown:a}}function L(e){if(!e.length||e.length>6)throw Error(`Invalid media timestamp`);return e.reduce((e,t)=>e*256+t,0)}var R=class{mimeType;pending=new Uint8Array;offset=0;stack=[];timeScaleMs=1;clusterTime=0;track=0;trackType=0;opus=!1;audioTrack=0;observed=0;decoded=0;lastStart=-1/0;prefix=0;failed=!1;gap=!1;constructor(e){this.mimeType=e}snapshot(){return{version:1,verifiedThroughMs:Math.floor(this.prefix),observedThroughMs:Math.floor(this.observed),status:this.gap?`gap`:this.failed||!this.audioTrack||!this.observed?`unknown`:`verified`}}packetClock(){return{durationMs:Math.floor(this.decoded),verified:!this.failed&&!!this.audioTrack&&this.decoded>0}}append(e){if(this.failed||!this.mimeType.includes(`webm`))return this.failed=!0,this.snapshot();let t=new Uint8Array(this.pending.length+e.length);t.set(this.pending),t.set(e,this.pending.length),this.pending=t;let n=0;try{for(;n<t.length;){let e=this.offset+n;for(;this.stack.length&&e>=this.stack.at(-1).end;)this.stack.pop();let r=I(t,n,!0);if(!r)break;let i=I(t,n+r.width);if(!i)break;let a=n+r.width+i.width;if(this.stack.length&&this.offset+a+(i.unknown?0:i.value)>this.stack.at(-1).end)throw Error(`Element exceeds its container`);if(P.has(r.value)){if(r.value===160)throw Error(`BlockGroup padding needs separate verification`);if(r.value===524531317){let e=this.stack.findIndex(e=>e.id===524531317);e>=0&&(this.stack.length=e),this.clusterTime=0}if(r.value===174&&(this.track=0,this.trackType=0,this.opus=!1),this.stack.length>12)throw Error(`Excessive media nesting`);this.stack.push({id:r.value,end:i.unknown?1/0:this.offset+a+i.value}),n=a;continue}if(i.unknown||i.value>F)throw Error(`Unsupported media element`);if(a+i.value>t.length)break;let o=t.subarray(a,a+i.value);if(r.value===2807729&&(this.timeScaleMs=L(o)/1e6,!this.timeScaleMs))throw Error(`Invalid media time scale`);if(r.value===22186&&L(o)!==0)throw Error(`Codec delay needs separate verification`);if(r.value===215&&(this.track=L(o)),r.value===131&&(this.trackType=L(o)),r.value===134&&(this.opus=new TextDecoder().decode(o)===`A_OPUS`),this.track&&this.trackType===2&&this.opus){if(this.audioTrack&&this.audioTrack!==this.track)throw Error(`Multiple audio tracks`);this.audioTrack=this.track}r.value===231&&(this.clusterTime=L(o)),(r.value===163||r.value===161)&&this.block(o),n=a+i.value}if(t.length-n>F)throw Error(`Incomplete oversized media element`)}catch{this.failed=!0}return this.offset+=n,this.pending=this.failed?new Uint8Array:t.slice(n),this.snapshot()}block(e){let t=I(e,0);if(!t||e.length<t.width+4||t.value!==this.audioTrack)throw Error(`Unsupported media block`);let n=t.width;if(e[n+2]&6)throw Error(`Laced audio needs separate verification`);let r=new DataView(e.buffer,e.byteOffset+n,2).getInt16(0),i=e.subarray(n+3),a=i[0]>>3,o=a>=16?2.5*2**(a&3):a>=12?10*2**(a&1):[10,20,40,60][a&3],s=i[0]&3,c=s===0?1:s===3?(i[1]??0)&63:2,l=o*c;if(!c||l>120||s===3&&i.length<2)throw Error(`Invalid Opus packet`);let u=(this.clusterTime+r)*this.timeScaleMs,d=u+l;if(!Number.isFinite(d)||u<0||u<=this.lastStart)throw Error(`Non-monotonic media time`);let f=Math.min(1,this.timeScaleMs),p=u-this.decoded;(p>0||p<-f)&&(this.gap=!0),this.lastStart=u,this.decoded+=l,this.observed=Math.max(this.observed,d),this.gap||(this.prefix=Math.min(this.decoded,this.observed))}},z=`xopc-discussion-drafts`,B=2,V=`drafts`,H=`chunks`,U=`segments`;function W(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error??Error(`IndexedDB request failed`))})}function G(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onabort=()=>n(e.error??Error(`IndexedDB transaction aborted`)),e.onerror=()=>n(e.error??Error(`IndexedDB transaction failed`))})}function K(){return typeof indexedDB>`u`?Promise.reject(Error(`Local recording storage is unavailable`)):new Promise((e,t)=>{let n=indexedDB.open(z,B);n.onupgradeneeded=e=>{if(e.oldVersion!==0){n.transaction?.abort(),t(Error(`Unsupported recording database version`));return}let r=n.result;r.objectStoreNames.contains(V)||r.createObjectStore(V,{keyPath:`id`}),r.objectStoreNames.contains(H)||r.createObjectStore(H,{keyPath:[`draftId`,`index`]}).createIndex(`draftId`,`draftId`),r.objectStoreNames.contains(U)||r.createObjectStore(U,{keyPath:[`draftId`,`sequence`]}).createIndex(`draftId`,`draftId`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`Could not open local recording storage`))})}async function q(e){let t=await K();try{let n=t.transaction(V,`readwrite`,{durability:`strict`});n.objectStore(V).put(e),await G(n)}finally{t.close()}}async function J(e,t){let n=await K();try{let r=n.transaction(t?[H,V]:[H],`readwrite`,{durability:`strict`}),i=G(r);try{r.objectStore(H).add(e),t&&r.objectStore(V).put(t),await i}catch(e){try{r.abort()}catch{}throw await i.catch(()=>void 0),e}}finally{n.close()}}async function re(){let e=await K();try{let t=e.transaction(V,`readonly`),n=G(t),r=await W(t.objectStore(V).getAll());return await n,r.sort((e,t)=>t.updatedAt-e.updatedAt)}finally{e.close()}}async function ie(e,t){let n=await K();try{let r=n.transaction(H,`readonly`),i=G(r),a=await W(r.objectStore(H).get([e,t]));return await i,a}finally{n.close()}}async function ae(e){let t=await K();try{let n=t.transaction(U,`readwrite`);n.objectStore(U).put(e),await G(n)}finally{t.close()}}async function oe(e){let t=await K();try{let n=t.transaction(U,`readonly`),r=G(n),i=await W(n.objectStore(U).index(`draftId`).getAll(e));return await r,i.sort((e,t)=>e.sequence-t.sequence)}finally{t.close()}}async function se(e,t){let n=await K();try{let r=n.transaction(U,`readwrite`);r.objectStore(U).delete([e,t]),await G(r)}finally{n.close()}}async function ce(e){let t=await K();try{let n=t.transaction([V,H,U],`readwrite`);n.objectStore(V).delete(e);let r=n.objectStore(H),i=r.index(`draftId`).openKeyCursor(IDBKeyRange.only(e));i.onsuccess=()=>{let e=i.result;e&&(r.delete(e.primaryKey),e.continue())};let a=n.objectStore(U),o=a.index(`draftId`).openKeyCursor(IDBKeyRange.only(e));o.onsuccess=()=>{let e=o.result;e&&(a.delete(e.primaryKey),e.continue())},await G(n)}finally{t.close()}}async function le(e){let t=await K();try{let n=t.transaction([V,H],`readonly`),r=G(n),i=n.objectStore(V).get(e),a=n.objectStore(H).index(`draftId`).openKeyCursor(IDBKeyRange.only(e)),o=0,s=!1,c=new Promise((e,t)=>{a.onerror=()=>t(a.error),a.onsuccess=()=>{let t=a.result;if(!t){e();return}let[,n]=t.primaryKey;n!==o&&(s=!0),o+=1,t.continue()}}),[l]=await Promise.all([W(i),c,r]);if(!l)throw Error(`The recording draft is missing`);if(s||o!==l.chunkCount)throw Error(`Local recording has missing chunks. Retained audio has not been deleted.`);if(!o)throw Error(`No audio was saved before the recording stopped`);let u=M(l)===null?void 0:l.mediaCoverage,d=l.epochs;if(l.mediaCoverage?.status===`gap`||(d?.length??0)>1){let n=(d?.length?d:[{firstChunk:0,mimeType:l.mimeType,startedAt:l.startedAt}]).map(e=>({...e}));for(let r=0;r<n.length;r++){let i=n[r],a=n[r+1]?.firstChunk??o;if(!Number.isInteger(i.firstChunk)||r===0&&i.firstChunk!==0||i.firstChunk<0||i.firstChunk>a||a>o)throw Error(`Local recording has invalid audio boundaries. Retained audio has not been deleted.`);let s=new R(i.mimeType);for(let n=i.firstChunk;n<a;n++){let r=t.transaction(H,`readonly`),i=G(r),a=await W(r.objectStore(H).get([e,n]));if(await i,!a)throw Error(`Local recording has missing chunks. Retained audio has not been deleted.`);s.append(new Uint8Array(await a.blob.arrayBuffer()))}r<n.length-1?i.savedThroughMs=s.snapshot().verifiedThroughMs:u={...s.snapshot(),committedChunkCount:o}}d?.length&&(d=n)}return{...l,epochs:d,mediaCoverage:u,saveOutcome:l.state===`recording`?`interrupted`:l.saveOutcome}}finally{t.close()}}var Y=()=>window.dispatchEvent(new Event(`discussion-annotations-changed`));async function ue(){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 X(e,t){let n=await ue();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 de(e){return X(!1,(t,n)=>{let r=t.index(`recordingId`).getAll(e);r.onsuccess=()=>n(r.result)})}async function fe(e,t,n){await X(!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()}}),Y()}function pe(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 me(e,t,n){await X(!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()}}),Y()}async function Z(e,t,n=!1){await X(!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()}}),Y()}var Q=new Map;function he(e,t){let i=`${e}:${t}`;if(Q.has(i))return Q.get(i);let a=(async()=>{for(let i=0;i<5;i++){let i=(await de(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(()=>Q.delete(i));return Q.set(i,a),a}async function ge(e){let t=await crypto.subtle.digest(`SHA-256`,await e.arrayBuffer());return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}async function $(e,t){let n=t,r=performance.now()+5*6e4;for(;n.state===`queued`||n.state===`running`;){if(performance.now()>=r)throw Error(`Recording is still processing. Your draft is saved; retry to check its result.`);await new Promise(e=>setTimeout(e,1e3)),n=await j(e)}if(n.state!==`completed`)throw Error(n.error??`Recording processing was cancelled`);return S(e)}async function _e(e,t,n,r=!0,i){if(i?.(`uploading`),r){let e=await S(t);if(e.discussion.audioDeletedAt)throw Error(`Original recording was deleted`);if(e.discussion.audioAttachmentId)return i?.(`available`),e;if(e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`){i?.(`verifying`);let n=await $(t,e.recordingJob);if(!n.discussion.audioAttachmentId||n.discussion.audioDeletedAt)throw Error(`Original audio attachment is not confirmed`);return i?.(`available`),n}}let a=new Map((await O(t)).map(e=>[e.sequence,e]));for(let r=0;r<e.chunkCount;r+=1){let i=await ie(e.id,r);if(!i)throw Error(`Missing local recording chunk ${r}`);if(i.blob.size>8388608)throw Error(`Recording chunk exceeds the supported size`);let o=await ge(i.blob);if(a.has(r)&&a.get(r).sha256!==o)throw Error(`Stored recording differs from this draft`);a.has(r)||await k(t,r,i.blob,o),n(Math.round((r+1)/e.chunkCount*100))}if(r){i?.(`verifying`),await q({...e,serverDiscussionId:t,sealRequested:!0});let n=await $(t,await A(t,{lastSequence:e.lastSequence,chunkCount:e.chunkCount,...e.epochs&&(e.epochs.length>1||e.fileName)?{epochs:e.epochs}:{},mimeType:e.mimeType,fileName:e.fileName??`meeting-${e.startedAt}.${e.mimeType.includes(`mp4`)?`m4a`:e.mimeType.includes(`ogg`)?`ogg`:`webm`}`}));if(!n.discussion.audioAttachmentId||n.discussion.audioDeletedAt)throw Error(`Original audio attachment is not confirmed`);return i?.(`available`),n}i?.(`pending`)}async function ve(e,t){let n=await navigator.storage?.estimate?.();if(n?.quota&&n.usage!==void 0&&n.quota-n.usage<e.size*1.1)throw Error(`Not enough local storage to safely import this recording`);let r={mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`,mp4:`audio/mp4`,ogg:`audio/ogg`,webm:`audio/webm`},i=e.name.split(`.`).pop()?.toLowerCase()??``,a=e.type.toLowerCase().split(`;`)[0],o=r[i]??(a===`audio/x-wav`?`audio/wav`:a);if(!Object.values(r).includes(o))throw Error(`Unsupported audio format`);let s=Date.now(),c={id:t,mimeType:o,fileName:e.name,startedAt:s,updatedAt:s,durationMs:0,epochs:[{firstChunk:0,startedAt:s,mimeType:o}],chunkCount:0,lastSequence:-1,state:`stopped`};try{for(let n=0;n<e.size;n+=f)await J({draftId:t,index:c.chunkCount,blob:e.slice(n,n+f),createdAt:Date.now()}),c.chunkCount+=1;return await q(c),c}catch(e){throw await ce(t),e}}export{v as A,S as C,E as D,w as E,f as F,u as I,l as L,m as M,h as N,D as O,d as P,c as R,x as S,C as T,ae as _,de as a,M as b,fe as c,ie as d,re as f,J as g,q as h,Z as i,_ as j,T as k,ce as l,le as m,_e as n,pe as o,oe as p,he as r,me as s,ve as t,se as u,R as v,y as w,b as x,N as y,s as z};
|
package/dist/gateway/static/root/assets/{registry-api-pQ0eInzG.js → registry-api-BEnvt9-6.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-CdRzEUwF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";import{i as t}from"./locale-store-
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{i as t}from"./locale-store-Cit_aHqC.js";import{t as n}from"./gateway-startup-retry-2jU7zCyx.js";async function r(){let e=await n(t(`/api/models`));if(!e.ok)throw Error(`Models: HTTP ${e.status}`);return(await e.json()).payload?.models??[]}var i=null,a=0,o=null,s=6e4,c=`gateway-configured-models`;async function l(){i=null,a=0;let{mutate:t}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-CdRzEUwF.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await t(c)}async function u(e=!1){if(!e&&i&&Date.now()<a)return i;if(e){let e=await r();return i=e,a=Date.now()+s,e}return o||(o=r().then(e=>(i=e,a=Date.now()+s,e)).finally(()=>{o=null}),o)}export{u as n,l as r,c 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{m as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as s,n as c}from"./locale-store-DIBIYLnI.js";import{t as l}from"./messages-BDBGlBKh.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./arrow-right-DSSvoX71.js";import{t as _}from"./check-DUBLcKHA.js";import{t as v}from"./chevron-down-ccbiQQz_.js";import{t as y}from"./chevron-right-BweFrslA.js";import{t as b}from"./circle-BoO4YvTx.js";import{t as x}from"./copy-Dv6d4Dvw.js";import{t as S}from"./external-link-DjqjBmc3.js";import{t as C}from"./secret-input-DsjfQmDn.js";import{t as w}from"./globe-DSSGFWFn.js";import{t as T}from"./key-round-DWbpyU2U.js";import{t as E}from"./loader-circle-CifKLtgG.js";import{t as D}from"./network-BUQLY1BV.js";import{t as O}from"./power-ZI-pBczI.js";import{t as k}from"./server-BlHCBjiE.js";import{t as A}from"./shield-B1sI_cxl.js";import{t as j}from"./smartphone-DSSsQFqA.js";import{t as M}from"./terminal-oKqqZdiG.js";import{t as N}from"./triangle-alert-2JXFNNKU.js";import{t as P}from"./cn-0WouolD0.js";import{i as F}from"./vendor-swr-CdRzEUwF.js";import{n as I,r as L}from"./gateway-config-swr-Dk3FtNv1.js";import{t as R}from"./button-Cc4hUNTt.js";import{i as z,o as B}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as V}from"./copy-to-clipboard-HOJ79TWv.js";import{t as H}from"./page-tabs-oeTY7z3_.js";import{r as U}from"./settings-form-draft-Dy10ldo8.js";import{t as W}from"./confirm-dialog-DrA5mTQp.js";import{t as ee}from"./copy-text-row-CpiRzq4G.js";import{n as G}from"./settings-mode-store-DWRhupcY.js";import{r as K}from"./providers-api-C26HgxZY.js";import{a as q,n as te,r as ne}from"./oauth-api-enDU_32p.js";import{t as J}from"./settings-advanced-section-CnGJr2xp.js";import{n as re,r as ie,t as ae}from"./oauth-authorization-window-o6URRos4.js";import{n as oe,t as se}from"./settings-page-header-wL2jvs-y.js";import{t as ce}from"./settings-page-layout-BkUQVmyY.js";import{n as Y,r as le,t as ue}from"./settings-form-section-num14vSv.js";import{S as de,_ as X,a as fe,b as pe,c as me,d as he,i as ge,n as _e,o as ve,r as ye,s as be,t as xe,x as Se,y as Ce}from"./tunnel-api-CIte6n0U.js";import{t as we}from"./settings-advanced-gate-DjyibJZ1.js";var Z=e(t(),1),Q=n(),$=r();function Te(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Ee(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=P(`inline-flex items-center gap-1.5 text-xs font-medium`,Te(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=P(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function De(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=c(ke),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!s(Oe),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={refreshInterval:3e4},t[2]=u):u=t[2];let{data:d}=F(o?`exposure-status`:null,Se,u),f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f={refreshInterval:15e3},t[3]=f):f=t[3];let{data:p}=F(o?`tunnel-status`:null,_e,f),m=L(o);if(!o)return null;let h=d?.tailscale.active===!0,g=p?.state,_=p?.enabled&&g===`connected`,v=p?.enabled&&(g===`connecting`||g===`reconnecting`||!!p?.startProgress||!!p?.frpcDownload),y=m.data?.payload?.config,b=!!(y&&typeof y==`object`&&!Array.isArray(y)&&y.gateway?.publicUrl),x=h?`active`:`off`,S=h?a.statusActive:a.statusOff,C;t[4]!==a.tailscaleCardTitle||t[5]!==x||t[6]!==S?(C={tab:`tailscale`,icon:w,title:a.tailscaleCardTitle,kind:x,statusLabel:S},t[4]=a.tailscaleCardTitle,t[5]=x,t[6]=S,t[7]=C):C=t[7];let T=_?`active`:v?`connecting`:`off`,E=_?a.statusActive:v?a.statusConnecting:a.statusOff,O;t[8]!==a.publicCardTitle||t[9]!==T||t[10]!==E?(O={tab:`public`,icon:D,title:a.publicCardTitle,kind:T,statusLabel:E},t[8]=a.publicCardTitle,t[9]=T,t[10]=E,t[11]=O):O=t[11];let j=b?`active`:`off`,N=b?a.statusActive:a.statusOff,I;t[12]!==a.reverseProxyCardTitle||t[13]!==j||t[14]!==N?(I={tab:`reverse-proxy`,icon:A,title:a.reverseProxyCardTitle,kind:j,statusLabel:N},t[12]=a.reverseProxyCardTitle,t[13]=j,t[14]=N,t[15]=I):I=t[15];let R;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(R={tab:`ssh`,icon:M,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=R):R=t[18];let z;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(z={tab:`lan`,icon:k,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=z):z=t[21];let B;t[22]!==I||t[23]!==R||t[24]!==z||t[25]!==C||t[26]!==O?(B=[C,O,I,R,z],t[22]=I,t[23]=R,t[24]=z,t[25]=C,t[26]=O,t[27]=B):B=t[27];let V=B,H;return t[28]!==V||t[29]!==n?(H=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:V.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:P(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Ee,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=V,t[29]=n,t[30]=H):H=t[30],H}function Oe(e){return e.conversationId}function ke(e){return e.language}function Ae(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=P(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let d;t[5]!==i||t[6]!==s?(d=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=d):d=t[7];let f;t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===r?p=t[12]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(y,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=h):h=t[16];let g;return t[17]!==o||t[18]!==l||t[19]!==m?(g=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,m,h]}),t[17]=o,t[18]=l,t[19]=m,t[20]=g):g=t[20],g}function je(e){let t=(0,Q.c)(78),{onOpenTab:n}=e,r=c(Pe),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,u=!!s(Ne),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:3e4},t[2]=d):d=t[2];let{data:f}=F(u?`exposure-status`:null,Se,d),p;t[3]===f?.conflicts?p=t[4]:(p=f?.conflicts??[],t[3]=f?.conflicts,t[4]=p);let m=p;if(!u){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let h;t[7]===n?h=t[8]:(h=(0,$.jsx)(De,{onOpenTab:n}),t[7]=n,t[8]=h);let g;t[9]!==m||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(g=m.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:m.map(Me)})]}):null,t[9]=m,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=g):g=t[12];let _;t[13]===o.pickMethod?_=t[14]:(_=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=_);let v;t[15]===n?v=t[16]:(v=()=>n(`tailscale`),t[15]=n,t[16]=v);let y;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==v?(y=(0,$.jsx)(Ae,{icon:w,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:v}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=v,t[21]=y):y=t[21];let b;t[22]===n?b=t[23]:(b=()=>n(`public`),t[22]=n,t[23]=b);let x;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==b?(x=(0,$.jsx)(Ae,{icon:D,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:b}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=b,t[27]=x):x=t[27];let S;t[28]===n?S=t[29]:(S=()=>n(`reverse-proxy`),t[28]=n,t[29]=S);let C;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==S?(C=(0,$.jsx)(Ae,{icon:A,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:S}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=S,t[33]=C):C=t[33];let T;t[34]===n?T=t[35]:(T=()=>n(`ssh`),t[34]=n,t[35]=T);let E;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==T?(E=(0,$.jsx)(Ae,{icon:M,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:T}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=T,t[39]=E):E=t[39];let O;t[40]!==a.advanced.proxyBody||t[41]!==a.advanced.proxyTitle||t[42]!==C||t[43]!==E?(O=(0,$.jsxs)(J,{title:a.advanced.proxyTitle,summary:a.advanced.proxyBody,children:[C,E]}),t[40]=a.advanced.proxyBody,t[41]=a.advanced.proxyTitle,t[42]=C,t[43]=E,t[44]=O):O=t[44];let j;t[45]===n?j=t[46]:(j=()=>n(`lan`),t[45]=n,t[46]=j);let N;t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==j?(N=(0,$.jsx)(Ae,{icon:k,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:j}),t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=j,t[50]=N):N=t[50];let P;t[51]!==x||t[52]!==O||t[53]!==N||t[54]!==y?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[y,x,O,N]}),t[51]=x,t[52]=O,t[53]=N,t[54]=y,t[55]=P):P=t[55];let I;t[56]!==P||t[57]!==_?(I=(0,$.jsxs)(`div`,{children:[_,P]}),t[56]=P,t[57]=_,t[58]=I):I=t[58];let L;t[59]===o.oneAtATimeHint?L=t[60]:(L=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[59]=o.oneAtATimeHint,t[60]=L);let R;t[61]===a.advanced.proxyTitle?R=t[62]:(R=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[61]=a.advanced.proxyTitle,t[62]=R);let z;t[63]===a.advanced.proxyBody?z=t[64]:(z=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[63]=a.advanced.proxyBody,t[64]=z);let B;t[65]!==r||t[66]!==a.advanced.proxyDocs?(B=(0,$.jsx)(de,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[65]=r,t[66]=a.advanced.proxyDocs,t[67]=B):B=t[67];let V;t[68]!==R||t[69]!==z||t[70]!==B?(V=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[R,z,B]}),t[68]=R,t[69]=z,t[70]=B,t[71]=V):V=t[71];let H;return t[72]!==I||t[73]!==L||t[74]!==V||t[75]!==h||t[76]!==g?(H=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,g,I,L,V]}),t[72]=I,t[73]=L,t[74]=V,t[75]=h,t[76]=g,t[77]=H):H=t[77],H}function Me(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Ne(e){return e.conversationId}function Pe(e){return e.language}function Fe(){let e=(0,Q.c)(16),t=c(Ie),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(Y,{icon:k,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let o;e[5]===r.body?o=e[6]:(o=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=o);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let u;e[8]===r.link?u=e[9]:(u=(0,$.jsxs)(a,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=u);let d;e[10]!==o||e[11]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[o,u]}),e[10]=o,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==i||e[14]!==d?(f=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ue,{children:[i,d]})}),e[13]=i,e[14]=d,e[15]=f):f=e[15],f}function Ie(e){return e.language}function Le(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n!==void 0&&n,i=c(Re),a;t[0]===i?a=t[1]:(a=l(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,u]=(0,Z.useState)(!1),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=async()=>{await V(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(u(!0),setTimeout(()=>u(!1),2e3))},t[2]=d):d=t[2];let f=d,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=p):p=t[3];let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void f(),h=(0,$.jsx)(x,{className:`mr-1 size-4`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let g=s?o.copied:o.copy,_;t[6]===g?_=t[7]:(_=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(R,{type:`button`,variant:`ghost`,onClick:m,children:[h,g]})}),t[6]=g,t[7]=_);let v;t[8]!==r||t[9]!==o.hint?(v=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=v):v=t[10];let y;t[11]!==_||t[12]!==v?(y=(0,$.jsxs)($.Fragment,{children:[p,_,v]}),t[11]=_,t[12]=v,t[13]=y):y=t[13];let b=y;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Y,{icon:M,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===b?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:b}),t[17]=b,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ue,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let S;t[22]!==o.subtitle||t[23]!==o.title?(S=(0,$.jsx)(Y,{icon:M,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=S):S=t[24];let C;t[25]===b?C=t[26]:(C=(0,$.jsx)(`div`,{className:`mt-4`,children:b}),t[25]=b,t[26]=C);let w;return t[27]!==S||t[28]!==C?(w=(0,$.jsxs)(ue,{children:[S,C]}),t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function Re(e){return e.language}function ze(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Le,{embedded:!0}),e[0]=t):t=e[0],t}var Be=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Ve(e){return e&&Be.includes(e)?e:`guide`}function He(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l!==void 0&&l,[d,f]=(0,Z.useState)(c??!1),p;t[0]===s?p=t[1]:(p=P(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(Ue),t[2]=m):m=t[2];let h=d&&`rotate-180`,g;t[3]===h?g=t[4]:(g=P(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[3]=h,t[4]=g);let _;t[5]===g?_=t[6]:(_=(0,$.jsx)(v,{className:g,"aria-hidden":!0}),t[5]=g,t[6]=_);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=d?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==d||t[12]!==_||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:m,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[_,y,x]}),t[11]=d,t[12]=_,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=P(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==S||t[27]!==D||t[28]!==p?(O=(0,$.jsxs)(`section`,{className:p,children:[S,D]}),t[26]=S,t[27]=D,t[28]=p,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(we,{children:k}),t[30]=k,t[31]=e),e}return k}function Ue(e){return!e}function We(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:g}=e,[_,v]=(0,Z.useState)(!1),y;t[0]===g?y=t[1]:(y=e=>{e||(v(!1),g())},t[0]=g,t[1]=y);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(u,{className:P(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,B)}),t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=P(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`,z),t[3]=x):x=t[3];let S;t[4]===r?S=t[5]:(S=(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=S);let C;t[6]===i?C=t[7]:(C=(0,$.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=C);let w;t[8]===a?w=t[9]:(w=a.map(Ge),t[8]=a,t[9]=w);let T;t[10]===w?T=t[11]:(T=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:w}),t[10]=w,t[11]=T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>v(e.target.checked),t[12]=E):E=t[12];let D;t[13]===_?D=t[14]:(D=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:_,onChange:E}),t[13]=_,t[14]=D);let O;t[15]===o?O=t[16]:(O=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=O);let k;t[17]!==O||t[18]!==D?(k=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[D,O]}),t[17]=O,t[18]=D,t[19]=k):k=t[19];let A;t[20]!==c||t[21]!==g?(A=(0,$.jsx)(R,{type:`button`,variant:`secondary`,onClick:g,children:c}),t[20]=c,t[21]=g,t[22]=A):A=t[22];let j=!_,M;t[23]!==s||t[24]!==l||t[25]!==j?(M=(0,$.jsx)(R,{type:`button`,disabled:j,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=j,t[26]=M):M=t[26];let N;t[27]!==A||t[28]!==M?(N=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[A,M]}),t[27]=A,t[28]=M,t[29]=N):N=t[29];let F;t[30]!==k||t[31]!==N||t[32]!==S||t[33]!==C||t[34]!==T?(F=(0,$.jsxs)(f,{children:[b,(0,$.jsxs)(p,{className:x,onOpenAutoFocus:Ke,children:[S,C,T,k,N]})]}),t[30]=k,t[31]=N,t[32]=S,t[33]=C,t[34]=T,t[35]=F):F=t[35];let I;return t[36]!==n||t[37]!==y||t[38]!==F?(I=(0,$.jsx)(h,{open:n,onOpenChange:y,children:F}),t[36]=n,t[37]=y,t[38]=F,t[39]=I):I=t[39],I}function Ge(e){return(0,$.jsx)(`li`,{children:e},e)}function Ke(e){return e.preventDefault()}function qe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Je=[`preparing_frpc`,`registering`,`starting_frpc`];function Ye(e){return e?e===`reconnecting_frpc`?Je.indexOf(`starting_frpc`):Je.indexOf(e):-1}function Xe(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Je.indexOf(e),i=Ye(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Ze(e,t,n){let r=n.startProgress;return Xe(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Qe(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function $e(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function et(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(tt),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,s;if(t[3]!==n.state||t[4]!==o?(s=[n.state,o],t[3]=n.state,t[4]=o,t[5]=s):s=t[5],(0,Z.useEffect)(a,s),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let c,l,u,d,f;if(t[6]!==n||t[7]!==r){let e=$e(n.startProgress?.startedAt);c=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,l=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(u=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=u):u=t[19];let o=Je.map(e=>{let t=Xe(e,n),i=Ze(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(_,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(E,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(b,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:P(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Qe(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:P(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[qe(n.frpcDownload.bytesReceived),` /`,` `,qe(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?d=t[21]:(d=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=d),f=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f}else c=t[8],l=t[9],u=t[10],d=t[11],f=t[12];let p;t[22]!==c||t[23]!==r.publicUrlPendingNotice?(p=c?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=c,t[23]=r.publicUrlPendingNotice,t[24]=p):p=t[24];let m;return t[25]!==l||t[26]!==u||t[27]!==d||t[28]!==f||t[29]!==p?(m=(0,$.jsxs)(`div`,{className:l,children:[u,d,f,p]}),t[25]=l,t[26]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m):m=t[30],m}function tt(e){return e+1}function nt(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function rt(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function it(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function at(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function ot(e){let t=(0,Q.c)(69),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:u,startDisabledReason:d,stepLabel:f,onStart:p,onStop:m}=e,h=u!==void 0&&u,g;t[0]!==r.lastError||t[1]!==r.state?(g=r.state===`error`&&he(Error(r.lastError??``)),t[0]=r.lastError,t[1]=r.state,t[2]=g):g=t[2];let _=g,v,y,b,x,S,C,T;t[3]!==r||t[4]!==o?(T=rt(r),v=r.enabled||o,y=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=P(le(),`space-y-4`),t[12]=C):C=t[12],S=`flex flex-wrap items-start justify-between gap-3`,x=`flex items-center gap-2`,b=P(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,it(T)),t[3]=r,t[4]=o,t[5]=v,t[6]=y,t[7]=b,t[8]=x,t[9]=S,t[10]=C,t[11]=T):(v=t[5],y=t[6],b=t[7],x=t[8],S=t[9],C=t[10],T=t[11]);let D=T===`connected`&&`bg-emerald-500`,k=T===`progress`&&`bg-amber-500 animate-pulse`,A=T===`error`&&`bg-red-500`,j=T===`off`&&`bg-fg-subtle`,M;t[13]!==j||t[14]!==D||t[15]!==k||t[16]!==A?(M=P(`size-1.5 rounded-full`,D,k,A,j),t[13]=j,t[14]=D,t[15]=k,t[16]=A,t[17]=M):M=t[17];let F;t[18]===M?F=t[19]:(F=(0,$.jsx)(`span`,{className:M,"aria-hidden":!0}),t[18]=M,t[19]=F);let I;t[20]!==i||t[21]!==r||t[22]!==n?(I=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):nt(n,r),t[20]=i,t[21]=r,t[22]=n,t[23]=I):I=t[23];let L;t[24]!==F||t[25]!==I||t[26]!==b?(L=(0,$.jsxs)(`span`,{className:b,children:[F,I]}),t[24]=F,t[25]=I,t[26]=b,t[27]=L):L=t[27];let z;t[28]!==r.connectedSince||t[29]!==r.state||t[30]!==n.uptime?(z=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,at(r.connectedSince)]}):null,t[28]=r.connectedSince,t[29]=r.state,t[30]=n.uptime,t[31]=z):z=t[31];let B;t[32]!==L||t[33]!==z||t[34]!==x?(B=(0,$.jsxs)(`div`,{className:x,children:[L,z]}),t[32]=L,t[33]=z,t[34]=x,t[35]=B):B=t[35];let V;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(w,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[36]=V):V=t[36];let H;t[37]!==B||t[38]!==S?(H=(0,$.jsxs)(`div`,{className:S,children:[B,V]}),t[37]=B,t[38]=S,t[39]=H):H=t[39];let U;t[40]===a?U=t[41]:(U=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[40]=a,t[41]=U);let W;t[42]!==c||t[43]!==n.consentExpiredBanner?(W=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[42]=c,t[43]=n.consentExpiredBanner,t[44]=W):W=t[44];let G;t[45]!==_||t[46]!==n.recoverConnectionHint?(G=_?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:n.recoverConnectionHint}):null,t[45]=_,t[46]=n.recoverConnectionHint,t[47]=G):G=t[47];let K;t[48]!==v||t[49]!==l||t[50]!==p||t[51]!==m||t[52]!==_||t[53]!==y||t[54]!==r||t[55]!==h||t[56]!==d||t[57]!==o||t[58]!==f||t[59]!==s||t[60]!==n?(K=v?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(ee,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,y?(0,$.jsx)(et,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(R,{type:`button`,variant:`secondary`,disabled:s,onClick:m,children:[s?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(R,{type:`button`,disabled:o,onClick:p,children:[o?(0,$.jsx)(E,{className:`size-4 animate-spin`}):(0,$.jsx)(O,{className:`size-4`}),_?n.recoverConnection:n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[f?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:f}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(N,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),h&&d?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:d}):null,(0,$.jsxs)(R,{type:`button`,disabled:o||h,onClick:p,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(E,{className:`size-4 animate-spin`}):(0,$.jsx)(O,{className:`size-4`}),_?n.recoverConnection:n.start]})]}),t[48]=v,t[49]=l,t[50]=p,t[51]=m,t[52]=_,t[53]=y,t[54]=r,t[55]=h,t[56]=d,t[57]=o,t[58]=f,t[59]=s,t[60]=n,t[61]=K):K=t[61];let q;return t[62]!==H||t[63]!==U||t[64]!==W||t[65]!==G||t[66]!==K||t[67]!==C?(q=(0,$.jsxs)(`section`,{className:C,children:[H,U,W,G,K]}),t[62]=H,t[63]=U,t[64]=W,t[65]=G,t[66]=K,t[67]=C,t[68]=q):q=t[68],q}var st={reconfiguring:!1};function ct(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:s,authorizingBrokerSecret:c,brokerSecretAuthorizationUrl:l,brokerSecretNotice:u,copyFailedLabel:d,onDraftChange:f,onSave:p,onAuthorize:m,onClear:h,sectionRef:g}=e,v=(0,Z.useId)(),y=r,b=!y,[x,w]=(0,Z.useReducer)(U,st),{reconfiguring:D}=x,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let j=A,M;t[9]===o?M=t[10]:(M=o.trim().length>0&&!K(o.trim()),t[9]=o,t[10]=M);let N=M,F;t[11]===f?F=t[12]:(F=()=>{w({type:`patch`,patch:{reconfiguring:!1}}),f(``)},t[11]=f,t[12]=F);let I=F,L=b&&`ring-1 ring-amber-500/30`,z;t[13]===L?z=t[14]:(z=P(L),t[13]=L,t[14]=z);let B=y?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:b?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,V;t[15]===B?V=t[16]:(V=P(`flex size-9 shrink-0 items-center justify-center rounded-lg`,B),t[15]=B,t[16]=V);let H;t[17]===y?H=t[18]:(H=y?(0,$.jsx)(_,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(T,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=y,t[18]=H);let W;t[19]!==V||t[20]!==H?(W=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=W):W=t[21];let ee=y?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,G;t[22]===ee?G=t[23]:(G=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:ee}),t[22]=ee,t[23]=G);let q=y?n.brokerSecretReadyHint:n.brokerSecretHint,te;t[24]===q?te=t[25]:(te=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:q}),t[24]=q,t[25]=te);let ne;t[26]!==b||t[27]!==n.brokerSecretMissingHint?(ne=b?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=b,t[27]=n.brokerSecretMissingHint,t[28]=ne):ne=t[28];let J;t[29]!==G||t[30]!==te||t[31]!==ne?(J=(0,$.jsxs)(`div`,{children:[G,te,ne]}),t[29]=G,t[30]=te,t[31]=ne,t[32]=J):J=t[32];let re;t[33]!==c||t[34]!==b||t[35]!==m||t[36]!==D||t[37]!==s||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(re=b||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(R,{type:`button`,disabled:s||c,onClick:m,children:[c?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,c?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:xe,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(S,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=c,t[34]=b,t[35]=m,t[36]=D,t[37]=s,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=re):re=t[41];let ie;t[42]!==c||t[43]!==l||t[44]!==n.brokerSecretOpenAuthorization?(ie=c&&l?(0,$.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(S,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=c,t[43]=l,t[44]=n.brokerSecretOpenAuthorization,t[45]=ie):ie=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==N||t[50]!==I||t[51]!==d||t[52]!==v||t[53]!==b||t[54]!==h||t[55]!==f||t[56]!==p||t[57]!==D||t[58]!==s||t[59]!==j||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(ae=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:v,children:n.brokerSecretTitle}),(0,$.jsx)(C,{id:v,value:a,labels:j,reveal:lt,loadFailedLabel:d||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(R,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>{w({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(R,{type:`button`,variant:`ghost`,disabled:s,onClick:h,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:v,children:n.brokerSecretTitle}),(0,$.jsx)(C,{id:v,value:o,onChange:f,placeholder:n.brokerSecretPlaceholder,labels:j,disabled:s}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(R,{type:`button`,disabled:s||!N,onClick:p,children:[s?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,b?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(R,{type:`button`,variant:`ghost`,disabled:s,onClick:h,children:n.brokerSecretClear}):null,D?(0,$.jsx)(R,{type:`button`,variant:`ghost`,disabled:s,onClick:I,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=N,t[50]=I,t[51]=d,t[52]=v,t[53]=b,t[54]=h,t[55]=f,t[56]=p,t[57]=D,t[58]=s,t[59]=j,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=ae):ae=t[71];let oe;t[72]===u?oe=t[73]:(oe=u?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:u}):null,t[72]=u,t[73]=oe);let se;t[74]!==J||t[75]!==re||t[76]!==ie||t[77]!==ae||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[J,re,ie,ae,oe]}),t[74]=J,t[75]=re,t[76]=ie,t[77]=ae,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==W||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[W,se]}),t[80]=W,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==z?(Y=(0,$.jsx)(ue,{className:z,children:ce}),t[83]=ce,t[84]=z,t[85]=Y):Y=t[85];let le;return t[86]!==g||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:g,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=g,t[87]=Y,t[88]=le):le=t[88],le}function lt(){return ve().then(ut)}function ut(e){return e.registrationSecret??null}var dt={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function ft({embedded:e=!1}){let t=c(e=>e.language),n=l(t).tunnelSettings,r=!!s(e=>e.conversationId),[i,a]=(0,Z.useReducer)(U,dt),{actionError:o,starting:u,stopping:d,savingAutoStart:f,consentOpen:p,autoStartConfirmOpen:m,releaseConfirmOpen:h,releasing:g,brokerSecretDraft:_,savingBrokerSecret:v,authorizingBrokerSecret:y,brokerSecretAuthorizationUrl:b,brokerSecretNotice:x}=i,S=(0,Z.useRef)(null),{data:C}=L(r),{data:T,error:D,isLoading:O,mutate:k}=F(r?`tunnel-status`:null,_e,{refreshInterval:e=>u?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),A=(0,Z.useMemo)(()=>{let e=C?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return T?.config?.autoStart===!0},[C,T?.config?.autoStart]),j=(0,Z.useMemo)(()=>{let e=C?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[C]),M=K(j),N=T?.registrationSecret?.configured??M;(0,Z.useEffect)(()=>{let e=()=>{k()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[k]);let z=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),B=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await be(T?.state===`error`&&he(Error(T.lastError??``))?{recoverActiveLease:!0}:void 0),await k(),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}}),await k().catch(()=>{})}finally{a({type:`patch`,patch:{starting:!1}})}},[k,T]),V=(0,Z.useCallback)(()=>{if(!N){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),S.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(T?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}B()},[N,T?.consentRequired,B,n.brokerSecretRequiredBeforeStart]),H=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await fe(),await Promise.all([k(),B()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[k,B]),ee=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await me(),await k(),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[k]),G=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ye({autoStart:e}),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),J=(0,Z.useCallback)(()=>{if(A){G(!1);return}if(T?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!T?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[G,T?.canAutoStart,T?.consentRequired,n,A]),oe=(0,Z.useCallback)(async()=>{let e=_.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ye({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),I(),await k(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[_,k,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ye({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),I(),await k()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[k,n.brokerSecretCleared]),ce=(0,Z.useCallback)(async()=>{let e=ie(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await q(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await ne(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await re(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await ge(),await Promise.all([k(),I()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{ae(e),t&&te(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[k,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await me({release:!0}),await k(),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[k]),le=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:l(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=T??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:A,brokerUrl:`https://frp.xopc.ai/api`}},pe=T?.consentRequired&&(X.enabled||A||T?.consent?.acceptedAt),ve=(0,$.jsx)(ct,{t:n,brokerSecretReady:N,brokerSecretConfiguredInConfig:M,brokerSecretMaskedValue:M?j:``,brokerSecretDraft:_,savingBrokerSecret:v,authorizingBrokerSecret:y,brokerSecretAuthorizationUrl:b,brokerSecretNotice:x,copyFailedLabel:l(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:S}),xe=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(We,{open:p,title:n.consentTitle,intro:n.consentIntro,bullets:z,checkboxLabel:n.consentCheckbox,confirmLabel:pe?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void H(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},p?`consent-open`:`consent-closed`),(0,$.jsx)(W,{open:m,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),G(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(W,{open:h,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void Y(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ve,(0,$.jsx)(ot,{t:n,status:X,isLoading:O,statusErr:D,starting:u,stopping:d,showConsentExpired:!!pe,copyLabels:le,startDisabled:!N,startDisabledReason:N?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:V,onStop:()=>void ee()}),(0,$.jsxs)(He,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:P(`flex items-center gap-3 text-sm text-fg`,!A&&!T?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:A,disabled:f||!A&&!T?.canAutoStart,onChange:J}),n.autoStart]}),!T?.canAutoStart&&!A?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(R,{type:`button`,variant:`secondary`,disabled:g||d,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[g?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(He,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),xe]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ve,(0,$.jsx)(ot,{t:n,status:X,isLoading:O,statusErr:D,starting:u,stopping:d,showConsentExpired:!!pe,copyLabels:le,startDisabled:!N,startDisabledReason:N?void 0:n.brokerSecretRequiredBeforeStart,onStart:V,onStop:()=>void ee()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(R,{type:`button`,variant:`secondary`,disabled:g||d,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[g?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ue,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:P(`flex items-center gap-3 text-sm text-fg`,!A&&!T?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:A,disabled:f||!A&&!T?.canAutoStart,onChange:J}),n.autoStart]}),!T?.canAutoStart&&!A?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),xe]})}function pt(e,t){return e.tabs[t]}function mt(e,t){return e.tabIntro[t]}function ht(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function gt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(je,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(pe,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ft,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ce,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ze,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fe,{}),t[6]=e):e=t[6],e}}}function _t(){let e=(0,Q.c)(3),t=o(),n=c(yt),r=l(n).remoteAccess,a=!!s(vt),[u,d]=i(),f=G(),p=Ve(u.get(`tab`)),m=u.get(`intent`)===`mobile-pairing`,h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={refreshInterval:2e3},e[0]=h):h=e[0];let _=F(m?`device-pairing-readiness`:null,X,h),v;e[1]===d?v=e[2]:(v=e=>{d(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=d,e[2]=v);let y=v,b=mt(r,p),x=Be.filter(e=>f||e!==`ssh`&&e!==`reverse-proxy`||e===p).map(e=>({id:e,label:pt(r,e)}));return(0,$.jsxs)(oe,{children:[(0,$.jsx)(se,{title:r.pageTitle,meta:(0,$.jsx)(de,{language:n,label:r.docsLink,section:ht(p),className:`mt-1`})}),a?(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(j,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:_.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(R,{variant:`primary`,disabled:!_.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[_.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(H,{items:x,activeTab:p,onChange:y,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ce,{id:p,activeTab:p,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:pt(r,p),hint:p===`public`?void 0:b,showHeading:!1,framed:!1,children:(0,$.jsx)(gt,{tab:p,onOpenTab:y})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function vt(e){return e.conversationId}function yt(e){return e.language}export{_t as RemoteAccessHub};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as s,n as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./arrow-right-DSSvoX71.js";import{t as _}from"./check-DUBLcKHA.js";import{t as v}from"./chevron-down-ccbiQQz_.js";import{t as y}from"./chevron-right-BweFrslA.js";import{t as b}from"./circle-BoO4YvTx.js";import{t as x}from"./copy-Dv6d4Dvw.js";import{t as S}from"./external-link-DjqjBmc3.js";import{t as C}from"./secret-input-DsjfQmDn.js";import{t as w}from"./globe-DSSGFWFn.js";import{t as T}from"./key-round-DWbpyU2U.js";import{t as E}from"./loader-circle-CifKLtgG.js";import{t as D}from"./network-BUQLY1BV.js";import{t as O}from"./power-ZI-pBczI.js";import{t as k}from"./server-BlHCBjiE.js";import{t as A}from"./shield-B1sI_cxl.js";import{t as j}from"./smartphone-DSSsQFqA.js";import{t as M}from"./terminal-oKqqZdiG.js";import{t as N}from"./triangle-alert-2JXFNNKU.js";import{t as P}from"./cn-0WouolD0.js";import{i as F}from"./vendor-swr-CdRzEUwF.js";import{n as I,r as L}from"./gateway-config-swr-DVXDJNCI.js";import{t as R}from"./button-Cc4hUNTt.js";import{i as z,o as B}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as V}from"./copy-to-clipboard-HOJ79TWv.js";import{t as H}from"./page-tabs-oeTY7z3_.js";import{r as U}from"./settings-form-draft-Dy10ldo8.js";import{t as W}from"./confirm-dialog-DrA5mTQp.js";import{t as ee}from"./copy-text-row-CpiRzq4G.js";import{n as G}from"./settings-mode-store-Dk0bZQgo.js";import{r as K}from"./providers-api-B6eZLEnh.js";import{a as q,n as te,r as ne}from"./oauth-api-Bz_PU9R_.js";import{t as J}from"./settings-advanced-section-Zex2dJo7.js";import{n as re,r as ie,t as ae}from"./oauth-authorization-window-o6URRos4.js";import{n as oe,t as se}from"./settings-page-header-B9Y_eGcH.js";import{t as ce}from"./settings-page-layout-D1MgJ5zP.js";import{n as Y,r as le,t as ue}from"./settings-form-section-num14vSv.js";import{S as de,_ as X,a as fe,b as pe,c as me,d as he,i as ge,n as _e,o as ve,r as ye,s as be,t as xe,x as Se,y as Ce}from"./tunnel-api-BkhCBt38.js";import{t as we}from"./settings-advanced-gate-BYrXsPjK.js";var Z=e(t(),1),Q=n(),$=r();function Te(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Ee(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=P(`inline-flex items-center gap-1.5 text-xs font-medium`,Te(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=P(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function De(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=c(ke),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!s(Oe),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={refreshInterval:3e4},t[2]=u):u=t[2];let{data:d}=F(o?`exposure-status`:null,Se,u),f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f={refreshInterval:15e3},t[3]=f):f=t[3];let{data:p}=F(o?`tunnel-status`:null,_e,f),m=L(o);if(!o)return null;let h=d?.tailscale.active===!0,g=p?.state,_=p?.enabled&&g===`connected`,v=p?.enabled&&(g===`connecting`||g===`reconnecting`||!!p?.startProgress||!!p?.frpcDownload),y=m.data?.payload?.config,b=!!(y&&typeof y==`object`&&!Array.isArray(y)&&y.gateway?.publicUrl),x=h?`active`:`off`,S=h?a.statusActive:a.statusOff,C;t[4]!==a.tailscaleCardTitle||t[5]!==x||t[6]!==S?(C={tab:`tailscale`,icon:w,title:a.tailscaleCardTitle,kind:x,statusLabel:S},t[4]=a.tailscaleCardTitle,t[5]=x,t[6]=S,t[7]=C):C=t[7];let T=_?`active`:v?`connecting`:`off`,E=_?a.statusActive:v?a.statusConnecting:a.statusOff,O;t[8]!==a.publicCardTitle||t[9]!==T||t[10]!==E?(O={tab:`public`,icon:D,title:a.publicCardTitle,kind:T,statusLabel:E},t[8]=a.publicCardTitle,t[9]=T,t[10]=E,t[11]=O):O=t[11];let j=b?`active`:`off`,N=b?a.statusActive:a.statusOff,I;t[12]!==a.reverseProxyCardTitle||t[13]!==j||t[14]!==N?(I={tab:`reverse-proxy`,icon:A,title:a.reverseProxyCardTitle,kind:j,statusLabel:N},t[12]=a.reverseProxyCardTitle,t[13]=j,t[14]=N,t[15]=I):I=t[15];let R;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(R={tab:`ssh`,icon:M,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=R):R=t[18];let z;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(z={tab:`lan`,icon:k,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=z):z=t[21];let B;t[22]!==I||t[23]!==R||t[24]!==z||t[25]!==C||t[26]!==O?(B=[C,O,I,R,z],t[22]=I,t[23]=R,t[24]=z,t[25]=C,t[26]=O,t[27]=B):B=t[27];let V=B,H;return t[28]!==V||t[29]!==n?(H=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:V.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:P(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Ee,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=V,t[29]=n,t[30]=H):H=t[30],H}function Oe(e){return e.conversationId}function ke(e){return e.language}function Ae(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=P(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let d;t[5]!==i||t[6]!==s?(d=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=d):d=t[7];let f;t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===r?p=t[12]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(y,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=h):h=t[16];let g;return t[17]!==o||t[18]!==l||t[19]!==m?(g=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,m,h]}),t[17]=o,t[18]=l,t[19]=m,t[20]=g):g=t[20],g}function je(e){let t=(0,Q.c)(78),{onOpenTab:n}=e,r=c(Pe),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,u=!!s(Ne),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:3e4},t[2]=d):d=t[2];let{data:f}=F(u?`exposure-status`:null,Se,d),p;t[3]===f?.conflicts?p=t[4]:(p=f?.conflicts??[],t[3]=f?.conflicts,t[4]=p);let m=p;if(!u){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let h;t[7]===n?h=t[8]:(h=(0,$.jsx)(De,{onOpenTab:n}),t[7]=n,t[8]=h);let g;t[9]!==m||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(g=m.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:m.map(Me)})]}):null,t[9]=m,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=g):g=t[12];let _;t[13]===o.pickMethod?_=t[14]:(_=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=_);let v;t[15]===n?v=t[16]:(v=()=>n(`tailscale`),t[15]=n,t[16]=v);let y;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==v?(y=(0,$.jsx)(Ae,{icon:w,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:v}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=v,t[21]=y):y=t[21];let b;t[22]===n?b=t[23]:(b=()=>n(`public`),t[22]=n,t[23]=b);let x;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==b?(x=(0,$.jsx)(Ae,{icon:D,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:b}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=b,t[27]=x):x=t[27];let S;t[28]===n?S=t[29]:(S=()=>n(`reverse-proxy`),t[28]=n,t[29]=S);let C;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==S?(C=(0,$.jsx)(Ae,{icon:A,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:S}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=S,t[33]=C):C=t[33];let T;t[34]===n?T=t[35]:(T=()=>n(`ssh`),t[34]=n,t[35]=T);let E;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==T?(E=(0,$.jsx)(Ae,{icon:M,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:T}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=T,t[39]=E):E=t[39];let O;t[40]!==a.advanced.proxyBody||t[41]!==a.advanced.proxyTitle||t[42]!==C||t[43]!==E?(O=(0,$.jsxs)(J,{title:a.advanced.proxyTitle,summary:a.advanced.proxyBody,children:[C,E]}),t[40]=a.advanced.proxyBody,t[41]=a.advanced.proxyTitle,t[42]=C,t[43]=E,t[44]=O):O=t[44];let j;t[45]===n?j=t[46]:(j=()=>n(`lan`),t[45]=n,t[46]=j);let N;t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==j?(N=(0,$.jsx)(Ae,{icon:k,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:j}),t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=j,t[50]=N):N=t[50];let P;t[51]!==x||t[52]!==O||t[53]!==N||t[54]!==y?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[y,x,O,N]}),t[51]=x,t[52]=O,t[53]=N,t[54]=y,t[55]=P):P=t[55];let I;t[56]!==P||t[57]!==_?(I=(0,$.jsxs)(`div`,{children:[_,P]}),t[56]=P,t[57]=_,t[58]=I):I=t[58];let L;t[59]===o.oneAtATimeHint?L=t[60]:(L=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[59]=o.oneAtATimeHint,t[60]=L);let R;t[61]===a.advanced.proxyTitle?R=t[62]:(R=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[61]=a.advanced.proxyTitle,t[62]=R);let z;t[63]===a.advanced.proxyBody?z=t[64]:(z=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[63]=a.advanced.proxyBody,t[64]=z);let B;t[65]!==r||t[66]!==a.advanced.proxyDocs?(B=(0,$.jsx)(de,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[65]=r,t[66]=a.advanced.proxyDocs,t[67]=B):B=t[67];let V;t[68]!==R||t[69]!==z||t[70]!==B?(V=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[R,z,B]}),t[68]=R,t[69]=z,t[70]=B,t[71]=V):V=t[71];let H;return t[72]!==I||t[73]!==L||t[74]!==V||t[75]!==h||t[76]!==g?(H=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,g,I,L,V]}),t[72]=I,t[73]=L,t[74]=V,t[75]=h,t[76]=g,t[77]=H):H=t[77],H}function Me(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Ne(e){return e.conversationId}function Pe(e){return e.language}function Fe(){let e=(0,Q.c)(16),t=c(Ie),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(Y,{icon:k,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let o;e[5]===r.body?o=e[6]:(o=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=o);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let u;e[8]===r.link?u=e[9]:(u=(0,$.jsxs)(a,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=u);let d;e[10]!==o||e[11]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[o,u]}),e[10]=o,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==i||e[14]!==d?(f=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ue,{children:[i,d]})}),e[13]=i,e[14]=d,e[15]=f):f=e[15],f}function Ie(e){return e.language}function Le(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n!==void 0&&n,i=c(Re),a;t[0]===i?a=t[1]:(a=l(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,u]=(0,Z.useState)(!1),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=async()=>{await V(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(u(!0),setTimeout(()=>u(!1),2e3))},t[2]=d):d=t[2];let f=d,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=p):p=t[3];let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void f(),h=(0,$.jsx)(x,{className:`mr-1 size-4`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let g=s?o.copied:o.copy,_;t[6]===g?_=t[7]:(_=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(R,{type:`button`,variant:`ghost`,onClick:m,children:[h,g]})}),t[6]=g,t[7]=_);let v;t[8]!==r||t[9]!==o.hint?(v=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=v):v=t[10];let y;t[11]!==_||t[12]!==v?(y=(0,$.jsxs)($.Fragment,{children:[p,_,v]}),t[11]=_,t[12]=v,t[13]=y):y=t[13];let b=y;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Y,{icon:M,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===b?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:b}),t[17]=b,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ue,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let S;t[22]!==o.subtitle||t[23]!==o.title?(S=(0,$.jsx)(Y,{icon:M,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=S):S=t[24];let C;t[25]===b?C=t[26]:(C=(0,$.jsx)(`div`,{className:`mt-4`,children:b}),t[25]=b,t[26]=C);let w;return t[27]!==S||t[28]!==C?(w=(0,$.jsxs)(ue,{children:[S,C]}),t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function Re(e){return e.language}function ze(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Le,{embedded:!0}),e[0]=t):t=e[0],t}var Be=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Ve(e){return e&&Be.includes(e)?e:`guide`}function He(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l!==void 0&&l,[d,f]=(0,Z.useState)(c??!1),p;t[0]===s?p=t[1]:(p=P(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(Ue),t[2]=m):m=t[2];let h=d&&`rotate-180`,g;t[3]===h?g=t[4]:(g=P(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[3]=h,t[4]=g);let _;t[5]===g?_=t[6]:(_=(0,$.jsx)(v,{className:g,"aria-hidden":!0}),t[5]=g,t[6]=_);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=d?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==d||t[12]!==_||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:m,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[_,y,x]}),t[11]=d,t[12]=_,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=P(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==S||t[27]!==D||t[28]!==p?(O=(0,$.jsxs)(`section`,{className:p,children:[S,D]}),t[26]=S,t[27]=D,t[28]=p,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(we,{children:k}),t[30]=k,t[31]=e),e}return k}function Ue(e){return!e}function We(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:g}=e,[_,v]=(0,Z.useState)(!1),y;t[0]===g?y=t[1]:(y=e=>{e||(v(!1),g())},t[0]=g,t[1]=y);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(u,{className:P(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,B)}),t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=P(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`,z),t[3]=x):x=t[3];let S;t[4]===r?S=t[5]:(S=(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=S);let C;t[6]===i?C=t[7]:(C=(0,$.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=C);let w;t[8]===a?w=t[9]:(w=a.map(Ge),t[8]=a,t[9]=w);let T;t[10]===w?T=t[11]:(T=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:w}),t[10]=w,t[11]=T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>v(e.target.checked),t[12]=E):E=t[12];let D;t[13]===_?D=t[14]:(D=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:_,onChange:E}),t[13]=_,t[14]=D);let O;t[15]===o?O=t[16]:(O=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=O);let k;t[17]!==O||t[18]!==D?(k=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[D,O]}),t[17]=O,t[18]=D,t[19]=k):k=t[19];let A;t[20]!==c||t[21]!==g?(A=(0,$.jsx)(R,{type:`button`,variant:`secondary`,onClick:g,children:c}),t[20]=c,t[21]=g,t[22]=A):A=t[22];let j=!_,M;t[23]!==s||t[24]!==l||t[25]!==j?(M=(0,$.jsx)(R,{type:`button`,disabled:j,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=j,t[26]=M):M=t[26];let N;t[27]!==A||t[28]!==M?(N=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[A,M]}),t[27]=A,t[28]=M,t[29]=N):N=t[29];let F;t[30]!==k||t[31]!==N||t[32]!==S||t[33]!==C||t[34]!==T?(F=(0,$.jsxs)(f,{children:[b,(0,$.jsxs)(p,{className:x,onOpenAutoFocus:Ke,children:[S,C,T,k,N]})]}),t[30]=k,t[31]=N,t[32]=S,t[33]=C,t[34]=T,t[35]=F):F=t[35];let I;return t[36]!==n||t[37]!==y||t[38]!==F?(I=(0,$.jsx)(h,{open:n,onOpenChange:y,children:F}),t[36]=n,t[37]=y,t[38]=F,t[39]=I):I=t[39],I}function Ge(e){return(0,$.jsx)(`li`,{children:e},e)}function Ke(e){return e.preventDefault()}function qe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Je=[`preparing_frpc`,`registering`,`starting_frpc`];function Ye(e){return e?e===`reconnecting_frpc`?Je.indexOf(`starting_frpc`):Je.indexOf(e):-1}function Xe(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Je.indexOf(e),i=Ye(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Ze(e,t,n){let r=n.startProgress;return Xe(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Qe(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function $e(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function et(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(tt),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,s;if(t[3]!==n.state||t[4]!==o?(s=[n.state,o],t[3]=n.state,t[4]=o,t[5]=s):s=t[5],(0,Z.useEffect)(a,s),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let c,l,u,d,f;if(t[6]!==n||t[7]!==r){let e=$e(n.startProgress?.startedAt);c=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,l=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(u=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=u):u=t[19];let o=Je.map(e=>{let t=Xe(e,n),i=Ze(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(_,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(E,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(b,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:P(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Qe(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:P(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[qe(n.frpcDownload.bytesReceived),` /`,` `,qe(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?d=t[21]:(d=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=d),f=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f}else c=t[8],l=t[9],u=t[10],d=t[11],f=t[12];let p;t[22]!==c||t[23]!==r.publicUrlPendingNotice?(p=c?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=c,t[23]=r.publicUrlPendingNotice,t[24]=p):p=t[24];let m;return t[25]!==l||t[26]!==u||t[27]!==d||t[28]!==f||t[29]!==p?(m=(0,$.jsxs)(`div`,{className:l,children:[u,d,f,p]}),t[25]=l,t[26]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m):m=t[30],m}function tt(e){return e+1}function nt(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function rt(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function it(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function at(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function ot(e){let t=(0,Q.c)(69),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:u,startDisabledReason:d,stepLabel:f,onStart:p,onStop:m}=e,h=u!==void 0&&u,g;t[0]!==r.lastError||t[1]!==r.state?(g=r.state===`error`&&he(Error(r.lastError??``)),t[0]=r.lastError,t[1]=r.state,t[2]=g):g=t[2];let _=g,v,y,b,x,S,C,T;t[3]!==r||t[4]!==o?(T=rt(r),v=r.enabled||o,y=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=P(le(),`space-y-4`),t[12]=C):C=t[12],S=`flex flex-wrap items-start justify-between gap-3`,x=`flex items-center gap-2`,b=P(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,it(T)),t[3]=r,t[4]=o,t[5]=v,t[6]=y,t[7]=b,t[8]=x,t[9]=S,t[10]=C,t[11]=T):(v=t[5],y=t[6],b=t[7],x=t[8],S=t[9],C=t[10],T=t[11]);let D=T===`connected`&&`bg-emerald-500`,k=T===`progress`&&`bg-amber-500 animate-pulse`,A=T===`error`&&`bg-red-500`,j=T===`off`&&`bg-fg-subtle`,M;t[13]!==j||t[14]!==D||t[15]!==k||t[16]!==A?(M=P(`size-1.5 rounded-full`,D,k,A,j),t[13]=j,t[14]=D,t[15]=k,t[16]=A,t[17]=M):M=t[17];let F;t[18]===M?F=t[19]:(F=(0,$.jsx)(`span`,{className:M,"aria-hidden":!0}),t[18]=M,t[19]=F);let I;t[20]!==i||t[21]!==r||t[22]!==n?(I=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):nt(n,r),t[20]=i,t[21]=r,t[22]=n,t[23]=I):I=t[23];let L;t[24]!==F||t[25]!==I||t[26]!==b?(L=(0,$.jsxs)(`span`,{className:b,children:[F,I]}),t[24]=F,t[25]=I,t[26]=b,t[27]=L):L=t[27];let z;t[28]!==r.connectedSince||t[29]!==r.state||t[30]!==n.uptime?(z=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,at(r.connectedSince)]}):null,t[28]=r.connectedSince,t[29]=r.state,t[30]=n.uptime,t[31]=z):z=t[31];let B;t[32]!==L||t[33]!==z||t[34]!==x?(B=(0,$.jsxs)(`div`,{className:x,children:[L,z]}),t[32]=L,t[33]=z,t[34]=x,t[35]=B):B=t[35];let V;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(w,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[36]=V):V=t[36];let H;t[37]!==B||t[38]!==S?(H=(0,$.jsxs)(`div`,{className:S,children:[B,V]}),t[37]=B,t[38]=S,t[39]=H):H=t[39];let U;t[40]===a?U=t[41]:(U=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[40]=a,t[41]=U);let W;t[42]!==c||t[43]!==n.consentExpiredBanner?(W=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[42]=c,t[43]=n.consentExpiredBanner,t[44]=W):W=t[44];let G;t[45]!==_||t[46]!==n.recoverConnectionHint?(G=_?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:n.recoverConnectionHint}):null,t[45]=_,t[46]=n.recoverConnectionHint,t[47]=G):G=t[47];let K;t[48]!==v||t[49]!==l||t[50]!==p||t[51]!==m||t[52]!==_||t[53]!==y||t[54]!==r||t[55]!==h||t[56]!==d||t[57]!==o||t[58]!==f||t[59]!==s||t[60]!==n?(K=v?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(ee,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,y?(0,$.jsx)(et,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(R,{type:`button`,variant:`secondary`,disabled:s,onClick:m,children:[s?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(R,{type:`button`,disabled:o,onClick:p,children:[o?(0,$.jsx)(E,{className:`size-4 animate-spin`}):(0,$.jsx)(O,{className:`size-4`}),_?n.recoverConnection:n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[f?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:f}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(N,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),h&&d?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:d}):null,(0,$.jsxs)(R,{type:`button`,disabled:o||h,onClick:p,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(E,{className:`size-4 animate-spin`}):(0,$.jsx)(O,{className:`size-4`}),_?n.recoverConnection:n.start]})]}),t[48]=v,t[49]=l,t[50]=p,t[51]=m,t[52]=_,t[53]=y,t[54]=r,t[55]=h,t[56]=d,t[57]=o,t[58]=f,t[59]=s,t[60]=n,t[61]=K):K=t[61];let q;return t[62]!==H||t[63]!==U||t[64]!==W||t[65]!==G||t[66]!==K||t[67]!==C?(q=(0,$.jsxs)(`section`,{className:C,children:[H,U,W,G,K]}),t[62]=H,t[63]=U,t[64]=W,t[65]=G,t[66]=K,t[67]=C,t[68]=q):q=t[68],q}var st={reconfiguring:!1};function ct(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:s,authorizingBrokerSecret:c,brokerSecretAuthorizationUrl:l,brokerSecretNotice:u,copyFailedLabel:d,onDraftChange:f,onSave:p,onAuthorize:m,onClear:h,sectionRef:g}=e,v=(0,Z.useId)(),y=r,b=!y,[x,w]=(0,Z.useReducer)(U,st),{reconfiguring:D}=x,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,A;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(A={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=A):A=t[8];let j=A,M;t[9]===o?M=t[10]:(M=o.trim().length>0&&!K(o.trim()),t[9]=o,t[10]=M);let N=M,F;t[11]===f?F=t[12]:(F=()=>{w({type:`patch`,patch:{reconfiguring:!1}}),f(``)},t[11]=f,t[12]=F);let I=F,L=b&&`ring-1 ring-amber-500/30`,z;t[13]===L?z=t[14]:(z=P(L),t[13]=L,t[14]=z);let B=y?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:b?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,V;t[15]===B?V=t[16]:(V=P(`flex size-9 shrink-0 items-center justify-center rounded-lg`,B),t[15]=B,t[16]=V);let H;t[17]===y?H=t[18]:(H=y?(0,$.jsx)(_,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(T,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=y,t[18]=H);let W;t[19]!==V||t[20]!==H?(W=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=W):W=t[21];let ee=y?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,G;t[22]===ee?G=t[23]:(G=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:ee}),t[22]=ee,t[23]=G);let q=y?n.brokerSecretReadyHint:n.brokerSecretHint,te;t[24]===q?te=t[25]:(te=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:q}),t[24]=q,t[25]=te);let ne;t[26]!==b||t[27]!==n.brokerSecretMissingHint?(ne=b?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=b,t[27]=n.brokerSecretMissingHint,t[28]=ne):ne=t[28];let J;t[29]!==G||t[30]!==te||t[31]!==ne?(J=(0,$.jsxs)(`div`,{children:[G,te,ne]}),t[29]=G,t[30]=te,t[31]=ne,t[32]=J):J=t[32];let re;t[33]!==c||t[34]!==b||t[35]!==m||t[36]!==D||t[37]!==s||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(re=b||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(R,{type:`button`,disabled:s||c,onClick:m,children:[c?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,c?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:xe,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(S,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=c,t[34]=b,t[35]=m,t[36]=D,t[37]=s,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=re):re=t[41];let ie;t[42]!==c||t[43]!==l||t[44]!==n.brokerSecretOpenAuthorization?(ie=c&&l?(0,$.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(S,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=c,t[43]=l,t[44]=n.brokerSecretOpenAuthorization,t[45]=ie):ie=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==N||t[50]!==I||t[51]!==d||t[52]!==v||t[53]!==b||t[54]!==h||t[55]!==f||t[56]!==p||t[57]!==D||t[58]!==s||t[59]!==j||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(ae=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:v,children:n.brokerSecretTitle}),(0,$.jsx)(C,{id:v,value:a,labels:j,reveal:lt,loadFailedLabel:d||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(R,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>{w({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(R,{type:`button`,variant:`ghost`,disabled:s,onClick:h,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:v,children:n.brokerSecretTitle}),(0,$.jsx)(C,{id:v,value:o,onChange:f,placeholder:n.brokerSecretPlaceholder,labels:j,disabled:s}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(R,{type:`button`,disabled:s||!N,onClick:p,children:[s?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,b?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(R,{type:`button`,variant:`ghost`,disabled:s,onClick:h,children:n.brokerSecretClear}):null,D?(0,$.jsx)(R,{type:`button`,variant:`ghost`,disabled:s,onClick:I,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=N,t[50]=I,t[51]=d,t[52]=v,t[53]=b,t[54]=h,t[55]=f,t[56]=p,t[57]=D,t[58]=s,t[59]=j,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=ae):ae=t[71];let oe;t[72]===u?oe=t[73]:(oe=u?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:u}):null,t[72]=u,t[73]=oe);let se;t[74]!==J||t[75]!==re||t[76]!==ie||t[77]!==ae||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[J,re,ie,ae,oe]}),t[74]=J,t[75]=re,t[76]=ie,t[77]=ae,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==W||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[W,se]}),t[80]=W,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==z?(Y=(0,$.jsx)(ue,{className:z,children:ce}),t[83]=ce,t[84]=z,t[85]=Y):Y=t[85];let le;return t[86]!==g||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:g,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=g,t[87]=Y,t[88]=le):le=t[88],le}function lt(){return ve().then(ut)}function ut(e){return e.registrationSecret??null}var dt={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function ft({embedded:e=!1}){let t=c(e=>e.language),n=l(t).tunnelSettings,r=!!s(e=>e.conversationId),[i,a]=(0,Z.useReducer)(U,dt),{actionError:o,starting:u,stopping:d,savingAutoStart:f,consentOpen:p,autoStartConfirmOpen:m,releaseConfirmOpen:h,releasing:g,brokerSecretDraft:_,savingBrokerSecret:v,authorizingBrokerSecret:y,brokerSecretAuthorizationUrl:b,brokerSecretNotice:x}=i,S=(0,Z.useRef)(null),{data:C}=L(r),{data:T,error:D,isLoading:O,mutate:k}=F(r?`tunnel-status`:null,_e,{refreshInterval:e=>u?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),A=(0,Z.useMemo)(()=>{let e=C?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return T?.config?.autoStart===!0},[C,T?.config?.autoStart]),j=(0,Z.useMemo)(()=>{let e=C?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[C]),M=K(j),N=T?.registrationSecret?.configured??M;(0,Z.useEffect)(()=>{let e=()=>{k()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[k]);let z=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),B=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await be(T?.state===`error`&&he(Error(T.lastError??``))?{recoverActiveLease:!0}:void 0),await k(),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}}),await k().catch(()=>{})}finally{a({type:`patch`,patch:{starting:!1}})}},[k,T]),V=(0,Z.useCallback)(()=>{if(!N){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),S.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(T?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}B()},[N,T?.consentRequired,B,n.brokerSecretRequiredBeforeStart]),H=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await fe(),await Promise.all([k(),B()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[k,B]),ee=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await me(),await k(),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[k]),G=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ye({autoStart:e}),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),J=(0,Z.useCallback)(()=>{if(A){G(!1);return}if(T?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!T?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[G,T?.canAutoStart,T?.consentRequired,n,A]),oe=(0,Z.useCallback)(async()=>{let e=_.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ye({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),I(),await k(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[_,k,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ye({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),I(),await k()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[k,n.brokerSecretCleared]),ce=(0,Z.useCallback)(async()=>{let e=ie(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await q(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await ne(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await re(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await ge(),await Promise.all([k(),I()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{ae(e),t&&te(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[k,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await me({release:!0}),await k(),I()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[k]),le=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:l(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=T??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:A,brokerUrl:`https://frp.xopc.ai/api`}},pe=T?.consentRequired&&(X.enabled||A||T?.consent?.acceptedAt),ve=(0,$.jsx)(ct,{t:n,brokerSecretReady:N,brokerSecretConfiguredInConfig:M,brokerSecretMaskedValue:M?j:``,brokerSecretDraft:_,savingBrokerSecret:v,authorizingBrokerSecret:y,brokerSecretAuthorizationUrl:b,brokerSecretNotice:x,copyFailedLabel:l(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:S}),xe=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(We,{open:p,title:n.consentTitle,intro:n.consentIntro,bullets:z,checkboxLabel:n.consentCheckbox,confirmLabel:pe?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void H(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},p?`consent-open`:`consent-closed`),(0,$.jsx)(W,{open:m,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),G(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(W,{open:h,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void Y(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ve,(0,$.jsx)(ot,{t:n,status:X,isLoading:O,statusErr:D,starting:u,stopping:d,showConsentExpired:!!pe,copyLabels:le,startDisabled:!N,startDisabledReason:N?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:V,onStop:()=>void ee()}),(0,$.jsxs)(He,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:P(`flex items-center gap-3 text-sm text-fg`,!A&&!T?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:A,disabled:f||!A&&!T?.canAutoStart,onChange:J}),n.autoStart]}),!T?.canAutoStart&&!A?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(R,{type:`button`,variant:`secondary`,disabled:g||d,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[g?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(He,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),xe]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ve,(0,$.jsx)(ot,{t:n,status:X,isLoading:O,statusErr:D,starting:u,stopping:d,showConsentExpired:!!pe,copyLabels:le,startDisabled:!N,startDisabledReason:N?void 0:n.brokerSecretRequiredBeforeStart,onStart:V,onStop:()=>void ee()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(R,{type:`button`,variant:`secondary`,disabled:g||d,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[g?(0,$.jsx)(E,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ue,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:P(`flex items-center gap-3 text-sm text-fg`,!A&&!T?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:A,disabled:f||!A&&!T?.canAutoStart,onChange:J}),n.autoStart]}),!T?.canAutoStart&&!A?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(de,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),xe]})}function pt(e,t){return e.tabs[t]}function mt(e,t){return e.tabIntro[t]}function ht(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function gt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(je,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(pe,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ft,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ce,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ze,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fe,{}),t[6]=e):e=t[6],e}}}function _t(){let e=(0,Q.c)(3),t=o(),n=c(yt),r=l(n).remoteAccess,a=!!s(vt),[u,d]=i(),f=G(),p=Ve(u.get(`tab`)),m=u.get(`intent`)===`mobile-pairing`,h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={refreshInterval:2e3},e[0]=h):h=e[0];let _=F(m?`device-pairing-readiness`:null,X,h),v;e[1]===d?v=e[2]:(v=e=>{d(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=d,e[2]=v);let y=v,b=mt(r,p),x=Be.filter(e=>f||e!==`ssh`&&e!==`reverse-proxy`||e===p).map(e=>({id:e,label:pt(r,e)}));return(0,$.jsxs)(oe,{children:[(0,$.jsx)(se,{title:r.pageTitle,meta:(0,$.jsx)(de,{language:n,label:r.docsLink,section:ht(p),className:`mt-1`})}),a?(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(j,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:_.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(R,{variant:`primary`,disabled:!_.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[_.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(H,{items:x,activeTab:p,onChange:y,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ce,{id:p,activeTab:p,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:pt(r,p),hint:p===`public`?void 0:b,showHeading:!1,framed:!1,children:(0,$.jsx)(gt,{tab:p,onOpenTab:y})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function vt(e){return e.conversationId}function yt(e){return e.language}export{_t as RemoteAccessHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as r}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as r}from"./locale-store-Cit_aHqC.js";var i=e(),a=t();function o(e){let t=(0,i.c)(18),{kind:o,missing:c,backTo:l,retry:u}=e,d=c===void 0||c,f=r(s)===`zh`,p;if(t[0]!==o||t[1]!==d||t[2]!==f){let e=f?{project:`项目`,app:`应用`,plugin:`插件`,"plugin-page":`插件页面`,"plugin-settings":`插件设置`,desktop:`桌面功能`}:{project:`Project`,app:`App`,plugin:`Plugin`,"plugin-page":`Plugin page`,"plugin-settings":`Plugin settings`,desktop:`Desktop feature`};p=o===`desktop`?f?`此功能需要 xopc 桌面版`:`This feature requires xopc desktop`:o===`plugin-page`||o===`plugin-settings`?f?`此插件未提供${o===`plugin-page`?`独立页面`:`设置页面`}`:`This plugin does not provide a ${o===`plugin-page`?`standalone page`:`settings page`}`:d?f?`找不到${e[o]}`:`${e[o]} not found`:f?`暂时无法加载${e[o]}`:`Unable to load ${e[o].toLowerCase()}`,t[0]=o,t[1]=d,t[2]=f,t[3]=p}else p=t[3];let m=p,h;t[4]===m?h=t[5]:(h=(0,a.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:m}),t[4]=m,t[5]=h);let g=l===`/`?f?`返回工作台`:`Back to work`:l.startsWith(`/settings/`)?f?`返回设置`:`Back to settings`:f?`返回列表`:`Back to list`,_;t[6]!==l||t[7]!==g?(_=(0,a.jsx)(n,{className:`text-accent hover:underline`,to:l,children:g}),t[6]=l,t[7]=g,t[8]=_):_=t[8];let v;t[9]!==u||t[10]!==f?(v=u?(0,a.jsx)(`button`,{className:`text-accent hover:underline`,onClick:u,children:f?`重试`:`Retry`}):null,t[9]=u,t[10]=f,t[11]=v):v=t[11];let y;t[12]!==_||t[13]!==v?(y=(0,a.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;return t[15]!==h||t[16]!==y?(b=(0,a.jsxs)(`section`,{className:`mx-auto my-8 w-full max-w-xl space-y-3 rounded-xl border border-edge bg-surface-panel p-6`,role:`status`,children:[h,y]}),t[15]=h,t[16]=y,t[17]=b):b=t[17],b}function s(e){return e.language}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,p as t}from"./locale-store-
|
|
1
|
+
import{l as e,p as t}from"./locale-store-Cit_aHqC.js";import{t as n}from"./phone-workspace-store-CKOW55gy.js";var r=`xopc:right-workspace:v1`,i={open:!1,tabs:[],activeId:null},a={panes:{},width:0,treeWidth:240,fileTreeOpen:!1,sideTreeOpen:!1};function o(){try{let t=JSON.parse(sessionStorage.getItem(r)||`null`);if(!t||t.version!==1||typeof t.panes!=`object`||!t.panes||t.identity!==e.getState().conversationId||t.gateway!==e.getState().baseUrl)return a;let n={};for(let[e,r]of Object.entries(t.panes)){let t=r;if(!t||!Array.isArray(t.tabs))continue;let i=t.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`));n[e]={open:t.open===!0&&i.length>0,tabs:i,activeId:i.some(e=>e.id===t.activeId)?t.activeId:i[0]?.id??null}}return{...a,panes:n}}catch{return a}}function s(e,t){try{let n=Number(localStorage.getItem(e));return n>0&&Number.isFinite(n)?n:t}catch{return t}}function c(t){try{let n=Object.fromEntries(Object.entries(t.panes).map(([e,t])=>[e,{...t,tabs:t.tabs.filter(e=>e.kind!==`browser`&&(e.kind!==`file`||!e.attachment)).map(e=>({...e}))}]));sessionStorage.setItem(r,JSON.stringify({version:1,identity:e.getState().conversationId,gateway:e.getState().baseUrl,panes:n}))}catch{}}var l=new WeakMap;function u(e){return e?e.id||e.uri?e.id||e.uri:(l.has(e)||l.set(e,crypto.randomUUID()),l.get(e)):``}function d(e){return e.replace(/\\/g,`/`).split(`/`).filter(e=>e!==`.`).join(`/`)}function f(e){let t=e.projectId?`project:${e.projectId}`:e.conversationId?`session:${e.conversationId}`:`agent:${e.agentId??``}`;return JSON.stringify([t,e.path?d(e.path):u(e.attachment)])}var p=t((e,t)=>{let r=(n,r)=>{e(e=>({panes:{...e.panes,[n]:r(e.panes[n]??i)}})),c(t())};return{...o(),width:s(`xopc:workspace-width`,0),treeWidth:s(`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[n,i]of Object.entries(t().panes))i.tabs.some(t=>t.id===e&&t.kind===`file`&&t.preview)&&r(n,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 a=t().panes[n];if(!a||n===r)return;let o=t().panes[r]??i,s={...t().panes,[r]:{open:a.open||o.open,tabs:[...o.tabs,...a.tabs.filter(e=>!o.tabs.some(t=>t.id===e.id))],activeId:a.activeId??o.activeId}};delete s[n],e({panes:s,scope:t().scope===n?r:t().scope}),c(t())},openPhone:(e,t,i,a=!0,o=!0)=>{let s=`phone:${e}`;r(i,n=>({open:a||n.open,activeId:a?s:n.activeId,tabs:n.tabs.some(e=>e.id===s)?n.tabs.map(e=>e.id===s?{...e,title:t}:e):[...n.tabs,{id:s,kind:`phone`,phoneSessionId:e,title:t,visitedAt:Date.now()}]})),o&&n.getState().show(e,a,/^[\da-f]{8}-[\da-f-]{27}$/i.test(i)?i:void 0)},openTools:(e=t().scope)=>{let n=crypto.randomUUID();return r(e,e=>{let t=[...e.tabs];return t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,{id:n,kind:`home`,title:`New tab`,visitedAt:Date.now()}),{open:!0,tabs:t,activeId:n}}),n},openBrowser:(e,n=t().scope,a)=>{let o=t().panes[n]??i,s=o.tabs.find(e=>e.id===o.activeId&&e.kind===`home`)?.id??crypto.randomUUID(),c={id:s,kind:`browser`,title:`Browser`,initialUrl:e,visitedAt:Date.now(),returnTo:a??o.activeId??void 0};return r(n,e=>{let t=[...e.tabs],n=t.findIndex(e=>e.id===s);return n>=0?t[n]=c:t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,c),{open:!0,activeId:s,tabs:t}}),s},updateBrowserTitle:(e,n)=>{for(let[i,a]of Object.entries(t().panes))a.tabs.some(t=>t.id===e&&t.kind===`browser`&&t.title!==n)&&r(i,t=>({...t,tabs:t.tabs.map(t=>t.id===e?{...t,title:n.slice(0,200)}:t)}))},openFiles:(e=t().scope)=>{let n=t().panes[e]??i,a=n.tabs.find(e=>e.kind===`files`);if(a){t().activate(a.id,e);return}let o=n.tabs.find(e=>e.id===n.activeId&&e.kind===`home`),s=o?.id??crypto.randomUUID();r(e,e=>({open:!0,activeId:s,tabs:o?e.tabs.map(e=>e.id===s?{...e,kind:`files`,title:`Files`}:e):[...e.tabs,{id:s,kind:`files`,title:`Files`,visitedAt:Date.now()}]}))},setOpen:(e,n=t().scope)=>{if(e&&!t().panes[n]?.tabs.length){t().openTools(n);return}r(n,t=>({...t,open:e,activeId:t.activeId??t.tabs[0]?.id??null}))},activate:(e,i=t().scope)=>{let a=t().panes[i]?.tabs.find(t=>t.id===e);a?.kind===`phone`&&(n.getState().setDisplayMode(`docked`),n.getState().show(a.phoneSessionId,!0,/^[\da-f]{8}-[\da-f-]{27}$/i.test(i)?i:void 0)),r(i,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,n=t().scope)=>{let a=t().panes[n]??i,o=a.tabs.find(t=>t.kind===`file`&&(f(t)===f(e)||t.aliases?.includes(f(e)))),s=!o&&e.preview!==!1?a.tabs.find(e=>e.kind===`file`&&e.preview&&!t().fileStatus[e.id]):void 0,c=o?.id??crypto.randomUUID(),l={...o?.kind===`file`?o:{},...e,preview:o?.kind===`file`?o.preview===!0:e.preview!==!1,id:c,kind:`file`,title:e.path?.replace(/\\/g,`/`).split(`/`).pop()||e.attachment?.name||`File`,visitedAt:Date.now(),returnTo:o?.returnTo??(s?s.returnTo:a.activeId??void 0)};return r(n,e=>{let t=[...e.tabs],n=t.findIndex(e=>e.id===c);return n>=0?t[n]=l:s?t[t.findIndex(e=>e.id===s.id)]=l:t.splice(Math.max(0,t.findIndex(t=>t.id===e.activeId)+1),0,l),{open:!0,tabs:t,activeId:c}}),c},addSideChat:(e,t,n,i=!0)=>r(n,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,n)=>{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===n)continue;let s=a.tabs.find(t=>t.kind===`file`&&t.id!==e&&t.resourceId===n);r(i,r=>!s||t().fileStatus[e]?{...r,tabs:r.tabs.map(t=>t.id===e?{...t,resourceId:n}:t)}:{...r,activeId:r.activeId===e?s.id:r.activeId,tabs:r.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??[],f(o)])],line:o.line??s.line}:e)})}},replaceSideChat:(e,t,n)=>r(n,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,n=t().scope)=>r(n,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`}),c(t())}}});e.subscribe((e,t)=>{e.baseUrl!==t.baseUrl||t.conversationId!==void 0&&e.conversationId!==t.conversationId?p.getState().reset():e.conversationId&&!t.conversationId&&p.setState({panes:o().panes})});export{p as n,i as t};
|