yepanywhere 0.9.0 → 0.9.1
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/bundled/@yep-anywhere/shared/dist/__tests__/long-context-effort-warning.test.js +19 -0
- package/bundled/@yep-anywhere/shared/dist/__tests__/long-context-effort-warning.test.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/capability-ids.d.ts +6 -0
- package/bundled/@yep-anywhere/shared/dist/capability-ids.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/capability-ids.js +6 -0
- package/bundled/@yep-anywhere/shared/dist/capability-ids.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.d.ts +11 -11
- package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.js +26 -9
- package/bundled/@yep-anywhere/shared/dist/long-context-effort-warning.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/server-capabilities.d.ts +20 -0
- package/bundled/@yep-anywhere/shared/dist/server-capabilities.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/server-capabilities.js +22 -0
- package/bundled/@yep-anywhere/shared/dist/server-capabilities.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/types.d.ts +7 -0
- package/bundled/@yep-anywhere/shared/dist/types.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/types.js.map +1 -1
- package/bundled/@yep-anywhere/shared/package.json +1 -1
- package/client-dist/assets/AboutSettings-CHsaLshd.js +1 -0
- package/client-dist/assets/{ActivityPage-FgSG_9Sl.js → ActivityPage-CBVcBckm.js} +1 -1
- package/client-dist/assets/{AgentContextSettings-BfTCI7qG.js → AgentContextSettings-DLLaiwUX.js} +3 -3
- package/client-dist/assets/AgentsPage-C3_U9MGs.js +2 -0
- package/client-dist/assets/App-DYWU2-wq.js +2 -0
- package/client-dist/assets/AppearanceSettings-Ci0wlAx3.js +2 -0
- package/client-dist/assets/AppsSettings-B1BIWKaz.js +1 -0
- package/client-dist/assets/AttachmentChip-CQTl9l1O.js +1 -0
- package/client-dist/assets/{AuthContext-CVsoMulX.js → AuthContext-BQK10GgC.js} +1 -1
- package/client-dist/assets/{BangCommandDisplayObject-B8KrHDzH.js → BangCommandDisplayObject-BDGW0BZN.js} +1 -1
- package/client-dist/assets/BangCommandsPage-C1-n2iHi.js +1 -0
- package/client-dist/assets/BrowserDebugToolbarButton-CRE47FFy.js +1 -0
- package/client-dist/assets/{CacheMissBillingSettings-Bfqlk9rA.js → CacheMissBillingSettings-BspB12sl.js} +2 -2
- package/client-dist/assets/{CodexUpdatePrompt-ChHtbla-.js → CodexUpdatePrompt-BXTqvclk.js} +1 -1
- package/client-dist/assets/{CommittedRangeInput-C3Z7YUlS.js → CommittedRangeInput-bK7EXtAc.js} +1 -1
- package/client-dist/assets/{CommittedRangeNumberInput-D497_5ff.js → CommittedRangeNumberInput-bGOjN2Xv.js} +1 -1
- package/client-dist/assets/ComputerControlSettings-BLA4wsEA.js +1 -0
- package/client-dist/assets/{ConversationPreviewPage-CTWx9N3v.js → ConversationPreviewPage-rxHQQOck.js} +2 -2
- package/client-dist/assets/DevelopmentSettings-CFo3ctnP.js +1 -0
- package/client-dist/assets/DevicesSettings-DPdJOmEQ.js +1 -0
- package/client-dist/assets/EmulatorPage-RPHDvihL.js +1 -0
- package/client-dist/assets/EmulatorSettings-8dHy0xqk.js +1 -0
- package/client-dist/assets/EnvironmentSettings-DaFyodJV.js +1 -0
- package/client-dist/assets/FilePage-BwbKyIGF.js +1 -0
- package/client-dist/assets/FilterDropdown-BiB5gAUh.js +1 -0
- package/client-dist/assets/FilterDropdown-D11gXriH.css +1 -0
- package/client-dist/assets/FloatingActionButton-DEiaqWhv.js +1 -0
- package/client-dist/assets/{GitStatusPage-879aktqc.js → GitStatusPage-CSXr__tv.js} +3 -3
- package/client-dist/assets/GlobalSessionsPage-C-CbcZjC.js +2 -0
- package/client-dist/assets/GlobalSessionsPage-dlTB6crv.css +1 -0
- package/client-dist/assets/{HeartbeatTextArea-CKxL-bdJ.js → HeartbeatTextArea-DWZZh0eE.js} +1 -1
- package/client-dist/assets/HostIdentityContext-DbEx7dor.js +1 -0
- package/client-dist/assets/HostsPage-BRlkrB-8.js +1 -0
- package/client-dist/assets/{InboxContext-opkOiXDB.js → InboxContext-DtjKccKZ.js} +1 -1
- package/client-dist/assets/InboxPage-DFaLlFm5.js +1 -0
- package/client-dist/assets/IssueSettings-CHjLBTZK.js +1 -0
- package/client-dist/assets/IssuesPage-CfYD-jwK.js +1 -0
- package/client-dist/assets/LifecycleWebhooksSettings-Ir3_1MvY.js +1 -0
- package/client-dist/assets/{LocalAccessSettings-BpmNC9pI.js → LocalAccessSettings-BVh3wBDY.js} +3 -3
- package/client-dist/assets/LocalMediaModal-DOcizK52.css +1 -0
- package/client-dist/assets/LocalMediaModal-DyDpC0dk.js +12 -0
- package/client-dist/assets/{LoginPage-Cu7cX9wS.js → LoginPage-irZxKYu1.js} +1 -1
- package/client-dist/assets/{MessageAge-Cd1C0-Kr.js → MessageAge-CKdiBg7K.js} +1 -1
- package/client-dist/assets/{MessageDeliverySettings-B_9VqCMP.js → MessageDeliverySettings-BJ6Hgu1F.js} +2 -2
- package/client-dist/assets/{MessageInput-B0t6b_Hd.js → MessageInput-leX__dbU.js} +2 -2
- package/client-dist/assets/MessageInputToolbar-BIL_6i7G.css +1 -0
- package/client-dist/assets/MessageInputToolbar-CvUMMGJv.js +58 -0
- package/client-dist/assets/MessageList-DDA4Q_Gj.js +4 -0
- package/client-dist/assets/MessageList-rD5OPsAJ.css +1 -0
- package/client-dist/assets/Modal-DOzUIhWU.js +15 -0
- package/client-dist/assets/ModelSettings-SWaaTKgm.js +1 -0
- package/client-dist/assets/NavigationLayout-D8BMwd7T.js +2 -0
- package/client-dist/assets/NewSessionPage-BBFzYBNs.js +1 -0
- package/client-dist/assets/NotificationsSettings-0iotA0wy.js +1 -0
- package/client-dist/assets/PageHeader-Ca3PbaMb.js +1 -0
- package/client-dist/assets/PerformanceSettings-BgDJMjlN.js +1 -0
- package/client-dist/assets/{ProjectSessionDefaultsModal-Dq2_xDka.js → ProjectSessionDefaultsModal-LEaPwpSM.js} +1 -1
- package/client-dist/assets/ProjectTemplatesSettings-fPlh8ZpJ.js +1 -0
- package/client-dist/assets/ProjectsPage-CiQ3rBB_.js +1 -0
- package/client-dist/assets/ProviderBadge-BKZVllDn.js +1 -0
- package/client-dist/assets/{ProviderChildSessionDetail-tWrpaB_X.js → ProviderChildSessionDetail-CSAbaZtr.js} +31 -31
- package/client-dist/assets/ProviderChildSessionPage-vpu5u3YA.js +1 -0
- package/client-dist/assets/ProvidersSettings-B327MdUT.js +1 -0
- package/client-dist/assets/{RecapAfterSecondsControl-qU0RMrUX.js → RecapAfterSecondsControl-DWG9fB4u.js} +1 -1
- package/client-dist/assets/{RelayProtocol-DjpPJk64.js → RelayProtocol-DOWXVB0k.js} +1 -1
- package/client-dist/assets/RemoteAccessSettings-CBSIP-qP.js +1 -0
- package/client-dist/assets/RemoteExecutorsSettings-DDAqEB42.js +1 -0
- package/client-dist/assets/SchemaValidationContext-DLNGXai_.js +1 -0
- package/client-dist/assets/{SearchPreview-B25ksFLA.js → SearchPreview-BCP67hKg.js} +1 -1
- package/client-dist/assets/{SessionHeader.module-Co9s-JR3.js → SessionHeader.module-CHO2T3eQ.js} +1 -1
- package/client-dist/assets/SessionPage-BJ5qaa-G.js +50 -0
- package/client-dist/assets/{SettingsItem-B_rM9Vhi.js → SettingsItem-BWF_CyTI.js} +1 -1
- package/client-dist/assets/{SettingsSection-DOwc_RwX.js → SettingsSection-DbOwfvBD.js} +1 -1
- package/client-dist/assets/SourceControlSettings-BopLkzc6.js +1 -0
- package/client-dist/assets/{SourceFileHeaderActions-3_76js_o.js → SourceFileHeaderActions-HoUciheJ.js} +1 -1
- package/client-dist/assets/SpeechControlMenu-DEDIWl9h.js +2 -0
- package/client-dist/assets/{SpeechSettings-BT4TnSgr.js → SpeechSettings-B4mB2LIj.js} +2 -2
- package/client-dist/assets/{SpeechSmartTurnControls-vIZ8a7Lb.js → SpeechSmartTurnControls-tb5zP_85.js} +1 -1
- package/client-dist/assets/StorageSettings-B5A0CtTo.js +1 -0
- package/client-dist/assets/{ThinkingControls-CbZcYobp.js → ThinkingControls-BEweLRqu.js} +1 -1
- package/client-dist/assets/ToolbarSettings-CJbxOope.js +1 -0
- package/client-dist/assets/UsersSettings-NWqRSGov.js +1 -0
- package/client-dist/assets/ViewerModePage-CfJJA5GL.css +1 -0
- package/client-dist/assets/ViewerModePage-Dyq_I7ws.js +1 -0
- package/client-dist/assets/{VoiceInputButton-japn0Kx_.js → VoiceInputButton-0BzvkjjK.js} +1 -1
- package/client-dist/assets/WorkstreamsPage-oM6jTLsK.js +1 -0
- package/client-dist/assets/{YaServerProvider-OSxrnpr9.js → YaServerProvider-BNTM9_P9.js} +1 -1
- package/client-dist/assets/{YepAnywhereLogo-OH70DoR4.js → YepAnywhereLogo-C4H1sg3q.js} +1 -1
- package/client-dist/assets/{abnfDiagram-VCTEODGH-BK2byNq2.js → abnfDiagram-VCTEODGH-DIBSwOuB.js} +1 -1
- package/client-dist/assets/{arc-BZ7613Gf.js → arc-Blz12Cef.js} +1 -1
- package/client-dist/assets/{architectureDiagram-5GKGNRK7-WEjy-r-z.js → architectureDiagram-5GKGNRK7-CtTnQhBI.js} +1 -1
- package/client-dist/assets/{attachmentFileNames-BfFUuufi.js → attachmentFileNames-DwaA5IPB.js} +1 -1
- package/client-dist/assets/{blockDiagram-I7D4REHJ-BOsYYXyW.js → blockDiagram-I7D4REHJ-BanTkGM6.js} +1 -1
- package/client-dist/assets/{c4Diagram-7LVT6UL2-BRrAUZLE.js → c4Diagram-7LVT6UL2-C4p1KgTp.js} +1 -1
- package/client-dist/assets/channel-DwT-nHaK.js +1 -0
- package/client-dist/assets/{chunk-2Q5K7J3B-ikUS9MZO.js → chunk-2Q5K7J3B-CJSvy8go.js} +1 -1
- package/client-dist/assets/{chunk-5VM5RSS4-DqxRtuTQ.js → chunk-5VM5RSS4-BVg02Giz.js} +1 -1
- package/client-dist/assets/{chunk-F27PBJKO-DQAhMVEw.js → chunk-F27PBJKO-f_VOUJ8l.js} +1 -1
- package/client-dist/assets/{chunk-IMKFNOWR-B2QXI9W-.js → chunk-IMKFNOWR-P5H0uE4d.js} +1 -1
- package/client-dist/assets/{chunk-JWPE2WC7-Px4jgxzE.js → chunk-JWPE2WC7-BpEGNu2X.js} +1 -1
- package/client-dist/assets/{chunk-POPQ4Y6H-BTrXHY42.js → chunk-POPQ4Y6H-oZudgMt7.js} +1 -1
- package/client-dist/assets/{chunk-SVP7TREG-DufcbLSM.js → chunk-SVP7TREG-dMWNgoWs.js} +1 -1
- package/client-dist/assets/{chunk-TICWLB2K-C6xArrXi.js → chunk-TICWLB2K-D8VqJUFw.js} +1 -1
- package/client-dist/assets/{chunk-XXDRQBXY-CtTuQMK6.js → chunk-XXDRQBXY-ZwkKkcDz.js} +1 -1
- package/client-dist/assets/classDiagram-ZZMXUADV-DdlhZ-2W.js +1 -0
- package/client-dist/assets/classDiagram-v2-VYDZK3BY-DdlhZ-2W.js +1 -0
- package/client-dist/assets/{client-sN_tbfxh.js → client-D_ikArFV.js} +2 -2
- package/client-dist/assets/{compactSettingsControls-BjKplkgf.js → compactSettingsControls-CzgNQCH3.js} +1 -1
- package/client-dist/assets/{cose-bilkent-JH36ORCC-Cn15YJGj.js → cose-bilkent-JH36ORCC-DrtmDj3A.js} +1 -1
- package/client-dist/assets/{cynefin-OW5HDTMX-CJkFJ0DX.js → cynefin-OW5HDTMX-CYhxgFq5.js} +1 -1
- package/client-dist/assets/{cynefinDiagram-5FMLGOSQ-CVX2L_eF.js → cynefinDiagram-5FMLGOSQ-BXvBp5eq.js} +1 -1
- package/client-dist/assets/{dagre-GXQ25YYZ-BMbYVbaU.js → dagre-GXQ25YYZ-CdvzhCPS.js} +1 -1
- package/client-dist/assets/de-Cgdxe5vX.js +6 -0
- package/client-dist/assets/{diagram-S7CK7UJ4-DTZ_P_Fh.js → diagram-S7CK7UJ4-DSGzzHN1.js} +1 -1
- package/client-dist/assets/{diagram-UQ7AKVKN-C6cgxro0.js → diagram-UQ7AKVKN-Bk4fbl1S.js} +1 -1
- package/client-dist/assets/{diagram-VSXAHHWV-MzNPAr2n.js → diagram-VSXAHHWV-BAOCj4oX.js} +1 -1
- package/client-dist/assets/{diagram-VX7I27RA-BZN6iloV.js → diagram-VX7I27RA-KHmeuEjq.js} +1 -1
- package/client-dist/assets/{diagram-Z3DM3KII-CtTiorxp.js → diagram-Z3DM3KII-D6GpIAdx.js} +1 -1
- package/client-dist/assets/{ebnfDiagram-PWID7BFC-B28XYdqt.js → ebnfDiagram-PWID7BFC-Bm_JuhNL.js} +1 -1
- package/client-dist/assets/{erDiagram-RLTQ6QDP-DlMmHWyy.js → erDiagram-RLTQ6QDP-u5Ryj9Z_.js} +1 -1
- package/client-dist/assets/es-gyRk85dY.js +6 -0
- package/client-dist/assets/{flowDiagram-HODETNUW-C5mVciwL.js → flowDiagram-HODETNUW-C9A7e1yC.js} +1 -1
- package/client-dist/assets/fr-Dx9lA8u-.js +6 -0
- package/client-dist/assets/{frontendReload-DT6MOpjg.js → frontendReload-DN8qVYjF.js} +1 -1
- package/client-dist/assets/{ganttDiagram-EL5Y4UJY-BTl7ZRTR.js → ganttDiagram-EL5Y4UJY-BEIN_FhZ.js} +1 -1
- package/client-dist/assets/{gitGraphDiagram-WWUBYQGX-BsG6KEKe.js → gitGraphDiagram-WWUBYQGX-Cu5ow6Ls.js} +1 -1
- package/client-dist/assets/{hostStorage-BoEdRarg.js → hostStorage-C37tOOJa.js} +1 -1
- package/client-dist/assets/index-BY-TgOY-.js +81 -0
- package/client-dist/assets/index-BgkZrNQv.js +1 -0
- package/client-dist/assets/{index-BBpZzMBa.js → index-BrCZcBcO.js} +2 -2
- package/client-dist/assets/{index-CkZXrIi5.js → index-LT-lzpNS.js} +1 -1
- package/client-dist/assets/index-YAR5D3xY.js +2 -0
- package/client-dist/assets/{index-D7q51uJV.js → index-_2WVhpKj.js} +1 -1
- package/client-dist/assets/{infoDiagram-27XIBGKW-CkZcthz-.js → infoDiagram-27XIBGKW-ILfv0Qu_.js} +1 -1
- package/client-dist/assets/{ishikawaDiagram-5VMMS53U-Cvqitz5U.js → ishikawaDiagram-5VMMS53U-D1P8nenz.js} +1 -1
- package/client-dist/assets/ja-BOj7smkY.js +6 -0
- package/client-dist/assets/{journeyDiagram-3NMN7TZE-vCw00Cqy.js → journeyDiagram-3NMN7TZE-CXP61NqX.js} +1 -1
- package/client-dist/assets/{kanban-definition-UXKFOSKX-BZGCo-wX.js → kanban-definition-UXKFOSKX-2x79Nimu.js} +1 -1
- package/client-dist/assets/{layout-D7JRfual.js → layout-D7AfOq-G.js} +1 -1
- package/client-dist/assets/{linear-O9cHRsA5.js → linear-B_4Bripc.js} +1 -1
- package/client-dist/assets/long-context-effort-warning-C6XHizE1.js +1 -0
- package/client-dist/assets/{mermaid.core-CdC8AeOx.js → mermaid.core-y_avJe8E.js} +5 -5
- package/client-dist/assets/{mindmap-definition-YA3MSWOX-CczC57z0.js → mindmap-definition-YA3MSWOX-DwMJuV6d.js} +1 -1
- package/client-dist/assets/newSessionPrefill-DKcy0abh.js +1 -0
- package/client-dist/assets/{pegDiagram-XKGWAZYB-jTm4iBWK.js → pegDiagram-XKGWAZYB-43LaxzRF.js} +1 -1
- package/client-dist/assets/{pieDiagram-E7YTZNPT-DfkDPuJg.js → pieDiagram-E7YTZNPT-DAOi_afd.js} +1 -1
- package/client-dist/assets/providerChildSessions-BpJF5D9s.css +1 -0
- package/client-dist/assets/providerChildSessions-DVWCZpC4.js +78 -0
- package/client-dist/assets/{quadrantDiagram-AXDQQJYC--bBZSIt1.js → quadrantDiagram-AXDQQJYC-BRPBWWpv.js} +1 -1
- package/client-dist/assets/{railroadDiagram-O6MQD6OU-gbkMdGN6.js → railroadDiagram-O6MQD6OU-xAuDG62P.js} +1 -1
- package/client-dist/assets/{recentProjectPathLinks-Ba20jx5b.js → recentProjectPathLinks-B6pQxzWg.js} +2 -2
- package/client-dist/assets/{registerServiceWorker-CGxgV4Yi.js → registerServiceWorker-fKJh5dWO.js} +1 -1
- package/client-dist/assets/{relayEndpoints-0oIbn4eU.js → relayEndpoints-DRyKx83V.js} +1 -1
- package/client-dist/assets/{remoteRoutePaths-CiDZeM2I.js → remoteRoutePaths-BxKY1U2z.js} +1 -1
- package/client-dist/assets/{requirementDiagram-BXWQKSXE-WfLCTewk.js → requirementDiagram-BXWQKSXE-BJvybhuU.js} +1 -1
- package/client-dist/assets/{sankeyDiagram-P5KCCOFB-BhJkx_M1.js → sankeyDiagram-P5KCCOFB-aAAflmwo.js} +1 -1
- package/client-dist/assets/{sequenceDiagram-WJ2MYXX4-_S-ZN-hK.js → sequenceDiagram-WJ2MYXX4-CP3BPtU-.js} +1 -1
- package/client-dist/assets/sessionHistorySearch.worker-DCkPlfGO.js +61 -0
- package/client-dist/assets/{sessionNavigationState-DKXD1sTS.js → sessionNavigationState-MSOOrZi4.js} +1 -1
- package/client-dist/assets/{sizeCapture-INFHLROL-YfaR_7-Y.js → sizeCapture-INFHLROL-BwAQ5zb3.js} +1 -1
- package/client-dist/assets/{sourceControlNavigationState-lyZ29oaF.js → sourceControlNavigationState-t_nQLZvO.js} +1 -1
- package/client-dist/assets/{speechDraftTransaction-zyWVCYTF.js → speechDraftTransaction-8sgF4uer.js} +1 -1
- package/client-dist/assets/{stateDiagram-D77RDMKH-_N9FdD6m.js → stateDiagram-D77RDMKH-B8llvNN3.js} +1 -1
- package/client-dist/assets/stateDiagram-v2-MP3YSRHH-CD7vRqY6.js +1 -0
- package/client-dist/assets/{swimlanes-42K2YHIH-DUl5jFZz.js → swimlanes-42K2YHIH-qqdgDD32.js} +1 -1
- package/client-dist/assets/swimlanesDiagram-VR7AAH4N-NBdWyLIY.js +8 -0
- package/client-dist/assets/{timeline-definition-24CTP7MA-DtYzRl63.js → timeline-definition-24CTP7MA-EBxDGVBl.js} +1 -1
- package/client-dist/assets/useAcliCommentarySetting-JMx-BSAu.js +9 -0
- package/client-dist/assets/useActivityBusState-CnG-LXsr.js +1 -0
- package/client-dist/assets/{useBackgroundRevalidation-CULom4_W.js → useBackgroundRevalidation-7vLWDD_M.js} +1 -1
- package/client-dist/assets/{useCodexUpdateStatus-BIDehnvt.js → useCodexUpdateStatus-CAR1HkyO.js} +1 -1
- package/client-dist/assets/{useConnectedDevices-kBo43kbz.js → useConnectedDevices-DxgKt21O.js} +1 -1
- package/client-dist/assets/{useDocumentTitle-C06qawRj.js → useDocumentTitle-bldu9XOq.js} +1 -1
- package/client-dist/assets/{useEmulators-Bz8194e3.js → useEmulators-BPiSdRjQ.js} +1 -1
- package/client-dist/assets/{useFileActivity-CwkGwsQt.js → useFileActivity-D0JXhEz7.js} +1 -1
- package/client-dist/assets/{useFloatingActionButtonEnabled-C31rfHtR.js → useFloatingActionButtonEnabled-Dp_hZuYb.js} +1 -1
- package/client-dist/assets/{useForkSummaryAutoOpen-D_SvtmbE.js → useForkSummaryAutoOpen-Cty_gTm1.js} +1 -1
- package/client-dist/assets/{useGeneratedTitleLength-Cu-SoQ6T.js → useGeneratedTitleLength-BpbPYGRf.js} +1 -1
- package/client-dist/assets/{useKeepMobileKeyboardOpenAfterDelivery-C-cYLaEU.js → useKeepMobileKeyboardOpenAfterDelivery-BWCiVVkU.js} +1 -1
- package/client-dist/assets/useModelSettings-CeABGid0.js +1 -0
- package/client-dist/assets/{useNotifyInApp-BcLZ8ie_.js → useNotifyInApp-CuUBcZeR.js} +1 -1
- package/client-dist/assets/{useOnboarding-CYgE-Xsg.js → useOnboarding-BDCBf2Fp.js} +1 -1
- package/client-dist/assets/{useProviders-C6kBPWYX.js → useProviders-45TZLkhy.js} +1 -1
- package/client-dist/assets/{useQuestionAsideSetting-6Excl6Pm.js → useQuestionAsideSetting-B0bjoe-z.js} +1 -1
- package/client-dist/assets/{useRecentSessions-CsmsGemq.js → useRecentSessions-COrEGQJH.js} +2 -2
- package/client-dist/assets/{useRelativeNow-BdLaPgKO.js → useRelativeNow-XM1dKxcx.js} +1 -1
- package/client-dist/assets/{useReloadNotifications-B0egr2ys.js → useReloadNotifications-JBj22syT.js} +1 -1
- package/client-dist/assets/{useRemoteExecutors-Bgjgzif1.js → useRemoteExecutors-Bzvi8gRe.js} +1 -1
- package/client-dist/assets/{useSidebarWidth-ut6NNk5Y.js → useSidebarWidth-CITe0sSV.js} +1 -1
- package/client-dist/assets/{useSourceControlCleanLanding-DxrwogwF.js → useSourceControlCleanLanding-B-8NTKPa.js} +1 -1
- package/client-dist/assets/{useStableToolPreviewRendering-CcrkchTG.js → useStableToolPreviewRendering-CeH1PY9S.js} +1 -1
- package/client-dist/assets/{useStreamingEnabled-EdvW04Vz.js → useStreamingEnabled-C535nHwb.js} +1 -1
- package/client-dist/assets/{useTabTitleActivityPreference-B0suFUHK.js → useTabTitleActivityPreference-NekVdSEZ.js} +1 -1
- package/client-dist/assets/{useVhostAccess-2ZKr0Lcl.js → useVhostAccess-CHT40zJ3.js} +1 -1
- package/client-dist/assets/{useWorkflowTags-_4F_41YI.js → useWorkflowTags-Bl7Czynw.js} +1 -1
- package/client-dist/assets/{vennDiagram-4TSXK5OY-26XZDUe6.js → vennDiagram-4TSXK5OY-BRLuM0pk.js} +1 -1
- package/client-dist/assets/{wardleyDiagram-VM6X3IG4-YvZ37BJ7.js → wardleyDiagram-VM6X3IG4-D5cPV-h-.js} +1 -1
- package/client-dist/assets/{xychartDiagram-S5SC5T6Z-BMT0MEGz.js → xychartDiagram-S5SC5T6Z-M2QslymW.js} +1 -1
- package/client-dist/assets/zh-CN-DadySLj9.js +7 -0
- package/client-dist/index.html +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +10 -0
- package/dist/app.js.map +1 -1
- package/dist/artifacts/ArtifactServer.d.ts +3 -0
- package/dist/artifacts/ArtifactServer.d.ts.map +1 -1
- package/dist/artifacts/ArtifactServer.js +47 -1
- package/dist/artifacts/ArtifactServer.js.map +1 -1
- package/dist/routes/file-edit.d.ts +15 -0
- package/dist/routes/file-edit.d.ts.map +1 -0
- package/dist/routes/file-edit.js +228 -0
- package/dist/routes/file-edit.js.map +1 -0
- package/dist/routes/files.d.ts.map +1 -1
- package/dist/routes/files.js +17 -6
- package/dist/routes/files.js.map +1 -1
- package/dist/routes/public-file-shares.d.ts +6 -0
- package/dist/routes/public-file-shares.d.ts.map +1 -1
- package/dist/routes/public-file-shares.js +22 -10
- package/dist/routes/public-file-shares.js.map +1 -1
- package/dist/routes/public-shares.d.ts.map +1 -1
- package/dist/routes/public-shares.js +18 -1
- package/dist/routes/public-shares.js.map +1 -1
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +4 -0
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/version.d.ts.map +1 -1
- package/dist/routes/version.js +1 -0
- package/dist/routes/version.js.map +1 -1
- package/dist/sdk/providers/agent-self.js +1 -1
- package/dist/sdk/providers/agent-self.js.map +1 -1
- package/dist/sdk/providers/claude.d.ts +1 -0
- package/dist/sdk/providers/claude.d.ts.map +1 -1
- package/dist/sdk/providers/claude.js +7 -0
- package/dist/sdk/providers/claude.js.map +1 -1
- package/dist/sdk/providers/codex.d.ts +16 -0
- package/dist/sdk/providers/codex.d.ts.map +1 -1
- package/dist/sdk/providers/codex.js +34 -2
- package/dist/sdk/providers/codex.js.map +1 -1
- package/dist/sdk/providers/index.d.ts.map +1 -1
- package/dist/sdk/providers/index.js +4 -1
- package/dist/sdk/providers/index.js.map +1 -1
- package/dist/sdk/providers/opencode.d.ts +9 -0
- package/dist/sdk/providers/opencode.d.ts.map +1 -1
- package/dist/sdk/providers/opencode.js +129 -76
- package/dist/sdk/providers/opencode.js.map +1 -1
- package/dist/sdk/providers/provider-session-owner.d.ts +9 -0
- package/dist/sdk/providers/provider-session-owner.d.ts.map +1 -1
- package/dist/sdk/providers/provider-session-owner.js +39 -3
- package/dist/sdk/providers/provider-session-owner.js.map +1 -1
- package/dist/sdk/providers/types.d.ts +13 -0
- package/dist/sdk/providers/types.d.ts.map +1 -1
- package/dist/sdk/providers/types.js.map +1 -1
- package/dist/services/ArtifactRebuildService.d.ts +70 -0
- package/dist/services/ArtifactRebuildService.d.ts.map +1 -0
- package/dist/services/ArtifactRebuildService.js +221 -0
- package/dist/services/ArtifactRebuildService.js.map +1 -0
- package/dist/services/DirtyFileEditorService.d.ts +2 -0
- package/dist/services/DirtyFileEditorService.d.ts.map +1 -1
- package/dist/services/DirtyFileEditorService.js +20 -1
- package/dist/services/DirtyFileEditorService.js.map +1 -1
- package/dist/services/SessionCatalogService.d.ts +27 -0
- package/dist/services/SessionCatalogService.d.ts.map +1 -1
- package/dist/services/SessionCatalogService.js +129 -34
- package/dist/services/SessionCatalogService.js.map +1 -1
- package/dist/sessions/opencode-reader.d.ts +2 -1
- package/dist/sessions/opencode-reader.d.ts.map +1 -1
- package/dist/sessions/opencode-reader.js +30 -1
- package/dist/sessions/opencode-reader.js.map +1 -1
- package/dist/sessions/types.d.ts +6 -0
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/supervisor/Process.d.ts +7 -0
- package/dist/supervisor/Process.d.ts.map +1 -1
- package/dist/supervisor/Process.js +48 -3
- package/dist/supervisor/Process.js.map +1 -1
- package/dist/supervisor/Supervisor.d.ts.map +1 -1
- package/dist/supervisor/Supervisor.js +11 -0
- package/dist/supervisor/Supervisor.js.map +1 -1
- package/dist/supervisor/types.d.ts +3 -1
- package/dist/supervisor/types.d.ts.map +1 -1
- package/dist/supervisor/types.js.map +1 -1
- package/package.json +1 -1
- package/client-dist/assets/AboutSettings-BlEONE7w.js +0 -1
- package/client-dist/assets/AgentsPage-CBku9RWz.js +0 -2
- package/client-dist/assets/App-DWHvFKob.js +0 -2
- package/client-dist/assets/AppearanceSettings-BSEBjSjr.js +0 -2
- package/client-dist/assets/AppsSettings-iDL6Xuaa.js +0 -1
- package/client-dist/assets/AttachmentChip-DHKr4EfG.js +0 -1
- package/client-dist/assets/BangCommandsPage-yX8grXp9.js +0 -1
- package/client-dist/assets/BrowserDebugToolbarButton-B-b7N4cr.js +0 -1
- package/client-dist/assets/ComputerControlSettings-DzRDwfJ1.js +0 -1
- package/client-dist/assets/DevelopmentSettings-Bf9gyeU0.js +0 -1
- package/client-dist/assets/DevicesSettings-dbZHFEEc.js +0 -1
- package/client-dist/assets/EmulatorPage-CKJwVTFq.js +0 -1
- package/client-dist/assets/EmulatorSettings-BV9Bg3Xk.js +0 -1
- package/client-dist/assets/EnvironmentSettings-DmOTuSwm.js +0 -1
- package/client-dist/assets/FilePage-DnPW5Pbc.js +0 -1
- package/client-dist/assets/FilterDropdown-CB_tRt6g.css +0 -1
- package/client-dist/assets/FilterDropdown-DpS1eMEf.js +0 -1
- package/client-dist/assets/FloatingActionButton-DBIoFwff.js +0 -1
- package/client-dist/assets/GlobalSessionsPage-Dbnuis89.css +0 -1
- package/client-dist/assets/GlobalSessionsPage-DcmQcX7q.js +0 -2
- package/client-dist/assets/HostIdentityContext-D5aBdejC.js +0 -1
- package/client-dist/assets/HostsPage-C1ZTrhJv.js +0 -1
- package/client-dist/assets/InboxPage-Cepu8VGM.js +0 -1
- package/client-dist/assets/IssueSettings-xRU8E-xR.js +0 -1
- package/client-dist/assets/IssuesPage-c6PUStFT.js +0 -1
- package/client-dist/assets/LifecycleWebhooksSettings-CZcZATjJ.js +0 -1
- package/client-dist/assets/MessageInputToolbar-DdP4tB2S.css +0 -1
- package/client-dist/assets/MessageInputToolbar-rhYW1xGJ.js +0 -58
- package/client-dist/assets/MessageList-Dcvfxbeq.css +0 -1
- package/client-dist/assets/MessageList-dH63bflu.js +0 -4
- package/client-dist/assets/Modal-QUinFhBP.js +0 -16
- package/client-dist/assets/ModelSettings-CcWkVSEK.js +0 -1
- package/client-dist/assets/NavigationLayout-BkOsag-J.js +0 -2
- package/client-dist/assets/NewSessionPage-DcZ9YjmC.js +0 -1
- package/client-dist/assets/NotificationsSettings-DoVzfeME.js +0 -1
- package/client-dist/assets/PageHeader-BaYMLVHI.js +0 -1
- package/client-dist/assets/PerformanceSettings-dwoVtUlX.js +0 -1
- package/client-dist/assets/ProjectTemplatesSettings-BlMWq1wb.js +0 -1
- package/client-dist/assets/ProjectsPage-B5VBairc.js +0 -1
- package/client-dist/assets/ProviderChildSessionPage-B3eTTTjF.js +0 -1
- package/client-dist/assets/ProvidersSettings-OUKp5-Hb.js +0 -1
- package/client-dist/assets/RemoteAccessSettings-Bn0ng7s4.js +0 -1
- package/client-dist/assets/RemoteExecutorsSettings-2Qh-9Qv_.js +0 -1
- package/client-dist/assets/SchemaValidationContext-CIAd7icg.js +0 -1
- package/client-dist/assets/SessionPage-B1g1UFEV.js +0 -49
- package/client-dist/assets/SourceControlSettings-BQfC1KbV.js +0 -1
- package/client-dist/assets/SpeechControlMenu-BIv0O1la.js +0 -2
- package/client-dist/assets/StorageSettings-DQcG9Mbq.js +0 -1
- package/client-dist/assets/ToolbarSettings-CmHVAejU.js +0 -1
- package/client-dist/assets/UsersSettings-COgiiV9D.js +0 -1
- package/client-dist/assets/WorkstreamsPage-DKLRDEAp.js +0 -1
- package/client-dist/assets/channel-C-7AVqtf.js +0 -1
- package/client-dist/assets/classDiagram-ZZMXUADV-DkRr8VcO.js +0 -1
- package/client-dist/assets/classDiagram-v2-VYDZK3BY-DkRr8VcO.js +0 -1
- package/client-dist/assets/de-DKHK9Tu3.js +0 -6
- package/client-dist/assets/es-XSkBrKBg.js +0 -6
- package/client-dist/assets/fr-DKUJaPhN.js +0 -6
- package/client-dist/assets/index-BUrcmRdN.js +0 -76
- package/client-dist/assets/index-CA-BRFYh.js +0 -1
- package/client-dist/assets/ja-BDnQUlyD.js +0 -6
- package/client-dist/assets/long-context-effort-warning-BGls6uvf.js +0 -1
- package/client-dist/assets/newSessionPrefill-DkkSfnYR.js +0 -1
- package/client-dist/assets/providerChildSessions-ClrSXOQr.js +0 -80
- package/client-dist/assets/providerChildSessions-D2O1SLei.css +0 -1
- package/client-dist/assets/sessionHistorySearch.worker-BGlVvPYq.js +0 -60
- package/client-dist/assets/stateDiagram-v2-MP3YSRHH-CBvcZngO.js +0 -1
- package/client-dist/assets/swimlanesDiagram-VR7AAH4N-DKVyQBDp.js +0 -8
- package/client-dist/assets/useAcliCommentarySetting-DxndlmkH.js +0 -9
- package/client-dist/assets/useActivityBusState-CINl9yjP.js +0 -1
- package/client-dist/assets/useModelSettings-DoDJRymT.js +0 -1
- package/client-dist/assets/zh-CN-FVXKSeP_.js +0 -7
- /package/client-dist/assets/{Modal-EC-u4IZ7.css → index-EC-u4IZ7.css} +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-y_avJe8E.js","assets/index-BY-TgOY-.js","assets/react-runtime-D-UPQ57m.js","assets/index-wA2zlxt-.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Ta=Object.defineProperty;var Ia=(e,t,n)=>t in e?Ta(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ee=(e,t,n)=>Ia(e,typeof t!="symbol"?t+"":t,n);import{r as c,h as Rs,U as Le,cm as Na,cn as Pa,co as Vn,cp as Lr,aG as $a,j as a,g as _t,bA as Fa,bB as Ba,s as Ot,G as Da,cq as Io,bb as Oa,aC as Rr,f as Mr,bG as Ha,cr as Ua,bv as Va,ax as tt,u as Ue,aK as _e,cs as No,bs as Ht,ct as qa,cb as Wa,d as Ka,p as Qa,cu as Po,F as $o,cv as Ga,cw as za,cx as Xa,cy as Ya,cz as Ja,cA as Za,cB as ec,cC as tc,by as nc,cD as sc,bz as rc,bp as oc,bt as ic}from"./index-BY-TgOY-.js";import{H as ac,b as Ms,a as oe,ab as cc}from"./client-D_ikArFV.js";import{q as lc,b as As,e as Fo,d as uc,r as dc,i as fc,a as hc,g as Bo,c as mc,s as Nt,t as Mn,v as pc,w as Ar,x as Do,S as gc,y as wc,u as Lt,Q as as,M as Oo,z as yc,A as jr,k as vc,l as xc,j as bc}from"./Modal-DOzUIhWU.js";import{N as Ut,O as js,P as Vt,Q as Ho,B as St,R as cs,T as Sc,e as Ts,f as An,U as ls,W as Is,I as Cc,X as Ec,Y as kc,Z as _c,r as Ns,_ as Uo,$ as jn,g as $t,a0 as Vo,a1 as xn,a2 as Lc,a3 as Rc,a4 as Mc,V as Ac,a5 as qo,a6 as us,p as jc,L as Tc,a7 as Wo,a8 as Tr,c as Ic,a9 as Nc,h as Pc,aa as $c,ab as Fc,v as Ko,ac as Bc,ad as Dc,ae as Oc,C as Ir,af as Hc,E as Qo,ag as Uc,ah as Vc}from"./LocalMediaModal-DyDpC0dk.js";import{k as qc}from"./katex-Dv2p4YRM.js";import{a as dt}from"./appHref-ByaEnJGJ.js";import{g as Go}from"./remoteRoutePaths-BxKY1U2z.js";import{c as Wc,e as Kc,C as Qc}from"./index-YAR5D3xY.js";import{n as Gc,D as zc}from"./relay-url-j3kYm5KO.js";import{P as Xc}from"./ProviderBadge-BKZVllDn.js";const ry=32,oy=64*1024;function iy(e){const t=e.trim().replace(/^#\s*/,""),n=/^acli: 1(?:\s+(.*))?$/.exec(t),s=/^acli-capabilities:\s+(.+)$/.exec(t),r=((n==null?void 0:n[1])??(s==null?void 0:s[1])??"").split(/\s+/);return r.includes(n?"+commentary-lines":"commentary-lines/1")?"lines":r.includes(n?"+commentary":"commentary/1")?"json":null}function Yc(e){JSON.parse(e);const t=/\s*("(?:\\.|[^"\\])*"|[{}[\],:]|[^\s{}[\],:]+)/y;let n=0;const s=()=>{t.lastIndex=n;const o=t.exec(e);if(!o)throw new Error("Missing JSON token");return n=t.lastIndex,{text:o[1],start:n-o[1].length}},r=o=>{if(o>128)throw new Error("JSON nesting exceeds commentary limit");const i=s(),l={start:i.start,end:n};if(i.text==="{"){l.members=[];const u=new Set;for(;;){const d=s();if(d.text==="}")break;const f=JSON.parse(d.text);if(u.has(f))throw new Error("Ambiguous duplicate JSON member");if(u.add(f),s(),l.members.push({key:f,start:d.start,value:r(o+1)}),s().text==="}")break}l.end=n}else if(i.text==="["){l.items=[];const u=n;if(s().text!=="]"){n=u;do l.items.push(r(o+1));while(s().text!=="]")}l.end=n}return l};return r(0)}function Nr(e,t){const n=JSON.parse(e.slice(t.start,t.end));if(!n||Array.isArray(n)||typeof n!="object"||Object.keys(n).length!==1||!Array.isArray(n.commentary)||n.commentary.length===0)return null;const s=[];for(const r of n.commentary){if(!r||typeof r!="object"||Array.isArray(r)||Object.keys(r).length!==1||typeof r.text!="string"||!r.text.trim())return null;s.push(r.text)}return s}function zo(e,t){const n=[];let s=t.start;for(const r of e.removed)r.start<t.start||r.end>t.end||(n.push(e.source.slice(s,r.start)),s=r.end);return n.push(e.source.slice(s,t.end)),n.join("")}function ay(e,t){return t.context?zo(e,t.context):null}function cy(e){const t={source:e,data:e,commentary:[],removed:[],metadataOnly:!1};if(e.length>1024*1024)return t;if(!e.includes("_acli")&&!e.includes("\\")){try{JSON.parse(e),t.json=!0}catch{}return t}let n;try{n=Yc(e)}catch{return t}t.json=!0;const s=o=>{var i;return((i=o.members)==null?void 0:i.length)===1&&o.members[0].key==="_acli"&&Nr(e,o.members[0].value)!==null},r=(o,i,l)=>{var u;if(o.items){let d=null;o.items.forEach((f,h)=>{r(f,`${i}/${h}`,d),s(f)||(d=f)})}(u=o.members)==null||u.forEach((d,f,h)=>{if(d.key!=="_acli"){r(d.value,`${i}/${d.key.replace(/~/g,"~0").replace(/\//g,"~1")}`,null);return}const w=Nr(e,d.value);if(!w)return;const g=s(o)?l:o===n?null:o;w.forEach((b,x)=>{t.commentary.push({id:`${i}/_acli/commentary/${x}`,text:b,context:g})});const p=h[f+1],y=h[f-1];t.removed.push({start:!p&&y?y.value.end:d.start,end:p?p.start:d.value.end})})};return r(n,"",null),t.removed.sort((o,i)=>o.start-i.start),t.metadataOnly=s(n),t.data=zo(t,{start:0,end:e.length}),t}function ly(e){const t="# _acli.commentary: ",n=e.startsWith(t)?e.slice(t.length).replace(/\r?\n$/,""):"",s=e.length<=1024*1024&&!!n.trim();return{source:e,data:s?"":e,commentary:s?[{id:"line",text:n,context:null}]:[],removed:s?[{start:0,end:e.length}]:[],metadataOnly:s}}class Jc{constructor(t="json"){ee(this,"fragments",[]);ee(this,"depth",0);ee(this,"quoted",!1);ee(this,"escaped",!1);ee(this,"json",!1);ee(this,"started",!1);this.format=t}append(t){const n=[];let s=0;for(let r=0;r<t.length;r++){const o=t[r];!this.started&&!/\s/.test(o)&&(this.started=!0,this.json=this.format==="json"&&(o==="{"||o==="[")),this.json&&(this.quoted?this.escaped?this.escaped=!1:o==="\\"?this.escaped=!0:o==='"'&&(this.quoted=!1):o==='"'?this.quoted=!0:o==="{"||o==="["?this.depth++:(o==="}"||o==="]")&&this.depth--),o===`
|
|
3
|
+
`&&(!this.json||!this.quoted&&this.depth<=0)&&(this.fragments.push(t.slice(s,r+1)),n.push(...this.finish()),s=r+1)}return s<t.length&&this.fragments.push(t.slice(s)),n}finish(){const t=this.fragments.join("");return this.fragments=[],this.depth=0,this.quoted=!1,this.escaped=!1,this.json=!1,this.started=!1,t?[t]:[]}}const Zc=8e3,el=120,tl=3;function uy(e){return(e.split(/\r?\n/u).map(n=>n.trim()).find(Boolean)??"Source review").slice(0,el)}function nl(e,t,n=tl,s="new"){if(!Number.isInteger(t)||t<0)return null;let r=0;for(const o of e){if(t<r+o.lines.length)return sl(o,t-r,n,s);r+=o.lines.length}return null}function sl(e,t,n,s){var h,w;let r=e.oldStart,o=e.newStart;for(let g=0;g<t;g++){const p=(h=e.lines[g])==null?void 0:h[0];p==="-"?r++:(p==="+"||r++,o++)}const i=(w=e.lines[t])==null?void 0:w[0];let l,u,d;i==="-"?(l="old",u=r,d=null):i==="+"?(l="new",u=null,d=o):(l=s,u=r,d=o);const f=Math.max(0,t-n);return{side:l,oldLine:u,newLine:d,snippet:rl(e.lines,t,n),snippetAnchorOffset:t-f}}function rl(e,t,n){const s=Math.max(0,t-n),r=Math.min(e.length,t+n+1),o=[];for(let i=s;i<r;i++)o.push((e[i]??"").slice(1));return o.join(`
|
|
4
|
+
`).slice(0,Zc)}const ol=/^([\w.-]+)\[(\d+)\]\{([^}]*)\}:\s*$/;function il(e){const t=[];let n="",s=!1,r=!1;for(let o=0;o<e.length;o+=1){const i=e[o];if(s)i==='"'?e[o+1]==='"'?(n+='"',o+=1):(s=!1,r=!0):n+=i;else if(r){if(i!==",")return null;t.push(n),n="",r=!1}else if(i==='"'&&n==="")s=!0;else{if(i==='"')return null;i===","?(t.push(n),n=""):n+=i}}return s?null:(t.push(n),t)}function al(e){var r,o;const t=e.trim().split(`
|
|
5
|
+
`),n=[];let s=0;for(;s<t.length;){if(!((r=t[s])!=null&&r.trim())){s+=1;continue}const i=(o=t[s])==null?void 0:o.trim().match(ol);if(!i)return null;const l=Number(i[2]),u=(i[3]??"").split(",").map(f=>f.trim());if(u.length===0||u.some(f=>!f))return null;s+=1;const d=[];for(let f=0;f<l;f+=1,s+=1){const h=t[s];if(h===void 0||!h.trim())return null;const w=il(h.trim());if(!w||w.length!==u.length)return null;d.push(w)}n.push({name:i[1]??"",columns:u,rows:d})}return n.length>0?n:null}const qn=/[^\s"'`<>&,:;()[\]{}=|]+/g,Wn=/(?:^|\s)((?:\/(?!\/)|[A-Za-z]:[\\/])\S+)/g,cl=/[.!?]+$/;function ll(e){const t=[];Wn.lastIndex=0;let n=Wn.exec(e);for(;n!==null;){const i=n[1];if(i){const l=n.index+n[0].length-i.length;t.push({end:l+i.length,kind:"absolute",start:l,text:i})}n=Wn.exec(e)}const s=[...t];let r=0;qn.lastIndex=0;let o=qn.exec(e);for(;o!==null;){const l=o[0].replace(cl,""),u=o.index,d=u+l.length;for(;t[r]&&t[r].end<=u;)r+=1;const f=t[r],h=!!f&&u<f.end&&d>f.start;l&&!l.startsWith("/")&&!h&&s.push({end:d,kind:"relative",start:u,text:l}),o=qn.exec(e)}return s.sort((i,l)=>i.start-l.start)}const Kn=typeof Intl.Segmenter=="function"?new Intl.Segmenter("und",{granularity:"grapheme"}):null,Pr=String.fromCodePoint(8205);function ul(e){for(let t=0;t<e.length;t+=1)if(e.charCodeAt(t)>127)return!1;return!0}function dl(e,t){const n=[],s=[],r=[];let o=null;for(let i=0;i<e.length;i+=1){const l=e.charCodeAt(i);if(l===32||l>=9&&l<=13){o??(o=i);continue}o!==null&&(n.push(" "),s.push(o),r.push(i),o=null),n.push(t&&l>=65&&l<=90?String.fromCharCode(l+32):e[i]),s.push(i),r.push(i+1)}return o!==null&&(n.push(" "),s.push(o),r.push(e.length)),{chars:n,ends:r,starts:s}}function $r(e){return e>=4352&&e<=4447||e>=43360&&e<=43388?"L":e>=4448&&e<=4519||e>=55216&&e<=55238?"V":e>=4520&&e<=4607||e>=55243&&e<=55291?"T":e>=44032&&e<=55203?(e-44032)%28===0?"LV":"LVT":null}function fl(e){const t=[];let n="",s=0,r;for(const o of e){const i=s+n.length,l=r?$r(r.codePointAt(0)):null,u=$r(o.codePointAt(0)),d=l==="L"&&(u==="L"||u==="V"||u==="LV"||u==="LVT")||(l==="LV"||l==="V")&&(u==="V"||u==="T")||(l==="LVT"||l==="T")&&u==="T";!(n.length>0&&(new RegExp("\\p{Mark}","u").test(o)||o===Pr||r===Pr||d))&&n&&(t.push({index:s,segment:n}),s+=n.length,n="",r=void 0),n||(s=i),n+=o,r=o}return n&&t.push({index:s,segment:n}),t}function hl(e){return(Kn==null?void 0:Kn.segment(e))??fl(e)}function ml(e,t){const n=e.normalize("NFKC");return t?n.toLowerCase().replaceAll("ς","σ"):n}function Xo(e,t){if(ul(e))return dl(e,t);const n=[],s=[],r=[];let o=null,i=0;const l=()=>{o!==null&&(n.push(" "),s.push(o),r.push(i),o=null)};for(const u of hl(e)){const d=u.index,f=d+u.segment.length;if(/^\s+$/u.test(u.segment)){o??(o=d),i=f;continue}l();for(const h of ml(u.segment,t))n.push(h),s.push(d),r.push(f)}return l(),{chars:n,ends:r,starts:s}}function pl(e){return Xo(e,!0)}function gl(e){return Xo(e,!1).chars.join("").trim()}function Fr(e){return e===void 0||!/[-\u2010\u2011]/u.test(e)&&/[\p{White_Space}\p{P}]/u.test(e)}class wl{constructor(t){ee(this,"boundaryIndexes");ee(this,"occupiedSegments");const n=Array.from(new Set(t.flatMap(s=>[s.start,s.end]))).sort((s,r)=>s-r);this.boundaryIndexes=new Map(n.map((s,r)=>[s,r])),this.occupiedSegments=new Uint32Array(n.length+1)}overlaps(t,n){const s=this.boundaryIndexes.get(t),r=this.boundaryIndexes.get(n);return this.prefixSum(r)>this.prefixSum(s)}add(t,n){const s=this.boundaryIndexes.get(t),r=this.boundaryIndexes.get(n);for(let o=s;o<r;o+=1)this.addSegment(o)}addSegment(t){for(let n=t+1;n<this.occupiedSegments.length;n+=n&-n)this.occupiedSegments[n]+=1}prefixSum(t){let n=0;for(let s=t;s>0;s-=s&-s)n+=this.occupiedSegments[s]??0;return n}}function yl(e,t){return t.visibleCodePoints-e.visibleCodePoints||t.requiredBoldCodePoints-e.requiredBoldCodePoints||e.glossaryOrder-t.glossaryOrder||e.rowOrder-t.rowOrder||e.alternativeOrder-t.alternativeOrder||e.start-t.start||e.end-t.end}function vl(e,t){var u,d,f,h,w,g;if(!e||t.nodes.length===0||t.terminals.length===0)return[];const n=pl(e),s=[],r=new Map;let o=0;for(let p=0;p<n.chars.length;p+=1){const y=n.chars[p];if(y!==void 0){for(;o!==0&&((u=t.nodes[o])==null?void 0:u.transitions[y])===void 0;)o=((d=t.nodes[o])==null?void 0:d.failure)??0;o=((f=t.nodes[o])==null?void 0:f.transitions[y])??((h=t.nodes[0])==null?void 0:h.transitions[y])??0;for(const b of((w=t.nodes[o])==null?void 0:w.outputs)??[]){const x=t.terminals[b];if(!x)continue;const L=p-x.codePointLength+1;if(L<0||!Fr(n.chars[L-1])||!Fr(n.chars[p+1]))continue;const A=n.starts[L],E=n.ends[p];if(A===void 0||E===void 0)continue;const S=e.slice(A,E);if((g=x.caseSensitiveForms)!=null&&g.length){let v=r.get(b);if(v||(v=new Set(x.caseSensitiveForms),r.set(b,v)),!v.has(gl(S)))continue}s.push({alternativeOrder:x.alternativeOrder,definitionText:x.definitionText,end:E,glossaryOrder:x.glossaryOrder,requiredBoldCodePoints:x.requiredBoldCodePoints,rowOrder:x.rowOrder,start:A,terminalIndex:b,visibleCodePoints:Array.from(S).length})}}}s.sort(yl);const i=[],l=new wl(s);for(const p of s)l.overlaps(p.start,p.end)||(l.add(p.start,p.end),i.push(p));return i.sort((p,y)=>p.start-y.start||p.end-y.end),i.map(({definitionText:p,end:y,start:b,terminalIndex:x})=>({definitionText:p,end:y,start:b,terminalIndex:x}))}const gn=Rs(Le.questionReminderTurns,3,e=>{const t=Number(e);return Number.isInteger(t)&&t>=0&&t<=12?t:void 0});function dy(e){if(!Number.isInteger(e)||e<0||e>12)throw new RangeError("Question reminder turns must be an integer from 0 to 12");gn.set(e)}function xl(){return c.useSyncExternalStore(gn.subscribe,gn.read,gn.read)}const bl=Na({draft:Lr(),dismissed:Vn(),seen:Vn(),answer:Lr().nullable(),quoted:Vn().optional(),edits:Pa().nonnegative()}),ds={draft:"",dismissed:!1,seen:!1,answer:null,edits:0};function Ps(e){return(e==null?void 0:e.answer)!=null||(e==null?void 0:e.quoted)===!0}const fs=new Map,Yo=new Set;let Jo=0,Br=0;function fy(e,t){return`yep-async-questions:${e}:${t}`}function $s(e){if(e)try{const t=bl.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function Sl(e){const t={};try{for(let n=0;n<localStorage.length;n++){const s=localStorage.key(n);if(!(s!=null&&s.startsWith(`${e}:`)))continue;const r=$s(localStorage.getItem(s));r&&(t[s.slice(e.length+1)]=r)}}catch{}return t}function kt(e){let t=fs.get(e);return t||(t={records:Sl(e),listeners:new Set},fs.set(e,t)),t}function hs(e,t,n=!0){const s=kt(e);s.records=t;for(const r of s.listeners)r();if(n){Jo++;for(const r of Yo)r()}}function Dr(e){var t;if(!(e.key!==null&&!e.key.startsWith("yep-async-questions:"))){for(const n of fs.keys())if(e.key===null)hs(n,{});else if(e.key.startsWith(`${n}:`)){const s=e.key.slice(n.length+1),r={...kt(n).records},o=$s(e.newValue);o?r[s]={...o,edits:Math.max(o.edits,((t=r[s])==null?void 0:t.edits)??0)}:delete r[s],hs(n,r)}}}function Zo(e,t){return Br++===0&&window.addEventListener("storage",Dr),e.add(t),()=>{e.delete(t),--Br===0&&window.removeEventListener("storage",Dr)}}function hy(e){return kt(e).records}function Cl(e,t,n){const s=kt(e),r=s.records[t]??ds;let o=r;try{o=$s(localStorage.getItem(`${e}:${t}`))??o}catch{}const i={...o,...n,edits:Math.max(r.edits,o.edits,n.edits??0)};try{localStorage.setItem(`${e}:${t}`,JSON.stringify(i))}catch{}const l={...s.records,[t]:i},u=r.answer!==i.answer||r.quoted!==i.quoted||r.dismissed!==i.dismissed||r.seen!==i.seen||r.edits!==i.edits;return hs(e,l,u),l}function El(e){return c.useSyncExternalStore(t=>Zo(kt(e).listeners,t),()=>kt(e).records)}const kl=e=>Zo(Yo,e),_l=()=>Jo;function my(){return c.useSyncExternalStore(kl,_l)}function Ll(e){return{countTurns:e,countEdits:Math.round(e*160/3),overflowTurns:Math.ceil(e*8/3),overflowEdits:e*200}}function bn(e,t,n=3){const s=Ll(n);return e>=s.overflowTurns||t>=s.overflowEdits?"retired":e>=s.countTurns||t>=s.countEdits?"quiet":"recent"}function Rl(e){const t=[],n=new Set,s=new Set;for(let r=e.length-1;r>=0;r--){const o=e[r];if(o.type==="user_prompt"&&s.add(o.id),o.type==="text")for(const i of o.sourceMessages){const l=ac(i);if(!l||i.codexAgentMessageDelivery!=="async")continue;const u=i.codexAsyncQuestions;if(u)for(let d=u.length-1;d>=0;d--){const f=u[d],h=JSON.stringify([l,d]);n.has(h)||(n.add(h),t.push({id:h,messageId:l,renderId:o.id,index:d,title:f.title,options:f.options??[],age:s.size}))}}}return t.reverse()}function ms(e){return e.split(`
|
|
6
|
+
`).map(t=>`> ${t}`).join(`
|
|
7
|
+
`)}function Sn(e){const t=e.sourceElement.closest("[data-render-id]"),n=t==null?void 0:t.dataset.renderId,r=(t?Array.from(t.querySelectorAll('[data-markdown-copy-source="true"]')):[]).indexOf(e.sourceElement);return{id:$a(),sourceElement:e.sourceElement,...n?{renderId:n}:{},...r>=0?{sourceIndex:r}:{},range:e.range,selectedText:e.selectedText,quotedText:ms(e.markdown),lineSignatures:Il(e.markdown),sourceStart:e.sourceStart,sourceEnd:e.sourceEnd,sourceLocation:e.sourceLocation}}function Ml(e,t){if(e.sourceElement.isConnected)return!0;if(!t||!e.renderId||e.sourceIndex===void 0)return!1;const n=Array.from(t.querySelectorAll("[data-render-id]")).find(r=>r.dataset.renderId===e.renderId),s=n==null?void 0:n.querySelectorAll('[data-markdown-copy-source="true"]')[e.sourceIndex];return s?(e.sourceElement=s,!0):!1}function Al(e){if(e.sourceStart!==void 0&&e.sourceEnd!==void 0){const t=lc(e.sourceElement,{start:e.sourceStart,end:e.sourceEnd});if(t)return t}return $l(e.range)?e.range:Bl(e.sourceElement,e.selectedText)}function jl(e){return new Set(e.split(`
|
|
8
|
+
`).filter(Nl).map(ei).filter(Boolean))}function Tl(e,t){return t.lineSignatures.length===0?!1:t.lineSignatures.some(n=>e.has(n))}function py(e,t,n){var i;if(e===t)return{mayAffectQuoteAnchors:!1};if(!n||(i=n.inputType)!=null&&i.startsWith("history"))return{mayAffectQuoteAnchors:!0};const s=qt(n.start,e.length),r=Math.max(s,qt(n.end,e.length)),o=n.insertedText;return{mayAffectQuoteAnchors:Or(e,s,r)||Or(t,s,s+o.length)}}function Il(e){return e.split(`
|
|
9
|
+
`).map(ei).filter(Boolean)}function Nl(e){return/^[\t ]*>/.test(e)}function ei(e){return e.replace(/^[\t ]*>\s?/,"").replace(/\s+/g," ").trim()}function qt(e,t){return Number.isFinite(e)?Math.max(0,Math.min(t,Math.trunc(e))):0}function Or(e,t,n){if(!e)return!1;const s=qt(t,e.length),r=Math.max(s,qt(n,e.length));if(rn(e,s)||r>s&&rn(e,r-1)||r<e.length&&rn(e,r))return!0;for(let o=s;o<r;o+=1)if(e[o]===`
|
|
10
|
+
`&&rn(e,o+1))return!0;return!1}function rn(e,t){if(!e)return!1;const n=qt(t,e.length),s=Math.max(0,n-1),r=e.lastIndexOf(`
|
|
11
|
+
`,s)+1;return Pl(e,r)}function Pl(e,t){for(let n=t;n<e.length;n+=1){const s=e[n];if(!(s===" "||s===" "))return s===">"}return!1}function $l(e){return e.collapsed||!e.startContainer.isConnected||!e.endContainer.isConnected?!1:typeof e.getClientRects!="function"?!0:e.getClientRects().length>0}function Fl(e){const n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o=>o.textContent&&o.textContent.length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT});let s="";const r=[];for(let o=n.nextNode();o;o=n.nextNode()){const i=o,l=i.textContent??"";for(let u=0;u<=l.length;u+=1)r[s.length+u]={node:i,offset:u};s+=l}return s?{text:s,positions:r}:null}function Bl(e,t){if(!e.isConnected)return null;const n=Fl(e);if(!n)return null;const s=n.text.indexOf(t);if(s>=0)return Hr(e,n.positions,s,s+t.length);const r=Ur(n.text),o=Ur(t);if(!o.text)return null;const i=r.text.indexOf(o.text);if(i<0)return null;const l=i+o.text.length-1,u=r.map[i],d=r.map[l];return u===void 0||d===void 0?null:Hr(e,n.positions,u,d+1)}function Hr(e,t,n,s){const r=t[n],o=t[s];if(!r||!o)return null;const i=e.ownerDocument.createRange();return i.setStart(r.node,r.offset),i.setEnd(o.node,o.offset),i}function Ur(e){let t="";const n=[];let s=null;for(let r=0;r<e.length;r+=1){const o=e[r]??"";if(/\s/.test(o)){t.length>0&&s===null&&(s=r);continue}s!==null&&(t+=" ",n.push(s),s=null),t+=o,n.push(r)}return{text:t,map:n}}const ti=c.createContext(null),Fs=()=>c.useContext(ti);function gy({storageKey:e,draftSignal:t,send:n,quote:s,focusComposer:r,target:o,children:i}){const l=xl(),[u,d]=c.useState([]),f=El(e),h=c.useRef(f);c.useEffect(()=>{var Q,X;const O={...f};for(const z of S.current)O[z]={...O[z]??ds,edits:Math.max(((Q=O[z])==null?void 0:Q.edits)??0,((X=h.current[z])==null?void 0:X.edits)??0)};h.current=O},[f]);const w=c.useRef(u),[g,p]=c.useState(null),[y,b]=c.useState(null),[x,L]=c.useState(null),A=c.useRef(!1),E=c.useRef(0),S=c.useRef(new Set),[v,_]=c.useState(!1),m=c.useRef(null),C=c.useRef(null),[T,N]=c.useState(null),R=c.useRef({send:n,quote:s,focusComposer:r});R.current={send:n,quote:s,focusComposer:r};const k=c.useCallback((O,Q)=>{var z;const X=Cl(e,O,{...Q,edits:Math.max(((z=h.current[O])==null?void 0:z.edits)??0,Q.edits??0)});h.current={...h.current,[O]:X[O]},S.current.delete(O)},[e]),M=c.useCallback(()=>{for(const O of S.current)k(O,{edits:h.current[O].edits})},[k]),$=c.useCallback((O,Q)=>{k(O,Q)},[k]),P=c.useCallback(O=>{const Q=Rl(O);JSON.stringify(Q)!==JSON.stringify(w.current)&&(w.current=Q,d(Q))},[]);c.useEffect(()=>{let O=t.getDraft();return t.subscribeDraftChanges(({text:Q})=>{const X=Q!==O;if(O=Q,!X||!Q)return;let z=!1;const j={...h.current};for(const he of w.current){const se=j[he.id]??ds;if(se.dismissed||Ps(se))continue;const ce=Math.min(2400,se.edits+1);ce!==se.edits&&(S.current.add(he.id),z||(z=bn(he.age,ce,l)!==bn(he.age,se.edits,l)),j[he.id]={...se,edits:ce})}h.current=j,z&&M()})},[t,M,l]),c.useEffect(()=>{M()},[l,M]),c.useEffect(()=>{const O=()=>{document.hidden&&M()};return document.addEventListener("visibilitychange",O),window.addEventListener("pagehide",M),()=>{M(),document.removeEventListener("visibilitychange",O),window.removeEventListener("pagehide",M)}},[M]);const F=c.useCallback(O=>{var Q,X,z;E.current++,C.current??(C.current=((Q=m.current)==null?void 0:Q.capture())??null),N(((z=(X=C.current)==null?void 0:X.anchor)==null?void 0:z.id)??null),_(!1),p(O.id),b({renderId:O.renderId,questionId:O.id,token:E.current})},[]),W=c.useRef(null);c.useEffect(()=>{if(!o||W.current===o.token)return;const O=u.find(Q=>Q.messageId===o.messageId&&Q.index===o.index);O&&(W.current=o.token,C.current={atBottom:!0,following:!0,scrollTop:0,scrollHeight:0,clientHeight:0,updatedAtMs:Date.now()},F(O))},[o,u,F]);const D=c.useCallback(()=>{var Q;E.current++,p(null),b(null);const O=C.current;C.current=null,N(null),O&&((Q=m.current)==null||Q.restore(O)),R.current.focusComposer()},[]),V=c.useCallback(async(O,Q)=>{var he;if(!Q.trim()||A.current)return!1;const X=E.current;C.current??(C.current=((he=m.current)==null?void 0:he.capture())??null),A.current=!0,L(O.id);let z=!1;const j=se=>{var Re;const ce=se.target;ce instanceof Element&&se.type!=="wheel"&&((Re=ce.closest("[data-async-question-reply]"))==null?void 0:Re.dataset.asyncQuestionReply)===O.id||(z=!0)};document.addEventListener("pointerdown",j,!0),document.addEventListener("focusin",j,!0),document.addEventListener("wheel",j,{capture:!0,passive:!0});try{const se=await R.current.send(`${ms(O.title)}
|
|
12
|
+
|
|
13
|
+
${Q}`);return se&&($(O.id,{answer:Q,draft:"",seen:!0}),!z&&X===E.current?D():X===E.current&&(p(null),b(null),N(null),C.current=null)),se}finally{A.current=!1,L(null),document.removeEventListener("pointerdown",j,!0),document.removeEventListener("focusin",j,!0),document.removeEventListener("wheel",j,!0)}},[D,$]),G=c.useCallback(O=>{F(O),p(null),N(null),C.current=null,R.current.quote(`${ms(O.title)}
|
|
14
|
+
|
|
15
|
+
`),$(O.id,{quoted:!0,seen:!0})},[F,$]),J=c.useMemo(()=>{const O=u.find(Q=>Q.id===g);return[...O?[O.renderId]:[],...T?[T]:[]]},[u,g,T]),K=c.useMemo(()=>({reminderTurns:l,questions:u,records:f,activeId:g,navigationTarget:y,submittingId:x,menuOpen:v,retainedRenderIds:J,setMenuOpen:_,observe:P,navigation:m,open:F,returnToPrevious:D,update:$,submit:V,quote:G}),[l,u,f,g,y,x,v,J,P,F,D,$,V,G]);return a.jsx(ti.Provider,{value:K,children:i})}const Dl="_indicator_u9558_1",Ol="_recent_u9558_17",Hl="_overflowEntry_u9558_22",Ul="_menu_u9558_28",Vl="_menuHeading_u9558_42",ql="_groupHeading_u9558_48",Wl="_questionList_u9558_53",Kl="_menuRow_u9558_60",Ql="_turnAge_u9558_67",Gl="_previewBox_u9558_73",zl="_preview_u9558_73",Xl="_previewText_u9558_95",Yl="_unseen_u9558_100",Jl="_dismiss_u9558_106",Zl="_rowMenu_u9558_117",eu="_secondary_u9558_134",tu="_inlineQuestion_u9558_144",nu="_activeQuestion_u9558_151",su="_questionTitle_u9558_154",ru="_hint_u9558_158",ou="_options_u9558_163",iu="_iconAction_u9558_190",au="_replyForm_u9558_201",cu="_replyActions_u9558_216",lu="_send_u9558_222",uu="_sent_u9558_230",du="_error_u9558_235",Y={indicator:Dl,recent:Ol,overflowEntry:Hl,menu:Ul,menuHeading:Vl,groupHeading:ql,questionList:Wl,menuRow:Kl,turnAge:Ql,previewBox:Gl,preview:zl,previewText:Xl,unseen:Yl,dismiss:Jl,rowMenu:Zl,secondary:eu,inlineQuestion:tu,activeQuestion:nu,questionTitle:su,hint:ru,options:ou,iconAction:iu,replyForm:au,replyActions:cu,send:lu,sent:uu,error:du},on=_t(Le.glossaryHints,!1);function fu(){return{glossaryHintsEnabled:c.useSyncExternalStore(on.subscribe,on.read,on.read),setGlossaryHintsEnabled:on.set}}const hu="",mu=32,pu=32*1024*1024,an={state:"idle"};function Vr(e,t){return e!==null&&t!==null&&e.epoch===t.epoch&&e.sequence===t.sequence}function Qn(e){if(e===void 0)return hu;const t=e.replaceAll("\\","/").replace(/^\.\//,"");if(!t||t.startsWith("/")||t.includes("\0"))return null;const n=[];for(const s of t.split("/"))if(!(!s||s===".")){if(s==="..")return null;n.push(s)}return n.join("/")||null}function gu(e){const t="/GLOSSARY.md";return e.endsWith(t)?e.slice(0,-t.length):""}function wu(e,t){return t?e===t||(e==null?void 0:e.startsWith(`${t}/`))===!0:!0}function yu(e){if(!e||typeof e!="object"||!("type"in e))return!1;const t=e.type;return t==="glossary-paths-snapshot"||t==="glossary-path-changed"}function vu(e){return e===void 0?0:new TextEncoder().encode(JSON.stringify(e)).byteLength}class xu{constructor(t={}){ee(this,"active",null);ee(this,"stream",null);ee(this,"paths",new Set);ee(this,"pathsReady",!1);ee(this,"generation",null);ee(this,"entries",new Map);ee(this,"listeners",new Map);ee(this,"activationSerial",0);ee(this,"accessSerial",0);ee(this,"maxInactiveArtifacts");ee(this,"maxInactiveBytes");this.maxInactiveArtifacts=Math.max(0,Math.floor(t.maxInactiveArtifacts??mu)),this.maxInactiveBytes=Math.max(0,Math.floor(t.maxInactiveBytes??pu))}activate(t,n){var r;if(((r=this.active)==null?void 0:r.projectId)===t&&this.active.transport===n)return;this.active&&this.deactivate();const s=++this.activationSerial;this.active={projectId:t,transport:n,activationSerial:s},this.stream=Fa(n,{subscribe:({transport:o,handlers:i})=>o.subscribeGlossary(t,i),onEvent:o=>{var i;((i=this.active)==null?void 0:i.activationSerial)===s&&yu(o.data)&&this.handleSubscriptionEvent(o.data)}},{inactivityTimeoutMs:Ba})}deactivate(){var t;(t=this.stream)==null||t.close(),this.stream=null,this.active=null,this.paths.clear(),this.pathsReady=!1,this.generation=null;for(const n of this.entries.values())n.requestSerial+=1;this.entries.clear(),this.emitAll()}getSnapshot(t){const n=Qn(t);if(n===null)return an;const s=this.entries.get(n);return s?(this.touch(s),s.snapshot):an}subscribe(t,n){const s=Qn(t);if(s===null)return()=>{};let r=this.listeners.get(s);r||(r=new Set,this.listeners.set(s,r)),r.add(n);const o=this.entries.get(s);return o&&this.touch(o),()=>{const i=this.listeners.get(s);if(i&&(i.delete(n),i.size===0)){this.listeners.delete(s);const l=this.entries.get(s);l&&(l.requested=!1,this.touch(l)),this.pruneInactiveEntries()}}}ensure(t){const n=Qn(t);if(n===null)return;const s=this.getOrCreateEntry(n);s.requested=!0,this.touch(s),this.ensureEntry(n,s)}diagnostics(){var s;let t=0,n=0;for(const[r,o]of this.entries)this.isPinned(r,o)||(t+=1,n+=o.estimatedBytes);return{activeProjectId:((s=this.active)==null?void 0:s.projectId)??null,artifacts:this.entries.size,glossaryPaths:this.paths.size,inactiveArtifacts:t,inactiveBytes:n,pathsReady:this.pathsReady}}handleSubscriptionEvent(t){t.type==="glossary-paths-snapshot"?this.handleSnapshot(t):this.handlePathChange(t)}handleSnapshot(t){const n=this.pathsReady,s=n&&!Vr(this.generation,t.generation);this.paths=new Set(t.paths),this.pathsReady=!0,this.generation=t.generation,n?s&&this.invalidateEntries(()=>!0):this.invalidateEntries(r=>r.snapshot.state==="loading"),this.ensureRequestedEntries(),this.pruneInactiveEntries()}handlePathChange(t){var r;const n=(((r=this.generation)==null?void 0:r.sequence)??-1)+1,s=!this.generation||this.generation.epoch!==t.generation.epoch||t.generation.sequence!==n;if(t.changeType==="delete"?this.paths.delete(t.path):this.paths.add(t.path),this.pathsReady=!0,this.generation=t.generation,s||t.changeType==="create")this.invalidateEntries(()=>!0);else{const o=gu(t.path);this.invalidateEntries(i=>(i.snapshot.result&&"dependencies"in i.snapshot.result?i.snapshot.result.dependencies:[]).some(d=>d.path===t.path)||t.changeType==="delete"&&wu(i.sourcePath,o))}this.ensureRequestedEntries(),this.pruneInactiveEntries()}invalidateEntries(t){for(const[n,s]of this.entries)t(s)&&(s.requestSerial+=1,s.snapshot=an,s.estimatedBytes=0,this.emit(n))}ensureRequestedEntries(){for(const[t,n]of this.entries)n.requested&&this.ensureEntry(t,n)}ensureEntry(t,n){if(!this.active||n.snapshot.state==="loading"||n.snapshot.state==="ready"||n.snapshot.state==="none"||n.snapshot.state==="disabled")return;const s=this.findReusableRootEntry(n);if(s){n.snapshot=s.snapshot,n.estimatedBytes=s.estimatedBytes,this.touch(n),this.emit(t);return}const r=this.active,o=this.generation,i=++n.requestSerial;n.snapshot={state:"loading"},n.estimatedBytes=0,this.emit(t);const l=new URLSearchParams;n.sourcePath!==void 0&&l.set("sourcePath",n.sourcePath);const u=l.size>0?`?${l.toString()}`:"";r.transport.fetch(`/projects/${encodeURIComponent(r.projectId)}/glossary-artifact${u}`).then(d=>{this.active!==r||n.requestSerial!==i||o!==null&&!Vr(o,this.generation)||(n.snapshot={state:d.status,result:d},n.estimatedBytes=vu(d),this.touch(n),this.emit(t),this.pruneInactiveEntries())}).catch(d=>{this.active!==r||n.requestSerial!==i||(n.snapshot={state:"error",error:d instanceof Error?d:new Error(String(d))},n.estimatedBytes=0,this.touch(n),this.emit(t),this.pruneInactiveEntries())})}findReusableRootEntry(t){if(t.sourcePath!==void 0||!this.pathsReady)return null;for(const n of this.entries.values()){if(n===t)continue;const s=n.snapshot.result;if((n.snapshot.state==="ready"||n.snapshot.state==="disabled")&&s&&"governingPath"in s&&s.governingPath==="GLOSSARY.md")return n}return null}getOrCreateEntry(t){const n=this.entries.get(t);if(n)return n;const s={sourcePath:t||void 0,snapshot:an,requested:!1,requestSerial:0,lastUsedSerial:++this.accessSerial,estimatedBytes:0};return this.entries.set(t,s),s}touch(t){t.lastUsedSerial=++this.accessSerial}isPinned(t,n){return n.requested||n.snapshot.state==="loading"||this.listeners.has(t)}pruneInactiveEntries(){const t=Array.from(this.entries.entries()).filter(([r,o])=>!this.isPinned(r,o)).sort(([,r],[,o])=>r.lastUsedSerial-o.lastUsedSerial);let n=t.length,s=t.reduce((r,[,o])=>r+o.estimatedBytes,0);for(const[r,o]of t){if(n<=this.maxInactiveArtifacts&&s<=this.maxInactiveBytes)break;this.entries.delete(r),n-=1,s-=o.estimatedBytes}}emit(t){for(const n of this.listeners.get(t)??[])n()}emitAll(){for(const t of this.listeners.values())for(const n of t)n()}}const bu={state:"idle"},ps=c.createContext(null);function Su(e,t){if(!t||!Ut(e))return t;const n=t.replaceAll("\\","/"),s=js(e).replaceAll("\\","/");if(n.startsWith(`${s}/`))return n.slice(s.length+1);if(!(n.startsWith("/")||/^[A-Za-z]:\//.test(n)))return t}function Cu({children:e,enabled:t=!0,projectId:n}){const s=c.useContext(ps),r=As(),{glossaryHintsEnabled:o}=fu(),{version:i}=Fo(),l=c.useMemo(()=>new xu,[]),u=(s==null?void 0:s.projectId)===n?s.store:null,f=u===null&&t&&o&&Ut(n)&&Ot(i,Da);c.useLayoutEffect(()=>{if(!f||!Ut(n)){l.deactivate();return}return l.activate(n,r.transport),()=>l.deactivate()},[l,f,n,r.transport]);const h=c.useMemo(()=>u?{projectId:n,store:u}:f?{projectId:n,store:l}:null,[u,l,f,n]);return a.jsx(ps.Provider,{value:h,children:e})}function qr({children:e,projectId:t}){return a.jsx(Cu,{projectId:t,children:e})}function ni(e){const t=c.useContext(ps),n=Su((t==null?void 0:t.projectId)??"",e),s=c.useCallback(i=>(t==null?void 0:t.store.subscribe(n,i))??(()=>{}),[t,n]),r=c.useCallback(()=>(t==null?void 0:t.store.getSnapshot(n))??bu,[t,n]),o=c.useSyncExternalStore(s,r,r);return c.useEffect(()=>{t==null||t.store.ensure(n)},[t,n]),o}const Eu="_host_n1tgc_4",ku={host:Eu},si='<svg class="render-mode-glyph" width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><text x="8" y="8.1" text-anchor="middle" dominant-baseline="central" font-family="KaTeX_Main, Times New Roman, serif" font-size="12.5" font-weight="500" fill="currentColor">Σ</text></svg>';function _u(){return a.jsx("span",{className:ku.host,dangerouslySetInnerHTML:{__html:si}})}const Lu={dark:"dark",light:"neutral"};let Gn=null,Wr=null,Ru=0;async function Mu(){return Gn||(Gn=Oa(()=>import("./mermaid.core-y_avJe8E.js").then(e=>e.cb),__vite__mapDeps([0,1,2,3])).then(e=>e.default)),Gn}function Au(e,t){Wr!==t&&(e.initialize({startOnLoad:!1,securityLevel:"strict",theme:Lu[t]}),Wr=t)}function ju(e){for(const t of document.querySelectorAll(`#${e}, #d${e}`))t.remove()}const Tu={language:"mermaid",renderedNoun:"diagram",async render(e){const t=await Mu();Au(t,Io());const n=`ya-mermaid-${++Ru}`;try{const{svg:s}=await t.render(n,e);return s}catch{return null}finally{ju(n)}}},ri=new Map;function Iu(e){ri.set(e.language,e)}function Nu(e){return ri.get(e)}Iu(Tu);const Pu="_root_1l3gc_4",$u={root:Pu},Fu=$u.root,Bu="pre > code[class*='language-']",Du=/(?:^|\s)language-(\S+)/,Ou=2500,Cn="data-ya-code-block",Kr="data-ya-code-rendered",Bs="data-ya-code-toggle",Hu=50,Pt=new Map;function Uu(e,t){for(Pt.set(e,t);Pt.size>Hu;){const n=Pt.keys().next();if(n.done)return;Pt.delete(n.value)}}function Vu(e,t,n){return`${e.language}|${n}|${t.length}|${t}`}function qu(e,t){e.dataset.yaCodeLanguage!==t&&(e.dataset.yaCodeLanguage=t,e.setAttribute("aria-label",`${t} code block`))}function Wu(e,t){const n=e.createElement("button");return n.type="button",n.setAttribute(Bs,""),n.innerHTML=si,n.dataset.yaRenderedNoun=t.renderedNoun,n}function Ku(e,t){const n=e.dataset.yaRenderedNoun??"rendered view",s=t?`Show ${n} source`:`Show ${n}`;e.setAttribute("aria-pressed",String(t)),e.setAttribute("aria-label",s),e.title=s}function oi(e,t){e.dataset.yaCodeView=t;const n=e.querySelector(`[${Bs}]`);n&&Ku(n,t==="rendered")}function Qu(e,t,n,s){const r=e.ownerDocument,o=e.parentElement;let i=(o==null?void 0:o.hasAttribute(Cn))===!0?o:void 0;i||(i=r.createElement("div"),i.setAttribute(Cn,""),e.replaceWith(i),i.append(e),i.append(Wu(r,s)));let l=i.querySelector(`[${Kr}]`);l||(l=r.createElement("div"),l.setAttribute(Kr,""),i.insertBefore(l,e)),l.innerHTML=t,i.dataset.yaRenderKey=n,oi(i,i.dataset.yaCodeView==="source"?"source":"rendered")}async function Gu(e,t,n){const s=t.textContent??"";if(s.trim()==="")return;const r=Vu(n,s,Io()),o=e.closest(`[${Cn}]`);if(o instanceof HTMLElement&&o.dataset.yaRenderKey===r||e.dataset.yaRenderAttempt===r)return;e.dataset.yaRenderAttempt=r;let i=Pt.get(r);i===void 0&&(i=await n.render(s),Uu(r,i)),!(i===null||!e.isConnected)&&Qu(e,i,r,n)}function zu(e){var t,n;for(const s of e.querySelectorAll(Bu)){const r=s.parentElement;if(!r)continue;const o=(n=(t=Du.exec(s.className))==null?void 0:t[1])==null?void 0:n.toLowerCase();if(!o)continue;qu(r,o);const i=Nu(o);i&&Gu(r,s,i)}}function Xu(e){c.useEffect(()=>{var f,h,w;const t=e.current;if(!t)return;let n=!1,s;const r=()=>{n=!1,zu(t)},o=()=>{n||(n=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(r):window.setTimeout(r,0))},i=g=>{const p=g.target;if(!(p instanceof Element))return;const y=p.closest(`[${Bs}]`),b=y==null?void 0:y.closest(`[${Cn}]`);if(y&&b instanceof HTMLElement){g.stopPropagation(),g.preventDefault(),oi(b,b.dataset.yaCodeView==="source"?"rendered":"source");return}const x=p.closest("pre[data-ya-code-language]");if(x){for(const L of t.querySelectorAll("pre[data-ya-code-language-shown]"))delete L.dataset.yaCodeLanguageShown;x.dataset.yaCodeLanguageShown="1",window.clearTimeout(s),s=window.setTimeout(()=>{delete x.dataset.yaCodeLanguageShown},Ou)}};r(),t.addEventListener("click",i);const l=new MutationObserver(o);l.observe(t,{childList:!0,subtree:!0});const u=new MutationObserver(o);u.observe(t.ownerDocument.documentElement,{attributeFilter:["data-theme"],attributes:!0});const d=(h=(f=t.ownerDocument.defaultView)==null?void 0:f.matchMedia)==null?void 0:h.call(f,"(prefers-color-scheme: dark)");return(w=d==null?void 0:d.addEventListener)==null||w.call(d,"change",o),()=>{var g;l.disconnect(),u.disconnect(),(g=d==null?void 0:d.removeEventListener)==null||g.call(d,"change",o),t.removeEventListener("click",i),window.clearTimeout(s)}},[e])}const Yu="_term_a5syx_1",Ju={term:Yu},Zu=["a","button","code","input","kbd","pre","samp","script","select","style","textarea","[data-glossary-term]","[data-tooltip]","[title]",".katex"].join(","),ed=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DD","DIV","DL","DT","FIGCAPTION","FIGURE","FOOTER","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"]);function td(e){const t=[];let n=[],s="";const r=()=>{s&&t.push({segments:n,text:s}),n=[],s=""},o=i=>{if(i instanceof Text){if(!i.data)return;const u=s.length;s+=i.data,n.push({start:u,end:s.length,node:i});return}if(!(i instanceof Element))return;if(i.matches(Zu)){r();return}const l=ed.has(i.tagName)||i.tagName==="BR";l&&r();for(const u of i.childNodes)o(u);l&&r()};for(const i of e.childNodes)o(i);return r(),t}function nd(e,t,n,s,r,o){const i=Math.max(t,e.start)-e.start,l=Math.min(n,e.end)-e.start;if(i>=l)return;e.node.splitText(l);const u=e.node.splitText(i),d=document.createElement("span");d.className=Ju.term,d.dataset.glossaryTerm="true",d.dataset.glossaryMatch=o,d.title=s,r&&(d.setAttribute("role","button"),d.tabIndex=0),u.replaceWith(d),d.append(u)}function ii(e,t){if(!t||typeof document>"u"||!e)return{changed:!1,html:e};const n=document.createElement("template");n.innerHTML=e;const s=td(n.content);let r=0,o=!1;for(const i of s){const l=vl(i.text,t);for(let u=l.length-1;u>=0;u-=1){const d=l[u];if(!d)continue;const f=i.segments.filter(w=>w.start<d.end&&d.start<w.end);if(f.length===0)continue;const h=`g${r++}`;for(let w=f.length-1;w>=0;w-=1){const g=f[w];g&&nd(g,d.start,d.end,d.definitionText,w===0,h)}o=!0}}return{changed:o,html:o?n.innerHTML:e}}const gs="yep-anywhere-file-viewer-density-zoom",ai=-4,ci=6,sd=.5,rd=1,od={fontSizeOffsetPx:-1,verticalSpacingOffsetPx:-2},id={fontSizeOffsetPx:0,verticalSpacingOffsetPx:0};function li(e){return Math.min(ci,Math.max(ai,e))}function ad(){if(typeof sessionStorage>"u")return 0;try{const e=Number(sessionStorage.getItem(gs));return Number.isFinite(e)?li(e):0}catch{return 0}}function cd(e){if(!(typeof sessionStorage>"u"))try{e===0?sessionStorage.removeItem(gs):sessionStorage.setItem(gs,String(e))}catch{}}function Qr(e,t){return{fontSizeOffsetPx:(e.fontSizeOffsetPx??0)+(t.fontSizeOffsetPx??0),verticalSpacingOffsetPx:(e.verticalSpacingOffsetPx??0)+(t.verticalSpacingOffsetPx??0)}}function ld({fontSizeOffsetPx:e=0,verticalSpacingOffsetPx:t=0}={}){return{"--markdown-preview-font-size-offset":`${e}px`,"--markdown-preview-vspace-offset":`${t}px`}}function ud({fontSizeOffsetPx:e=0,verticalSpacingOffsetPx:t=0}={}){return{"--source-font-size-offset":`${e}px`,"--source-vspace-offset":`${t}px`}}function dd(){const[e,t]=c.useState(ad),n=c.useMemo(()=>({fontSizeOffsetPx:e*sd,verticalSpacingOffsetPx:e*rd}),[e]),s=c.useCallback(r=>{const o=li(r);t(o),cd(o)},[]);return{canZoomIn:e<ci,canZoomOut:e>ai,density:n,zoom:e,zoomIn:()=>s(e+1),zoomOut:()=>s(e-1)}}const Ds=c.memo(c.forwardRef(function({ariaLabel:t,className:n,density:s,html:r,onClick:o,onContextMenu:i,onKeyDown:l,sourcePath:u},d){const f=["markdown-preview",n].filter(Boolean).join(" "),h=ni(u),w=c.useMemo(()=>{var y;return h.state!=="ready"||((y=h.result)==null?void 0:y.status)!=="ready"?r:ii(r,h.result.artifact).html},[h,r]),g=c.useMemo(()=>({__html:w}),[w]),p=c.useRef(null);return Xu(p),a.jsx("div",{className:f,role:"region","aria-label":t??"Markdown preview",onClick:o,onContextMenu:i,onKeyDown:l,ref:d,style:ld(s),children:a.jsx("div",{className:`markdown-rendered ${Fu}`,ref:p,dangerouslySetInnerHTML:g})})}));function fd({canZoomIn:e,canZoomOut:t,onZoomIn:n,onZoomOut:s,zoom:r}){return a.jsxs("div",{className:"file-viewer-density-controls",role:"group","aria-label":"Source zoom",children:[a.jsx("button",{type:"button",className:"file-viewer-action",onClick:s,disabled:!t,title:"Zoom source and preview out","aria-label":"Zoom source and preview out",children:a.jsx(hd,{})}),a.jsx("span",{className:"file-viewer-density-value","aria-hidden":"true",children:r>0?`+${r}`:r}),a.jsx("button",{type:"button",className:"file-viewer-action",onClick:n,disabled:!e,title:"Zoom source and preview in","aria-label":"Zoom source and preview in",children:a.jsx(md,{})})]})}function hd(){return a.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:a.jsx("path",{d:"M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function md(){return a.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:a.jsx("path",{d:"M8 3v10M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}const ui=c.createContext(null),pd=[];function wy({children:e}){const[t,n]=c.useState("rendered"),[s,r]=c.useState(()=>new Set),[o,i]=c.useState(0),l=c.useCallback((f,h)=>{r(w=>{const g=w.has(f);if(h===g)return w;const p=new Set(w);return h?p.add(f):p.delete(f),p})},[]),u=c.useCallback(()=>{n(f=>f==="rendered"?"source":"rendered"),r(()=>new Set),i(f=>f+1)},[]);c.useEffect(()=>{const f=h=>{h.defaultPrevented||h.isComposing||(h.ctrlKey||h.metaKey)&&h.shiftKey&&!h.altKey&&h.key.toLowerCase()==="m"&&(h.preventDefault(),u())};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[u]);const d=c.useMemo(()=>({globalMode:t,state:s.size>0?"mixed":t,resetVersion:o,toggleGlobalMode:u,setOverrideActive:l}),[t,s.size,o,l,u]);return a.jsx(ui.Provider,{value:d,children:e})}function gd(){return c.useContext(ui)}function wd(e,t={}){const n=gd(),s=t.participateInGlobalMode??!0,r=s&&n?n.globalMode:"rendered",o=s&&n?n.resetVersion:0,i=t.renderWhenDisabled??!0,l=t.resetDependencies??pd,u=c.useRef(l);u.current=l;const d=c.useId(),[f,h]=c.useState(()=>t.initialMode&&t.initialMode!==r?t.initialMode:null),w=c.useRef([e,o,...l]);c.useEffect(()=>{const y=[e,o,...u.current],b=w.current;w.current=y,(y.length!==b.length||y.some((x,L)=>!Object.is(x,b[L])))&&h(null)},[e,o,...l]),c.useEffect(()=>{if(!n||!s)return;const y=e&&f!==null;return n.setOverrideActive(d,y),()=>{n.setOverrideActive(d,!1)}},[e,n,f,s,d]);const g=e?(f??r)==="rendered":i,p=c.useCallback(()=>{e&&h(y=>{const x=(y??r)==="rendered"?"source":"rendered";return x===r?null:x})},[e,r]);return{showRendered:g,toggleLocalMode:p}}const yd=1e3,Gr="[SessionUITrace]";let ze=null;function vd(e){try{return JSON.stringify(e)}catch{return JSON.stringify({unserializable:!0})}}function xd(e,t){if(e==="session-stream-event"){const n=t.eventType,s=t.sdkType;if(n==="message"&&s==="stream_event")return"stream:message:stream_event";if(n==="pending"||n==="markdown-augment")return`stream:${String(n)}`}if(e==="session-stream-dispatch"){const n=t.eventType,s=t.sdkType;if(n==="message"&&s==="stream_event")return"dispatch:message:stream_event";if(n==="pending"||n==="markdown-augment")return`dispatch:${String(n)}`}return null}function di(e){Kc.record("log",Gr,`${Gr} ${vd(e)}`)}function bd(){const e=ze;e&&(ze=null,e.timer&&clearTimeout(e.timer),di({event:"session-ui-trace-batch",sessionId:e.sessionId,total:e.total,counts:e.counts,windowMs:Date.now()-e.startedAt,firstEventId:e.firstEventId??null,lastEventId:e.lastEventId??null}))}function Sd(e,t){ze||(ze={timer:null,startedAt:Date.now(),total:0,counts:{},sessionId:t.sessionId,firstEventId:t.eventId},ze.timer=setTimeout(bd,yd)),ze.total+=1,ze.counts[e]=(ze.counts[e]??0)+1,ze.lastEventId=t.eventId}function Cd(e,t={}){if(!Wc())return;const n=xd(e,t);if(n){Sd(n,t);return}di({event:e,...t})}const zr=8;function Xr(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ed(){if(typeof window>"u")return zr;const e=window.__RENDER_PROFILE__;if(e&&typeof e=="object"){const t=e.thresholdMs;if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,t)}return zr}function kd(){return Go()||typeof window<"u"&&window.__RENDER_PROFILE__!==void 0}function fi(e,t,n){if(!kd())return n();const s=Xr();try{return n()}finally{const r=Xr()-s;if(r>=Ed()){const o=typeof t=="function"?t():t,i={name:e,durationMs:Math.round(r*10)/10,...o};Cd("render-profile",i),typeof window<"u"&&window.__RENDER_PROFILE__!==void 0&&!Go()&&console.log("[RenderProfile]",i)}}}function ws(e,t){return!e||!t?null:{scrollRoot:e,initialOffset:t.getBoundingClientRect().top-e.getBoundingClientRect().top}}function hi(e,t){if(!e||!t)return;const s=t.getBoundingClientRect().top-e.scrollRoot.getBoundingClientRect().top-e.initialOffset;Math.abs(s)>1&&(e.scrollRoot.scrollTop+=s)}function _d(e,t){const n=c.useRef(null),s=c.useRef(null),r=c.useCallback(()=>{const o=n.current;if(o){let i=o.parentElement;for(;i;){const{overflowY:l}=window.getComputedStyle(i);if(l==="auto"||l==="scroll")break;i=i.parentElement}s.current=ws(i,o)}t()},[t]);return c.useLayoutEffect(()=>{const o=s.current;o&&(s.current=null,hi(o,n.current))},[e]),{btnRef:n,handleClick:r}}function Ld(e){const t=e.trim().replace(/^#\s*/,"");return/^acli: 1(?:\s+\+?[a-z][a-z0-9-]*)*$/.test(t)||/^acli-capabilities: (?:[a-z][a-z0-9-]*\/1)(?:\s+[a-z][a-z0-9-]*\/1)*$/.test(t)}function Rd(e){JSON.parse(e);const t=e.match(/"(?:\\.|[^"\\])*"|[{}[\],:]|[^\s{}[\],:]+/g)??[];let n=0,s="";const r=()=>`
|
|
16
|
+
${" ".repeat(n)}`;return t.forEach((o,i)=>{o==="{"||o==="["?(s+=o,n++,t[i+1]!==(o==="{"?"}":"]")&&(s+=r())):o==="}"||o==="]"?(n--,t[i-1]!==(o==="}"?"{":"[")&&(s+=r()),s+=o):o===","?s+=o+r():o===":"?s+=": ":s+=o}),s+(e.endsWith(`
|
|
17
|
+
`)?`
|
|
18
|
+
`:"")}function Md(e){const t=new Jc,n=[...t.append(e),...t.finish()];let s;return n.map(r=>{var i;const o=(i=/^\s*(`{3,}|~{3,})/.exec(r))==null?void 0:i[1];if(o)return s?o[0]===s[0]&&o.length>=s.length&&(s=void 0):s=o,{kind:"text",source:r,text:r};if(!s&&Ld(r))return{kind:"metadata",source:r,text:r};if(!s&&/^[\s]*[[{]/.test(r))try{return{kind:"json",source:r,text:Rd(r)}}catch{}return{kind:"text",source:r,text:r}})}const mi=c.createContext(null);function Ad({children:e,onQuoteTextBlock:t}){return a.jsx(mi.Provider,{value:t,children:e})}function Os(){return c.useContext(mi)}function jd(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M13.5 8h-11M6.5 4l-4 4 4 4"})})}const Td=300*1e3,Id=32,Nd=1024*1024,Pd=100,Te=new Map,ys=new Set,wn=[];function Hs(e){return(e==null?void 0:e.nowMs)??Date.now()}function pi(e){return Array.isArray(e)?e.map(t=>pi(t)):e??null}function Yr(e){if(!e)return{};if(e instanceof URLSearchParams){const n={};for(const s of Array.from(new Set(e.keys())).sort()){const r=e.getAll(s);n[s]=r.length>1?r:r[0]??""}return n}const t={};for(const n of Object.keys(e).sort())t[n]=pi(e[n]);return t}function vs(e){if(e===void 0)return"undefined";if(e===null||typeof e!="object")return JSON.stringify(e)??String(e);if(Array.isArray(e))return`[${e.map(n=>vs(n)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${vs(t[n])}`).join(",")}}`}function Tn(e){const t=e.projectId??null;return{key:vs({sourceKey:e.sourceKey,routeId:e.routeId,projectId:t,routeParams:Yr(e.routeParams),queryParams:Yr(e.queryParams)}),sourceKey:e.sourceKey,routeId:e.routeId,projectId:t}}function gi(e){var t;try{return((t=JSON.stringify(e))==null?void 0:t.length)??0}catch{return 0}}function wi(){for(const e of Array.from(ys))e()}function $d(e){return{key:e.key,sourceKey:e.sourceKey,routeId:e.routeId,projectId:e.projectId,createdAt:e.createdAt,updatedAt:e.updatedAt,lastAccessedAt:e.lastAccessedAt,expiresAt:e.expiresAt,approxBytes:e.approxBytes}}function Us(){typeof window>"u"||(window.__YA_ROUTE_RETENTION__={entries:()=>zn().entries,events:()=>zn().events,diagnostics:zn,clear:Ud,invalidate:Hd})}function Ct(e,t={}){for(wn.push(e);wn.length>Pd;)wn.shift();Us(),t.emit&&wi()}function Kt(e,t,n,s=!0){const r=Te.get(e);r&&(Te.delete(e),Ct({type:t==="invalidate"?"invalidate":"evict",key:r.key,sourceKey:r.sourceKey,routeId:r.routeId,projectId:r.projectId,at:n,reason:t,approxBytes:r.approxBytes},{emit:s}))}function Fd(e){for(const t of Array.from(Te.values()))t.expiresAt<=e&&Kt(t.key,"expired",e,!1)}function Bd(){let e=0;for(const t of Te.values())e+=t.approxBytes;return e}function Dd(e,t){const n=e.maxEntries??Id,s=e.maxBytes??Nd;for(;Te.size>n||Bd()>s;){const r=Array.from(Te.values()).sort((o,i)=>o.lastAccessedAt!==i.lastAccessedAt?o.lastAccessedAt-i.lastAccessedAt:o.updatedAt-i.updatedAt)[0];if(!r)break;Kt(r.key,"lru",t,!1)}}function yi(e){return ys.add(e),Us(),()=>{ys.delete(e)}}function Od(e,t={}){const n=Hs(t),s=Tn(e),r=Te.get(s.key),o=t.recordDiagnostics??!0;return r?r.expiresAt<=n?t.touch===!1&&!o?{value:null,missReason:"expired"}:(Kt(r.key,"expired",n),o&&Ct({type:"miss",key:s.key,sourceKey:s.sourceKey,routeId:s.routeId,projectId:s.projectId,at:n,reason:"expired"}),{value:null,missReason:"expired"}):(t.touch!==!1&&(r.lastAccessedAt=n),o&&Ct({type:"hit",key:r.key,sourceKey:r.sourceKey,routeId:r.routeId,projectId:r.projectId,at:n,approxBytes:r.approxBytes}),{value:r.value}):(o&&Ct({type:"miss",key:s.key,sourceKey:s.sourceKey,routeId:s.routeId,projectId:s.projectId,at:n,reason:"missing"}),{value:null,missReason:"missing"})}function Vs(e,t){return Od(e,t).value}function qs(e,t,n={}){const s=Hs(n);Fd(s);const r=Tn(e),o=Te.get(r.key),i=n.ttlMs??Td,l={...r,value:t,createdAt:(o==null?void 0:o.createdAt)??s,updatedAt:s,lastAccessedAt:s,expiresAt:s+i,approxBytes:n.approxBytes??gi(t)};Te.set(r.key,l),Dd(n,s),Ct({type:"write",key:l.key,sourceKey:l.sourceKey,routeId:l.routeId,projectId:l.projectId,at:s,approxBytes:l.approxBytes},{emit:!0})}function yy(e,t,n={}){const s=Vs(e,{...n,touch:!1,recordDiagnostics:!1}),r=typeof t=="function"?t(s):Object.assign({},s,t);qs(e,r,n);const o=Tn(e);Ct({type:"patch",key:o.key,sourceKey:o.sourceKey,routeId:o.routeId,projectId:o.projectId,at:Hs(n),approxBytes:n.approxBytes??gi(r)})}function Hd(e){const t=Date.now();Kt(Tn(e).key,"invalidate",t)}function Ud(){const e=Date.now();for(const t of Array.from(Te.values()))Kt(t.key,"invalidate",e,!1);wi()}function zn(){const e=Array.from(Te.values(),$d);return{entries:e,events:[...wn],totalBytes:e.reduce((t,n)=>t+n.approxBytes,0)}}Us();const Vd=3e4,qd=750,Wd=60*1e3;function Kd(){return hc(),!0}function vi(e,t,n,s){return{sourceKey:e,routeId:n?"git-status:data:cached-untracked":s?"git-status:data:no-untracked":"git-status:data",projectId:t}}function Qd(e,t,n,s){const r=c.useMemo(()=>t?vi(e,t,n,s):null,[e,t,n,s]);return c.useSyncExternalStore(yi,()=>r?Vs(r,{touch:!1,recordDiagnostics:!1}):null,()=>null)}function Gd(e,t={}){const n=Ms(),s=Kd(),r=t.useUntrackedCache===!0,o=t.omitUntracked===!0,i=c.useMemo(()=>uc({endpoint:r?"git-status:cached-untracked":o?"git-status:no-untracked":"git-status",projectId:e??null}),[o,e,r]),l=Qd(n,e,r,o),u=`${n}\0${i}`,d=c.useRef({identity:u,value:l});d.current.identity!==u?d.current={identity:u,value:l}:l!==null&&(d.current.value=l);const f=l??d.current.value,[h,w]=c.useState(null),[g,p]=c.useState(!1),y=c.useMemo(()=>zd(f,h,r),[f,h,r]),[b,x]=c.useState(()=>!!e&&y===null),[L,A]=c.useState(null),[E,S]=c.useState(null),v=c.useRef(!0),_=c.useRef(0),m=c.useRef(0),C=c.useRef(null),T=c.useRef(y),N=c.useRef(h),R=c.useRef(l),k=c.useRef({queryKey:"",present:!1});T.current=y,N.current=h,R.current=l,c.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]),c.useEffect(()=>{m.current+=1,C.current=null,w(null),p(!1),S(null)},[o,e,n,r]),c.useEffect(()=>{A(null),x(!!e&&T.current===null)},[e,i,n]),c.useEffect(()=>{if(e)return dc({sourceKey:n,key:i})},[e,i,n]);const M=c.useCallback(async({background:W=!1}={})=>{if(!e||!s||!r||(l==null?void 0:l.isGitRepo)!==!0)return;const D=++m.current;(!W||N.current===null)&&S(null),N.current===null&&p(!0);const V=C.current,G=V??oe.listGitUntrackedFiles(e);V||(C.current=G);try{const J=await G;v.current&&D===m.current&&(w(J),p(!1),S(null))}catch(J){v.current&&D===m.current&&!Rr(J)&&(!W||N.current===null)&&S(J instanceof Error?J:new Error(String(J)))}finally{v.current&&D===m.current&&p(!1),C.current===G&&(C.current=null)}},[e,s,l==null?void 0:l.isGitRepo,r]),$=c.useCallback(async({force:W=!1,background:D=!1}={})=>{if(!e||!s)return;const V=++_.current,G=R.current!==null,J=T.current!==null;!D&&!J&&x(!0),D||A(null);const K={projectId:e},O=(X,z)=>{const j=z.meta.projectId;j&&qs(vi(z.sourceKey,j,r,o),X,{ttlMs:Wd})},Q=X=>{const z=X.meta.projectId;if(!z)throw new Error("Project id is required");return oe.getGitStatus(z,{...o?{omitUntracked:!0}:{},...r?{useUntrackedCache:!0}:{}})};try{const X=await fc({sourceKey:n,key:i,force:W||!G,meta:K,fetcher:Q,applySnapshot:O});if(!v.current||V!==_.current)return;X.status!=="obsolete"&&A(null)}catch(X){if(!v.current||V!==_.current)return;T.current===null&&!Rr(X)&&A(X instanceof Error?X:new Error(String(X)))}finally{v.current&&V===_.current&&x(!1)}},[o,e,i,s,n,r]);c.useEffect(()=>{!e||!s||$({background:T.current!==null})},[$,e,s]),c.useEffect(()=>{const W=k.current,D=l!==null;k.current={queryKey:i,present:D},W.queryKey===i&&W.present&&!D&&e&&s&&document.visibilityState==="visible"&&document.hasFocus()&&$()},[$,e,i,s,l]),c.useEffect(()=>{(l==null?void 0:l.isGitRepo)===!0&&M({background:N.current!==null})},[M,l==null?void 0:l.isGitRepo]);const P=t.poll!==!1;c.useEffect(()=>{if(!e||!s)return;let W=document.visibilityState==="visible"&&document.hasFocus();const D=()=>{const V=document.visibilityState==="visible"&&document.hasFocus();if(V!==W&&(W=V,!!V)){if(R.current===null){$();return}P&&($({force:!0,background:!0}),M({background:!0}))}};return document.addEventListener("visibilitychange",D),window.addEventListener("focus",D),window.addEventListener("blur",D),()=>{document.removeEventListener("visibilitychange",D),window.removeEventListener("focus",D),window.removeEventListener("blur",D)}},[$,M,P,e,s]),c.useEffect(()=>{if(!e||!s||t.poll===!1)return;let W=!1,D=!1,V=null,G=null;const J=()=>{$({force:!0,background:!0}),M({background:!0})},K=()=>{V&&(clearInterval(V),V=null)},O=()=>{V||(V=setInterval(J,Vd))},Q=()=>{G&&(clearTimeout(G),G=null)},X=()=>{K(),W&&O()},z=()=>{W&&(Q(),G=setTimeout(()=>{G=null,J(),X()},qd))},j=()=>{const ce=document.visibilityState==="visible"&&document.hasFocus();D&&ce===W||(D=!0,W=ce,W?O():(K(),Q()))},he=Mr.onSource(n,"process-state-changed",ce=>{ce.projectId===e&&ce.activity!=="in-turn"&&z()}),se=Mr.onSource(n,"reconnect",z);return j(),document.addEventListener("visibilitychange",j),window.addEventListener("focus",j),window.addEventListener("blur",j),()=>{W=!1,K(),Q(),he(),se(),document.removeEventListener("visibilitychange",j),window.removeEventListener("focus",j),window.removeEventListener("blur",j)}},[$,M,t.poll,e,s,n]);const F=c.useCallback(async()=>{await Promise.all([$({force:!0,background:T.current!==null}),M({background:N.current!==null})])},[$,M]);return{gitStatus:y,untrackedFiles:h,untrackedLoading:g,untrackedError:E,loading:b,error:L,refetch:F}}function zd(e,t,n){if(!n||(e==null?void 0:e.isGitRepo)===!1||!e||!t)return e;const s=[...t.files.map(i=>{var l;return{path:i,status:"?",staged:!1,linesAdded:null,linesDeleted:null,...(l=t.lastEditors)!=null&&l[i]?{lastEditor:t.lastEditors[i]}:{}}}),...t.folders.map(({path:i})=>({path:i,status:"?",staged:!1,linesAdded:null,linesDeleted:null}))],o=[...e.files.filter(i=>i.status!=="?"),...s];return{...e,files:o,isClean:o.length===0}}const Xd=5e3,Yd=6e4;function Jr(e,t){return{sourceKey:e,routeId:"git-status:file-projections",projectId:t}}function Jd(e,t,n){const s=c.useMemo(()=>t?Jr(e,t):null,[t,e]),r=c.useSyncExternalStore(yi,()=>s?Vs(s,{touch:!1,recordDiagnostics:!1}):null,()=>null),o=(r==null?void 0:r.statusKey)===n?r.value:null,i=c.useRef(n);i.current=n;const l=mc({sourceKey:e,key:{endpoint:"git-status:file-projections",projectId:t??null,statusKey:n},enabled:!!(t&&n),hasData:o!==null,staleTimeMs:Xd,meta:{projectId:t,statusKey:n},fetcher:async d=>{const f=d.meta;if(!f.projectId)throw new Error("Project is required for file projections");return oe.getGitFileProjections(f.projectId)},applySnapshot:(d,f)=>{const h=f.meta;!h.projectId||!h.statusKey||h.statusKey!==i.current||qs(Jr(f.sourceKey,h.projectId),{statusKey:h.statusKey,value:d},{ttlMs:Yd})}});return{manifest:o??(n&&!l.error?(r==null?void 0:r.value)??null:null),loading:!!(n&&!o&&!l.error)}}function Zd(e){const t=Vt(e).replace(/^\.\/+/,""),n=t.startsWith("/")||t.startsWith("//")||/^[a-zA-Z]:\//.test(t),s=t===".."||t.startsWith("../");return t&&!n&&!s?t:null}function Zr(e,t){return e?t.find(n=>n.path===e||n.origPath===e)??null:null}function ef(e){var t,n;return JSON.stringify([((n=(t=e.recentCommits)==null?void 0:t[0])==null?void 0:n.hash)??null,e.files.map(s=>[s.path,s.origPath??null,s.status,s.staged,s.linesAdded,s.linesDeleted])])}function xi(e,t){var g,p;const n=Ms(),s=Bo(n),r=Ot(s,Ha),o=Ot(s,Ua),i=c.useMemo(()=>Zd(t),[t]),l=r&&o&&i?e:void 0,{gitStatus:u,loading:d,error:f}=Gd(l,{poll:!1,omitUntracked:!1}),h=u!=null&&u.isGitRepo&&i?ef(u):null,w=Jd(n,l,h);return{cumulativeFile:Zr(i,((g=w.manifest)==null?void 0:g.cumulativeFiles)??[]),loading:!!(e&&i&&(s===null||o&&l&&(d||!u&&!f||u!=null&&u.isGitRepo&&w.loading))),relativePath:i,supported:o,worktreeFile:Zr(i,((p=w.manifest)==null?void 0:p.worktreeFiles)??[])}}const tf=["block","paragraph-hover","paragraph-always"],bi="paragraph-hover";function nf(e){return tf.includes(e)?e:void 0}const Ft=Rs(Le.quoteReplyButtonMode,bi,nf);Ft.set;function Si(){return{quoteReplyButtonMode:c.useSyncExternalStore(Ft.subscribe,Ft.read,()=>bi),setQuoteReplyButtonMode:Ft.set}}Ft.read;const sf="_rowSurface_1pv0o_1",rf="_trigger_1pv0o_5",of="_overlay_1pv0o_38",af="_menu_1pv0o_48",cf="_separatorBefore_1pv0o_74",Bt={rowSurface:sf,trigger:rf,overlay:of,menu:af,separatorBefore:cf},vy=Bt.rowSurface,lf=500,uf=8;function Ci(e,t){const[n,s]=c.useState(null),r=c.useRef(null),o=c.useRef(!1),i=c.useRef(null),l=c.useCallback(()=>s(null),[]),u=c.useCallback((S,v,_,m,C)=>{var T;s({actions:m,x:S,y:v,returnFocus:_,...C!=null&&C.contextKey?{contextKey:C.contextKey}:{}}),(T=C==null?void 0:C.onOpen)==null||T.call(C)},[]),d=c.useCallback((S,v,_)=>{S.preventDefault(),S.stopPropagation();const m=S.currentTarget.getBoundingClientRect();u(m.right,m.bottom+4,S.currentTarget,v,_)},[u]),f=c.useCallback((S,v)=>{s(_=>(_==null?void 0:_.contextKey)===S?{..._,actions:v}:_)},[]),h=c.useCallback((S,v,_)=>{S.preventDefault(),S.stopPropagation(),u(S.clientX,S.clientY,S.currentTarget,v,_)},[u]),w=c.useCallback((S,v,_)=>{if(S.key!=="ContextMenu"&&!(S.shiftKey&&S.key==="F10"))return!1;S.preventDefault(),S.stopPropagation();const m=S.currentTarget.getBoundingClientRect();return u(m.left+Math.min(32,m.width/2),m.top+Math.min(32,m.height),S.currentTarget,v,_),!0},[u]),g=c.useCallback(()=>{r.current&&(clearTimeout(r.current.timer),r.current=null)},[]),p=c.useCallback((S,v,_,m)=>{if(g(),i.current&&(clearTimeout(i.current),i.current=null),o.current=!1,!S.isPrimary||S.button!==0||S.pointerType!=="touch"&&S.pointerType!=="pen")return;const C=S.clientX,T=S.clientY,N=setTimeout(()=>{o.current=!0,r.current=null,u(C,T,v,_,m)},lf);r.current={timer:N,x:C,y:T}},[g,u]),y=c.useCallback((S,v,_)=>{p(S.nativeEvent,S.currentTarget,v,_)},[p]),b=c.useCallback(S=>{const v=r.current;!v||Math.hypot(S.clientX-v.x,S.clientY-v.y)<=uf||g()},[g]),x=c.useCallback(S=>{b(S.nativeEvent)},[b]),L=c.useCallback(()=>o.current?(o.current=!1,!0):!1,[]),A=c.useCallback(()=>{g(),o.current&&(i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o.current=!1,i.current=null},0))},[g]),E=c.useCallback((S,v,_)=>({onContextMenu:m=>h(m,S,_),onKeyDown:m=>{w(m,S,_)},onPointerDown:m=>y(m,S,_),onPointerMove:x,onPointerUp:g,onPointerCancel:g,onClick:()=>{L()||v()}}),[y,L,g,x,h,w]);return c.useEffect(()=>(window.addEventListener("pointerup",A),window.addEventListener("pointercancel",A),()=>{window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",A),g(),i.current&&(clearTimeout(i.current),i.current=null)}),[g,A]),{menu:n?a.jsx(df,{...n,labels:t,onClose:l,t:e}):null,targetProps:E,openAt:u,openFromButton:d,refreshOpenActions:f,beginLongPressAt:p,moveLongPressAt:b,endLongPress:g,consumeLongPressClick:L}}function xy({actions:e,label:t,onOpen:n,openOptions:s}){return a.jsx("button",{type:"button",className:Bt.trigger,"aria-label":t,title:t,onClick:r=>n(r,e,s),children:"⋯"})}function df({actions:e,x:t,y:n,returnFocus:s,onClose:r,t:o,labels:i}){const l=c.useRef(null);c.useEffect(()=>Va(),[]),c.useLayoutEffect(()=>{var f,h;(h=(f=l.current)==null?void 0:f.querySelector('button[role="menuitem"]:not(:disabled)'))==null||h.focus()},[]),c.useEffect(()=>{const f=h=>{var y,b;if(h.key==="Escape"){h.preventDefault(),r(),s==null||s.focus();return}if(h.key!=="ArrowDown"&&h.key!=="ArrowUp"&&h.key!=="Home"&&h.key!=="End")return;const w=Array.from(((y=l.current)==null?void 0:y.querySelectorAll('button[role="menuitem"]:not(:disabled)'))??[]);if(w.length===0)return;h.preventDefault();const g=w.indexOf(document.activeElement),p=h.key==="Home"?0:h.key==="End"?w.length-1:h.key==="ArrowDown"?(g+1+w.length)%w.length:(g-1+w.length)%w.length;(b=w[p])==null||b.focus()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[r,s]);const u=f=>{f.disabled||(f.onSelect(),r(),s==null||s.focus())},d=e.length*34+16;return tt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Bt.overlay,"aria-label":(i==null?void 0:i.dismiss)??o("sourceDismissActions"),onClick:()=>{r(),s==null||s.focus()},onContextMenu:f=>{f.preventDefault(),r(),s==null||s.focus()}}),a.jsx("div",{ref:l,className:Bt.menu,role:"menu","aria-label":(i==null?void 0:i.menu)??o("sourceActionMenu"),style:{left:Math.max(8,Math.min(t,window.innerWidth-232)),top:Math.max(8,Math.min(n,window.innerHeight-d))},children:e.map((f,h)=>a.jsx("button",{type:"button",role:"menuitem",className:f.separatorBefore?Bt.separatorBefore:void 0,disabled:f.disabled,onClick:()=>u(f),children:f.label},h))})]}),document.body)}const ff="_cluster_13b9h_1",hf="_button_13b9h_9",mf="_text_13b9h_37",pf="_quote_13b9h_56",gf="_source_13b9h_75",wf="_rich_13b9h_94",yf="_newSession_13b9h_112",vf="_specimen_13b9h_132",xf="_mobile_13b9h_137",bf="_docked_13b9h_146",He={cluster:ff,button:hf,text:mf,quote:pf,source:gf,rich:wf,newSession:yf,specimen:vf,mobile:xf,docked:bf},Sf=30,Cf=44,It=6;function Ef(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),a.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}const eo={text:a.jsx(Ef,{}),quote:">",source:"</>",rich:"Aa",newSession:"+"},kf={text:He.text,quote:He.quote,source:He.source,rich:He.rich,newSession:He.newSession};function _f({kind:e,label:t,onClick:n,onPointerDown:s,onPointerUp:r,specimen:o=!1}){const i=`${He.button} ${kf[e]} ${o?He.specimen:""}`;return o?a.jsx("span",{className:i,"aria-hidden":"true","data-selection-action-specimen":e,children:eo[e]}):a.jsx("button",{type:"button",className:i,onMouseDown:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),s==null||s(l)},onPointerUp:r,onClick:n,"aria-label":t,title:t,children:eo[e]})}function Lf({children:e,docked:t=!1,mobile:n=!1,placement:s,style:r}){return a.jsx("div",{className:[He.cluster,t?He.docked:"",n?He.mobile:""].filter(Boolean).join(" "),style:r,"data-selection-action-cluster":"true","data-selection-action-placement":s,children:e})}const Rf="session-file-comments",Ei="data-session-file-comment-mode",ki=100,Mf=2e4,to=8e3;function Af({sourceKey:e,sessionId:t,projectId:n,filePath:s}){return[Rf,e,t,n,s].map(encodeURIComponent).join(":")}function jf(e){try{const t=JSON.parse(localStorage.getItem(e)??"null");if(!Array.isArray(t))return[];const n=[];for(const s of t.slice(0,ki)){if(!If(s))continue;const{id:r,location:o,quote:i,text:l,afterLine:u,afterBlock:d}=s;typeof r!="string"||!r||typeof o!="string"||!o||typeof i!="string"||!i.trim()||typeof l!="string"||!l.trim()||o.length>to||i.length>to||l.length>Mf||u!==void 0&&(!Number.isInteger(u)||Number(u)<1)||d!==void 0&&(!Number.isInteger(d)||Number(d)<0)||n.push({id:r,location:o,quote:i,text:l,...u===void 0?{}:{afterLine:Number(u)},...d===void 0?{}:{afterBlock:Number(d)}})}return n}catch{return[]}}function Xn(e,t){const n=t.filter(s=>s.text.trim()).slice(0,ki);if(n.length===0){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(n))}function _i(e){const t=e.quote.replace(/\r\n?/g,`
|
|
19
|
+
`).replace(/^\n+|\n+$/g,"").split(`
|
|
20
|
+
`).map(n=>`> ${n}`).join(`
|
|
21
|
+
`);return`${e.location}
|
|
22
|
+
|
|
23
|
+
${t}
|
|
24
|
+
|
|
25
|
+
${e.text.trim()}`}function Tf(e){return e.map(_i).join(`
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
`)}function If(e){return typeof e=="object"&&e!==null}const wt="session-transcript-selection-active",Nf=50;function no(e,t,n){return Math.max(t,Math.min(n,e))}function so(e,t,n){const s=e.sourceElement.ownerDocument.createRange();return s.selectNodeContents(e.sourceElement),t==="after"?s.setStart(e.range.endContainer,e.range.endOffset):s.setEnd(e.range.startContainer,e.range.startOffset),!s.toString().trim()||typeof s.getClientRects!="function"?!0:!Array.from(s.getClientRects()).some(r=>r.width>0&&r.height>0&&r.bottom>n.top+1&&r.top<n.bottom-1)}function Pf(e){const t=new Set(e.map(s=>s.sourceElement)),n=[];for(const s of t){const r=s.ownerDocument.createRange();r.selectNodeContents(s),typeof r.getClientRects=="function"&&n.push(...Array.from(r.getClientRects()).filter(o=>o.width>0&&o.height>0))}return n}function $f(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Ws(e){var t;return((t=e.matchMedia)==null?void 0:t.call(e,"(pointer: coarse)").matches)===!0}function Ff(e,t){if(Ws(t))return!0;const n=e.pointerType;return n==="touch"||n==="pen"}function Bf(e,t,n){return t===0&&n===0?!0:e.ranges.some(s=>typeof s.getClientRects!="function"?!0:Array.from(s.getClientRects()).some(r=>t>=r.left-1&&t<=r.right+1&&n>=r.top-1&&n<=r.bottom+1))}function Df(e,t,n,s,r){const{snippets:o}=n,i=n.root,l=e.ownerDocument.defaultView??window,u=Ws(l),d=u?Cf:Sf,f=t.getRangeAt(t.rangeCount-1),h=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null,w=typeof f.getClientRects=="function"?Array.from(f.getClientRects()).filter(D=>D.width!==0||D.height!==0):[],g=h&&(h.width!==0||h.height!==0);if(!g&&!r)return null;const p=i.getBoundingClientRect(),y=g?h:{top:(r==null?void 0:r.clientY)??p.top,right:(r==null?void 0:r.clientX)??p.left,bottom:(r==null?void 0:r.clientY)??p.top,left:(r==null?void 0:r.clientX)??p.left,width:0,height:0},b=w[0]??y,x=w.at(-1)??y,L=s*d+(s-1)*It,A=o[0],E=o.at(-1),S=E?so(E,"after",x):!1,v=A?so(A,"before",b):!1,_=p.right-x.right,m=b.left-p.left,C=p.bottom-y.bottom,T=y.top-p.top,N=Math.max(0,i.clientHeight-d),R=Math.max(0,i.clientWidth-L),k=y.left-p.left+(y.width-L)/2,M={after:{top:x.top-p.top+(x.height-d)/2,left:x.right-p.left+It},before:{top:b.top-p.top+(b.height-d)/2,left:b.left-p.left-L-It},below:{top:y.bottom-p.top+It,left:k},above:{top:y.top-p.top-d-It,left:k}},$=Pf(o),P=D=>{if(D==="after"&&!S||D==="before"&&!v)return!1;const V=M[D];if(V.left<0||V.top<0||V.left+L>i.clientWidth||V.top+d>i.clientHeight)return!1;const G={top:p.top+V.top,right:p.left+V.left+L,bottom:p.top+V.top+d,left:p.left+V.left};return G.left<0||G.top<0||G.right>l.innerWidth||G.bottom>l.innerHeight?!1:!$.some(J=>$f(G,J))},F=["after","before","below","above"].find(P)??[["after",_-L],["before",m-L],["below",C-d],["above",T-d]].reduce((D,V)=>V[1]>D[1]?V:D)[0],W=M[F];return{side:F,docked:u&&i===e,mobile:u,snapshot:n,top:no(W.top,0,N),left:no(W.left,0,R)}}function Of({actionCount:e,getActionCount:t,containerRef:n,inert:s,isInteractiveTarget:r}){const o=c.useRef(!1),[i,l]=c.useState(null),u=c.useCallback(()=>l(null),[]),d=c.useCallback(()=>{const f=n.current,h=f==null?void 0:f.ownerDocument.getSelection();if(!f||!h||h.isCollapsed||h.rangeCount===0)return null;const w=Nt(f,h);if(!w)return null;const g=Mn(w);return g.length===0?null:{anchors:g.map(Sn),snippets:g,ranges:g.map(p=>p.range.cloneRange()),root:w}},[n]);return c.useEffect(()=>{if(s)return;const f=h=>{const w=n.current;if(!w)return;const g=Nt(w);g&&pc(h,g)};return document.addEventListener("copy",f),()=>document.removeEventListener("copy",f)},[n,s]),c.useEffect(()=>{if(s)return;const f=n.current,h=(f==null?void 0:f.ownerDocument)??document,w=g=>{const p=n.current;if(g.button!==0||!p||r(g.target))return;const y=h.getSelection(),b=Nt(p,y),x=Ar(p,g.target);b&&b===x&&(y==null||y.removeAllRanges())};return h.addEventListener("mousedown",w,!0),()=>h.removeEventListener("mousedown",w,!0)},[n,s,r]),c.useEffect(()=>{if(s)return;const f=n.current,h=(f==null?void 0:f.ownerDocument)??document,w=h.defaultView??window;if(!Ws(w))return;let g=null,p=null;const y=x=>{const L=n.current,A=(L==null?void 0:L.closest(".session-page"))??null,E=(L==null?void 0:L.ownerDocument.body)??null;g&&g!==A&&g.classList.remove(wt),p&&p!==E&&p.classList.remove(wt),g=A,p=E,A==null||A.classList.toggle(wt,x),E==null||E.classList.toggle(wt,x&&A!==null)},b=()=>{const x=n.current;y(x?Nt(x,x.ownerDocument.getSelection())!==null:!1)};return h.addEventListener("selectionchange",b),h.addEventListener("pointerup",b,!0),h.addEventListener("keyup",b,!0),w.addEventListener("blur",b),()=>{h.removeEventListener("selectionchange",b),h.removeEventListener("pointerup",b,!0),h.removeEventListener("keyup",b,!0),w.removeEventListener("blur",b),g==null||g.classList.remove(wt),p==null||p.classList.remove(wt)}},[n,s]),c.useEffect(()=>{var _;if(s||e===0){l(null);return}const f=((_=n.current)==null?void 0:_.ownerDocument)??document,h=f.defaultView??window;let w,g=!1;const p=()=>{g=!1,w!==void 0&&(h.clearTimeout(w),w=void 0)},y=m=>{if(o.current&&!m){l(null);return}const C=n.current,T=C==null?void 0:C.ownerDocument.getSelection(),N=d();if(!C||!T||!N){l(null);return}const R=(t==null?void 0:t(N))??e;if(R===0){l(null);return}l(Df(C,T,N,R,m))},b=()=>{w=h.setTimeout(()=>{w=void 0,g&&(g=!1,y(),b())},Nf)},x=()=>{if(w!==void 0){g=!0;return}y(),b()},L=()=>{const m=f.getSelection();if(!m||m.isCollapsed||m.rangeCount===0){p();return}x()},A=m=>{const C=n.current;if(m.target instanceof Element&&m.target.closest('[data-selection-action-cluster="true"]')){o.current=!1,p();return}if(p(),!C||!Ar(C,m.target)){o.current=!1;return}o.current=!0,l(null)},E=m=>{const C=o.current;o.current=!1,C&&(p(),h.setTimeout(()=>{p(),y({clientX:m.clientX,clientY:m.clientY})},0))},S=()=>{o.current=!1,p()},v=()=>{if(o.current){p();return}const m=f.getSelection();if(!m||m.isCollapsed||m.rangeCount===0){p(),l(null);return}x()};return f.addEventListener("selectionchange",v),f.addEventListener("pointerdown",A,!0),f.addEventListener("pointercancel",S,!0),f.addEventListener("pointerup",E,!0),h.addEventListener("resize",L),h.addEventListener("scroll",L,!0),()=>{p(),f.removeEventListener("selectionchange",v),f.removeEventListener("pointerdown",A,!0),f.removeEventListener("pointercancel",S,!0),f.removeEventListener("pointerup",E,!0),h.removeEventListener("resize",L),h.removeEventListener("scroll",L,!0)}},[e,d,n,t,s]),{captureSnapshot:d,dismiss:u,state:i}}const cn=_t(Le.selectionQuoteActionEnabled,!0),ln=_t(Le.selectionTextCopyActionEnabled,!1),un=_t(Le.selectionSourceCopyActionEnabled,!1),dn=_t(Le.selectionRichCopyActionEnabled,!1),fn=_t(Le.selectionNewSessionActionEnabled,!1);function Hf(){const e=c.useSyncExternalStore(cn.subscribe,cn.read,cn.read),t=c.useSyncExternalStore(ln.subscribe,ln.read,ln.read),n=c.useSyncExternalStore(un.subscribe,un.read,un.read),s=c.useSyncExternalStore(dn.subscribe,dn.read,dn.read),r=c.useSyncExternalStore(fn.subscribe,fn.read,fn.read);return{selectionQuoteActionEnabled:e,setSelectionQuoteActionEnabled:cn.set,selectionTextCopyActionEnabled:t,setSelectionTextCopyActionEnabled:ln.set,selectionSourceCopyActionEnabled:n,setSelectionSourceCopyActionEnabled:un.set,selectionRichCopyActionEnabled:s,setSelectionRichCopyActionEnabled:dn.set,selectionNewSessionActionEnabled:r,setSelectionNewSessionActionEnabled:fn.set}}function Yn(e){return e.snippets.some(t=>t.sourceElement.closest(`[${Ei}="true"]`)!==null)}function Uf(e){return e.snippets.map((t,n)=>{var r;if(t.sourceStart!==void 0)return t.selectedText;const s=e.ranges[n];return s?((r=Ho(e.root,[s]))==null?void 0:r.text)??t.selectedText:t.selectedText}).join(`
|
|
30
|
+
|
|
31
|
+
`)}function Vf(e){return e.snippets.map(t=>t.markdown).join(`
|
|
32
|
+
|
|
33
|
+
`)}function qf(e){return e.anchors.map(t=>t.quotedText).join(`
|
|
34
|
+
|
|
35
|
+
`)}function Wf(e){const t=e.snippets.map(o=>o.sourceLocation);if(t.some(o=>o===void 0))return null;const n=t[0];if(!n||t.some(o=>(o==null?void 0:o.projectId)!==n.projectId||o.filePath!==n.filePath))return null;const s=Math.min(...t.map(o=>(o==null?void 0:o.lineStart)??n.lineStart)),r=Math.max(...t.map(o=>(o==null?void 0:o.lineEnd)??n.lineEnd));return`${n.filePath}:${s}${r>s?`-${r}`:""}`}function Kf(e){const t=qf(e),n=Wf(e);return n?`${n}
|
|
36
|
+
|
|
37
|
+
${t}`:t}function Qf({applyQuoteAnchors:e,applyQuoteFromSelection:t,containerRef:n,inert:s,isInteractiveTarget:r,onQuoteSelection:o,onStartNewSessionFromSelection:i}){const l=c.useRef(null),{selectionQuoteActionEnabled:u,selectionTextCopyActionEnabled:d,selectionSourceCopyActionEnabled:f,selectionRichCopyActionEnabled:h,selectionNewSessionActionEnabled:w}=Hf(),{t:g}=Ue(),{menu:p,openAt:y}=Ci(g,{dismiss:g("sessionDismissSelectionActions"),menu:g("sessionSelectionActionMenu")}),b=c.useMemo(()=>{const k=[];return d&&k.push({kind:"text",label:g("sessionCopySelectionText")}),f&&k.push({kind:"source",label:g("sessionCopySelectionSource")}),h&&k.push({kind:"rich",label:g("sessionCopySelectionRich")}),u&&o&&k.push({kind:"quote",label:g("sessionQuoteSelection")}),w&&i&&k.push({kind:"newSession",label:g("sessionNewSessionFromSelection")}),k},[o,i,w,u,h,f,d,g]),x=c.useCallback(k=>Yn(k)?b.filter(M=>M.kind!=="quote"):b,[b]),L=c.useCallback(k=>x(k).length,[x]),A=Of({actionCount:b.length,getActionCount:L,containerRef:n,inert:s,isInteractiveTarget:r});c.useEffect(()=>{if(s||!o||!u)return;const k=M=>{if(M.defaultPrevented||M.isComposing||M.ctrlKey||M.metaKey||M.altKey||M.key.length!==1||r(M.target))return;const $=A.captureSnapshot();$&&Yn($)||t(M.key)&&(A.dismiss(),M.preventDefault(),M.stopPropagation())};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[t,A.captureSnapshot,A.dismiss,s,r,o,u]);const E=c.useCallback((k,M)=>{if(k==="text"){const P=Uf(M);return P?(_e(P),!0):!1}if(k==="quote"){const P=e(M.anchors);return P&&A.dismiss(),P}if(k==="source"){const P=Vf(M);return P?(_e(P),!0):!1}if(k==="newSession")return i?(i(Kf(M)),!0):!1;const $=Ho(M.root,M.ranges);return $?(No($.html,$.text),!0):!1},[e,A.dismiss,i]),S=c.useCallback(k=>{const M=[{label:g("sessionCopySelectionText"),onSelect:()=>{E("text",k)}},{label:g("sessionCopySelectionSource"),onSelect:()=>{E("source",k)}}];return o&&!Yn(k)&&M.push({label:g("sessionQuoteSelection"),onSelect:()=>{E("quote",k)}}),i&&M.push({label:g("sessionNewSessionFromSelection"),onSelect:()=>{E("newSession",k)}}),M},[E,o,i,g]);c.useEffect(()=>{if(s)return;const k=n.current,M=k==null?void 0:k.ownerDocument;if(!k||!M)return;const $=M.defaultView??window,P=F=>{if(F.defaultPrevented||r(F.target)||Ff(F,$))return;const W=A.captureSnapshot();!W||!Bf(W,F.clientX,F.clientY)||(F.preventDefault(),F.stopPropagation(),y(F.clientX,F.clientY,M.activeElement instanceof HTMLElement?M.activeElement:null,S(W)))};return M.addEventListener("contextmenu",P),()=>M.removeEventListener("contextmenu",P)},[A.captureSnapshot,n,s,r,y,S]);const v=A.state,_=v!==null&&v.snapshot.root!==n.current,m=v!=null&&v.docked&&typeof document<"u"?document.querySelector("[data-selection-actions-mobile-slot]"):null,C=(v==null?void 0:v.docked)===!0&&m!==null,T=v?a.jsx(Lf,{docked:C,mobile:v.mobile,placement:v.side,style:C?void 0:{top:`${v.top}px`,left:`${v.left}px`},children:x(v.snapshot).map(({kind:k,label:M})=>a.jsx(_f,{kind:k,label:M,onPointerDown:()=>{l.current=null},onPointerUp:$=>{v.mobile&&($.preventDefault(),E(k,v.snapshot)&&(l.current=k))},onClick:()=>{if(l.current===k){l.current=null;return}E(k,v.snapshot)}},k))}):null,N=C&&T?tt.createPortal(T,m):null,R=v&&!C?_?v.snapshot.root.isConnected?tt.createPortal(T,v.snapshot.root):null:T:null;return{dismiss:A.dismiss,floatingSelectionActions:R,mobileSelectionActions:N,selectionContextMenu:p}}function Gf({containerRef:e,composerDraftSignal:t,onQuoteSelection:n,quoteClearSignal:s}){const r=c.useRef(null),o=c.useRef([]),[i,l]=c.useState([]),u=c.useRef(null),d=c.useRef(null),f=c.useRef(t),h=c.useRef(()=>{}),w=c.useCallback(E=>{if(typeof CSS>"u"||!("highlights"in CSS)||typeof Highlight>"u")return;if(E.length===0){CSS.highlights.delete("comment-tint");return}const S=E.filter(v=>Ml(v,e.current)).map(Al).filter(v=>v!==null);if(S.length===0){CSS.highlights.delete("comment-tint");return}CSS.highlights.set("comment-tint",new Highlight(...S))},[e]),g=c.useCallback(()=>{var E;(E=d.current)==null||E.call(d),d.current=null},[]),p=c.useCallback(()=>{var E;(E=u.current)==null||E.disconnect(),u.current=null},[]),y=c.useCallback(E=>{var C;p();const S=Array.from(new Set(E.map(T=>T.sourceElement).filter(T=>T.isConnected))),v=S[0],_=(C=v==null?void 0:v.ownerDocument.defaultView)==null?void 0:C.MutationObserver;if(!v||!_)return;const m=new _(()=>{w(o.current)});for(const T of S)m.observe(T,{childList:!0,characterData:!0,subtree:!0});u.current=m},[w,p]),b=c.useCallback(()=>{g();const E=f.current;!E||o.current.length===0||(d.current=E.subscribeDraftChanges(S=>{h.current(S)}))},[g]),x=c.useCallback(E=>{const S=o.current;E!==S&&(o.current=E,l(Array.from(new Set(E.map(v=>v.renderId).filter(v=>v!==void 0)))),w(E),y(E),S.length===0&&E.length>0?b():S.length>0&&E.length===0&&g())},[w,y,b,g]);h.current=E=>{const S=o.current;if(S.length===0)return;const v=r.current;if(v===null&&E.metadata.mayAffectQuoteAnchors===!1)return;r.current=null;const _=jl(v??E.text),m=S.filter(C=>Tl(_,C));m.length!==S.length&&x(m)},c.useEffect(()=>(f.current=t,b(),g),[t,b,g]),c.useEffect(()=>()=>{g(),p(),w([])},[w,p,g]);const L=c.useCallback((E,S="")=>{var m,C;if(!n||E.length===0)return!1;const v=E.map(T=>{const N=T.sourceLocation;return N?`re: ${N.filePath}:${N.lineStart}
|
|
38
|
+
${T.quotedText}`:T.quotedText}).join(`
|
|
39
|
+
|
|
40
|
+
`),_=n(S?`${v}
|
|
41
|
+
${S}`:`${v}
|
|
42
|
+
`);return _===null?!1:(r.current=_,x([...o.current,...E]),(C=(m=e.current)==null?void 0:m.ownerDocument.getSelection())==null||C.removeAllRanges(),!0)},[e,n,x]),A=c.useCallback((E="")=>{const S=e.current;if(!S)return!1;const v=Nt(S);if(!v)return!1;const _=Mn(v).map(Sn);return L(_,E)},[L,e]);return c.useEffect(()=>{s>0&&x([])},[s,x]),{anchoredRenderIds:i,applyQuoteAnchors:L,applyQuoteFromSelection:A}}function Li({containerRef:e,inert:t,onQuoteSelection:n,onStartNewSessionFromSelection:s,composerDraftSignal:r,quoteClearSignal:o,isInteractiveTarget:i}){const{quoteReplyButtonMode:l}=Si(),u=Gf({containerRef:e,composerDraftSignal:r,onQuoteSelection:n,quoteClearSignal:o}),d=Qf({...u,containerRef:e,inert:t,isInteractiveTarget:i,onQuoteSelection:n,onStartNewSessionFromSelection:s}),f=c.useCallback(h=>{u.applyQuoteAnchors([h])&&d.dismiss()},[u.applyQuoteAnchors,d.dismiss]);return{anchoredRenderIds:u.anchoredRenderIds,alwaysShowQuoteCircles:l==="paragraph-always",paragraphQuoteCirclesEnabled:l!=="block",handleQuoteTextBlock:f,mobileSelectionActions:d.mobileSelectionActions,floatingSelectionActions:d.floatingSelectionActions,selectionContextMenu:d.selectionContextMenu}}const by=Li;function Ri(e,t,n){c.useEffect(()=>{const s=e.current;if(!(!s||!(t!=null&&t.trim())))return Do(s,t,n)},[n,e,t])}function ro(e,t){const n=c.useRef(null);return Ri(n,e,t),n}function oo(e,t){const n=new Map(t.map(s=>[s.id,s.text]));return e.filter(s=>n.get(s.id)!==s.text)}function zf({active:e,storageKey:t,sendComment:n}){const[s,r]=c.useState([]),[o,i]=c.useState(null),[l,u]=c.useState(new Set),[d,f]=c.useState(!1),h=c.useRef(s),w=c.useRef(o),g=c.useRef(l),p=c.useRef(n),y=c.useRef(t);w.current=o,g.current=l,p.current=n,y.current=t,c.useEffect(()=>{var T;const m=t?jf(t):[];h.current=m,w.current=((T=m.at(-1))==null?void 0:T.id)??null,r(m),i(w.current);const C=new Set;g.current=C,u(C),f(!1)},[t]);const b=c.useCallback(()=>{const m=y.current;m&&Xn(m,h.current),r(h.current)},[]),x=c.useCallback(m=>{h.current=m,r(m)},[]),L=c.useCallback(m=>{w.current=m,i(m)},[]),A=c.useCallback(m=>{f(!1);const C=h.current.find(k=>k.id===w.current);if((C==null?void 0:C.location)===m.location&&C.quote===m.quote)return;const T=h.current.filter(k=>k.id!==w.current||k.text.trim()),N=T.find(k=>k.location===m.location&&k.quote===m.quote);if(N){x(T),L(N.id);return}const R={...m,id:crypto.randomUUID(),text:""};x([...T,R]),L(R.id)},[x,L]),E=c.useCallback((m,C)=>{f(!1),h.current=h.current.map(T=>T.id===m?{...T,text:C}:T)},[]),S=c.useCallback(m=>{f(!1),x(h.current.filter(C=>C.id!==m)),w.current===m&&L(null)},[x,L]),v=c.useCallback(async m=>{const C=h.current.find(P=>P.id===m),T=p.current;if(!(C!=null&&C.text.trim())||!T||g.current.has(m))return!1;const N=new Set(g.current).add(m);g.current=N,u(N),b();const R=await T(_i(C)),k=new Set(g.current);if(k.delete(m),g.current=k,u(k),!R)return f(!0),!1;const M=oo(h.current,[C]);x(M),w.current===m&&!M.some(P=>P.id===m)&&L(null);const $=y.current;return $&&Xn($,M),f(!1),!0},[b,x,L]),_=c.useCallback(async()=>{const m=p.current,C=h.current.filter(P=>P.text.trim()&&!g.current.has(P.id));if(C.length===0)return b(),!0;if(!m)return b(),!1;const T=new Set(C.map(P=>P.id)),N=new Set([...g.current,...T]);g.current=N,u(N),b();const R=await m(Tf(C)),k=new Set(g.current);for(const P of T)k.delete(P);if(g.current=k,u(k),!R)return f(!0),!1;const M=oo(h.current,C);x(M),w.current&&T.has(w.current)&&!M.some(P=>P.id===w.current)&&L(null);const $=y.current;return $&&Xn($,M),f(!1),!0},[b,x,L]);return c.useEffect(()=>{if(e)return()=>{_()}},[e,_]),{activeDraft:s.find(m=>m.id===o)??null,cancel:S,error:d,flush:_,open:A,persist:b,sendOne:v,sendingIds:l,update:E}}function xs(e,t){var i,l;const n=t.replaceAll("\\","/"),s=((i=e.embeddedMedia)==null?void 0:i[t])??((l=e.embeddedMedia)==null?void 0:l[n]);if(!s)return null;const r=atob(s.data),o=new Uint8Array(r.length);for(let u=0;u<r.length;u+=1)o[u]=r.charCodeAt(u);return new Blob([o],{type:s.mimeType})}function Mi(e,t){const n=new URLSearchParams({h:t.relayUsername,projectId:t.projectId,path:t.path});if(t.relayUrl){const r=Gc(t.relayUrl);r!==zc&&n.set("r",r)}const s=new URLSearchParams({share:t.secret});return`${e}/play.html?${n}#${s}`}function Xf(e){let t;try{t=new URL(e)}catch{return null}const n=/^(\/remote)?\/share\/([A-Za-z0-9_-]+)\/file$/.exec(t.pathname),s=t.searchParams.get("h"),r=t.searchParams.get("projectId"),o=t.searchParams.get("path");if(!n||!s||!r||!o)return null;const i=t.searchParams.get("r")??void 0;return`${t.origin}${Mi(n[1]??"",{relayUsername:s,projectId:r,path:o,secret:n[2],...i?{relayUrl:i}:{}})}`}function Ai(e){return e&&e.replace(/<\/span>\r?\n(?=<span class="line(?:\s|"))/g,"</span>")}function Yf(e){const t=[];let n=0;const s=/\r\n|\r|\n/g;for(let r=s.exec(e);r;r=s.exec(e)){const o=r.index;t.push({start:n,end:o,text:e.slice(n,o)}),n=r.index+r[0].length}return t.push({start:n,end:e.length,text:e.slice(n)}),t}function ji(e,t,n){e.setAttribute(gc,String(t)),e.setAttribute(wc,String(n))}function Jf(e,t){const n=new Map,s=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0;for(let o=s.nextNode();o;o=s.nextNode()){const i=o,l=i.data;if(t.text.slice(r,r+l.length)!==l)return;const u=t.start+r,d=u+l.length;for(let f=i.parentElement;f&&f!==e;f=f.parentElement){const h=n.get(f);n.set(f,{start:h?Math.min(h.start,u):u,end:h?Math.max(h.end,d):d})}r+=l.length}if(r===t.text.length)for(const[o,i]of n)ji(o,i.start,i.end)}function Zf(e,t){if(!e||t===void 0||typeof document>"u")return e;const n=document.createElement("template");n.innerHTML=Ai(e)??"";const s=Array.from(n.content.querySelectorAll("code .line")),r=Yf(t);for(let o=0;o<s.length;o+=1){const i=s[o],l=r[o];!i||!l||i.textContent!==l.text||(ji(i,l.start,l.end),Jf(i,l))}return n.innerHTML}function eh(e,t){if(typeof document>"u")return null;const n=document.createElement("template");if(n.innerHTML=e,!Array.from(n.content.querySelectorAll("code .line[data-line]")).some(o=>Number(o.dataset.line)===t))return null;const r=o=>{const i=n.content.cloneNode(!0);for(const u of i.querySelectorAll("code .line[data-line]")){const d=Number(u.dataset.line);(!Number.isInteger(d)||!o(d))&&u.remove()}const l=document.createElement("div");return l.append(i),l.innerHTML};return{before:r(o=>o<=t),after:r(o=>o>t)}}function th({value:e,title:t,className:n,disabled:s=!1,icon:r="copy"}){const[o,i]=c.useState(!1),[l,u]=c.useState(!1);return c.useEffect(()=>{if(!o)return;const d=setTimeout(()=>i(!1),1200);return()=>clearTimeout(d)},[o]),a.jsx("button",{type:"button",className:`copy-button ${o?"copied":""} ${n??""}`,title:t,"aria-label":t,disabled:s||l,onClick:async d=>{d.stopPropagation(),u(!0);const f=typeof e=="function"?await Ht(e()):await _e(e);u(!1),f&&i(!0)},children:o?a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsx(nh,{icon:r})})}function nh({icon:e}){const t={width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="path"?a.jsxs("svg",{...t,"aria-hidden":"true",children:[a.jsx("path",{d:"M3 7h6l2 2h10v9H3z"}),a.jsx("path",{d:"M8 14h8"}),a.jsx("path",{d:"m13 11 3 3-3 3"})]}):e==="content"?a.jsxs("svg",{...t,"aria-hidden":"true",children:[a.jsx("path",{d:"M6 2h8l4 4v16H6z"}),a.jsx("path",{d:"M14 2v5h5"}),a.jsx("path",{d:"M9 12h6M9 16h6"})]}):a.jsxs("svg",{...t,"aria-hidden":"true",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}const sh="_root_eaud3_1",rh="_commit_eaud3_14",oh="_age_eaud3_23",ih="_dirty_eaud3_27",ah="_uncommitted_eaud3_33",yt={root:sh,commit:rh,age:oh,dirty:ih,uncommitted:ah};function Ks({projectId:e,path:t,rev:n,origPath:s,dirtyLabel:r,uncommittedLabel:o,className:i}){const l=Ms(),u=Bo(l),d=Lt(),f=Ot(u,qa),h=`${l}\0${e}\0${t}\0${n??""}\0${s??""}`,[w,g]=c.useState({identity:h,value:null}),p=w.identity===h?w.value:null;if(c.useEffect(()=>{if(!f||!e||!t)return;let L=!1;return oe.getGitFileRevision(e,{path:t,rev:n,origPath:s}).then(A=>{L||g({identity:h,value:A})}).catch(()=>{L||g({identity:h,value:null})}),()=>{L=!0}},[h,s,t,e,n,f]),!f||!(p!=null&&p.isGitRepo))return null;if(!p.commit)return a.jsx("span",{className:`${yt.root} ${yt.uncommitted} ${i??""}`,children:o});const y=new URLSearchParams({projectId:e,rev:p.commit.hash,commitFile:n?t:s??t}),b=dt(`${d}/git-status?${y.toString()}`),x=lh(p.commit);return a.jsxs("span",{className:`${yt.root} ${i??""}`,children:[a.jsx("a",{className:yt.commit,href:b,title:x,children:p.commit.shortHash}),a.jsxs("span",{className:yt.age,children:["(",ch(p.commit.authorDate),")"]}),p.dirty&&a.jsx("span",{className:yt.dirty,children:r})]})}function ch(e,t=Date.now()){const n=Math.max(0,Math.floor((t-new Date(e).getTime())/1e3));if(n<60)return"now";const s=Math.floor(n/60);if(s<60)return`${s}m ago`;const r=Math.floor(s/60);if(r<24)return`${r}h ago`;const o=Math.floor(r/24);return o<30?`${o}d ago`:o<365?`${Math.floor(o/30)}mo ago`:`${Math.floor(o/365)}y ago`}function lh(e){const t=new Date(e.authorDate).toLocaleString(),n=`${e.message}${e.messageTruncated?`
|
|
43
|
+
...`:""}`;return`${e.authorName}
|
|
44
|
+
${t}
|
|
45
|
+
|
|
46
|
+
${n}`}function uh(e){return e==="auto"||e==="unified"||e==="side-by-side"}function dh(){try{const e=localStorage.getItem(Le.diffViewMode);if(uh(e))return e}catch{}return"auto"}function fh(){const[e,t]=c.useState(dh),n=c.useCallback(s=>{t(s);try{localStorage.setItem(Le.diffViewMode,s)}catch{}},[]);return[e,n]}const hh="[data-source-list-item]:not(:disabled)",mh="[data-source-file-item]:not(:disabled)",ph=100;function Jn(){Wa(ph)}function Sy(e,{filesOnly:t=!1,onPage:n}={}){var f,h;const s=e.key==="PageDown"?1:e.key==="PageUp"?-1:null;if(s===null&&e.key!=="ArrowDown"&&e.key!=="ArrowUp"&&e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;if(s!==null){if(!n)return;e.preventDefault(),Jn(),n(s);return}const r=Array.from(e.currentTarget.querySelectorAll(t?mh:hh));if(r.length===0)return;const o=document.activeElement,i=r.indexOf(o);if(i<0)return;if(e.key==="ArrowLeft"||e.key==="ArrowRight"){const w=r[i],g=w.getAttribute("aria-expanded");if(e.preventDefault(),Jn(),e.key==="ArrowRight"){if(g==="false"){w.click();return}if(g==="true"){const b=r[i+1];if(!b||!((f=w.parentElement)!=null&&f.contains(b)))return;b.focus()}return}if(g==="true"){w.click();return}const p=w.closest("ul");if(!p||p===e.currentTarget)return;const y=(h=p.parentElement)==null?void 0:h.querySelector(":scope > [data-source-list-item]:not(:disabled)");if(!y)return;y.focus();return}const l=e.key==="ArrowDown"?1:-1,u=Math.min(r.length-1,Math.max(0,i+l)),d=r[u];d&&(e.preventDefault(),Jn(),d!==o&&d.focus())}function Cy(e,t=!0){c.useEffect(()=>{if(!t)return;const n=s=>{if(s.defaultPrevented||s.key!=="/"||s.altKey||s.ctrlKey||s.metaKey||Ti(s.target))return;const r=e.current;r&&(s.preventDefault(),r.focus(),r.select())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}function Ti(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT":!1}const gh=1e3;function wh(e,t){return e==="unified"||e==="side-by-side"?e:t>=gh?"side-by-side":"unified"}function yh(e){const t=[];let n=0;for(const s of e){t.push({type:"header",text:`@@ -${s.oldStart},${s.oldLines} +${s.newStart},${s.newLines} @@`});let r=[],o=[];const i=()=>{const l=Math.max(r.length,o.length);for(let u=0;u<l;u++)t.push({type:"line",left:r[u]??null,right:o[u]??null});r=[],o=[]};for(const l of s.lines){const u=n++,d=l[0];d==="-"?r.push(u):d==="+"?o.push(u):(i(),t.push({type:"line",left:u,right:u}))}i()}return t}function Ii(e,t=!1){var r;const n=new Map;if(typeof DOMParser>"u")return n;const s=new DOMParser().parseFromString(e,"text/html");for(const o of s.querySelectorAll("[data-diff-line]")){const i=Number(o.getAttribute("data-diff-line"));Number.isInteger(i)&&(t&&((r=o.querySelector(".diff-prefix"))==null||r.remove()),n.set(i,o.outerHTML))}return n}const vh=c.createContext(null);function xh(){return c.useContext(vh)}const yn=new Map;function bh(e,t){let n=yn.get(e);return n||(n=new Set,yn.set(e,n)),n.add(t),()=>{n==null||n.delete(t),n&&n.size===0&&yn.delete(e)}}function io(e){for(const t of yn.get(e)??[])t()}function Sh(e,t,n=!1){const s=Ka(),r=Lt(),o=xh(),[i,l]=c.useState([]),[u,d]=c.useState(!1),[f,h]=c.useState(null),w=c.useRef(null),g=c.useCallback(async()=>{try{const b=await oe.listReviewComments(e);l(b.comments.filter(x=>x.status==="pending"&&x.anchor.path===t))}catch{}},[e,t]);c.useEffect(()=>(g(),bh(e,()=>{g()})),[e,g]);const p=c.useCallback(async(b,x)=>{d(!0),h(null);try{const{comment:L}=await oe.addReviewComment(e,b,x);return l(A=>[...A,L]),io(e),!0}catch(L){return h(L instanceof Error?L.message:"Failed to add comment"),!1}finally{d(!1)}},[e]),y=c.useCallback(async(b,x,L,A,E)=>{var S;d(!0),h(null);try{const v=JSON.stringify({anchor:b,text:x,target:L}),_=n&&((S=w.current)==null?void 0:S.key)===v?w.current:null,m=_?_.commentId:(await oe.addReviewComment(e,b,x)).comment.id,C=(_==null?void 0:_.submissionId)??crypto.randomUUID();n&&!_&&(w.current={key:v,commentId:m,submissionId:C});const T=n?{id:C}:void 0,N=T?await oe.submitReview(e,[m],L,L==="new"?E:void 0,T):L==="new"&&E?await oe.submitReview(e,[m],L,E):await oe.submitReview(e,[m],L);return io(e),N.sessionId?(w.current=null,s(`${r}/projects/${e}/sessions/${N.sessionId}`),"navigated"):(n&&(w.current=null),h(A),g(),"queued")}catch(v){return h(v instanceof Error?v.message:"Failed to submit"),"error"}finally{d(!1)}},[e,s,r,g,n]);return{pending:i,defaultSession:o,busy:u,error:f,setError:h,refreshPending:g,addToReview:p,submitNow:y}}const Ni=$o*Po,Ch=80,Eh=600,kh=10,Qs=150,En="yep-hovercard-appearance-change",_h=Rs(Le.sessionHoverCardShowDelayMs,Ni,e=>{const t=Number(e);return Number.isFinite(t)?Math.max(0,t):void 0});function Lh(e,t,n){return Math.min(n,Math.max(t,e))}function Rh(e,t){return Math.round(e/t)*t}function Pi(e){return Number.isFinite(e)?Lh(Rh(e,kh),Ch,Eh):Qs}function Mh(e,t){const n=localStorage.getItem(e);return n===null?t:Number(n)}function ao(){return{showDelayMs:Ni,warmShowDelayMs:$o,maxHeightPx:Pi(Mh(Le.sessionHoverCardMaxHeightPx,Qs))}}function $i(){const{tooltipMode:e,tooltipDelayMs:t}=Qa(),[n,s]=c.useState(ao);c.useEffect(()=>{const o=()=>s(ao());return window.addEventListener(En,o),()=>window.removeEventListener(En,o)},[]);const r=_h.read();return{...n,showDelayMs:e==="native"?r:t*Po,warmShowDelayMs:t}}function Ey(){const{maxHeightPx:e}=$i(),t=c.useCallback(s=>{localStorage.setItem(Le.sessionHoverCardMaxHeightPx,String(Pi(s))),window.dispatchEvent(new Event(En))},[]),n=c.useCallback(()=>{localStorage.removeItem(Le.sessionHoverCardMaxHeightPx),window.dispatchEvent(new Event(En))},[]);return{hoverCardMaxHeightPx:e,setHoverCardMaxHeightPx:t,resetHoverCardAppearance:n}}const bs="active-session-hovercard",Ss=new EventTarget;let co=0;function Ah(){return co+=1,`session-hovercard-${co}`}function jh(e){Ss.dispatchEvent(new CustomEvent(bs,{detail:e}))}function Th(e){const t=n=>{e(n.detail)};return Ss.addEventListener(bs,t),()=>{Ss.removeEventListener(bs,t)}}function Ih({targetRef:e,showDelayMs:t,warmShowDelayMs:n,enabled:s=!0,refreshPreview:r}){const o=r==null?void 0:r.projectId,i=r==null?void 0:r.sessionId,l=r==null?void 0:r.lastAgentText,u=r==null?void 0:r.owner,d=r!==void 0&&r.available!==!1,f=c.useRef(Symbol("session-hovercard-intent")),h=c.useRef(null),w=c.useRef(null),g=c.useRef(!1),p=c.useRef(null);p.current||(p.current=Ah());const y=p.current,[b,x]=c.useState(null),L=c.useRef(null),A=c.useCallback(()=>{Ga(f.current)},[]),E=c.useCallback(()=>{const N=h.current;N&&(h.current=null,za(N))},[]),S=c.useCallback(()=>{A(),E(),L.current=null,x(null)},[A,E]),v=c.useCallback(()=>{!d||!o||!i||l||u==="self"||u==="external"||g.current||(g.current=!0,oe.refreshSessionPreview(o,i).finally(()=>{g.current=!1}))},[d,l,u,o,i]),_=c.useCallback(()=>{if(!s||Xa()){S();return}A();const N=Ya()?n:t,R=e.current;R&&Ja(f.current,N,()=>{if(!R.isConnected||!ec(R))return;const k=R.getBoundingClientRect();v(),jh(y),h.current??(h.current=tc(S));const M={rowLeft:k.left,rowTop:k.top,rowRight:k.right,rowBottom:k.bottom,cursorX:w.current??k.right};L.current=M,x(M)})},[S,A,s,y,v,t,e,n]);c.useEffect(()=>Th(N=>{N!==y&&S()}),[S,y]),c.useEffect(()=>Za(S),[S]),c.useEffect(()=>{s||S()},[S,s]),c.useEffect(()=>()=>{A(),E()},[A,E]);const m=c.useCallback(N=>{N.pointerType!=="touch"&&(w.current=N.clientX,_())},[_]),C=c.useCallback(N=>{N.pointerType!=="touch"&&(w.current=N.clientX,L.current||_())},[_]),T=c.useCallback(N=>{const R=N.relatedTarget;R instanceof Element&&R.closest(`[data-session-hovercard-id="${y}"]`)!==null||S()},[S,y]);return{anchor:b,hoverCardId:y,clear:S,onPointerEnter:m,onPointerMove:C,onPointerLeave:T}}const Nh=Date.UTC(2001,0,1);function Ph(e){if(!e)return!1;const t=new Date(e).getTime();return Number.isFinite(t)&&t>=Nh}function lo(e){if(!Ph(e))return null;const t=Date.now()-new Date(e).getTime();if(t<0)return"0m";const n=Math.floor(t/6e4);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function $h(e,t){const n=lo(e),s=lo(t);return n?`${n} ago${s?` (est. ${s})`:""}`:s?`est. ${s}`:null}const Fh=/<command-name>([\s\S]*?)<\/command-name>/,Bh=/<command-message>[\s\S]*?<\/command-message>/g,Dh=/<command-args>([\s\S]*?)<\/command-args>/,Oh=/<command-name>[\s\S]*?<\/command-name>/g,Hh=/<command-args>[\s\S]*?<\/command-args>/g,Uh=/<local-command-caveat>[\s\S]*?<\/local-command-caveat>/g,Vh=/^(?:\s*<local-command-caveat>[\s\S]*?<\/local-command-caveat>\s*)+$/,qh=/^\s*<local-command-stdout>([\s\S]*?)<\/local-command-stdout>\s*$/,Wh=new RegExp("\x1B\\[[\\d;:? ]*[ -/]*[@-~]","g");function Kh(e){var r,o,i,l;const t=(o=(r=e.match(Fh))==null?void 0:r[1])==null?void 0:o.trim();if(!t||e.replace(Uh,"").replace(Oh,"").replace(Bh,"").replace(Hh,"").trim())return null;const s=((l=(i=e.match(Dh))==null?void 0:i[1])==null?void 0:l.trim())??"";return{command:t,args:s}}function ky(e){return e.args?`${e.command} ${e.args}`:e.command}function _y(e){return Vh.test(e)}function Ly(e){var n;const t=e.match(qh);return((n=t==null?void 0:t[1])==null?void 0:n.replace(Wh,"").trim())??null}function Ry(e){const t=e.replace(/\s+/g," ").trim().toLowerCase();return t==="compacted"||t.startsWith("compacted (")}const Qh=19,Gh=34,zh=20,Xh=38;function Yh(e,t){return Math.max(1,Math.floor((e-Gh-zh-(t?Xh:0))/Qh))}const Fi="--ya-activity-play",Ze=new Map;let Xe=null;function Jh(){return document.visibilityState==="visible"}function Gs(e,t){const n=t.intersectsViewport&&Jh();if(e.style.setProperty(Fi,n?"running":"paused"),t.active!==n){t.active=n;for(const s of t.subscriptions.values())s==null||s(n)}}function Zh(e){for(const t of e){const n=t.target,s=Ze.get(n);s&&(s.intersectsViewport=t.isIntersecting,Gs(n,s))}}function em(){return typeof window.IntersectionObserver!="function"?null:(Xe??(Xe=new window.IntersectionObserver(Zh)),Xe)}function uo(){for(const[e,t]of Ze)Gs(e,t)}function tm(e,t){const n=Symbol("activity-animation");let s=Ze.get(e);if(s)s.subscriptions.set(n,t),t==null||t(s.active??!1);else{const r=em();s={active:null,intersectsViewport:r===null,subscriptions:new Map([[n,t]])};const o=Ze.size===0;Ze.set(e,s),o&&document.addEventListener("visibilitychange",uo),r==null||r.observe(e),Gs(e,s)}return()=>{const r=Ze.get(e);r&&(r.subscriptions.delete(n),!(r.subscriptions.size>0)&&(Xe==null||Xe.unobserve(e),Ze.delete(e),e.style.removeProperty(Fi),Ze.size===0&&(Xe==null||Xe.disconnect(),Xe=null,document.removeEventListener("visibilitychange",uo))))}}const nm="_dot_m9hw9_1",sm="_root_m9hw9_11",rm="_pill_m9hw9_17",om="_label_m9hw9_30",im="_icon_m9hw9_34",am="_iconSvg_m9hw9_46",vt={dot:nm,root:sm,pill:rm,label:om,icon:im,iconSvg:am};function cm({variant:e="dot",label:t="Thinking",className:n,animationVisibilityManaged:s=!1}){const r=c.useRef(null);c.useEffect(()=>{if(!(s||!r.current))return tm(r.current)},[s]);const o=a.jsx("span",{className:vt.dot});return e==="icon"?a.jsx("span",{ref:r,className:`${vt.icon} ${n??""}`,title:t,"aria-label":t,role:"img",children:a.jsxs("svg",{className:vt.iconSvg,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M12 18V5"}),a.jsx("path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}),a.jsx("path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}),a.jsx("path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}),a.jsx("path",{d:"M18 18a4 4 0 0 0 2-7.464"}),a.jsx("path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}),a.jsx("path",{d:"M6 18a4 4 0 0 1-2-7.464"}),a.jsx("path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"})]})}):e==="pill"?a.jsxs("span",{ref:r,className:`${vt.pill} ${n??""}`,children:[o,a.jsx("span",{className:vt.label,children:t})]}):a.jsx("span",{ref:r,className:`${vt.root} ${n??""}`,children:o})}function lm({variant:e,label:t}){const n=e==="needs-input"?"Input Needed":"New";return a.jsx("span",{className:`status-badge notification-${e}`,children:t??n})}function um({status:e,pendingInputType:t,activity:n}){if(e.owner==="external")return a.jsx("span",{className:"status-badge status-external",children:"External"});if(t){const s=t==="tool-approval"?"Approval Needed":"Question";return a.jsx(lm,{variant:"needs-input",label:s})}return n==="in-turn"?a.jsx(cm,{variant:"pill"}):null}const dm="_root_79ggm_5",fm="_wide_79ggm_15",hm="_turn_79ggm_38",mm="_command_79ggm_54",pm="_meta_79ggm_59",gm="_project_79ggm_68",wm="_age_79ggm_76",ym="_reply_79ggm_85",vm="_replyMarker_79ggm_95",xm="_replyText_79ggm_100",De={root:dm,wide:fm,turn:hm,command:mm,meta:pm,project:gm,age:wm,reply:ym,replyMarker:vm,replyText:xm},hn=4,et=8,bm=14,fo=8;function Sm({rowLeft:e,rowRight:t,cursorX:n,cardWidth:s,viewportWidth:r}){const o=Math.max(et,r-s-et),i=t+fo;if(i+s<=r-et)return i;const l=e-fo-s;return l>=et?l:Math.min(Math.max(n+bm,et),o)}function Cm({hoverCardId:e,anchor:t,prompt:n,lastAgentText:s,provider:r,model:o,projectName:i,ageLabel:l,onMouseLeave:u,status:d,pendingInputType:f,hasUnread:h,activity:w,maxHeightPx:g=Qs}){const p=c.useRef(null),y=ro(n),b=ro(s),[x,L]=c.useState(null),A=[n,s??"",o??"",i??"",l,d].join("\0");c.useLayoutEffect(()=>{const v=p.current;if(!v)return;const{rowTop:_,rowBottom:m}=t,C=v.scrollHeight,T=v.offsetWidth,N=Math.max(0,window.innerHeight-m-hn-et),R=Math.max(0,_-hn-et),k=Math.min(C,g),M=Math.min(N,g),$=Math.min(R,g);let P,F,W=!1;k<=M?(P=!0,F=M):k<=$?(P=!1,F=$):(P=N>=R,F=Math.min(Math.max(N,R),g),W=!0);const D=Math.min(C,F),V=P?m+hn:_-hn-D,G=Sm({...t,cardWidth:T,viewportWidth:window.innerWidth});L({top:Math.max(et,V),left:G,maxHeight:F,loosened:W})},[t,A,g]);const E=x?Yh(x.maxHeight,!!s):void 0,S=n?Kh(n):null;return tt.createPortal(a.jsxs("div",{ref:p,"data-session-hovercard-id":e,...as,className:`${De.root}${x!=null&&x.loosened?` ${De.wide}`:""}`,onMouseLeave:u,style:x?{top:x.top,left:x.left,maxHeight:x.maxHeight}:{top:0,left:0,visibility:"hidden"},role:"tooltip",children:[n&&a.jsx("div",{ref:y,className:De.turn,style:E?{WebkitLineClamp:E}:void 0,children:S?a.jsxs("span",{className:De.command,children:[S.command,S.args?` ${S.args}`:""]}):n}),a.jsxs("div",{className:De.meta,children:[a.jsx(Xc,{provider:r,model:o}),i&&a.jsx("span",{className:De.project,children:i}),l&&a.jsx("span",{className:De.age,children:l}),d&&a.jsx(um,{status:d,pendingInputType:f,hasUnread:h,activity:w})]}),s&&a.jsxs("div",{ref:b,className:De.reply,children:[a.jsx("span",{className:De.replyMarker,"aria-hidden":"true",children:"↳"}),a.jsx("span",{className:De.replyText,children:s})]})]}),document.body)}function ho({sessionId:e,fallback:t,children:n,className:s}){var L,A;const r=cc(e),{showDelayMs:o,warmShowDelayMs:i,maxHeightPx:l}=$i(),u=c.useRef(null),{anchor:d,hoverCardId:f,clear:h,onPointerEnter:w,onPointerMove:g,onPointerLeave:p}=Ih({targetRef:u,showDelayMs:o,warmShowDelayMs:i,refreshPreview:{projectId:t.projectId,sessionId:e,lastAgentText:r==null?void 0:r.lastAgentText,owner:(L=r==null?void 0:r.ownership)==null?void 0:L.owner,available:!!r}});c.useEffect(()=>{if(!d)return;const E=()=>h();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[d,h]);const b=((A=!!(r!=null&&r.customTitle)?r==null?void 0:r.title:(r==null?void 0:r.initialPrompt)??(r==null?void 0:r.fullTitle)??(r==null?void 0:r.title))==null?void 0:A.trim())||t.title,x=(r==null?void 0:r.provider)??t.provider;return a.jsxs("span",{ref:u,className:s,onPointerEnter:w,onPointerMove:g,onPointerLeave:p,children:[n,d&&a.jsx(Cm,{hoverCardId:f,anchor:d,prompt:b,lastAgentText:r==null?void 0:r.lastAgentText,provider:x,model:(r==null?void 0:r.model)??t.model,projectName:r==null?void 0:r.projectName,ageLabel:$h(r==null?void 0:r.updatedAt,r==null?void 0:r.createdAt),status:r==null?void 0:r.ownership,pendingInputType:r==null?void 0:r.pendingInputType,hasUnread:r==null?void 0:r.hasUnread,activity:r==null?void 0:r.activity,maxHeightPx:l,onMouseLeave:h})]})}async function Em(e){var s;const t=[];let n;for(;;){const r=await oe.getGlobalSessions({project:e,limit:500,after:n});if(t.push(...r.sessions),!r.hasMore)return t;const o=(s=r.sessions[r.sessions.length-1])==null?void 0:s.updatedAt;if(!o||o===n)throw new Error("Existing-session list did not advance");n=o}}function km(e,t){const n=e.customTitle||e.title||e.id.slice(0,8),s=e.model?`${e.provider}/${e.model}`:e.provider;return t?`${n} · ${s} · ${t}`:`${n} · ${s}`}const _m="_window_1f36g_1",Lm="_anchor_1f36g_12",Rm="_snippet_1f36g_18",Mm="_input_1f36g_30",Am="_error_1f36g_41",jm="_actions_1f36g_46",Tm="_submitActions_1f36g_53",Im="_destination_1f36g_62",Nm="_destinationError_1f36g_76",Pm="_defaultSessionTarget_1f36g_82",$m="_submit_1f36g_53",Ae={window:_m,anchor:Lm,snippet:Rm,input:Mm,error:Am,actions:jm,submitActions:Tm,destination:Im,destinationError:Nm,defaultSessionTarget:Pm,submit:$m};function Fm({projectId:e,anchorLabel:t,snippet:n,busy:s,error:r,onCancel:o,onAddToReview:i,defaultSession:l,onSubmit:u,t:d}){const[f,h]=c.useState(""),[w,g]=c.useState(null),[p,y]=c.useState(!1),[b,x]=c.useState((l==null?void 0:l.id)??"new"),L=c.useRef(!1),A=f.trim().length>0&&!s;c.useEffect(()=>{let v=!1;return Em(e).then(_=>{var m;v||(g(_),!l&&!L.current&&x(((m=_[0])==null?void 0:m.id)??"new"))}).catch(()=>{v||y(!0)}),()=>{v=!0}},[l,e]);const E=(w==null?void 0:w.find(v=>v.id===b))??null,S=a.jsx("button",{type:"button",className:Ae.submit,onClick:()=>u(f,b),disabled:!A,children:d("sourceReviewSubmitComment")});return a.jsx(Bi,{anchorLabel:t,snippet:n,text:f,placeholder:d("sourceReviewCommentPlaceholder"),error:r,onChange:h,actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"review-comment-window-cancel",onClick:o,disabled:s,children:d("cancel")}),a.jsx("button",{type:"button",className:"review-comment-window-add",onClick:()=>i(f),disabled:!A,children:d("sourceReviewAddToReview")}),a.jsxs("div",{className:Ae.submitActions,children:[a.jsxs("label",{className:Ae.destination,children:[a.jsx("span",{children:d("sourceReviewTargetLegend")}),a.jsxs("select",{value:b,onChange:v=>{L.current=!0,x(v.target.value)},children:[a.jsx("option",{value:"new",children:d("sourceReviewTargetNew")}),l&&!(w!=null&&w.some(v=>v.id===l.id))&&a.jsxs("option",{value:l.id,children:[l.title," ·"," ",l.newSession.provider,l.newSession.model?`/${l.newSession.model}`:""," ","· ",d("sourceReviewCurrentSuffix")]}),w==null?void 0:w.map(v=>a.jsx("option",{value:v.id,children:km(v,v.id===(l==null?void 0:l.id)?d("sourceReviewCurrentSuffix"):void 0)},v.id))]})]}),p&&a.jsx("span",{className:Ae.destinationError,children:d("sourceReviewSessionsUnavailable")}),l&&b===l.id?a.jsx(ho,{sessionId:l.id,fallback:{projectId:l.projectId,title:l.title,provider:l.newSession.provider,model:l.newSession.model},className:Ae.defaultSessionTarget,children:S}):E?a.jsx(ho,{sessionId:E.id,fallback:{projectId:E.projectId,title:E.customTitle||E.title||E.id.slice(0,8),provider:E.provider,model:E.model},className:Ae.defaultSessionTarget,children:S}):S]})]})})}function Bi({anchorLabel:e,snippet:t,text:n,placeholder:s,autoFocus:r=!0,error:o,onChange:i,onBlur:l,onKeyDown:u,actions:d}){return a.jsxs("div",{className:Ae.window,"data-markdown-copy-ignore":"true",children:[a.jsx("div",{className:Ae.anchor,children:e}),a.jsx("pre",{className:Ae.snippet,children:t}),a.jsx("textarea",{className:Ae.input,autoFocus:r,rows:3,value:n,placeholder:s,onBlur:l,onChange:f=>i(f.target.value),onKeyDown:u}),o&&a.jsx("div",{className:Ae.error,children:o}),a.jsx("div",{className:Ae.actions,children:d})]})}const Bm="_menuTrigger_qenm5_1",Dm={menuTrigger:Bm};function Om({container:e,structuredPatch:t,pending:n,revisions:s,consumeLongPressClick:r,onOpenComment:o,onOpenMenu:i,onBeginLongPress:l,onMoveLongPress:u,onEndLongPress:d,t:f}){const[h,w]=c.useState(null),g=c.useCallback(b=>{if(!(b instanceof HTMLElement))return null;const x=b.closest("[data-diff-line]");return!x||!e.contains(x)?null:Zn(e,x,t)},[e,t]),p=c.useCallback(b=>{w(x=>(x==null?void 0:x.flatIndex)===b.flatIndex&&x.contextSide===b.contextSide&&x.top===b.top?x:b)},[]),y=c.useCallback(()=>{if(!h)return null;const b=e.querySelectorAll(`[data-diff-line="${h.flatIndex}"]`),x=Array.from(b).find(L=>Di(L)===h.contextSide)??b[0];return x?Zn(e,x,t):null},[h,e,t]);return c.useLayoutEffect(()=>{const b=m=>{var T;if(r()||!(((T=window.getSelection())==null?void 0:T.isCollapsed)??!0))return;const C=g(m.target);C&&o(C)},x=m=>{const C=g(m.target);C&&(m.preventDefault(),m.stopPropagation(),p(C.target),i(C,{x:m.clientX,y:m.clientY}))},L=m=>{const C=g(m.target);C&&(p(C.target),l(C,m))},A=m=>{u(m);const C=g(m.target);C&&p(C.target)},E=()=>d(),S=()=>{d(),w(null)},v=m=>{const C=g(m.target);C&&p(C.target)},_=m=>{const C=g(m.target);if(!C)return;if(m.key==="ContextMenu"||m.shiftKey&&m.key==="F10"){m.preventDefault(),m.stopPropagation();const k=C.node.getBoundingClientRect();i(C,{x:k.left+Math.min(32,k.width/2),y:k.bottom});return}if(m.key==="Enter"||m.key===" "){m.preventDefault(),o(C);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;const T=Array.from(e.querySelectorAll("[data-diff-line]")),N=T.indexOf(C.node),R=T[N+(m.key==="ArrowDown"?1:-1)];R&&(m.preventDefault(),R.focus())};return e.addEventListener("click",b),e.addEventListener("contextmenu",x),e.addEventListener("pointerdown",L),e.addEventListener("pointermove",A),e.addEventListener("pointerup",E),e.addEventListener("pointercancel",E),e.addEventListener("pointerleave",S),e.addEventListener("focusin",v),e.addEventListener("keydown",_),()=>{e.removeEventListener("click",b),e.removeEventListener("contextmenu",x),e.removeEventListener("pointerdown",L),e.removeEventListener("pointermove",A),e.removeEventListener("pointerup",E),e.removeEventListener("pointercancel",E),e.removeEventListener("pointerleave",S),e.removeEventListener("focusin",v),e.removeEventListener("keydown",_)}},[p,r,e,l,d,u,o,i,g]),c.useLayoutEffect(()=>{const b=new Set(n.map(A=>Um(A.anchor))),x=()=>{const A=e.querySelectorAll("[data-diff-line]");for(const E of A){const S=Zn(e,E,t),v=S?s==null?void 0:s[S.location.side]:void 0;E.classList.toggle("has-review-comment",!!S&&b.has(Oi(S.location,v))),E.tabIndex=0,E.setAttribute("aria-label",f("sourceDiffLineActions"))}};x();const L=new MutationObserver(x);return L.observe(e,{childList:!0,subtree:!0}),()=>L.disconnect()},[e,n,s,t,f]),{activeLine:h,resolveActiveLine:y}}function Zn(e,t,n){const s=Number(t.getAttribute("data-diff-line")),r=Di(t),o=nl(n,s,void 0,r);if(!o)return null;const i=t.getBoundingClientRect(),l=e.getBoundingClientRect();return{node:t,target:{flatIndex:s,contextSide:r,top:i.top-l.top+e.scrollTop},location:o}}function Di(e){var t;return((t=e.closest("[data-diff-col]"))==null?void 0:t.getAttribute("data-diff-col"))==="old"?"old":"new"}function Hm(e){return(e==null?void 0:e.kind)==="sha"?`sha:${e.sha}`:"uncommitted"}function Oi(e,t){return`${Hm(t)}:${e.side}:${e.oldLine}:${e.newLine}`}function Um(e){return Oi(e,e.revision)}function Vm({projectId:e,filePath:t,structuredPatch:n,revisions:s,projections:r,container:o,onOpenChange:i,renderSource:l,t:u}){const[d,f]=c.useState(null),{pending:h,defaultSession:w,busy:g,error:p,setError:y,addToReview:b,submitNow:x}=Sh(e,t,r!==void 0);c.useLayoutEffect(()=>(i==null||i(d!==null),()=>{d&&(i==null||i(!1))}),[i,d]);const L=c.useCallback(v=>{y(null),f(v)},[y]),A=c.useCallback(async v=>{d&&await b(d.anchor,v)&&f(null)},[b,d]),E=c.useCallback(async(v,_,m)=>{if(!d)return;await x(d.anchor,v,_,u("sourceReviewSubmitQueued"),m)==="navigated"&&f(null)},[d,x,u]),S=d?a.jsx(Fm,{projectId:e,anchorLabel:`${t}:${d.anchor.newLine??d.anchor.oldLine??"?"}`,snippet:d.anchor.snippet,busy:g,error:p,onCancel:()=>f(null),onAddToReview:A,defaultSession:w,onSubmit:(v,_)=>E(v,_,_==="new"?w==null?void 0:w.newSession:void 0),t:u},`${d.anchor.side}:${d.flatIndex}`):null;return a.jsxs(a.Fragment,{children:[l({openComment:d,editor:S}),a.jsx(qm,{filePath:t,structuredPatch:n,revisions:s,projections:r,container:o,pending:h,onOpenComment:L,t:u})]})}function qm({filePath:e,structuredPatch:t,revisions:n,projections:s,container:r,pending:o,onOpenComment:i,t:l}){const{menu:u,openAt:d,openFromButton:f,beginLongPressAt:h,moveLongPressAt:w,endLongPress:g,consumeLongPressClick:p}=Ci(l),y=c.useCallback(v=>({path:e,revision:(n==null?void 0:n[v.side])??{kind:"uncommitted",savedAt:new Date().toISOString()},side:v.side,oldLine:v.oldLine,newLine:v.newLine,snippet:v.snippet,snippetAnchorOffset:v.snippetAnchorOffset,...s!=null&&s[v.side]?{projection:s[v.side]}:{}}),[e,s,n]),b=c.useCallback(({location:v,target:_})=>{i({anchor:y(v),flatIndex:_.flatIndex})},[y,i]),x=c.useCallback((v,_,m)=>{const C=_.snippet.split(`
|
|
47
|
+
`)[_.snippetAnchorOffset]??"",T=_.newLine??_.oldLine;return[{label:l("sourceCommentOnLine"),onSelect:()=>b({target:v,location:_,node:m})},{label:l("sourceCopyLine"),separatorBefore:!0,onSelect:()=>{_e(C)}},{label:l("sourceCopyPathLine"),onSelect:()=>{_e(T?`${e}:${T}`:e)}}]},[e,b,l]),L=c.useCallback((v,_)=>{d(_.x,_.y,v.node,x(v.target,v.location,v.node))},[x,d]),A=c.useCallback((v,_)=>{h(_,v.node,x(v.target,v.location,v.node))},[h,x]),{activeLine:E,resolveActiveLine:S}=Om({container:r,structuredPatch:t,pending:o,revisions:n,consumeLongPressClick:p,onOpenComment:b,onOpenMenu:L,onBeginLongPress:A,onMoveLongPress:w,onEndLongPress:g,t:l});return a.jsxs(a.Fragment,{children:[E&&a.jsx("button",{type:"button",className:Dm.menuTrigger,style:{top:E.top},"aria-label":l("sourceMoreActions"),title:l("sourceMoreActions"),onClick:v=>{const _=S();_&&f(v,x(_.target,_.location,_.node))},children:"⋯"}),u]})}const Wm="_root_nfjne_1",Km="_source_nfjne_7",Qm="_editor_nfjne_11",xt={root:Wm,source:Km,editor:Qm};function Dt({before:e,editor:t,after:n}){return t?a.jsxs("div",{className:xt.root,"data-review-comment-split":"",children:[a.jsx("div",{className:xt.source,"data-review-comment-before":"",children:e}),a.jsx("div",{className:xt.editor,children:t}),a.jsx("div",{className:xt.source,"data-review-comment-after":"",children:n})]}):a.jsx(a.Fragment,{children:e})}function Gm({editor:e}){return e?a.jsx("div",{className:xt.root,"data-review-comment-inline":"",children:a.jsx("div",{className:xt.editor,children:e})}):null}const zm=c.memo(function({diffHtml:t,structuredPatch:n,splitAfterLine:s,editor:r=null}){const o=c.useMemo(()=>Ii(t),[t]),i=c.useMemo(()=>yh(n),[n]),l=s===void 0?-1:i.findIndex(u=>u.type==="line"&&(u.left===s||u.right===s));return l<0||!r?a.jsx(es,{rows:i,fragments:o}):a.jsx(Dt,{before:a.jsx(es,{rows:i.slice(0,l+1),fragments:o}),editor:r,after:a.jsx(es,{rows:i.slice(l+1),fragments:o})})});function es({rows:e,fragments:t}){return a.jsx("div",{className:"side-by-side-diff",children:e.map((n,s)=>n.type==="header"?a.jsx("div",{className:"sbs-header highlighted-diff",dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code><span class="line line-hunk">${Xm(n.text)}</span></code></pre>`}},`h-${s}`):a.jsxs("div",{className:"sbs-row",children:[a.jsx(po,{col:"old",html:mo(t,n.left)}),a.jsx(po,{col:"new",html:mo(t,n.right)})]},`r-${s}`))})}function mo(e,t){return t===null?null:e.get(t)??null}function po({col:e,html:t}){return t===null?a.jsx("div",{className:"sbs-cell sbs-empty"}):a.jsx("div",{className:"sbs-cell highlighted-diff","data-diff-col":e,dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code>${t}</code></pre>`}})}function Xm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const Ym="_plain_v5smy_1",Jm="_hunkHeader_v5smy_22",go={plain:Ym,hunkHeader:Jm},ts=".line-deleted, .line-inserted, .diff-removed, .diff-added, .fixed-font-diff-removed, .fixed-font-diff-added",wo=c.memo(function({diffHtml:t,structuredPatch:n,splitAfterLine:s,editor:r=null,plain:o=!1,hideRemovedLines:i=!1}){const l=c.useMemo(()=>o?new Map:Ii(t,i),[t,i,o]),u=c.useMemo(()=>o?[]:ep(n,i),[i,o,n]);if(o)return a.jsx(Zm,{hunks:n,hideRemovedLines:i});const d=s===void 0?-1:u.findIndex(f=>f.type==="line"&&f.flatIndex===s);return d<0||!r?a.jsx(ns,{rows:u,fragments:l,omitDiffPrefixes:i}):a.jsx(Dt,{before:a.jsx(ns,{rows:u.slice(0,d+1),fragments:l,omitDiffPrefixes:i}),editor:r,after:a.jsx(ns,{rows:u.slice(d+1),fragments:l,omitDiffPrefixes:i})})});function Zm({hunks:e,hideRemovedLines:t}){return a.jsx("div",{className:go.plain,"data-diff-rendering":"plain",children:a.jsx("pre",{children:a.jsx("code",{children:e.map((n,s)=>a.jsxs(c.Fragment,{children:[!t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${go.hunkHeader} line-hunk`,children:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`}),`
|
|
48
|
+
`]}),n.lines.filter(r=>!t||!r.startsWith("-")).map(r=>t?r.slice(1):r).join(`
|
|
49
|
+
`),s+1<e.length?`
|
|
50
|
+
`:""]},`${n.oldStart}:${n.newStart}:${s}`))})})})}function ep(e,t){const n=[];let s=0;for(const r of e){t||n.push({type:"header",text:`@@ -${r.oldStart},${r.oldLines} +${r.newStart},${r.newLines} @@`});for(const o of r.lines)(!t||!o.startsWith("-"))&&n.push({type:"line",flatIndex:s,text:o}),s+=1}return n}function ns({rows:e,fragments:t,omitDiffPrefixes:n}){const s=e.map(r=>r.type==="header"?`<span class="line line-hunk">${ss(r.text)}</span>`:t.get(r.flatIndex)??`<span class="${tp(r.text)}" data-diff-line="${r.flatIndex}">${n?"":`<span class="diff-prefix">${ss(r.text[0]??" ")}</span>`}${ss(r.text.slice(1))}</span>`).join("");return a.jsx("div",{className:"highlighted-diff",dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code>${s}</code></pre>`}})}function tp(e){return e[0]==="-"?"line line-deleted":e[0]==="+"?"line line-inserted":"line line-context"}function ss(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const np="_plainNotice_ymdjf_1",sp={plainNotice:np},rp=1e6*20;function op(e){return e.flatMap(t=>t.lines).join(`
|
|
51
|
+
`)}function yo(e){return e.length===0?null:e.map(t=>t.lines.filter(n=>n.startsWith(" ")||n.startsWith("+")).map(n=>n.slice(1)).join(`
|
|
52
|
+
`)).join(`
|
|
53
|
+
`)}function mn(e){return e.closest(".git-diff-preview-body, .modal-content")??e}const Qt={kind:"worktree"},ip={kind:"working-tree-history"};function kn(e){if(e.kind==="commit")return e.sha;if(e.kind==="comparison"||e.kind==="inclusive-comparison")return e.headSha}function zs(e){const t=Math.max(0,e.scrollHeight-e.clientHeight);return t===0?0:Math.min(1,Math.max(0,e.scrollTop/t))}function ap(e,t){const n=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=n*Math.min(1,Math.max(0,t))}function Cs(e,t,n,s){return e==="commit"?{kind:"commit",sha:t}:e==="comparison"||e==="inclusive-comparison"?{kind:e,baseSha:t,headSha:n}:e==="file-projection"?{kind:"file-projection",mode:s}:e==="working-tree-history"?ip:Qt}function Hi(e,t,n,s,r){return n.kind==="commit"?oe.getGitCommitDiff(e,{sha:n.sha,path:t.path,status:t.status,...t.origPath?{origPath:t.origPath}:{},fullContext:s,...r?{ignoreWhitespace:!0}:{}}):n.kind==="comparison"||n.kind==="inclusive-comparison"?(n.kind==="inclusive-comparison"?oe.getGitInclusiveComparisonDiff:oe.getGitComparisonDiff)(e,{baseSha:n.baseSha,headSha:n.headSha,path:t.path,status:t.status,...t.origPath?{origPath:t.origPath}:{},fullContext:s,...r?{ignoreWhitespace:!0}:{}}):n.kind==="file-projection"?oe.getGitFileProjectionDiff(e,{path:t.path,mode:n.mode,...t.origPath?{origPath:t.origPath}:{},fullContext:s}):oe.getGitDiff(e,{path:t.path,staged:t.staged,status:t.status,...n.kind==="working-tree-history"?{againstHead:!0,...t.origPath?{origPath:t.origPath}:{}}:{},fullContext:s,...r?{ignoreWhitespace:!0}:{}})}function cp(e){if(e.kind==="commit"){const t={kind:"sha",sha:e.sha};return{old:t,new:t}}if(e.kind==="comparison"||e.kind==="inclusive-comparison")return{old:{kind:"sha",sha:e.baseSha},new:{kind:"sha",sha:e.headSha}}}const My=c.forwardRef(function({file:t,fileKey:n,projectId:s,source:r=Qt,headerActions:o,retainedScrollRatio:i,retainedDiffView:l,onRetainScrollRatio:u,onRetainDiffView:d,onCommentEditorOpenChange:f,captureReviewProjections:h=!1,ignoreWhitespace:w=!1,onToggleIgnoreWhitespace:g,onProjectionRequestFailure:p,t:y},b){const x=t?t.path.split("/").pop()||t.path:null,L=c.useRef(null),A=c.useRef(null),E=c.useCallback(S=>{A.current=S},[]);return c.useImperativeHandle(b,()=>({jumpToNextHunk:()=>{var S;return((S=A.current)==null?void 0:S.next())??!1},jumpToPreviousHunk:()=>{var S;return((S=A.current)==null?void 0:S.previous())??!1},scrollByPage:S=>{const v=L.current;if(!v)return;const _=Math.max(0,v.scrollHeight-v.clientHeight);v.scrollTop=Math.min(_,Math.max(0,v.scrollTop+S*v.clientHeight))}}),[]),c.useLayoutEffect(()=>{const S=L.current;return()=>{!n||!S||u==null||u(n,zs(S))}},[n,u]),a.jsx("section",{className:"git-diff-preview-pane",children:a.jsx("div",{className:"git-diff-preview-body",ref:L,children:t&&n?a.jsx(Xs,{file:t,fileKey:n,projectId:s,source:r,retainedScrollRatio:i,scrollContainerRef:L,retainedDiffView:l,onRetainDiffView:d,paneHeader:{title:x??t.path,path:t.path,actions:o,revision:a.jsx(Ks,{projectId:s,path:t.path,origPath:kn(r)?void 0:t.origPath,rev:kn(r),dirtyLabel:y("fileRevisionDirty"),uncommittedLabel:y("fileRevisionUncommitted")})},onHunkNavigationChange:E,onCommentEditorOpenChange:f,captureReviewProjections:h,ignoreWhitespace:w,onToggleIgnoreWhitespace:g,onProjectionRequestFailure:p,t:y}):a.jsxs(a.Fragment,{children:[a.jsx(Ys,{title:y("gitStatusDiffPreview"),path:"",actions:o}),a.jsx("div",{className:"git-diff-placeholder",children:y("gitStatusSelectFileForDiff")})]})})})});function Ay({file:e,fileKey:t,projectId:n,source:s=Qt,headerActions:r,retainedScrollRatio:o,retainedDiffView:i,onRetainScrollRatio:l,onRetainDiffView:u,onCommentEditorOpenChange:d,captureReviewProjections:f=!1,ignoreWhitespace:h=!1,onToggleIgnoreWhitespace:w,onProjectionRequestFailure:g,t:p,onClose:y}){const b=c.useRef(null);return c.useLayoutEffect(()=>{const x=b.current;return()=>{x&&(l==null||l(t,zs(x)))}},[t,l]),a.jsxs(Oo,{title:e.path,onClose:y,closeOnBackGesture:!0,contentRef:b,children:[a.jsxs("div",{className:"git-diff-preview-header-actions",children:[a.jsx(Ks,{projectId:n,path:e.path,origPath:kn(s)?void 0:e.origPath,rev:kn(s),dirtyLabel:p("fileRevisionDirty"),uncommittedLabel:p("fileRevisionUncommitted")}),r]}),a.jsx(Xs,{file:e,fileKey:t,projectId:n,source:s,retainedScrollRatio:o,scrollContainerRef:b,retainedDiffView:i,onRetainDiffView:u,onCommentEditorOpenChange:d,captureReviewProjections:f,ignoreWhitespace:h,onToggleIgnoreWhitespace:w,onProjectionRequestFailure:g,t:p})]})}function Xs({file:e,fileKey:t,projectId:n,source:s=Qt,retainedDiffView:r,onRetainDiffView:o,paneHeader:i,onHunkNavigationChange:l,onCommentEditorOpenChange:u,captureReviewProjections:d=!1,ignoreWhitespace:f=!1,onToggleIgnoreWhitespace:h,onProjectionRequestFailure:w,retainedScrollRatio:g,scrollContainerRef:p,t:y}){const b=s.kind,x=s.kind==="commit"?s.sha:s.kind==="comparison"||s.kind==="inclusive-comparison"?s.baseSha:"",L=s.kind==="comparison"||s.kind==="inclusive-comparison"?s.headSha:"",A=s.kind==="file-projection"?s.mode:"worktree",E=JSON.stringify([t,b,x,L,A,f]),[S,v]=c.useState(()=>({requestKey:E,result:null,loading:!0,error:null})),_=S.requestKey===E?S:{result:null,loading:!0,error:null},{result:m,loading:C,error:T}=_,N=c.useRef({fileKey:t,view:r});N.current.fileKey!==t&&(N.current={fileKey:t,view:r});const R=c.useCallback((P,F)=>{N.current.fileKey===P&&(N.current.view={...N.current.view,...F}),o==null||o(P,F)},[o]),k=c.useRef(m),M=c.useRef(g===void 0?null:{fileKey:t,ratio:g});k.current=m,c.useLayoutEffect(()=>{M.current=g===void 0?null:{fileKey:t,ratio:g}},[t,g]),c.useLayoutEffect(()=>{const P=M.current;if(!m||(P==null?void 0:P.fileKey)!==t)return;const F=p==null?void 0:p.current;F&&(ap(F,P.ratio),M.current=null)},[m,t,p]),c.useEffect(()=>{let P=!1;return v(F=>F.requestKey===E?{...F,loading:!0,error:null}:{requestKey:E,result:null,loading:!0,error:null}),Hi(n,e,Cs(b,x,L,A),void 0,f).then(F=>{if(!P){const W=p==null?void 0:p.current;k.current&&W&&(M.current={fileKey:t,ratio:zs(W)}),v({requestKey:E,result:F,loading:!1,error:null})}}).catch(F=>{if(!P){(f||b==="comparison"||b==="inclusive-comparison")&&(w==null||w(F));const W=F.message||y("gitStatusLoadDiffFailed");v(D=>D.requestKey===E?{...D,loading:!1,error:W}:{requestKey:E,result:null,loading:!1,error:W})}}),()=>{P=!0}},[n,e,t,E,b,x,L,A,f,w,p,y]);const $=C&&!m;return a.jsxs(a.Fragment,{children:[i&&($||!m&&T)&&a.jsx(Ys,{title:i.title,path:i.path,actions:i.actions,revision:i.revision}),$&&a.jsx("div",{className:"git-diff-loading",children:y("gitStatusLoadingDiff")}),!m&&T&&a.jsx("div",{className:"git-diff-error",children:T}),m&&a.jsxs(a.Fragment,{children:[T&&a.jsx("div",{className:"git-diff-error",children:T}),a.jsx(lp,{file:e,fileKey:t,projectId:n,source:s,diffResult:m,retainedDiffView:N.current.view,onRetainDiffView:R,paneHeader:i,onHunkNavigationChange:l,onCommentEditorOpenChange:u,captureReviewProjections:d,ignoreWhitespace:f,onToggleIgnoreWhitespace:h,onProjectionRequestFailure:w,t:y},E)]})]})}function lp({file:e,fileKey:t,projectId:n,source:s=Qt,diffResult:r,retainedDiffView:o,onRetainDiffView:i,paneHeader:l,onHunkNavigationChange:u,onCommentEditorOpenChange:d,captureReviewProjections:f=!1,ignoreWhitespace:h=!1,onToggleIgnoreWhitespace:w,onProjectionRequestFailure:g,t:p}){const[y,b]=c.useState(()=>((o==null?void 0:o.showFullContext)??!1)||((o==null?void 0:o.hideRemovedLines)??!1)),[x,L]=c.useState(()=>(o==null?void 0:o.hideRemovedLines)??!1),A=c.useMemo(()=>JSON.stringify([r.structuredPatch,r.previewSkipped??null]),[r.previewSkipped,r.structuredPatch]),[E,S]=c.useState({revisionKey:null,result:null,loading:!1,error:null}),v=E.revisionKey===A?E:{result:null,loading:!1,error:null},{result:_,loading:m,error:C}=v,[T,N]=c.useState(()=>(o==null?void 0:o.showMarkdownPreview)??!1),R=c.useRef(null),k=c.useRef(null),[M,$]=c.useState(null),P=c.useCallback(U=>{R.current=U,$(U)},[]),[F,W]=fh(),[D,V]=c.useState(0),G=s.kind,J=s.kind==="commit"?s.sha:s.kind==="comparison"||s.kind==="inclusive-comparison"?s.baseSha:"",K=s.kind==="comparison"||s.kind==="inclusive-comparison"?s.headSha:"",O=s.kind==="file-projection"?s.mode:"worktree",Q=c.useMemo(()=>cp(Cs(G,J,K,O)),[J,O,K,G]);c.useEffect(()=>{const U=R.current;if(!U||typeof ResizeObserver>"u")return;const H=new ResizeObserver(ue=>{var be;const ae=(be=ue[0])==null?void 0:be.contentRect.width;typeof ae=="number"&&V(ae)});return H.observe(U),()=>H.disconnect()},[]);const X=c.useCallback(()=>{W(F==="auto"?"unified":F==="unified"?"side-by-side":"auto")},[F,W]),z=cs(e.path),j=c.useMemo(()=>z?Rn(op(r.structuredPatch),{diffAware:!0,baseFilePath:e.path,projectId:n}):null,[r.structuredPatch,e.path,z,n]),he=c.useMemo(()=>_?yo(_.structuredPatch):null,[_]),se=c.useMemo(()=>!z||he===null||_!=null&&_.markdownHtml?null:Rn(he,{baseFilePath:e.path,projectId:n}),[e.path,_==null?void 0:_.markdownHtml,he,z,n]),ce=(_==null?void 0:_.markdownHtml)||(se==null?void 0:se.html),Re=z&&(!!r.markdownHtml||(j==null?void 0:j.changed)===!0||(se==null?void 0:se.changed)===!0),de=T&&Re,Z=y?ce:j==null?void 0:j.html,ve=c.useCallback(U=>{i==null||i(t,U)},[t,i]),ie=c.useCallback(async()=>{if(_)return _;if(m)return null;const U=A;S(H=>H.revisionKey===U?{...H,loading:!0,error:null}:{revisionKey:U,result:null,loading:!0,error:null});try{const H=await Hi(n,e,Cs(G,J,K,O),!0,h);return S(ue=>ue.revisionKey===U?{revisionKey:U,result:H,loading:!1,error:null}:ue),H}catch(H){(h||G==="comparison"||G==="inclusive-comparison")&&(g==null||g(H));const ue=H instanceof Error?H.message:p("gitStatusLoadContextFailed");return S(ae=>ae.revisionKey===U?{revisionKey:U,result:null,loading:!1,error:ue}:ae),null}},[_,m,A,n,e,G,J,K,O,h,g,p]),Ve=c.useCallback(async()=>{const U=!y;if(U&&!await ie())return;const H=R.current,ue=H?mn(H):null;k.current=ws(ue,(H==null?void 0:H.querySelector(ts))??null),b(U),U||L(!1),ve({showFullContext:U,...U?{}:{hideRemovedLines:!1}})},[ie,ve,y]),Gt=c.useCallback(async()=>{const U=!x;if(U&&!await ie())return;const H=R.current,ue=H?mn(H):null;k.current=ws(ue,(H==null?void 0:H.querySelector(ts))??null),U&&b(!0),L(U),ve({hideRemovedLines:U,...U?{showFullContext:!0}:{}})},[x,ie,ve]),In=c.useCallback(()=>{const U=!T;N(U),ve({showMarkdownPreview:U})},[ve,T]),zt=c.useCallback(async()=>{const U=y?_??await ie():r,H=U?yo(U.structuredPatch):null;if(H===null)throw new Error("Diff content is unavailable");return H},[r,_,ie,y]);c.useEffect(()=>{y&&!_&&!m&&ie()},[m,_,ie,y]),c.useLayoutEffect(()=>{var H;const U=k.current;U&&(k.current=null,hi(U,((H=R.current)==null?void 0:H.querySelector(ts))??null))},[y,x,_]);const xe=y&&_?_:r,Ye=xe.renderMode==="plain"||xe.diffHtml.length>rp,ft=Ye?"":xe.diffHtml,Nn=c.useMemo(()=>xe.previewSkipped?null:pp(xe.structuredPatch),[xe.previewSkipped,xe.structuredPatch]),qe=xe.previewSkipped??Nn,[We,nt]=c.useState({index:0,count:0}),me=c.useRef(We);c.useEffect(()=>{me.current=We},[We]);const st=c.useCallback(()=>de||qe||!R.current?[]:Array.from(R.current.querySelectorAll(".line-hunk")),[qe,de]),rt=c.useCallback(()=>{const U=R.current,H=st();if(!U||H.length===0){nt(pe=>pe.count===0?pe:{index:0,count:0});return}const ae=mn(U).getBoundingClientRect().top+52;let be=0;for(let pe=0;pe<H.length;pe++){const Yt=H[pe];if(Yt&&Yt.getBoundingClientRect().top<=ae)be=pe;else break}nt(pe=>pe.index===be&&pe.count===H.length?pe:{index:be,count:H.length})},[st]),ot=c.useCallback(U=>{const H=st();if(H.length===0)return!1;const ae=((me.current.count===H.length?me.current.index:0)+U+H.length)%H.length,be=H[ae];return!be||typeof be.scrollIntoView!="function"?!1:(be.scrollIntoView({block:"start",behavior:"smooth"}),nt({index:ae,count:H.length}),!0)},[st]),Je=c.useCallback(()=>ot(1),[ot]),Ie=c.useCallback(()=>ot(-1),[ot]);c.useEffect(()=>{const U=R.current;if(!U)return;const H=mn(U);let ue=requestAnimationFrame(rt),ae=!1;const be=()=>{ae||(ae=!0,ue=requestAnimationFrame(()=>{ae=!1,rt()}))};return H.addEventListener("scroll",be,{passive:!0}),()=>{cancelAnimationFrame(ue),H.removeEventListener("scroll",be)}},[rt]),c.useEffect(()=>(u==null||u({next:Je,previous:Ie}),()=>u==null?void 0:u(null)),[Je,Ie,u]),c.useLayoutEffect(()=>{const U=H=>{const ue=H.key.toLowerCase();if(ue!=="n"&&ue!=="p"||H.altKey||H.ctrlKey||H.metaKey||Ti(H.target))return;(ue==="n"?Je():Ie())&&H.preventDefault()};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[Je,Ie]);const Xt=We.count>0?a.jsxs("span",{className:"diff-hunk-navigation",children:[a.jsx("button",{type:"button",className:"diff-hunk-step",onClick:Ie,title:p("sourcePreviousHunkShortcut"),"aria-label":p("sourcePreviousHunkShortcut"),children:"‹"}),a.jsxs("span",{className:"diff-hunk-indicator",children:[We.index+1,"/",We.count]}),a.jsx("button",{type:"button",className:"diff-hunk-step",onClick:Je,title:p("sourceNextHunkShortcut"),"aria-label":p("sourceNextHunkShortcut"),children:"›"})]}):null,ht=a.jsxs(a.Fragment,{children:[Xt,w&&a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${h?"active":""}`,onClick:w,title:p(h?"gitStatusIgnoreWhitespaceActive":"gitStatusIgnoreWhitespace"),"aria-label":p(h?"gitStatusIgnoreWhitespaceActive":"gitStatusIgnoreWhitespace"),"aria-pressed":h,children:a.jsx("span",{className:"diff-whitespace-glyph","aria-hidden":"true",children:"_+"})}),Re&&a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${de?"active":""}`,onClick:In,title:p(de?"gitStatusDiff":"gitStatusPreview"),"aria-label":p(de?"gitStatusDiff":"gitStatusPreview"),"aria-pressed":de,children:a.jsx(fp,{showDiff:de})}),a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${y?"active":""}`,onClick:Ve,disabled:m,title:p(m?"gitStatusLoading":y?"gitStatusDiffOnly":"gitStatusFullContext"),"aria-label":p(m?"gitStatusLoading":y?"gitStatusDiffOnly":"gitStatusFullContext"),"aria-pressed":y,children:a.jsx(up,{expanded:y})}),a.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${x?"active":""}`,onClick:Gt,disabled:m,title:p(x?"gitStatusShowRemovedLines":"gitStatusHideRemovedLines"),"aria-label":p(x?"gitStatusShowRemovedLines":"gitStatusHideRemovedLines"),"aria-pressed":x,children:a.jsx(dp,{hidden:x})}),a.jsx(th,{value:zt,title:p("fileViewerCopyContent"),className:"diff-context-toggle diff-toolbar-icon-button",disabled:m||!!qe||xe.structuredPatch.length===0,icon:"content"}),!de&&!Ye&&!x&&a.jsx("button",{type:"button",className:"diff-context-toggle diff-toolbar-icon-button",onClick:X,title:`${p("diffViewModeTitle")}: ${p(vo(F))}`,"aria-label":`${p("diffViewModeTitle")}: ${p(vo(F))}`,children:a.jsx(hp,{mode:F})})]}),Ne=(U,H)=>xe.structuredPatch.length===0?a.jsx("div",{className:"git-diff-empty-projection",children:p(h?"gitStatusWhitespaceChangesHidden":"gitStatusNoContentChanges")}):ft&&!x&&wh(F,D)==="side-by-side"?a.jsx(zm,{diffHtml:ft,structuredPatch:xe.structuredPatch,splitAfterLine:U,editor:H}):ft?a.jsx(wo,{diffHtml:ft,structuredPatch:xe.structuredPatch,hideRemovedLines:x,plain:Ye,splitAfterLine:U,editor:H}):a.jsx(wo,{diffHtml:"",structuredPatch:xe.structuredPatch,hideRemovedLines:x,plain:Ye,splitAfterLine:U,editor:H});return a.jsxs(a.Fragment,{children:[l?a.jsx(Ys,{title:l.title,path:l.path,actions:l.actions,revision:l.revision,children:ht}):a.jsxs("div",{className:"diff-context-controls source-diff-context-controls",children:[a.jsx("span",{className:"diff-context-path",children:e.path}),a.jsx("div",{className:"diff-context-buttons",children:ht})]}),C&&a.jsx("div",{className:"diff-context-error",children:C}),a.jsxs("div",{className:"diff-modal-content source-diff-pane diff-gutter-aligned",ref:P,children:[Ye&&!qe&&!de&&a.jsx("div",{className:sp.plainNotice,children:p("gitStatusDiffPlainMode")}),de&&Z?a.jsx(Ds,{html:Z,sourcePath:e.path}):qe?a.jsx(mp,{file:e,previewSkipped:qe,t:p}):M?a.jsx(Vm,{projectId:n,filePath:e.path,structuredPatch:xe.structuredPatch,revisions:Q,projections:f?xe.reviewProjections:void 0,container:M,onOpenChange:d,renderSource:({openComment:U,editor:H})=>Ne(U==null?void 0:U.flatIndex,H),t:p}):Ne(void 0,null)]})]})}function Ys({title:e,path:t,actions:n,revision:s,children:r}){const o=t&&t!==e?t.endsWith(e)?t.slice(0,-e.length).replace(/\/$/,""):t:"";return a.jsxs("div",{className:`git-diff-pane-toolbar ${St.header}`,children:[a.jsxs("div",{className:St.identity,children:[a.jsxs("span",{className:"git-diff-file-identity",title:t||e,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"git-diff-toolbar-path",children:o}),a.jsx("span",{className:"git-diff-toolbar-separator","aria-hidden":"true",children:"/"})]}),a.jsx("h3",{className:"git-diff-preview-title",children:e})]}),s]}),a.jsxs("div",{className:St.actions,children:[r&&a.jsx("div",{className:"diff-context-buttons",children:r}),n&&a.jsx("div",{className:"git-diff-preview-header-actions",children:n})]})]})}function up({expanded:e}){return a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 12h14"}),e?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m8 7 4-4 4 4"}),a.jsx("path",{d:"m8 17 4 4 4-4"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m8 3 4 4 4-4"}),a.jsx("path",{d:"m8 21 4-4 4 4"})]})]})}function dp({hidden:e}){return a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 7h14M5 12h14M5 17h14"}),e&&a.jsx("path",{d:"M4 4l16 16"})]})}function fp({showDiff:e}){return e?a.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m8 9-4 3 4 3M16 9l4 3-4 3M14 5l-4 14"})}):a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12Z"}),a.jsx("circle",{cx:"12",cy:"12",r:"2.5"})]})}function hp({mode:e}){return a.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:e==="side-by-side"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M3 7h7M14 7h7"}),a.jsx("path",{d:"M3 12h7M14 12h7"}),a.jsx("path",{d:"M3 17h7M14 17h7"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"}),e==="auto"&&a.jsx("path",{d:"M5 4h4M5 4v3M19 20h-4M19 20v-3"})]})})}function vo(e){switch(e){case"unified":return"diffViewModeUnified";case"side-by-side":return"diffViewModeSideBySide";default:return"diffViewModeAuto"}}function mp({file:e,previewSkipped:t,t:n}){return a.jsxs("div",{className:"git-diff-preview-skipped",children:[a.jsx("div",{className:"git-diff-preview-skipped-title",children:n("gitStatusDiffPreviewSkipped")}),a.jsx("div",{className:"git-diff-preview-skipped-message",children:gp(t,n)}),a.jsxs("dl",{className:"git-diff-preview-skipped-details",children:[a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedPath")}),a.jsx("dd",{children:e.path})]}),t.totalBytes!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedSize")}),a.jsx("dd",{children:wp(t.totalBytes)})]}),t.totalChars!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedCharacters")}),a.jsx("dd",{children:t.totalChars.toLocaleString()})]}),t.totalLines!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedLines")}),a.jsx("dd",{children:t.totalLines.toLocaleString()})]}),t.maxLineChars!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedLineLength")}),a.jsx("dd",{children:t.maxLineChars.toLocaleString()})]}),t.htmlChars!==void 0&&a.jsxs("div",{children:[a.jsx("dt",{children:n("gitStatusDiffPreviewSkippedHtmlSize")}),a.jsx("dd",{children:t.htmlChars.toLocaleString()})]})]})]})}function pp(e){let t=0,n=0;for(const s of e)for(const r of s.lines)for(const o of r){const i=o.codePointAt(0);if(i!==void 0){if(i===0||i===65533)return{reason:"binary"};t+=1,(i<32&&i!==8&&i!==9&&i!==10&&i!==12&&i!==13&&i!==27||i===127)&&(n+=1)}}return n/Math.max(t,1)>.01?{reason:"binary"}:null}function gp(e,t){switch(e.reason){case"binary":return t("gitStatusDiffPreviewSkippedBinary");case"content-too-large":return t("gitStatusDiffPreviewSkippedContentTooLarge");case"line-too-long":return t("gitStatusDiffPreviewSkippedLineTooLong");case"html-too-large":return t("gitStatusDiffPreviewSkippedHtmlTooLarge")}}function wp(e){return e<1024?`${e} B`:e<1024*1024?`${xo(e/1024)} KB`:`${xo(e/(1024*1024))} MB`}function xo(e){return e>=10?e.toFixed(0):e.toFixed(1)}const yp="_root_13ii2_1",vp="_link_13ii2_7",xp="_inline_13ii2_17",bp="_inlineLink_13ii2_21",Sp="_header_13ii2_31",Cp="_headerLink_13ii2_38",Ep="_active_13ii2_45",ct={root:yp,link:vp,inline:xp,inlineLink:bp,header:Sp,headerLink:Cp,active:Ep};function _n({basePath:e="",diffMode:t,filePath:n,lineEnd:s,lineNumber:r,projectId:o,viewMode:i}){const l=new URLSearchParams({path:n});return t?l.set("diff",t):(r!==void 0&&l.set("line",String(r)),s!==void 0&&l.set("lineEnd",String(s)),i==="range"&&l.set("view","range")),`${e}/projects/${o}/file?${l.toString()}`}function kp({className:e,filePath:t,projectId:n}){const s=xi(n,t);return!s.supported||!s.relativePath||!s.worktreeFile&&!s.cumulativeFile?null:a.jsx(Ui,{availability:s,className:e,projectId:n,variant:"inline"})}function Ui({activeView:e="source",availability:t,className:n,onSelect:s,projectId:r,sourceHref:o,variant:i}){const{t:l}=Ue(),u=Lt(),d=t.relativePath;if(!t.supported||!d||!t.worktreeFile&&!t.cumulativeFile)return null;const f=g=>dt(_n({basePath:u,diffMode:g,filePath:d,projectId:r})),h=g=>p=>{p.stopPropagation(),!(!s||p.button!==0||p.metaKey||p.ctrlKey||p.shiftKey||p.altKey)&&(p.preventDefault(),s(g))},w=g=>[ct.link,i==="header"?ct.headerLink:ct.inlineLink,e===g?ct.active:null].filter(Boolean).join(" ");return a.jsxs("span",{className:[ct.root,i==="header"?ct.header:ct.inline,n].filter(Boolean).join(" "),"data-file-diff-links":i,role:"group","aria-label":l("fileDiffViews"),children:[i==="header"&&o&&a.jsx("a",{className:w("source"),href:o,"aria-current":e==="source"?"page":void 0,onClick:h("source"),children:l("fileViewerSource")}),t.worktreeFile&&a.jsx("a",{className:w("worktree"),href:f("worktree"),"aria-current":e==="worktree"?"page":void 0,"aria-label":l("fileDiffVsHeadTitle",{path:d}),title:l("fileDiffVsHeadTitle",{path:d}),onClick:h("worktree"),children:l("fileDiffVsHead")}),t.cumulativeFile&&a.jsx("a",{className:w("cumulative"),href:f("cumulative"),"aria-current":e==="cumulative"?"page":void 0,"aria-label":l("fileDiffVsParentTitle",{path:d}),title:l("fileDiffVsParentTitle",{path:d}),onClick:h("cumulative"),children:l("fileDiffVsParent")})]})}const _p="_list_1omn2_1",Lp="_listCompact_1omn2_11",Rp="_row_1omn2_15",Mp="_rowHighlighted_1omn2_27",Ap="_rowMain_1omn2_32",jp="_rowMeta_1omn2_39",Tp="_count_1omn2_46",Ip="_warning_1omn2_51",Np="_notice_1omn2_56",Pp="_rowActions_1omn2_61",$p="_rowTypeIcon_1omn2_68",Fp="_rowTypeIconLive_1omn2_85",Bp="_iconButton_1omn2_89",Dp="_iconButtonDanger_1omn2_107",Op="_iconButtonFreeze_1omn2_114",Hp="_error_1omn2_144",Up="_empty_1omn2_148",ye={list:_p,listCompact:Lp,row:Rp,rowHighlighted:Mp,rowMain:Ap,rowMeta:jp,count:Tp,warning:Ip,notice:Np,rowActions:Pp,rowTypeIcon:$p,rowTypeIconLive:Fp,iconButton:Bp,iconButtonDanger:Dp,iconButtonFreeze:Op,error:Hp,empty:Up};function Vp({children:e,compact:t=!1}){return a.jsx("div",{className:`${ye.list} ${t?ye.listCompact:""}`,role:"list",children:e})}function qp({children:e,copyAction:t,freezeAction:n,highlighted:s=!1,mode:r,modeLabel:o,revokeAction:i,title:l,warning:u}){return a.jsxs("div",{className:`${ye.row} ${s?ye.rowHighlighted:""}`,role:"listitem",children:[a.jsxs("div",{className:ye.rowMain,children:[a.jsx("strong",{children:l}),e,u&&a.jsx("span",{className:ye.warning,children:u})]}),a.jsxs("div",{className:ye.rowActions,children:[a.jsx("span",{className:`${ye.rowTypeIcon} ${r==="live"?ye.rowTypeIconLive:""}`,title:o,"aria-label":o,role:"img",children:a.jsx(zp,{kind:r})}),a.jsx("button",{type:"button",className:ye.iconButton,disabled:t.disabled,onClick:t.onClick,title:t.label,"aria-label":t.label,children:t.working?"…":a.jsx(Xp,{})}),n&&a.jsx("button",{type:"button",className:`${ye.iconButton} ${ye.iconButtonFreeze}`,disabled:n.disabled,onClick:n.onClick,title:n.label,"aria-label":n.label,children:n.working?"…":a.jsx(Gp,{})}),a.jsx("button",{type:"button",className:`${ye.iconButton} ${ye.iconButtonDanger}`,disabled:i.disabled,onClick:i.onClick,title:i.label,"aria-label":i.label,children:i.working?"…":a.jsx(Qp,{})})]})]})}function Wp({children:e}){return a.jsx("span",{className:ye.rowMeta,children:e})}function bo({children:e,loading:t=!1}){return a.jsx("div",{className:ye.empty,role:t?"status":void 0,children:e})}function Kp({children:e}){return a.jsx("div",{className:ye.count,children:e})}function So({children:e,tone:t}){return a.jsx("div",{className:t==="error"?ye.error:ye.notice,role:t==="error"?"alert":"status",children:e})}function jy(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})}function Qp(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round","aria-hidden":"true",children:a.jsx("path",{d:"m4 4 8 8M12 4l-8 8"})})}function Gp(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1.5"}),a.jsx("path",{d:"M5.5 7V4.75a2.5 2.5 0 0 1 5 0V7M8 10v1.5"})]})}function Ty(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m3 8.5 3.2 3.2L13 4.8"})})}function zp({kind:e}){const t={all:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18"})]}),project:a.jsx("path",{d:"M3 6.5h7l2 2h9v10.5H3zM3 6.5V5h7l2 2"}),session:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"14",rx:"3"}),a.jsx("path",{d:"m8 21 4-3h5M7 9h10M7 13h7"})]}),frozen:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"5",y:"10",width:"14",height:"11",rx:"2"}),a.jsx("path",{d:"M8 10V7a4 4 0 0 1 8 0v3M12 14v3"})]}),live:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),a.jsx("path",{d:"M8.5 8.5a5 5 0 0 0 0 7M15.5 8.5a5 5 0 0 1 0 7M5.5 5.5a9 9 0 0 0 0 13M18.5 5.5a9 9 0 0 1 0 13"})]})};return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t[e]})}function Xp(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),a.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}const Yp="_modal_1132s_1",Jp="_fileIdentity_1132s_10",Zp="_liveBadge_1132s_39",eg="_description_1132s_52",tg="_warning_1132s_59",ng="_createButton_1132s_82",sg="_manualCopy_1132s_97",rg="_inventory_1132s_118",og="_inventoryHeading_1132s_123",Oe={modal:Yp,fileIdentity:Jp,liveBadge:Zp,description:eg,warning:tg,createButton:ng,manualCopy:sg,inventory:rg,inventoryHeading:og};function ig({anchorRect:e,filePath:t,projectId:n,title:s,transformUrl:r=i=>i,onClose:o}){const{t:i}=Ue(),[l,u]=c.useState([]),[d,f]=c.useState(!0),[h,w]=c.useState(null),[g,p]=c.useState(null),[y,b]=c.useState(null),[x,L]=c.useState(null),A=c.useRef(null),E=c.useCallback(async()=>{f(!0),p(null);try{const m=await oe.getPublicFileShares(n,t);u(m.items)}catch(m){p(m instanceof Error?m.message:i("publicFileShareLoadFailed"))}finally{f(!1)}},[t,n,i]);c.useEffect(()=>{E()},[E]),c.useEffect(()=>{var m,C;x&&((m=A.current)==null||m.focus(),(C=A.current)==null||C.select())},[x]);const S=async()=>{w("create"),p(null),b(null),L(null);const m=oe.createPublicFileShare({projectId:n,path:t,...s?{title:s}:{}}),C=Ht(m.then(T=>r(T.url)));try{const T=await m;await C?b(i("publicFileShareCopied")):(L(r(T.url)),b(i("publicFileShareManualCopy"))),await E()}catch(T){p(T instanceof Error?T.message:i("publicFileShareCreateFailed"))}finally{w(null)}},v=async m=>{p(null),b(null),L(null);const C=r(m.url);if(await Ht(Promise.resolve(C))){b(i("publicFileShareCopied"));return}L(C),b(i("publicFileShareManualCopy"))},_=async m=>{if(window.confirm(i("publicShareManagementRevokeOneConfirm"))){w(`revoke:${m.shareId}`),p(null),b(null);try{await oe.revokePublicFileShare(m.shareId),u(C=>C.filter(T=>T.shareId!==m.shareId)),b(i("publicFileShareRevoked"))}catch(C){p(C instanceof Error?C.message:i("publicFileShareRevokeFailed"))}finally{w(null)}}};return a.jsx(Oo,{anchorRect:e,title:i("publicFileShareTitle"),onClose:o,children:a.jsxs("div",{className:Oe.modal,children:[a.jsxs("div",{className:Oe.fileIdentity,title:t,children:[a.jsx(ag,{}),a.jsx("span",{children:t}),a.jsx("span",{className:Oe.liveBadge,children:i("publicShareLiveBadge")})]}),a.jsx("p",{className:Oe.description,children:i("publicFileShareDescription")}),r("x")!=="x"&&a.jsx("p",{className:Oe.description,children:i("publicFileSharePlayLinks")}),a.jsxs("div",{className:Oe.warning,role:"note",children:[a.jsx(cg,{}),a.jsx("span",{children:i("publicFileShareWarning")})]}),a.jsxs("button",{type:"button",className:`settings-button settings-button-primary ${Oe.createButton}`,disabled:h!==null,onClick:()=>void S(),children:[a.jsx(lg,{}),i(h==="create"?"publicFileShareCreating":"publicFileShareCreate")]}),x&&a.jsxs("label",{className:Oe.manualCopy,children:[a.jsx("span",{children:i("publicFileShareUrlLabel")}),a.jsx("input",{ref:A,readOnly:!0,value:x})]}),g&&a.jsx(So,{tone:"error",children:g}),y&&a.jsx(So,{tone:"notice",children:y}),a.jsxs("div",{className:Oe.inventory,children:[a.jsx("div",{className:Oe.inventoryHeading,children:a.jsx("strong",{children:i("publicFileShareExisting")})}),d?a.jsx(bo,{loading:!0,children:i("publicFileShareLoading")}):l.length===0?a.jsx(bo,{children:i("publicFileShareEmpty")}):a.jsx(Vp,{compact:!0,children:l.map(m=>{const C=h===`revoke:${m.shareId}`;return a.jsx(qp,{title:m.title||t.split("/").at(-1)||t,mode:"live",modeLabel:i("publicShareLiveBadge"),copyAction:{label:i("publicFileShareCopy"),disabled:h!==null,onClick:()=>void v(m)},revokeAction:{label:i("publicFileShareRevoke"),disabled:h!==null,working:C,onClick:()=>void _(m)},children:a.jsx(Wp,{children:new Date(m.createdAt).toLocaleString()})},m.shareId)})}),!d&&a.jsx(Kp,{children:i("publicFileShareCount",{count:l.length})})]})]})})}function ag(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M5 2.5h6l4 4v11H5zM11 2.5v4h4"})})}function cg(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M10 2.5 18 17H2zM10 7v4.5M10 14.5v.1"})})}function lg(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"m8 12 4-4M6.5 14.5l-1 1a2.8 2.8 0 0 1-4-4l3-3a2.8 2.8 0 0 1 4 0M13.5 5.5l1-1a2.8 2.8 0 1 1 4 4l-3 3a2.8 2.8 0 0 1-4 0"})})}const ug="_viewer_1ffmf_1",dg="_context_1ffmf_6",fg="_body_1ffmf_10",hg="_backButton_1ffmf_14",mg="_htmlPreviewFrame_1ffmf_19",pg="_diffBody_1ffmf_27",gg="_reloadStale_1ffmf_32",wg="_rawToggle_1ffmf_36",yg="_commentToggle_1ffmf_46",vg="_commentSend_1ffmf_56",xg="_provenanceRow_1ffmf_69",bg="_quoteReplySurface_1ffmf_76",Sg="_header_1ffmf_83",Cg="_info_1ffmf_100",Eg="_actions_1ffmf_124",kg="_windowActions_1ffmf_141",_g="_fullscreenButton_1ffmf_142",Ce={viewer:ug,context:dg,body:fg,backButton:hg,htmlPreviewFrame:mg,diffBody:pg,reloadStale:gg,rawToggle:wg,commentToggle:yg,commentSend:vg,provenanceRow:xg,quoteReplySurface:bg,header:Sg,info:Cg,actions:Eg,windowActions:kg,fullscreenButton:_g};function Lg(e){return e instanceof Element&&e.closest("input, textarea, select, [contenteditable]:not([contenteditable='false'])")!==null}function Rg(e){if(!e.isConnected||e.closest('[aria-hidden="true"]'))return!1;const t=e.closest('[role="dialog"]')??e.closest(".file-viewer")??e,n=e.ownerDocument.activeElement;return!n||n===e.ownerDocument.body||t.contains(n)}function Mg(e){var u,d,f;const t=e==null?void 0:e.ownerDocument.getSelection();if(!e||!t)return!1;const n=e.ownerDocument.createRange(),s=((u=e.ownerDocument.defaultView)==null?void 0:u.NodeFilter)??NodeFilter,r=e.ownerDocument.createTreeWalker(e,s.SHOW_TEXT),o=r.nextNode();if(o){let h=o;for(let w=r.nextNode();w;w=r.nextNode())h=w;n.setStart(o,0),n.setEnd(h,((d=h.textContent)==null?void 0:d.length)??0)}else n.selectNodeContents(e);t.removeAllRanges(),t.addRange(n);const i=((f=e.ownerDocument.defaultView)==null?void 0:f.Event)??Event;return e.ownerDocument.dispatchEvent(new i("selectionchange")),!0}function Ag({className:e,contentRef:t}){const{t:n}=Ue(),s=c.useCallback(()=>Mg(t.current),[t]);c.useEffect(()=>{var u;const i=((u=t.current)==null?void 0:u.ownerDocument)??document,l=d=>{const f=t.current;!f||d.defaultPrevented||d.isComposing||d.altKey||d.shiftKey||!(d.ctrlKey||d.metaKey)||d.key.toLowerCase()!=="a"||Lg(d.target)||!Rg(f)||(d.preventDefault(),d.stopPropagation(),s())};return i.addEventListener("keydown",l,!0),()=>i.removeEventListener("keydown",l,!0)},[t,s]);const r=n("viewerSelectAll"),o=n("viewerSelectAllTitle");return a.jsx("button",{type:"button",className:e,onMouseDown:i=>i.preventDefault(),onPointerDown:i=>i.preventDefault(),onClick:s,title:o,"aria-label":r,children:a.jsx(jg,{})})}function jg(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M6 2H2v4M10 2h4v4M14 10v4h-4M6 14H2v-4"}),a.jsx("rect",{x:"5",y:"5",width:"6",height:"6",rx:"1"})]})}const Co="p, ul, ol, blockquote, pre, h1, h2, h3, h4, h5, h6, table",Tg=200,Ig=120;function Ng(e){return Array.from(e.querySelectorAll(Co)).filter(n=>{var r;const s=(r=n.parentElement)==null?void 0:r.closest(Co);return!s||!e.contains(s)})}function Pg(e,t){return e.length===t.length&&e.every((n,s)=>{var r,o,i;return n.blockIndex===((r=t[s])==null?void 0:r.blockIndex)&&n.top===((o=t[s])==null?void 0:o.top)&&n.height===((i=t[s])==null?void 0:i.height)})}function Vi(e,t){const n=e[t];if(!n)throw new Error(`Missing paragraph block ${t}`);return n}function $g(e,t,n){const s=n.getBoundingClientRect();return Array.from(t).sort((r,o)=>r-o).map(r=>{const o=Vi(e,r).getBoundingClientRect();return{blockIndex:r,top:o.top-s.top+n.scrollTop,height:o.height}})}function Fg({alwaysShowQuoteCircle:e,contentRef:t,layoutKey:n,onQuoteBlock:s,paragraphQuoteCirclesEnabled:r,sourceRef:o,surfaceRef:i}){const{t:l}=Ue(),u=c.useRef([]),[d,f]=c.useState([]);c.useEffect(()=>{const g=t.current,p=i.current;if(!r||!g||!p){u.current.length>0&&(u.current=[],f([]));return}let y=[],b=new WeakMap;const x=new Set;let L=0,A=0,E=!1;const S=()=>{L=0;const R=$g(y,x,p);u.current=R.map(k=>Vi(y,k.blockIndex)),f(k=>Pg(k,R)?k:R)},v=()=>{L===0&&(L=requestAnimationFrame(S))},_=()=>{window.clearTimeout(A),A=window.setTimeout(v,Ig)},m=typeof IntersectionObserver>"u"?null:new IntersectionObserver(R=>{const k=R.find(M=>M.target===p);if(k&&!k.isIntersecting){if(!E)return;E=!1,x.clear(),m==null||m.disconnect(),m==null||m.observe(p),v();return}if(k!=null&&k.isIntersecting&&!E){E=!0;for(const M of y)m==null||m.observe(M)}for(const M of R){if(!(M.target instanceof HTMLElement))continue;const $=b.get(M.target);$!==void 0&&(M.isIntersecting?x.add($):x.delete($))}v()},{rootMargin:`${Tg}px 0px`}),C=()=>{if(m)for(const R of y)m.unobserve(R);if(y=Ng(g),b=new WeakMap,y.forEach((R,k)=>{b.set(R,k)}),x.clear(),m&&E)for(const R of y)m.observe(R);else if(!m)for(let R=0;R<y.length;R+=1)x.add(R);v()};C(),m&&m.observe(p);const T=typeof ResizeObserver>"u"?null:new ResizeObserver(_);T==null||T.observe(g);const N=new MutationObserver(C);return N.observe(g,{childList:!0,subtree:!0}),()=>{T==null||T.disconnect(),N.disconnect(),m==null||m.disconnect(),L!==0&&cancelAnimationFrame(L),window.clearTimeout(A)}},[t,n,r,i]);const h=c.useCallback(()=>{const g=o.current,p=t.current;if(!g)return;const y=yc(g);if(!y)return;const b=p&&p!==g?jr(g,p):null;s(Sn(b?{...y,range:b.range,selectedText:b.selectedText}:y))},[t,s,o]),w=c.useCallback(g=>{const p=o.current,y=u.current[g];if(!p||!y)return;const b=jr(p,y);b&&s(Sn(b))},[s,o]);return a.jsx("div",{className:"text-block-quote-rail",children:r&&d.length>0?d.map((g,p)=>a.jsx("button",{type:"button",className:`text-block-quote text-block-quote-paragraph ${e?"always-visible":""}`,style:{top:`${g.top+g.height}px`},onClick:()=>w(p),title:l("sessionQuoteBlock"),"aria-label":l("sessionQuoteBlock"),children:">"},g.blockIndex)):a.jsx("button",{type:"button",className:`text-block-quote text-block-quote-fallback ${e?"always-visible":""}`,onClick:h,title:l("sessionQuoteBlock"),"aria-label":l("sessionQuoteBlock"),children:">"})})}function Eo(e,t,n){if(e.length===0)return 0;if(t<=0)return Number.POSITIVE_INFINITY;let s=1,r=0;for(const o of e){const i=r===0?o:r+n+o;r>0&&i>t?(s+=1,r=o):r=i}return s}function Bg({actionGap:e,actionWidths:t,availableWidth:n,contextWidth:s,headerGap:r,provenanceWidth:o}){if(t.length===0)return!1;const i=[s,o].filter(h=>h>0),l=i.reduce((h,w)=>h+w,0),u=n-l-r*Math.max(0,i.length),d=Eo(t,u,e),f=1+Eo(t,n,e);return d>=f}function ko(e){return e<1024?`${e} b`:e<1024*1024?`${Math.round(e/1024)} kb`:`${Math.round(e/(1024*1024)*10)/10} mb`}function Dg(e){var s;const t=((s=e.split(".").pop())==null?void 0:s.toLowerCase())||"";return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",swift:"swift",php:"php",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",md:"markdown",markdown:"markdown"}[t]||"plaintext"}function _o(e){return e.startsWith("image/")}function rs(e,t){return/\.(?:html?|xhtml)$/i.test(e)||t==="text/html"||t==="application/xhtml+xml"}function Og(e){if(!Ut(e))return null;try{return Wo(js(e))}catch{return null}}function Hg(e,t){return e===void 0?null:{end:Math.max(e,t??e),start:e}}function lt(e){return(e==null?void 0:e.contentStartLine)??1}function qi(e){if(e.contentEndLine!==void 0)return e.contentEndLine;if(e.content!==void 0)return lt(e)+e.content.split(`
|
|
54
|
+
`).length-1}function Lo(e){if(!e.contentTruncated)return null;const t=qi(e),n=e.contentTotalLines?` of ${e.contentTotalLines}`:"";return`Showing lines ${lt(e)}-${t}${n}`}function Wi(e,t,n){return t===void 0?e:`${e}:${t}${n&&n>t?`-${n}`:""}`}function Ug(e,t,n,s){const r=e.split(`
|
|
55
|
+
`),o=s-t;if(o<0||o>=r.length)return null;const i=Math.max(0,o-3),l=Math.min(r.length,o+4);return{location:Wi(n,s),quote:r.slice(i,l).join(`
|
|
56
|
+
`),afterLine:s}}function Vg(e,t){const n=Array.from(e.querySelectorAll(".markdown-rendered > :not([data-review-comment-inline-host])"));let s;for(let r=0;r<n.length;r+=1)try{t.intersectsNode(n[r])&&(s=r)}catch{}return s}function qg({afterBlock:e,children:t,editor:n,previewRef:s}){const[r,o]=c.useState(null);return c.useLayoutEffect(()=>{if(e===void 0){o(null);return}const i=s.current;if(!i){o(null);return}const l=i.ownerDocument.createElement("div");l.dataset.reviewCommentInlineHost="";const u=()=>{const h=i.querySelectorAll(".markdown-rendered > :not([data-review-comment-inline-host])").item(e);h&&h.nextElementSibling!==l&&h.after(l)};if(u(),!l.isConnected){o(null);return}const d=new MutationObserver(u);return d.observe(i,{childList:!0,subtree:!0}),o(l),()=>{d.disconnect(),l.remove()}},[e,s]),a.jsxs("div",{ref:s,children:[t,r?tt.createPortal(a.jsx(Gm,{editor:n}),r,"session-file-comment-editor"):null]})}function Wg({busy:e,cancelLabel:t,draft:n,error:s,onCancel:r,onChange:o,onPersist:i,onSend:l,placeholder:u,sendLabel:d}){const[f,h]=c.useState(n.text);return a.jsx(Bi,{anchorLabel:n.location,snippet:n.quote,text:f,placeholder:u,autoFocus:!n.preserveSelection,error:s,onBlur:i,onChange:w=>{h(w),o(n.id,w)},onKeyDown:w=>{w.key!=="Enter"||w.shiftKey||w.nativeEvent.isComposing||(w.preventDefault(),w.stopPropagation(),l(n.id))},actions:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>r(n.id),disabled:e,children:t}),a.jsx("button",{type:"button",className:Ce.commentSend,onClick:()=>l(n.id),disabled:!f.trim()||e,children:d})]})})}function Kg(e,t,n,s){if(!e)return e;const r=Hg(n,s),o=(r==null?void 0:r.start)===(r==null?void 0:r.end);let i=0;return e.replace(/<span class="([^"]*)">/g,(l,u)=>{if(!u.split(/\s+/).includes("line"))return l;i+=1;const d=t+i-1,f=r!==null&&d>=r.start&&d<=r.end;return`<span class="${[u,o&&f?"highlighted-line":"",d===(r==null?void 0:r.start)?"highlighted-line-start":"",d===(r==null?void 0:r.end)?"highlighted-line-end":""].filter(Boolean).join(" ")}" data-line="${d}">`})}const os={loadFile:(e,t,n,s,r,o)=>oe.getFile(e,t,n,s,r,o),getRawFileUrl:(e,t,n)=>oe.getFileRawUrl(e,t,n),statFile:(e,t)=>oe.getFileMetadata(e,t),fetchRawFileBlob:(e,t,n)=>{const{rawUrl:s}=e;if(!s)throw new Error("Raw file URL unavailable");const r=n?`${s}${s.includes("?")?"&":"?"}download=true`:s;return Tr(r)},createMediaSource:e=>e?{fetchBlob:async(t,n)=>xs(e,t)??Tr(n)}:void 0};function Qg(e,t){const n=e.getBoundingClientRect();return t.getBoundingClientRect().top-n.top+e.scrollTop}function Gg(e,t){if(e.scrollHeight<=e.clientHeight)return 0;const n=Qg(e,t),s=e.clientHeight*.1,r=Math.max(0,e.scrollHeight-e.clientHeight);return Math.max(0,Math.min(r,n-s))}const zg=c.memo(function({projectId:t,filePath:n,source:s=os,openInNewTabUrl:r,onClose:o,onMinimize:i,parentViewerId:l,standalone:u=!1,lineNumber:d,lineEnd:f,viewMode:h="full",initialPresentation:w,diffMode:g,headerLeading:p}){var kr,_r;const{t:y}=Ue(),b=Os(),x=Sc(),L=Ts(),{quoteReplyButtonMode:A}=Si(),E=As(),S=E.transport,v=An(),_=`${t}\0${n}\0${g??"source"}`,[m,C]=c.useState(!1),[T,N]=c.useState(null),[R,k]=c.useState(null),M=c.useRef(null),[$,P]=c.useState(()=>({identity:_,view:g??"source"})),F=$.identity===_?$.view:g??"source",W=c.useCallback(I=>{I==="source"&&(M.current=_,C(!1),k(null)),P({identity:_,view:I})},[_]),D=F!=="source",V=D?void 0:d,G=D?void 0:f,J=D?"full":h,K=xi(v===null?t:void 0,n),O=F==="worktree"?K.worktreeFile:F==="cumulative"?K.cumulativeFile:null,Q=S.capabilities.sameOriginUrls,X=Lt(),z=v&&v.projectId!==null?Mi(X,{relayUsername:v.relayUsername,relayUrl:v.relayUrl,secret:v.secret,projectId:v.projectId,path:n}):null,[j,he]=c.useState(null),[se,ce]=c.useState(!0),[Re,de]=c.useState(null),[Z,ve]=c.useState(!1),[ie,Ve]=c.useState(!1),[Gt,In]=c.useState(null),zt=c.useRef(null),xe=c.useRef(null),Ye=c.useRef(null),[ft,Nn]=c.useState(!1),[qe,We]=c.useState(null),nt=c.useRef(null),[me,st]=c.useState(!1),[rt,ot]=c.useState(null),[Je,Ie]=c.useState(null),[Xt,ht]=c.useState(null),Ne=dd(),U=Qr(id,Ne.density),H=Qr(od,Ne.density),ue=ud(U),ae=c.useMemo(()=>Og(t),[t]),be=c.useMemo(()=>ls(n)?Is(n,ae):Vt(n).replace(/^\.\/+/,""),[n,ae]),pe=be??n,Yt=c.useMemo(()=>({projectId:t,filePath:pe,contentStartLine:j?lt(j):1}),[j,t,pe]),ra=c.useMemo(()=>L&&x?Af({sourceKey:E.sourceKey,sessionId:L.sessionId,projectId:t,filePath:n}):null,[n,t,x,L,E.sourceKey]),le=zf({active:me,storageKey:ra,sendComment:x}),Pe=c.useRef(null);c.useLayoutEffect(()=>{const I=Gt,B=zt.current,q=xe.current,re=Ye.current;if(!I||!B||!q||!re)return;const we=()=>{const fe=getComputedStyle(I),at=getComputedStyle(re),Ge=Number.parseFloat(fe.paddingLeft)+Number.parseFloat(fe.paddingRight),pt=Array.from(re.children,Se=>Se.getBoundingClientRect().width).filter(Se=>Se>0),gt=Bg({actionGap:Number.parseFloat(at.columnGap)||0,actionWidths:pt,availableWidth:I.clientWidth-Ge,contextWidth:B.getBoundingClientRect().width,headerGap:Number.parseFloat(fe.columnGap)||0,provenanceWidth:q.getBoundingClientRect().width});Nn(Se=>Se===gt?Se:gt)},te=typeof ResizeObserver>"u"?null:new ResizeObserver(we),ne=()=>{te==null||te.disconnect(),te==null||te.observe(I),te==null||te.observe(B),te==null||te.observe(q),te==null||te.observe(re);for(const fe of re.children)te==null||te.observe(fe)},Qe=new MutationObserver(()=>{ne(),we()});return Qe.observe(re,{childList:!0,subtree:!0}),ne(),we(),()=>{Qe.disconnect(),te==null||te.disconnect()}},[Gt]),Ri(Pe,D||j==null?void 0:j.content,Yt);const nr=Cc(),oa=c.useCallback(I=>{nr(t,I)},[t,nr]),Jt=c.useRef(null),{modal:Zt,localFileModal:Pn,projectFileModal:mt,handleClick:$n,handleContextMenu:Fn,closeModal:ia,closeLocalFileModal:aa,closeProjectFileModal:ca,contextMenuElement:la}=Ec({projectContext:{projectId:t,projectPath:ae}}),sr=c.useRef($n),rr=c.useRef(Fn);sr.current=$n,rr.current=Fn;const or=c.useCallback(I=>sr.current(I),[]),ir=c.useCallback(I=>rr.current(I),[]),Bn=c.useCallback(I=>{var q,re;if(I.key!==" ")return;const B=(re=(q=I.target).closest)==null?void 0:re.call(q,"a[href]");B&&(I.preventDefault(),B.click())},[]),ua=c.useCallback(I=>{I.button>0||I.target instanceof Element&&I.target.closest("button, input, textarea, select, a[href], [contenteditable='true']")||I.currentTarget.focus({preventScroll:!0})},[]),da=c.useCallback(I=>{if(I.button!==0||I.target instanceof Element&&I.target.closest("button, input, textarea, select, a[href], [contenteditable='true']"))return;const B=I.currentTarget.ownerDocument.getSelection();if(!B||B.isCollapsed||B.rangeCount===0)return;(B.anchorNode!==null&&I.currentTarget.contains(B.anchorNode)||B.focusNode!==null&&I.currentTarget.contains(B.focusNode))&&B.removeAllRanges()},[]),Ke=!!(x&&L&&o&&!u&&v===null&&!D&&(j!=null&&j.metadata.isText)&&j.content!==void 0&&!(m&&rs(n,j.metadata.mimeType)));c.useEffect(()=>{!me||Ke||(le.flush(),st(!1))},[me,Ke,le.flush]);const ar=c.useCallback(()=>{const I=Pe.current;if(!me||!Ke||!I)return;const B=Mn(I);if(B.length===0)return;const q=B.map(ne=>ne.sourceLocation).filter(ne=>(ne==null?void 0:ne.filePath)===pe),re=q.length===B.length?Math.min(...q.map(ne=>(ne==null?void 0:ne.lineStart)??1)):void 0,we=q.length===B.length?Math.max(...q.map(ne=>(ne==null?void 0:ne.lineEnd)??1)):void 0,te=m?Vg(Jt.current??I,B.at(-1).range):void 0;le.open({location:Wi(pe,re,we),quote:B.map(ne=>ne.markdown).join(`
|
|
57
|
+
|
|
58
|
+
`),preserveSelection:!0,...!m&&we!==void 0?{afterLine:we}:{},...te===void 0?{}:{afterBlock:te}})},[me,Ke,le.open,m,pe]);c.useEffect(()=>{if(!me||!Ke)return;const I=Pe.current,B=I==null?void 0:I.ownerDocument;if(!I||!B)return;let q=!1,re=0;const we=()=>{window.clearTimeout(re),re=window.setTimeout(ar,0)},te=fe=>{fe.button===0&&fe.target instanceof Node&&I.contains(fe.target)&&!(fe.target instanceof Element&&fe.target.closest("button, input, textarea, select, a[href]"))&&(q=!0)},ne=()=>{q&&(q=!1,we())},Qe=()=>{const fe=B.activeElement;fe instanceof Element&&fe.closest('[data-markdown-copy-ignore="true"]')||q||we()};return B.addEventListener("pointerdown",te,!0),B.addEventListener("pointerup",ne,!0),B.addEventListener("pointercancel",ne,!0),B.addEventListener("selectionchange",Qe),we(),()=>{window.clearTimeout(re),B.removeEventListener("pointerdown",te,!0),B.removeEventListener("pointerup",ne,!0),B.removeEventListener("pointercancel",ne,!0),B.removeEventListener("selectionchange",Qe)}},[me,Ke,ar]);const fa=c.useCallback(I=>{if(!me||!Ke||!(j!=null&&j.content)||I.target instanceof Element&&I.target.closest("button, input, textarea, select, a[href], [contenteditable='true']"))return;const B=I.currentTarget.ownerDocument.getSelection();if(B&&!B.isCollapsed)return;const q=I.target instanceof Element?I.target.closest("[data-line]"):null,re=Number(q==null?void 0:q.dataset.line);if(!Number.isInteger(re))return;const we=Ug(j.content,lt(j),pe,re);we&&le.open(we)},[me,Ke,j,le.open,pe]),ha=c.useCallback(()=>{st(I=>(I&&le.flush(),!I))},[le.flush]),ma=c.useCallback(I=>{if(!me)return;const B=I.relatedTarget;if(!(B instanceof Node)){le.persist();return}(I.currentTarget.closest("dialog")??I.currentTarget).contains(B)||le.flush()},[me,le.flush,le.persist]),cr=c.useCallback(()=>{le.flush(),o==null||o()},[o,le.flush]),pa=c.useCallback(()=>{le.flush(),i==null||i()},[i,le.flush]),lr=c.useMemo(()=>{var I;return(I=s.createMediaSource)==null?void 0:I.call(s,j)},[j,s]),je=c.useMemo(()=>j!=null&&j.renderedMarkdownHtml?s.transformRenderedMarkdownHtml?s.transformRenderedMarkdownHtml(j.renderedMarkdownHtml,j):j.renderedMarkdownHtml:null,[j,s]),ga=c.useMemo(()=>je?a.jsx(Ds,{html:je,sourcePath:n,density:H,ariaLabel:y("fileViewerPreview"),onClick:or,onContextMenu:ir,onKeyDown:Bn}):null,[n,Bn,or,ir,H,je,y]),Rt=c.useMemo(()=>j?kc(n,j,je??void 0):null,[j,n,je]),en=c.useMemo(()=>{const I=Kg(j==null?void 0:j.highlightedHtml,lt(j),V,G);return Zf(Ai(I),j==null?void 0:j.content)},[G,V,j]);_c(Jt,!D&&m?je:null,lr);const ur=!D&&m?je:D?null:en,Dn=`${t}\0${n}\0${d??""}\0${f??""}\0${h}`,[wa,ya]=c.useState(0),[$e,On]=c.useState(null),dr=c.useCallback(()=>{const I=j==null?void 0:j.metadata.modifiedAt;!s.statFile||I===void 0||s.statFile(t,n).then(B=>{const q=B.metadata.modifiedAt;q!==void 0&&On(q!==I||B.metadata.size!==(j==null?void 0:j.metadata.size)?{state:"stale",at:q}:{state:"fresh",loadedAt:I})}).catch(()=>On(null))},[s,t,n,j]),fr=c.useCallback(()=>{On(null),ya(I=>I+1),s.loadFile(t,n,!0,V,G,J).then(he).catch(I=>de(String(I)))},[s,t,n,V,G,J]);c.useEffect(()=>{F==="source"||K.loading||(F==="worktree"&&!K.worktreeFile||F==="cumulative"&&!K.cumulativeFile)&&W("source")},[F,K,W]),c.useEffect(()=>{var B;let I=!1;if(D){ce(!1),de(null),ht(null);return}if(j&&((B=nt.current)==null?void 0:B.identity)===Dn&&nt.current.source===s){ce(!1),de(null);return}return ce(!0),de(null),ht(null),s.loadFile(t,n,!0,V,G,J).then(q=>{if(!I){nt.current={identity:Dn,source:s},he(q);const re=cs(n)&&!!q.renderedMarkdownHtml,we=q.content!==void 0&&rs(n,q.metadata.mimeType);C(M.current===_?!1:w?w==="preview"&&(re||we):re||we),ce(!1)}}).catch(q=>{I||(de(q.message||y("fileViewerLoadFailed")),ce(!1))}),()=>{I=!0}},[t,D,G,V,J,n,w,s,Dn,y,_,j]),c.useEffect(()=>{if(!j||!_o(j.metadata.mimeType)){Ie(null);return}if(!s.fetchRawFileBlob){Ie(null);return}let I=!1,B=null;return Ie(null),s.fetchRawFileBlob(j,n,!1).then(q=>{I||(B=URL.createObjectURL(q),Ie(B))}).catch(q=>{I||de(q instanceof Error?q.message:String(q))}),()=>{I=!0,B&&URL.revokeObjectURL(B)}},[j,n,s]),c.useEffect(()=>{if(!ie)return;const I=B=>{B.key==="Escape"&&Ve(!1)};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[ie]),c.useEffect(()=>{var q;if(V===void 0||!ur)return;const I=Xt??((q=Pe.current)==null?void 0:q.querySelector(".highlighted-line-start, .markdown-preview-span-start")),B=Pe.current;I&&B&&requestAnimationFrame(()=>{B.scrollTop=Gg(B,I)})},[V,ur,Xt]);const va=c.useCallback(async()=>{if((j==null?void 0:j.content)!==void 0)try{if(!await _e(j.content))throw new Error("Clipboard write failed");ve(!0),setTimeout(()=>ve(!1),3e3)}catch(I){console.error("Failed to copy:",I)}},[j==null?void 0:j.content]),xa=c.useCallback(()=>{Ht(s.loadFile(t,n,!1).then(I=>I.content??""))},[n,t,s]),ba=c.useCallback(()=>{Rt&&No(Rt.html,Rt.text)},[Rt]),Sa=c.useMemo(()=>Ns(n,ae),[n,ae]),Hn=c.useMemo(()=>Uo(n,ae),[n,ae]),Mt=c.useMemo(()=>v?jn(v,{filePath:n,lineEnd:f,lineNumber:d,viewMode:h}):null,[n,f,d,v,h]),Un=c.useMemo(()=>r||Mt||dt(_n({basePath:X,filePath:n,lineEnd:f,lineNumber:d,projectId:t,viewMode:h})),[X,n,f,d,r,t,Mt,h]),At=c.useMemo(()=>F==="source"||Mt?Un:dt(_n({basePath:X,diffMode:F,filePath:K.relativePath??n,projectId:t})),[F,X,n,K.relativePath,t,Mt,Un]),Fe=$t(n),hr=Dg(n),tn=j?_o(j.metadata.mimeType):!1,jt=j?((kr=s.getRawFileUrl)==null?void 0:kr.call(s,t,n,!1))??j.rawUrl:null,nn=tn?Q&&jt?jt:Je??(s.fetchRawFileBlob?null:jt):null,mr=y("fileViewerOpenImageNewTab"),pr=Vo(t,n),gr=c.useCallback(()=>{if(!j)return;if(s.fetchRawFileBlob){s.fetchRawFileBlob(j,n,!0).then(B=>xn(B,Fe)).catch(B=>{de(B instanceof Error?B.message:String(B))});return}const I=new URLSearchParams({path:n,download:"true"});S.fetchBlob(`/projects/${t}/files/raw?${I}`).then(B=>xn(B,Fe)).catch(B=>{de(B instanceof Error?B.message:"Failed to download file")})},[j,Fe,n,t,s,S]),wr=c.useMemo(()=>new URL(At,window.location.href).href,[At]),yr=c.useCallback(()=>{if(nn){window.open(nn,"_blank","noopener");return}window.open(At,"_blank","noopener")},[nn,At]),Ca=c.useCallback(()=>{if(!j)return Promise.reject(new Error("Image is not loaded"));if(s.fetchRawFileBlob)return s.fetchRawFileBlob(j,n,!1);const I=new URLSearchParams({path:n});return S.fetchBlob(`/projects/${encodeURIComponent(t)}/files/raw?${I}`)},[j,n,t,s,S]),vr=Lc({fileName:Fe,filePath:n,loadBlob:tn?Ca:void 0,onOpen:yr,projectPath:ae,viewerLink:At}),Ea=c.useCallback(I=>{I.preventDefault(),I.stopPropagation(),ot({x:I.clientX,y:I.clientY})},[]),ka=c.useCallback(()=>ot(null),[]);if(se||!D&&!j&&!Re||D&&K.loading&&!O)return a.jsx("div",{className:"file-viewer",children:a.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Fe})})});if(!D&&(Re||!j))return a.jsx("div",{className:"file-viewer",children:a.jsx("div",{className:"file-viewer-error",children:Re||y("fileViewerNotFound")})});const ge=j==null?void 0:j.metadata,ke=j==null?void 0:j.content,xr=tn,br=!!(s.fetchRawFileBlob||jt),sn=ke!==void 0&&cs(n)&&!!je,it=ke!==void 0&&ge!==void 0&&rs(n,ge.mimeType),Sr=sn||it,Me=me?le.activeDraft:null,_a=Me?le.sendingIds.has(Me.id):!1,Be=Me?a.jsx(Wg,{draft:Me,placeholder:y("fileViewerCommentPlaceholder"),error:le.error?y("fileViewerCommentSendFailed"):null,busy:_a,cancelLabel:y("cancel"),sendLabel:y("toolbarSend"),onCancel:le.cancel,onChange:le.update,onPersist:le.persist,onSend:I=>void le.sendOne(I)},Me.id):null,Tt=Be&&!m?Me==null?void 0:Me.afterLine:void 0,Cr=Be&&m&&je&&(Me==null?void 0:Me.afterBlock)!==void 0?Me.afterBlock:void 0,Er=()=>{if(D)return O?a.jsx("div",{className:Ce.diffBody,children:a.jsx(Xs,{file:O,fileKey:`file-viewer:${F}:${O.path}`,projectId:t,source:{kind:"file-projection",mode:F},captureReviewProjections:!0,t:y})}):a.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Fe})});if(!j||!ge)return a.jsx("div",{className:"file-viewer-error",children:Re||y("fileViewerNotFound")});if(xr){const I=s.fetchRawFileBlob?Je:jt,B=nn??I;return a.jsx("div",{className:"file-viewer-image",children:I&&B?a.jsx("a",{className:"file-viewer-image-link",href:B,target:"_blank",rel:"noopener noreferrer",title:mr,"aria-label":mr,onContextMenu:vr.handleContextMenu,children:a.jsx("img",{src:I,alt:Fe})}):a.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Fe})})})}if(ke!==void 0){if(m&&sn&&je)return a.jsx(qg,{afterBlock:Be?Cr:void 0,editor:Be,previewRef:Jt,children:ga});if(m&&it)return a.jsx(Nc,{html:ke,path:n,projectId:t,className:Ce.htmlPreviewFrame,title:Fe,autoStart:R===_,toolbarHost:T,reloadKey:wa},_);if(en){const fe=Lo(j),at=Tt!==void 0?eh(en,Tt):null,Ge=pt=>a.jsx("div",{className:"shiki-container",onClick:$n,onContextMenu:Fn,onKeyDown:Bn,dangerouslySetInnerHTML:{__html:pt}});return a.jsxs("div",{className:"file-viewer-code file-viewer-code-highlighted","data-language":j.highlightedLanguage??hr,style:ue,children:[at&&Be?a.jsx(Dt,{before:Ge(at.before),editor:Be,after:Ge(at.after)}):Ge(en),j.highlightedTruncated&&a.jsx("div",{className:"file-viewer-truncated",children:y("fileViewerHighlightTruncated")}),fe&&a.jsx("div",{className:"file-viewer-truncated",children:fe})]})}const I=ke.length>0?ke.split(`
|
|
59
|
+
`):[],B=lt(j),q=V??0,re=Math.max(q,G??q),we=q===re,te=Lo(j),ne=(fe,at)=>{const Ge=I.slice(fe,at);return Ge.length>0?a.jsxs("div",{className:"code-highlighter-plain",children:[a.jsx("div",{className:"code-line-numbers",children:Ge.map((pt,gt)=>{const Se=B+fe+gt;return a.jsx("div",{children:Se},`ln-${Se}`)})}),a.jsx("pre",{className:"code-content",children:a.jsx("code",{children:Ge.map((pt,gt)=>{const Se=B+fe+gt,Ma=V!==void 0&&Se>=q&&Se<=re,Aa=[we&&Ma?"highlighted-line":"",Se===q?"highlighted-line-start":"",Se===re?"highlighted-line-end":""].filter(Boolean).join(" ");return a.jsx("div",{ref:V!==void 0&&Se===q?ja=>ht(ja):void 0,className:Aa||void 0,"data-line":Se,children:pt||" "},`line-${Se}`)})})})]}):null},Qe=Tt===void 0?null:Math.min(I.length,Math.max(0,Tt-B+1));return a.jsxs("div",{className:"file-viewer-code","data-language":hr,style:ue,children:[Qe!==null&&Be?a.jsx(Dt,{before:ne(0,Qe),editor:Be,after:ne(Qe,I.length)}):I.length>0?ne(0,I.length):a.jsx("div",{className:"file-viewer-empty-content",children:"No content read"}),te&&a.jsx("div",{className:"file-viewer-truncated",children:te})]})}return a.jsxs("div",{className:"file-viewer-binary",children:[a.jsx("p",{children:y("fileViewerBinary")}),a.jsxs("p",{children:[a.jsx("strong",{children:y("fileViewerType")})," ",ge==null?void 0:ge.mimeType]}),a.jsxs("p",{children:[a.jsx("strong",{children:y("fileViewerSize")})," ",ge?ko(ge.size):""]}),br&&a.jsx("button",{type:"button",className:"file-viewer-download-btn",onClick:gr,children:y("fileViewerDownloadFile")})]})},La=a.jsxs("div",{ref:In,className:`file-viewer-header ${St.header} ${Ce.header}`,"data-actions-below":ft||void 0,children:[a.jsxs("div",{ref:zt,className:Ce.context,children:[p,o&&a.jsx("button",{type:"button",className:`file-viewer-action ${Ce.backButton}`,onClick:cr,title:y("actionBack"),"aria-label":y("actionBack"),children:a.jsx(jd,{})})]}),a.jsxs("div",{className:`file-viewer-info ${St.identity} ${Ce.info}`,children:[a.jsx("span",{className:"file-viewer-path",title:n,onContextMenu:Ea,children:Sa}),a.jsxs("div",{ref:xe,className:Ce.provenanceRow,children:[v===null&&K.relativePath&&a.jsx(Ks,{projectId:t,path:K.relativePath,origPath:(_r=K.worktreeFile)==null?void 0:_r.origPath,dirtyLabel:y("fileRevisionDirty"),uncommittedLabel:y("fileRevisionUncommitted")}),a.jsxs("span",{className:"file-viewer-meta",children:[ge?ko(ge.size):"",!D&&(ge==null?void 0:ge.isText)&&ke!==void 0&&a.jsxs(a.Fragment,{children:[" • ",j!=null&&j.contentTruncated?`lines ${lt(j)}-${qi(j)}${j!=null&&j.contentTotalLines?` of ${j.contentTotalLines}`:""}`:y("fileViewerLines",{count:ke.length>0?ke.split(`
|
|
60
|
+
`).length:0})]})]})]})]}),a.jsxs("div",{ref:Ye,className:`file-viewer-actions ${St.actions} ${Ce.actions}`,children:[v===null&&a.jsx(Ui,{activeView:F,availability:K,onSelect:W,projectId:t,sourceHref:Un,variant:"header"}),!D&&Sr&&a.jsx("button",{type:"button",className:`file-viewer-action ${Ce.rawToggle}`,"aria-label":y("fileViewerRawSource"),"aria-pressed":!m,title:y("fileViewerRawSource"),onClick:()=>{k(!m&&it?_:null),C(I=>!I)},children:a.jsx(Jg,{})}),Ke&&a.jsx("button",{type:"button",className:`file-viewer-action ${Ce.commentToggle}`,"aria-label":y("fileViewerCommentMode"),"aria-pressed":me,title:y("fileViewerCommentMode"),onClick:ha,children:a.jsx(rw,{})}),v===null&&s===os&&!D&&(ge==null?void 0:ge.isText)&&ke!==void 0&&a.jsx(Rc,{source:{path:n,projectId:t},line:V,artifact:it,onSaved:it?void 0:fr}),a.jsx("span",{ref:N}),!D&&j&&a.jsx("button",{type:"button",className:`file-viewer-action${($e==null?void 0:$e.state)==="stale"?` ${Ce.reloadStale}`:""}`,"aria-label":y("fileViewerReload"),title:($e==null?void 0:$e.state)==="stale"?y("fileViewerReloadStale",{time:new Date($e.at).toLocaleTimeString()}):($e==null?void 0:$e.state)==="fresh"?y("fileViewerReloadFresh"):y("fileViewerReload"),onMouseEnter:dr,onFocus:dr,onClick:fr,children:a.jsx(Yg,{})}),!D&&(ge==null?void 0:ge.isText)&&ke!==void 0&&a.jsx(fd,{zoom:Ne.zoom,canZoomIn:Ne.canZoomIn,canZoomOut:Ne.canZoomOut,onZoomIn:Ne.zoomIn,onZoomOut:Ne.zoomOut}),(D||!xr&&ke!==void 0&&!(m&&it))&&a.jsx(Ag,{className:"file-viewer-action",contentRef:Pe}),!D&&ke!==void 0&&a.jsx("button",{type:"button",className:`file-viewer-action ${Z?"copied":""}`,onClick:va,title:y(Z?"fileViewerCopied":"fileViewerCopyContent"),children:Z?a.jsx(nw,{}):a.jsx(Zg,{})}),v===null&&s===os&&!D&&a.jsx(ew,{onOpen:We}),v!==null&&v.projectId!==null&&!D&&it&&ke!==void 0&&a.jsx(Mc,{mode:"interactive",source:{},artifact:!0,href:z,active:!1,label:y("publicSharePlay"),onToggle:()=>window.open(z,"_blank","noopener")}),v===null&&a.jsx("button",{type:"button",className:"file-viewer-action file-viewer-new-session",onClick:pr,title:y("fileViewerNewSession"),children:a.jsx(sw,{})}),!D&&br&&a.jsx("button",{type:"button",className:"file-viewer-action",onClick:gr,title:y("fileViewerDownload"),children:a.jsx(ow,{})}),a.jsx("button",{type:"button",className:`file-viewer-action file-viewer-fullscreen-toggle ${Ce.fullscreenButton}`,onClick:()=>Ve(!ie),title:y(ie?"fileViewerExitFullscreen":"fileViewerFullscreen"),children:ie?a.jsx(aw,{}):a.jsx(iw,{})}),a.jsx(Ac,{className:Ce.windowActions,url:wr,moveOut:!u,onMinimize:i?pa:void 0,onClose:o?cr:void 0,minimizeLabel:y("fileViewerMinimize")})]})]}),Ra=["file-viewer",Ce.viewer,u&&"file-viewer-standalone",ie&&"file-viewer-fullscreen",J==="range"&&"file-viewer-compact"].filter(Boolean).join(" ");return a.jsxs("div",{className:Ra,onBlurCapture:ma,children:[La,qe&&a.jsx(ig,{anchorRect:qe,filePath:n,projectId:t,title:Fe,transformUrl:R===_?I=>Xf(I)??I:void 0,onClose:()=>We(null)}),rt&&a.jsx(qo,{x:rt.x,y:rt.y,canStartNewSession:v===null,onClose:ka,onOpen:yr,onOpenSource:us(n)?()=>{k(null),C(!1)}:void 0,onOpenPreview:us(n)&&Sr?()=>{k(_),C(!0)}:void 0,onStartNewSession:pr,onCopyProjectRelativePath:be?()=>void _e(be):void 0,onCopyAbsolutePath:v===null&&Hn?()=>void _e(Hn):void 0,onCopyFilePath:!be&&!Hn?()=>void _e(n):void 0,onCopyViewerLink:()=>void _e(wr),onCopyContents:xa,onCopyRenderedContents:Rt?ba:void 0}),la,tn?vr.contextMenuElement:null,a.jsxs("div",{className:`file-viewer-body ${Ce.body} ${b&&m&&sn?Ce.quoteReplySurface:""}`,ref:Pe,tabIndex:-1,...me?{[Ei]:"true"}:{},onClick:fa,onMouseDownCapture:da,onPointerDown:ua,children:[Be&&Tt===void 0&&Cr===void 0?a.jsx(Dt,{before:Er(),editor:Be}):Er(),!me&&b&&m&&sn?a.jsx(Fg,{alwaysShowQuoteCircle:A==="paragraph-always",contentRef:Jt,layoutKey:`${n}\0${je??""}`,onQuoteBlock:b,paragraphQuoteCirclesEnabled:A!=="block",sourceRef:Pe,surfaceRef:Pe}):null,u?a.jsx(Xg,{containerRef:Pe,onStartNewSessionFromSelection:v===null?oa:void 0}):null]}),Zt?a.jsx(jc,{path:Zt.path,mediaType:Zt.mediaType,mediaSource:lr,dismissOnBack:!0,parentViewerId:Zt.mediaType==="image"?l:void 0,onClose:ia}):null,Pn?a.jsx(Tc,{resource:Pn.resource,initialPresentation:Pn.initialPresentation,dismissOnBack:!0,onClose:aa}):null,mt?a.jsx(Wt,{nestedViewer:!0,projectId:mt.projectId,filePath:mt.filePath,lineNumber:mt.lineNumber,lineEnd:mt.lineEnd,initialPresentation:mt.initialPresentation,onClose:ca}):null]})});function Xg({containerRef:e,onStartNewSessionFromSelection:t}){const{floatingSelectionActions:n,selectionContextMenu:s}=Li({containerRef:e,inert:!1,onStartNewSessionFromSelection:t,quoteClearSignal:0,isInteractiveTarget:r=>r instanceof Element&&r.closest("button, input, textarea, select, a[href], [contenteditable='true']")!==null});return a.jsxs(a.Fragment,{children:[n,s]})}function Yg(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 1-1.6-3.9"}),a.jsx("path",{d:"M13.5 2.5v3.2h-3.2"})]})}function Jg(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M5.5 4 2 8l3.5 4M10.5 4 14 8l-3.5 4M9.5 2.5l-3 11"})})}function Zg(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),a.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}function ew({onOpen:e}){const{t}=Ue(),{version:n}=Fo(),{status:s}=Ic();return(s==null?void 0:s.canCreate)!==!0||!Ot(n,nc)?null:a.jsx("button",{type:"button",className:"file-viewer-action",onClick:r=>e(r.currentTarget.getBoundingClientRect()),title:t("fileViewerSharePublicly"),"aria-label":t("fileViewerSharePublicly"),children:a.jsx(tw,{})})}function tw(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m8 12 4-4M6.5 14.5l-1 1a2.8 2.8 0 0 1-4-4l3-3a2.8 2.8 0 0 1 4 0M13.5 5.5l1-1a2.8 2.8 0 1 1 4 4l-3 3a2.8 2.8 0 0 1-4 0"})})}function nw(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M3 8.5L6.5 12L13 4"})})}function sw(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M8 5v6M5 8h6"})]})}function rw(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M3 3.5h10v7H7l-3.5 2.5v-2.5H3z"})})}function ow(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M8 2v9M4 8l4 4 4-4M2 14h12"})})}function iw(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M2 5V2h3M11 2h3v3M14 11v3h-3M5 14H2v-3"})})}function aw(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M5 2v3H2M14 5h-3V2M11 14v-3h3M2 11h3v3"})})}const cw=128*1024,Ro=3e4,lw=64,Ki=128,uw=4096;function dw(){var e;return(e=globalThis.crypto)!=null&&e.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Mo(){const e=new Error("Share request cancelled");return e.name="AbortError",e}function fw(e){return e instanceof Error?e:new Error("Share transfer failed")}function Qi(e,t){return e.length>t||new TextEncoder().encode(e).byteLength>t}async function hw(e,t){if(typeof e=="string"){if(Qi(e,t))throw new Error("Relay response is too large");return e}if(e instanceof Blob){if(e.size>t)throw new Error("Relay response is too large");return await e.text()}if(e instanceof ArrayBuffer){if(e.byteLength>t)throw new Error("Relay response is too large");return new TextDecoder().decode(e)}throw new Error("Relay returned an invalid response")}function mw(e){if(e===void 0)return!0;if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=Object.entries(e);return t.length<=lw&&t.every(([n,s])=>n.length<=Ki&&typeof s=="string"&&s.length<=uw)}class pw{constructor(t,n,s){ee(this,"ws");ee(this,"ready");ee(this,"readyResolve");ee(this,"readyReject");ee(this,"readySettled",!1);ee(this,"connectTimeout");ee(this,"pending");ee(this,"closedIntentionally",!1);ee(this,"terminalError");ee(this,"signal");ee(this,"abortListener",()=>{this.close(Mo())});var r,o;this.signal=s,this.ready=new Promise((i,l)=>{this.readyResolve=i,this.readyReject=l}),this.ready.catch(()=>{}),this.ws=new WebSocket(t),this.connectTimeout=setTimeout(()=>{this.fail(new Error("Share request timed out")),this.close()},Ro),this.ws.onopen=()=>{this.ws.send(JSON.stringify({type:"client_connect",username:n}))},this.ws.onmessage=i=>{this.handleMessage(i)},this.ws.onerror=()=>{this.close(new Error("Relay connection failed"))},this.ws.onclose=()=>{this.closedIntentionally||this.failTerminal(new Error("Relay connection closed"))},(r=this.signal)==null||r.addEventListener("abort",this.abortListener,{once:!0}),(o=this.signal)!=null&&o.aborted&&this.abortListener()}async request(t,n=sc){var r;if(await this.ready,(r=this.signal)!=null&&r.aborted)throw Mo();if(this.terminalError)throw this.terminalError;if(this.closedIntentionally||this.ws.readyState>=2)throw new Error("Relay connection closed");if(this.pending)throw new Error("Public share relay requests must be sequential");const s=dw();return await new Promise((o,i)=>{const l=setTimeout(()=>{this.pending=void 0;const u=new Error("Share request timed out");i(u),this.close(u)},Ro);this.pending={id:s,resolve:o,reject:i,timeout:l,maxResponseBytes:n};try{this.ws.send(JSON.stringify({type:"request",id:s,method:"GET",path:t,headers:{}}))}catch{clearTimeout(l),this.pending=void 0;const u=new Error("Relay connection closed");this.failTerminal(u),i(u)}})}isTerminal(){return this.terminalError!==void 0||this.closedIntentionally||this.ws.readyState>=2}close(t=new Error("Relay connection closed")){var n;this.closedIntentionally||(this.failTerminal(t),this.closedIntentionally=!0,(n=this.signal)==null||n.removeEventListener("abort",this.abortListener),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.close())}async handleMessage(t){var s;let n;try{const r=((s=this.pending)==null?void 0:s.maxResponseBytes)??cw;let o;if(typeof t.data=="string"){if(Qi(t.data,r))throw new Error("Relay response is too large");o=t.data}else o=await hw(t.data,r);n=JSON.parse(o)}catch(r){const o=fw(r);this.fail(o),this.close(o);return}if(n&&typeof n=="object"&&n.type==="client_connected"){this.readySettled||(this.readySettled=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.readyResolve());return}if(n&&typeof n=="object"&&n.type==="response"){const r=n;if(typeof r.id!="string"||r.id.length>Ki||!Number.isInteger(r.status)||r.status<100||r.status>599||!mw(r.headers)){const i=new Error("Relay returned an invalid response");this.fail(i),this.close(i);return}if(!this.pending||r.id!==this.pending.id)return;const o=this.pending;this.pending=void 0,clearTimeout(o.timeout),o.resolve(r)}}fail(t){if(this.readySettled||(this.readySettled=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.readyReject(t)),this.pending){const n=this.pending;this.pending=void 0,clearTimeout(n.timeout),n.reject(t)}}failTerminal(t){this.terminalError??(this.terminalError=t),this.fail(this.terminalError)}}async function Gi({path:e,relayUrl:t,relayUsername:n,signal:s,maxResponseBytes:r}){const o=new pw(t,n,s);try{return await o.request(e,r)}finally{o.close()}}class Ao extends Error{constructor(t,n,s){super(t),this.status=n,this.retryable=s,this.name="PublicShareRelayError"}}function gw(e){var t,n;if(e.status>=400){const s=e.body,r=s&&typeof s=="object"&&typeof s.error=="string"?s.error:"Share not found";throw new Ao(r,e.status,!!(s&&typeof s=="object"&&s.retryable===!0))}if(e.status!==200)throw new Ao("Share returned an unexpected response",e.status,!1);if(typeof e.body=="string"&&(((t=e.headers)==null?void 0:t["content-type"])??((n=e.headers)==null?void 0:n["Content-Type"])??"").includes("json"))try{return JSON.parse(e.body)}catch{throw new Error("Share response is invalid")}return e.body}async function ww(e){return gw(await Gi(e))}async function yw(e){var r,o;const t=await Gi(e);if(t.status>=400)throw new Error("Share not found");const n=((r=t.headers)==null?void 0:r["content-type"])||((o=t.headers)==null?void 0:o["Content-Type"])||"application/octet-stream",s=t.body;if(s&&typeof s=="object"&&s._binary===!0&&typeof s.data=="string"){const i=atob(s.data),l=new Uint8Array(i.length);for(let u=0;u<i.length;u+=1)l[u]=i.charCodeAt(u);return new Blob([l],{type:n})}return typeof s=="string"?new Blob([s],{type:n}):new Blob([JSON.stringify(s??null)],{type:n})}function vw(e,t){const n=document.createElement("template");return n.innerHTML=e,Fc(n.content,t),n.innerHTML}function Js(e){const t=async(n,s)=>{const r=$c(s,e.projectId),o=(r?xs(n,r.path):null)??xs(n,s);if(o)return o;if(!r)throw new Error("File is outside this public share");const i=new URLSearchParams({path:r.path});return e.viewerId&&i.set("viewerId",e.viewerId),await yw({relayUrl:e.relayUrl,relayUsername:e.relayUsername,path:`/public-api/shares/${encodeURIComponent(e.secret)}/files/raw?${i}`})};return{loadFile:async(n,s,r,o,i,l)=>{const u=new URLSearchParams({path:s});return e.viewerId&&u.set("viewerId",e.viewerId),r&&u.set("highlight","true"),o!==void 0&&u.set("line",String(o)),i!==void 0&&u.set("lineEnd",String(i)),l==="range"&&u.set("view","range"),await ww({relayUrl:e.relayUrl,relayUsername:e.relayUsername,path:`/public-api/shares/${encodeURIComponent(e.secret)}/files?${u}`})},getRawFileUrl:()=>null,fetchRawFileBlob:t,createMediaSource:n=>({buildApiPath:s=>Pc(e,s),fetchBlob:async s=>await t(n??{embeddedMedia:{}},s)}),transformRenderedMarkdownHtml:n=>vw(n,e)}}const xw="_linkCluster_1l5oo_1",bw="_paneViewer_1l5oo_7",Sw="_nestedPaneViewer_1l5oo_15",Cw="_fileViewerModal_1l5oo_21",Ew="_fileViewerModalCompact_1l5oo_35",kw="_inlineDiffLinks_1l5oo_50",bt={linkCluster:xw,paneViewer:bw,nestedPaneViewer:Sw,fileViewerModal:Cw,fileViewerModalCompact:Ew,inlineDiffLinks:kw};function _w({filePath:e}){return a.jsx(Qc,{text:e,label:"Copy path",copiedLabel:"Copied path",className:"file-path-copy",onClick:t=>t.stopPropagation()})}function zi(e){if(!Ut(e))return null;try{const t=js(e);return Wo(t)}catch{return null}}function Lw(e,t){const n=zi(e),s=Is(t,n);if(s!==null)return s;const r=Vt(t);return!(r.startsWith("/")||/^[a-zA-Z]:\//.test(r))&&t.includes("\\")?Vt(t):t}function Es(e,t){return e===void 0?"":t!==void 0&&t>e?`:${e}-${t}`:`:${e}`}const Iy=c.memo(function({filePath:t,projectId:n,lineNumber:s,lineEnd:r,columnNumber:o,displayText:i,showLineSuffix:l=!0,showFullPath:u=!1,viewMode:d="full",showCopyButton:f=!0,showVersionControlLinks:h=!0}){const w=An(),g=Ko(),p=Os(),y=Lt(),b=As().transport,x=c.useId(),[L,A]=c.useState(!1),[E,S]=c.useState(),[v,_]=c.useState(null),m=c.useMemo(()=>Lw(n,t),[n,t]),C=Vo(n,m),T=c.useMemo(()=>zi(n),[n]),N=c.useMemo(()=>ls(m)?Is(m,T):Vt(m).replace(/^\.\/+/,""),[T,m]),R=c.useMemo(()=>Uo(ls(t)?t:m,T),[t,T,m]),k=us(m),M=w?jn(w,{columnNumber:o,filePath:m,lineEnd:r,lineNumber:s,viewMode:d}):null,$=w!==null?M:dt(_n({basePath:y,filePath:m,lineEnd:r,lineNumber:s,projectId:n,viewMode:d})),P=c.useMemo(()=>w?Js(w):void 0,[w]),F=c.useCallback(Z=>{if(g&&w===null){const ve=Es(s,r);Qo({id:x,kind:"file",sessionId:g,label:`${m}${ve}`,briefLabel:$t(m),filePath:m,lineSuffix:ve,supportsRightPane:!0,renderContent:(ie,Ve)=>a.jsx(Wt,{managedViewerId:x,inactive:ie,rightPane:Ve,quoteReply:p,projectId:n,filePath:m,lineNumber:s,lineEnd:r,viewMode:d,initialPresentation:Z,source:P,openInNewTabUrl:$},x)});return}S(Z),A(!0)},[$,r,s,x,n,w,P,g,p,d,m]),W=c.useCallback(Z=>{if(Z.stopPropagation(),!(Z.button!==0||Z.metaKey||Z.ctrlKey||Z.shiftKey||Z.altKey)){if(w&&!M){Z.preventDefault();return}Z.preventDefault(),F()}},[F,w,M]),D=c.useCallback(()=>{A(!1)},[]),V=c.useCallback(Z=>{Z.preventDefault(),Z.stopPropagation(),_({x:Z.clientX,y:Z.clientY})},[]),G=c.useCallback(()=>_(null),[]),J=c.useCallback(Z=>F(Z),[F]),K=c.useCallback(()=>{$&&_e(new URL($,window.location.href).href)},[$]),O=c.useCallback(()=>{const Z=P?P.loadFile(n,m,!1):oe.getFile(n,m);Ht(Z.then(ve=>ve.content??""))},[n,P,m]),Q=c.useCallback(()=>{const Z=P?P.loadFile(n,m,!0):oe.getFile(n,m,!0);rc(Z.then(ve=>Uc(m,ve)))},[n,P,m]),X=c.useCallback(()=>{const Z=$t(m);if(P!=null&&P.fetchRawFileBlob){P.loadFile(n,m,!1).then(ie=>{var Ve;return(Ve=P.fetchRawFileBlob)==null?void 0:Ve.call(P,ie,m,!0)}).then(ie=>{ie&&xn(ie,Z)}).catch(()=>{});return}const ve=new URLSearchParams({path:m,download:"true"});b.fetchBlob(`/projects/${n}/files/raw?${ve}`).then(ie=>xn(ie,Z)).catch(()=>{})},[n,P,b,m]),z=u?t:$t(t),j=i||z,he=Es(s,r),se=he&&o!==void 0&&r===void 0?`:${o}`:"",ce=`${he}${se}`,Re=l?ce:"",de=oc(`${t}${ce}`);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:bt.linkCluster,children:[a.jsxs("a",{href:$??"#",className:"file-path-link",onClick:W,onContextMenu:V,...de,children:[a.jsx("span",{className:"file-path-link-name",children:j}),Re&&a.jsx("span",{className:"file-path-link-line",children:Re})]}),f&&a.jsx(_w,{filePath:m}),w===null&&h&&a.jsx(kp,{className:bt.inlineDiffLinks,projectId:n,filePath:m})]}),v&&a.jsx(qo,{x:v.x,y:v.y,canStartNewSession:w===null,onClose:G,onOpen:()=>J(),onDownload:X,onOpenSource:k?()=>J("source"):void 0,onOpenPreview:k?()=>J("preview"):void 0,onStartNewSession:C,onCopyProjectRelativePath:N?()=>void _e(N):void 0,onCopyAbsolutePath:w===null&&R?()=>void _e(R):void 0,onCopyFilePath:!N&&!R?()=>void _e(m):void 0,onCopyViewerLink:$?K:void 0,onCopyContents:O,onCopyRenderedContents:k?Q:void 0}),L&&a.jsx(Wt,{projectId:n,filePath:m,lineNumber:s,lineEnd:r,viewMode:d,initialPresentation:E,source:P,openInNewTabUrl:$,onClose:D})]})});function Rw(e){return a.jsx(Wt,{...e})}function Wt({projectId:e,filePath:t,lineNumber:n,lineEnd:s,viewMode:r="full",initialPresentation:o,source:i,openInNewTabUrl:l,managedViewerId:u,inactive:d=!1,rightPane:f=!1,nestedViewer:h=!1,quoteReply:w,onClose:g}){const p=An(),y=c.useMemo(()=>p?Js(p):void 0,[p]),b=i??y,x=Os(),L=w??x,A=Ko(),E=Bc(),S=u===void 0&&(h||E!==null),v=f||S&&!!(E!=null&&E.target),_=u===void 0&&!S&&!!A&&p===null,m=Ts(),C=c.useId(),T=u??C,N=Dc(),R=!!(d||S&&(E!=null&&E.inactive)||(N==null?void 0:N.id)===T&&N.minimized),k=c.useRef(g);k.current=g;const M=c.useCallback(()=>{var K;if(u!==void 0){Oc(T);return}Ir(T),(K=k.current)==null||K.call(k)},[T,u]),$=c.useCallback(()=>Hc(T),[T]);c.useLayoutEffect(()=>{if(u!==void 0||S||p!==null)return;const K=Es(n,s);Qo({id:T,kind:"file",sessionId:A??(m==null?void 0:m.sessionId)??"",label:`${t}${K}`,briefLabel:$t(t),onClose:M,filePath:t,lineSuffix:K,..._?{supportsRightPane:!0,renderContent:(O,Q)=>a.jsx(Rw,{managedViewerId:T,inactive:O,rightPane:Q,quoteReply:L,projectId:e,filePath:t,lineNumber:n,lineEnd:s,viewMode:r,initialPresentation:o,source:b,openInNewTabUrl:l})}:{}})},[M,t,s,n,u,S,T,p,m==null?void 0:m.sessionId,A,_,e,r,o,b,l,L]),c.useEffect(()=>{if(!(u!==void 0||_||S))return()=>Ir(T)},[u,T,_,S]);const P=K=>{K.target===K.currentTarget&&M()},F=!_&&!R&&(!v||S||(N==null?void 0:N.id)===T);if(vc(M,F,"__fileViewerModal"),xc(M,F),bc(M,F),_)return null;const W=a.jsx(zg,{projectId:e,filePath:t,lineNumber:n,lineEnd:s,viewMode:r,initialPresentation:o,source:b,openInNewTabUrl:l,onClose:M,onMinimize:p===null&&!S?$:void 0,parentViewerId:u}),D=L?a.jsx(Ad,{onQuoteTextBlock:L,children:W}):W;if(v){const K=a.jsx(qr,{projectId:e,children:a.jsx("div",{className:`${bt.paneViewer} ${S?bt.nestedPaneViewer:""}`,...as,children:D})});return S&&(E!=null&&E.target)?tt.createPortal(K,E.target):K}const V=p===null?document.querySelector(".navigation-route-layer.is-active [data-session-viewer-layer]")??document.querySelector("[data-session-viewer-layer]"):null,G=a.jsx("div",{className:"modal-overlay","aria-hidden":R||void 0,style:R?{display:"none"}:void 0,onClick:P,onMouseDown:K=>K.stopPropagation(),children:a.jsx("dialog",{className:`modal file-viewer-modal ${bt.fileViewerModal} ${r==="range"?`file-viewer-modal-compact ${bt.fileViewerModalCompact}`:""}`,...as,open:!0,onClick:K=>K.stopPropagation(),children:D})}),J=p===null?V??document.querySelector(".navigation-route-layer.is-active .session-page")??document.querySelector(".session-page"):null;return tt.createPortal(p?G:a.jsx(qr,{projectId:e,children:G}),J??document.body)}const Mw=new RegExp(String.raw`\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1b\\)|[@-Z\\-_])`,"g");function Ee(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Et(e){return Ee(e).replaceAll(`
|
|
61
|
+
`," ")}function Zs(e){return e.replace(Mw,"")}function pn(e){return e.replace(/^[ab]\//,"")}function Aw(e){const t=e.replace(/\r\n/g,`
|
|
62
|
+
`).split(`
|
|
63
|
+
`);for(const n of t){const s=/^\+\+\+\s+(?!\/dev\/null)(?:[ab]\/)?(.+?)\s*$/.exec(n);if(s!=null&&s[1])return pn(s[1].trim())}for(const n of t){const s=/^---\s+(?!\/dev\/null)(?:[ab]\/)?(.+?)\s*$/.exec(n);if(s!=null&&s[1])return pn(s[1].trim())}for(const n of t){const s=/^diff --git\s+a\/(.+?)\s+b\/(.+?)\s*$/.exec(n);if(s!=null&&s[2])return pn(s[2].trim());if(s!=null&&s[1])return pn(s[1].trim())}}function jo(e){const t=[];for(const n of e.replace(/\\/g,"/").split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.join("/")}function jw(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||/^[a-z][a-z0-9+.-]*:/i.test(n))return null;const s=n.split(/[?#]/,1)[0]??"";if(!s)return null;if(s.startsWith("/"))return jo(s.slice(1));const r=t!=null&&t.includes("/")?t.slice(0,t.lastIndexOf("/")):"";return jo(r?`${r}/${s}`:s)}function Tw(e,t,n={}){const s=jw(t,n.baseFilePath);if(!s)return null;const r=Ee(e||t);if(!n.projectId)return{html:r,changed:!0};const i=(n.publicShare&&jn(n.publicShare,{filePath:s}))??dt(`${n.basePath??""}/projects/${encodeURIComponent(n.projectId)}/file?path=${encodeURIComponent(s)}`),l=`/${s}`,u=Ns(l,n.projectPath);return{html:`<a class="fixed-font-file-link" href="${Et(i)}" data-fixed-font-file-path="${Et(s)}" data-tooltip="${Et(u)}">${r}</a>`,changed:!0}}function To(e,t){var i;if(!t.projectId||!((i=t.projectPathLinks)!=null&&i.length))return{html:Ee(e),changed:!1};const n=new Map(t.projectPathLinks.map(l=>[l.text,l.filePath])),s=ll(e).filter(l=>n.has(l.text));if(s.length===0)return{html:Ee(e),changed:!1};let r="",o=0;for(const l of s){const u=n.get(l.text),d=t.publicShare?jn(t.publicShare,{filePath:u}):null;if(t.publicShare&&!d){r+=Ee(e.slice(o,l.end)),o=l.end;continue}r+=Ee(e.slice(o,l.start));const f=d??dt(`${t.basePath??""}/projects/${encodeURIComponent(t.projectId)}/file?path=${encodeURIComponent(u)}`),h=Ns(u,t.projectPath);r+=`<a class="fixed-font-file-link" href="${Et(f)}" data-fixed-font-file-path="${Et(u)}" data-tooltip="${Et(h)}">${Ee(l.text)}</a>`,o=l.end}return r+=Ee(e.slice(o)),{html:r,changed:!0}}function Ln(e,t){try{return qc.renderToString(e,{throwOnError:!1,displayMode:t,output:"htmlAndMathml",strict:"ignore",trust:!1})}catch{const n=t?`$$${e}$$`:`$${e}$`;return`<span class="fixed-font-math-error">${Ee(n)}</span>`}}function er(e,t){let n=0;for(let s=t-1;s>=0&&e[s]==="\\";s-=1)n+=1;return n%2===1}function Xi(e,t,n){let s=n;for(;s<e.length;){const r=e.indexOf(t,s);if(r<0||!er(e,r))return r;s=r+t.length}return-1}function Yi(e,t){const n=e.startsWith("$$",t)?{close:"$$",open:"$$"}:e.startsWith("\\[",t)&&!er(e,t)?{close:"\\]",open:"\\["}:null;if(!n)return null;const s=Xi(e,n.close,t+n.open.length);if(s<0)return null;const r=e.slice(t+n.open.length,s).trim();return r?{end:s+n.close.length,html:Ln(r,!0)}:null}function Ji(e,t){if(e.startsWith("\\(",t)&&!er(e,t)){const l=Xi(e,"\\)",t+2);if(l<0)return null;const u=e.slice(t+2,l).trim();return!u||u.includes(`
|
|
64
|
+
`)?null:{end:l+2,html:Ln(u,!1)}}if(e[t]!=="$")return null;const n=e[t+1];if(!n||/\s/.test(n))return null;let s=t+1;for(;s<e.length;){const l=e[s];if(l===`
|
|
65
|
+
`)return null;if(l==="$")break;s+=1}if(s>=e.length||e[s]!=="$")return null;const r=e[s-1];if(!r||/\s/.test(r))return null;const o=e[s+1];if(o&&(/\d/.test(o)||o==="$"))return null;const i=e.slice(t+1,s);return!i||!/[\\^{}+]/.test(i)&&!/\d/.test(i)?null:{end:s+1,html:Ln(i,!1)}}function Zi(e){return{chars:e.length,lines:e.length===0?0:e.split(`
|
|
66
|
+
`).length}}function ea(e){let t="",n=!1,s=0,r=0;for(;r<e.length;){const o=Yi(e,r),i=o?null:Ji(e,r),l=o??i;if(!l){r+=1;continue}t+=Ee(e.slice(s,r)),t+=l.html,n=!0,r=l.end,s=r}return t+=Ee(e.slice(s)),{html:t,changed:n}}function Iw(e,t={}){return fi("fixed-font-math",()=>({...Zi(e),diffAware:t.diffAware??!1}),()=>t.diffAware?Dw(e):ea(e))}function Nw(e){const t=e.replace(/\r\n/g,`
|
|
67
|
+
`).split(`
|
|
68
|
+
`);if(t.some(r=>r.startsWith("@@ "))||t.some(r=>r.startsWith("diff --git "))||t.some(r=>r.startsWith("--- "))&&t.some(r=>r.startsWith("+++ ")))return!0;let n=0,s=0;for(const r of t)r.startsWith("+")&&!r.startsWith("+++")&&(n+=1),r.startsWith("-")&&!r.startsWith("---")&&(s+=1);return n>0&&s>0&&n+s>=2}function ta(e,t){return t&&e.length>0&&(e[0]===" "||e[0]==="+"&&!e.startsWith("+++")||e[0]==="-"&&!e.startsWith("---"))?{prefix:e[0],content:e.slice(1)}:{prefix:"",content:e}}function ks(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.split("|").length>=4}function vn(e){return e.trim().slice(1,-1).split("|").map(n=>n.trim())}function is(e){if(!ks(e))return!1;const t=vn(e);return t.length>0&&t.every(n=>/^:?-{2,}:?$/.test(n.replace(/\s+/g,"")))}function Pw(e){const t=e.replace(/\s+/g,""),n=t.startsWith(":"),s=t.endsWith(":");return n&&s?"center":s?"right":n?"left":null}function ut(e,t={}){let n="",s=!1,r=0,o=0;const i=l=>{if(l>r){const u=To(e.slice(r,l),t);n+=u.html,u.changed&&(s=!0)}};for(;o<e.length;){const l=e[o];if(l==="`"){const w=e.indexOf("`",o+1);if(w>o+1){i(o);const g=To(e.slice(o+1,w),t);n+=`<code>${g.html}</code>`,s=!0,o=w+1,r=o;continue}}if(l==="["){const w=e.indexOf("]",o+1);if(w>o+1&&e[w+1]==="("){const g=e.indexOf(")",w+2);if(g>w+2){const p=e.slice(o+1,w),y=e.slice(w+2,g),b=Tw(p,y,t);if(b){i(o),n+=b.html,s=!0,o=g+1,r=o;continue}}}}const u=Yi(e,o),d=u?null:Ji(e,o),f=u??d;if(f){i(o),n+=f.html,s=!0,o=f.end,r=o;continue}const h=e.startsWith("**",o)?"**":e.startsWith("__",o)?"__":null;if(h){const w=e.indexOf(h,o+2);if(w>o+2){i(o);const g=ut(e.slice(o+2,w),t);n+=`<strong>${g.html}</strong>`,s=!0,o=w+2,r=o;continue}}o+=1}return i(e.length),{html:n,changed:s}}function _s(e){return e==="+"?"fixed-font-diff-added":e==="-"?"fixed-font-diff-removed":e===" "?"fixed-font-diff-context":""}function Ls(e){return`<span class="fixed-font-diff-gutter">${e===""||e===" "?" ":Ee(e)}</span>`}function $w(e,t,n={}){var g,p;const s=e[t],r=e[t+1];if(!s||!ks(s.content))return null;const o=!!r&&is(r.content);let i=o?t+2:t+1;for(;i<e.length&&ks(((g=e[i])==null?void 0:g.content)??"")&&!(i+1<e.length&&is(((p=e[i+1])==null?void 0:p.content)??""));)i+=1;if(!o&&i-t<2)return null;const l=o?vn(r.content).map(Pw):[],u=o?e.slice(t+2,i).filter(y=>!is(y.content)):e.slice(t,i),d=e.slice(t,i).some(y=>y.prefix!==""),f=(y,b,x)=>{const L=l[x],A=L?` style="text-align: ${L}"`:"";return`<${y}${A}>${ut(b,n).html}</${y}>`},h=o?(()=>{const y=vn(s.content).map((x,L)=>f("th",x,L)).join(""),b=d?`<th class="fixed-font-diff-gutter-cell">${Ls(s.prefix)}</th>`:"";return`<thead><tr class="${_s(s.prefix)}">${b}${y}</tr></thead>`})():"",w=u.map(y=>{const b=vn(y.content).map((L,A)=>f("td",L,A)).join(""),x=d?`<td class="fixed-font-diff-gutter-cell">${Ls(y.prefix)}</td>`:"";return`<tr class="${_s(y.prefix)}">${x}${b}</tr>`}).join("");return{end:i,html:`<div class="fixed-font-markdown-block"><table class="fixed-font-markdown-table">${h}<tbody>${w}</tbody></table></div>`}}function Fw(e,t,n){var f;if(n)return null;const r=(((f=e[t])==null?void 0:f.content.trim())??"").match(/^[\w.-]+\[(\d+)\]\{[^}]*\}:$/);if(!r)return null;const o=t+1+Number(r[1]);if(o>e.length)return null;const i=al(e.slice(t,o).map(h=>h.content).join(`
|
|
69
|
+
`)),l=(i==null?void 0:i.length)===1?i[0]:void 0;if(!l)return null;const u=`<thead><tr>${l.columns.map(h=>`<th>${Ee(h)}</th>`).join("")}</tr></thead>`,d=l.rows.map(h=>`<tr>${h.map(w=>`<td>${Ee(w)}</td>`).join("")}</tr>`).join("");return{end:o,html:`<div class="fixed-font-markdown-block"><table class="fixed-font-markdown-table">${u}<tbody>${d}</tbody></table></div>`}}function Bw(e,t={}){var l;const n=/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/.exec(e);if(n!=null&&n[1]&&n[2])return{html:ut(n[2],t).html,changed:!0,className:`fixed-font-markdown-heading fixed-font-markdown-heading-${n[1].length}`};if(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/.test(e))return{html:'<span class="fixed-font-markdown-rule" aria-hidden="true"></span>',changed:!0,className:"fixed-font-markdown-rule-line"};const s=/^\s{0,3}>\s?(.*)$/.exec(e);if(s)return{html:ut(s[1]??"",t).html,changed:!0,className:"fixed-font-markdown-blockquote"};const r=/^(\s*)([-*+]|\d+[.)])\s+(.+)$/.exec(e);if(r!=null&&r[2]&&r[3]){const u=((l=r[1])==null?void 0:l.length)??0,d=r[2].length+1;return{html:`<span class="fixed-font-markdown-list-marker">${/^\d/.test(r[2])?Ee(r[2]):"•"}</span><span class="fixed-font-markdown-list-body">${ut(r[3],t).html}</span>`,changed:!0,className:"fixed-font-markdown-list-line",style:`--fixed-font-list-indent-ch:${u};--fixed-font-list-marker-ch:${d};`}}const o=/^(\s+)(\S[\s\S]*)$/.exec(e);if(o!=null&&o[1]&&o[2]){const u=ut(o[2],t);return{html:`<span class="fixed-font-leading-indent" style="--fixed-font-leading-ch:${o[1].length};"></span>${u.html}`,changed:u.changed}}return ut(e,t)}function na(e,t,n){var u,d,f;const s=(u=e[t])==null?void 0:u.content.trim(),r=s==="$$"?"$$":s==="\\["?"\\]":null;if(!r)return null;let o=t+1;for(;o<e.length&&((d=e[o])==null?void 0:d.content.trim())!==r;)o+=1;if(o>=e.length)return null;const i=e.slice(t+1,o).map(h=>h.content).join(`
|
|
70
|
+
`).trim();if(!i)return null;const l=Ln(i,!0);if(n){const h=e.slice(t,o+1),w=((f=h[0])==null?void 0:f.prefix)??"";return h.some(g=>g.prefix!==w)?null:{end:o+1,html:tr({prefix:w},{className:"fixed-font-markdown-display-math",html:l})}}return{end:o+1,html:l}}function tr(e,t){const n=["fixed-font-rendered-line",_s(e.prefix),t.className].filter(Boolean).join(" "),s=t.style?` style="${t.style}"`:"";return`<div class="${n}">${Ls(e.prefix)}<div class="fixed-font-rendered-line__content"${s}>${t.html}</div></div>`}function Dw(e){const t=Zs(e).replace(/\r\n/g,`
|
|
71
|
+
`).split(`
|
|
72
|
+
`).map(o=>ta(o,!0));let n="",s=!1,r=0;for(;r<t.length;){const o=na(t,r,!0);if(o){n+=o.html,s=!0,r=o.end;continue}const i=t[r];if(!i){r+=1;continue}const l=ea(i.content);n+=tr(i,l),l.changed&&(s=!0),r+=1}return{html:n,changed:s}}function Ow(e,t={}){const n=Zs(e),s=t.baseFilePath??Aw(n),r=t.diffAware??Nw(n);if(!r&&Md(n).some(f=>f.kind!=="text"))return{html:Ee(n),changed:!1};const o={...t,baseFilePath:s},i=n.replace(/\r\n/g,`
|
|
73
|
+
`).split(`
|
|
74
|
+
`).map(f=>ta(f,r));let l="",u=!1,d=0;for(;d<i.length;){const f=na(i,d,r);if(f){l+=f.html,f.end<i.length&&(l+=`
|
|
75
|
+
`),u=!0,d=f.end;continue}const h=Fw(i,d,r);if(h){l+=h.html,u=!0,d=h.end;continue}const w=$w(i,d,o);if(w){l+=w.html,u=!0,d=w.end;continue}const g=i[d];if(!g){d+=1;continue}const p=Bw(g.content,o);p.changed&&(u=!0),r?l+=tr(g,p):(l+=p.html,d<i.length-1&&(l+=`
|
|
76
|
+
`)),d+=1}return{html:l,changed:u}}function Rn(e,t={}){return fi("fixed-font-rich-content",()=>({...Zi(e),diffAware:t.diffAware??null,hasProjectId:!!t.projectId,hasBaseFilePath:!!t.baseFilePath}),()=>Ow(e,t))}function Hw(e,t){return t==="themed"?e:e.replace(/ data-tooltip="([^"]*)"/g,(n,s)=>` title="${s}"`)}function Ny({sourceText:e,sourceView:t,renderRenderedView:n,diffAware:s,baseFilePath:r,initialMode:o,precomputedRendered:i,renderMode:l="rich",projectPathLinks:u}){const d=Ts(),f=An(),h=Lt(),w=ic(),g=ni(r),[p,y]=c.useState(null),b=c.useRef(null),x=c.useMemo(()=>Zs(e),[e]),L=c.useMemo(()=>f?Js(f):void 0,[f]),A=c.useMemo(()=>i??(l==="math"?Iw(e,{diffAware:s}):Rn(e,{diffAware:s,projectId:d==null?void 0:d.projectId,projectPath:(d==null?void 0:d.projectPath)??void 0,baseFilePath:r,basePath:h,publicShare:f,projectPathLinks:u})),[i,e,l,s,d==null?void 0:d.projectId,d==null?void 0:d.projectPath,r,h,f,u]),{showRendered:E,toggleLocalMode:S}=wd(A.changed,{initialMode:o,renderWhenDisabled:!1,resetDependencies:[e,l]}),{btnRef:v,handleClick:_}=_d(E,S),m=c.useMemo(()=>{var k;const R=Hw(A.html,w);return ii(R,g.state==="ready"&&((k=g.result)==null?void 0:k.status)==="ready"?g.result.artifact:void 0).html},[g,A.html,w]);c.useEffect(()=>{const R=b.current;if(!(!R||!x.trim()))return Do(R,x)},[x]);const C=c.useCallback(R=>{var M,$;const k=($=(M=R.target)==null?void 0:M.closest)==null?void 0:$.call(M,"a[data-fixed-font-file-path]");k&&(R.button!==0||R.metaKey||R.ctrlKey||R.shiftKey||R.altKey||(R.preventDefault(),R.stopPropagation(),y({filePath:k.dataset.fixedFontFilePath??"",href:k.getAttribute("href")})))},[]),T=c.useCallback(R=>{const k=b.current,M=k?Mn(k).map(P=>P.markdown).join(`
|
|
77
|
+
|
|
78
|
+
`):"";Vc(R.nativeEvent,R.currentTarget)&&M&&R.clipboardData.setData("text/plain",M)},[]),N=(d==null?void 0:d.projectId)??(f==null?void 0:f.projectId)??"";return a.jsxs("div",{ref:b,className:"fixed-font-render-toggle","data-render-mode":E&&A.changed?"rendered":"source",children:[E&&A.changed?a.jsx("div",{onClick:C,onCopy:T,children:n(m)}):t,A.changed&&a.jsx("button",{ref:v,type:"button",className:`fixed-font-render-toggle__button ${E?"is-rendered":""}`,onClick:_,"aria-label":E?"Show source":"Show rendered view",title:E?"Show source":"Show rendered view","aria-pressed":E,children:a.jsx(_u,{})}),p&&N!==""&&a.jsx(Wt,{projectId:N,filePath:p.filePath,source:L,openInNewTabUrl:p.href,onClose:()=>y(null)})]})}function Uw(){return a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:[a.jsx("path",{d:"M21 11a9 9 0 0 1-9 9 10 10 0 0 1-4-.9L3 21l1.8-5A9 9 0 1 1 21 11Z"}),a.jsx("path",{d:"M9.6 8a2.5 2.5 0 0 1 4.8 1c0 1.7-2.4 1.7-2.4 3.5M12 15h.01"})]})}function Vw({question:e,showDismissed:t,state:n}){var h,w;const{t:s}=Ue(),[r,o]=c.useState(!1),i=c.useRef(null),l=c.useRef(!1),u=()=>{i.current&&clearTimeout(i.current),i.current=null};c.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const d=((h=n.records[e.id])==null?void 0:h.dismissed)===!0,f=()=>{n.update(e.id,{dismissed:!d}),o(!1)};return a.jsxs("li",{className:Y.menuRow,children:[a.jsx("span",{className:Y.turnAge,role:"img","aria-label":s("asyncQuestionTurnsAgo",{count:e.age}),children:e.age}),a.jsxs("div",{className:Y.previewBox,children:[a.jsxs("button",{type:"button",className:Y.preview,title:e.title,"aria-label":e.title,onClick:()=>{if(l.current){l.current=!1;return}n.open(e)},onContextMenu:g=>{g.preventDefault(),u(),o(!0)},onTouchStart:()=>{l.current=!1,u(),i.current=setTimeout(()=>{l.current=!0,o(!0)},450)},onTouchMove:u,onTouchEnd:u,onTouchCancel:u,children:[a.jsx("span",{className:Y.previewText,children:e.title}),!((w=n.records[e.id])!=null&&w.seen)&&a.jsx("span",{className:Y.unseen,role:"img","aria-label":s("asyncQuestionUnseen")})]}),a.jsx("button",{type:"button",className:Y.dismiss,onClick:f,"aria-label":s(d?"asyncQuestionRestore":"asyncQuestionDismiss",{question:e.title}),children:d&&t?"↶":"×"}),r&&a.jsx("div",{className:Y.rowMenu,role:"menu",children:a.jsx("button",{type:"button",role:"menuitem",onClick:f,children:s(d?"asyncQuestionRestoreShort":"asyncQuestionDismissShort")})})]})]})}function Py({overflow:e=!1,compact:t="none",inventory:n,groupTitles:s,omitted:r=!1}){const o=Fs(),i=n??o,{t:l}=Ue(),u=c.useRef(null),d=c.useRef(null),f=c.useRef(null),[h,w]=c.useState(!1),[g,p]=c.useState(!1),[y,b]=c.useState(!1),[x,L]=c.useState({left:8,bottom:0,width:360,maxHeight:400}),A=(i==null?void 0:i.questions.filter(R=>!Ps(i.records[R.id])))??[],E=A.filter(R=>{var k;return y||!((k=i==null?void 0:i.records[R.id])!=null&&k.dismissed)}),S=A.filter(R=>{var k;return!((k=i==null?void 0:i.records[R.id])!=null&&k.dismissed)}),v=S.filter(R=>{var k;return bn(R.age,((k=i==null?void 0:i.records[R.id])==null?void 0:k.edits)??0,i==null?void 0:i.reminderTurns)==="recent"}),_=S.every(R=>{var k;return bn(R.age,((k=i==null?void 0:i.records[R.id])==null?void 0:k.edits)??0,i==null?void 0:i.reminderTurns)==="retired"}),m=v.reduce((R,k)=>!R||k.age<=R.age?k:R,void 0),C=i==null?void 0:i.setMenuOpen,T=()=>{w(!1),C==null||C(!1)};if(c.useLayoutEffect(()=>{if(!h)return;const R=()=>{var F;const k=(F=u.current)==null?void 0:F.getBoundingClientRect();if(!k)return;const M=Math.min(520,window.innerWidth-16),$=!!n&&window.innerHeight-k.bottom>Math.min(280,k.top),P=$?window.innerHeight-k.bottom-14:k.top-16;L({left:Math.max(8,Math.min(k.right-M,window.innerWidth-M-8)),...$?{top:k.bottom+6}:{bottom:window.innerHeight-k.top+6},width:M,maxHeight:Math.max(100,Math.min(400,P))})};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[h,n]),c.useLayoutEffect(()=>{var k,M;if(!h)return;f.current&&(f.current.scrollTop=f.current.scrollHeight);const R=(k=d.current)==null?void 0:k.querySelectorAll(`button.${Y.preview}`);(M=R==null?void 0:R[R.length-1])==null||M.focus({preventScroll:!0})},[h]),c.useEffect(()=>{if(!h)return;const R=M=>{var $,P;!(M.target instanceof Node)||($=d.current)!=null&&$.contains(M.target)||(P=u.current)!=null&&P.contains(M.target)||(w(!1),C==null||C(!1))},k=M=>{var $;M.key==="Escape"&&(M.preventDefault(),w(!1),C==null||C(!1),($=u.current)==null||$.focus({preventScroll:!0}))};return document.addEventListener("pointerdown",R),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",R),document.removeEventListener("keydown",k)}},[h,C]),c.useEffect(()=>{(i==null?void 0:i.menuOpen)===!1&&w(!1)},[i==null?void 0:i.menuOpen]),!i||i.reminderTurns===0||i.questions.length===0||!e&&_&&!h&&!g)return null;const N=m?`${l(v.length===1?"asyncQuestionSingle":"asyncQuestionCount",{count:v.length})} · ${l(m.age===1?"asyncQuestionOneTurnAgo":"asyncQuestionTurnsAgo",{count:m.age})}`:l("asyncQuestionsTitle");return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:u,onFocus:()=>p(!0),onBlur:()=>p(!1),type:"button",className:`${Y.indicator} ${v.length?Y.recent:""} ${e?Y.overflowEntry:""}`,"aria-label":N,title:N,"aria-expanded":h,"aria-haspopup":"dialog",role:e?"menuitem":void 0,onClick:()=>{w(!h),C==null||C(!h)},onContextMenu:R=>{R.preventDefault(),R.stopPropagation(),w(!0),C==null||C(!0)},children:[a.jsx(Uw,{}),m&&!e?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:v.length}),t!=="late"&&a.jsx("span",{children:l(v.length===1?"asyncQuestionWord":"asyncQuestionsWord")}),t==="none"&&a.jsxs("span",{children:["·"," ",l(m.age===1?"asyncQuestionOneTurnAgo":"asyncQuestionTurnsAgo",{count:m.age})]})]}):t!=="late"&&a.jsx("span",{children:l("asyncQuestionsTitle")})]}),h&&tt.createPortal(a.jsxs("div",{ref:d,className:Y.menu,style:x,role:"dialog","aria-label":l("asyncQuestionsTitle"),onKeyDown:R=>{var $,P;if(R.key!=="ArrowDown"&&R.key!=="ArrowUp")return;const k=[...(($=d.current)==null?void 0:$.querySelectorAll(`button.${Y.preview}`))??[]],M=k.indexOf(document.activeElement);k.length&&(R.preventDefault(),(P=k[(M+(R.key==="ArrowDown"?1:-1)+k.length)%k.length])==null||P.focus())},children:[a.jsxs("div",{className:Y.menuHeading,children:[a.jsx("strong",{children:l("asyncQuestionsTitle")}),a.jsx("button",{type:"button",className:Y.dismiss,"aria-label":l("asyncQuestionCloseMenu"),onClick:T,children:"×"})]}),a.jsx("ul",{ref:f,className:Y.questionList,children:E.map((R,k)=>{var M,$,P;return a.jsxs(c.Fragment,{children:[(s==null?void 0:s.has(R.id))&&(k===0||((M=s.get(E[k-1].id))==null?void 0:M.id)!==(($=s.get(R.id))==null?void 0:$.id))&&a.jsx("li",{className:Y.groupHeading,children:(P=s.get(R.id))==null?void 0:P.title}),a.jsx(Vw,{question:R,showDismissed:y,state:{...i,open:F=>{T(),i.open(F)}}})]},R.id)})}),E.length===0&&a.jsx("p",{children:l("asyncQuestionsNone")}),r&&a.jsx("p",{className:Y.hint,children:l("asyncQuestionsEarlierOmitted")}),a.jsx("button",{type:"button",className:Y.secondary,onClick:()=>b(!y),children:l(y?"asyncQuestionHideDismissed":"asyncQuestionShowDismissed")})]}),document.body)]})}function qw({question:e}){const t=Fs(),{t:n}=Ue(),s=c.useRef(null),[r,o]=c.useState(!1),i=t.records[e.id],l=t.activeId===e.id,u=t.submittingId===e.id,d=Ps(i),f=t.update,h=c.useMemo(()=>Rn(e.title,{diffAware:!1}).html,[e.title]);c.useEffect(()=>{if(i!=null&&i.seen||!s.current)return;let g=!1;const p=()=>{g&&!document.hidden&&f(e.id,{seen:!0})},y=new IntersectionObserver(([b])=>{g=((b==null?void 0:b.intersectionRatio)??0)>=.6,p()},{threshold:.6});return y.observe(s.current),document.addEventListener("visibilitychange",p),()=>{y.disconnect(),document.removeEventListener("visibilitychange",p)}},[e.id,i==null?void 0:i.seen,f]);const w=async g=>{o(!1);try{await t.submit(e,g)||o(!0)}catch{o(!0)}};return a.jsxs("div",{className:`${Y.inlineQuestion} ${l?Y.activeQuestion:""}`,"data-async-question-reply":e.id,children:[a.jsx("div",{ref:s,children:a.jsx(Ds,{className:Y.questionTitle,html:h})}),e.options.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:Y.hint,children:n("asyncQuestionClickToSend")}),a.jsx("ul",{className:Y.options,children:e.options.map((g,p)=>a.jsx("li",{children:a.jsxs("button",{type:"button",disabled:u||d,onClick:()=>void w(g),children:[a.jsx("span",{"aria-hidden":"true",children:"•"}),a.jsx("span",{children:g})]})},`${p}:${g}`))})]}),d?a.jsx("p",{className:Y.sent,children:i!=null&&i.quoted?n("asyncQuestionReplyQuoted"):n("asyncQuestionReplySent",{answer:i.answer})}):a.jsxs(a.Fragment,{children:[!l&&a.jsx("button",{type:"button",className:Y.secondary,onClick:()=>t.open(e),children:n("asyncQuestionReply")}),l&&a.jsxs("form",{className:Y.replyForm,onSubmit:g=>{g.preventDefault(),!(u||!(i!=null&&i.draft.trim()))&&w((i==null?void 0:i.draft)??"")},children:[a.jsx("textarea",{rows:3,value:(i==null?void 0:i.draft)??"","aria-label":n("asyncQuestionReplyTo",{question:e.title}),placeholder:n("asyncQuestionReplyPlaceholder"),readOnly:u,onKeyDown:g=>{var p;g.key!=="Enter"||g.shiftKey||g.nativeEvent.isComposing||g.keyCode===229||(g.preventDefault(),g.repeat||(p=g.currentTarget.form)==null||p.requestSubmit())},onChange:g=>f(e.id,{draft:g.target.value})}),a.jsxs("div",{className:Y.replyActions,children:[a.jsx("button",{type:"button",className:`${Y.secondary} ${Y.iconAction}`,onClick:t.returnToPrevious,"aria-label":n("asyncQuestionBack"),title:n("asyncQuestionBack"),children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"m10 5-7 7 7 7M3 12h18"})})}),a.jsx("button",{type:"submit",className:Y.send,disabled:u||!(i!=null&&i.draft.trim()),children:n(u?"asyncQuestionSending":"asyncQuestionSend")})]})]}),a.jsx("button",{type:"button",className:`${Y.secondary} ${Y.iconAction}`,onClick:()=>t.quote(e),"aria-label":n("asyncQuestionQuoteMain"),title:n("asyncQuestionQuoteMain"),children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"m10 8 4 4-4 4"})]})})]}),r&&a.jsx("p",{role:"alert",className:Y.error,children:n("asyncQuestionSendFailed")})]})}function $y({renderId:e,fallback:t}){const n=Fs(),s=(n==null?void 0:n.questions.filter(r=>r.renderId===e))??[];return s.length?a.jsx(a.Fragment,{children:s.map(r=>a.jsx(qw,{question:r},r.id))}):t}const sa=1600,Fy=`${sa}px 0px`;function By(e,t=sa){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}const Ww=180*1e3;function Dy(e,t,n,s){return`${e.replace(/\/$/,"")}/projects/${t}/sessions/${n}/agents/${encodeURIComponent(s)}`}function Oy(e,t){return e.title||e.agentType||t}function Hy(...e){for(const t of e)if(t)return t;return[]}const Kw=300*1e3;function Uy(e){const t=new Map;let n=Number.NEGATIVE_INFINITY;for(const s of e){const r=Date.parse(s.updatedAt);Number.isFinite(r)&&r>n&&(n=r)}for(const s of e){const r=Date.parse(s.updatedAt);if(!Number.isFinite(r)||n===Number.NEGATIVE_INFINITY){t.set(s.id,"older");continue}const o=n-r;t.set(s.id,o===0?"latest":o<Kw?"recent":"older")}return t}function Vy(e,t,n=Date.now()){return t!=="in-turn"?0:e.filter(s=>{const r=Date.parse(s.updatedAt);return!Number.isNaN(r)&&n-r<Ww}).length}export{uy as $,Py as A,jd as B,th as C,Qs as D,bh as E,zg as F,qr as G,kh as H,Jn as I,Sh as J,Fm as K,tl as L,Ds as M,Ks as N,Dt as O,Cy as P,tf as Q,_u as R,_f as S,cm as T,Sy as U,vy as V,xy as W,My as X,Ay as Y,Ti as Z,io as _,fu as a,wo as a$,Em as a0,km as a1,Gd as a2,vh as a3,yi as a4,yy as a5,Vs as a6,my as a7,fy as a8,hy as a9,Jc as aA,cy as aB,ly as aC,_y as aD,Kh as aE,ky as aF,Ly as aG,ni as aH,ii as aI,Xu as aJ,wd as aK,Fg as aL,Fu as aM,Wt as aN,Iy as aO,_w as aP,fi as aQ,Md as aR,Ny as aS,Ag as aT,Rn as aU,Ld as aV,kp as aW,Lw as aX,ws as aY,ts as aZ,hi as a_,Cl as aa,zp as ab,Ty as ac,Qp as ad,jy as ae,Gp as af,So as ag,bo as ah,Vp as ai,qp as aj,Wp as ak,Kp as al,$i as am,$h as an,Ih as ao,Uy as ap,um as aq,Cm as ar,By as as,Cu as at,Hy as au,Vy as av,Ry as aw,wy as ax,gy as ay,iy as az,Ey as b,Ai as b0,_d as b1,od as b2,ay as b3,ry as b4,oy as b5,Fy as b6,$y as b7,Si as c,Hf as d,Eh as e,Ch as f,Yh as g,ll as h,Dy as i,xl as j,Ll as k,py as l,lo as m,yw as n,ro as o,Oy as p,gd as q,Iw as r,dy as s,Fs as t,Ci as u,tm as v,by as w,Ad as x,Cd as y,Hd as z};
|