@inkeep/open-knowledge 0.46.0-beta.21 → 0.46.0-beta.22

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 (212) hide show
  1. package/dist/{abnfDiagram-VRR7QNED-CyIW4oQ8.mjs → abnfDiagram-VRR7QNED-C01LwnLj.mjs} +2 -2
  2. package/dist/{acp-harness-probe--uGaXex0.mjs → acp-harness-probe-CRn8eK5E.mjs} +2 -2
  3. package/dist/{architectureDiagram-ZJ3FMSHR-CLPPzKEe.mjs → architectureDiagram-ZJ3FMSHR-54tD72To.mjs} +2 -2
  4. package/dist/{blockDiagram-677ZJIJ3-C-y19CxU.mjs → blockDiagram-677ZJIJ3-BFWl-x5e.mjs} +2 -2
  5. package/dist/{c4Diagram-LMCZKHZV-o2jsbHiN.mjs → c4Diagram-LMCZKHZV-BkY5gq8X.mjs} +2 -2
  6. package/dist/channel-DppMxZyL.mjs +2 -0
  7. package/dist/{chunk-32BRIVSS-DYHXEarP.mjs → chunk-32BRIVSS-Bsc-9o_O.mjs} +2 -2
  8. package/dist/{chunk-52WLFC77-DH1KQBRY.mjs → chunk-52WLFC77-D0ICJuoG.mjs} +2 -2
  9. package/dist/{chunk-C7G6YPKG-Bd7km2QU.mjs → chunk-C7G6YPKG-6PzAyV0E.mjs} +2 -2
  10. package/dist/{chunk-EX3LRPZG-BMWHPlJp.mjs → chunk-EX3LRPZG-Bk8s0J-D.mjs} +2 -2
  11. package/dist/{chunk-FWX5IMBZ-BAa0doOI.mjs → chunk-FWX5IMBZ-BKxaTzwN.mjs} +2 -2
  12. package/dist/{chunk-HKLCLINH-C_zL5CHv.mjs → chunk-HKLCLINH-DkU4By68.mjs} +2 -2
  13. package/dist/{chunk-HOUHSVGY-DEVfwHxJ.mjs → chunk-HOUHSVGY-CM96kWHC.mjs} +2 -2
  14. package/dist/{chunk-ICXQ74PX-BVMOo_rh.mjs → chunk-ICXQ74PX-a_OoZV-J.mjs} +2 -2
  15. package/dist/{chunk-MOJQB5TN-BlrHhlHB.mjs → chunk-MOJQB5TN-a3t5NDdo.mjs} +2 -2
  16. package/dist/{chunk-OGEWGWER-Diyk7J65.mjs → chunk-OGEWGWER-BE748IwJ.mjs} +2 -2
  17. package/dist/{chunk-PUDLZKDR-BIqiwjP2.mjs → chunk-PUDLZKDR-CgH8fCPb.mjs} +2 -2
  18. package/dist/{chunk-Q4XR5HBZ-CQiRMQNx.mjs → chunk-Q4XR5HBZ-Dj_gUljr.mjs} +2 -2
  19. package/dist/{chunk-V7JOEXUC-31UT4kI9.mjs → chunk-V7JOEXUC-Ca3kqXAx.mjs} +2 -2
  20. package/dist/{chunk-VAUOI2AC-Irj_jrJs.mjs → chunk-VAUOI2AC-CLylHljB.mjs} +2 -2
  21. package/dist/{chunk-VR4S4FIN-ClMSUBWQ.mjs → chunk-VR4S4FIN-DFCLUzSW.mjs} +2 -2
  22. package/dist/{chunk-WYO6CB5R-Bu0g7bu2.mjs → chunk-WYO6CB5R-CkxB2qiV.mjs} +2 -2
  23. package/dist/{chunk-XKWWSDBF-CY0zm_d3.mjs → chunk-XKWWSDBF-BTq_A_8q.mjs} +3 -3
  24. package/dist/{chunk-ZGVPDNZ5-DSVV_BiI.mjs → chunk-ZGVPDNZ5-DExn7OfJ.mjs} +2 -2
  25. package/dist/classDiagram-OUVF2IWQ-c5qgwZAE.mjs +2 -0
  26. package/dist/classDiagram-v2-EOCWNBFH-D9ilZPqi.mjs +2 -0
  27. package/dist/cli.mjs +64 -64
  28. package/dist/constants-BtN4Fp1d.mjs +2 -0
  29. package/dist/{cynefinDiagram-TSTJHNR4-Dp6ZCni9.mjs → cynefinDiagram-TSTJHNR4-CT6-xML3.mjs} +2 -2
  30. package/dist/{dagre-VKFMJZFB-FTWgT7HO.mjs → dagre-VKFMJZFB-BGysx5vx.mjs} +2 -2
  31. package/dist/{diagram-FQU43EPY-BgUehmaO.mjs → diagram-FQU43EPY-ZqRG6Q5e.mjs} +2 -2
  32. package/dist/{diagram-G47NLZAW-gH-Ih94q.mjs → diagram-G47NLZAW-DI7dcuHy.mjs} +2 -2
  33. package/dist/{diagram-NH7WQ7WH-DYr1RvMm.mjs → diagram-NH7WQ7WH-D1oPk0UR.mjs} +2 -2
  34. package/dist/{diagram-OA4YK3LP-BRb4Y3EQ.mjs → diagram-OA4YK3LP-Bm3vioHL.mjs} +2 -2
  35. package/dist/{diagram-WEI45ONY-Bcifi75m.mjs → diagram-WEI45ONY-Dn8oUVjW.mjs} +2 -2
  36. package/dist/{ebnfDiagram-CCIWWBDH-BlBla8lv.mjs → ebnfDiagram-CCIWWBDH-Cv_KK2i9.mjs} +2 -2
  37. package/dist/{erDiagram-Q63AITRT-BxKcPLGX.mjs → erDiagram-Q63AITRT-Bt6lGD8v.mjs} +2 -2
  38. package/dist/{esm-CItKw7Y6.mjs → esm-DxvI2ZVA.mjs} +1 -1
  39. package/dist/{flag-coverage-6JEX67RU-D1byxsyF.mjs → flag-coverage-6JEX67RU-C21BAvUp.mjs} +2 -2
  40. package/dist/flowDiagram-23GEKE2U-BHZRRZtz.mjs +1 -0
  41. package/dist/fs-traced-DbSNN5G0.mjs +1 -0
  42. package/dist/fs-traced-S0kTDDbJ.mjs +12 -0
  43. package/dist/{ganttDiagram-NO4QXBWP-DGpVzTxp.mjs → ganttDiagram-NO4QXBWP-DbUuL83g.mjs} +2 -2
  44. package/dist/{getMachineId-bsd-BZEr0yHg.mjs → getMachineId-bsd-Ba_eiHKT.mjs} +2 -2
  45. package/dist/{getMachineId-bsd-BN-aHS3V.mjs → getMachineId-bsd-MpjjBCnQ.mjs} +2 -2
  46. package/dist/{getMachineId-darwin-BWLy_Kik.mjs → getMachineId-darwin-CCowcQE1.mjs} +2 -2
  47. package/dist/{getMachineId-darwin-CRdUTcMc.mjs → getMachineId-darwin-CCtDS2VI.mjs} +2 -2
  48. package/dist/{getMachineId-linux-CVE8Y0Fo.mjs → getMachineId-linux-DMjXicei.mjs} +2 -2
  49. package/dist/{getMachineId-linux-DX2JAnAv.mjs → getMachineId-linux-DdmiwElW.mjs} +2 -2
  50. package/dist/{getMachineId-unsupported-CA6ETHmi.mjs → getMachineId-unsupported-x9lk4Rw9.mjs} +2 -2
  51. package/dist/{getMachineId-unsupported-DmJiNggJ.mjs → getMachineId-unsupported-xN2oDqpO.mjs} +2 -2
  52. package/dist/{getMachineId-win-nbjd9hhL.mjs → getMachineId-win-DuQfpi_A.mjs} +2 -2
  53. package/dist/{getMachineId-win-B_OXaWuM.mjs → getMachineId-win-mbAJtBuz.mjs} +2 -2
  54. package/dist/{git-handle-C-4njDy4.mjs → git-handle-B4sZCaOF.mjs} +2 -2
  55. package/dist/git-handle-uBCwtyAf.mjs +1 -0
  56. package/dist/{gitGraphDiagram-IHSO6WYX-BHxhlO7y.mjs → gitGraphDiagram-IHSO6WYX-C-Kq9SCM.mjs} +2 -2
  57. package/dist/index.d.mts +94 -4
  58. package/dist/index.mjs +1 -1
  59. package/dist/{infoDiagram-FWYZ7A6U-Be13xP1j.mjs → infoDiagram-FWYZ7A6U-BcXqPzyL.mjs} +2 -2
  60. package/dist/init-Cx94zXdb.mjs +1 -0
  61. package/dist/{init-ClZIjoyZ.mjs → init-DB7V_L0g.mjs} +35 -35
  62. package/dist/{ishikawaDiagram-FXEZZL3T-DTVMpa-_.mjs → ishikawaDiagram-FXEZZL3T-tlTxPgv8.mjs} +2 -2
  63. package/dist/{journeyDiagram-5HDEW3XC-BTWVlxLh.mjs → journeyDiagram-5HDEW3XC-NczxLuUX.mjs} +2 -2
  64. package/dist/{kanban-definition-HUTT4EX6-g-tXrd8p.mjs → kanban-definition-HUTT4EX6-CJ2cty8a.mjs} +2 -2
  65. package/dist/{katex-Bi5vgbZh.mjs → katex-BCblvTb9.mjs} +1 -1
  66. package/dist/{launch-json-removal-A4pVH8BU.mjs → launch-json-removal-D3Fmd63b.mjs} +2 -2
  67. package/dist/{line-Bq-Bigdz.mjs → line-CyR2aPKZ.mjs} +2 -2
  68. package/dist/loader-C3960z78.mjs +2 -0
  69. package/dist/loader-CRQzxtMB.mjs +1 -0
  70. package/dist/{logger-B7Z8XO-z.mjs → logger-5LePyO3n.mjs} +3 -3
  71. package/dist/{lzma-66I-DF3D.mjs → lzma-yp9l_vMN.mjs} +2 -2
  72. package/dist/markdownit-7GRZNS8U.mjs +1 -0
  73. package/dist/{markdownit-BX7TxUEO.mjs → markdownit-BNz2xGu4.mjs} +1 -1
  74. package/dist/md-manager-DZuZjzrd.mjs +2 -0
  75. package/dist/{mermaid.core-BeGj3DLy.mjs → mermaid.core-CZm3qvuv.mjs} +3 -3
  76. package/dist/{mindmap-definition-LN4V7U3C-BMIyW_lX.mjs → mindmap-definition-LN4V7U3C-DYytxufy.mjs} +2 -2
  77. package/dist/{open-browser-ht7iEqMu.mjs → open-browser-C7gapRCk.mjs} +2 -2
  78. package/dist/parse-worker.mjs +1 -1
  79. package/dist/{pegDiagram-2B236MQR-j5NleAHq.mjs → pegDiagram-2B236MQR-tT5pVAwT.mjs} +2 -2
  80. package/dist/{pieDiagram-ENE6RG2P-BGffNz0y.mjs → pieDiagram-ENE6RG2P-kD_93j1i.mjs} +2 -2
  81. package/dist/{preview-BLLXZhXK.mjs → preview-BptdoKu1.mjs} +2 -2
  82. package/dist/preview-CLNTLfvK.mjs +1 -0
  83. package/dist/public/assets/{ActivityModeContent-FNrTftul.js → ActivityModeContent-DSMkdCKH.js} +1 -1
  84. package/dist/public/assets/{AgentDiffPane-Fn4gJpWE.js → AgentDiffPane-C4Ff6cFp.js} +1 -1
  85. package/dist/public/assets/{AgentThreadClientBinder-C6qMoZ6y.js → AgentThreadClientBinder-BGP2cYbn.js} +1 -1
  86. package/dist/public/assets/{ChangedOutsideBadge-hZYC6kff.js → ChangedOutsideBadge-5cWobd6L.js} +1 -1
  87. package/dist/public/assets/{CodeMirrorPropInput-7jlwH38H.js → CodeMirrorPropInput-BFenJemA.js} +1 -1
  88. package/dist/public/assets/{DocumentContext-D2Zxk1ro.js → DocumentContext-CKMhLy2N.js} +1 -1
  89. package/dist/public/assets/{EditorModeToggle-EtEqcZm6.js → EditorModeToggle-BYt93vnW.js} +1 -1
  90. package/dist/public/assets/{EnableSyncConfirmDialog-CqlZIrfh.js → EnableSyncConfirmDialog-V141T2QR.js} +1 -1
  91. package/dist/public/assets/FeedbackForm-BFPoJkdK.js +1 -0
  92. package/dist/public/assets/{GraphPanel-C1iICOOC.js → GraphPanel-BHhs9d_j.js} +1 -1
  93. package/dist/public/assets/{ImportSkillDialog-CcnnPQWH.js → ImportSkillDialog-BBOb5ucQ.js} +1 -1
  94. package/dist/public/assets/{LintConfigEditor-BBNyuz2O.js → LintConfigEditor-BQrh8rjg.js} +1 -1
  95. package/dist/public/assets/{ManagedArtifactProperties-CoGLUHSS.js → ManagedArtifactProperties-C2RUr9ul.js} +1 -1
  96. package/dist/public/assets/ManagedArtifactProperties-C4CnV_IS.js +1 -0
  97. package/dist/public/assets/{McpConsentDialogBody-Bzy77Gzw.js → McpConsentDialogBody-CnzWhv5d.js} +1 -1
  98. package/dist/public/assets/{MermaidDocEditor-zpY_4dgz.js → MermaidDocEditor-CNK3K4lC.js} +1 -1
  99. package/dist/public/assets/{ReportBugDialogBody-CoM6D3VY.js → ReportBugDialogBody-cxc30WKp.js} +1 -1
  100. package/dist/public/assets/{SchemaConfigEditor-DvpY4XyG.js → SchemaConfigEditor-BpQBtTyY.js} +1 -1
  101. package/dist/public/assets/{SessionsHost-C4hHsdu0.js → SessionsHost-CbagO4xN.js} +2 -2
  102. package/dist/public/assets/{SettingsDialogBody-L8vKdOyj.js → SettingsDialogBody-hWpwDgnT.js} +1 -1
  103. package/dist/public/assets/{ShareBranchSwitchDialog-M8nEIk2w.js → ShareBranchSwitchDialog-ChLbTjJf.js} +1 -1
  104. package/dist/public/assets/{ShareReceiveDialog-BJ8uKULf.js → ShareReceiveDialog-BV36sHT2.js} +1 -1
  105. package/dist/public/assets/{ShareReceiveMissDialog-Ch00HDAB.js → ShareReceiveMissDialog-BuwUGCen.js} +1 -1
  106. package/dist/public/assets/{SkillEditBanner-cQP3OGlb.js → SkillEditBanner-CTLg7M8S.js} +1 -1
  107. package/dist/public/assets/{SkillOriginInline-DH6wq8QJ.js → SkillOriginInline-BC5LfTxy.js} +1 -1
  108. package/dist/public/assets/{SkillToolbarControls-s_AZBCXM.js → SkillToolbarControls-B2lqqSNx.js} +1 -1
  109. package/dist/public/assets/{SourceEditor-CsUfQH2a.js → SourceEditor-hADslP9Q.js} +1 -1
  110. package/dist/public/assets/{TerminalPanel-DYpr3gZa.js → TerminalPanel-BPqwq8Q7.js} +1 -1
  111. package/dist/public/assets/{TerminalWindowApp-YDhaoZtO.js → TerminalWindowApp-DXkoU-Wq.js} +1 -1
  112. package/dist/public/assets/{TextDocEditor-eezsdRDa.js → TextDocEditor-D07aFI4B.js} +1 -1
  113. package/dist/public/assets/{ThreadView-B3krQ2Z2.js → ThreadView-De8W8Sau.js} +1 -1
  114. package/dist/public/assets/{TimelineDiffPane-Dt3MCe5V.js → TimelineDiffPane-BgqJsURk.js} +1 -1
  115. package/dist/public/assets/{agent-diff-store-D9lLLqBv.js → agent-diff-store-D3wCGBNo.js} +1 -1
  116. package/dist/public/assets/{agent-visibility-CTpE4Fld.js → agent-visibility-jMXG7qfn.js} +1 -1
  117. package/dist/public/assets/{auth-state-cache-39oyxDcu.js → auth-state-cache-cFen_h-t.js} +1 -1
  118. package/dist/public/assets/{client-version-_i4MI4fL.js → client-version-BBVOjYrp.js} +1 -1
  119. package/dist/public/assets/{comment-chips-BovIyLpD.js → comment-chips-Dyvy03mN.js} +1 -1
  120. package/dist/public/assets/{config-provider-BwmrVQtw.js → config-provider-D2FBTvIx.js} +1 -1
  121. package/dist/public/assets/{dist-DZN2z2Ue2.js → dist-Bs8DNjRh2.js} +173 -173
  122. package/dist/public/assets/{doc-paths-CR2slzEF.js → doc-paths-BbWRFVgi.js} +1 -1
  123. package/dist/public/assets/{documents-events-BhxlQGXQ.js → documents-events-BajItHup.js} +1 -1
  124. package/dist/public/assets/{file-tree-adapter-DLG2-zm9.js → file-tree-adapter-J6QKEfhJ.js} +1 -1
  125. package/dist/public/assets/{file-tree-utils-BWXvrWAR.js → file-tree-utils-BbhSDaTW.js} +1 -1
  126. package/dist/public/assets/{folder-config-api-CZeUrq2G.js → folder-config-api-4IXvDZej.js} +1 -1
  127. package/dist/public/assets/{index-23dRVBsm.js → index-HKhe_5r9.js} +8 -8
  128. package/dist/public/assets/{lint-config-client-B-vQycwW.js → lint-config-client-DxXOFrgQ.js} +1 -1
  129. package/dist/public/assets/{markdownlint-rule-browser-CfejazL_.js → markdownlint-rule-browser-C30SWnqC.js} +1 -1
  130. package/dist/public/assets/{navigation-targets-MirHYTh2.js → navigation-targets-CnIm35UZ.js} +1 -1
  131. package/dist/public/assets/{open-managed-artifact-tab-DfPczkie.js → open-managed-artifact-tab-JgSQJhTn.js} +1 -1
  132. package/dist/public/assets/{pending-receive-nav-store-Bxm3O-w-.js → pending-receive-nav-store-DsrtuI8M.js} +1 -1
  133. package/dist/public/assets/{prop-types-BWDJYVli.js → prop-types-CiBsNxle.js} +1 -1
  134. package/dist/public/assets/{receive-store-BISeFaHm.js → receive-store-CV99IXkf.js} +1 -1
  135. package/dist/public/assets/{selection-context-I5uwZblj.js → selection-context-DEAlV4hy.js} +1 -1
  136. package/dist/public/assets/{skill-actions-Diq5Ajd4.js → skill-actions-Du0nfl4o.js} +1 -1
  137. package/dist/public/assets/{skill-scope-DHskNAp8.js → skill-scope-p6Dsw7Bl.js} +1 -1
  138. package/dist/public/assets/{skills-api-DhbM0zp_.js → skills-api-ctJhutDo.js} +1 -1
  139. package/dist/public/assets/{src-BYvjpH1r.js → src-DvGM96LY.js} +1 -1
  140. package/dist/public/assets/{tag-pill-input-Bz9pQv5K.js → tag-pill-input-BR6KfEym.js} +1 -1
  141. package/dist/public/assets/{target-navigation-intent-DBjtrY9M.js → target-navigation-intent-CbnILhIU.js} +1 -1
  142. package/dist/public/assets/{terminal-launch-events-U2hE6Ms1.js → terminal-launch-events-BO-PD_eo.js} +1 -1
  143. package/dist/public/assets/{terminal-telemetry-D-x2ahmt.js → terminal-telemetry-D8M0Ozm1.js} +1 -1
  144. package/dist/public/assets/{typing-burst-detector-DKA4UU69.js → typing-burst-detector-J49yrfso.js} +1 -1
  145. package/dist/public/assets/{uninstall-Ds-POoIZ.js → uninstall-CFuBiQfI.js} +1 -1
  146. package/dist/public/assets/{use-activity-panel-DPG6akAo.js → use-activity-panel-BkkZ0ANm.js} +1 -1
  147. package/dist/public/assets/{use-apply-config-color-theme-Cm_U612q.js → use-apply-config-color-theme-C7h1V38B.js} +1 -1
  148. package/dist/public/assets/{use-collab-url-26Kxxrga.js → use-collab-url-DZPhaKCl.js} +1 -1
  149. package/dist/public/assets/{use-live-xterm-theme-PP95E3RH.js → use-live-xterm-theme-CbDRpOKw.js} +1 -1
  150. package/dist/public/assets/{use-open-skill-BKzqH_Ko.js → use-open-skill-DLwXz8W_.js} +1 -1
  151. package/dist/public/assets/{use-settings-route-b9ICe6ju.js → use-settings-route-CS1B3HfO.js} +1 -1
  152. package/dist/public/assets/{use-skill-directory-BhzSr2An.js → use-skill-directory-jOoyjAPU.js} +1 -1
  153. package/dist/public/assets/{use-skill-origin-CYFatjkw.js → use-skill-origin-DDWTwjBX.js} +1 -1
  154. package/dist/public/assets/{use-skills-CQ22zxZh.js → use-skills-udAv99z6.js} +1 -1
  155. package/dist/public/assets/{use-terminal-enabled-DD-6dEVX.js → use-terminal-enabled-87atXgw4.js} +1 -1
  156. package/dist/public/assets/{use-timeline-entry-diff-ktIa370y.js → use-timeline-entry-diff-BN4My22X.js} +1 -1
  157. package/dist/public/assets/{use-workspace-B7bQ2SZR.js → use-workspace-DGXA9Dn3.js} +1 -1
  158. package/dist/public/index.html +42 -42
  159. package/dist/public/uninstall.html +2 -2
  160. package/dist/{quadrantDiagram-ABIIQ3AL-RE3ttQBG.mjs → quadrantDiagram-ABIIQ3AL-CyuIUsL6.mjs} +2 -2
  161. package/dist/{railroadDiagram-RFXS5EU6-Co0UHOis.mjs → railroadDiagram-RFXS5EU6-CHD_Jape.mjs} +2 -2
  162. package/dist/{repair-launch-json-D2-N9umw.mjs → repair-launch-json-KmYO_2FG.mjs} +2 -2
  163. package/dist/{repair-mcp-configs-8xnoWKwL.mjs → repair-mcp-configs-CsIGV5-7.mjs} +2 -2
  164. package/dist/repair-skills-C0rCwW3E.mjs +1 -0
  165. package/dist/{repair-skills-Cp0zxj36.mjs → repair-skills-Cie1nS2r.mjs} +2 -2
  166. package/dist/{requirementDiagram-TGXJPOKE-CkQZFeMs.mjs → requirementDiagram-TGXJPOKE-CGQTVdQl.mjs} +2 -2
  167. package/dist/{sankeyDiagram-HTMAVEWB-CDausn8Y.mjs → sankeyDiagram-HTMAVEWB-B1AFQN8q.mjs} +2 -2
  168. package/dist/{sequenceDiagram-DBY2YBRQ-B6TuF3qe.mjs → sequenceDiagram-DBY2YBRQ-JQ2Wynkh.mjs} +2 -2
  169. package/dist/{server-lock-CWyGkpt0.mjs → server-lock-DW5T6J_m.mjs} +2 -2
  170. package/dist/server-lock-GGE1_Y5o.mjs +1 -0
  171. package/dist/{sleep-CKdHmS4J.mjs → sleep-CJdjw5UD.mjs} +6 -6
  172. package/dist/{sqlite3-TE5AIOTF-BKiscy5E.mjs → sqlite3-TE5AIOTF-DV5JBdcO.mjs} +1 -1
  173. package/dist/{src-B9eLNT3o.mjs → src-0sJ50HI5.mjs} +125 -125
  174. package/dist/src-BKLIxQOr.mjs +2030 -0
  175. package/dist/src-CpgLre_H.mjs +20 -0
  176. package/dist/{src-R13rZ762.mjs → src-D0P0SFti.mjs} +1 -1
  177. package/dist/start-DdGn_P_U.mjs +1 -0
  178. package/dist/{start-eVNrd_nb.mjs → start-DhBxzdcm.mjs} +3 -3
  179. package/dist/{stateDiagram-2N3HPSRC-C_tdGYXg.mjs → stateDiagram-2N3HPSRC-BzNiMGRR.mjs} +2 -2
  180. package/dist/stateDiagram-v2-6OUMAXLB-8Ywz0Hzd.mjs +2 -0
  181. package/dist/{swimlanes-5IMT3BWC-DLXpBxPB.mjs → swimlanes-5IMT3BWC-BrdJ_D0k.mjs} +2 -2
  182. package/dist/swimlanesDiagram-G3AALYLV-Df_BjTMR.mjs +9 -0
  183. package/dist/{tar-MZQD7NO4-COEqG_IX.mjs → tar-MZQD7NO4-B2cyr2d4.mjs} +1 -1
  184. package/dist/{timeline-definition-FHXFAJF6-BtGgJVSL.mjs → timeline-definition-FHXFAJF6-ByhSkc7M.mjs} +2 -2
  185. package/dist/{vennDiagram-L72KCM5P-DYDKnnjp.mjs → vennDiagram-L72KCM5P-CosAdslh.mjs} +2 -2
  186. package/dist/{wardleyDiagram-EHGQE667-M2W4S8Ng.mjs → wardleyDiagram-EHGQE667-Bdo1uN9O.mjs} +2 -2
  187. package/dist/{write-project-skill-Dwv4krCb.mjs → write-project-skill-CKuq5itB.mjs} +4 -4
  188. package/dist/{xychartDiagram-FW5EYKEG-DX0dJSsD.mjs → xychartDiagram-FW5EYKEG-CBeluzNN.mjs} +2 -2
  189. package/package.json +5 -5
  190. package/dist/channel-DhqoAJoQ.mjs +0 -2
  191. package/dist/classDiagram-OUVF2IWQ-CWObDbTU.mjs +0 -2
  192. package/dist/classDiagram-v2-EOCWNBFH-CUMl48K_.mjs +0 -2
  193. package/dist/constants-Bb2Znuq1.mjs +0 -2
  194. package/dist/flowDiagram-23GEKE2U-CD0oxQCp.mjs +0 -1
  195. package/dist/fs-traced-BxDcwVzG.mjs +0 -14
  196. package/dist/fs-traced-C4vgso5m.mjs +0 -1
  197. package/dist/git-handle-DBNV29KD.mjs +0 -1
  198. package/dist/init-CoZdNwPt.mjs +0 -1
  199. package/dist/loader-BuPU3_5V.mjs +0 -1
  200. package/dist/loader-DfLacIT6.mjs +0 -4
  201. package/dist/markdownit-C8k7jh2Z.mjs +0 -1
  202. package/dist/md-manager-BfHofc4f.mjs +0 -2
  203. package/dist/preview-CqWoyN0f.mjs +0 -1
  204. package/dist/public/assets/FeedbackForm-C3WLSH7D.js +0 -1
  205. package/dist/public/assets/ManagedArtifactProperties-YYdD8hua.js +0 -1
  206. package/dist/repair-skills-BKWnC8s9.mjs +0 -1
  207. package/dist/server-lock-Cd8tGKJ7.mjs +0 -1
  208. package/dist/src-CPkwD6c_.mjs +0 -2030
  209. package/dist/src-DP7egWy_.mjs +0 -20
  210. package/dist/start-uiE1Xi2-.mjs +0 -1
  211. package/dist/stateDiagram-v2-6OUMAXLB-B9_dtBI0.mjs +0 -2
  212. package/dist/swimlanesDiagram-G3AALYLV-DnknHegw.mjs +0 -9
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{F as n,I as r,Nn as i,P as a,gn as o,i as s}from"./DocumentContext-D2Zxk1ro.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{l as f}from"./terminal-input-events-D7rv6nZZ.js";import{c as p,i as m,n as h,o as g,s as _,t as v}from"./ChangedOutsideBadge-hZYC6kff.js";import{t as y}from"./button-D3xSRfT4.js";import{i as b,n as x,t as S}from"./tooltip-CtvLp_YK.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as ee,t as te}from"./dialog-BRwYcDyc.js";import{a as k,d as A,f as j,i as M,n as N,o as P,p as F,u as I}from"./dropdown-menu-BvpO8ueR.js";import{t as L}from"./label-CGqMAe0S.js";import{C as R,a as z,f as B,h as V,m as H,n as U,o as W,p as G,r as K,s as q,t as J}from"./agent-visibility-CTpE4Fld.js";import{$t as Y,Dt as ne,Ia as X,Kt as re,Mt as ie,Ra as ae,Sn as oe,Va as se,Zt as ce,_n as le,bn as ue,en as de,fn as fe,hn as pe,jt as me,mn as he,nt as ge,pa as _e,pn as ve,ri as ye,tt as be,xn as xe,xt as Se,yn as Ce,yr as we}from"./dist-DZN2z2Ue2.js";import{t as Te}from"./createLucideIcon-wbFLvDA-.js";import{t as Ee}from"./RegisteredAgentIcon-UInuA1Ei.js";import{n as De,r as Oe}from"./ManagedArtifactProperties-CoGLUHSS.js";import{n as ke}from"./CopyButton-Dk8yDsPs.js";import{t as Ae}from"./folder-open-DxWbBr3T.js";import{t as je}from"./folder-CyL8AyXY.js";import{t as Me}from"./trash-2-YBQNhePb.js";import{n as Z}from"./dist-BNVxnBBw.js";import{t as Ne}from"./input-DcoGZoTQ.js";import{t as Pe}from"./dist-D6euTqbb.js";import{i as Fe}from"./use-settings-route-b9ICe6ju.js";import{t as Ie}from"./parse-api-error-CGRziNbI.js";import{G as Le,O as Re,W as ze}from"./navigation-targets-MirHYTh2.js";import{c as Be,n as Ve,o as He}from"./documents-events-BhxlQGXQ.js";import{d as Ue,n as We,r as Ge,s as Ke}from"./skill-scope-DHskNAp8.js";import{A as qe,D as Je,O as Ye,S as Xe,_ as Ze,c as Qe,f as $e,i as et,n as tt,t as nt,v as rt,x as it,y as at}from"./skills-api-DhbM0zp_.js";import{a as ot}from"./use-apply-config-color-theme-Cm_U612q.js";import{t as st}from"./use-skills-CQ22zxZh.js";import{t as ct}from"./use-open-skill-BKzqH_Ko.js";import{t as lt}from"./use-workspace-B7bQ2SZR.js";import{n as ut}from"./clipboard-adapter-Brbch5VX.js";import{t as dt}from"./DiffView-DBpBW2MH.js";var ft=Te(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),pt=Te(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),mt=Te(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),ht=Te(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),gt=Te(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=t(),$=e(c(),1),_t=d();function vt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function yt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ie(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function bt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?vt(e):yt()}var xt=`ok:skill:cowork:installed`,St=`1`,Ct=250,wt=`/api/skill/install-state`;function Tt(e){return`${xt}:v${e}`}var Et=new Map;async function Dt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Et.get(n);if(r)return r;let i=Ot(e,t);return Et.set(n,i),i.finally(()=>{Et.get(n)===i&&Et.delete(n)}),i}async function Ot(e,t){let n=e.installer===void 0?bt():e.installer,r=kt(e.storage),i=e.fetchSnapshot??jt,a=e.serverTimeoutMs??Ct,o=null;if(!t.force){try{o=await Mt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Tt(o?.currentVersion??e.fallbackSkillVersion??At());if(!t.force&&r?.getItem(s)===St)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,St)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function kt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function At(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function jt(){let e;try{e=await fetch(wt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Mt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Nt(e){return Dt({},e)}function Pt(){return Dt({},{force:!0})}async function Ft(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function It(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ft({target:`claude-cowork`,url:ce({mode:`cowork`},e)},n);case`claude-code`:return Ft({target:`claude-code`,url:ce({mode:`code`},e)},n);case`codex`:return Ft({target:`codex`,url:Y(e)},n);case`cursor`:return Ft({target:`cursor`,url:de(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Lt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Rt=`open-knowledge:agent-thread-launch`;function zt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Rt,{detail:e}))}function Bt(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Rt,n),()=>t.removeEventListener(Rt,n)}function Vt(e){if(!e.docName||!e.workspace)return null;let t=a(e.docName),{contentDir:r,pathSeparator:i}=e.workspace;return{docContext:{relativePath:t},projectDir:r,docPath:n(r,t,i)}}function Ht(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Wt(e){return G(e.installUrl).then(()=>void 0)}function Gt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Kt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function qt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:r}=e.workspace;if(e.docName){let i=e.docRelativePath??a(e.docName),o={scope:`doc`,docRelativePath:i,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?o:{...o,selection:e.selection},projectDir:t,docPath:n(t,i,r)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function Jt(e){return`Opened in ${e}.`}function Yt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Xt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Zt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function Qt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function $t(e,t,n,r){return e.compose?re(Qt(e.compose,t,n,r)):e.selection?Ce({...e.selection,target:t,transport:r}):e.skill?ue(e.skill.name,e.skill.scope,n):e.ask?fe(e.ask.relativePath,e.ask.instruction,n,t,r):ye(e.docContext===null?e.folderRelativePath?le(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?he(n,e.instruction,r):ve(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):pe(e.docContext.relativePath,n,e.instruction,r))}function en(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${be} ${$t(e,me[t].handoffTarget,!1,`terminal`)}`:xe(e.docContext?.relativePath??null)}function tn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${ge} ${$t(e,`claude-code`,!1,`terminal`)}`:oe(e.docContext?.relativePath??null)}function nn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function rn(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function an(e,t){zt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:tn(e),docName:nn(e),titleHint:rn(e)})}async function on(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:$t(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=Zt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(Jt(u));else{let i=Xt(r),a=Yt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{on(e,t,n,r+1)}}})}return a}function sn(e){return H.find(t=>t.id===e)?.displayName??e}function cn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function ln(){return{dispatchHandoff:It,recordHandoff:Lt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>cn(),getDisplayName:sn,ensureCoworkSkillInstalled:Nt,autoOpen:!0}}function un(){let e=(0,_t.c)(2),{merged:t}=ot(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>on(e,t,{...ln(),autoOpen:n}),reinstallCoworkSkill:Pt},e[0]=n,e[1]=r),r}var dn=Object.freeze({hosts:null,source:null}),fn=new Map,pn=new Map;function mn(e,t){return`${e}:${t}`}function hn(e){return fn.get(e)??dn}function gn(e,t){let n=pn.get(e)??new Set;return pn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&pn.delete(e)}}function _n(e,t){let n=hn(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?fn.delete(e):fn.set(e,r);for(let t of pn.get(e)??[])t()}}var vn=ne.options,yn=`min-w-[24rem]`;function bn(e,t){let n=(0,_t.c)(45),r=t.installingName===e.name,i=(0,$.useRef)(e),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,$.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,$.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=mn(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>gn(m,e),g=()=>hn(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,$.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&_n(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,ee;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},ee=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=ee):(O=n[21],ee=n[22]),(0,$.useEffect)(O,ee);let te;n[23]===e.hosts?te=n[24]:(te=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=te);let k=te,A,j;n[25]!==m||n[26]!==k?(A=()=>{let e=hn(m).hosts;e&&[...e].sort().join(`,`)===k&&_n(m,{hosts:null})},j=[k,m],n[25]=m,n[26]=k,n[27]=A,n[28]=j):(A=n[27],j=n[28]),(0,$.useEffect)(A,j);let M=(0,$.useRef)(null),N=(0,$.useRef)(null),P,F;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>()=>{M.current&&clearTimeout(M.current),N.current?.(),N.current=null},F=[],n[29]=P,n[30]=F):(P=n[29],F=n[30]),(0,$.useEffect)(P,F);let I;n[31]!==t||n[32]!==m||n[33]!==e?(I=function(n,r){D.current=n,_n(m,{hosts:n}),M.current&&clearTimeout(M.current);let i=async()=>{N.current=null,M.current=null;let r=await t.install(e,n.filter(we));if(!r.ok){_n(m,{hosts:null});return}D.current=[...r.hosts],_n(m,{hosts:[...r.hosts]})};r?(N.current=()=>void i(),M.current=setTimeout(()=>void i(),350)):(N.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=I):I=n[34];let L=I,R;return n[35]!==t||n[36]!==L||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(R={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),L([...n],!0)},installAll(){let t=D.current.filter(Cn),n=e.installableEditors??vn,r=vn.filter(e=>n.includes(e)||D.current.includes(e));L([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>rt({scope:e.scope,name:e.name,dir:n,mode:r})).then(Sn)},unplaceAt(n){t.runLocationWrite(e,()=>Ye({scope:e.scope,name:e.name,path:n})).then(xn)},setSource(n){_n(m,{source:n}),t.runLocationWrite(e,()=>Je({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(_n(m,{source:null}),Z.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=L,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=R):R=n[44],R}function xn(e){e.ok||Z.error(e.error)}function Sn(e){e.ok||Z.error(e.error)}function Cn(e){return!vn.includes(e)}function wn(e){let t=(0,_t.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(b,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(x,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(S,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Tn(e){let t=(0,_t.c)(155),{toggles:n,skill:r,onResolveFork:i,onRunStart:a}=e,{_:o}=u(),{hostSet:s,toggleEditor:c,installAll:d}=n,f;t[0]===r?f=t[1]:(f=e=>r?`${Ke(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=f);let p=f,m=st(),g;t[2]!==m.data||t[3]!==m.status||t[4]!==r?(g=r!==void 0&&((r.hosts??[]).includes(`agents`)||m.status===`ready`&&m.data.some(Ln)),t[2]=m.data,t[3]=m.status,t[4]=r,t[5]=g):g=t[5];let _=g,b;t[6]!==m.data||t[7]!==m.status||t[8]!==r?(b=r?.hostAliases??(r&&m.status===`ready`?Object.assign({},...m.data.filter(e=>e.scope===r.scope).map(In)):{}),t[6]=m.data,t[7]=m.status,t[8]=r,t[9]=b):b=t[9];let x=b,S;t[10]!==m.data||t[11]!==m.status||t[12]!==r?(S=r?.installableEditors??(r&&m.status===`ready`?m.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=m.data,t[11]=m.status,t[12]=r,t[13]=S):S=t[13];let C=S,w,T,E,D,O,ee,te;if(t[14]!==o||t[15]!==x||t[16]!==m.data||t[17]!==m.status||t[18]!==s||t[19]!==_||t[20]!==d||t[21]!==C||t[22]!==i||t[23]!==a||t[24]!==p||t[25]!==r||t[26]!==c||t[27]!==n){let e=C?new Set(C):null,u;t[35]===x?u=t[36]:(u=e=>!(e in x),t[35]=x,t[36]=u);let f=(_?[`agents`,...vn]:vn).filter(u).filter(t=>t===`agents`||e===null||e.has(t)||s.has(t)),g;t[37]===p?g=t[38]:(g=e=>p(e),t[37]=p,t[38]=g);let b=new Set(f.map(g)),S=r?.scope===`global`?`~/`:``,k;t[39]!==S||t[40]!==r?(k=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[39]=S,t[40]=r,t[41]=k):k=t[41];let A=k,j=A!==null&&!b.has(A)?A:null,M=j===null?n.sourceHost??r?.hosts?.[0]:void 0,F;t[42]===x?F=t[43]:(F=e=>We(x,e),t[42]=x,t[43]=F);let I=F,L=Fn,R;t[44]!==o||t[45]!==I?(R=e=>{let t=I(e);return t.length===0?!0:window.confirm(o({id:`Uobeu9`,values:{0:t.map(L).join(`, `),rootRel:e}}))},t[44]=o,t[45]=I,t[46]=R):R=t[46];let z=R,B;t[47]!==o||t[48]!==r?(B=(e,t)=>{let n=e.includes(`/`)?e:Ke(e,r?.scope??`project`);return(0,Q.jsx)(wn,{hint:o({id:`0dslv8`,values:{0:L(e),1:L(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":o({id:`G6Lrs_`,values:{0:L(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(o({id:`iiqOKM`,values:{0:L(e),1:r.name,2:L(e),subRoot:n,poolRootRel:t}}))&&at({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?He():Z.error(o({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[47]=o,t[48]=r,t[49]=B):B=t[49];let V=B,H;t[50]===r?.conflictHosts?H=t[51]:(H=r?.conflictHosts??[],t[50]=r?.conflictHosts,t[51]=H);let U;t[52]===H?U=t[53]:(U=new Set(H),t[52]=H,t[53]=U);let W=U,G;t[54]===r?.driftPaths?G=t[55]:(G=r?.driftPaths??[],t[54]=r?.driftPaths,t[55]=G);let K;t[56]===G?K=t[57]:(K=new Set(G),t[56]=G,t[57]=K);let q=K;w=n.installing;let J=Pn,Y;t[58]===r?.symlinkedHosts?Y=t[59]:(Y=r?.symlinkedHosts??[],t[58]=r?.symlinkedHosts,t[59]=Y);let ne;t[60]===Y?ne=t[61]:(ne=new Set(Y),t[60]=Y,t[61]=ne);let X=ne,re=[...[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map(Nn)],ie=re.filter(Mn).length;E=re.length===0?n.linkMode?`link`:`copy`:ie*2>=re.length?`link`:`copy`;let ae;t[62]!==x||t[63]!==W||t[64]!==s||t[65]!==X||t[66]!==p||t[67]!==M?(ae=[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:p(e)??L(e),mode:X.has(e)?`link`:`copy`})),t[62]=x,t[63]=W,t[64]=s,t[65]=X,t[66]=p,t[67]=M,t[68]=ae):ae=t[68];let oe;t[69]===r?.customPlacements?oe=t[70]:(oe=r?.customPlacements??[],t[69]=r?.customPlacements,t[70]=oe);let se;if(t[71]!==S||t[72]!==ae||t[73]!==oe){let e;t[75]===S?e=t[76]:(e=e=>({target:Ge(e),display:`${S}${e.path}`,mode:e.mode}),t[75]=S,t[76]=e),se=[...ae,...oe.map(e)],t[71]=S,t[72]=ae,t[73]=oe,t[74]=se}else se=t[74];T=se;let ce;t[77]!==o||t[78]!==a||t[79]!==n?(ce=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(wn,{hint:o(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(o(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(l,{id:`uUCrBv`}):(0,Q.jsx)(l,{id:`iaPtht`})})})},t[77]=o,t[78]=a,t[79]=n,t[80]=ce):ce=t[80];let le=ce,ue;t[81]===r?.customPlacements?ue=t[82]:(ue=r?.customPlacements??[],t[81]=r?.customPlacements,t[82]=ue);let de=new Map(ue.map(jn)),fe=new Set(de.keys());if(m.status===`ready`&&r){for(let e of m.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=Ge(t);e!==``&&fe.add(e)}}let pe=r===void 0?[]:[...fe].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:de.get(e)??null})).filter(e=>!b.has(e.display)&&e.display!==A&&!(e.root in x)),me;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(l,{id:`npcziF`}),t[83]=me):me=t[83];let he;t[84]===o?he=t[85]:(he=o({id:`6f_UX4`}),t[84]=o,t[85]=he);let ge;t[86]===d?ge=t[87]:(ge=()=>d(),t[86]=d,t[87]=ge);let ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(l,{id:`N40H-G`}),t[88]=ve):ve=t[88];let ye;t[89]!==w||t[90]!==ge?(ye=(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:w,onClick:ge,"data-testid":`skill-install-all`,children:ve}),t[89]=w,t[90]=ge,t[91]=ye):ye=t[91],t[92]!==he||t[93]!==ye?(D=(0,Q.jsxs)(P,{className:`flex items-center justify-between gap-2`,children:[me,(0,Q.jsx)(wn,{hint:he,children:ye})]}),t[92]=he,t[93]=ye,t[94]=D):D=t[94],t[95]!==o||t[96]!==V||t[97]!==w||t[98]!==j||t[99]!==I?(O=j===null?null:(0,Q.jsx)(wn,{hint:o({id:`pXB6SL`}),children:(0,Q.jsxs)(N,{disabled:w,checked:!0,onSelect:An,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:j}),(()=>{let e=J(j).split(`/`).slice(0,-1).join(`/`),t=I(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>V(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})})]})]})}),t[95]=o,t[96]=V,t[97]=w,t[98]=j,t[99]=I,t[100]=O):O=t[100];let be;t[101]!==o||t[102]!==V||t[103]!==w||t[104]!==z||t[105]!==W||t[106]!==le||t[107]!==q||t[108]!==E||t[109]!==s||t[110]!==X||t[111]!==i||t[112]!==p||t[113]!==r?.hosts||t[114]!==M||t[115]!==I||t[116]!==c||t[117]!==n?(be=e=>{let t=p(e),a=e===`agents`?`.agents`:_e[e],u=J(t).split(`/`).slice(0,-1).join(`/`),d=I(u);return(0,Q.jsx)(wn,{hint:W.has(e)?o({id:`8HvJlU`,values:{0:t??a}}):e===M?t?o({id:`ssk6rl`,values:{path:t}}):a:s.has(e)?o(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):o(t?E===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(N,{disabled:w,checked:s.has(e),onCheckedChange:t=>{W.has(e)||t===!0&&!z(u)||c(e,t===!0)},onSelect:kn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),d.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:d.map(e=>V(e,u))}):null,W.has(e)?(0,Q.jsx)(wn,{hint:o({id:`_O7dJS`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(l,{id:`jng7Ko`})})}):e===M?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})}):s.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!w&&(X.has(e)?`link`:`copy`)!==E?le(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]}):null,!w&&q.has(J(t))?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[101]=o,t[102]=V,t[103]=w,t[104]=z,t[105]=W,t[106]=le,t[107]=q,t[108]=E,t[109]=s,t[110]=X,t[111]=i,t[112]=p,t[113]=r?.hosts,t[114]=M,t[115]=I,t[116]=c,t[117]=n,t[118]=be):be=t[118],ee=f.map(be);let xe;t[119]!==o||t[120]!==V||t[121]!==w||t[122]!==z||t[123]!==le||t[124]!==q||t[125]!==E||t[126]!==I||t[127]!==n?(xe=e=>(0,Q.jsx)(wn,{hint:e.placed===null?o(E===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):o({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(N,{disabled:w,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!z(e.root))return;n.placeAt(e.root,E)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:On,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(h,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),I(e.root).length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:I(e.root).map(t=>V(t,e.root))}):null,!w&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!w&&e.placed.mode!==E?le(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]})]})]})},e.root),t[119]=o,t[120]=V,t[121]=w,t[122]=z,t[123]=le,t[124]=q,t[125]=E,t[126]=I,t[127]=n,t[128]=xe):xe=t[128],te=pe.map(xe),t[14]=o,t[15]=x,t[16]=m.data,t[17]=m.status,t[18]=s,t[19]=_,t[20]=d,t[21]=C,t[22]=i,t[23]=a,t[24]=p,t[25]=r,t[26]=c,t[27]=n,t[28]=w,t[29]=T,t[30]=E,t[31]=D,t[32]=O,t[33]=ee,t[34]=te}else w=t[28],T=t[29],E=t[30],D=t[31],O=t[32],ee=t[33],te=t[34];let A;t[129]!==o||t[130]!==w||t[131]!==T||t[132]!==E||t[133]!==a||t[134]!==n?(A=T.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=E===`link`?`copy`:`link`,r=T.filter(e=>e.mode!==t);if(r.length===0)return;let i=o(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),s=o(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),c=r.map(Dn).join(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{F as n,I as r,Nn as i,P as a,gn as o,i as s}from"./DocumentContext-CKMhLy2N.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{l as f}from"./terminal-input-events-D7rv6nZZ.js";import{c as p,i as m,n as h,o as g,s as _,t as v}from"./ChangedOutsideBadge-5cWobd6L.js";import{t as y}from"./button-D3xSRfT4.js";import{i as b,n as x,t as S}from"./tooltip-CtvLp_YK.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as ee,t as te}from"./dialog-BRwYcDyc.js";import{a as k,d as A,f as j,i as M,n as N,o as P,p as F,u as I}from"./dropdown-menu-BvpO8ueR.js";import{t as L}from"./label-CGqMAe0S.js";import{C as R,a as z,f as B,h as V,m as H,n as U,o as W,p as G,r as K,s as q,t as J}from"./agent-visibility-jMXG7qfn.js";import{$t as Y,Dt as ne,Ia as X,Kt as re,Mt as ie,Ra as ae,Sn as oe,Va as se,Zt as ce,_n as le,bn as ue,en as de,fn as fe,hn as pe,jt as me,mn as he,nt as ge,pa as _e,pn as ve,ri as ye,tt as be,xn as xe,xt as Se,yn as Ce,yr as we}from"./dist-Bs8DNjRh2.js";import{t as Te}from"./createLucideIcon-wbFLvDA-.js";import{t as Ee}from"./RegisteredAgentIcon-UInuA1Ei.js";import{n as De,r as Oe}from"./ManagedArtifactProperties-C2RUr9ul.js";import{n as ke}from"./CopyButton-Dk8yDsPs.js";import{t as Ae}from"./folder-open-DxWbBr3T.js";import{t as je}from"./folder-CyL8AyXY.js";import{t as Me}from"./trash-2-YBQNhePb.js";import{n as Z}from"./dist-BNVxnBBw.js";import{t as Ne}from"./input-DcoGZoTQ.js";import{t as Pe}from"./dist-D6euTqbb.js";import{i as Fe}from"./use-settings-route-CS1B3HfO.js";import{t as Ie}from"./parse-api-error-CGRziNbI.js";import{G as Le,O as Re,W as ze}from"./navigation-targets-CnIm35UZ.js";import{c as Be,n as Ve,o as He}from"./documents-events-BajItHup.js";import{d as Ue,n as We,r as Ge,s as Ke}from"./skill-scope-p6Dsw7Bl.js";import{A as qe,D as Je,O as Ye,S as Xe,_ as Ze,c as Qe,f as $e,i as et,n as tt,t as nt,v as rt,x as it,y as at}from"./skills-api-ctJhutDo.js";import{a as ot}from"./use-apply-config-color-theme-C7h1V38B.js";import{t as st}from"./use-skills-udAv99z6.js";import{t as ct}from"./use-open-skill-DLwXz8W_.js";import{t as lt}from"./use-workspace-DGXA9Dn3.js";import{n as ut}from"./clipboard-adapter-Brbch5VX.js";import{t as dt}from"./DiffView-DBpBW2MH.js";var ft=Te(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),pt=Te(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),mt=Te(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),ht=Te(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),gt=Te(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=t(),$=e(c(),1),_t=d();function vt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function yt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ie(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function bt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?vt(e):yt()}var xt=`ok:skill:cowork:installed`,St=`1`,Ct=250,wt=`/api/skill/install-state`;function Tt(e){return`${xt}:v${e}`}var Et=new Map;async function Dt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Et.get(n);if(r)return r;let i=Ot(e,t);return Et.set(n,i),i.finally(()=>{Et.get(n)===i&&Et.delete(n)}),i}async function Ot(e,t){let n=e.installer===void 0?bt():e.installer,r=kt(e.storage),i=e.fetchSnapshot??jt,a=e.serverTimeoutMs??Ct,o=null;if(!t.force){try{o=await Mt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Tt(o?.currentVersion??e.fallbackSkillVersion??At());if(!t.force&&r?.getItem(s)===St)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,St)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function kt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function At(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function jt(){let e;try{e=await fetch(wt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Mt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Nt(e){return Dt({},e)}function Pt(){return Dt({},{force:!0})}async function Ft(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function It(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ft({target:`claude-cowork`,url:ce({mode:`cowork`},e)},n);case`claude-code`:return Ft({target:`claude-code`,url:ce({mode:`code`},e)},n);case`codex`:return Ft({target:`codex`,url:Y(e)},n);case`cursor`:return Ft({target:`cursor`,url:de(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Lt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Rt=`open-knowledge:agent-thread-launch`;function zt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Rt,{detail:e}))}function Bt(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Rt,n),()=>t.removeEventListener(Rt,n)}function Vt(e){if(!e.docName||!e.workspace)return null;let t=a(e.docName),{contentDir:r,pathSeparator:i}=e.workspace;return{docContext:{relativePath:t},projectDir:r,docPath:n(r,t,i)}}function Ht(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Wt(e){return G(e.installUrl).then(()=>void 0)}function Gt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Kt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function qt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:r}=e.workspace;if(e.docName){let i=e.docRelativePath??a(e.docName),o={scope:`doc`,docRelativePath:i,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?o:{...o,selection:e.selection},projectDir:t,docPath:n(t,i,r)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function Jt(e){return`Opened in ${e}.`}function Yt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Xt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Zt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function Qt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function $t(e,t,n,r){return e.compose?re(Qt(e.compose,t,n,r)):e.selection?Ce({...e.selection,target:t,transport:r}):e.skill?ue(e.skill.name,e.skill.scope,n):e.ask?fe(e.ask.relativePath,e.ask.instruction,n,t,r):ye(e.docContext===null?e.folderRelativePath?le(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?he(n,e.instruction,r):ve(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):pe(e.docContext.relativePath,n,e.instruction,r))}function en(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${be} ${$t(e,me[t].handoffTarget,!1,`terminal`)}`:xe(e.docContext?.relativePath??null)}function tn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${ge} ${$t(e,`claude-code`,!1,`terminal`)}`:oe(e.docContext?.relativePath??null)}function nn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function rn(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function an(e,t){zt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:tn(e),docName:nn(e),titleHint:rn(e)})}async function on(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:$t(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=Zt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(Jt(u));else{let i=Xt(r),a=Yt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{on(e,t,n,r+1)}}})}return a}function sn(e){return H.find(t=>t.id===e)?.displayName??e}function cn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function ln(){return{dispatchHandoff:It,recordHandoff:Lt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>cn(),getDisplayName:sn,ensureCoworkSkillInstalled:Nt,autoOpen:!0}}function un(){let e=(0,_t.c)(2),{merged:t}=ot(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>on(e,t,{...ln(),autoOpen:n}),reinstallCoworkSkill:Pt},e[0]=n,e[1]=r),r}var dn=Object.freeze({hosts:null,source:null}),fn=new Map,pn=new Map;function mn(e,t){return`${e}:${t}`}function hn(e){return fn.get(e)??dn}function gn(e,t){let n=pn.get(e)??new Set;return pn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&pn.delete(e)}}function _n(e,t){let n=hn(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?fn.delete(e):fn.set(e,r);for(let t of pn.get(e)??[])t()}}var vn=ne.options,yn=`min-w-[24rem]`;function bn(e,t){let n=(0,_t.c)(45),r=t.installingName===e.name,i=(0,$.useRef)(e),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,$.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,$.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=mn(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>gn(m,e),g=()=>hn(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,$.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&_n(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,ee;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},ee=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=ee):(O=n[21],ee=n[22]),(0,$.useEffect)(O,ee);let te;n[23]===e.hosts?te=n[24]:(te=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=te);let k=te,A,j;n[25]!==m||n[26]!==k?(A=()=>{let e=hn(m).hosts;e&&[...e].sort().join(`,`)===k&&_n(m,{hosts:null})},j=[k,m],n[25]=m,n[26]=k,n[27]=A,n[28]=j):(A=n[27],j=n[28]),(0,$.useEffect)(A,j);let M=(0,$.useRef)(null),N=(0,$.useRef)(null),P,F;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>()=>{M.current&&clearTimeout(M.current),N.current?.(),N.current=null},F=[],n[29]=P,n[30]=F):(P=n[29],F=n[30]),(0,$.useEffect)(P,F);let I;n[31]!==t||n[32]!==m||n[33]!==e?(I=function(n,r){D.current=n,_n(m,{hosts:n}),M.current&&clearTimeout(M.current);let i=async()=>{N.current=null,M.current=null;let r=await t.install(e,n.filter(we));if(!r.ok){_n(m,{hosts:null});return}D.current=[...r.hosts],_n(m,{hosts:[...r.hosts]})};r?(N.current=()=>void i(),M.current=setTimeout(()=>void i(),350)):(N.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=I):I=n[34];let L=I,R;return n[35]!==t||n[36]!==L||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(R={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),L([...n],!0)},installAll(){let t=D.current.filter(Cn),n=e.installableEditors??vn,r=vn.filter(e=>n.includes(e)||D.current.includes(e));L([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>rt({scope:e.scope,name:e.name,dir:n,mode:r})).then(Sn)},unplaceAt(n){t.runLocationWrite(e,()=>Ye({scope:e.scope,name:e.name,path:n})).then(xn)},setSource(n){_n(m,{source:n}),t.runLocationWrite(e,()=>Je({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(_n(m,{source:null}),Z.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=L,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=R):R=n[44],R}function xn(e){e.ok||Z.error(e.error)}function Sn(e){e.ok||Z.error(e.error)}function Cn(e){return!vn.includes(e)}function wn(e){let t=(0,_t.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(b,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(x,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(S,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Tn(e){let t=(0,_t.c)(155),{toggles:n,skill:r,onResolveFork:i,onRunStart:a}=e,{_:o}=u(),{hostSet:s,toggleEditor:c,installAll:d}=n,f;t[0]===r?f=t[1]:(f=e=>r?`${Ke(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=f);let p=f,m=st(),g;t[2]!==m.data||t[3]!==m.status||t[4]!==r?(g=r!==void 0&&((r.hosts??[]).includes(`agents`)||m.status===`ready`&&m.data.some(Ln)),t[2]=m.data,t[3]=m.status,t[4]=r,t[5]=g):g=t[5];let _=g,b;t[6]!==m.data||t[7]!==m.status||t[8]!==r?(b=r?.hostAliases??(r&&m.status===`ready`?Object.assign({},...m.data.filter(e=>e.scope===r.scope).map(In)):{}),t[6]=m.data,t[7]=m.status,t[8]=r,t[9]=b):b=t[9];let x=b,S;t[10]!==m.data||t[11]!==m.status||t[12]!==r?(S=r?.installableEditors??(r&&m.status===`ready`?m.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=m.data,t[11]=m.status,t[12]=r,t[13]=S):S=t[13];let C=S,w,T,E,D,O,ee,te;if(t[14]!==o||t[15]!==x||t[16]!==m.data||t[17]!==m.status||t[18]!==s||t[19]!==_||t[20]!==d||t[21]!==C||t[22]!==i||t[23]!==a||t[24]!==p||t[25]!==r||t[26]!==c||t[27]!==n){let e=C?new Set(C):null,u;t[35]===x?u=t[36]:(u=e=>!(e in x),t[35]=x,t[36]=u);let f=(_?[`agents`,...vn]:vn).filter(u).filter(t=>t===`agents`||e===null||e.has(t)||s.has(t)),g;t[37]===p?g=t[38]:(g=e=>p(e),t[37]=p,t[38]=g);let b=new Set(f.map(g)),S=r?.scope===`global`?`~/`:``,k;t[39]!==S||t[40]!==r?(k=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[39]=S,t[40]=r,t[41]=k):k=t[41];let A=k,j=A!==null&&!b.has(A)?A:null,M=j===null?n.sourceHost??r?.hosts?.[0]:void 0,F;t[42]===x?F=t[43]:(F=e=>We(x,e),t[42]=x,t[43]=F);let I=F,L=Fn,R;t[44]!==o||t[45]!==I?(R=e=>{let t=I(e);return t.length===0?!0:window.confirm(o({id:`Uobeu9`,values:{0:t.map(L).join(`, `),rootRel:e}}))},t[44]=o,t[45]=I,t[46]=R):R=t[46];let z=R,B;t[47]!==o||t[48]!==r?(B=(e,t)=>{let n=e.includes(`/`)?e:Ke(e,r?.scope??`project`);return(0,Q.jsx)(wn,{hint:o({id:`0dslv8`,values:{0:L(e),1:L(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":o({id:`G6Lrs_`,values:{0:L(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(o({id:`iiqOKM`,values:{0:L(e),1:r.name,2:L(e),subRoot:n,poolRootRel:t}}))&&at({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?He():Z.error(o({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[47]=o,t[48]=r,t[49]=B):B=t[49];let V=B,H;t[50]===r?.conflictHosts?H=t[51]:(H=r?.conflictHosts??[],t[50]=r?.conflictHosts,t[51]=H);let U;t[52]===H?U=t[53]:(U=new Set(H),t[52]=H,t[53]=U);let W=U,G;t[54]===r?.driftPaths?G=t[55]:(G=r?.driftPaths??[],t[54]=r?.driftPaths,t[55]=G);let K;t[56]===G?K=t[57]:(K=new Set(G),t[56]=G,t[57]=K);let q=K;w=n.installing;let J=Pn,Y;t[58]===r?.symlinkedHosts?Y=t[59]:(Y=r?.symlinkedHosts??[],t[58]=r?.symlinkedHosts,t[59]=Y);let ne;t[60]===Y?ne=t[61]:(ne=new Set(Y),t[60]=Y,t[61]=ne);let X=ne,re=[...[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map(Nn)],ie=re.filter(Mn).length;E=re.length===0?n.linkMode?`link`:`copy`:ie*2>=re.length?`link`:`copy`;let ae;t[62]!==x||t[63]!==W||t[64]!==s||t[65]!==X||t[66]!==p||t[67]!==M?(ae=[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:p(e)??L(e),mode:X.has(e)?`link`:`copy`})),t[62]=x,t[63]=W,t[64]=s,t[65]=X,t[66]=p,t[67]=M,t[68]=ae):ae=t[68];let oe;t[69]===r?.customPlacements?oe=t[70]:(oe=r?.customPlacements??[],t[69]=r?.customPlacements,t[70]=oe);let se;if(t[71]!==S||t[72]!==ae||t[73]!==oe){let e;t[75]===S?e=t[76]:(e=e=>({target:Ge(e),display:`${S}${e.path}`,mode:e.mode}),t[75]=S,t[76]=e),se=[...ae,...oe.map(e)],t[71]=S,t[72]=ae,t[73]=oe,t[74]=se}else se=t[74];T=se;let ce;t[77]!==o||t[78]!==a||t[79]!==n?(ce=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(wn,{hint:o(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(o(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(l,{id:`uUCrBv`}):(0,Q.jsx)(l,{id:`iaPtht`})})})},t[77]=o,t[78]=a,t[79]=n,t[80]=ce):ce=t[80];let le=ce,ue;t[81]===r?.customPlacements?ue=t[82]:(ue=r?.customPlacements??[],t[81]=r?.customPlacements,t[82]=ue);let de=new Map(ue.map(jn)),fe=new Set(de.keys());if(m.status===`ready`&&r){for(let e of m.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=Ge(t);e!==``&&fe.add(e)}}let pe=r===void 0?[]:[...fe].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:de.get(e)??null})).filter(e=>!b.has(e.display)&&e.display!==A&&!(e.root in x)),me;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(l,{id:`npcziF`}),t[83]=me):me=t[83];let he;t[84]===o?he=t[85]:(he=o({id:`6f_UX4`}),t[84]=o,t[85]=he);let ge;t[86]===d?ge=t[87]:(ge=()=>d(),t[86]=d,t[87]=ge);let ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(l,{id:`N40H-G`}),t[88]=ve):ve=t[88];let ye;t[89]!==w||t[90]!==ge?(ye=(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:w,onClick:ge,"data-testid":`skill-install-all`,children:ve}),t[89]=w,t[90]=ge,t[91]=ye):ye=t[91],t[92]!==he||t[93]!==ye?(D=(0,Q.jsxs)(P,{className:`flex items-center justify-between gap-2`,children:[me,(0,Q.jsx)(wn,{hint:he,children:ye})]}),t[92]=he,t[93]=ye,t[94]=D):D=t[94],t[95]!==o||t[96]!==V||t[97]!==w||t[98]!==j||t[99]!==I?(O=j===null?null:(0,Q.jsx)(wn,{hint:o({id:`pXB6SL`}),children:(0,Q.jsxs)(N,{disabled:w,checked:!0,onSelect:An,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:j}),(()=>{let e=J(j).split(`/`).slice(0,-1).join(`/`),t=I(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>V(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})})]})]})}),t[95]=o,t[96]=V,t[97]=w,t[98]=j,t[99]=I,t[100]=O):O=t[100];let be;t[101]!==o||t[102]!==V||t[103]!==w||t[104]!==z||t[105]!==W||t[106]!==le||t[107]!==q||t[108]!==E||t[109]!==s||t[110]!==X||t[111]!==i||t[112]!==p||t[113]!==r?.hosts||t[114]!==M||t[115]!==I||t[116]!==c||t[117]!==n?(be=e=>{let t=p(e),a=e===`agents`?`.agents`:_e[e],u=J(t).split(`/`).slice(0,-1).join(`/`),d=I(u);return(0,Q.jsx)(wn,{hint:W.has(e)?o({id:`8HvJlU`,values:{0:t??a}}):e===M?t?o({id:`ssk6rl`,values:{path:t}}):a:s.has(e)?o(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):o(t?E===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(N,{disabled:w,checked:s.has(e),onCheckedChange:t=>{W.has(e)||t===!0&&!z(u)||c(e,t===!0)},onSelect:kn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),d.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:d.map(e=>V(e,u))}):null,W.has(e)?(0,Q.jsx)(wn,{hint:o({id:`_O7dJS`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(l,{id:`jng7Ko`})})}):e===M?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})}):s.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!w&&(X.has(e)?`link`:`copy`)!==E?le(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]}):null,!w&&q.has(J(t))?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[101]=o,t[102]=V,t[103]=w,t[104]=z,t[105]=W,t[106]=le,t[107]=q,t[108]=E,t[109]=s,t[110]=X,t[111]=i,t[112]=p,t[113]=r?.hosts,t[114]=M,t[115]=I,t[116]=c,t[117]=n,t[118]=be):be=t[118],ee=f.map(be);let xe;t[119]!==o||t[120]!==V||t[121]!==w||t[122]!==z||t[123]!==le||t[124]!==q||t[125]!==E||t[126]!==I||t[127]!==n?(xe=e=>(0,Q.jsx)(wn,{hint:e.placed===null?o(E===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):o({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(N,{disabled:w,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!z(e.root))return;n.placeAt(e.root,E)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:On,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(h,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),I(e.root).length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:I(e.root).map(t=>V(t,e.root))}):null,!w&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!w&&e.placed.mode!==E?le(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]})]})]})},e.root),t[119]=o,t[120]=V,t[121]=w,t[122]=z,t[123]=le,t[124]=q,t[125]=E,t[126]=I,t[127]=n,t[128]=xe):xe=t[128],te=pe.map(xe),t[14]=o,t[15]=x,t[16]=m.data,t[17]=m.status,t[18]=s,t[19]=_,t[20]=d,t[21]=C,t[22]=i,t[23]=a,t[24]=p,t[25]=r,t[26]=c,t[27]=n,t[28]=w,t[29]=T,t[30]=E,t[31]=D,t[32]=O,t[33]=ee,t[34]=te}else w=t[28],T=t[29],E=t[30],D=t[31],O=t[32],ee=t[33],te=t[34];let A;t[129]!==o||t[130]!==w||t[131]!==T||t[132]!==E||t[133]!==a||t[134]!==n?(A=T.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=E===`link`?`copy`:`link`,r=T.filter(e=>e.mode!==t);if(r.length===0)return;let i=o(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),s=o(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),c=r.map(Dn).join(`
2
2
  `);window.confirm(`${i}\n\n${s}\n\n${c}\n\n${o({id:`Cu6GXQ`})}`)&&(a?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:w,"data-testid":`skill-convert-all`,children:E===`link`?(0,Q.jsx)(l,{id:`rcJmK8`}):(0,Q.jsx)(l,{id:`LBv_TR`})}),(0,Q.jsx)(wn,{hint:o({id:`0J6nhG`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,"aria-label":o({id:`qJSo0_`}),className:`size-4 shrink-0 rounded-full border border-border/60 p-0 font-normal text-[9px] text-muted-foreground hover:border-foreground/40 hover:bg-transparent hover:text-foreground`,onClick:En,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[129]=o,t[130]=w,t[131]=T,t[132]=E,t[133]=a,t[134]=n,t[135]=A):A=t[135];let j;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(I,{}),t[136]=j):j=t[136];let M;t[137]===o?M=t[138]:(M=o({id:`jqe7Yq`}),t[137]=o,t[138]=M);let F;t[139]===r?.scope?F=t[140]:(F=()=>{window.location.hash=r?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[139]=r?.scope,t[140]=F);let L,R;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(gt,{"aria-hidden":!0}),R=(0,Q.jsx)(l,{id:`ZBF9fn`}),t[141]=L,t[142]=R):(L=t[141],R=t[142]);let z;t[143]===F?z=t[144]:(z=(0,Q.jsxs)(k,{onSelect:F,children:[L,R]}),t[143]=F,t[144]=z);let B;t[145]!==M||t[146]!==z?(B=(0,Q.jsx)(wn,{hint:M,children:z}),t[145]=M,t[146]=z,t[147]=B):B=t[147];let V;return t[148]!==B||t[149]!==D||t[150]!==O||t[151]!==ee||t[152]!==te||t[153]!==A?(V=(0,Q.jsxs)(Q.Fragment,{children:[D,O,ee,te,A,j,B]}),t[148]=B,t[149]=D,t[150]=O,t[151]=ee,t[152]=te,t[153]=A,t[154]=V):V=t[154],V}function En(e){return e.preventDefault()}function Dn(e){return e.display}function On(e){return e.preventDefault()}function kn(e){return e.preventDefault()}function An(e){return e.preventDefault()}function jn(e){return[Ge(e),e]}function Mn(e){return e===`link`}function Nn(e){return e.mode}function Pn(e){return(e??``).replace(/^~\//,``)}function Fn(e){return e===`agents`?`.agents`:_e[e]??e}function In(e){return e.hostAliases??{}}function Ln(e){return e.hosts.includes(`agents`)||e.path.startsWith(`.agents/`)}function Rn(e){let t=(0,_t.c)(10),{onAddProperty:n,className:r}=e,{_:i}=u(),a;t[0]===i?a=t[1]:(a=i({id:`81H_23`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(b,{children:(0,Q.jsx)(mt,{})}),t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n||t[5]!==a?(s=(0,Q.jsx)(y,{variant:`ghost`,size:`icon`,"aria-label":a,onClick:n,"data-testid":`add-properties-button`,className:r,asChild:!0,children:o}),t[3]=r,t[4]=n,t[5]=a,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(x,{side:`bottom`,children:(0,Q.jsx)(l,{id:`81H_23`})}),t[7]=c):c=t[7];let d;return t[8]===s?d=t[9]:(d=(0,Q.jsxs)(S,{children:[s,c]}),t[8]=s,t[9]=d),d}function zn(e){return e?Pe._({id:`wTcjov`}):null}function Bn(e){let t=(0,_t.c)(47),{_:n}=u(),i=r(),a=g(),s=R(),c=B();if(i)return null;let{input:d,installStates:p,dispatch:m,onBeforeLaunch:h}=e,_=d===null,v,y,b,x,S,C,w,T,E,D,O;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==_||t[4]!==p||t[5]!==h||t[6]!==c||t[7]!==s||t[8]!==a){let e=zn(_),r;t[20]===c?r=t[21]:(r=e=>J(c,e.id),t[20]=c,t[21]=r);let i=V.filter(r),u;t[22]===c?u=t[23]:(u=e=>U(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=u);let f=s.filter(u),g=a?ie.filter(e=>K(c,e,a.installedClis)):[];b=i.length>0,x=a!==null&&g.length>0,S=f.length>0,y=A,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[24]=O):O=t[24],v=j,C=`max-h-80`,w=S?(0,Q.jsxs)(M,{"aria-label":n({id:`vPKX2i`}),children:[(0,Q.jsxs)(P,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`RXEbZy`}),(0,Q.jsx)(q,{})]}),f.map(t=>{let r=t.name;return(0,Q.jsxs)(k,{onSelect:()=>{d!==null&&(h?.(),an(d,{agent:{source:t.source,id:t.id}}))},disabled:_,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:r,hint:e}}):void 0,children:[(0,Q.jsx)(Ee,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`5PrrYw`,values:{agentName:r}})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==b||t[26]!==x||t[27]!==S?(T=S&&(x||b)?(0,Q.jsx)(I,{}):null,t[25]=b,t[26]=x,t[27]=S,t[28]=T):T=t[28],E=x?(0,Q.jsxs)(M,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(P,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),g.map(t=>{let{displayName:r}=me[t];return(0,Q.jsxs)(k,{onSelect:()=>{d!==null&&(h?.(),a.launchInTerminal(d,t))},disabled:_,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(W,{id:z(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,D=b?(0,Q.jsxs)(Q.Fragment,{children:[x?(0,Q.jsx)(I,{}):null,(0,Q.jsxs)(M,{"aria-label":n({id:`BBqGS9`}),children:[(0,Q.jsx)(P,{children:(0,Q.jsx)(l,{id:`BBqGS9`})}),i.map(t=>{let r=!_,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Q.jsxs)(k,{disabled:!r,onSelect:()=>{if(d){if(h?.(),p[t.id]?.installed!==!0){Wt(t);return}m(t.id,d)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(W,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=_,t[4]=p,t[5]=h,t[6]=c,t[7]=s,t[8]=a,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O}else v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let ee;t[29]!==b||t[30]!==x||t[31]!==S?(ee=S||x||b?(0,Q.jsx)(I,{}):null,t[29]=b,t[30]=x,t[31]=S,t[32]=ee):ee=t[32];let te;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(f,{"aria-hidden":`true`}),t[33]=te):te=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsxs)(k,{onSelect:Fe,"data-testid":`file-tree-open-in-settings`,children:[te,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`jRAGrQ`})})]}),t[34]=N):N=t[34];let L;t[35]!==v||t[36]!==C||t[37]!==w||t[38]!==T||t[39]!==E||t[40]!==D||t[41]!==ee?(L=(0,Q.jsxs)(v,{className:C,children:[w,T,E,D,ee,N]}),t[35]=v,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=ee,t[42]=L):L=t[42];let H;return t[43]!==y||t[44]!==O||t[45]!==L?(H=(0,Q.jsxs)(y,{children:[O,L]}),t[43]=y,t[44]=O,t[45]=L,t[46]=H):H=t[46],H}function Vn(e){let t=ae(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=X(e);return n?{scope:`global`,name:n.name,rel:n.rel}:null}function Hn(e,t,n){return e.filter(e=>{let r=Re(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=Vn(r.docName);return i?.scope===t&&i.name===n})}function Un(e,t){let n=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),r=[];for(let t of e){let e=Vn(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`,a=n.get(`${i}\u0000${e.name}`);e.rel===null&&a!==void 0?r.push({kind:`retarget`,fromDocName:t,toDocName:Le(a)}):r.push({kind:`close`,docName:t})}return r}function Wn(){let e=(0,_t.c)(15),{openTabs:t,closeDocument:n}=s(),r=De(),i;e[0]===t?i=e[1]:(i=t.some(Kn),e[0]=t,e[1]=i);let a=i,o;e[2]===a?o=e[3]:(o={enabled:a},e[2]=a,e[3]=o);let c=st(o),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Gn).sort().join(``)}`;if(l.current===i)return;l.current=i;let a=Un(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Gn(e){return`${e.scope}\u0000${e.name}`}function Kn(e){return Vn(e)!==null}function qn(e){let t=(0,_t.c)(19),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:a}=u(),{setSkillsSidebar:o,closeTabs:c,openTabs:l}=s(),[d,f]=(0,$.useState)(!1),p;t[0]!==a||t[1]!==c||t[2]!==i||t[3]!==r||t[4]!==l||t[5]!==o?(p=async function(e){o(!0),f(!0);let t=await tt(e.scope,e.name);if(f(!1),!t.ok){let{error:e}=t;Z.error(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),c(Hn(l,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,t[1]=c,t[2]=i,t[3]=r,t[4]=l,t[5]=o,t[6]=p):p=t[6];let h=p,g=n!==null,_;t[7]!==d||t[8]!==r?(_=e=>{!e&&!d&&r(!1)},t[7]=d,t[8]=r,t[9]=_):_=t[9];let v;t[10]!==a||t[11]!==d||t[12]!==h||t[13]!==n?(v=n?(0,Q.jsx)(m,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:d,onDelete:()=>h(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[10]=a,t[11]=d,t[12]=h,t[13]=n,t[14]=v):v=t[14];let y;return t[15]!==g||t[16]!==_||t[17]!==v?(y=(0,Q.jsx)(te,{open:g,onOpenChange:_,children:v}),t[15]=g,t[16]=_,t[17]=v,t[18]=y):y=t[18],y}function Jn(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function Yn(e){let t=(0,_t.c)(66),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:a}=s(),o=(0,$.useId)(),[c,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let b,x,S,E;t[6]!==c||t[7]!==f?(E=c.trim(),x=E===``||!Jn(E),b=!x&&!f,S=E.includes(`/`)?E.split(`/`).slice(0,-1).join(`/`):null,t[6]=c,t[7]=f,t[8]=b,t[9]=x,t[10]=S,t[11]=E):(b=t[8],x=t[9],S=t[10],E=t[11]);let O=S,k;t[12]!==i||t[13]!==b||t[14]!==r||t[15]!==a||t[16]!==n||t[17]!==E?(k=async function(){if(!n||!b)return;p(!0);let e=/\.mdx?$/i.test(E),t=await qe({scope:n.skill.scope,name:n.skill.name,path:E,content:e?`# ${E.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`a_2_uB`,values:{0:t.error,trimmed:E}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=ze(n.skill,E);a({kind:`doc`,target:e,docName:e})}r(!1)},t[12]=i,t[13]=b,t[14]=r,t[15]=a,t[16]=n,t[17]=E,t[18]=k):k=t[18];let A=k,j;t[19]!==r||t[20]!==f?(j=e=>{!e&&!f&&r(!1)},t[19]=r,t[20]=f,t[21]=j):j=t[21];let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`wQvvZY`})}),t[22]=M):M=t[22];let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsxs)(ee,{children:[M,(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`lM4c-I`})})]}),t[23]=N):N=t[23];let P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(l,{id:`I6gXOa`}),t[24]=P):P=t[24];let F;t[25]===o?F=t[26]:(F=(0,Q.jsx)(L,{htmlFor:o,children:P}),t[25]=o,t[26]=F);let I;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>d(e.target.value),t[27]=I):I=t[27];let R=x&&E!==``,z;t[28]===A?z=t[29]:(z=e=>{e.key===`Enter`&&A()},t[28]=A,t[29]=z);let B;t[30]!==o||t[31]!==c||t[32]!==R||t[33]!==z?(B=(0,Q.jsx)(Ne,{id:o,value:c,onChange:I,placeholder:`references/notes.md`,"aria-invalid":R,onKeyDown:z}),t[30]=o,t[31]=c,t[32]=R,t[33]=z,t[34]=B):B=t[34];let V;t[35]!==O||t[36]!==x||t[37]!==E?(V=x&&E!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):O?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`9lso1Y`,values:{folderPart:O},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null,t[35]=O,t[36]=x,t[37]=E,t[38]=V):V=t[38];let H;t[39]!==F||t[40]!==B||t[41]!==V?(H=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[F,B,V]}),t[39]=F,t[40]=B,t[41]=V,t[42]=H):H=t[42];let U;t[43]===r?U=t[44]:(U=()=>r(!1),t[43]=r,t[44]=U);let W;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(l,{id:`dEgA5A`}),t[45]=W):W=t[45];let G;t[46]!==f||t[47]!==U?(G=(0,Q.jsx)(y,{variant:`outline`,onClick:U,disabled:f,children:W}),t[46]=f,t[47]=U,t[48]=G):G=t[48];let K;t[49]===A?K=t[50]:(K=()=>void A(),t[49]=A,t[50]=K);let q=!b,J;t[51]===f?J=t[52]:(J=f?(0,Q.jsx)(l,{id:`E9bKSA`}):(0,Q.jsx)(l,{id:`hYgDIe`}),t[51]=f,t[52]=J);let Y;t[53]!==K||t[54]!==q||t[55]!==J?(Y=(0,Q.jsx)(y,{onClick:K,disabled:q,children:J}),t[53]=K,t[54]=q,t[55]=J,t[56]=Y):Y=t[56];let ne;t[57]!==G||t[58]!==Y?(ne=(0,Q.jsxs)(D,{children:[G,Y]}),t[57]=G,t[58]=Y,t[59]=ne):ne=t[59];let X;t[60]!==H||t[61]!==ne?(X=(0,Q.jsxs)(T,{className:`sm:max-w-md`,children:[N,H,ne]}),t[60]=H,t[61]=ne,t[62]=X):X=t[62];let re;return t[63]!==X||t[64]!==j?(re=(0,Q.jsx)(te,{open:!0,onOpenChange:j,children:X}),t[63]=X,t[64]=j,t[65]=re):re=t[65],re}function Xn(e){let t=(0,_t.c)(64),{target:n,onOpenChange:r}=e,{_:i}=u(),a=De(),o=(0,$.useId)(),[s,c]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,b,x;t[6]!==s||t[7]!==n.filePath?(b=s.trim(),x=b===n.filePath,v=b===``||!Jn(b),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=b,t[10]=x):(v=t[8],b=t[9],x=t[10]);let S=v,E=!S&&!x&&!d,O;t[11]!==i||t[12]!==E||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==b?(O=async function(){if(!n||!E)return;f(!0);let e=await it({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:b});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=E,t[13]=r,t[14]=a,t[15]=n,t[16]=b,t[17]=O):O=t[17];let k=O,A;t[18]!==r||t[19]!==d?(A=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=A):A=t[20];let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`yckias`})}),t[21]=j):j=t[21];let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(ee,{children:[j,(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`HzVAoz`})})]}),t[22]=M):M=t[22];let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(l,{id:`I6gXOa`}),t[23]=N):N=t[23];let P;t[24]===o?P=t[25]:(P=(0,Q.jsx)(L,{htmlFor:o,children:N}),t[24]=o,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>c(e.target.value),t[26]=F):F=t[26];let I=S&&b!==``,R;t[27]===k?R=t[28]:(R=e=>{e.key===`Enter`&&k()},t[27]=k,t[28]=R);let z;t[29]!==o||t[30]!==s||t[31]!==I||t[32]!==R?(z=(0,Q.jsx)(Ne,{id:o,value:s,onChange:F,"aria-invalid":I,onKeyDown:R}),t[29]=o,t[30]=s,t[31]=I,t[32]=R,t[33]=z):z=t[33];let B;t[34]!==S||t[35]!==b?(B=S&&b!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):null,t[34]=S,t[35]=b,t[36]=B):B=t[36];let V;t[37]!==P||t[38]!==z||t[39]!==B?(V=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[P,z,B]}),t[37]=P,t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]===r?H=t[42]:(H=()=>r(!1),t[41]=r,t[42]=H);let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(l,{id:`dEgA5A`}),t[43]=U):U=t[43];let W;t[44]!==d||t[45]!==H?(W=(0,Q.jsx)(y,{variant:`outline`,onClick:H,disabled:d,children:U}),t[44]=d,t[45]=H,t[46]=W):W=t[46];let G;t[47]===k?G=t[48]:(G=()=>void k(),t[47]=k,t[48]=G);let K=!E,q;t[49]===d?q=t[50]:(q=d?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[49]=d,t[50]=q);let J;t[51]!==G||t[52]!==K||t[53]!==q?(J=(0,Q.jsx)(y,{onClick:G,disabled:K,children:q}),t[51]=G,t[52]=K,t[53]=q,t[54]=J):J=t[54];let Y;t[55]!==W||t[56]!==J?(Y=(0,Q.jsxs)(D,{children:[W,J]}),t[55]=W,t[56]=J,t[57]=Y):Y=t[57];let ne;t[58]!==V||t[59]!==Y?(ne=(0,Q.jsxs)(T,{className:`sm:max-w-md`,children:[M,V,Y]}),t[58]=V,t[59]=Y,t[60]=ne):ne=t[60];let X;return t[61]!==ne||t[62]!==A?(X=(0,Q.jsx)(te,{open:!0,onOpenChange:A,children:ne}),t[61]=ne,t[62]=A,t[63]=X):X=t[63],X}function Zn(e){let t=(0,_t.c)(59),{target:n,onOpenChange:r}=e,{_:i}=u(),a=(0,$.useId)(),[o,s]=(0,$.useState)(null),[c,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,b]=(0,$.useState)(!1),x;t[0]===n?x=t[1]:(x=()=>{if(s(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${Ke(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,s]])Qe({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=x);let S=n?.skill.scope,O=n?.skill.name,k=n?.editor,A;if(t[2]!==S||t[3]!==O||t[4]!==k?(A=[S,O,k],t[2]=S,t[3]=O,t[4]=k,t[5]=A):A=t[5],(0,$.useEffect)(x,A),!n)return null;let{skill:j,editor:M}=n,N;t[6]!==i||t[7]!==M||t[8]!==r||t[9]!==j.name||t[10]!==j.scope||t[11]!==n||t[12]!==g?(N=async function(e){if(!n)return;b(!0);let t=await Xe({scope:j.scope,name:j.name,editor:M,action:e,...e===`rename`?{toName:g.trim()}:{}});if(b(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:M}}:e===`make-source`?{id:`It9oAP`,values:{editor:M}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=M,t[8]=r,t[9]=j.name,t[10]=j.scope,t[11]=n,t[12]=g,t[13]=N):N=t[13];let P=N,F,I;t[14]!==j.name||t[15]!==g?(I=g.trim(),F=I===``||!Se.test(I)||I===j.name,t[14]=j.name,t[15]=g,t[16]=F,t[17]=I):(F=t[16],I=t[17]);let R=F,z;t[18]!==v||t[19]!==r?(z=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=z):z=t[20];let B;t[21]!==M||t[22]!==j.name?(B=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`q8aCbb`,values:{0:j.name,editor:M}})}),t[21]=M,t[22]=j.name,t[23]=B):B=t[23];let V;t[24]===M?V=t[25]:(V=(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`QASTNu`,values:{editor:M}})}),t[24]=M,t[25]=V);let H;t[26]!==V||t[27]!==B?(H=(0,Q.jsxs)(ee,{children:[B,V]}),t[26]=V,t[27]=B,t[28]=H):H=t[28];let U;t[29]!==c||t[30]!==o||t[31]!==f?(U=c!==null&&o!==null?(0,Q.jsx)(dt,{oldContent:c,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`1V17kO`})}),t[29]=c,t[30]=o,t[31]=f,t[32]=U):U=t[32];let W;t[33]!==P||t[34]!==M||t[35]!==a||t[36]!==R||t[37]!==m||t[38]!==j.name||t[39]!==g||t[40]!==I?(W=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(L,{htmlFor:a,children:(0,Q.jsx)(l,{id:`pSimwP`,values:{editor:M}})}),(0,Q.jsx)(Ne,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${j.name}-${M}`,"aria-invalid":R&&I!==``,onKeyDown:e=>{e.key===`Enter`&&!R&&P(`rename`)}})]}):null,t[33]=P,t[34]=M,t[35]=a,t[36]=R,t[37]=m,t[38]=j.name,t[39]=g,t[40]=I,t[41]=W):W=t[41];let G;t[42]!==U||t[43]!==W?(G=(0,Q.jsxs)(E,{className:`min-h-0 flex-1 overflow-auto`,children:[U,W]}),t[42]=U,t[43]=W,t[44]=G):G=t[44];let K;t[45]!==P||t[46]!==v||t[47]!==M||t[48]!==R||t[49]!==m||t[50]!==j.name?(K=(0,Q.jsx)(D,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(l,{id:`iH8pgl`})}),(0,Q.jsx)(y,{onClick:()=>void P(`rename`),disabled:v||R,children:(0,Q.jsx)(l,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{variant:`outline`,onClick:()=>{_(`${j.name}-${M}`),h(!0)},disabled:v,children:(0,Q.jsx)(l,{id:`AT0e50`})}),(0,Q.jsx)(y,{variant:`outline`,onClick:()=>void P(`make-source`),disabled:v,children:(0,Q.jsx)(l,{id:`xWomUD`,values:{editor:M}})}),(0,Q.jsx)(y,{onClick:()=>void P(`align`),disabled:v,children:(0,Q.jsx)(l,{id:`PZn2LP`})})]})}),t[45]=P,t[46]=v,t[47]=M,t[48]=R,t[49]=m,t[50]=j.name,t[51]=K):K=t[51];let q;t[52]!==H||t[53]!==G||t[54]!==K?(q=(0,Q.jsxs)(T,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[H,G,K]}),t[52]=H,t[53]=G,t[54]=K,t[55]=q):q=t[55];let J;return t[56]!==q||t[57]!==z?(J=(0,Q.jsx)(te,{open:!0,onOpenChange:z,children:q}),t[56]=q,t[57]=z,t[58]=J):J=t[58],J}function Qn(e){let t=(0,_t.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=Oe(),s=n!==null,c=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,b,x,S,E,O;if(t[5]!==r||t[6]!==u||t[7]!==n.name){E=u.trim(),O=E===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,S=E.length>64,b=E===``||!Se.test(E)||S,x=!b&&!O&&r.has(E),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=b,t[10]=x,t[11]=S,t[12]=E,t[13]=O}else v=t[8],b=t[9],x=t[10],S=t[11],E=t[12],O=t[13];let k=x,A=!b&&!k&&!O&&!f,j;t[17]!==A||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==E?(j=async function(){if(!n||!A)return;p(!0);let e=await o({scope:n.scope,name:n.name},E);p(!1),e.ok&&(a?.(E),i(!1))},t[17]=A,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=E,t[23]=j):j=t[23];let M=j,N;t[24]===i?N=t[25]:(N=e=>e?null:i(!1),t[24]=i,t[25]=N);let P;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`dw_3cv`})}),t[26]=P):P=t[26];let F;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(ee,{children:[P,(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`R9IDFz`})})]}),t[27]=F):F=t[27];let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(l,{id:`6YtxFj`}),t[28]=I):I=t[28];let R;t[29]===c?R=t[30]:(R=(0,Q.jsx)(L,{htmlFor:c,children:I}),t[29]=c,t[30]=R);let z;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>d(e.target.value),t[31]=z):z=t[31];let B;t[32]===M?B=t[33]:(B=e=>{e.key===`Enter`&&M()},t[32]=M,t[33]=B);let V=b||k,H=b&&E!==``||k?`${c}-error`:void 0,U;t[34]!==c||t[35]!==u||t[36]!==B||t[37]!==V||t[38]!==H?(U=(0,Q.jsx)(Ne,{id:c,value:u,onChange:z,onKeyDown:B,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":V,"aria-describedby":H,className:`font-mono`}),t[34]=c,t[35]=u,t[36]=B,t[37]=V,t[38]=H,t[39]=U):U=t[39];let W;t[40]!==k||t[41]!==v||t[42]!==c||t[43]!==b||t[44]!==S||t[45]!==E?(W=b&&E!==``?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(l,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):S?(0,Q.jsx)(l,{id:`lK9c4T`}):(0,Q.jsx)(l,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):k?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(l,{id:`YJ1BTp`})}):null,t[40]=k,t[41]=v,t[42]=c,t[43]=b,t[44]=S,t[45]=E,t[46]=W):W=t[46];let G;t[47]!==R||t[48]!==U||t[49]!==W?(G=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[R,U,W]}),t[47]=R,t[48]=U,t[49]=W,t[50]=G):G=t[50];let K;t[51]===i?K=t[52]:(K=()=>i(!1),t[51]=i,t[52]=K);let q;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(l,{id:`dEgA5A`}),t[53]=q):q=t[53];let J;t[54]!==f||t[55]!==K?(J=(0,Q.jsx)(y,{variant:`outline`,className:`font-mono uppercase`,onClick:K,disabled:f,children:q}),t[54]=f,t[55]=K,t[56]=J):J=t[56];let Y;t[57]===M?Y=t[58]:(Y=()=>void M(),t[57]=M,t[58]=Y);let ne=!A,X;t[59]===f?X=t[60]:(X=f?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[59]=f,t[60]=X);let re;t[61]!==Y||t[62]!==ne||t[63]!==X?(re=(0,Q.jsx)(y,{onClick:Y,disabled:ne,children:X}),t[61]=Y,t[62]=ne,t[63]=X,t[64]=re):re=t[64];let ie;t[65]!==J||t[66]!==re?(ie=(0,Q.jsxs)(D,{children:[J,re]}),t[65]=J,t[66]=re,t[67]=ie):ie=t[67];let ae;t[68]!==G||t[69]!==ie?(ae=(0,Q.jsxs)(T,{children:[F,G,ie]}),t[68]=G,t[69]=ie,t[70]=ae):ae=t[70];let oe;return t[71]!==s||t[72]!==ae||t[73]!==N?(oe=(0,Q.jsx)(te,{open:s,onOpenChange:N,children:ae}),t[71]=s,t[72]=ae,t[73]=N,t[74]=oe):oe=t[74],oe}function $n(){let e=(0,_t.c)(5),{_:t}=u(),n=Ue(),r=De(),i=st(),a;return e[0]!==t||e[1]!==r||e[2]!==n||e[3]!==i?(a=async(e,a)=>{if(a===e.scope)return!1;Ve(e.scope,e.name);let o=await Ze({name:e.name,fromScope:e.scope,toScope:a});if(Be(e.scope,e.name),!o.ok)return Z.error(t({id:`07eGJB`,values:{0:o.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[a]}}));let s=i.status===`ready`?i.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0;return r(s?Le(s):se(e.scope,e.name),a===`project`&&o.path!==void 0?`${o.path.replace(/\/+$/,``)}/SKILL`:se(a,e.name)),!0},e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function er(e){let t=(0,_t.c)(38),{target:n,onOpenChange:r}=e,i=Ue(),a=$n(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:c,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[c],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=b):b=t[10];let x;t[11]===v?x=t[12]:(x=(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`7bIiJ7`,values:v,components:b})}),t[11]=v,t[12]=x);let S;t[13]!==m||t[14]!==x?(S=(0,Q.jsxs)(ee,{children:[m,x]}),t[13]=m,t[14]=x,t[15]=S):S=t[15];let E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(l,{id:`dEgA5A`}),t[16]=E):E=t[16];let k;t[17]===o?k=t[18]:(k=(0,Q.jsx)(O,{asChild:!0,children:(0,Q.jsx)(y,{variant:`outline`,disabled:o,children:E})}),t[17]=o,t[18]=k);let A;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==d?(A=async()=>{s(!0),await a({scope:c,name:u},d),s(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=c,t[23]=d,t[24]=A):A=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(l,{id:`QWdKwH`}),t[25]=j):j=t[25];let M;t[26]!==o||t[27]!==A?(M=(0,Q.jsx)(y,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:A,children:j}),t[26]=o,t[27]=A,t[28]=M):M=t[28];let N;t[29]!==k||t[30]!==M?(N=(0,Q.jsxs)(D,{children:[k,M]}),t[29]=k,t[30]=M,t[31]=N):N=t[31];let P;t[32]!==S||t[33]!==N?(P=(0,Q.jsxs)(T,{className:`sm:max-w-md`,children:[S,N]}),t[32]=S,t[33]=N,t[34]=P):P=t[34];let F;return t[35]!==f||t[36]!==P?(F=(0,Q.jsx)(te,{open:!0,onOpenChange:f,children:P}),t[35]=f,t[36]=P,t[37]=F):F=t[37],F}function tr(){let e=(0,_t.c)(45),{_:t}=u(),n=ct(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[l,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),v;e[0]===t?v=e[1]:(v=async function(e,n,r){_(e.name);let i=await $e({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(_(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=nr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=v);let y=v,b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=async function(e,t){if(t.length!==0){_(e.name);for(let{target:n,mode:r}of t){let t=await nt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}_(null)}},e[2]=b):b=e[2];let x=b,S;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){_(e.name);let n=await t();return _(null),n},e[3]=S):S=e[3];let C=S,w;e[4]!==t||e[5]!==n?(w=async function(e,r){let i=await et({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=w):w=e[6];let T=w,E,D;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||i(null)},D=()=>i(null),e[7]=E,e[8]=D):(E=e[7],D=e[8]);let O;e[9]===r?O=e[10]:(O=(0,Q.jsx)(qn,{skill:r,onOpenChange:E,onDeleted:D}),e[9]=r,e[10]=O);let ee=a?.skill??null,te=a?.existingNames??ir,k,A;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||o(null)},k=()=>o(null),e[11]=k,e[12]=A):(k=e[11],A=e[12]);let j;e[13]!==ee||e[14]!==te?(j=(0,Q.jsx)(Qn,{skill:ee,existingNames:te,onOpenChange:A,onRenamed:k}),e[13]=ee,e[14]=te,e[15]=j):j=e[15];let M;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{e||c(null)},e[16]=M):M=e[16];let N;e[17]===s?N=e[18]:(N=(0,Q.jsx)(er,{target:s,onOpenChange:M}),e[17]=s,e[18]=N);let P;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e||d(null)},e[19]=P):P=e[19];let F;e[20]===l?F=e[21]:(F=(0,Q.jsx)(Xn,{target:l,onOpenChange:P}),e[20]=l,e[21]=F);let I;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{e||p(null)},e[22]=I):I=e[22];let L;e[23]===f?L=e[24]:(L=(0,Q.jsx)(Yn,{target:f,onOpenChange:I}),e[23]=f,e[24]=L);let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||h(null)},e[25]=R):R=e[25];let z;e[26]===m?z=e[27]:(z=(0,Q.jsx)(Zn,{target:m,onOpenChange:R}),e[26]=m,e[27]=z);let B;e[28]!==j||e[29]!==N||e[30]!==F||e[31]!==L||e[32]!==z||e[33]!==O?(B=(0,Q.jsxs)(Q.Fragment,{children:[O,j,N,F,L,z]}),e[28]=j,e[29]=N,e[30]=F,e[31]=L,e[32]=z,e[33]=O,e[34]=B):B=e[34];let V=B,H,U,W,G,K;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(e,t)=>o({skill:e,existingNames:t}),U=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),W=(e,t)=>d({skill:e,filePath:t}),G=(e,t)=>p(t===void 0?{skill:e}:{skill:e,prefix:t}),K=(e,t)=>h({skill:e,editor:t}),e[35]=H,e[36]=U,e[37]=W,e[38]=G,e[39]=K):(H=e[35],U=e[36],W=e[37],G=e[38],K=e[39]);let q;return e[40]!==V||e[41]!==T||e[42]!==y||e[43]!==g?(q={installingName:g,install:y,convertLocations:x,runLocationWrite:C,duplicate:T,requestDelete:i,requestRename:H,requestScopeMove:U,requestFileRename:W,requestFileCreate:G,requestForkResolve:K,dialogs:V},e[40]=V,e[41]=T,e[42]=y,e[43]=g,e[44]=q):q=e[44],q}function nr(e){return e.map(rr).join(`, `)}function rr(e){return _e[e]??e}var ir=new Set;function ar(e){let t=(0,_t.c)(29),{skill:n,filePath:r,actions:i}=e,{_:a}=u(),o=typeof window<`u`?window.okDesktop:void 0,s=n.absolutePath?`${n.absolutePath}/${r}`:void 0,c=`${n.path}/${r}`,d;t[0]===a?d=t[1]:(d=async function(e){try{await ut(e),Z.success(a({id:`SXCSQd`}))}catch{Z.error(a({id:`cRHuuI`}))}},t[0]=a,t[1]=d);let f=d,p;t[2]!==i||t[3]!==r||t[4]!==n?(p=()=>i.requestFileRename(n,r),t[2]=i,t[3]=r,t[4]=n,t[5]=p):p=t[5];let m,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(ht,{"aria-hidden":!0}),h=(0,Q.jsx)(l,{id:`2wxgft`}),t[6]=m,t[7]=h):(m=t[6],h=t[7]);let g;t[8]===p?g=t[9]:(g=(0,Q.jsxs)(k,{onSelect:p,children:[m,h]}),t[8]=p,t[9]=g);let _;t[10]===s?_=t[11]:(_=o&&s?(0,Q.jsxs)(k,{onSelect:()=>void o.shell.showItemInFolder(s),children:[(0,Q.jsx)(Ae,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`LtSYdi`})]}):null,t[10]=s,t[11]=_);let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(ke,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[12]=v):v=t[12];let y;t[13]!==s||t[14]!==f?(y=s?(0,Q.jsx)(k,{onSelect:()=>void f(s),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[13]=s,t[14]=f,t[15]=y):y=t[15];let b;t[16]!==f||t[17]!==c?(b=()=>void f(c),t[16]=f,t[17]=c,t[18]=b):b=t[18];let x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(l,{id:`xloBjn`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,Q.jsx)(k,{onSelect:b,children:x}),t[20]=b,t[21]=S);let C;t[22]!==S||t[23]!==y?(C=(0,Q.jsxs)(A,{children:[v,(0,Q.jsxs)(j,{children:[y,S]})]}),t[22]=S,t[23]=y,t[24]=C):C=t[24];let w;return t[25]!==C||t[26]!==g||t[27]!==_?(w=(0,Q.jsxs)(Q.Fragment,{children:[g,_,C]}),t[25]=C,t[26]=g,t[27]=_,t[28]=w):w=t[28],w}function or(e){let t=(0,_t.c)(86),{skill:n,actions:r,existingNames:a}=e,{_:o}=u(),s=lt(),c=Ue(),d=_().states,{dispatch:f}=un(),m=bn(n,r),h=typeof window<`u`?window.okDesktop:void 0,g=n.absolutePath,v;t[0]===o?v=t[1]:(v=async function(e){try{await ut(e),Z.success(o({id:`SXCSQd`}))}catch{Z.error(o({id:`cRHuuI`}))}},t[0]=o,t[1]=v);let y=v,b;t[2]===g?b=t[3]:(b=h&&g?(0,Q.jsxs)(k,{onSelect:()=>void h.shell.showItemInFolder(g),children:[(0,Q.jsx)(Ae,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`LtSYdi`})]}):null,t[2]=g,t[3]=b);let x;t[4]!==n.name||t[5]!==n.scope||t[6]!==s?(x=Kt({skillName:n.name,scope:n.scope,workspace:s}),t[4]=n.name,t[5]=n.scope,t[6]=s,t[7]=x):x=t[7];let S;t[8]!==f||t[9]!==d||t[10]!==x?(S=(0,Q.jsx)(Bn,{input:x,installStates:d,isElectronHost:h!=null,dispatch:f}),t[8]=f,t[9]=d,t[10]=x,t[11]=S):S=t[11];let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(ke,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[12]=C):C=t[12];let w;t[13]!==g||t[14]!==y?(w=g?(0,Q.jsx)(k,{onSelect:()=>void y(g),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[13]=g,t[14]=y,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==n.path?(T=()=>void y(n.path),t[16]=y,t[17]=n.path,t[18]=T):T=t[18];let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(l,{id:`xloBjn`}),t[19]=E):E=t[19];let D;t[20]===T?D=t[21]:(D=(0,Q.jsx)(k,{onSelect:T,children:E}),t[20]=T,t[21]=D);let O;t[22]!==w||t[23]!==D?(O=(0,Q.jsxs)(A,{children:[C,(0,Q.jsxs)(j,{children:[w,D]})]}),t[22]=w,t[23]=D,t[24]=O):O=t[24];let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(I,{}),t[25]=ee):ee=t[25];let te;t[26]!==r||t[27]!==a||t[28]!==n?(te=()=>void r.duplicate(n,a),t[26]=r,t[27]=a,t[28]=n,t[29]=te):te=t[29];let M,N;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(i,{"aria-hidden":!0}),N=(0,Q.jsx)(l,{id:`euc6Ns`}),t[30]=M,t[31]=N):(M=t[30],N=t[31]);let P;t[32]===te?P=t[33]:(P=(0,Q.jsxs)(k,{onSelect:te,children:[M,N]}),t[32]=te,t[33]=P);let L;t[34]!==r||t[35]!==a||t[36]!==n?(L=()=>r.requestRename(n,a),t[34]=r,t[35]=a,t[36]=n,t[37]=L):L=t[37];let R,z;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(ht,{"aria-hidden":!0}),z=(0,Q.jsx)(l,{id:`2wxgft`}),t[38]=R,t[39]=z):(R=t[38],z=t[39]);let B;t[40]===L?B=t[41]:(B=(0,Q.jsxs)(k,{onSelect:L,children:[R,z]}),t[40]=L,t[41]=B);let V;t[42]!==r||t[43]!==n?(V=()=>r.requestFileCreate(n),t[42]=r,t[43]=n,t[44]=V):V=t[44];let H,U;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(p,{"aria-hidden":!0}),U=(0,Q.jsx)(l,{id:`HdkSiO`}),t[45]=H,t[46]=U):(H=t[45],U=t[46]);let W;t[47]===V?W=t[48]:(W=(0,Q.jsxs)(k,{onSelect:V,children:[H,U]}),t[47]=V,t[48]=W);let G;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(pt,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),t[49]=G):G=t[49];let K;t[50]!==r||t[51]!==n?(K=e=>r.requestForkResolve(n,e),t[50]=r,t[51]=n,t[52]=K):K=t[52];let q;t[53]!==m||t[54]!==n||t[55]!==K?(q=(0,Q.jsxs)(A,{children:[G,(0,Q.jsx)(j,{className:yn,children:(0,Q.jsx)(Tn,{toggles:m,skill:n,onResolveFork:K})})]}),t[53]=m,t[54]=n,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==r||t[58]!==n?(J=()=>r.requestScopeMove(n,n.scope===`project`?`global`:`project`),t[57]=r,t[58]=n,t[59]=J):J=t[59];let Y;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(ft,{"aria-hidden":!0}),t[60]=Y):Y=t[60];let ne;t[61]!==c.global||t[62]!==c.project||t[63]!==n.scope?(ne=n.scope===`project`?(0,Q.jsx)(l,{id:`bpytj4`,values:{0:c.global}}):(0,Q.jsx)(l,{id:`bpytj4`,values:{0:c.project}}),t[61]=c.global,t[62]=c.project,t[63]=n.scope,t[64]=ne):ne=t[64];let X;t[65]!==J||t[66]!==ne?(X=(0,Q.jsxs)(k,{onSelect:J,children:[Y,ne]}),t[65]=J,t[66]=ne,t[67]=X):X=t[67];let re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(I,{}),t[68]=re):re=t[68];let ie;t[69]!==r||t[70]!==n?(ie=()=>r.requestDelete(n),t[69]=r,t[70]=n,t[71]=ie):ie=t[71];let ae,oe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(Me,{"aria-hidden":!0}),oe=(0,Q.jsx)(l,{id:`cnGeoo`}),t[72]=ae,t[73]=oe):(ae=t[72],oe=t[73]);let se;t[74]===ie?se=t[75]:(se=(0,Q.jsxs)(k,{variant:`destructive`,onSelect:ie,children:[ae,oe]}),t[74]=ie,t[75]=se);let ce;return t[76]!==O||t[77]!==P||t[78]!==B||t[79]!==b||t[80]!==W||t[81]!==q||t[82]!==X||t[83]!==se||t[84]!==S?(ce=(0,Q.jsxs)(Q.Fragment,{children:[b,S,O,ee,P,B,W,q,X,re,se]}),t[76]=O,t[77]=P,t[78]=B,t[79]=b,t[80]=W,t[81]=q,t[82]=X,t[83]=se,t[84]=S,t[85]=ce):ce=t[85],ce}export{gt as C,Bt as S,ft as T,en as _,Wn as a,an as b,vn as c,bn as d,qt as f,Ht as g,Vt as h,er as i,yn as l,Gt as m,ar as n,Bn as o,Ut as p,tr as r,Rn as s,or as t,Tn as u,sn as v,mt as w,un as x,Wt as y};
@@ -1 +1 @@
1
- import{r as e}from"./dist-Nvb76hAm.js";import{Dt as t,ba as n,ga as r,ma as i}from"./dist-DZN2z2Ue2.js";function a(e){return e.path.split(`/`).slice(0,-1).join(`/`)}var o=[`project`,`global`];function s(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}function c(e){return e.startsWith(`open-knowledge-pack-`)?e.slice(n.length):e}function l(e){let t=e.path.replace(/\/SKILL\.mdx?$/i,``);return e.scope===`global`?`~/${t}`:t}function u(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`).replace(/^\/root/,`~`)}function d(){let{_:t}=e();return{project:t({id:`e0NrBM`}),global:t({id:`2GT3Hf`})}}function f(){let{_:t}=e();return{project:t({id:`Es3G-g`}),global:t({id:`fvrHin`})}}function p(e,t){if(e.includes(`/`))return t===`global`?`~/${e}`:e;let n=e===`agents`?`.agents/skills`:(t===`global`?r:i)[e]??`.${e}/skills`;return t===`global`?`~/${n}`:n}function m(e,t){return!e||t===``?[]:Object.keys(e).filter(n=>e[n]===t)}function h(e){let t=e.hostAliases??{},n=e=>e.split(`/`).slice(0,-1).join(`/`),r=new Set(e.hosts),i=new Set([...e.hosts.filter(e=>!e.includes(`/`)).map(t=>p(t,e.scope).replace(/^~\//,``)),...(e.customPlacements??[]).map(e=>n(e.path)),...e.path.includes(`/`)?[n(e.path.replace(/\/SKILL\.mdx?$/i,``))]:[]]);return Object.entries(t).filter(([e,t])=>!r.has(e)&&i.has(t)).map(([e])=>e)}function g(e){let t=new Set(e.symlinkedHosts??[]),n=[],r=new Set,i=(e,t)=>{r.has(e)||(r.add(e),n.push({dir:e,symlink:t}))};i(l(e),t.has(e.hosts[0]??``));for(let n of e.hosts)i(`${p(n,e.scope)}/${e.name}`,t.has(n));for(let t of e.customPlacements??[])i(t.path,t.mode===`link`);return n}function _(e,n=e.hosts){let r=t.options,i=h(e);return[...n.includes(`agents`)?[`agents`]:[],...r.filter(e=>n.includes(e)||i.includes(e)),...(e.customPlacements??[]).map(e=>a(e))]}export{c as a,s as c,d,_ as i,u as l,m as n,g as o,a as r,p as s,o as t,f as u};
1
+ import{r as e}from"./dist-Nvb76hAm.js";import{Dt as t,ba as n,ga as r,ma as i}from"./dist-Bs8DNjRh2.js";function a(e){return e.path.split(`/`).slice(0,-1).join(`/`)}var o=[`project`,`global`];function s(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}function c(e){return e.startsWith(`open-knowledge-pack-`)?e.slice(n.length):e}function l(e){let t=e.path.replace(/\/SKILL\.mdx?$/i,``);return e.scope===`global`?`~/${t}`:t}function u(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`).replace(/^\/root/,`~`)}function d(){let{_:t}=e();return{project:t({id:`e0NrBM`}),global:t({id:`2GT3Hf`})}}function f(){let{_:t}=e();return{project:t({id:`Es3G-g`}),global:t({id:`fvrHin`})}}function p(e,t){if(e.includes(`/`))return t===`global`?`~/${e}`:e;let n=e===`agents`?`.agents/skills`:(t===`global`?r:i)[e]??`.${e}/skills`;return t===`global`?`~/${n}`:n}function m(e,t){return!e||t===``?[]:Object.keys(e).filter(n=>e[n]===t)}function h(e){let t=e.hostAliases??{},n=e=>e.split(`/`).slice(0,-1).join(`/`),r=new Set(e.hosts),i=new Set([...e.hosts.filter(e=>!e.includes(`/`)).map(t=>p(t,e.scope).replace(/^~\//,``)),...(e.customPlacements??[]).map(e=>n(e.path)),...e.path.includes(`/`)?[n(e.path.replace(/\/SKILL\.mdx?$/i,``))]:[]]);return Object.entries(t).filter(([e,t])=>!r.has(e)&&i.has(t)).map(([e])=>e)}function g(e){let t=new Set(e.symlinkedHosts??[]),n=[],r=new Set,i=(e,t)=>{r.has(e)||(r.add(e),n.push({dir:e,symlink:t}))};i(l(e),t.has(e.hosts[0]??``));for(let n of e.hosts)i(`${p(n,e.scope)}/${e.name}`,t.has(n));for(let t of e.customPlacements??[])i(t.path,t.mode===`link`);return n}function _(e,n=e.hosts){let r=t.options,i=h(e);return[...n.includes(`agents`)?[`agents`]:[],...r.filter(e=>n.includes(e)||i.includes(e)),...(e.customPlacements??[]).map(e=>a(e))]}export{c as a,s as c,d,_ as i,u as l,m as n,g as o,a as r,p as s,o as t,f as u};
@@ -1 +1 @@
1
- import{kt as e}from"./dist-DZN2z2Ue2.js";import{t}from"./parse-api-error-CGRziNbI.js";import{o as n}from"./documents-events-BhxlQGXQ.js";async function r(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function i(e,t){try{let n=await fetch(e,t?{signal:t}:void 0);return n.ok?{ok:!0,...await n.json()}:{ok:!1,error:await r(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function a(e,t,n){try{let i=await fetch(e,{method:t,...n===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}});return i.ok?{ok:!0,...await i.json().catch(()=>null)??{}}:{ok:!1,error:await r(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function o(e){let t=e.trim();return t.length<2?{ok:!0,results:[],backend:`skills.sh`,degraded:!1}:i(`/api/skills/search?q=${encodeURIComponent(t)}`)}async function s(){return i(`/api/skills/popular?limit=24`)}async function c(t,n){let r=await i(t?`/api/skills?scope=${t}`:`/api/skills`,n);if(!r.ok)return r;let{ok:a,...o}=r,s=e.safeParse(o);return s.success?{ok:!0,skills:s.data.skills}:{ok:!1,error:`The skills list did not match its schema.`}}async function l(e){return i(`/api/skills/detail?${new URLSearchParams({source:e.source,name:e.name}).toString()}`)}async function u(e,t){return i(`/api/skills/preview?${new URLSearchParams({source:e.source,name:e.name}).toString()}`,t)}async function d(e,t){return i(`/api/skills/resolve-ref?${new URLSearchParams({ref:e.ref,scope:e.scope,from:e.from}).toString()}`,t)}async function f(e,t){return i(`/api/skills/discover?source=${encodeURIComponent(e)}`,t)}async function p(){return i(`/api/skills/installed`)}async function m(e){try{let t=await fetch(`/api/skill/edit-external`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let n=await t.json().catch(()=>null);return!n||typeof n.docName!=`string`?{ok:!1,error:`Server returned a malformed response.`}:{ok:!0,docName:n.docName}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function h(e){try{let t=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,created:i?.created??!1,warnings:i?.warnings??[],...typeof i?.path==`string`?{path:i.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function g(e){try{let r=await fetch(`/api/skill/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null),n=t(e)??`HTTP ${r.status}`,i=typeof e?.detail==`string`&&/multiple skills/i.test(String(e?.title??``))?String(e.detail).split(`, `).map(e=>e.trim()).filter(Boolean):void 0;return i?{ok:!1,error:n,skills:i}:{ok:!1,error:n}}let i=await r.json().catch(()=>null);return!i||typeof i.name!=`string`?{ok:!1,error:`Server returned a malformed import response.`}:(n(),{ok:!0,name:i.name,alreadyImported:i?.alreadyImported??!1,collisionRenamedFrom:i?.collisionRenamedFrom,warnings:i?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function _(e){try{let t=await fetch(`/api/skills/import-bulk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return!i||!Array.isArray(i.results)?{ok:!1,error:`Server returned a malformed import response.`}:(n(),{ok:!0,...i})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function v(e,t){try{let i=await fetch(`/api/skill-upload?scope=${encodeURIComponent(t)}`,{method:`POST`,body:e});if(!i.ok)return{ok:!1,error:await r(i)};let a=await i.json().catch(()=>null);return!a||typeof a.name!=`string`?{ok:!1,error:`Server returned a malformed upload response.`}:(n(),{ok:!0,name:a.name,alreadyImported:a?.alreadyImported??!1,collisionRenamedFrom:a?.collisionRenamedFrom,warnings:a?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function y(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function b(e){try{let t=y(e.name,e.existingNames),i=await fetch(`/api/skill/duplicate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,toName:t})});if(!i.ok)return{ok:!1,error:await r(i)};let a=await i.json().catch(()=>null);return typeof a?.name==`string`?(n(),{ok:!0,name:a.name}):{ok:!1,error:`Server returned a malformed duplicate response.`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function x(e){let{name:t,fromScope:i,toScope:a}=e;if(i===a)return{ok:!0,scope:a};try{let e=await fetch(`/api/skill/move-scope`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,fromScope:i,toScope:a})});if(!e.ok)return{ok:!1,error:await r(e)};let o=await e.json().catch(()=>null);return n(),{ok:!0,scope:a,...typeof o?.path==`string`?{path:o.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function S(e){try{let t=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,committed:i?.committed??!1,...typeof i?.to==`string`?{to:i.to}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function C(e,t){try{let i=`?name=${encodeURIComponent(t)}&scope=${encodeURIComponent(e)}`,a=await fetch(`/api/skill${i}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await r(a)};let o=await a.json().catch(()=>null);return n(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function w(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,fork:{editor:e.editor,action:e.action,...e.toName===void 0?{}:{toName:e.toName}}});return t.ok?(n(),{ok:!0}):t}async function T(e){try{let t=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,path:i?.path??e.path}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function E(e){try{let t=await fetch(`/api/skill-file/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,from:i?.from??e.from,to:i?.to??e.to,...i?.fromDocName===void 0?{}:{fromDocName:i.fromDocName},...i?.toDocName===void 0?{}:{toDocName:i.toDocName}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function D(e,t,n){try{let i=new URLSearchParams({name:t,scope:e,...n?{host:n}:{}}),a=await fetch(`/api/skill?${i.toString()}`);return a.ok?{ok:!0,files:(await a.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await r(a)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function O(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path,...e.host?{host:e.host}:{}}),n=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!n.ok)return{ok:!1,status:n.status,error:await r(n)};let i=await n.json().catch(()=>null);return typeof i?.text==`string`?{ok:!0,text:i.text}:{ok:!1,status:n.status,error:`HTTP ${n.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function k(e,t){return O({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function A(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,hosts:i?.hosts??[],scripts:i?.scripts??!1,warnings:i?.warnings??[],warningCodes:i?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function j(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,place:{dir:e.dir,mode:e.mode}})});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,placedAt:i?.placedAt??e.dir}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function M(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,unplace:{path:e.path}});return t.ok?(n(),{ok:!0}):t}async function N(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,setSource:e.target});return t.ok?(n(),{ok:!0}):t}async function P(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,convert:{target:e.target,mode:e.mode}});return t.ok?(n(),{ok:!0}):t}async function F(e){try{let t=await fetch(`/api/skill-targets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folderAction:e})});return t.ok?{ok:!0}:{ok:!1,error:await r(t)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function I(e){try{let t=await fetch(`/api/skill/reimport`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return e.dryRun||n(),{ok:!0,updated:i?.updated??!1,source:i?.source??``,localBody:i?.localBody,upstreamBody:i?.upstreamBody,...i?.gitTracked===void 0?{}:{gitTracked:i.gitTracked},warnings:i?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function L(e){try{let t=await fetch(`/api/skill/revert`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,warnings:i?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{T as A,d as C,N as D,o as E,M as O,w as S,h as T,x as _,m as a,I as b,u as c,_ as d,A as f,S as g,k as h,b as i,v as k,D as l,c as m,C as n,s as o,p,f as r,l as s,P as t,g as u,j as v,L as w,E as x,F as y};
1
+ import{kt as e}from"./dist-Bs8DNjRh2.js";import{t}from"./parse-api-error-CGRziNbI.js";import{o as n}from"./documents-events-BajItHup.js";async function r(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function i(e,t){try{let n=await fetch(e,t?{signal:t}:void 0);return n.ok?{ok:!0,...await n.json()}:{ok:!1,error:await r(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function a(e,t,n){try{let i=await fetch(e,{method:t,...n===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}});return i.ok?{ok:!0,...await i.json().catch(()=>null)??{}}:{ok:!1,error:await r(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function o(e){let t=e.trim();return t.length<2?{ok:!0,results:[],backend:`skills.sh`,degraded:!1}:i(`/api/skills/search?q=${encodeURIComponent(t)}`)}async function s(){return i(`/api/skills/popular?limit=24`)}async function c(t,n){let r=await i(t?`/api/skills?scope=${t}`:`/api/skills`,n);if(!r.ok)return r;let{ok:a,...o}=r,s=e.safeParse(o);return s.success?{ok:!0,skills:s.data.skills}:{ok:!1,error:`The skills list did not match its schema.`}}async function l(e){return i(`/api/skills/detail?${new URLSearchParams({source:e.source,name:e.name}).toString()}`)}async function u(e,t){return i(`/api/skills/preview?${new URLSearchParams({source:e.source,name:e.name}).toString()}`,t)}async function d(e,t){return i(`/api/skills/resolve-ref?${new URLSearchParams({ref:e.ref,scope:e.scope,from:e.from}).toString()}`,t)}async function f(e,t){return i(`/api/skills/discover?source=${encodeURIComponent(e)}`,t)}async function p(){return i(`/api/skills/installed`)}async function m(e){try{let t=await fetch(`/api/skill/edit-external`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let n=await t.json().catch(()=>null);return!n||typeof n.docName!=`string`?{ok:!1,error:`Server returned a malformed response.`}:{ok:!0,docName:n.docName}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function h(e){try{let t=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,created:i?.created??!1,warnings:i?.warnings??[],...typeof i?.path==`string`?{path:i.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function g(e){try{let r=await fetch(`/api/skill/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null),n=t(e)??`HTTP ${r.status}`,i=typeof e?.detail==`string`&&/multiple skills/i.test(String(e?.title??``))?String(e.detail).split(`, `).map(e=>e.trim()).filter(Boolean):void 0;return i?{ok:!1,error:n,skills:i}:{ok:!1,error:n}}let i=await r.json().catch(()=>null);return!i||typeof i.name!=`string`?{ok:!1,error:`Server returned a malformed import response.`}:(n(),{ok:!0,name:i.name,alreadyImported:i?.alreadyImported??!1,collisionRenamedFrom:i?.collisionRenamedFrom,warnings:i?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function _(e){try{let t=await fetch(`/api/skills/import-bulk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return!i||!Array.isArray(i.results)?{ok:!1,error:`Server returned a malformed import response.`}:(n(),{ok:!0,...i})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function v(e,t){try{let i=await fetch(`/api/skill-upload?scope=${encodeURIComponent(t)}`,{method:`POST`,body:e});if(!i.ok)return{ok:!1,error:await r(i)};let a=await i.json().catch(()=>null);return!a||typeof a.name!=`string`?{ok:!1,error:`Server returned a malformed upload response.`}:(n(),{ok:!0,name:a.name,alreadyImported:a?.alreadyImported??!1,collisionRenamedFrom:a?.collisionRenamedFrom,warnings:a?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function y(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function b(e){try{let t=y(e.name,e.existingNames),i=await fetch(`/api/skill/duplicate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,toName:t})});if(!i.ok)return{ok:!1,error:await r(i)};let a=await i.json().catch(()=>null);return typeof a?.name==`string`?(n(),{ok:!0,name:a.name}):{ok:!1,error:`Server returned a malformed duplicate response.`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function x(e){let{name:t,fromScope:i,toScope:a}=e;if(i===a)return{ok:!0,scope:a};try{let e=await fetch(`/api/skill/move-scope`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,fromScope:i,toScope:a})});if(!e.ok)return{ok:!1,error:await r(e)};let o=await e.json().catch(()=>null);return n(),{ok:!0,scope:a,...typeof o?.path==`string`?{path:o.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function S(e){try{let t=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,committed:i?.committed??!1,...typeof i?.to==`string`?{to:i.to}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function C(e,t){try{let i=`?name=${encodeURIComponent(t)}&scope=${encodeURIComponent(e)}`,a=await fetch(`/api/skill${i}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await r(a)};let o=await a.json().catch(()=>null);return n(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function w(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,fork:{editor:e.editor,action:e.action,...e.toName===void 0?{}:{toName:e.toName}}});return t.ok?(n(),{ok:!0}):t}async function T(e){try{let t=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,path:i?.path??e.path}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function E(e){try{let t=await fetch(`/api/skill-file/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,from:i?.from??e.from,to:i?.to??e.to,...i?.fromDocName===void 0?{}:{fromDocName:i.fromDocName},...i?.toDocName===void 0?{}:{toDocName:i.toDocName}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function D(e,t,n){try{let i=new URLSearchParams({name:t,scope:e,...n?{host:n}:{}}),a=await fetch(`/api/skill?${i.toString()}`);return a.ok?{ok:!0,files:(await a.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await r(a)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function O(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path,...e.host?{host:e.host}:{}}),n=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!n.ok)return{ok:!1,status:n.status,error:await r(n)};let i=await n.json().catch(()=>null);return typeof i?.text==`string`?{ok:!0,text:i.text}:{ok:!1,status:n.status,error:`HTTP ${n.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function k(e,t){return O({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function A(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,hosts:i?.hosts??[],scripts:i?.scripts??!1,warnings:i?.warnings??[],warningCodes:i?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function j(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,place:{dir:e.dir,mode:e.mode}})});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,placedAt:i?.placedAt??e.dir}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function M(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,unplace:{path:e.path}});return t.ok?(n(),{ok:!0}):t}async function N(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,setSource:e.target});return t.ok?(n(),{ok:!0}):t}async function P(e){let t=await a(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,convert:{target:e.target,mode:e.mode}});return t.ok?(n(),{ok:!0}):t}async function F(e){try{let t=await fetch(`/api/skill-targets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folderAction:e})});return t.ok?{ok:!0}:{ok:!1,error:await r(t)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function I(e){try{let t=await fetch(`/api/skill/reimport`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return e.dryRun||n(),{ok:!0,updated:i?.updated??!1,source:i?.source??``,localBody:i?.localBody,upstreamBody:i?.upstreamBody,...i?.gitTracked===void 0?{}:{gitTracked:i.gitTracked},warnings:i?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function L(e){try{let t=await fetch(`/api/skill/revert`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await r(t)};let i=await t.json().catch(()=>null);return n(),{ok:!0,warnings:i?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{T as A,d as C,N as D,o as E,M as O,w as S,h as T,x as _,m as a,I as b,u as c,_ as d,A as f,S as g,k as h,b as i,v as k,D as l,c as m,C as n,s as o,p,f as r,l as s,P as t,g as u,j as v,L as w,E as x,F as y};
@@ -1,2 +1,2 @@
1
- import{z as e}from"./CodeMirrorPropInput-7jlwH38H.js";import{$ as t,B as n,C as r,N as i,S as a,V as o,et as s,f as c,v as l,y as u,z as d}from"./config-provider-BwmrVQtw.js";import{$ as f,Dt as p,J as m,Mt as h,Q as g,St as _,X as v,kt as y}from"./dist-pl6OT5yc.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:i(this.yanchor),yhead:i(this.yhead)}}static fromJSON(t){return new e(a(t.yanchor),a(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return r(this.ytext,e,t)}fromYPos(e){let t=u(a(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?p.cursor(n.pos,n.assoc):p.range(t.pos,n.pos)}},S=y.define({combine(e){return e[e.length-1]}}),C=_.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
1
+ import{z as e}from"./CodeMirrorPropInput-BFenJemA.js";import{$ as t,B as n,C as r,N as i,S as a,V as o,et as s,f as c,v as l,y as u,z as d}from"./config-provider-D2FBTvIx.js";import{$ as f,Dt as p,J as m,Mt as h,Q as g,St as _,X as v,kt as y}from"./dist-pl6OT5yc.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:i(this.yanchor),yhead:i(this.yhead)}}static fromJSON(t){return new e(a(t.yanchor),a(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return r(this.ytext,e,t)}fromYPos(e){let t=u(a(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?p.cursor(n.pos,n.assoc):p.range(t.pos,n.pos)}},S=y.define({combine(e){return e[e.length-1]}}),C=_.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
2
2
  `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},T=g.fromClass(w),E=v.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),D=_.define(),O=class extends f{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return d(`span`,[o(`class`,`cm-ySelectionCaret`),o(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[n(`⁠`),d(`div`,[o(`class`,`cm-ySelectionCaretDot`)]),n(`⁠`),d(`div`,[o(`class`,`cm-ySelectionInfo`)],[n(this.name)]),n(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},k=class{constructor(e){this.conf=e.state.facet(S),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[D.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=h.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let n=this.conf.ytext,i=n.doc,o=this.conf.awareness,c=[],d=this.conf.awareness.getLocalState();if(d!=null){let t=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=t?e.state.selection.main:null,s=d.cursor==null?null:a(d.cursor.anchor),c=d.cursor==null?null:a(d.cursor.head);if(i!=null){let e=r(n,i.anchor),t=r(n,i.head);(d.cursor==null||!l(s,e)||!l(c,t))&&o.setLocalStateField(`cursor`,{anchor:e,head:t})}else d.cursor!=null&&t&&o.setLocalStateField(`cursor`,null)}o.getStates().forEach((r,a)=>{if(a===o.doc.clientID)return;let l=r.cursor;if(l==null||l.anchor==null||l.head==null)return;let d=u(l.anchor,i),f=u(l.head,i);if(d==null||f==null||d.type!==n||f.type!==n)return;let{color:p=`#30bced`,name:h=`Anonymous`}=r.user||{},g=r.user&&r.user.colorLight||p+`33`,_=s(d.index,f.index),v=t(d.index,f.index),y=e.view.state.doc.lineAt(_),b=e.view.state.doc.lineAt(v);if(y.number===b.number)c.push({from:_,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});else{c.push({from:_,to:y.from+y.length,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})}),c.push({from:b.from,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});for(let t=y.number+1;t<b.number;t++){let n=e.view.state.doc.line(t).from;c.push({from:n,to:n,value:m.line({attributes:{style:`background-color: ${g}`,class:`cm-yLineSelection`}})})}}c.push({from:f.index,to:f.index,value:m.widget({side:f.index-d.index>0?-1:1,block:!1,widget:new O(p,h)})})}),this.decorations=m.set(c,!0)}},A=g.fromClass(k,{decorations:e=>e.decorations}),j=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},M=y.define({combine(e){return e[e.length-1]}});_.define();var N=class{constructor(t){this.view=t,this.conf=t.state.facet(M),this._undoManager=this.conf.undoManager,this.syncConf=t.state.facet(S),this._beforeChangeSelection=null,this._mux=e(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:e})=>{let n=e.meta.get(this);if(n){let e=this.syncConf.fromYRange(n);t.dispatch(t.state.update({selection:e,effects:[v.scrollIntoView(e)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(C)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},P=g.fromClass(N),F=({state:e,dispatch:t})=>e.facet(M).undo()||!0,I=({state:e,dispatch:t})=>e.facet(M).redo()||!0,L=[{key:`Mod-z`,run:F,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:I,preventDefault:!0},{key:`Mod-Shift-z`,run:I,preventDefault:!0}],R=(e,t,{undoManager:n=new c(e)}={})=>{let r=new x(e,t),i=[S.of(r),T];return t&&i.push(E,A),n!==!1&&i.push(M.of(new j(n)),P,v.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?F(t):e.inputType===`historyRedo`?I(t):!1}})),i};export{L as n,R as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./utils-CPqDy6Hr.js";import{i as o,n as ee,t as te}from"./tooltip-CtvLp_YK.js";import{br as ne}from"./dist-DZN2z2Ue2.js";import{t as re}from"./x-M_y7ybHr.js";import{t as ie}from"./badge-DwfQ2IQa.js";var s=i(),c=e(n(),1),l=t();function u(e){let t=(0,s.c)(96),{value:n,onChange:i,onBlur:u,placeholder:d,id:f,disabled:p,grammar:ae,entryProblems:m,"aria-describedby":oe,"aria-invalid":se,ref:h}=e,ce=ae===void 0?`frontmatter-tag`:ae,{_:g}=r(),[_,le]=(0,c.useState)(``),[v,ue]=(0,c.useState)(null),[y,b]=(0,c.useState)(null),de=(0,c.useRef)(null),x;t[0]===h?x=t[1]:(x=e=>{de.current=e,typeof h==`function`?h(e):h&&(h.current=e)},t[0]=h,t[1]=x);let fe=x,[S,C]=(0,c.useState)(!1),pe=(0,c.useId)(),w=`${f??pe}-grammar-hint`,T=`${f??pe}-pill`,E;t[2]!==g||t[3]!==d?(E=d??g({id:`M5mfAe`}),t[2]=g,t[3]=d,t[4]=E):E=t[4];let me=E,D=ce===`frontmatter-tag`,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{le(``),C(!1),ue(null)},t[5]=O):O=t[5];let k=O,A;t[6]!==v||t[7]!==i||t[8]!==D||t[9]!==n?(A=e=>{let t=e.trim(),r=v===null?-1:n.indexOf(v);if(!t)return r!==-1&&i(n.filter((e,t)=>t!==r)),v!==null&&k(),!0;if(D&&!ne(t))return C(!0),!1;let a=D&&t.startsWith(`#`)?t.slice(1):t,o=n.indexOf(a);if(r===-1)return o===-1&&i([...n,a]),k(),!0;let ee=n.map((e,t)=>t===r?a:e);return i(o===-1||o===r?ee:ee.filter((e,t)=>t!==r)),k(),!0},t[6]=v,t[7]=i,t[8]=D,t[9]=n,t[10]=A):A=t[10];let j=A,M;t[11]!==i||t[12]!==n?(M=e=>{i(n.filter((t,n)=>n!==e))},t[11]=i,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==j||t[15]!==p||t[16]!==_?(P=e=>{p||(_.trim()!==``&&j(_),le(e),C(!1),b(null),ue(e))},t[14]=j,t[15]=p,t[16]=_,t[17]=P):P=t[17];let F=P,I;t[18]!==y||t[19]!==n?(I=y===null?-1:n.indexOf(y),t[18]=y,t[19]=n,t[20]=I):I=t[20];let L=I,R;t[21]===n?R=t[22]:(R=e=>{b(e===null?null:n[e]??null)},t[21]=n,t[22]=R);let z=R,B,V;t[23]===v?(B=t[24],V=t[25]):(B=()=>{v!==null&&(de.current?.focus(),de.current?.select())},V=[v],t[23]=v,t[24]=B,t[25]=V),(0,c.useEffect)(B,V);let H=S?`true`:se,he=p&&`pointer-events-none opacity-60`,U;t[26]===he?U=t[27]:(U=a(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,he),t[26]=he,t[27]=U);let W;if(t[28]!==g||t[29]!==F||t[30]!==p||t[31]!==v||t[32]!==m||t[33]!==y||t[34]!==T||t[35]!==N||t[36]!==D||t[37]!==n){let e;t[39]!==g||t[40]!==F||t[41]!==p||t[42]!==v||t[43]!==m||t[44]!==y||t[45]!==T||t[46]!==N||t[47]!==D?(e=(e,t)=>{if(e===v)return null;let n=D&&!ne(e),r=m?.get(e),i=n||r!==void 0,s=r??(n?`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`:void 0),c=e===y,u=(0,l.jsxs)(ie,{id:`${T}-${t}`,variant:i?`destructive`:`secondary`,"data-tag-invalid":n?`true`:void 0,"data-tag-problem":r===void 0?void 0:`true`,"data-highlighted":c?`true`:void 0,className:a(`gap-1 pl-2 pr-1 normal-case`,i&&`ring-1 ring-destructive/40`,c&&`ring-2 ring-ring/70`),children:[(0,l.jsx)(`button`,{type:`button`,tabIndex:-1,className:`cursor-pointer rounded-sm font-mono`,onDoubleClick:()=>F(e),disabled:p,"aria-label":g({id:`NkNfSr`,values:{tag:e}}),title:s===void 0?g({id:`vHlhDc`}):void 0,children:e}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>N(t),"aria-label":g({id:`D4H2N6`,values:{tag:e}}),className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:p,children:(0,l.jsx)(re,{className:`size-3`,"aria-hidden":`true`})})]},e);return s===void 0?u:(0,l.jsxs)(te,{children:[(0,l.jsx)(o,{asChild:!0,children:u}),(0,l.jsx)(ee,{children:s})]},e)},t[39]=g,t[40]=F,t[41]=p,t[42]=v,t[43]=m,t[44]=y,t[45]=T,t[46]=N,t[47]=D,t[48]=e):e=t[48],W=n.map(e),t[28]=g,t[29]=F,t[30]=p,t[31]=v,t[32]=m,t[33]=y,t[34]=T,t[35]=N,t[36]=D,t[37]=n,t[38]=W}else W=t[38];let G;t[49]!==S||t[50]!==y?(G=e=>{le(e.target.value),S&&C(!1),y!==null&&b(null)},t[49]=S,t[50]=y,t[51]=G):G=t[51];let K;t[52]!==j||t[53]!==F||t[54]!==_||t[55]!==S||t[56]!==v||t[57]!==z||t[58]!==L||t[59]!==N||t[60]!==n?(K=e=>{let t=e.currentTarget,r=t.selectionStart===0&&t.selectionEnd===0;if(v===null&&n.length>0){if(e.key===`ArrowLeft`&&(L!==-1||r)){e.preventDefault(),z(L===-1?n.length-1:Math.max(0,L-1));return}if(e.key===`ArrowRight`&&L!==-1){e.preventDefault(),z(L===n.length-1?null:L+1);return}if((e.key===`Home`||e.key===`End`)&&L!==-1){e.preventDefault(),z(e.key===`Home`?0:n.length-1);return}}if(L!==-1&&v===null){if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=n[L];t!==void 0&&F(t);return}if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let t=n[L-1]??null,r=n[L+1]??null;N(L),b(e.key===`Backspace`?t??r:r??t);return}}e.key===`Enter`?(_.trim()||v!==null)&&(e.preventDefault(),j(_)):e.key===`,`?(e.preventDefault(),_.trim()&&j(_)):e.key===`Tab`?_.trim()&&(e.preventDefault(),j(_)):e.key===`Backspace`&&_===``&&n.length>0&&v===null?(e.preventDefault(),N(n.length-1)):e.key===`Escape`&&(v!==null||S?(e.preventDefault(),k(),b(null)):L!==-1&&(e.preventDefault(),b(null)))},t[52]=j,t[53]=F,t[54]=_,t[55]=S,t[56]=v,t[57]=z,t[58]=L,t[59]=N,t[60]=n,t[61]=K):K=t[61];let q;t[62]!==j||t[63]!==_||t[64]!==v||t[65]!==u?(q=()=>{(_.trim()||v!==null)&&!j(_)&&v!==null&&k(),b(null),u?.()},t[62]=j,t[63]=_,t[64]=v,t[65]=u,t[66]=q):q=t[66];let ge=n.length===0?me:``,_e=S?`true`:void 0,J;t[67]!==oe||t[68]!==S||t[69]!==w?(J=[S?w:void 0,oe].filter(Boolean).join(` `)||void 0,t[67]=oe,t[68]=S,t[69]=w,t[70]=J):J=t[70];let ve=S?`true`:se,ye=L===-1?void 0:`${T}-${L}`,Y=S&&`text-destructive placeholder:text-destructive/60`,X;t[71]===Y?X=t[72]:(X=a(`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`,Y),t[71]=Y,t[72]=X);let Z;t[73]!==fe||t[74]!==p||t[75]!==_||t[76]!==f||t[77]!==G||t[78]!==K||t[79]!==q||t[80]!==ge||t[81]!==_e||t[82]!==J||t[83]!==ve||t[84]!==ye||t[85]!==X?(Z=(0,l.jsx)(`input`,{id:f,ref:fe,type:`text`,value:_,onChange:G,onKeyDown:K,onBlur:q,placeholder:ge,"data-tag-invalid":_e,"aria-describedby":J,"aria-invalid":ve,"aria-activedescendant":ye,disabled:p,className:X}),t[73]=fe,t[74]=p,t[75]=_,t[76]=f,t[77]=G,t[78]=K,t[79]=q,t[80]=ge,t[81]=_e,t[82]=J,t[83]=ve,t[84]=ye,t[85]=X,t[86]=Z):Z=t[86];let Q;t[87]!==S||t[88]!==w?(Q=S&&(0,l.jsx)(`span`,{id:w,role:`alert`,"data-testid":`tag-pill-input-error`,className:`w-full px-1 pt-0.5 text-xs text-destructive`,children:`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`}),t[87]=S,t[88]=w,t[89]=Q):Q=t[89];let $;return t[90]!==H||t[91]!==U||t[92]!==W||t[93]!==Z||t[94]!==Q?($=(0,l.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":H,className:U,children:[W,Z,Q]}),t[90]=H,t[91]=U,t[92]=W,t[93]=Z,t[94]=Q,t[95]=$):$=t[95],$}export{u as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./utils-CPqDy6Hr.js";import{i as o,n as ee,t as te}from"./tooltip-CtvLp_YK.js";import{br as ne}from"./dist-Bs8DNjRh2.js";import{t as re}from"./x-M_y7ybHr.js";import{t as ie}from"./badge-DwfQ2IQa.js";var s=i(),c=e(n(),1),l=t();function u(e){let t=(0,s.c)(96),{value:n,onChange:i,onBlur:u,placeholder:d,id:f,disabled:p,grammar:ae,entryProblems:m,"aria-describedby":oe,"aria-invalid":se,ref:h}=e,ce=ae===void 0?`frontmatter-tag`:ae,{_:g}=r(),[_,le]=(0,c.useState)(``),[v,ue]=(0,c.useState)(null),[y,b]=(0,c.useState)(null),de=(0,c.useRef)(null),x;t[0]===h?x=t[1]:(x=e=>{de.current=e,typeof h==`function`?h(e):h&&(h.current=e)},t[0]=h,t[1]=x);let fe=x,[S,C]=(0,c.useState)(!1),pe=(0,c.useId)(),w=`${f??pe}-grammar-hint`,T=`${f??pe}-pill`,E;t[2]!==g||t[3]!==d?(E=d??g({id:`M5mfAe`}),t[2]=g,t[3]=d,t[4]=E):E=t[4];let me=E,D=ce===`frontmatter-tag`,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{le(``),C(!1),ue(null)},t[5]=O):O=t[5];let k=O,A;t[6]!==v||t[7]!==i||t[8]!==D||t[9]!==n?(A=e=>{let t=e.trim(),r=v===null?-1:n.indexOf(v);if(!t)return r!==-1&&i(n.filter((e,t)=>t!==r)),v!==null&&k(),!0;if(D&&!ne(t))return C(!0),!1;let a=D&&t.startsWith(`#`)?t.slice(1):t,o=n.indexOf(a);if(r===-1)return o===-1&&i([...n,a]),k(),!0;let ee=n.map((e,t)=>t===r?a:e);return i(o===-1||o===r?ee:ee.filter((e,t)=>t!==r)),k(),!0},t[6]=v,t[7]=i,t[8]=D,t[9]=n,t[10]=A):A=t[10];let j=A,M;t[11]!==i||t[12]!==n?(M=e=>{i(n.filter((t,n)=>n!==e))},t[11]=i,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==j||t[15]!==p||t[16]!==_?(P=e=>{p||(_.trim()!==``&&j(_),le(e),C(!1),b(null),ue(e))},t[14]=j,t[15]=p,t[16]=_,t[17]=P):P=t[17];let F=P,I;t[18]!==y||t[19]!==n?(I=y===null?-1:n.indexOf(y),t[18]=y,t[19]=n,t[20]=I):I=t[20];let L=I,R;t[21]===n?R=t[22]:(R=e=>{b(e===null?null:n[e]??null)},t[21]=n,t[22]=R);let z=R,B,V;t[23]===v?(B=t[24],V=t[25]):(B=()=>{v!==null&&(de.current?.focus(),de.current?.select())},V=[v],t[23]=v,t[24]=B,t[25]=V),(0,c.useEffect)(B,V);let H=S?`true`:se,he=p&&`pointer-events-none opacity-60`,U;t[26]===he?U=t[27]:(U=a(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,he),t[26]=he,t[27]=U);let W;if(t[28]!==g||t[29]!==F||t[30]!==p||t[31]!==v||t[32]!==m||t[33]!==y||t[34]!==T||t[35]!==N||t[36]!==D||t[37]!==n){let e;t[39]!==g||t[40]!==F||t[41]!==p||t[42]!==v||t[43]!==m||t[44]!==y||t[45]!==T||t[46]!==N||t[47]!==D?(e=(e,t)=>{if(e===v)return null;let n=D&&!ne(e),r=m?.get(e),i=n||r!==void 0,s=r??(n?`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`:void 0),c=e===y,u=(0,l.jsxs)(ie,{id:`${T}-${t}`,variant:i?`destructive`:`secondary`,"data-tag-invalid":n?`true`:void 0,"data-tag-problem":r===void 0?void 0:`true`,"data-highlighted":c?`true`:void 0,className:a(`gap-1 pl-2 pr-1 normal-case`,i&&`ring-1 ring-destructive/40`,c&&`ring-2 ring-ring/70`),children:[(0,l.jsx)(`button`,{type:`button`,tabIndex:-1,className:`cursor-pointer rounded-sm font-mono`,onDoubleClick:()=>F(e),disabled:p,"aria-label":g({id:`NkNfSr`,values:{tag:e}}),title:s===void 0?g({id:`vHlhDc`}):void 0,children:e}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>N(t),"aria-label":g({id:`D4H2N6`,values:{tag:e}}),className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:p,children:(0,l.jsx)(re,{className:`size-3`,"aria-hidden":`true`})})]},e);return s===void 0?u:(0,l.jsxs)(te,{children:[(0,l.jsx)(o,{asChild:!0,children:u}),(0,l.jsx)(ee,{children:s})]},e)},t[39]=g,t[40]=F,t[41]=p,t[42]=v,t[43]=m,t[44]=y,t[45]=T,t[46]=N,t[47]=D,t[48]=e):e=t[48],W=n.map(e),t[28]=g,t[29]=F,t[30]=p,t[31]=v,t[32]=m,t[33]=y,t[34]=T,t[35]=N,t[36]=D,t[37]=n,t[38]=W}else W=t[38];let G;t[49]!==S||t[50]!==y?(G=e=>{le(e.target.value),S&&C(!1),y!==null&&b(null)},t[49]=S,t[50]=y,t[51]=G):G=t[51];let K;t[52]!==j||t[53]!==F||t[54]!==_||t[55]!==S||t[56]!==v||t[57]!==z||t[58]!==L||t[59]!==N||t[60]!==n?(K=e=>{let t=e.currentTarget,r=t.selectionStart===0&&t.selectionEnd===0;if(v===null&&n.length>0){if(e.key===`ArrowLeft`&&(L!==-1||r)){e.preventDefault(),z(L===-1?n.length-1:Math.max(0,L-1));return}if(e.key===`ArrowRight`&&L!==-1){e.preventDefault(),z(L===n.length-1?null:L+1);return}if((e.key===`Home`||e.key===`End`)&&L!==-1){e.preventDefault(),z(e.key===`Home`?0:n.length-1);return}}if(L!==-1&&v===null){if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=n[L];t!==void 0&&F(t);return}if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let t=n[L-1]??null,r=n[L+1]??null;N(L),b(e.key===`Backspace`?t??r:r??t);return}}e.key===`Enter`?(_.trim()||v!==null)&&(e.preventDefault(),j(_)):e.key===`,`?(e.preventDefault(),_.trim()&&j(_)):e.key===`Tab`?_.trim()&&(e.preventDefault(),j(_)):e.key===`Backspace`&&_===``&&n.length>0&&v===null?(e.preventDefault(),N(n.length-1)):e.key===`Escape`&&(v!==null||S?(e.preventDefault(),k(),b(null)):L!==-1&&(e.preventDefault(),b(null)))},t[52]=j,t[53]=F,t[54]=_,t[55]=S,t[56]=v,t[57]=z,t[58]=L,t[59]=N,t[60]=n,t[61]=K):K=t[61];let q;t[62]!==j||t[63]!==_||t[64]!==v||t[65]!==u?(q=()=>{(_.trim()||v!==null)&&!j(_)&&v!==null&&k(),b(null),u?.()},t[62]=j,t[63]=_,t[64]=v,t[65]=u,t[66]=q):q=t[66];let ge=n.length===0?me:``,_e=S?`true`:void 0,J;t[67]!==oe||t[68]!==S||t[69]!==w?(J=[S?w:void 0,oe].filter(Boolean).join(` `)||void 0,t[67]=oe,t[68]=S,t[69]=w,t[70]=J):J=t[70];let ve=S?`true`:se,ye=L===-1?void 0:`${T}-${L}`,Y=S&&`text-destructive placeholder:text-destructive/60`,X;t[71]===Y?X=t[72]:(X=a(`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`,Y),t[71]=Y,t[72]=X);let Z;t[73]!==fe||t[74]!==p||t[75]!==_||t[76]!==f||t[77]!==G||t[78]!==K||t[79]!==q||t[80]!==ge||t[81]!==_e||t[82]!==J||t[83]!==ve||t[84]!==ye||t[85]!==X?(Z=(0,l.jsx)(`input`,{id:f,ref:fe,type:`text`,value:_,onChange:G,onKeyDown:K,onBlur:q,placeholder:ge,"data-tag-invalid":_e,"aria-describedby":J,"aria-invalid":ve,"aria-activedescendant":ye,disabled:p,className:X}),t[73]=fe,t[74]=p,t[75]=_,t[76]=f,t[77]=G,t[78]=K,t[79]=q,t[80]=ge,t[81]=_e,t[82]=J,t[83]=ve,t[84]=ye,t[85]=X,t[86]=Z):Z=t[86];let Q;t[87]!==S||t[88]!==w?(Q=S&&(0,l.jsx)(`span`,{id:w,role:`alert`,"data-testid":`tag-pill-input-error`,className:`w-full px-1 pt-0.5 text-xs text-destructive`,children:`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`}),t[87]=S,t[88]=w,t[89]=Q):Q=t[89];let $;return t[90]!==H||t[91]!==U||t[92]!==W||t[93]!==Z||t[94]!==Q?($=(0,l.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":H,className:U,children:[W,Z,Q]}),t[90]=H,t[91]=U,t[92]=W,t[93]=Z,t[94]=Q,t[95]=$):$=t[95],$}export{u as t};
@@ -1 +1 @@
1
- import{m as e}from"./doc-paths-CR2slzEF.js";import{s as t}from"./navigation-targets-MirHYTh2.js";function n(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`skill-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function r(r,i){let a=t(r,i);return{resolvedTarget:a,hashDocName:a.target,hash:a.kind===`skill-file`?e({scope:a.scope,name:a.name,path:a.path,...a.host?{host:a.host}:{}}):null,displayState:n(a)}}export{r as t};
1
+ import{m as e}from"./doc-paths-BbWRFVgi.js";import{s as t}from"./navigation-targets-CnIm35UZ.js";function n(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`skill-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function r(r,i){let a=t(r,i);return{resolvedTarget:a,hashDocName:a.target,hash:a.kind===`skill-file`?e({scope:a.scope,name:a.name,path:a.path,...a.host?{host:a.host}:{}}):null,displayState:n(a)}}export{r as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./utils-CPqDy6Hr.js";import{h as r,r as i,t as a}from"./agent-visibility-CTpE4Fld.js";import{Mt as o}from"./dist-DZN2z2Ue2.js";import{t as s}from"./createLucideIcon-wbFLvDA-.js";import{c,d as l,m as u}from"./sortable.esm-BuA5-2It.js";var d=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),f=s(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),p=e(t(),1),m={},h=new Set;function g(){return m}function ee(e){m={...m,...e};for(let e of h)e()}function te(e){return h.add(e),()=>{h.delete(e)}}function _(){return(0,p.useSyncExternalStore)(te,g,g)}var v=null,y=new Set;function b(e,t){return e===null||t===null?e===t:e.id!==t.id||e.kind!==t.kind||e.label!==t.label?!1:e.kind===`thread`&&t.kind===`thread`?e.agentId===t.agentId&&e.iconUrl===t.iconUrl:e.kind===`terminal`&&t.kind===`terminal`?e.cli===t.cli:!1}function x(e){if(!b(v,e)){v=e;for(let e of y)e()}}function S(){return v}function C(e){return y.add(e),()=>{y.delete(e)}}function w(){return(0,p.useSyncExternalStore)(C,S,T)}function T(){return null}var E=`ok-ask-ai-agent-v2`,D=`ok-ask-ai-default-agent-v1`,O=`ok-preferred-agent-v1`,k=`terminal-cli`;function A(e){return`${k}:${e}`}var j=`in-app-thread`;function M(e){return`${j}:${e.source}:${e.id}`}function N(e){if(e===null)return null;if(e===`in-app-thread`)return{kind:`default`};let t=`${j}:`;if(!e.startsWith(t))return null;let n=e.slice(t.length),r=n.indexOf(`:`);if(r<=0)return null;let i=n.slice(0,r),a=n.slice(r+1);return i!==`registry`&&i!==`custom`||a===``?null:{kind:`concrete`,source:i,id:a}}function P(e){return e===null?null:e===`terminal-cli`?`claude`:o.find(t=>e===A(t))??null}function F(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function I(e){let t=F(e);if(!t)return null;try{let e=t.getItem(E);return e===null?t.getItem(D)??t.getItem(O):e}catch{return null}}function L(e,t){let n=F(t);if(n)try{n.setItem(E,e)}catch(e){console.warn(`[ask-ai] Failed to persist default agent:`,e)}for(let e of R)e()}var R=new Set;function z(){return I()}function B(){for(let e of R)e()}typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-ask-ai-agent-v2`||e.key===null)&&B()});function V(e){return R.add(e),()=>R.delete(e)}function ne(){return(0,p.useSyncExternalStore)(V,z,z)}function H(e,t){return o.filter(n=>i(e,n,t))}function U(e){return r.filter(t=>a(e,t.id)).map(e=>e.id)}function W(e){let{sticky:t,effectiveThreadAgent:n,enabledClis:r,enabledDesktopTargets:i,installedClis:a,terminalAvailable:o,threadsAvailable:s,desktopSelectable:c,preferBareTerminal:l,bareTerminalFallback:u}=e;if(l&&o)return{kind:`terminal`};if(s&&N(t)!==null&&n!==null)return{kind:`thread`,agent:n};if(o){let e=P(t);if(e!==null&&r.includes(e))return{kind:`cli`,cli:e}}return c&&t!==null&&i.includes(t)?{kind:`desktop`,target:t}:s&&n!==null?{kind:`thread`,agent:n}:o&&r.length>0?{kind:`cli`,cli:r.find(e=>a[e]===!0)??r[0]}:c&&i.length>0?{kind:`desktop`,target:i[0]}:u&&o?{kind:`terminal`}:{kind:`none`}}var G=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,K=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,q={start:[c.Space],cancel:[c.Esc],end:[c.Space,c.Enter]};function J(e){return n(G,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function Y(e){return e?void 0:-1}function X({className:e,isDragging:t}){return n(e,t&&K)}function Z(e){return e.code===c.Enter&&e.target===e.currentTarget}function re({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&Z(e)?`activate-tab`:`delegate-sortable`}function ie({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:u.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function ae(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function oe(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var se=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return l(e)};function ce(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}var Q=`open-knowledge:new-preferred-session`;function le(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Q))}function ue(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Q,n),()=>t.removeEventListener(Q,n)}var $=`open-knowledge:terminal-launch`;function de(e,t,n,r=typeof window>`u`?new EventTarget:window){r.dispatchEvent(new CustomEvent($,{detail:{prompt:e,cli:t,stage:n?.stage===!0}}))}function fe(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli,{stage:n.stage===!0})};return t.addEventListener($,n),()=>t.removeEventListener($,n)}export{d as A,M as C,ee as D,w as E,_ as O,A as S,x as T,W as _,ce as a,P as b,X as c,J as d,Y as f,H as g,U as h,ue as i,f as k,re as l,se as m,fe as n,q as o,ae as p,le as r,oe as s,de as t,ie as u,j as v,ne as w,L as x,I as y};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./utils-CPqDy6Hr.js";import{h as r,r as i,t as a}from"./agent-visibility-jMXG7qfn.js";import{Mt as o}from"./dist-Bs8DNjRh2.js";import{t as s}from"./createLucideIcon-wbFLvDA-.js";import{c,d as l,m as u}from"./sortable.esm-BuA5-2It.js";var d=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),f=s(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),p=e(t(),1),m={},h=new Set;function g(){return m}function ee(e){m={...m,...e};for(let e of h)e()}function te(e){return h.add(e),()=>{h.delete(e)}}function _(){return(0,p.useSyncExternalStore)(te,g,g)}var v=null,y=new Set;function b(e,t){return e===null||t===null?e===t:e.id!==t.id||e.kind!==t.kind||e.label!==t.label?!1:e.kind===`thread`&&t.kind===`thread`?e.agentId===t.agentId&&e.iconUrl===t.iconUrl:e.kind===`terminal`&&t.kind===`terminal`?e.cli===t.cli:!1}function x(e){if(!b(v,e)){v=e;for(let e of y)e()}}function S(){return v}function C(e){return y.add(e),()=>{y.delete(e)}}function w(){return(0,p.useSyncExternalStore)(C,S,T)}function T(){return null}var E=`ok-ask-ai-agent-v2`,D=`ok-ask-ai-default-agent-v1`,O=`ok-preferred-agent-v1`,k=`terminal-cli`;function A(e){return`${k}:${e}`}var j=`in-app-thread`;function M(e){return`${j}:${e.source}:${e.id}`}function N(e){if(e===null)return null;if(e===`in-app-thread`)return{kind:`default`};let t=`${j}:`;if(!e.startsWith(t))return null;let n=e.slice(t.length),r=n.indexOf(`:`);if(r<=0)return null;let i=n.slice(0,r),a=n.slice(r+1);return i!==`registry`&&i!==`custom`||a===``?null:{kind:`concrete`,source:i,id:a}}function P(e){return e===null?null:e===`terminal-cli`?`claude`:o.find(t=>e===A(t))??null}function F(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function I(e){let t=F(e);if(!t)return null;try{let e=t.getItem(E);return e===null?t.getItem(D)??t.getItem(O):e}catch{return null}}function L(e,t){let n=F(t);if(n)try{n.setItem(E,e)}catch(e){console.warn(`[ask-ai] Failed to persist default agent:`,e)}for(let e of R)e()}var R=new Set;function z(){return I()}function B(){for(let e of R)e()}typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-ask-ai-agent-v2`||e.key===null)&&B()});function V(e){return R.add(e),()=>R.delete(e)}function ne(){return(0,p.useSyncExternalStore)(V,z,z)}function H(e,t){return o.filter(n=>i(e,n,t))}function U(e){return r.filter(t=>a(e,t.id)).map(e=>e.id)}function W(e){let{sticky:t,effectiveThreadAgent:n,enabledClis:r,enabledDesktopTargets:i,installedClis:a,terminalAvailable:o,threadsAvailable:s,desktopSelectable:c,preferBareTerminal:l,bareTerminalFallback:u}=e;if(l&&o)return{kind:`terminal`};if(s&&N(t)!==null&&n!==null)return{kind:`thread`,agent:n};if(o){let e=P(t);if(e!==null&&r.includes(e))return{kind:`cli`,cli:e}}return c&&t!==null&&i.includes(t)?{kind:`desktop`,target:t}:s&&n!==null?{kind:`thread`,agent:n}:o&&r.length>0?{kind:`cli`,cli:r.find(e=>a[e]===!0)??r[0]}:c&&i.length>0?{kind:`desktop`,target:i[0]}:u&&o?{kind:`terminal`}:{kind:`none`}}var G=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,K=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,q={start:[c.Space],cancel:[c.Esc],end:[c.Space,c.Enter]};function J(e){return n(G,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function Y(e){return e?void 0:-1}function X({className:e,isDragging:t}){return n(e,t&&K)}function Z(e){return e.code===c.Enter&&e.target===e.currentTarget}function re({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&Z(e)?`activate-tab`:`delegate-sortable`}function ie({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:u.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function ae(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function oe(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var se=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return l(e)};function ce(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}var Q=`open-knowledge:new-preferred-session`;function le(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Q))}function ue(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Q,n),()=>t.removeEventListener(Q,n)}var $=`open-knowledge:terminal-launch`;function de(e,t,n,r=typeof window>`u`?new EventTarget:window){r.dispatchEvent(new CustomEvent($,{detail:{prompt:e,cli:t,stage:n?.stage===!0}}))}function fe(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli,{stage:n.stage===!0})};return t.addEventListener($,n),()=>t.removeEventListener($,n)}export{d as A,M as C,ee as D,w as E,_ as O,A as S,x as T,W as _,ce as a,P as b,X as c,J as d,Y as f,H as g,U as h,ue as i,f as k,re as l,se as m,fe as n,q as o,ae as p,le as r,oe as s,de as t,ie as u,j as v,ne as w,L as x,I as y};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./useQuery-ZeEDLtxh.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{_ as i}from"./agent-visibility-CTpE4Fld.js";import{t as a}from"./trace-api-C3cW9MnH.js";var o=r(),s=e(t(),1);function c(e){let t=[`claude-acp`,`codex-acp`,`cursor`,`opencode`],n=e=>{let n=t.indexOf(e);return n===-1?t.length:n};return e.filter(e=>e.supported&&e.harness?.availability===`present`).sort((e,t)=>n(e.id)-n(t.id))}async function l(e){let t=await fetch(`/api/acp/catalog`,{signal:e??AbortSignal.timeout(2e4)});if(!t.ok)throw Error(`agent catalog request failed: HTTP ${t.status}`);let n=await t.json();return{agents:Array.isArray(n.agents)?n.agents:[],stale:n.stale===!0,maxThreads:typeof n.maxThreads==`number`?n.maxThreads:8}}function u(){let e=(0,o.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:f,staleTime:3e5},e[0]=t):t=e[0];let{data:r}=n(t),a=r?.agents,c,l;e[1]===a?(c=e[2],l=e[3]):(c=()=>{a&&i(a.map(d))},l=[a],e[1]=a,e[2]=c,e[3]=l),(0,s.useEffect)(c,l)}function d(e){return{source:e.source,id:e.id,name:e.name,supported:e.supported,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function f(e){let{signal:t}=e;return l(t)}var p=`open-knowledge-app`;function m(e){try{a.getTracer(p).startSpan(e).end()}catch(e){console.warn(`[terminal-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function h(){m(`ok.desktop.terminalOpened`)}function g(){m(`ok.desktop.shellConsentGranted`)}export{u as a,l as i,h as n,c as r,g as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./useQuery-ZeEDLtxh.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{_ as i}from"./agent-visibility-jMXG7qfn.js";import{t as a}from"./trace-api-C3cW9MnH.js";var o=r(),s=e(t(),1);function c(e){let t=[`claude-acp`,`codex-acp`,`cursor`,`opencode`],n=e=>{let n=t.indexOf(e);return n===-1?t.length:n};return e.filter(e=>e.supported&&e.harness?.availability===`present`).sort((e,t)=>n(e.id)-n(t.id))}async function l(e){let t=await fetch(`/api/acp/catalog`,{signal:e??AbortSignal.timeout(2e4)});if(!t.ok)throw Error(`agent catalog request failed: HTTP ${t.status}`);let n=await t.json();return{agents:Array.isArray(n.agents)?n.agents:[],stale:n.stale===!0,maxThreads:typeof n.maxThreads==`number`?n.maxThreads:8}}function u(){let e=(0,o.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:f,staleTime:3e5},e[0]=t):t=e[0];let{data:r}=n(t),a=r?.agents,c,l;e[1]===a?(c=e[2],l=e[3]):(c=()=>{a&&i(a.map(d))},l=[a],e[1]=a,e[2]=c,e[3]=l),(0,s.useEffect)(c,l)}function d(e){return{source:e.source,id:e.id,name:e.name,supported:e.supported,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function f(e){let{signal:t}=e;return l(t)}var p=`open-knowledge-app`;function m(e){try{a.getTracer(p).startSpan(e).end()}catch(e){console.warn(`[terminal-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function h(){m(`ok.desktop.terminalOpened`)}function g(){m(`ok.desktop.shellConsentGranted`)}export{u as a,l as i,h as n,c as r,g as t};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{$ as n,Ht as r,It as i,Pt as a,Tn as o,dt as s,et as c,gn as l,ht as u,i as d,lt as f,w as p,yt as m}from"./DocumentContext-D2Zxk1ro.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{r as v,t as y}from"./useQuery-ZeEDLtxh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{t as x}from"./utils-CPqDy6Hr.js";import{t as S}from"./button-D3xSRfT4.js";import{i as C,n as w,t as T}from"./tooltip-CtvLp_YK.js";import{n as E,r as D,t as O}from"./collapsible-BTn3nxAn.js";import{A as k,E as A,j,ot as M}from"./CodeMirrorPropInput-7jlwH38H.js";import{n as N,t as P}from"./toggle-group-DpvWeoN9.js";import{Bt as F,En as I,Ma as L,P as R,Tn as z,Ua as B,Vr as V,Vt as H,_a as U,ct as W,ft as G}from"./dist-DZN2z2Ue2.js";import{t as ee}from"./chevron-right-COaV_K3r.js";import{r as te}from"./CopyButton-Dk8yDsPs.js";import{i as ne,r as re}from"./prop-types-BWDJYVli.js";import{t as ie}from"./refresh-cw-DaKSQ-xL.js";import{t as ae}from"./triangle-alert-Dk8dL1G6.js";import{t as oe}from"./wrench-86_Xzzag.js";import{n as se}from"./dist-BNVxnBBw.js";import{t as K}from"./dist-D6euTqbb.js";import{f as ce,u as le}from"./doc-paths-CR2slzEF.js";import{o as ue}from"./use-settings-route-b9ICe6ju.js";import{d as de}from"./documents-events-BhxlQGXQ.js";import{a as q,i as fe}from"./startup-marks-Bl-kvAXX.js";import{t as J}from"./badge-DwfQ2IQa.js";import{C as pe,y as me}from"./config-provider-BwmrVQtw.js";import{Dt as he,Ft as ge,It as _e,J as ve,Q as ye,X as be}from"./dist-pl6OT5yc.js";import{a as xe,c as Se,i as Ce,n as we,r as Te,s as Ee,t as De}from"./panel-Bjv8raTx.js";import{t as Oe}from"./lint-plugin-meta-BxfSlkph.js";import{t as ke}from"./skeleton-Zj40UZU5.js";import{a as Ae,c as je,d as Me}from"./lint-config-client-B-vQycwW.js";var Ne=56,Pe=2,Fe=150,Ie=2e3;function Le(e,t,n){return e.top+e.height/2-(n+t)/2}function Re(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function ze(e){let{docName:t,container:n,measureTarget:r,placement:i,intent:a,grade:o,landedMode:c,transition:l,onOutcome:d,onDiscardQueuedTarget:f,toolbarOffset:p=Ne,driftThresholdPx:h=Pe,quietMs:g=Fe,abandonAfterMs:_=Ie}=e,v=e.contentColumn??n.firstElementChild,y=s(t),b=u(t,{yieldsToNavigation:a===`toggle`,supersede:()=>P(`superseded`)}),x=n.style.overflowAnchor;n.style.overflowAnchor=`none`,l&&q(`ok/mode-switch/transition`,{from:l.from,to:l.to,grade:o});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=r();return e===null?null:Re(i===`center`?Le(e,n.clientHeight,p):e.top-p,n)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(n.scrollTop-e)>h;return t&&(n.scrollTop=e),{measurable:!0,moved:t}},A=()=>n.scrollTop-(O()??C??n.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),n.removeEventListener(`wheel`,I),n.removeEventListener(`touchstart`,I),n.removeEventListener(`contentvisibilityautostatechange`,L,!0),n.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&m({docName:t,container:n,targetScrollTop:n.scrollTop,mode:c})}finally{j()}q(`ok/landing/land`,{grade:o,delta:e}),d?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??n.scrollTop,t;try{t=A()}finally{j()}q(`ok/landing/abandoned`,{grade:o,target:e,delta:t}),d?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&f?.(),d?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),n.addEventListener(`contentvisibilityautostatechange`,L,!0),n.addEventListener(`wheel`,I,{passive:!0}),n.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function Be(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function Ve(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(Ve).join(``):``}function He(e,t){let{frontmatter:n,body:r}=B(e),i=n===``?0:n.split(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{$ as n,Ht as r,It as i,Pt as a,Tn as o,dt as s,et as c,gn as l,ht as u,i as d,lt as f,w as p,yt as m}from"./DocumentContext-CKMhLy2N.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{r as v,t as y}from"./useQuery-ZeEDLtxh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{t as x}from"./utils-CPqDy6Hr.js";import{t as S}from"./button-D3xSRfT4.js";import{i as C,n as w,t as T}from"./tooltip-CtvLp_YK.js";import{n as E,r as D,t as O}from"./collapsible-BTn3nxAn.js";import{A as k,E as A,j,ot as M}from"./CodeMirrorPropInput-BFenJemA.js";import{n as N,t as P}from"./toggle-group-DpvWeoN9.js";import{Bt as F,En as I,Ma as L,P as R,Tn as z,Ua as B,Vr as V,Vt as H,_a as U,ct as W,ft as G}from"./dist-Bs8DNjRh2.js";import{t as ee}from"./chevron-right-COaV_K3r.js";import{r as te}from"./CopyButton-Dk8yDsPs.js";import{i as ne,r as re}from"./prop-types-CiBsNxle.js";import{t as ie}from"./refresh-cw-DaKSQ-xL.js";import{t as ae}from"./triangle-alert-Dk8dL1G6.js";import{t as oe}from"./wrench-86_Xzzag.js";import{n as se}from"./dist-BNVxnBBw.js";import{t as K}from"./dist-D6euTqbb.js";import{f as ce,u as le}from"./doc-paths-BbWRFVgi.js";import{o as ue}from"./use-settings-route-CS1B3HfO.js";import{d as de}from"./documents-events-BajItHup.js";import{a as q,i as fe}from"./startup-marks-Bl-kvAXX.js";import{t as J}from"./badge-DwfQ2IQa.js";import{C as pe,y as me}from"./config-provider-D2FBTvIx.js";import{Dt as he,Ft as ge,It as _e,J as ve,Q as ye,X as be}from"./dist-pl6OT5yc.js";import{a as xe,c as Se,i as Ce,n as we,r as Te,s as Ee,t as De}from"./panel-Bjv8raTx.js";import{t as Oe}from"./lint-plugin-meta-BxfSlkph.js";import{t as ke}from"./skeleton-Zj40UZU5.js";import{a as Ae,c as je,d as Me}from"./lint-config-client-DxXOFrgQ.js";var Ne=56,Pe=2,Fe=150,Ie=2e3;function Le(e,t,n){return e.top+e.height/2-(n+t)/2}function Re(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function ze(e){let{docName:t,container:n,measureTarget:r,placement:i,intent:a,grade:o,landedMode:c,transition:l,onOutcome:d,onDiscardQueuedTarget:f,toolbarOffset:p=Ne,driftThresholdPx:h=Pe,quietMs:g=Fe,abandonAfterMs:_=Ie}=e,v=e.contentColumn??n.firstElementChild,y=s(t),b=u(t,{yieldsToNavigation:a===`toggle`,supersede:()=>P(`superseded`)}),x=n.style.overflowAnchor;n.style.overflowAnchor=`none`,l&&q(`ok/mode-switch/transition`,{from:l.from,to:l.to,grade:o});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=r();return e===null?null:Re(i===`center`?Le(e,n.clientHeight,p):e.top-p,n)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(n.scrollTop-e)>h;return t&&(n.scrollTop=e),{measurable:!0,moved:t}},A=()=>n.scrollTop-(O()??C??n.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),n.removeEventListener(`wheel`,I),n.removeEventListener(`touchstart`,I),n.removeEventListener(`contentvisibilityautostatechange`,L,!0),n.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&m({docName:t,container:n,targetScrollTop:n.scrollTop,mode:c})}finally{j()}q(`ok/landing/land`,{grade:o,delta:e}),d?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??n.scrollTop,t;try{t=A()}finally{j()}q(`ok/landing/abandoned`,{grade:o,target:e,delta:t}),d?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&f?.(),d?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),n.addEventListener(`contentvisibilityautostatechange`,L,!0),n.addEventListener(`wheel`,I,{passive:!0}),n.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function Be(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function Ve(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(Ve).join(``):``}function He(e,t){let{frontmatter:n,body:r}=B(e),i=n===``?0:n.split(`
2
2
  `).length-1;try{return{blocks:t.parseToEditorMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i,kind:Be(e.type),text:Ve(e)})),fmLineCount:i}}catch{return performance.mark(`ok/block-spans/parse-failed`),{blocks:[],fmLineCount:i}}}function Ue(e,t){let{blocks:n,fmLineCount:r}=He(e,t);return{spans:n.map(e=>({start:e.start,end:e.end})),fmLineCount:r}}function We(e,t){if(e.length===0)return null;let n=0,r=e.length-1,i=e.length-1;for(;n<=r;){let a=n+r>>1,o=e[a];o!==void 0&&o.end>=t?(i=a,r=a-1):n=a+1}return i}function Ge(e){let t=e.childCount>0?e.child(e.childCount-1):null;return t!==null&&t.type.name===`paragraph`&&t.content.size===0?e.childCount-1:e.childCount}function Ke(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function qe(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
3
3
  `&&t.push(n+1);return t}function Je(e,t,n){return t<=1?0:t-1>=e.length?n:e[t-1]??n}function Ye(e,t){let n=0,r=e.length-1,i=1;for(;n<=r;){let a=n+r>>1;(e[a]??0)<=t?(i=a+1,n=a+1):r=a-1}return i}function Xe(e,t,n){return Math.max(t,Math.min(e,n))}function Ze(e,t){let n=e=>e.replace(/\s+/g,` `).trim();return n(e)===n(t)}function Qe(e,t){return t.inRange?t.tripwireOk?Ze(e.content,t.text)?`exact`:e.kind===t.kind?`same-type-ordinal`:`ordinal`:`ordinal`:`clamped`}function $e(e){let t=null,n=null;function r(r){return n!==null&&t===r?n:(n={blocks:He(r,e).blocks,lineStarts:qe(r)},t=r,n)}return{captureFromWysiwyg(e,t,n){if(e.childCount===0)return null;let r=Xe(t,0,e.content.size),i=0,a=e.childCount-1,o=0;for(let t=0;t<e.childCount;t++){let n=e.child(t).nodeSize;if(r<i+n){a=t,o=i+1;break}i+=n,o=i+1}let s=e.child(a),c={blockIndex:a,kind:Be(s.type.name),content:s.textContent};return n?.refine&&(c.selectionInBlock=Math.max(0,r-o)),c},captureFromSource(e,t,n){let{blocks:i,lineStarts:a}=r(e);if(i.length===0)return null;let o=Xe(t,0,e.length),s=We(i,Ye(a,o));if(s===null)return null;let c=i[s];if(!c)return null;let l={blockIndex:s,kind:c.kind,content:c.text};if(n?.refine){let t=Je(a,c.start,e.length);l.selectionInBlock=Math.max(0,o-t)}return l},resolveInSource(e,{source:t,doc:n}){let{blocks:i,lineStarts:a}=r(t);if(i.length===0)return null;let o=e.blockIndex>=0&&e.blockIndex<i.length,s=Ge(n)===i.length,c=i[Xe(e.blockIndex,0,i.length-1)],l=Je(a,c.start,t.length),u=Math.min(Je(a,c.end+1,t.length),t.length),d=Qe(e,{inRange:o,tripwireOk:s,kind:c.kind,text:c.text}),f=l;return d===`exact`&&e.selectionInBlock!==void 0&&(f=Xe(l+e.selectionInBlock,l,u)),{blockStart:l,blockEnd:u,point:f,confidence:d}},resolveInWysiwyg(e,{source:t,doc:n}){let i=Ge(n);if(i===0)return null;let{blocks:a}=r(t),o=e.blockIndex>=0&&e.blockIndex<i,s=i===a.length,c=Xe(e.blockIndex,0,i-1),l=Ke(n,c,c+1);if(l===null)return null;let u=n.child(c),d=Qe(e,{inRange:o,tripwireOk:s,kind:Be(u.type.name),text:u.textContent});return{blockStart:l.from,blockEnd:l.to,point:l.from,confidence:d}}}}var et=ge.define(),tt=ge.define(),nt=ve.mark({class:n}),rt=_e.define({create(){return ve.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(et)?n=ve.set([nt.range(e.value.from,e.value.to)]):e.is(tt)&&(n=ve.none);return n},provide:e=>be.decorations.from(e)}),it=new WeakMap,at=ye.define(e=>({destroy(){let t=it.get(e);t!==void 0&&(clearTimeout(t),it.delete(e))}}));function ot(e,t,n,r){let i=c(e.state.doc.length,t,n,r);if(!i)return;e.dispatch({effects:et.of(i)});let a=it.get(e);a!==void 0&&clearTimeout(a);let o=setTimeout(()=>{it.delete(e),e.dispatch({effects:tt.of(null)})},R);it.set(e,o)}function st(){return[rt,at]}var ct=3e4;function lt(){let e=new Map,t=e=>e?Date.now()-e.rememberedAt>ct?null:e.navigation:null;return{remember(t,n){e.set(t,{navigation:n,rememberedAt:Date.now()})},peek(n){return t(e.get(n))},consume(n){let r=e.get(n);return e.delete(n),t(r)},clear(t){e.delete(t)},clearForTest(){e.clear()}}}var ut=lt(),dt=lt(),ft=ut.remember,pt=ut.peek,mt=ut.consume,ht=ut.clear;ut.clearForTest;var gt=dt.remember,_t=dt.peek,vt=dt.consume,yt=dt.clear;dt.clearForTest;function bt(e,t,n){return{start:pe(e,t),end:pe(e,n)}}function xt(e,t){let n=me(e.start,t),r=me(e.end,t);return n===null||r===null||r.index<=n.index?null:n.index}var St=`open-knowledge:view-in-source`,Y=56,Ct=null;function wt(){return Ct??=$e(k()),Ct}function Tt(e,t,n,r,i=`toggle`){let a=r.captureFromWysiwyg(e,t,{refine:i===`jump`});if(!a)return null;let o=r.resolveInSource(a,{source:n.toString(),doc:e});return{kind:`selection-offset`,intent:i,anchor:a,pin:o?bt(n,o.blockStart,o.blockEnd):void 0}}function Et(e){let{editor:t,docName:n,ytext:r}=e,i=A(t);if(!i)return;let a=i.state.selection.from,o=Tt(i.state.doc,a,r,wt(),`jump`);o&&ft(n,o),window.dispatchEvent(new CustomEvent(St,{detail:{docName:n}}))}function Dt(e,t,n,r,i){let a=r.captureFromSource(e,t);if(!a)return null;let o=i?r.resolveInSource(a,{source:e,doc:i}):null;return{kind:`selection-offset`,anchor:a,pin:o?bt(n,o.blockStart,o.blockEnd):void 0}}function Ot(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=xt(e.pin,i);if(t===null){let t=a.resolveInWysiwyg(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInWysiwyg(o,{source:n,doc:r})}return a.resolveInWysiwyg(e.anchor,{source:n,doc:r})}function kt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=xt(e.pin,i);if(t===null){let t=a.resolveInSource(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInSource(o,{source:n,doc:r})}return a.resolveInSource(e.anchor,{source:n,doc:r})}function At(e,t){try{return e.coordsAtPos(t)}catch{return null}}function jt(e,t,n){let r=Math.max(0,Math.min(n,e.state.doc.length)),i=t.getBoundingClientRect().top,a=At(e,r);if(a)return{top:a.top-i+t.scrollTop,height:a.bottom-a.top};try{let n=e.lineBlockAt(r);return{top:e.documentTop-i+t.scrollTop+n.top,height:n.height}}catch{return null}}function Mt(e,t){if(e.isDestroyed)return null;try{let n=e.nodeDOM(t);if(n instanceof HTMLElement)return n;let{node:r}=e.domAtPos(t);return r instanceof HTMLElement?r:r.parentElement}catch{return null}}function Nt(e,t,n){if(e.isDestroyed)return null;let r=Mt(e,Math.max(0,Math.min(n,e.state.doc.content.size)));if(!r)return null;let i=r.getBoundingClientRect(),a=t.getBoundingClientRect().top;return{top:i.top-a+t.scrollTop,height:i.height}}function Pt(){return typeof document>`u`?null:f()}function Ft(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2;for(let t of[Y+1,Y+12,Y+40]){let i=e.posAtCoords({left:r,top:n.top+t});if(i)return i.pos}return null}function It(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2;for(let t of[Y+1,Y+12,Y+40]){let i=e.posAtCoords({x:r,y:n.top+t});if(i!==null)return i}return null}function Lt(e){let{from:t,to:n,docName:r,ytext:i}=e;t===`wysiwyg`&&n===`source`?Rt(r,i):t===`source`&&n===`wysiwyg`&&zt(r,i)}function Rt(e,t){let n=pt(e);if(n&&n.kind!==`selection-offset`)return;let i=r(e);if(!i)return;let a=A(i);if(!a)return;let o=Pt();if(!o)return;let s=Ft(a,o);if(s===null)return;let c=Tt(a.state.doc,s,t,wt());c&&ft(e,c)}function zt(e,t){let n=a(e);if(!n)return;let i=Pt();if(!i)return;let o=It(n,i);if(o===null)return;let s=r(e),c=s?A(s)?.state.doc:void 0,l=Dt(t.toString(),o,t,wt(),c);l&&gt(e,l)}function Bt(e){let{view:t,docName:n,navigation:i,ydoc:a,transition:o}=e,s=r(n),c=s?A(s)?.state.doc:void 0;if(!c)return null;let l=kt(i,{source:t.state.doc.toString(),pmDoc:c,ydoc:a,resolver:wt()});if(!l)return null;let d=Pt();if(!d)return null;let f=l,p=i.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:be.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=u(n,{yieldsToNavigation:!p,supersede:()=>{h=!0,_.release()}}),v=e=>{if(!h){if(At(t,m)===null&&e<8){requestAnimationFrame(()=>v(e+1));return}try{p&&(t.dispatch({selection:he.cursor(m)}),t.focus())}finally{_.release()}g=ze({docName:n,container:d,contentColumn:t.contentDOM,measureTarget:()=>jt(t,d,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:o,toolbarOffset:Y,onOutcome:p?e=>{e.status===`landed`&&ot(t,f.blockStart,f.blockEnd,f.confidence)}:void 0,onDiscardQueuedTarget:()=>ht(n)})}};return v(0),{cancel:e=>{h=!0,_.release(),g?.cancel(e)}}}function Vt(e){let{editor:t,docName:n,navigation:r,ydoc:i,transition:a}=e,o=A(t);if(!o)return null;let s=Ot(r,{source:i.getText(`source`).toString(),pmDoc:o.state.doc,ydoc:i,resolver:wt()});if(!s)return null;let c=Pt();if(!c)return null;let l=s;return ze({docName:n,container:c,contentColumn:o.dom,measureTarget:()=>Nt(o,c,l.point),placement:`top`,intent:`toggle`,grade:l.confidence,landedMode:`wysiwyg`,transition:a,toolbarOffset:Y,onDiscardQueuedTarget:()=>yt(n)})}var X=e(h(),1),Z=b(),Q=t();function Ht(e){let t=(0,Z.c)(14),{scope:n,onScopeChange:r,projectLabel:i}=e,{_:a}=_(),o;t[0]===r?o=t[1]:(o=e=>{e&&r(e)},t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=a({id:`aBgwis`}),t[2]=a,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(N,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,Q.jsx)(g,{id:`UpCz01`})}),t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i??(0,Q.jsx)(g,{id:`e0NrBM`}),t[5]=i,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,Q.jsx)(N,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n||t[10]!==o||t[11]!==s||t[12]!==u?(d=(0,Q.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,Q.jsxs)(P,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:o,"aria-label":s,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[c,u]})}),t[9]=n,t[10]=o,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}var Ut=null,Wt=[];function Gt(e){if(e===Ut)return Wt;let t=Kt(e);return Ut=e,Wt=t,t}function Kt(e){let t=[],n=new Map,r=I();for(let i=qt(e);i<=e.lines;i++){let a=e.line(i);if(r(a.text))continue;let o=V(a.text,n);o&&t.push({slug:o.slug,from:a.from})}return t}function qt(e){if(!Jt(e.line(1).text))return 1;for(let t=2;t<=e.lines;t++)if(Jt(e.line(t).text))return t+1;return 1}function Jt(e){return U.test(e.endsWith(`\r`)?e.slice(0,-1):e)}function Yt(e){let t=document.getElementById(e);return t?t.getBoundingClientRect().top:null}function Xt(e){let t=new Map;for(let n of Gt(e.state.doc))t.set(n.slug,n.from);let n=e.documentTop;return r=>{let i=t.get(r);return i===void 0?null:n+e.lineBlockAt(i).top}}function Zt(e,t){let n=(0,Z.c)(9),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let{isSourceMode:o,docName:s}=r,c=o===void 0?!1:o,[l,u]=(0,X.useState)(void 0),d=(0,X.useRef)(null),f;n[2]===s?f=n[3]:(f=()=>s?a(s):null,n[2]=s,n[3]=f);let p=(0,X.useSyncExternalStore)(i,f,Qt),m,h;return n[4]!==c||n[5]!==e||n[6]!==p?(m=()=>{if(e.length===0||c&&!p){u(void 0);return}let t=function(){let t=c&&p?Xt(p):Yt,n=window.innerHeight/2,r,i;for(let a of e){let e=t(a);e!==null&&(e<0?r=a:i===void 0&&e<n&&(i=a))}u(i??r??e[0])},n=function(){d.current===null&&(d.current=requestAnimationFrame(()=>{d.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)}},h=[e,c,p],n[4]=c,n[5]=e,n[6]=p,n[7]=m,n[8]=h):(m=n[7],h=n[8]),(0,X.useEffect)(m,h),l}function Qt(){return null}var $t=300;async function en(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new j(K._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=G.safeParse(n);throw e.success?Error(e.data.title):new j(K._({id:`zlErBl`}),{status:t.status})}let r=W.safeParse(n);if(!r.success)throw new j(K._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var tn=32,nn=12,rn=6,an=`open-knowledge:outline-nav`;function on(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(fe,{name:`outline-panel`,children:(0,Q.jsx)(sn,{...e})}),t[0]=e,t[1]=n),n}function sn(e){let t=(0,Z.c)(53),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=_(),{pages:s,loading:c}=ne(),l=v(),{activeProvider:u,activeDocName:f}=d(),p,m;t[0]===n?(p=t[1],m=t[2]):(p=[`page-headings`,n],m=()=>en(n),t[0]=n,t[1]=p,t[2]=m);let h;t[3]!==n||t[4]!==c||t[5]!==s?(h=!c&&(s.has(n)||L(n)),t[3]=n,t[4]=c,t[5]=s,t[6]=h):h=t[6];let b;t[7]!==p||t[8]!==m||t[9]!==h?(b={queryKey:p,queryFn:m,enabled:h,staleTime:1/0},t[7]=p,t[8]=m,t[9]=h,t[10]=b):b=t[10];let{data:S,isLoading:C,error:w}=y(b),T;t[11]===S?T=t[12]:(T=S===void 0?[]:S,t[11]=S,t[12]=T);let E=T,D,O;t[13]!==f||t[14]!==u||t[15]!==n||t[16]!==l?(D=()=>{if(!u||f!==n)return;let e=u.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,l.invalidateQueries({queryKey:[`page-headings`,n]})},$t)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},O=[u,f,n,l],t[13]=f,t[14]=u,t[15]=n,t[16]=l,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,X.useEffect)(D,O);let k;t[19]===E?k=t[20]:(k=E.map(cn),t[19]=E,t[20]=k);let A=k,j;t[21]!==n||t[22]!==r?(j={isSourceMode:r,docName:n},t[21]=n,t[22]=r,t[23]=j):j=t[23];let M=Zt(A,j),N;t[24]!==M||t[25]!==E?(N=M?E.findIndex(e=>e.slug===M):-1,t[24]=M,t[25]=E,t[26]=N):N=t[26];let P=N,F;t[27]!==n||t[28]!==r?(F=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&ft(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(an,{detail:i}))},t[27]=n,t[28]=r,t[29]=F):F=t[29];let I=F,R=((P>=0?E[P].level:1)-1)*nn+(nn-rn)/2,z=P*tn+(tn-rn)/2,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Se,{children:(0,Q.jsx)(g,{id:`dD7NPy`})}),t[30]=B):B=t[30];let V;t[31]!==E.length||t[32]!==C?(V=!C&&(0,Q.jsx)(Te,{children:E.length}),t[31]=E.length,t[32]=C,t[33]=V):V=t[33];let H;t[34]===V?H=t[35]:(H=(0,Q.jsxs)(Ee,{children:[B,V]}),t[34]=V,t[35]=H);let U;t[36]!==o||t[37]!==P||t[38]!==M||t[39]!==w||t[40]!==I||t[41]!==E||t[42]!==C||t[43]!==R||t[44]!==z?(U=w?(0,Q.jsx)(xe,{className:`px-2`,children:w instanceof Error?w.message:o({id:`GuqOb1`})}):E.length===0&&!C?(0,Q.jsx)(Ce,{className:`px-2`,children:(0,Q.jsx)(g,{id:`0BB9ID`})}):(0,Q.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[P>=0&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:rn,height:rn,transform:`translate(${R}px, ${z}px)`}}),E.map((e,t)=>{let n=e.slug===M;return(0,Q.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>I(t,e.slug),className:x(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*nn+20}px`},title:e.text,children:e.text},t)})]}),t[36]=o,t[37]=P,t[38]=M,t[39]=w,t[40]=I,t[41]=E,t[42]=C,t[43]=R,t[44]=z,t[45]=U):U=t[45];let W;t[46]!==C||t[47]!==U?(W=(0,Q.jsx)(we,{className:`px-3 py-2`,"aria-busy":C,children:U}),t[46]=C,t[47]=U,t[48]=W):W=t[48];let G;return t[49]!==a||t[50]!==H||t[51]!==W?(G=(0,Q.jsxs)(De,{className:a,children:[H,W]}),t[49]=a,t[50]=H,t[51]=W,t[52]=G):G=t[52],G}function cn(e){return e.slug}var ln=`audit-superseded`;async function un(e={kind:`project`}){return fn(e,H,!1)}async function dn(e={kind:`project`},t){return fn(e,F,!0,t)}async function fn(e,t,n,r){try{let i=new URLSearchParams;e.kind===`path`?i.set(`path`,e.path):e.kind===`doc`&&i.set(`doc`,e.docName),n&&i.set(`counts`,`1`);let a=i.size===0?``:`?${i}`,o=await fetch(`/api/audit${a}`,r===void 0?void 0:{signal:r});if(!o.ok)return o.status===409?ln:(console.warn(`[audit] request failed`,o.status,o.statusText),null);let s;try{s=await o.json()}catch{return r?.aborted===!0||console.warn(`[audit] response body is not valid JSON`),null}let c=t.safeParse(s);return c.success?c.data:(console.warn(`[audit] response failed schema validation`,c.error.issues),null)}catch(e){return r?.aborted===!0||console.warn(`[audit] fetch threw`,e),null}}function pn(e){let t=(0,Z.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,i]=(0,X.useState)(n),a,o;return t[1]===e?(a=t[2],o=t[3]):(a=()=>{if(i(gn),e===null)return;let t=!1,n=()=>{un({kind:`doc`,docName:e}).then(e=>{if(t||e===null||e===`audit-superseded`)return;let n=e.files.flatMap(hn).filter(mn);i(e=>e.length===0&&n.length===0?e:n)})};n();let r=de(e=>{e.includes(`backlinks`)&&n()});return()=>{t=!0,r()}},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,X.useEffect)(a,o),r}function mn(e){return e.source===`links`}function hn(e){return e.diagnostics}function gn(e){return e.length===0?e:[]}var _n={errorCount:0,warningCount:0},$=new Map,vn=new Set,yn=new Map;function bn(){let e=new Map;for(let[t,n]of $){let r=n.lint.errorCount+n.links.errorCount,i=n.lint.warningCount+n.links.warningCount;r===0&&i===0||e.set(t,{errorCount:r,warningCount:i})}yn=e;for(let e of vn)e()}var xn=z;function Sn(e){return vn.add(e),()=>{vn.delete(e)}}function Cn(){return yn}function wn(e){$.clear();for(let t of e)$.set(le(t.file),xn(t.diagnostics));bn()}function Tn(e){$.clear();for(let t of e)$.set(le(t.file),{lint:t.lint,links:t.links});bn()}function En(e,t){$.set(e,xn(t)),bn()}function Dn(e,t,n){let r=$.get(e)??{lint:_n,links:_n},i=r[t];i.errorCount===n.errorCount&&i.warningCount===n.warningCount||($.set(e,{...r,[t]:n}),bn())}var On=`open-knowledge:lint-nav`;function kn(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function An(e){return{line:e.range.start.line+1,column:e.range.start.character+1}}function jn(e){let t=(0,Z.c)(35),{diagnostic:n,instanceCount:r}=e,{_:i}=_(),a=n.severity===`error`?te:ae,s=n.range.start.line+1,c=n.source===`links`,l=r!==void 0&&r>1,u=n.severity===`error`?`text-destructive`:`text-amber-500`,d;t[0]===u?d=t[1]:(d=x(`mt-0.5 size-3.5 shrink-0`,u),t[0]=u,t[1]=d);let f;t[2]!==a||t[3]!==d?(f=(0,Q.jsx)(a,{"aria-hidden":`true`,className:d}),t[2]=a,t[3]=d,t[4]=f):f=t[4];let p;t[5]===n.message?p=t[6]:(p=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-foreground`,children:n.message}),t[5]=n.message,t[6]=p);let m;t[7]!==l||t[8]!==r?(m=l?(0,Q.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(J,{variant:`gray`,"data-testid":`problems-instance-count`,className:`h-4 px-1 font-sans text-[10px] leading-none`,children:(0,Q.jsx)(g,{id:`iZCZmF`,values:{instanceCount:r}})}),(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]}):null,t[7]=l,t[8]=r,t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[f,p,m]}),t[10]=f,t[11]=p,t[12]=m,t[13]=h):h=t[13];let v=c&&`gap-0.5`,y;t[14]===v?y=t[15]:(y=x(`h-4 shrink-0 px-1 font-sans text-[10px] uppercase leading-none`,v),t[14]=v,t[15]=y);let b;t[16]===c?b=t[17]:(b=c?(0,Q.jsx)(o,{"aria-hidden":`true`,className:`size-2.5`}):null,t[16]=c,t[17]=b);let S;t[18]!==n.source||t[19]!==y||t[20]!==b?(S=(0,Q.jsxs)(J,{variant:`gray`,"data-testid":`problems-source-tag`,className:y,children:[b,n.source]}),t[18]=n.source,t[19]=y,t[20]=b,t[21]=S):S=t[21];let C;t[22]!==i||t[23]!==n.code||t[24]!==s||t[25]!==l?(C=l?n.code:`${n.code} · ${i({id:`enPTnx`,values:{displayLine:s}})}`,t[22]=i,t[23]=n.code,t[24]=s,t[25]=l,t[26]=C):C=t[26];let w;t[27]===C?w=t[28]:(w=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:C}),t[27]=C,t[28]=w);let T;t[29]!==S||t[30]!==w?(T=(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 ps-5 font-mono text-xs text-muted-foreground`,children:[S,w]}),t[29]=S,t[30]=w,t[31]=T):T=t[31];let E;return t[32]!==T||t[33]!==h?(E=(0,Q.jsxs)(Q.Fragment,{children:[h,T]}),t[32]=T,t[33]=h,t[34]=E):E=t[34],E}function Mn(e){let t=new Map;for(let n of e){let e=`${n.source}/${n.code}\u0000${n.linkTarget??``}\u0000${n.message}`,r=t.get(e);r===void 0?t.set(e,{key:e,instances:[n]}):r.instances.push(n)}return[...t.values()]}function Nn(e){let t=(0,Z.c)(43),{group:n,onNavigate:r,navTitle:i,renderActions:a}=e,{_:o}=_(),s=n.instances[0];if(n.instances.length===1){let e;t[0]!==s||t[1]!==a?(e=a(s),t[0]=s,t[1]=a,t[2]=e):e=t[2];let n=e,o;t[3]!==s||t[4]!==r?(o=()=>r(s),t[3]=s,t[4]=r,t[5]=o):o=t[5];let c;t[6]!==s||t[7]!==i?(c=i(s),t[6]=s,t[7]=i,t[8]=c):c=t[8];let l;t[9]===s?l=t[10]:(l=(0,Q.jsx)(jn,{diagnostic:s}),t[9]=s,t[10]=l);let u;t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,Q.jsx)(`button`,{type:`button`,onClick:o,className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:c,children:l}),t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;t[15]===n?d=t[16]:(d=n===null?null:(0,Q.jsx)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:n}),t[15]=n,t[16]=d);let f;return t[17]!==u||t[18]!==d?(f=(0,Q.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[u,d]}),t[17]=u,t[18]=d,t[19]=f):f=t[19],f}let c;t[20]!==s||t[21]!==n.instances.length?(c=(0,Q.jsx)(D,{className:`group flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:(0,Q.jsx)(jn,{diagnostic:s,instanceCount:n.instances.length})}),t[20]=s,t[21]=n.instances.length,t[22]=c):c=t[22];let l;t[23]!==o||t[24]!==s.message?(l=o({id:`EUiJEM`,values:{0:s.message}}),t[23]=o,t[24]=s.message,t[25]=l):l=t[25];let u;if(t[26]!==o||t[27]!==n.instances||t[28]!==i||t[29]!==r||t[30]!==a){let e;t[32]!==o||t[33]!==i||t[34]!==r||t[35]!==a?(e=e=>{let t=a(e),n=e.range.start.line+1;return(0,Q.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full cursor-pointer rounded px-2 py-1 text-left font-mono text-xs text-muted-foreground`,title:i(e),"aria-label":o({id:`uCe4AX`,values:{0:e.message,displayLine:n}}),children:o({id:`enPTnx`,values:{displayLine:n}})}),t===null?null:(0,Q.jsx)(`div`,{className:`absolute bottom-0.5 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:t})]},Pn(e))},t[32]=o,t[33]=i,t[34]=r,t[35]=a,t[36]=e):e=t[36],u=n.instances.map(e),t[26]=o,t[27]=n.instances,t[28]=i,t[29]=r,t[30]=a,t[31]=u}else u=t[31];let d;t[37]!==l||t[38]!==u?(d=(0,Q.jsx)(E,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,children:(0,Q.jsx)(`ul`,{"aria-label":l,className:`flex flex-col gap-0.5 pb-1 ps-5`,"data-testid":`problems-duplicate-instances`,children:u})}),t[37]=l,t[38]=u,t[39]=d):d=t[39];let f;return t[40]!==c||t[41]!==d?(f=(0,Q.jsx)(`li`,{className:`rounded`,"data-testid":`problems-duplicate-group`,children:(0,Q.jsxs)(O,{children:[c,d]})}),t[40]=c,t[41]=d,t[42]=f):f=t[42],f}function Pn(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function Fn(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function In(e){let t=(0,Z.c)(11),{target:n,creating:r,disabled:i,onCreate:a}=e,{_:o}=_(),s;t[0]!==o||t[1]!==n?(s=o({id:`oWsZk8`,values:{target:n}}),t[0]=o,t[1]=n,t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(M,{"aria-hidden":`true`,className:`size-3`}),t[3]=c):c=t[3];let l;t[4]===r?l=t[5]:(l=r?(0,Q.jsx)(g,{id:`E9bKSA`}):(0,Q.jsx)(g,{id:`XRuL0i`}),t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==a||t[8]!==s||t[9]!==l?(u=(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:i,onClick:a,"aria-label":s,"data-testid":`problems-create-page`,children:[c,l]}),t[6]=i,t[7]=a,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function Ln(e){let t=(0,Z.c)(8),{tip:n,testId:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`inline-flex shrink-0`,children:i})}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=(0,Q.jsx)(w,{"data-testid":r,children:n}),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(T,{children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Rn(e){let t=(0,Z.c)(21),{count:n,problemCount:r,aiAvailable:i,disabled:a,onClick:o,children:s}=e,{_:c}=_(),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=n>0?(0,Q.jsx)(g,{id:`vjwsDi`,values:{count:n}}):r===0?(0,Q.jsx)(g,{id:`gAhHu7`}):i?(0,Q.jsx)(g,{id:`zA9zRL`}):(0,Q.jsx)(g,{id:`X3MMeA`}),t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u;t[4]!==c||t[5]!==s||t[6]!==n||t[7]!==r?(u=s===void 0?r===0?c({id:`4m-xuX`}):n===0?c({id:`SqIoy_`}):void 0:void 0,t[4]=c,t[5]=s,t[6]=n,t[7]=r,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==n?(f=s??(0,Q.jsx)(g,{id:`RZXTlY`,values:{count:n}}),t[10]=s,t[11]=n,t[12]=f):f=t[12];let p;t[13]!==a||t[14]!==o||t[15]!==u||t[16]!==f?(p=(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:a,onClick:o,"aria-label":u,"data-testid":`problems-auto-fix`,children:[d,f]}),t[13]=a,t[14]=o,t[15]=u,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==l||t[19]!==p?(m=(0,Q.jsx)(Ln,{testId:`problems-auto-fix-tip`,tip:l,children:p}),t[18]=l,t[19]=p,t[20]=m):m=t[20],m}function zn(e){let t=(0,Z.c)(12),{count:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(g,{id:`mgDKWS`,values:{count:n}}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(l,{"aria-hidden":`true`,className:`size-3`}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Q.jsx)(g,{id:`gyHDWC`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]!==r||t[6]!==i||t[7]!==s?(c=(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"data-testid":`problems-fix-with-ai`,children:[o,s]}),t[5]=r,t[6]=i,t[7]=s,t[8]=c):c=t[8];let u;return t[9]!==a||t[10]!==c?(u=(0,Q.jsx)(Ln,{testId:`problems-fix-with-ai-tip`,tip:a,children:c}),t[9]=a,t[10]=c,t[11]=u):u=t[11],u}function Bn(e){let t=(0,Z.c)(18),{docName:n,diagnostics:r,onFix:i,onAutoFix:a,onAskAi:o,onFixWithAi:s}=e,{_:c}=_(),[u,d]=(0,X.useState)(`doc`),{data:f}=Me(),m=f===null?null:f.effective.enabled?Oe.filter(e=>f.effective.plugins[e.id].enabled):[],h=m!==null&&m.length===0,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={status:`idle`},t[0]=v):v=t[0];let[y,b]=(0,X.useState)(v),[x,E]=(0,X.useState)(null),D=re(),[O,k]=(0,X.useState)(null),A=(0,X.useRef)(!0),j,M;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>(A.current=!0,()=>{A.current=!1}),M=[],t[1]=j,t[2]=M):(j=t[1],M=t[2]),(0,X.useEffect)(j,M);let N=(0,X.useRef)(qn),P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P={status:`idle`},t[3]=P):P=t[3];let F=(0,X.useRef)(P),I;t[4]===y?I=t[5]:(I=()=>{y.status!==`loading`&&(F.current=y)},t[4]=y,t[5]=I),(0,X.useEffect)(I);let L=(0,X.useRef)(0),R=[...r].sort(kn),z=Fn(R),B=async function(e){let t=e.linkTarget;if(!(t===void 0||O!==null||D===null)){k(t);try{await p({initialDir:``,suggestedName:t},{addPage:D.addPage})}catch(e){let t=e;se.error(t instanceof Error?t.message:c({id:`tfi40B`})),A.current&&k(null);return}se.success(c({id:`EWCJFu`,values:{target:t}})),A.current&&k(null),A.current&&y.status===`loaded`&&await V()}};async function V(){L.current+=1;let e=L.current,t=F.current;b({status:`loading`});let n=await un();if(n===`audit-superseded`){L.current===e&&A.current&&b(t.status===`idle`?{status:`failed`}:t);return}n!==null&&wn(n.files),A.current&&b(n===null?{status:`failed`}:{status:`loaded`,result:n})}let H=y.status===`loaded`?y.result.files.filter(Gn):[],U=async function(){if(x!==null||H.length===0)return;E({done:0,total:H.length});let e=[];for(let t of H){let n=await Ae(le(t.file));if(!A.current)return;n.ok||e.push({file:t.file,detail:n.errorDetail}),E(Wn)}if(E(null),e.length>0){let t=e[0];se.error(c({id:`fru3T7`,values:{0:e.length,1:H.length}}),{description:t===void 0?void 0:`${t.file}${t.detail===null?``:` — ${t.detail}`}`})}try{await V()}catch{A.current&&b({status:`failed`})}},W=function(e){d(e),e===`project`&&y.status===`idle`&&V()};(0,X.useEffect)(()=>{N.current=()=>{y.status===`idle`||y.status===`failed`||V()}});let G;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[6]=G):G=t[6],(0,X.useEffect)(()=>je(()=>N.current()),G);let ee;t[7]===n?ee=t[8]:(ee=function(e){let t=An(e);ft(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(On,{detail:t}))},t[7]=n,t[8]=ee);let te=ee,ne;t[9]!==n||t[10]!==te?(ne=function(e,t){let r=le(e);if(r===n){te(t);return}ft(r,{kind:`lint`,detail:An(t)}),window.location.hash=ce(r)},t[9]=n,t[10]=te,t[11]=ne):ne=t[11];let ie=ne,ae=function(e){let t=i!==void 0&&(e.fixes?.length??0)>0,n=e.linkTarget!==void 0&&D!==null;if(!t&&!n&&o===void 0)return null;let r=`${e.source}/${e.code}`;return(0,Q.jsxs)(Q.Fragment,{children:[n?(0,Q.jsx)(In,{target:e.linkTarget??``,creating:O===e.linkTarget,disabled:O!==null,onCreate:()=>void B(e)}):null,t?(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>i?.(e),"aria-label":c({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),(0,Q.jsx)(g,{id:`c4fVUV`})]}):null,o===void 0?null:(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>o(e),"aria-label":c({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,Q.jsx)(l,{"aria-hidden":`true`,className:`size-3`}),(0,Q.jsx)(g,{id:`xWEvuo`})]})]})},K;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(Se,{children:(0,Q.jsx)(g,{id:`OXdGnd`})}),t[12]=K):K=t[12];let de=m!==null&&m.length>0&&(0,Q.jsxs)(T,{children:[(0,Q.jsx)(C,{className:`shrink-0 cursor-default rounded-md bg-muted-foreground/5 px-2 py-1 font-mono text-xs text-muted-foreground`,"data-testid":`problems-active-plugins`,children:(0,Q.jsx)(g,{id:`yxF19Y`,values:{0:m.length}})}),(0,Q.jsx)(w,{"data-testid":`problems-active-plugins-tooltip`,children:(0,Q.jsx)(g,{id:`ws5o1F`,values:{0:m.map(Un).join(`, `)}})})]}),q;t[13]===de?q=t[14]:(q=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,de]}),t[13]=de,t[14]=q);let fe=u===`doc`&&R.length>0&&(0,Q.jsx)(Te,{children:R.length}),J;return t[15]!==q||t[16]!==fe?(J=(0,Q.jsxs)(Ee,{children:[q,fe]}),t[15]=q,t[16]=fe,t[17]=J):J=t[17],(0,Q.jsxs)(De,{children:[J,(0,Q.jsx)(Ht,{scope:u,onScopeChange:W}),u===`doc`?(0,Q.jsx)(we,{className:`px-2 py-2`,children:R.length===0?h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ce,{className:`px-2`,"data-testid":`problems-no-plugins`,children:(0,Q.jsx)(g,{id:`Hngy37`})}),(0,Q.jsx)(`div`,{className:`px-2 pt-2`,children:(0,Q.jsx)(S,{variant:`outline`,size:`sm`,onClick:ue,"data-testid":`problems-enable-plugins`,children:(0,Q.jsx)(g,{id:`rnX-1S`})})})]}):(0,Q.jsx)(Ce,{className:`px-2`,children:(0,Q.jsx)(g,{id:`ZI8uvA`})}):(0,Q.jsxs)(Q.Fragment,{children:[a!==void 0||s!==void 0?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1 px-2 pb-1`,children:[a!==void 0&&(0,Q.jsx)(Rn,{count:z,problemCount:R.length,aiAvailable:s!==void 0,disabled:z===0,onClick:a}),s!==void 0&&(0,Q.jsx)(zn,{count:R.length,disabled:!1,onClick:()=>s(`doc`)})]}):null,(0,Q.jsx)(`ul`,{"aria-label":c({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:Mn(R).map(e=>(0,Q.jsx)(Nn,{group:e,onNavigate:te,navTitle:e=>c({id:`vbMHjo`,values:{0:e.range.start.line+1}}),renderActions:ae},e.key))})]})}):(0,Q.jsx)(Jn,{audit:y,onRefresh:()=>void V(),onNavigate:ie,fixableCount:H.reduce(Hn,0),problemCount:y.status===`loaded`?y.result.files.reduce(Vn,0):0,fixing:x,onAutoFix:()=>void U(),onFixWithAi:s===void 0||y.status!==`loaded`?void 0:()=>s(`project`),onCreateTarget:D===null?void 0:e=>void B(e),creatingTarget:O})]})}function Vn(e,t){return e+t.diagnostics.length}function Hn(e,t){return e+Fn(t.diagnostics)}function Un(e){return e.label}function Wn(e){return e===null?e:{...e,done:e.done+1}}function Gn(e){return e.diagnostics.some(Kn)}function Kn(e){return(e.fixes?.length??0)>0}function qn(){}function Jn(e){let t=(0,Z.c)(57),{audit:n,onRefresh:r,onNavigate:i,fixableCount:a,problemCount:o,fixing:s,onAutoFix:c,onFixWithAi:l,onCreateTarget:u,creatingTarget:d}=e,{_:f}=_(),p=n.status===`loading`||n.status===`idle`,m;t[0]!==n.result||t[1]!==n.status?(m=n.status===`loaded`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(g,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,Q.jsx)(g,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[0]=n.result,t[1]=n.status,t[2]=m):m=t[2];let h;t[3]===m?h=t[4]:(h=(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:m}),t[3]=m,t[4]=h);let v;t[5]===f?v=t[6]:(v=f({id:`I7y_vn`}),t[5]=f,t[6]=v);let y=p||s!==null,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`}),t[7]=b):b=t[7];let x;t[8]!==r||t[9]!==v||t[10]!==y?(x=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(S,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":v,"data-testid":`problems-audit-refresh`,disabled:y,onClick:r,children:b})}),t[8]=r,t[9]=v,t[10]=y,t[11]=x):x=t[11];let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(w,{"data-testid":`problems-audit-refresh-tooltip`,children:(0,Q.jsx)(g,{id:`I7y_vn`})}),t[12]=E):E=t[12];let D;t[13]===x?D=t[14]:(D=(0,Q.jsxs)(T,{children:[x,E]}),t[13]=x,t[14]=D);let O;t[15]!==h||t[16]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[h,D]}),t[15]=h,t[16]=D,t[17]=O):O=t[17];let k;t[18]!==f||t[19]!==s?(k=s===null?null:(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:f({id:`gZElfU`,values:{0:s.done,1:s.total}})}),t[18]=f,t[19]=s,t[20]=k):k=t[20];let A=l!==void 0,j=p||s!==null||a===0,M;t[21]===s?M=t[22]:(M=s===null?void 0:(0,Q.jsx)(g,{id:`S9t1PI`,values:{0:s.done,1:s.total}}),t[21]=s,t[22]=M);let N;t[23]!==a||t[24]!==c||t[25]!==o||t[26]!==A||t[27]!==j||t[28]!==M?(N=(0,Q.jsx)(Rn,{count:a,problemCount:o,aiAvailable:A,disabled:j,onClick:c,children:M}),t[23]=a,t[24]=c,t[25]=o,t[26]=A,t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;t[30]!==s||t[31]!==l||t[32]!==o?(P=l!==void 0&&o>0?(0,Q.jsx)(zn,{count:o,disabled:s!==null,onClick:l}):null,t[30]=s,t[31]=l,t[32]=o,t[33]=P):P=t[33];let F;t[34]!==k||t[35]!==N||t[36]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:[k,N,P]}),t[34]=k,t[35]=N,t[36]=P,t[37]=F):F=t[37];let I;t[38]!==F||t[39]!==O?(I=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 px-2 pb-1`,children:[O,F]}),t[38]=F,t[39]=O,t[40]=I):I=t[40];let L;t[41]!==f||t[42]!==p?(L=p&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":f({id:`dx-TwN`}),children:[1,2,3].map(Yn)}),t[41]=f,t[42]=p,t[43]=L):L=t[43];let R;t[44]===n.status?R=t[45]:(R=n.status===`failed`&&(0,Q.jsx)(xe,{className:`px-2 text-xs`,children:(0,Q.jsx)(g,{id:`IFezUv`})}),t[44]=n.status,t[45]=R);let z;t[46]!==n.result||t[47]!==n.status||t[48]!==d||t[49]!==u||t[50]!==i?(z=n.status===`loaded`&&(0,Q.jsx)(Xn,{result:n.result,onNavigate:i,onCreateTarget:u,creatingTarget:d}),t[46]=n.result,t[47]=n.status,t[48]=d,t[49]=u,t[50]=i,t[51]=z):z=t[51];let B;return t[52]!==I||t[53]!==L||t[54]!==R||t[55]!==z?(B=(0,Q.jsxs)(we,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[I,L,R,z]}),t[52]=I,t[53]=L,t[54]=R,t[55]=z,t[56]=B):B=t[56],B}function Yn(e){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,Q.jsx)(ke,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(ke,{className:`h-3 w-28`}),(0,Q.jsx)(ke,{className:`h-3 w-40`})]})]},e)}function Xn(e){let t=(0,Z.c)(12),{result:n,onNavigate:r,onCreateTarget:i,creatingTarget:a}=e,{_:o}=_(),s;t[0]!==o||t[1]!==n.warnings?(s=n.warnings.length>0&&(0,Q.jsx)(`ul`,{"aria-label":o({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(Zn)}),t[0]=o,t[1]=n.warnings,t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n.fileCount||t[7]!==n.files?(c=n.files.length===0?(0,Q.jsx)(Ce,{className:`px-2`,children:(0,Q.jsx)(g,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,Q.jsx)(Qn,{file:e,onNavigate:r,onCreateTarget:i,creatingTarget:a},e.file)),t[3]=a,t[4]=i,t[5]=r,t[6]=n.fileCount,t[7]=n.files,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Zn(e,t){return(0,Q.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,Q.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function Qn(e){let t=(0,Z.c)(41),{file:n,onNavigate:r,onCreateTarget:i,creatingTarget:a}=e,{_:o}=_(),s,c,l,u,d,f,p,m,h;if(t[0]!==o||t[1]!==a||t[2]!==n.diagnostics||t[3]!==n.file||t[4]!==i||t[5]!==r){let e=[...n.diagnostics].sort(kn);c=O,p=!0,m=`problems-audit-group`;let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[15]=g):g=t[15];let _;t[16]===n.file?_=t[17]:(_=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[16]=n.file,t[17]=_),h=(0,Q.jsxs)(D,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[g,_,(0,Q.jsx)(J,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),s=E,f=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,t[18]!==o||t[19]!==n.file?(l=o({id:`zAJzIg`,values:{0:n.file}}),t[18]=o,t[19]=n.file,t[20]=l):l=t[20],u=`flex flex-col gap-0.5 pb-1 ps-3`;let v;t[21]!==o||t[22]!==a||t[23]!==n.file||t[24]!==i||t[25]!==r?(v=e=>(0,Q.jsx)(Nn,{group:e,onNavigate:e=>r(n.file,e),navTitle:e=>o({id:`xKDsGS`,values:{0:e.range.start.line+1,1:n.file}}),renderActions:e=>e.linkTarget===void 0||i===void 0?null:(0,Q.jsx)(In,{target:e.linkTarget,creating:a===e.linkTarget,disabled:a!==null,onCreate:()=>i(e)})},e.key),t[21]=o,t[22]=a,t[23]=n.file,t[24]=i,t[25]=r,t[26]=v):v=t[26],d=Mn(e).map(v),t[0]=o,t[1]=a,t[2]=n.diagnostics,t[3]=n.file,t[4]=i,t[5]=r,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h}else s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14];let g;t[27]!==l||t[28]!==u||t[29]!==d?(g=(0,Q.jsx)(`ul`,{"aria-label":l,className:u,children:d}),t[27]=l,t[28]=u,t[29]=d,t[30]=g):g=t[30];let v;t[31]!==s||t[32]!==f||t[33]!==g?(v=(0,Q.jsx)(s,{className:f,children:g}),t[31]=s,t[32]=f,t[33]=g,t[34]=v):v=t[34];let y;return t[35]!==c||t[36]!==p||t[37]!==m||t[38]!==h||t[39]!==v?(y=(0,Q.jsxs)(c,{defaultOpen:p,"data-testid":m,children:[h,v]}),t[35]=c,t[36]=p,t[37]=m,t[38]=h,t[39]=v,t[40]=y):y=t[40],y}var $n={words:0,chars:0,tokens:0},er=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,tr=/[\p{L}\p{N}]/u,nr=new Set([`text`,`inlineCode`,`code`,`tag`]),rr=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),ir=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function ar(e,t){if(!e)return;let n=e.type;if(!rr.has(n)){if(nr.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
4
4
  `));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)ar(n,t);if(ir.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`