@inkeep/open-knowledge 0.38.4 → 0.39.0-beta.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.
Files changed (182) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +6 -7
  2. package/dist/{acp-harness-probe-BdmNFu8L.mjs → acp-harness-probe-BtCFgpt9.mjs} +2 -2
  3. package/dist/assets/skills/discovery/SKILL.md +1 -1
  4. package/dist/assets/skills/project/SKILL.md +1 -1
  5. package/dist/assets/skills/write-skill/SKILL.md +1 -1
  6. package/dist/cli.mjs +64 -62
  7. package/dist/constants-geQohyDW.mjs +2 -0
  8. package/dist/fs-traced-DOXZOlKx.mjs +1 -0
  9. package/dist/{fs-traced-B-qtPUmb.mjs → fs-traced-vMO6kYgZ.mjs} +2 -2
  10. package/dist/{git-handle-DnLoe9hy.mjs → git-handle-B30Z3S49.mjs} +2 -2
  11. package/dist/git-handle-RhB108wn.mjs +1 -0
  12. package/dist/index.mjs +1 -1
  13. package/dist/{init-BWhBsLIZ.mjs → init-BDsdA_o5.mjs} +5 -5
  14. package/dist/init-UpwZfJC9.mjs +1 -0
  15. package/dist/{launch-json-removal-BsMbCWYS.mjs → launch-json-removal-DvHJ0pIl.mjs} +2 -2
  16. package/dist/{loader-DO3qjQDp.mjs → loader-Cvfiqwbx.mjs} +2 -2
  17. package/dist/loader-D5j7kLJN.mjs +1 -0
  18. package/dist/{logger-CuGHGn_E.mjs → logger-B7Z8XO-z.mjs} +2 -2
  19. package/dist/md-manager-DqdW_K1F.mjs +2 -0
  20. package/dist/{open-browser-Bbzq7Z7d.mjs → open-browser-BAGk1RTK.mjs} +2 -2
  21. package/dist/parse-worker.mjs +1 -1
  22. package/dist/{preview-C1DTZkXE.mjs → preview-DlS48lyQ.mjs} +2 -2
  23. package/dist/preview-MJbgqGrR.mjs +1 -0
  24. package/dist/public/assets/{ActivityModeContent-CQTRie_S.js → ActivityModeContent-D7IDAADR.js} +1 -1
  25. package/dist/public/assets/{AgentDiffPane-ZsuLVO9W.js → AgentDiffPane-CKdCEnqD.js} +1 -1
  26. package/dist/public/assets/{AgentThreadClientBinder-poPjsQXP.js → AgentThreadClientBinder-CBCAdG4p.js} +1 -1
  27. package/dist/public/assets/{AppMenubar-DqlpmcU7.js → AppMenubar-hPGBtMtR.js} +1 -1
  28. package/dist/public/assets/{CodeMirrorPropInput-DUwQlljh.js → CodeMirrorPropInput-DqNDfEnD.js} +3 -3
  29. package/dist/public/assets/{DocumentContext-CPZffvoA.js → DocumentContext-C4Ar5jL6.js} +2 -2
  30. package/dist/public/assets/{EnableSyncConfirmDialog-BfZ_iVD2.js → EnableSyncConfirmDialog-DrkGGVev.js} +1 -1
  31. package/dist/public/assets/{FeedbackForm-BUn96JmL.js → FeedbackForm-CXXvUOWy.js} +1 -1
  32. package/dist/public/assets/{GraphPanel-BjCltqW1.js → GraphPanel-CG7ehFyf.js} +1 -1
  33. package/dist/public/assets/{ManagedArtifactProperties-CHmkRShb.js → ManagedArtifactProperties-C2eNyJKF.js} +1 -1
  34. package/dist/public/assets/{McpConsentDialogBody-B0VkhB1e.js → McpConsentDialogBody-BEu_w4lu.js} +1 -1
  35. package/dist/public/assets/{MermaidDocEditor-cedDjA-A.js → MermaidDocEditor-P9f8X7tU.js} +1 -1
  36. package/dist/public/assets/PropertyPanel-Bmem71bg.js +2 -0
  37. package/dist/public/assets/{ReportBugDialogBody-hPmCfQyc.js → ReportBugDialogBody--5aXNg8I.js} +1 -1
  38. package/dist/public/assets/{SettingsDialogBody-B6_psJil.js → SettingsDialogBody-DzDGWXMf.js} +1 -1
  39. package/dist/public/assets/{ShareBranchSwitchDialog-GXTPAgND.js → ShareBranchSwitchDialog-Dz3x9STZ.js} +1 -1
  40. package/dist/public/assets/{ShareReceiveDialog-IVAS4xf8.js → ShareReceiveDialog-B4PVwjNG.js} +1 -1
  41. package/dist/public/assets/{ShareReceiveMissDialog-ClkBICGx.js → ShareReceiveMissDialog-ByUnHZEP.js} +1 -1
  42. package/dist/public/assets/{SkillEditorActions-BEtnBlep.js → SkillEditorActions-Dr52b0PZ.js} +1 -1
  43. package/dist/public/assets/{SourceEditor-Bp45kdTW.js → SourceEditor-HYrhk_fF.js} +1 -1
  44. package/dist/public/assets/{TerminalPanel-CUoZt7C0.js → TerminalPanel-BpSo4w0_.js} +1 -1
  45. package/dist/public/assets/{TerminalSessionsHost-CNebjNFj.js → TerminalSessionsHost-DtGNhWg4.js} +2 -2
  46. package/dist/public/assets/{TerminalWindowApp-B6bT25Jw.js → TerminalWindowApp-DWqRcNhK.js} +1 -1
  47. package/dist/public/assets/{ThreadView-CmIHLGuV.js → ThreadView-CHP5Ra30.js} +1 -1
  48. package/dist/public/assets/{TimelineDiffPane-DffKOwf1.js → TimelineDiffPane-Cc8rHqoV.js} +1 -1
  49. package/dist/public/assets/{abnfDiagram-VRR7QNED-VSTZcs2U.js → abnfDiagram-VRR7QNED-D9F9DXsr.js} +1 -1
  50. package/dist/public/assets/{agent-diff-store-D6N0WX_4.js → agent-diff-store-Bd0NDaYd.js} +1 -1
  51. package/dist/public/assets/{agent-visibility-Z2AQQ5Ce.js → agent-visibility-bo7-lQPw.js} +1 -1
  52. package/dist/public/assets/architecture-TIHT7OUA-B1GVwxkr.js +1 -0
  53. package/dist/public/assets/{architectureDiagram-ZJ3FMSHR-CdM-QQxh.js → architectureDiagram-ZJ3FMSHR-DfsVDv0h.js} +1 -1
  54. package/dist/public/assets/{auth-state-cache-CfU3gJ3i.js → auth-state-cache-UUKRA6mi.js} +1 -1
  55. package/dist/public/assets/{chunk-5FCAYU7R-NiUcHUPk.js → chunk-5FCAYU7R-BZbSx9vA.js} +1 -1
  56. package/dist/public/assets/{chunk-5HE753X5-Dg-RP8eS.js → chunk-5HE753X5-B2Flc7i4.js} +1 -1
  57. package/dist/public/assets/{chunk-5JV3BV7I-B4O-mi81.js → chunk-5JV3BV7I-B6P7lOib.js} +1 -1
  58. package/dist/public/assets/{chunk-5TONJI2A-0kIjpsBw.js → chunk-5TONJI2A-Bx2IxKM5.js} +1 -1
  59. package/dist/public/assets/{chunk-BIQX33UG-D48fi9B_.js → chunk-BIQX33UG-BK09YW6f.js} +1 -1
  60. package/dist/public/assets/{chunk-CQNSW5MT-v0U-WvYg.js → chunk-CQNSW5MT-BAtlNSBX.js} +1 -1
  61. package/dist/public/assets/{chunk-CYSBUYHQ-DxqLAiLc.js → chunk-CYSBUYHQ-D8hsDORv.js} +1 -1
  62. package/dist/public/assets/{chunk-EMLP6XTP-CJ9U9-wH.js → chunk-EMLP6XTP-ChQSYJxh.js} +1 -1
  63. package/dist/public/assets/{chunk-JG7HCLWE-C-1xmmk6.js → chunk-JG7HCLWE-Biog_J3i.js} +1 -1
  64. package/dist/public/assets/{chunk-MOZMSUNE-C1Vt9ku6.js → chunk-MOZMSUNE-CPb1eEls.js} +1 -1
  65. package/dist/public/assets/{chunk-OSBZ3O6U-C6W744Of.js → chunk-OSBZ3O6U-DLOl9lpV.js} +1 -1
  66. package/dist/public/assets/{chunk-QBLGF6JB-gEqmaH-L.js → chunk-QBLGF6JB-CXHeFNVR.js} +1 -1
  67. package/dist/public/assets/{chunk-R7FJI6CG-BDAk393G.js → chunk-R7FJI6CG-C16CHt3a.js} +1 -1
  68. package/dist/public/assets/{chunk-U6XO7XAA-BrFJStxD.js → chunk-U6XO7XAA-DbjPtJON.js} +1 -1
  69. package/dist/public/assets/{chunk-YOTPTUD7-D0J4uIcv.js → chunk-YOTPTUD7-CI44npHy.js} +1 -1
  70. package/dist/public/assets/client-version-Ti93fR_U.js +1 -0
  71. package/dist/public/assets/{config-provider-DstRVgzH.js → config-provider-BMeRatQe.js} +1 -1
  72. package/dist/public/assets/cynefin-VYW2F7L2-IoPsg8uT.js +1 -0
  73. package/dist/public/assets/{cynefinDiagram-TSTJHNR4-BSgy8cxo.js → cynefinDiagram-TSTJHNR4-BerNcsRY.js} +1 -1
  74. package/dist/public/assets/{diagram-FQU43EPY-CMvIHgbq.js → diagram-FQU43EPY-Bn3pI3fo.js} +1 -1
  75. package/dist/public/assets/{diagram-G47NLZAW-fKFf9jF_.js → diagram-G47NLZAW-DlmHXzE8.js} +1 -1
  76. package/dist/public/assets/{diagram-NH7WQ7WH-B7-_M2pB.js → diagram-NH7WQ7WH-DSU5C3aY.js} +1 -1
  77. package/dist/public/assets/{diagram-OA4YK3LP-DZtbNsi6.js → diagram-OA4YK3LP-BxczHUUr.js} +1 -1
  78. package/dist/public/assets/{diagram-WEI45ONY-CCuX-lrB.js → diagram-WEI45ONY-9RfHZ21T.js} +1 -1
  79. package/dist/public/assets/{dist-DKsN2Ojq.js → dist-2zkQMrQC.js} +1 -1
  80. package/dist/public/assets/dist-DfKVxirz.js +124 -0
  81. package/dist/public/assets/{dist-Vm1kQiqo.js → dist-df-v6kvy.js} +64 -64
  82. package/dist/public/assets/{doc-hash-B8kD24Kw.js → doc-hash-NyLrtNo2.js} +1 -1
  83. package/dist/public/assets/{documents-events-DQ6Iario.js → documents-events-BHJB8gGz.js} +1 -1
  84. package/dist/public/assets/{ebnfDiagram-CCIWWBDH-lTULSp5K.js → ebnfDiagram-CCIWWBDH-D2xzvzqw.js} +1 -1
  85. package/dist/public/assets/eventmodeling-45OFAUF4-Miu5EHpe.js +1 -0
  86. package/dist/public/assets/{file-tree-adapter-eftmn56d.js → file-tree-adapter-BnZwo5Ls.js} +1 -1
  87. package/dist/public/assets/gitGraph-TEB2WS4Q-OmjugmYN.js +1 -0
  88. package/dist/public/assets/{gitGraphDiagram-IHSO6WYX-DST3agGX.js → gitGraphDiagram-IHSO6WYX-LRtYXzVh.js} +1 -1
  89. package/dist/public/assets/index-CJ7E0pG6.css +1 -0
  90. package/dist/public/assets/{index-XkYGz2OG.js → index-WhmMzp-C.js} +97 -97
  91. package/dist/public/assets/info-DKCQHKI2-BNI5cXhn.js +1 -0
  92. package/dist/public/assets/{infoDiagram-FWYZ7A6U-Cj1rH5Ql.js → infoDiagram-FWYZ7A6U-CoQbECuU.js} +1 -1
  93. package/dist/public/assets/{keyboard-shortcuts-DZ9kTSZ4.js → keyboard-shortcuts-Ctc7xams.js} +1 -1
  94. package/dist/public/assets/{lint-config-client-Bg-6mquJ.js → lint-config-client-BwIg_Zty.js} +1 -1
  95. package/dist/public/assets/{mermaid-parser.core-BO-Jr815.js → mermaid-parser.core-3Xu6H-xr.js} +2 -2
  96. package/dist/public/assets/{mermaid.core-BQ2yyMHt.js → mermaid.core-BgfUsmdk.js} +3 -3
  97. package/dist/public/assets/{navigation-targets-4J3F85tT.js → navigation-targets-D1rdXyAI.js} +1 -1
  98. package/dist/public/assets/{open-managed-artifact-tab-ze9HkqWn.js → open-managed-artifact-tab-MjzvjrV8.js} +1 -1
  99. package/dist/public/assets/packet-7NZHBO7P-B_5BB2Lm.js +1 -0
  100. package/dist/public/assets/{pegDiagram-2B236MQR-VQ3qdS5Z.js → pegDiagram-2B236MQR-BWoigFVh.js} +1 -1
  101. package/dist/public/assets/{pending-receive-nav-store-CVDTioM4.js → pending-receive-nav-store-XNS4eahL.js} +1 -1
  102. package/dist/public/assets/pie-RZYD4A2V-DN_XCApP.js +1 -0
  103. package/dist/public/assets/{pieDiagram-ENE6RG2P-B5fNaqzS.js → pieDiagram-ENE6RG2P-CkC6m5hO.js} +1 -1
  104. package/dist/public/assets/{prop-types-B0l6ZN6O.js → prop-types-C0wWXvTx.js} +1 -1
  105. package/dist/public/assets/radar-I7S5WNFK-KdS1Y0nk.js +1 -0
  106. package/dist/public/assets/railroad-3IZDKUUU-CargXMo2.js +1 -0
  107. package/dist/public/assets/railroad-abnf-AHOZXSZD-rKz-719h.js +1 -0
  108. package/dist/public/assets/railroad-ebnf-EBAXGLYW-BwxcIuUm.js +1 -0
  109. package/dist/public/assets/railroad-peg-LSFZ7HO6-D-qfZOX5.js +1 -0
  110. package/dist/public/assets/{railroadDiagram-RFXS5EU6-hi-XN2Rm.js → railroadDiagram-RFXS5EU6-DFdEG7eg.js} +1 -1
  111. package/dist/public/assets/{receive-store-jfaprLyZ.js → receive-store-B3ygF-LA.js} +1 -1
  112. package/dist/public/assets/{selection-context-BpEA0WhV.js → selection-context-z7qCoarT.js} +1 -1
  113. package/dist/public/assets/{skill-actions-s_ATobEI.js → skill-actions-DeZSwOo7.js} +1 -1
  114. package/dist/public/assets/{skills-api-CYoD9FQt.js → skills-api-vt4KnCX6.js} +1 -1
  115. package/dist/public/assets/{src-B-pNk3y3.js → src-BlUYczaV.js} +1 -1
  116. package/dist/public/assets/{target-navigation-intent-95GTKrco.js → target-navigation-intent-DNrmu8Sx.js} +1 -1
  117. package/dist/public/assets/{telemetry-impl-BgQUPJ0t.js → telemetry-impl-ThDnRQ01.js} +1 -1
  118. package/dist/public/assets/{telemetry-startup-DcvNN2rn.js → telemetry-startup-BYGi0S46.js} +1 -1
  119. package/dist/public/assets/{terminal-launch-events-D0NkBM4g.js → terminal-launch-events-vDhBoD8w.js} +1 -1
  120. package/dist/public/assets/{terminal-telemetry-DxZXlrf4.js → terminal-telemetry-D1lMQO11.js} +1 -1
  121. package/dist/public/assets/treeView-QDETBFTQ-ocdjjjzR.js +1 -0
  122. package/dist/public/assets/treemap-6X3UGDF4-PQZ2TLFo.js +1 -0
  123. package/dist/public/assets/{typing-burst-detector-CI_4wux0.js → typing-burst-detector-BJJh89A5.js} +1 -1
  124. package/dist/public/assets/{use-activity-panel-DoU5dDI7.js → use-activity-panel-DddtATqP.js} +1 -1
  125. package/dist/public/assets/{use-apply-config-color-theme-DBdIMwiU.js → use-apply-config-color-theme-R1RZkk5a.js} +1 -1
  126. package/dist/public/assets/{use-collab-url-CwAStsIj.js → use-collab-url-B-LUA0g9.js} +1 -1
  127. package/dist/public/assets/{use-live-xterm-theme-oqXGh0AM.js → use-live-xterm-theme-DW54zfIk.js} +1 -1
  128. package/dist/public/assets/{use-terminal-enabled-B1QnDzPO.js → use-terminal-enabled-C0F3SkCA.js} +1 -1
  129. package/dist/public/assets/{use-timeline-entry-diff-C_hkFzJg.js → use-timeline-entry-diff-DTpDQjgI.js} +2 -2
  130. package/dist/public/assets/{use-workspace-DyAcZSjY.js → use-workspace-0T1cdRp3.js} +1 -1
  131. package/dist/public/assets/wardley-OPB4EBWU-CAyNEwcQ.js +1 -0
  132. package/dist/public/assets/{wardleyDiagram-EHGQE667-ZOtSnSGU.js → wardleyDiagram-EHGQE667-C30zq5TO.js} +1 -1
  133. package/dist/public/assets/{workspace-paths-B_ozK4P-.js → workspace-paths-nkXut9sM.js} +1 -1
  134. package/dist/public/assets/{zod-CCGVCn6n.js → zod-BmQcPlGk.js} +1 -1
  135. package/dist/public/index.html +36 -36
  136. package/dist/{repair-launch-json-BIpE7NKe.mjs → repair-launch-json-DUkhIhmI.mjs} +2 -2
  137. package/dist/{repair-mcp-configs-xT4PqUrS.mjs → repair-mcp-configs-CKxdm8Dd.mjs} +2 -2
  138. package/dist/repair-skills-D2vECWae.mjs +1 -0
  139. package/dist/{repair-skills-DaVaOiQC.mjs → repair-skills-hgtdKE41.mjs} +2 -2
  140. package/dist/{server-lock-DzWMWbLN.mjs → server-lock-B6fpjbeE.mjs} +2 -2
  141. package/dist/server-lock-C_4LRuVM.mjs +1 -0
  142. package/dist/{src-eVRfK1KK.mjs → src-BNWCeu4P.mjs} +1 -1
  143. package/dist/{src-D_kKrwVo.mjs → src-CNWv2m7o.mjs} +6 -6
  144. package/dist/src-CaRd1QSi.mjs +3264 -0
  145. package/dist/{src-Cwu3lS3D.mjs → src-FuRMJntf.mjs} +107 -107
  146. package/dist/start-BKZeR4jl.mjs +1 -0
  147. package/dist/{start-BnU7-Z9L.mjs → start-BZulfzdD.mjs} +2 -2
  148. package/dist/{write-project-skill-DtERurRT.mjs → write-project-skill-CnAZrDt1.mjs} +4 -4
  149. package/package.json +5 -5
  150. package/dist/constants-B_riNG8U.mjs +0 -2
  151. package/dist/fs-traced-BRzKbmYW.mjs +0 -1
  152. package/dist/git-handle-DluCIpMR.mjs +0 -1
  153. package/dist/init-BEOhkLFQ.mjs +0 -1
  154. package/dist/loader-JolD1GIz.mjs +0 -1
  155. package/dist/md-manager-DtA0LK6p.mjs +0 -2
  156. package/dist/preview-CluoUHys.mjs +0 -1
  157. package/dist/public/assets/PropertyPanel-CpcpWkfS.js +0 -2
  158. package/dist/public/assets/architecture-TIHT7OUA-ei5hsjAY.js +0 -1
  159. package/dist/public/assets/client-version-BBhtdyiC.js +0 -1
  160. package/dist/public/assets/cynefin-VYW2F7L2-CSnwYRoV.js +0 -1
  161. package/dist/public/assets/dist-BS_gC2L8.js +0 -124
  162. package/dist/public/assets/eventmodeling-45OFAUF4-DaV8ZCTn.js +0 -1
  163. package/dist/public/assets/gitGraph-TEB2WS4Q-P9_tpoZt.js +0 -1
  164. package/dist/public/assets/index-NzW9g3x_.css +0 -1
  165. package/dist/public/assets/info-DKCQHKI2-DJJ8FtaQ.js +0 -1
  166. package/dist/public/assets/packet-7NZHBO7P-DOwsFu9x.js +0 -1
  167. package/dist/public/assets/pie-RZYD4A2V-DEV7c1Ne.js +0 -1
  168. package/dist/public/assets/radar-I7S5WNFK-B607lrnK.js +0 -1
  169. package/dist/public/assets/railroad-3IZDKUUU-CRgAnFFT.js +0 -1
  170. package/dist/public/assets/railroad-abnf-AHOZXSZD-DulrY9_U.js +0 -1
  171. package/dist/public/assets/railroad-ebnf-EBAXGLYW-D8e0kEYb.js +0 -1
  172. package/dist/public/assets/railroad-peg-LSFZ7HO6-C2iIAAkK.js +0 -1
  173. package/dist/public/assets/treeView-QDETBFTQ-DIWn4fzK.js +0 -1
  174. package/dist/public/assets/treemap-6X3UGDF4-WPqEPk4A.js +0 -1
  175. package/dist/public/assets/wardley-OPB4EBWU-CFdyGX48.js +0 -1
  176. package/dist/repair-skills-vw_jVt0o.mjs +0 -1
  177. package/dist/server-lock-DZZ64TDY.mjs +0 -1
  178. package/dist/src-DxAg43k_.mjs +0 -3264
  179. package/dist/start-yhXxcSrI.mjs +0 -1
  180. /package/dist/public/assets/{chunk-KEIR6QF5-CFEoHvxJ.js → chunk-KEIR6QF5-dYt3HMDt.js} +0 -0
  181. /package/dist/public/assets/{dist-BneDw0Gk.js → dist-Y35lJRjm.js} +0 -0
  182. /package/dist/public/assets/{panzoom.es-BH0upAOZ.js → panzoom.es-DSQCRJbU.js} +0 -0
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r,r as i}from"./dist-DBENJeML.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{t as o}from"./button-DHE6Sx02.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-BLaUGJCd.js";import{n as se,t as s}from"./git-branch-DFJ3yJt8.js";import{t as c}from"./loader-circle-K7Xwpjny.js";import{n as ce,t as le}from"./miss-dialog-store-81J1GwFD.js";import{n as l}from"./dist-DwCd6eR-.js";import{t as u}from"./desktop-bridge-types-Ij8BA7el.js";import{n as d}from"./worktree-store-1tC864Do.js";import{a as f,n as ue}from"./receive-store-jfaprLyZ.js";import{t as de}from"./share-metadata-rows-Do2le589.js";var p=e(n(),1),fe=a();function pe(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function m(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function Se(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=m(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function Ce(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper}}:{state:e}}var h=t();function we(e){return e!==null&&e.kind===`project-branch-switch`}function g(e){let t=(0,fe.c)(217),{bridge:n,store:a}=e,m=a===void 0?ue:a,{_:g}=i(),_=(0,p.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[v,y]=(0,p.useState)(he),Me=(0,p.useRef)(!1),Ne=(0,p.useRef)(!1),Pe=(0,p.useRef)(!1),Fe=(0,p.useRef)(null),Ie;t[0]===_?Ie=t[1]:(Ie=we(_)?_:null,t[0]=_,t[1]=Ie);let b=Ie,Le;t[2]!==g||t[3]!==b?.share.target.kind?(Le=b?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=b?.share.target.kind,t[4]=Le):Le=t[4];let x=Le,Re;t[5]===b?Re=t[6]:(Re=()=>{y(he),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=b},t[5]=b,t[6]=Re);let ze;t[7]===_?ze=t[8]:(ze=[_],t[7]=_,t[8]=ze),(0,p.useEffect)(Re,ze);let Be;t[9]!==b||t[10]!==n?(Be=()=>{if(!b||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{e||y(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),y(Ae))}),()=>{e=!0}},t[9]=b,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===b?Ve=t[13]:(Ve=[b],t[12]=b,t[13]=Ve),(0,p.useEffect)(Be,Ve);let He;t[14]!==b||t[15]!==v.info||t[16]!==v.phase||t[17]!==n?(He=()=>{if(!b||v.phase!==`ready`||Pe.current||!ye(v.info))return;Pe.current=!0,y(be);let e=b;n.project.fetchTargetStatus({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{Fe.current===e&&y(e=>xe(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),y(ke))})},t[14]=b,t[15]=v.info,t[16]=v.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==b||t[20]!==v.phase?(Ue=[v.phase,b],t[19]=b,t[20]=v.phase,t[21]=Ue):Ue=t[21],(0,p.useEffect)(He,Ue);let We;t[22]!==b||t[23]!==v.phase||t[24]!==v.resolution||t[25]!==m?(We=()=>{if(v.phase!==`verdict`)return;let{kind:e}=v.resolution;e!==`deleted`&&e!==`never-on-branch`||b&&(le.arm({kind:b.share.target.kind,path:u(b.share.target),branch:b.share.branch}),m.dismiss())},t[22]=b,t[23]=v.phase,t[24]=v.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==b||t[28]!==v||t[29]!==m?(Ge=[v,b,m],t[27]=b,t[28]=v,t[29]=m,t[30]=Ge):Ge=t[30],(0,p.useEffect)(We,Ge);let Ke;t[31]!==v.phase||t[32]!==v.resolution?(Ke=()=>{v.phase===`verdict`&&console.log(f({verdict_cell:v.resolution.kind}))},t[31]=v.phase,t[32]=v.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===v?qe=t[35]:(qe=[v],t[34]=v,t[35]=qe),(0,p.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==b||t[38]!==v.pendingDoc||t[39]!==v.phase||t[40]!==n||t[41]!==m||t[42]!==x?(Je=()=>{if(v.phase!==`awaiting-cc1-recycle`||!b)return;let e=b.share.branch,t=v.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:b.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:b.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:b.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(g({id:`gQV-9w`,values:{targetNoun:x}}))}),m.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:x}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:x}})),m.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=b,t[38]=v.pendingDoc,t[39]=v.phase,t[40]=n,t[41]=m,t[42]=x,t[43]=Je):Je=t[43];let Ye;if(t[44]!==b||t[45]!==v.phase?(Ye=[v.phase,b],t[44]=b,t[45]=v.phase,t[46]=Ye):Ye=t[46],(0,p.useEffect)(Je,Ye),!b)return null;let{share:S,projectPath:C,currentBranch:w}=b,T=S.branch,Xe;t[47]!==g||t[48]!==n.project||t[49]!==C||t[50]!==T||t[51]!==m?(Xe=function(e,t,r){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),y(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:C,branch:T,fastForward:!0}:{projectPath:C,branch:T}).then(e=>{let t=null,n=!1;y(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?l.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),y(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=C,t[50]=T,t[51]=m,t[52]=Xe):Xe=t[52];let E=Xe,Ze;t[53]!==v.info||t[54]!==v.phase||t[55]!==E||t[56]!==S.target?(Ze=function(){v.phase===`ready`&&pe(v.info).switchEnabled&&E(u(S.target),!1)},t[53]=v.info,t[54]=v.phase,t[55]=E,t[56]=S.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==v.phase||t[59]!==v.resolution||t[60]!==E||t[61]!==S.target?($e=function(){v.phase===`verdict`&&E(u(S.target),!0,v.resolution.kind)},t[58]=v.phase,t[59]=v.resolution,t[60]=E,t[61]=S.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==v.phase||t[64]!==v.resolution||t[65]!==E?(tt=function(){v.phase===`verdict`&&v.resolution.kind===`renamed`&&E(v.resolution.renamedTo,!0,v.resolution.kind)},t[63]=v.phase,t[64]=v.resolution,t[65]=E,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==v.phase||t[68]!==v.resolution||t[69]!==E||t[70]!==S.target?(rt=function(){v.phase===`verdict`&&E(u(S.target),!1,v.resolution.kind)},t[67]=v.phase,t[68]=v.resolution,t[69]=E,t[70]=S.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==g||t[73]!==n.project||t[74]!==C||t[75]!==S.target||t[76]!==T||t[77]!==m||t[78]!==x?(at=function(){console.log(f({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:C,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(g({id:`b5aNbi`,values:{targetNoun:x}}))}),m.dismiss()},t[72]=g,t[73]=n.project,t[74]=C,t[75]=S.target,t[76]=T,t[77]=m,t[78]=x,t[79]=at):at=t[79];let ot=at,st;t[80]!==g||t[81]!==T?(st=function(e,t){switch(e){case`helper-not-found`:{let e=t??g({id:`cHhH3i`});l.error(g({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:l.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:l.error(g({id:`bWLmRK`}));return;case`already-checked-out`:l.error(g({id:`ljHjfg`}));return;case`branch-exists`:l.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:l.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:l.error(g({id:`CFnavk`}));return;case`invalid-branch`:l.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`proxy-null`:case`error`:l.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=g,t[81]=T,t[82]=st):st=t[82];let ct=st,lt;t[83]!==g||t[84]!==n.project||t[85]!==S.target||t[86]!==T||t[87]!==ct||t[88]!==m?(lt=function(e){let t=null,r,i=!1,a=null;if(y(n=>{let{state:o,sideEffect:ee}=Ce(n,e);return ee&&(t=ee.reason,r=ee.helper,i=o.phase===`dismissed`),o.phase===`opening-worktree`&&(a=o.path),o}),t!==null&&(console.log(f({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),ct(t,r)),a!==null){d();let e=a;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}i&&m.dismiss()},t[83]=g,t[84]=n.project,t[85]=S.target,t[86]=T,t[87]=ct,t[88]=m,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==v.phase||t[92]!==n.worktree||t[93]!==T?(dt=function(){v.phase===`ready`&&(console.log(f({branch_dialog_action:`open-worktree`,branch:T})),y(ve),n.worktree.checkout({branch:T}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=v.phase,t[92]=n.worktree,t[93]=T,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==g||t[96]!==v.otherWorktreePath||t[97]!==v.phase||t[98]!==n.project||t[99]!==S.target||t[100]!==T||t[101]!==m?(pt=function(){if(v.phase!==`branch-in-other-worktree`)return;let e=v.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=g,t[96]=v.otherWorktreePath,t[97]=v.phase,t[98]=n.project,t[99]=S.target,t[100]=T,t[101]=m,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==v.phase||t[104]!==v.resolution||t[105]!==m?(ht=function(){console.log(f({branch_dialog_action:`cancel`,verdict_cell:v.phase===`verdict`?v.resolution.kind:void 0})),m.dismiss()},t[103]=v.phase,t[104]=v.resolution,t[105]=m,t[106]=ht):ht=t[106];let D=ht,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==v.info||t[109]!==v.otherWorktreePath||t[110]!==v.phase||t[111]!==v.resolution||t[112]!==D||t[113]!==w||t[114]!==S.branch||t[115]!==S.owner||t[116]!==S.repo||t[117]!==S.target||t[118]!==T||t[119]!==x){G=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?pe(v.info):null;let e;t[139]!==v.info||t[140]!==v.phase||t[141]!==w?(e=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?me(v.info):w??`HEAD`,t[139]=v.info,t[140]=v.phase,t[141]=w,t[142]=e):e=t[142];let n=e;P=v.phase===`switching`||v.phase===`awaiting-cc1-recycle`,j=v.phase===`creating-worktree`;let i;t[143]===g?i=t[144]:(i=g({id:`OuY8t9`}),t[143]=g,t[144]=i),M=i;let a;t[145]===g?a=t[146]:(a=g({id:`XZkdtg`}),t[145]=g,t[146]=a),N=a;let o;t[147]===g?o=t[148]:(o=g({id:`VTulZj`}),t[147]=g,t[148]=o),K=o;let ie=v.phase===`loading`,se=v.phase===`error`;A=oe,U=!0,t[149]===D?W=t[150]:(W=e=>{e||D()},t[149]=D,t[150]=W),k=ne,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=De,V=Ee;let s;t[151]===x?s=t[152]:(s=(0,h.jsx)(te,{children:(0,h.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:x}})}),t[151]=x,t[152]=s);let ce=S.owner,le=S.repo,l;t[153]===S.target?l=t[154]:(l=u(S.target),t[153]=S.target,t[154]=l);let d;t[155]!==S.owner||t[156]!==S.repo||t[157]!==l?(d=(0,h.jsx)(ee,{className:`sr-only`,children:(0,h.jsx)(r,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[155]=S.owner,t[156]=S.repo,t[157]=l,t[158]=d):d=t[158],t[159]!==s||t[160]!==d?(H=(0,h.jsxs)(ae,{children:[s,d]}),t[159]=s,t[160]=d,t[161]=H):H=t[161],O=re;let f=S.owner,ue=S.repo,p;t[162]===S.target?p=t[163]:(p=u(S.target),t[162]=S.target,t[163]=p),t[164]!==S.branch||t[165]!==S.owner||t[166]!==S.repo||t[167]!==S.target.kind||t[168]!==p?(F=(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(de,{owner:f,repo:ue,path:p,kind:S.target.kind,branch:S.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=S.branch,t[165]=S.owner,t[166]=S.repo,t[167]=S.target.kind,t[168]=p,t[169]=F):F=t[169],I=v.phase===`branch-in-other-worktree`?(0,h.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,h.jsx)(`p`,{className:`leading-6`,children:(0,h.jsx)(r,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,h.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:v.otherWorktreePath})]}):v.phase===`verdict-pending`?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`c8jBgX`})]}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,h.jsx)(r,{id:`Uay5NL`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`renamed`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,h.jsx)(r,{id:`P0HC30`,values:{0:v.resolution.renamedTo,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`diverged`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,h.jsx)(r,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`c8jBgX`})]}):ie?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`jerqF0`})]}):se?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,h.jsx)(r,{id:`w4hMYl`})}):G?.kind===`D`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(r,{id:`DTI-fp`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(r,{id:`_902BE`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,h.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,h.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,h.jsx)(r,{id:`n2lRue`})}),(0,h.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(Te)})]}):null,t[107]=g,t[108]=v.info,t[109]=v.otherWorktreePath,t[110]=v.phase,t[111]=v.resolution,t[112]=D,t[113]=w,t[114]=S.branch,t[115]=S.owner,t[116]=S.repo,t[117]=S.target,t[118]=T,t[119]=x,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=t[120],k=t[121],A=t[122],j=t[123],M=t[124],N=t[125],P=t[126],F=t[127],I=t[128],L=t[129],R=t[130],z=t[131],B=t[132],V=t[133],H=t[134],U=t[135],W=t[136],G=t[137],K=t[138];let q;t[170]===P?q=t[171]:(q=P?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=j,t[173]=J);let Y;t[174]!==O||t[175]!==F||t[176]!==I||t[177]!==L||t[178]!==q||t[179]!==J?(Y=(0,h.jsxs)(O,{children:[F,I,L,q,J]}),t[174]=O,t[175]=F,t[176]=I,t[177]=L,t[178]=q,t[179]=J,t[180]=Y):Y=t[180];let gt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,h.jsx)(r,{id:`dEgA5A`}),t[181]=gt):gt=t[181];let X;t[182]===D?X=t[183]:(X=(0,h.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:gt}),t[182]=D,t[183]=X);let Z;t[184]!==v.phase||t[185]!==v.resolution||t[186]!==j||t[187]!==ot||t[188]!==nt||t[189]!==ft||t[190]!==mt||t[191]!==it||t[192]!==Qe||t[193]!==et||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=v.phase===`branch-in-other-worktree`?(0,h.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,h.jsx)(r,{id:`hyCxJY`})}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(r,{id:`uA_jXp`})]}):v.resolution.kind===`renamed`?(0,h.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(r,{id:`AItsE5`})]}):v.resolution.kind===`diverged`?(0,h.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[G?.openCurrentEnabled?(0,h.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,h.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,h.jsx)(o,{onClick:ft,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=v.phase,t[185]=v.resolution,t[186]=j,t[187]=ot,t[188]=nt,t[189]=ft,t[190]=mt,t[191]=it,t[192]=Qe,t[193]=et,t[194]=M,t[195]=N,t[196]=P,t[197]=G,t[198]=K,t[199]=Z):Z=t[199];let Q;t[200]!==X||t[201]!==Z?(Q=(0,h.jsxs)(ie,{className:`sm:justify-between`,children:[X,Z]}),t[200]=X,t[201]=Z,t[202]=Q):Q=t[202];let $;t[203]!==k||t[204]!==R||t[205]!==z||t[206]!==B||t[207]!==V||t[208]!==H||t[209]!==Y||t[210]!==Q?($=(0,h.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[203]=k,t[204]=R,t[205]=z,t[206]=B,t[207]=V,t[208]=H,t[209]=Y,t[210]=Q,t[211]=$):$=t[211];let _t;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(_t=(0,h.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=_t):_t=t[216],_t}function Te(e){return(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(e){return Se(e,null).state}function ke(e){return xe(e,null)}function Ae(e){return ge(e,null)}function je(){return null}export{g as ShareBranchSwitchDialog};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r,r as i}from"./dist-DBENJeML.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{t as o}from"./button-DHE6Sx02.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-BLaUGJCd.js";import{n as se,t as s}from"./git-branch-DFJ3yJt8.js";import{t as c}from"./loader-circle-K7Xwpjny.js";import{n as ce,t as le}from"./miss-dialog-store-81J1GwFD.js";import{n as l}from"./dist-DwCd6eR-.js";import{t as u}from"./desktop-bridge-types-Ij8BA7el.js";import{n as d}from"./worktree-store-1tC864Do.js";import{a as f,n as ue}from"./receive-store-B3ygF-LA.js";import{t as de}from"./share-metadata-rows-Do2le589.js";var p=e(n(),1),fe=a();function pe(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function m(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function Se(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=m(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function Ce(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper}}:{state:e}}var h=t();function we(e){return e!==null&&e.kind===`project-branch-switch`}function g(e){let t=(0,fe.c)(217),{bridge:n,store:a}=e,m=a===void 0?ue:a,{_:g}=i(),_=(0,p.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[v,y]=(0,p.useState)(he),Me=(0,p.useRef)(!1),Ne=(0,p.useRef)(!1),Pe=(0,p.useRef)(!1),Fe=(0,p.useRef)(null),Ie;t[0]===_?Ie=t[1]:(Ie=we(_)?_:null,t[0]=_,t[1]=Ie);let b=Ie,Le;t[2]!==g||t[3]!==b?.share.target.kind?(Le=b?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=b?.share.target.kind,t[4]=Le):Le=t[4];let x=Le,Re;t[5]===b?Re=t[6]:(Re=()=>{y(he),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=b},t[5]=b,t[6]=Re);let ze;t[7]===_?ze=t[8]:(ze=[_],t[7]=_,t[8]=ze),(0,p.useEffect)(Re,ze);let Be;t[9]!==b||t[10]!==n?(Be=()=>{if(!b||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{e||y(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),y(Ae))}),()=>{e=!0}},t[9]=b,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===b?Ve=t[13]:(Ve=[b],t[12]=b,t[13]=Ve),(0,p.useEffect)(Be,Ve);let He;t[14]!==b||t[15]!==v.info||t[16]!==v.phase||t[17]!==n?(He=()=>{if(!b||v.phase!==`ready`||Pe.current||!ye(v.info))return;Pe.current=!0,y(be);let e=b;n.project.fetchTargetStatus({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{Fe.current===e&&y(e=>xe(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),y(ke))})},t[14]=b,t[15]=v.info,t[16]=v.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==b||t[20]!==v.phase?(Ue=[v.phase,b],t[19]=b,t[20]=v.phase,t[21]=Ue):Ue=t[21],(0,p.useEffect)(He,Ue);let We;t[22]!==b||t[23]!==v.phase||t[24]!==v.resolution||t[25]!==m?(We=()=>{if(v.phase!==`verdict`)return;let{kind:e}=v.resolution;e!==`deleted`&&e!==`never-on-branch`||b&&(le.arm({kind:b.share.target.kind,path:u(b.share.target),branch:b.share.branch}),m.dismiss())},t[22]=b,t[23]=v.phase,t[24]=v.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==b||t[28]!==v||t[29]!==m?(Ge=[v,b,m],t[27]=b,t[28]=v,t[29]=m,t[30]=Ge):Ge=t[30],(0,p.useEffect)(We,Ge);let Ke;t[31]!==v.phase||t[32]!==v.resolution?(Ke=()=>{v.phase===`verdict`&&console.log(f({verdict_cell:v.resolution.kind}))},t[31]=v.phase,t[32]=v.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===v?qe=t[35]:(qe=[v],t[34]=v,t[35]=qe),(0,p.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==b||t[38]!==v.pendingDoc||t[39]!==v.phase||t[40]!==n||t[41]!==m||t[42]!==x?(Je=()=>{if(v.phase!==`awaiting-cc1-recycle`||!b)return;let e=b.share.branch,t=v.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:b.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:b.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:b.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(g({id:`gQV-9w`,values:{targetNoun:x}}))}),m.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:x}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:x}})),m.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=b,t[38]=v.pendingDoc,t[39]=v.phase,t[40]=n,t[41]=m,t[42]=x,t[43]=Je):Je=t[43];let Ye;if(t[44]!==b||t[45]!==v.phase?(Ye=[v.phase,b],t[44]=b,t[45]=v.phase,t[46]=Ye):Ye=t[46],(0,p.useEffect)(Je,Ye),!b)return null;let{share:S,projectPath:C,currentBranch:w}=b,T=S.branch,Xe;t[47]!==g||t[48]!==n.project||t[49]!==C||t[50]!==T||t[51]!==m?(Xe=function(e,t,r){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),y(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:C,branch:T,fastForward:!0}:{projectPath:C,branch:T}).then(e=>{let t=null,n=!1;y(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?l.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),y(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=C,t[50]=T,t[51]=m,t[52]=Xe):Xe=t[52];let E=Xe,Ze;t[53]!==v.info||t[54]!==v.phase||t[55]!==E||t[56]!==S.target?(Ze=function(){v.phase===`ready`&&pe(v.info).switchEnabled&&E(u(S.target),!1)},t[53]=v.info,t[54]=v.phase,t[55]=E,t[56]=S.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==v.phase||t[59]!==v.resolution||t[60]!==E||t[61]!==S.target?($e=function(){v.phase===`verdict`&&E(u(S.target),!0,v.resolution.kind)},t[58]=v.phase,t[59]=v.resolution,t[60]=E,t[61]=S.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==v.phase||t[64]!==v.resolution||t[65]!==E?(tt=function(){v.phase===`verdict`&&v.resolution.kind===`renamed`&&E(v.resolution.renamedTo,!0,v.resolution.kind)},t[63]=v.phase,t[64]=v.resolution,t[65]=E,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==v.phase||t[68]!==v.resolution||t[69]!==E||t[70]!==S.target?(rt=function(){v.phase===`verdict`&&E(u(S.target),!1,v.resolution.kind)},t[67]=v.phase,t[68]=v.resolution,t[69]=E,t[70]=S.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==g||t[73]!==n.project||t[74]!==C||t[75]!==S.target||t[76]!==T||t[77]!==m||t[78]!==x?(at=function(){console.log(f({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:C,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(g({id:`b5aNbi`,values:{targetNoun:x}}))}),m.dismiss()},t[72]=g,t[73]=n.project,t[74]=C,t[75]=S.target,t[76]=T,t[77]=m,t[78]=x,t[79]=at):at=t[79];let ot=at,st;t[80]!==g||t[81]!==T?(st=function(e,t){switch(e){case`helper-not-found`:{let e=t??g({id:`cHhH3i`});l.error(g({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:l.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:l.error(g({id:`bWLmRK`}));return;case`already-checked-out`:l.error(g({id:`ljHjfg`}));return;case`branch-exists`:l.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:l.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:l.error(g({id:`CFnavk`}));return;case`invalid-branch`:l.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`proxy-null`:case`error`:l.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=g,t[81]=T,t[82]=st):st=t[82];let ct=st,lt;t[83]!==g||t[84]!==n.project||t[85]!==S.target||t[86]!==T||t[87]!==ct||t[88]!==m?(lt=function(e){let t=null,r,i=!1,a=null;if(y(n=>{let{state:o,sideEffect:ee}=Ce(n,e);return ee&&(t=ee.reason,r=ee.helper,i=o.phase===`dismissed`),o.phase===`opening-worktree`&&(a=o.path),o}),t!==null&&(console.log(f({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),ct(t,r)),a!==null){d();let e=a;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}i&&m.dismiss()},t[83]=g,t[84]=n.project,t[85]=S.target,t[86]=T,t[87]=ct,t[88]=m,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==v.phase||t[92]!==n.worktree||t[93]!==T?(dt=function(){v.phase===`ready`&&(console.log(f({branch_dialog_action:`open-worktree`,branch:T})),y(ve),n.worktree.checkout({branch:T}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=v.phase,t[92]=n.worktree,t[93]=T,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==g||t[96]!==v.otherWorktreePath||t[97]!==v.phase||t[98]!==n.project||t[99]!==S.target||t[100]!==T||t[101]!==m?(pt=function(){if(v.phase!==`branch-in-other-worktree`)return;let e=v.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=g,t[96]=v.otherWorktreePath,t[97]=v.phase,t[98]=n.project,t[99]=S.target,t[100]=T,t[101]=m,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==v.phase||t[104]!==v.resolution||t[105]!==m?(ht=function(){console.log(f({branch_dialog_action:`cancel`,verdict_cell:v.phase===`verdict`?v.resolution.kind:void 0})),m.dismiss()},t[103]=v.phase,t[104]=v.resolution,t[105]=m,t[106]=ht):ht=t[106];let D=ht,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==v.info||t[109]!==v.otherWorktreePath||t[110]!==v.phase||t[111]!==v.resolution||t[112]!==D||t[113]!==w||t[114]!==S.branch||t[115]!==S.owner||t[116]!==S.repo||t[117]!==S.target||t[118]!==T||t[119]!==x){G=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?pe(v.info):null;let e;t[139]!==v.info||t[140]!==v.phase||t[141]!==w?(e=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?me(v.info):w??`HEAD`,t[139]=v.info,t[140]=v.phase,t[141]=w,t[142]=e):e=t[142];let n=e;P=v.phase===`switching`||v.phase===`awaiting-cc1-recycle`,j=v.phase===`creating-worktree`;let i;t[143]===g?i=t[144]:(i=g({id:`OuY8t9`}),t[143]=g,t[144]=i),M=i;let a;t[145]===g?a=t[146]:(a=g({id:`XZkdtg`}),t[145]=g,t[146]=a),N=a;let o;t[147]===g?o=t[148]:(o=g({id:`VTulZj`}),t[147]=g,t[148]=o),K=o;let ie=v.phase===`loading`,se=v.phase===`error`;A=oe,U=!0,t[149]===D?W=t[150]:(W=e=>{e||D()},t[149]=D,t[150]=W),k=ne,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=De,V=Ee;let s;t[151]===x?s=t[152]:(s=(0,h.jsx)(te,{children:(0,h.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:x}})}),t[151]=x,t[152]=s);let ce=S.owner,le=S.repo,l;t[153]===S.target?l=t[154]:(l=u(S.target),t[153]=S.target,t[154]=l);let d;t[155]!==S.owner||t[156]!==S.repo||t[157]!==l?(d=(0,h.jsx)(ee,{className:`sr-only`,children:(0,h.jsx)(r,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[155]=S.owner,t[156]=S.repo,t[157]=l,t[158]=d):d=t[158],t[159]!==s||t[160]!==d?(H=(0,h.jsxs)(ae,{children:[s,d]}),t[159]=s,t[160]=d,t[161]=H):H=t[161],O=re;let f=S.owner,ue=S.repo,p;t[162]===S.target?p=t[163]:(p=u(S.target),t[162]=S.target,t[163]=p),t[164]!==S.branch||t[165]!==S.owner||t[166]!==S.repo||t[167]!==S.target.kind||t[168]!==p?(F=(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(de,{owner:f,repo:ue,path:p,kind:S.target.kind,branch:S.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=S.branch,t[165]=S.owner,t[166]=S.repo,t[167]=S.target.kind,t[168]=p,t[169]=F):F=t[169],I=v.phase===`branch-in-other-worktree`?(0,h.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,h.jsx)(`p`,{className:`leading-6`,children:(0,h.jsx)(r,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,h.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:v.otherWorktreePath})]}):v.phase===`verdict-pending`?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`c8jBgX`})]}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,h.jsx)(r,{id:`Uay5NL`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`renamed`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,h.jsx)(r,{id:`P0HC30`,values:{0:v.resolution.renamedTo,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`diverged`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,h.jsx)(r,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`c8jBgX`})]}):ie?(0,h.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`jerqF0`})]}):se?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,h.jsx)(r,{id:`w4hMYl`})}):G?.kind===`D`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(r,{id:`DTI-fp`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(r,{id:`_902BE`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,h.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,h.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,h.jsx)(r,{id:`n2lRue`})}),(0,h.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(Te)})]}):null,t[107]=g,t[108]=v.info,t[109]=v.otherWorktreePath,t[110]=v.phase,t[111]=v.resolution,t[112]=D,t[113]=w,t[114]=S.branch,t[115]=S.owner,t[116]=S.repo,t[117]=S.target,t[118]=T,t[119]=x,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=t[120],k=t[121],A=t[122],j=t[123],M=t[124],N=t[125],P=t[126],F=t[127],I=t[128],L=t[129],R=t[130],z=t[131],B=t[132],V=t[133],H=t[134],U=t[135],W=t[136],G=t[137],K=t[138];let q;t[170]===P?q=t[171]:(q=P?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,h.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=j,t[173]=J);let Y;t[174]!==O||t[175]!==F||t[176]!==I||t[177]!==L||t[178]!==q||t[179]!==J?(Y=(0,h.jsxs)(O,{children:[F,I,L,q,J]}),t[174]=O,t[175]=F,t[176]=I,t[177]=L,t[178]=q,t[179]=J,t[180]=Y):Y=t[180];let gt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,h.jsx)(r,{id:`dEgA5A`}),t[181]=gt):gt=t[181];let X;t[182]===D?X=t[183]:(X=(0,h.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:gt}),t[182]=D,t[183]=X);let Z;t[184]!==v.phase||t[185]!==v.resolution||t[186]!==j||t[187]!==ot||t[188]!==nt||t[189]!==ft||t[190]!==mt||t[191]!==it||t[192]!==Qe||t[193]!==et||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=v.phase===`branch-in-other-worktree`?(0,h.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,h.jsx)(r,{id:`hyCxJY`})}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(r,{id:`uA_jXp`})]}):v.resolution.kind===`renamed`?(0,h.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(r,{id:`AItsE5`})]}):v.resolution.kind===`diverged`?(0,h.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[G?.openCurrentEnabled?(0,h.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,h.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,h.jsx)(o,{onClick:ft,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=v.phase,t[185]=v.resolution,t[186]=j,t[187]=ot,t[188]=nt,t[189]=ft,t[190]=mt,t[191]=it,t[192]=Qe,t[193]=et,t[194]=M,t[195]=N,t[196]=P,t[197]=G,t[198]=K,t[199]=Z):Z=t[199];let Q;t[200]!==X||t[201]!==Z?(Q=(0,h.jsxs)(ie,{className:`sm:justify-between`,children:[X,Z]}),t[200]=X,t[201]=Z,t[202]=Q):Q=t[202];let $;t[203]!==k||t[204]!==R||t[205]!==z||t[206]!==B||t[207]!==V||t[208]!==H||t[209]!==Y||t[210]!==Q?($=(0,h.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[203]=k,t[204]=R,t[205]=z,t[206]=B,t[207]=V,t[208]=H,t[209]=Y,t[210]=Q,t[211]=$):$=t[211];let _t;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(_t=(0,h.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=_t):_t=t[216],_t}function Te(e){return(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(e){return Se(e,null).state}function ke(e){return xe(e,null)}function Ae(e){return ge(e,null)}function je(){return null}export{g as ShareBranchSwitchDialog};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r,r as i}from"./dist-DBENJeML.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{t as o}from"./button-DHE6Sx02.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-BLaUGJCd.js";import{an as u,rn as d}from"./dist-Vm1kQiqo.js";import{t as ie}from"./loader-circle-K7Xwpjny.js";import{n as f}from"./dist-DwCd6eR-.js";import{t as p}from"./desktop-bridge-types-Ij8BA7el.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-jfaprLyZ.js";import{t as se}from"./share-metadata-rows-Do2le589.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return e!==null&&e.kind===`launcher-consent`}function D(e){return e!==null&&e.kind===`launcher-miss`}function O(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,A),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(k));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=D(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=E(o)?o:null,t[6]=o,t[7]=d);let ie=d??u;if(!ie)return null;let p;return t[8]!==ie||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(p=(0,T.jsx)(j,{payload:ie,bridge:n,cloneController:r,store:a},ee),t[8]=ie,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=p):p=t[13],p}function k(e){return e+1}function A(){return null}function j(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(null),[j,fe]=(0,v.useState)(!1),[N,pe]=(0,v.useState)(!1),[P,me]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),he=(0,v.useRef)(!1),ge=(0,v.useRef)(null),_e,ve;t[0]===P?(_e=t[1],ve=t[2]):(_e=()=>{P&&ge.current?.focus()},ve=[P],t[0]=P,t[1]=_e,t[2]=ve),(0,v.useEffect)(_e,ve);let ye;t[3]!==F||t[4]!==n?(ye=()=>{E(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=ye):ye=t[5];let be;t[6]===n?be=t[7]:(be=[n],t[6]=n,t[7]=be),(0,v.useEffect)(ye,be);let xe;t[8]!==k||t[9]!==h||t[10]!==n?(xe=()=>{if(!h||!D(n)||k!==null||he.current)return;he.current=!0,fe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{A(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),A({authenticated:!1,host:e})}).finally(()=>{fe(!1)})},t[8]=k,t[9]=h,t[10]=n,t[11]=xe):xe=t[11];let Se;t[12]!==k||t[13]!==n?(Se=[n,k],t[12]=k,t[13]=n,t[14]=Se):Se=t[14],(0,v.useEffect)(xe,Se);let L=D(n)?n:null,Ce=E(n)?n:null,R=L?.share??Ce?.share??null,z,B,V,H,U,we,W,G;if(t[15]!==x||t[16]!==j||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){W=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],G=n,V=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;me(null),pe(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),pe(!1),me({detail:t instanceof Error?t.message:String(t)});return}if(pe(!1),n.kind===`error`){me({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==j||t[38]!==h?(i=async function(){if(!(!h||j)){fe(!0);try{let e=await h.startSignIn();fe(!1),e!==null&&A(e)}catch(e){let t=e;fe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=j,t[38]=h,t[39]=i):i=t[39],U=i,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(de),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),I(ue),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(M),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===G?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[50]=G,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],W=ue;break bb0}if(!L||!R||!e){W=null;break bb0}z=h!==void 0&&!N;let E;t[103]!==x||t[104]!==N?(E=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=E):E=t[105],B=E,we=d(e)}t[15]=x,t[16]=j,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=B,t[27]=V,t[28]=H,t[29]=U,t[30]=we,t[31]=W,t[32]=G}else z=t[25],B=t[26],V=t[27],H=t[28],U=t[29],we=t[30],W=t[31],G=t[32];if(W!==Symbol.for(`react.early_return_sentinel`))return W;let Te=we,Ee=k?.authenticated?k.login:void 0,De;t[106]===P?De=t[107]:(De=P?.detail?m(P.detail):``,t[106]=P,t[107]=De);let Oe=De,K;t[108]===_?K=t[109]:(K=e=>{e||_.dismiss()},t[108]=_,t[109]=K);let q;t[110]===G?q=t[111]:(q=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[110]=G,t[111]=q);let J;t[112]===R.target?J=t[113]:(J=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=J);let Y;t[114]!==R.owner||t[115]!==R.repo||t[116]!==J?(Y=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,J]}),t[114]=R.owner,t[115]=R.repo,t[116]=J,t[117]=Y):Y=t[117];let ke=R.owner,Ae=R.repo,X;t[118]===R.target?X=t[119]:(X=p(R.target),t[118]=R.target,t[119]=X);let Z;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==X?(Z=(0,T.jsx)(se,{owner:ke,repo:Ae,path:X,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=X,t[125]=Z):Z=t[125];let Q;t[126]!==q||t[127]!==Y||t[128]!==Z?(Q=(0,T.jsxs)(c,{children:[q,Y,Z]}),t[126]=q,t[127]=Y,t[128]=Z,t[129]=Q):Q=t[129];let $;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Oe||t[134]!==B||t[135]!==N||t[136]!==V||t[137]!==H||t[138]!==w?($=P?(0,T.jsxs)(`div`,{ref:ge,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Oe?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Oe,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{V()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:B}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Oe,t[134]=B,t[135]=N,t[136]=V,t[137]=H,t[138]=w,t[139]=$):$=t[139];let je;t[140]!==j||t[141]!==k||t[142]!==h||t[143]!==U||t[144]!==Ee?(je=h?(0,T.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:k===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Ee},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{U()},disabled:j,children:j?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=j,t[141]=k,t[142]=h,t[143]=U,t[144]=Ee,t[145]=je):je=t[145];let Me;t[146]!==P||t[147]!==Te?(Me=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:Te},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=Te,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,T.jsxs)(re,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===_?Pe=t[154]:(Pe=()=>_.dismiss(),t[153]=_,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Q||t[159]!==Ne||t[160]!==Ie?(Le=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Q,Ne,Ie]}),t[158]=Q,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==K||t[163]!==Le?(Re=(0,T.jsx)(l,{open:!0,onOpenChange:K,children:Le}),t[162]=K,t[163]=Le,t[164]=Re):Re=t[164],Re}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function M(e){return e===null?e:w(e)}function ue(e){return e===null?e:C(e,{ok:!0})}function de(e){return e===null?e:x(e)}export{O as ShareReceiveDialog};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r,r as i}from"./dist-DBENJeML.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{t as o}from"./button-DHE6Sx02.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-BLaUGJCd.js";import{an as u,rn as d}from"./dist-df-v6kvy.js";import{t as ie}from"./loader-circle-K7Xwpjny.js";import{n as f}from"./dist-DwCd6eR-.js";import{t as p}from"./desktop-bridge-types-Ij8BA7el.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-B3ygF-LA.js";import{t as se}from"./share-metadata-rows-Do2le589.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return e!==null&&e.kind===`launcher-consent`}function D(e){return e!==null&&e.kind===`launcher-miss`}function O(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,A),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(k));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=D(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=E(o)?o:null,t[6]=o,t[7]=d);let ie=d??u;if(!ie)return null;let p;return t[8]!==ie||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(p=(0,T.jsx)(j,{payload:ie,bridge:n,cloneController:r,store:a},ee),t[8]=ie,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=p):p=t[13],p}function k(e){return e+1}function A(){return null}function j(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(null),[j,fe]=(0,v.useState)(!1),[N,pe]=(0,v.useState)(!1),[P,me]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),he=(0,v.useRef)(!1),ge=(0,v.useRef)(null),_e,ve;t[0]===P?(_e=t[1],ve=t[2]):(_e=()=>{P&&ge.current?.focus()},ve=[P],t[0]=P,t[1]=_e,t[2]=ve),(0,v.useEffect)(_e,ve);let ye;t[3]!==F||t[4]!==n?(ye=()=>{E(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=ye):ye=t[5];let be;t[6]===n?be=t[7]:(be=[n],t[6]=n,t[7]=be),(0,v.useEffect)(ye,be);let xe;t[8]!==k||t[9]!==h||t[10]!==n?(xe=()=>{if(!h||!D(n)||k!==null||he.current)return;he.current=!0,fe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{A(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),A({authenticated:!1,host:e})}).finally(()=>{fe(!1)})},t[8]=k,t[9]=h,t[10]=n,t[11]=xe):xe=t[11];let Se;t[12]!==k||t[13]!==n?(Se=[n,k],t[12]=k,t[13]=n,t[14]=Se):Se=t[14],(0,v.useEffect)(xe,Se);let L=D(n)?n:null,Ce=E(n)?n:null,R=L?.share??Ce?.share??null,z,B,V,H,U,we,W,G;if(t[15]!==x||t[16]!==j||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){W=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],G=n,V=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;me(null),pe(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),pe(!1),me({detail:t instanceof Error?t.message:String(t)});return}if(pe(!1),n.kind===`error`){me({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==j||t[38]!==h?(i=async function(){if(!(!h||j)){fe(!0);try{let e=await h.startSignIn();fe(!1),e!==null&&A(e)}catch(e){let t=e;fe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=j,t[38]=h,t[39]=i):i=t[39],U=i,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(de),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),I(ue),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(M),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===G?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[50]=G,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],W=ue;break bb0}if(!L||!R||!e){W=null;break bb0}z=h!==void 0&&!N;let E;t[103]!==x||t[104]!==N?(E=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=E):E=t[105],B=E,we=d(e)}t[15]=x,t[16]=j,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=B,t[27]=V,t[28]=H,t[29]=U,t[30]=we,t[31]=W,t[32]=G}else z=t[25],B=t[26],V=t[27],H=t[28],U=t[29],we=t[30],W=t[31],G=t[32];if(W!==Symbol.for(`react.early_return_sentinel`))return W;let Te=we,Ee=k?.authenticated?k.login:void 0,De;t[106]===P?De=t[107]:(De=P?.detail?m(P.detail):``,t[106]=P,t[107]=De);let Oe=De,K;t[108]===_?K=t[109]:(K=e=>{e||_.dismiss()},t[108]=_,t[109]=K);let q;t[110]===G?q=t[111]:(q=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[110]=G,t[111]=q);let J;t[112]===R.target?J=t[113]:(J=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=J);let Y;t[114]!==R.owner||t[115]!==R.repo||t[116]!==J?(Y=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,J]}),t[114]=R.owner,t[115]=R.repo,t[116]=J,t[117]=Y):Y=t[117];let ke=R.owner,Ae=R.repo,X;t[118]===R.target?X=t[119]:(X=p(R.target),t[118]=R.target,t[119]=X);let Z;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==X?(Z=(0,T.jsx)(se,{owner:ke,repo:Ae,path:X,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=X,t[125]=Z):Z=t[125];let Q;t[126]!==q||t[127]!==Y||t[128]!==Z?(Q=(0,T.jsxs)(c,{children:[q,Y,Z]}),t[126]=q,t[127]=Y,t[128]=Z,t[129]=Q):Q=t[129];let $;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Oe||t[134]!==B||t[135]!==N||t[136]!==V||t[137]!==H||t[138]!==w?($=P?(0,T.jsxs)(`div`,{ref:ge,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Oe?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Oe,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{V()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:B}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Oe,t[134]=B,t[135]=N,t[136]=V,t[137]=H,t[138]=w,t[139]=$):$=t[139];let je;t[140]!==j||t[141]!==k||t[142]!==h||t[143]!==U||t[144]!==Ee?(je=h?(0,T.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:k===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Ee},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{U()},disabled:j,children:j?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=j,t[141]=k,t[142]=h,t[143]=U,t[144]=Ee,t[145]=je):je=t[145];let Me;t[146]!==P||t[147]!==Te?(Me=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:Te},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=Te,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,T.jsxs)(re,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===_?Pe=t[154]:(Pe=()=>_.dismiss(),t[153]=_,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Q||t[159]!==Ne||t[160]!==Ie?(Le=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Q,Ne,Ie]}),t[158]=Q,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==K||t[163]!==Le?(Re=(0,T.jsx)(l,{open:!0,onOpenChange:K,children:Le}),t[162]=K,t[163]=Le,t[164]=Re):Re=t[164],Re}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function M(e){return e===null?e:w(e)}function ue(e){return e===null?e:C(e,{ok:!0})}function de(e){return e===null?e:x(e)}export{O as ShareReceiveDialog};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{t as r}from"./compiler-runtime-dQcBxOhn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-BLaUGJCd.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-CVDTioM4.js";import{t as p}from"./miss-dialog-store-81J1GwFD.js";import{c as m,s as h}from"./doc-hash-B8kD24Kw.js";var g=r(),_=e(n(),1),v=t();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(p.subscribe,p.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(25),{nav:n}=e,{state:r,refetch:_}=l(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){p.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(u(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){d.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(s,{children:(0,v.jsx)(i,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,M;t[11]!==C||t[12]!==n||t[13]!==T||t[14]!==_||t[15]!==r?(M=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_}),t[11]=C,t[12]=n,t[13]=T,t[14]=_,t[15]=r,t[16]=M):M=t[16];let N;t[17]!==M||t[18]!==j?(N=(0,v.jsx)(o,{className:j,children:M}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;return t[20]!==r.phase||t[21]!==N||t[22]!==O||t[23]!==A?(P=(0,v.jsx)(c,{open:!0,onOpenChange:E,children:(0,v.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,N]})}),t[20]=r.phase,t[21]=N,t[22]=O,t[23]=A,t[24]=P):P=t[24],P}export{b as ShareReceiveMissDialog};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{t as r}from"./compiler-runtime-dQcBxOhn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-BLaUGJCd.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-XNS4eahL.js";import{t as p}from"./miss-dialog-store-81J1GwFD.js";import{c as m,s as h}from"./doc-hash-NyLrtNo2.js";var g=r(),_=e(n(),1),v=t();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(p.subscribe,p.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(25),{nav:n}=e,{state:r,refetch:_}=l(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){p.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(u(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){d.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(s,{children:(0,v.jsx)(i,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,M;t[11]!==C||t[12]!==n||t[13]!==T||t[14]!==_||t[15]!==r?(M=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_}),t[11]=C,t[12]=n,t[13]=T,t[14]=_,t[15]=r,t[16]=M):M=t[16];let N;t[17]!==M||t[18]!==j?(N=(0,v.jsx)(o,{className:j,children:M}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;return t[20]!==r.phase||t[21]!==N||t[22]!==O||t[23]!==A?(P=(0,v.jsx)(c,{open:!0,onOpenChange:E,children:(0,v.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,N]})}),t[20]=r.phase,t[21]=N,t[22]=O,t[23]=A,t[24]=P):P=t[24],P}export{b as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r}from"./dist-DBENJeML.js";import{t as i}from"./compiler-runtime-dQcBxOhn.js";import{s as ee}from"./createLucideIcon-BUb14crZ.js";import{t as a}from"./button-DHE6Sx02.js";import{a as o,m as te,n as s,o as ne,r as c,t as re,u as l}from"./dropdown-menu-CcKe8PiU.js";import{Nt as u,P as ie}from"./dist-Vm1kQiqo.js";import{t as d}from"./chevron-down-0vl-mPeL.js";import{i as ae,r as oe}from"./skill-actions-s_ATobEI.js";var se=i(),f=e(n(),1),p=t(),m=u.options;function h(e){let t=(0,se.c)(74),{scope:n,name:i}=e,u=ae(),h=oe(),g;t[0]!==i||t[1]!==n||t[2]!==u.data||t[3]!==u.status?(g=u.status===`ready`?u.data.find(e=>e.scope===n&&e.name===i):void 0,t[0]=i,t[1]=n,t[2]=u.data,t[3]=u.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==i||t[7]!==n?(v=_??{scope:n,name:i,path:i,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=i,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===i,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=re;let n=E?`installed`:`draft`,i=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,o;t[36]===i?o=t[37]:(o=ee(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,i),t[36]=i,t[37]=o);let l;t[38]!==E||t[39]!==b?(l=b?(0,p.jsx)(r,{id:`b4itZn`}):E?(0,p.jsx)(r,{id:`eQkgKV`}):(0,p.jsx)(r,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=l):l=t[40];let u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,p.jsx)(d,{"aria-hidden":!0}),t[41]=u):u=t[41],t[42]!==b||t[43]!==n||t[44]!==o||t[45]!==l?(W=(0,p.jsx)(te,{asChild:!0,children:(0,p.jsxs)(a,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:o,children:[l,u]})}),t[42]=b,t[43]=n,t[44]=o,t[45]=l,t[46]=W):W=t[46],L=c,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(ne,{children:(0,p.jsx)(r,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(s,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:ie[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(l,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(r,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(o,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(o,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(r,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{n as r}from"./dist-DBENJeML.js";import{t as i}from"./compiler-runtime-dQcBxOhn.js";import{s as ee}from"./createLucideIcon-BUb14crZ.js";import{t as a}from"./button-DHE6Sx02.js";import{a as o,m as te,n as s,o as ne,r as c,t as re,u as l}from"./dropdown-menu-CcKe8PiU.js";import{Nt as u,P as ie}from"./dist-df-v6kvy.js";import{t as d}from"./chevron-down-0vl-mPeL.js";import{i as ae,r as oe}from"./skill-actions-DeZSwOo7.js";var se=i(),f=e(n(),1),p=t(),m=u.options;function h(e){let t=(0,se.c)(74),{scope:n,name:i}=e,u=ae(),h=oe(),g;t[0]!==i||t[1]!==n||t[2]!==u.data||t[3]!==u.status?(g=u.status===`ready`?u.data.find(e=>e.scope===n&&e.name===i):void 0,t[0]=i,t[1]=n,t[2]=u.data,t[3]=u.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==i||t[7]!==n?(v=_??{scope:n,name:i,path:i,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=i,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===i,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=re;let n=E?`installed`:`draft`,i=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,o;t[36]===i?o=t[37]:(o=ee(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,i),t[36]=i,t[37]=o);let l;t[38]!==E||t[39]!==b?(l=b?(0,p.jsx)(r,{id:`b4itZn`}):E?(0,p.jsx)(r,{id:`eQkgKV`}):(0,p.jsx)(r,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=l):l=t[40];let u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,p.jsx)(d,{"aria-hidden":!0}),t[41]=u):u=t[41],t[42]!==b||t[43]!==n||t[44]!==o||t[45]!==l?(W=(0,p.jsx)(te,{asChild:!0,children:(0,p.jsxs)(a,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:o,children:[l,u]})}),t[42]=b,t[43]=n,t[44]=o,t[45]=l,t[46]=W):W=t[46],L=c,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(ne,{children:(0,p.jsx)(r,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(s,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:ie[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(l,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(r,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(o,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(o,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(r,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{M as n,dt as r,ut as i,z as a}from"./DocumentContext-CPZffvoA.js";import{t as o}from"./react-JNybMug3.js";import{n as s}from"./dist-COAuqNbv.js";import{t as c}from"./compiler-runtime-dQcBxOhn.js";import{O as l,P as ee,a as u,i as te,o as d}from"./CodeMirrorPropInput-DUwQlljh.js";import{Cn as f,E as p,L as m,Ni as ne,Qr as h,br as g}from"./dist-Vm1kQiqo.js";import{l as re}from"./keyboard-shortcuts-DZ9kTSZ4.js";import"./config-provider-DstRVgzH.js";import{Dt as _,Et as v,It as y,J as b,Ot as ie,P as x,Q as S,X as C,dt as ae,mt as oe}from"./dist-5kUc8Rop.js";import{n as se}from"./config-context-C5AosGyi.js";import{o as ce,r as le}from"./selection-context-BpEA0WhV.js";import{c as ue,f as de,n as fe,p as pe,r as me,u as he}from"./typing-burst-detector-CI_4wux0.js";import{o as ge}from"./lint-config-client-Bg-6mquJ.js";import{i as _e,n as w,r as T,t as ve}from"./dist-DKsN2Ojq.js";import{t as ye}from"./src-B-pNk3y3.js";var E=e(o(),1),be=c();function xe(e,t){return e.enabled?[w(),T(async n=>O(n.state.doc,await g(n.state.doc.toString(),e,t)),{delay:600})]:[]}function D(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function O(e,t){let n=[];for(let r of t){let t=D(e,r.range.start),i=D(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=k(r);o&&(a.actions=[o]),n.push(a)}return n}function k(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:D(n,e.range.start),to:D(n,e.range.end),insert:e.newText}))})}}}var A=b.mark({class:`cm-link-ref-broken`}),j=/^\s{0,3}\[([^\]]+)\]:\s/,M=/\[([^\]]*)\]\[([^\]]*)\]/g,N=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function P(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function F(e){let t=[];return x(e).iterate({enter(e){if(N.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function I(e){let t=new Set,n=[],r=e.doc,i=F(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(P(n.from,i))continue;let a=j.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!P(t.from,i)&&!j.test(t.text))for(M.lastIndex=0;;){let e=M.exec(t.text);if(!e)break;let r=t.from+e.index;if(P(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(A.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),b.set(a)}var L=y.define({create(e){return I(e)},update(e,t){return t.docChanged?I(t.state):e},provide:e=>C.decorations.from(e)}),R=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,z=b.mark({class:`cm-del`}),B=b.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),V=b.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function H(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function U(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!m.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(m.test(r.text))return{from:t.from,to:r.to}}return null}function W(e,t){let n=[],r=x(e),i=U(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(z.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=R.exec(r.text),a=i?i[1].length:2,o=b.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=H(r.text),a=b.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(B.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),b.set(n)}var G=class{decorations;constructor(e){this.decorations=W(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||x(e.startState)!==x(e.state))&&(this.decorations=W(e.view.state,e.view.visibleRanges))}},K=S.fromClass(G,{decorations:e=>e.decorations});function Se(){return[K,L]}var Ce=t(),q=56;function we(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&m.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(m.test(n.line(e).text)){r=e+1;break}}let i=f(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:_.cursor(r.from),effects:C.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Te(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:_.cursor(r),effects:C.scrollIntoView(r,{y:`center`})}),e.focus()})}function Ee(e,t){let n=e.state.doc,r=Math.min(Math.max(t.line,1),n.lines),i=n.line(r),a=Math.min(i.from+Math.max(0,t.column-1),i.to);e.dispatch({selection:_.cursor(a),effects:C.scrollIntoView(a,{y:`start`})}),e.focus()}function J(e){let t=(0,be.c)(49),{docName:o,ytext:c,provider:l,placeholder:f,isSourceModeActive:m}=e,g=(0,E.useRef)(null),_=(0,E.useRef)(null),[y,b]=(0,E.useState)(null);if(y)throw y;let{resolvedTheme:x}=s(),{merged:S}=se(),w=(0,E.useRef)(m),T=S?.editor?.wordWrap??!0,{data:D}=ge(o),O;t[0]!==D?.effective||t[1]!==S?(O=D?.effective??(S?.contentRules?h(S.contentRules):p),t[0]=D?.effective,t[1]=S,t[2]=O):O=t[2];let k=O,A;t[3]===k?A=t[4]:(A=JSON.stringify(k),t[3]=k,t[4]=A);let j=A,M,N;t[5]===m?(M=t[6],N=t[7]):(M=()=>{w.current=m},N=[m],t[5]=m,t[6]=M,t[7]=N),(0,E.useEffect)(M,N);let P=(0,E.useRef)(null),F;t[8]!==o||t[9]!==k||t[10]!==f||t[11]!==l||t[12]!==x||t[13]!==T||t[14]!==c?(F=()=>{let e=g.current;if(!e)return;let t=l.configuration.name??``,s,u=ke;try{s=i({docName:t,container:e,sizeStats:{viewCount:0,bytes:c.length},factory:e=>{let r=null,i=n({ydoc:l.document,ytext:c}),s=new v,d=new v,p=new v,m=new v,h=new C({state:ie.create({doc:c.toString(),extensions:[ve,_e({scrollToMatch:Oe}),ae.of([ee]),ye(c,l.awareness),...te({themeCompartment:s,resolvedTheme:x,ydoc:l.document,wordWrapCompartment:d,wordWrap:T,currentDocName:t}),Se(),m.of(xe(k,o)),i,C.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,fe(t,`source`,me(e.view)),le(t,`source`,ce(e.view,t))},120))}),C.domEventHandlers({keydown:(e,t)=>!w.current||!ne()||!re(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),a(),!0)}),p.of(oe(f??``)),C.theme({"&":{height:`100%`}}),C.scrollMargins.of(De)]}),parent:e});fe(t,`source`,me(h)),le(t,`source`,ce(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,u),g.addEventListener(`paste`,u),g.addEventListener(`drop`,u),g.addEventListener(`cut`,u),{view:h,ydoc:l.document,ytext:c,provider:l,themeCompartment:s,wordWrapCompartment:d,placeholderCompartment:p,lintCompartment:m}}}),P.current=s,_.current=s.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),P.current=null,_.current=null,b(t instanceof Error?t:Error(String(t)))}return()=>{let e=P.current;e&&r(e),P.current=null,_.current=null}},t[8]=o,t[9]=k,t[10]=f,t[11]=l,t[12]=x,t[13]=T,t[14]=c,t[15]=F):F=t[15];let I;t[16]!==l||t[17]!==c?(I=[c,l],t[16]=l,t[17]=c,t[18]=I):I=t[18],(0,E.useEffect)(F,I);let L,R;t[19]===o?(L=t[20],R=t[21]):(L=()=>{},R=[o],t[19]=o,t[20]=L,t[21]=R),(0,E.useEffect)(L,R);let z,B;t[22]===x?(z=t[23],B=t[24]):(B=()=>{let e=P.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(x===`dark`?u:d)})},z=[x],t[22]=x,t[23]=z,t[24]=B),(0,E.useEffect)(B,z);let V,H;t[25]===T?(V=t[26],H=t[27]):(V=()=>{let e=P.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(T?C.lineWrapping:[])})},H=[T],t[25]=T,t[26]=V,t[27]=H),(0,E.useEffect)(V,H);let U,W;t[28]===f?(U=t[29],W=t[30]):(U=()=>{let e=P.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(oe(f??``))})},W=[f],t[28]=f,t[29]=U,t[30]=W),(0,E.useEffect)(U,W);let G;t[31]!==o||t[32]!==k?(G=()=>{let e=P.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(xe(k,o))})},t[31]=o,t[32]=k,t[33]=G):G=t[33];let K;t[34]===j?K=t[35]:(K=[j],t[34]=j,t[35]=K),(0,E.useEffect)(G,K);let q,J;t[36]!==o||t[37]!==m?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!m)return;let n=_.current;n&&(we(n,t),de(o))};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},J=[o,m],t[36]=o,t[37]=m,t[38]=q,t[39]=J):(q=t[38],J=t[39]),(0,E.useEffect)(q,J);let Y,X;t[40]!==o||t[41]!==m?(Y=()=>{let e=function(e){let t=e.detail;if(!t||!m)return;let n=_.current;n&&(Ee(n,t),de(o))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},X=[o,m],t[40]=o,t[41]=m,t[42]=Y,t[43]=X):(Y=t[42],X=t[43]),(0,E.useEffect)(Y,X);let Z,Q;t[44]!==o||t[45]!==m?(Z=()=>{if(!m)return;let e=_.current;if(!e)return;let t=pe(o);if(t){if(t.kind===`outline`){we(e,t.detail);return}if(t.kind===`lint`){Ee(e,t.detail);return}Te(e,t.detail)}},Q=[o,m],t[44]=o,t[45]=m,t[46]=Z,t[47]=Q):(Z=t[46],Q=t[47]),(0,E.useEffect)(Z,Q);let $;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,Ce.jsx)(`div`,{ref:g,className:`source-editor h-full pb-3`}),t[48]=$):$=t[48],$}function De(){return{top:q}}function Oe(e){return C.scrollIntoView(e,{y:`start`})}function ke(){return l()}export{J as SourceEditor};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{M as n,dt as r,ut as i,z as a}from"./DocumentContext-C4Ar5jL6.js";import{t as o}from"./react-JNybMug3.js";import{n as s}from"./dist-COAuqNbv.js";import{t as c}from"./compiler-runtime-dQcBxOhn.js";import{O as l,P as ee,a as u,i as te,o as d}from"./CodeMirrorPropInput-DqNDfEnD.js";import{Cn as f,E as p,L as m,Ni as ne,Qr as h,br as g}from"./dist-df-v6kvy.js";import{l as re}from"./keyboard-shortcuts-Ctc7xams.js";import"./config-provider-BMeRatQe.js";import{Dt as _,Et as v,It as y,J as b,Ot as ie,P as x,Q as S,X as C,dt as ae,mt as oe}from"./dist-5kUc8Rop.js";import{n as se}from"./config-context-C5AosGyi.js";import{o as ce,r as le}from"./selection-context-z7qCoarT.js";import{c as ue,f as de,n as fe,p as pe,r as me,u as he}from"./typing-burst-detector-BJJh89A5.js";import{o as ge}from"./lint-config-client-BwIg_Zty.js";import{i as _e,n as w,r as T,t as ve}from"./dist-2zkQMrQC.js";import{t as ye}from"./src-BlUYczaV.js";var E=e(o(),1),be=c();function xe(e,t){return e.enabled?[w(),T(async n=>O(n.state.doc,await g(n.state.doc.toString(),e,t)),{delay:600})]:[]}function D(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function O(e,t){let n=[];for(let r of t){let t=D(e,r.range.start),i=D(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=k(r);o&&(a.actions=[o]),n.push(a)}return n}function k(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:D(n,e.range.start),to:D(n,e.range.end),insert:e.newText}))})}}}var A=b.mark({class:`cm-link-ref-broken`}),j=/^\s{0,3}\[([^\]]+)\]:\s/,M=/\[([^\]]*)\]\[([^\]]*)\]/g,N=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function P(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function F(e){let t=[];return x(e).iterate({enter(e){if(N.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function I(e){let t=new Set,n=[],r=e.doc,i=F(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(P(n.from,i))continue;let a=j.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!P(t.from,i)&&!j.test(t.text))for(M.lastIndex=0;;){let e=M.exec(t.text);if(!e)break;let r=t.from+e.index;if(P(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(A.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),b.set(a)}var L=y.define({create(e){return I(e)},update(e,t){return t.docChanged?I(t.state):e},provide:e=>C.decorations.from(e)}),R=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,z=b.mark({class:`cm-del`}),B=b.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),V=b.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function H(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function U(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!m.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(m.test(r.text))return{from:t.from,to:r.to}}return null}function W(e,t){let n=[],r=x(e),i=U(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(z.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=R.exec(r.text),a=i?i[1].length:2,o=b.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=H(r.text),a=b.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(B.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),b.set(n)}var G=class{decorations;constructor(e){this.decorations=W(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||x(e.startState)!==x(e.state))&&(this.decorations=W(e.view.state,e.view.visibleRanges))}},K=S.fromClass(G,{decorations:e=>e.decorations});function Se(){return[K,L]}var Ce=t(),q=56;function we(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&m.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(m.test(n.line(e).text)){r=e+1;break}}let i=f(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:_.cursor(r.from),effects:C.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Te(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:_.cursor(r),effects:C.scrollIntoView(r,{y:`center`})}),e.focus()})}function Ee(e,t){let n=e.state.doc,r=Math.min(Math.max(t.line,1),n.lines),i=n.line(r),a=Math.min(i.from+Math.max(0,t.column-1),i.to);e.dispatch({selection:_.cursor(a),effects:C.scrollIntoView(a,{y:`start`})}),e.focus()}function J(e){let t=(0,be.c)(49),{docName:o,ytext:c,provider:l,placeholder:f,isSourceModeActive:m}=e,g=(0,E.useRef)(null),_=(0,E.useRef)(null),[y,b]=(0,E.useState)(null);if(y)throw y;let{resolvedTheme:x}=s(),{merged:S}=se(),w=(0,E.useRef)(m),T=S?.editor?.wordWrap??!0,{data:D}=ge(o),O;t[0]!==D?.effective||t[1]!==S?(O=D?.effective??(S?.contentRules?h(S.contentRules):p),t[0]=D?.effective,t[1]=S,t[2]=O):O=t[2];let k=O,A;t[3]===k?A=t[4]:(A=JSON.stringify(k),t[3]=k,t[4]=A);let j=A,M,N;t[5]===m?(M=t[6],N=t[7]):(M=()=>{w.current=m},N=[m],t[5]=m,t[6]=M,t[7]=N),(0,E.useEffect)(M,N);let P=(0,E.useRef)(null),F;t[8]!==o||t[9]!==k||t[10]!==f||t[11]!==l||t[12]!==x||t[13]!==T||t[14]!==c?(F=()=>{let e=g.current;if(!e)return;let t=l.configuration.name??``,s,u=ke;try{s=i({docName:t,container:e,sizeStats:{viewCount:0,bytes:c.length},factory:e=>{let r=null,i=n({ydoc:l.document,ytext:c}),s=new v,d=new v,p=new v,m=new v,h=new C({state:ie.create({doc:c.toString(),extensions:[ve,_e({scrollToMatch:Oe}),ae.of([ee]),ye(c,l.awareness),...te({themeCompartment:s,resolvedTheme:x,ydoc:l.document,wordWrapCompartment:d,wordWrap:T,currentDocName:t}),Se(),m.of(xe(k,o)),i,C.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,fe(t,`source`,me(e.view)),le(t,`source`,ce(e.view,t))},120))}),C.domEventHandlers({keydown:(e,t)=>!w.current||!ne()||!re(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),a(),!0)}),p.of(oe(f??``)),C.theme({"&":{height:`100%`}}),C.scrollMargins.of(De)]}),parent:e});fe(t,`source`,me(h)),le(t,`source`,ce(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,u),g.addEventListener(`paste`,u),g.addEventListener(`drop`,u),g.addEventListener(`cut`,u),{view:h,ydoc:l.document,ytext:c,provider:l,themeCompartment:s,wordWrapCompartment:d,placeholderCompartment:p,lintCompartment:m}}}),P.current=s,_.current=s.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),P.current=null,_.current=null,b(t instanceof Error?t:Error(String(t)))}return()=>{let e=P.current;e&&r(e),P.current=null,_.current=null}},t[8]=o,t[9]=k,t[10]=f,t[11]=l,t[12]=x,t[13]=T,t[14]=c,t[15]=F):F=t[15];let I;t[16]!==l||t[17]!==c?(I=[c,l],t[16]=l,t[17]=c,t[18]=I):I=t[18],(0,E.useEffect)(F,I);let L,R;t[19]===o?(L=t[20],R=t[21]):(L=()=>{},R=[o],t[19]=o,t[20]=L,t[21]=R),(0,E.useEffect)(L,R);let z,B;t[22]===x?(z=t[23],B=t[24]):(B=()=>{let e=P.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(x===`dark`?u:d)})},z=[x],t[22]=x,t[23]=z,t[24]=B),(0,E.useEffect)(B,z);let V,H;t[25]===T?(V=t[26],H=t[27]):(V=()=>{let e=P.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(T?C.lineWrapping:[])})},H=[T],t[25]=T,t[26]=V,t[27]=H),(0,E.useEffect)(V,H);let U,W;t[28]===f?(U=t[29],W=t[30]):(U=()=>{let e=P.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(oe(f??``))})},W=[f],t[28]=f,t[29]=U,t[30]=W),(0,E.useEffect)(U,W);let G;t[31]!==o||t[32]!==k?(G=()=>{let e=P.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(xe(k,o))})},t[31]=o,t[32]=k,t[33]=G):G=t[33];let K;t[34]===j?K=t[35]:(K=[j],t[34]=j,t[35]=K),(0,E.useEffect)(G,K);let q,J;t[36]!==o||t[37]!==m?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!m)return;let n=_.current;n&&(we(n,t),de(o))};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},J=[o,m],t[36]=o,t[37]=m,t[38]=q,t[39]=J):(q=t[38],J=t[39]),(0,E.useEffect)(q,J);let Y,X;t[40]!==o||t[41]!==m?(Y=()=>{let e=function(e){let t=e.detail;if(!t||!m)return;let n=_.current;n&&(Ee(n,t),de(o))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},X=[o,m],t[40]=o,t[41]=m,t[42]=Y,t[43]=X):(Y=t[42],X=t[43]),(0,E.useEffect)(Y,X);let Z,Q;t[44]!==o||t[45]!==m?(Z=()=>{if(!m)return;let e=_.current;if(!e)return;let t=pe(o);if(t){if(t.kind===`outline`){we(e,t.detail);return}if(t.kind===`lint`){Ee(e,t.detail);return}Te(e,t.detail)}},Q=[o,m],t[44]=o,t[45]=m,t[46]=Z,t[47]=Q):(Z=t[46],Q=t[47]),(0,E.useEffect)(Z,Q);let $;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,Ce.jsx)(`div`,{ref:g,className:`source-editor h-full pb-3`}),t[48]=$):$=t[48],$}function De(){return{top:q}}function Oe(e){return C.scrollIntoView(e,{y:`start`})}function ke(){return l()}export{J as SourceEditor};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{r}from"./dist-DBENJeML.js";import{n as i}from"./dist-COAuqNbv.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{s as o}from"./createLucideIcon-BUb14crZ.js";import{t as s}from"./button-DHE6Sx02.js";import{Jr as c,Kr as l,Lt as u,Qt as d,nn as f}from"./dist-Vm1kQiqo.js";import{t as p}from"./x-6ATUQvcC.js";import{n as m}from"./dist-DwCd6eR-.js";import{d as h}from"./navigation-targets-4J3F85tT.js";import{a as g,c as _,s as v}from"./doc-hash-B8kD24Kw.js";import{t as y}from"./config-context-C5AosGyi.js";import{f as b,m as x}from"./file-tree-adapter-eftmn56d.js";import{t as ee}from"./use-live-xterm-theme-oqXGh0AM.js";var S=a(),C=2,w=1,te=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(C,Math.floor(u/e.css.cell.width)),rows:Math.max(w,Math.floor(l/e.css.cell.height))}}},T=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ne=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function re(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var ie=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<T.length;++e)E.fill(0,T[e][0],T[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:re(e,ne)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=$e.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return $e.createPropertyValue(0,n,r)}},ae=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?se.isErrorNoTelemetry(e)?new se(e.message+`
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{t}from"./jsx-runtime-DyiINK0N.js";import{t as n}from"./react-JNybMug3.js";import{r}from"./dist-DBENJeML.js";import{n as i}from"./dist-COAuqNbv.js";import{t as a}from"./compiler-runtime-dQcBxOhn.js";import{s as o}from"./createLucideIcon-BUb14crZ.js";import{t as s}from"./button-DHE6Sx02.js";import{Jr as c,Kr as l,Lt as u,Qt as d,nn as f}from"./dist-df-v6kvy.js";import{t as p}from"./x-6ATUQvcC.js";import{n as m}from"./dist-DwCd6eR-.js";import{d as h}from"./navigation-targets-D1rdXyAI.js";import{a as g,c as _,s as v}from"./doc-hash-NyLrtNo2.js";import{t as y}from"./config-context-C5AosGyi.js";import{f as b,m as x}from"./file-tree-adapter-BnZwo5Ls.js";import{t as ee}from"./use-live-xterm-theme-DW54zfIk.js";var S=a(),C=2,w=1,te=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(C,Math.floor(u/e.css.cell.width)),rows:Math.max(w,Math.floor(l/e.css.cell.height))}}},T=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ne=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function re(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var ie=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<T.length;++e)E.fill(0,T[e][0],T[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:re(e,ne)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=$e.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return $e.createPropertyValue(0,n,r)}},ae=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?se.isErrorNoTelemetry(e)?new se(e.message+`
2
2
 
3
3
  `+e.stack):Error(e.message+`
4
4