@inkeep/open-knowledge 0.86.22-beta.3 → 0.86.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 (181) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +2 -3
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-CKiX5Z0-.mjs +1 -0
  4. package/dist/{dist-nfglEvqM.mjs → dist-0qA3xZU8.mjs} +1 -1
  5. package/dist/dist-CJAnJkM1.mjs +2213 -0
  6. package/dist/index.mjs +219 -218
  7. package/dist/init-BSBhjVTS.mjs +1 -0
  8. package/dist/{init-DrTOYs4b.mjs → init-DQY_k8Bb.mjs} +2 -2
  9. package/dist/{launch-json-removal-B7rw00xq.mjs → launch-json-removal-BToQcc3e.mjs} +1 -1
  10. package/dist/{loader-BBHe-qov.mjs → loader-BcKRvBDf.mjs} +1 -1
  11. package/dist/loader-vXeyPd6b.mjs +1 -0
  12. package/dist/{md-manager-BGnqyqi1-I7NmBKjQ.mjs → md-manager-BGnqyqi1-BzZ_8EQ9.mjs} +108 -108
  13. package/dist/native/native-config.win32-arm64-msvc.node +0 -0
  14. package/dist/native/native-config.win32-x64-msvc.node +0 -0
  15. package/dist/{open-browser-BGyDP4ZD.mjs → open-browser-DhYyRIyx.mjs} +1 -1
  16. package/dist/parse-worker.mjs +1 -1
  17. package/dist/{preview-DJz-JIPh.mjs → preview-BNlI5MHG.mjs} +1 -1
  18. package/dist/preview-Cvm5I8jO.mjs +1 -0
  19. package/dist/public/assets/{AboutSection-Bddd4fs4.js → AboutSection-LPELvEUl.js} +1 -1
  20. package/dist/public/assets/{AccountSection-BWpFu1mh.js → AccountSection-Dla17okM.js} +1 -1
  21. package/dist/public/assets/ActivityModeContent-fbqWmmqu.js +1 -0
  22. package/dist/public/assets/{AddPropertiesButton-Bnt-4ijP.js → AddPropertiesButton-C0bGsu-F.js} +2 -2
  23. package/dist/public/assets/AgentConnectionsSection-DhbJCdHu.js +1 -0
  24. package/dist/public/assets/{AgentDiffPane-C5OsRI_M.js → AgentDiffPane-BIzndumu.js} +1 -1
  25. package/dist/public/assets/{AppMenubar-vPHVy2jk.js → AppMenubar-ClplcAeM.js} +1 -1
  26. package/dist/public/assets/{AttachmentsSection-nHyur5RE.js → AttachmentsSection-BjrHOhme.js} +1 -1
  27. package/dist/public/assets/AuthModal-DT32BOAJ.js +3 -0
  28. package/dist/public/assets/{BugReportHistory-CHujhV74.js → BugReportHistory-BM589t1t.js} +1 -1
  29. package/dist/public/assets/{BugReportHistoryDialog-CaE3cXFx.js → BugReportHistoryDialog-BfdDMBqN.js} +1 -1
  30. package/dist/public/assets/{ChangedOutsideBadge-BfH3veLO.js → ChangedOutsideBadge-DhpGZlDx.js} +1 -1
  31. package/dist/public/assets/{CodeMirrorPropInput-BIVsUkip.js → CodeMirrorPropInput-C5fRuWf2.js} +3 -3
  32. package/dist/public/assets/{ConsentDialogBody-k0k7metW.js → ConsentDialogBody-CaPp8huq.js} +1 -1
  33. package/dist/public/assets/{ContentRulesSection-CspBseTS.js → ContentRulesSection-B5CAsULt.js} +1 -1
  34. package/dist/public/assets/{DiffViewBoundary-DFNHnF7f.js → DiffViewBoundary-Czp-0Arc.js} +1 -1
  35. package/dist/public/assets/{DocumentContext-B6jTblM-.js → DocumentContext-DDDUTQJi.js} +5 -5
  36. package/dist/public/assets/{EditorModeToggle-C3jorbxy.js → EditorModeToggle-Bd8FyUeG.js} +1 -1
  37. package/dist/public/assets/{ExcalidrawDocEditor-DnNwcoSI.js → ExcalidrawDocEditor-4RZPPTS9.js} +1 -1
  38. package/dist/public/assets/FeedbackForm-DTSn-xTq.js +1 -0
  39. package/dist/public/assets/{GraphPanel-4ARXQVWm.js → GraphPanel-D1tkoAHM.js} +1 -1
  40. package/dist/public/assets/{HotkeysSection-D1qQH68p.js → HotkeysSection-C9sCf3j3.js} +1 -1
  41. package/dist/public/assets/{ImportSkillDialog-DERCjSDI.js → ImportSkillDialog-Be_RD2Gk.js} +1 -1
  42. package/dist/public/assets/{IntegrationsSection-r5E7Aje8.js → IntegrationsSection-D3htSKMO.js} +1 -1
  43. package/dist/public/assets/{LinkPreviewsSection-CbueguvE.js → LinkPreviewsSection-D0uy1PxC.js} +1 -1
  44. package/dist/public/assets/{LintConfigEditor-BioGvRZz.js → LintConfigEditor-l01M8Bbg.js} +1 -1
  45. package/dist/public/assets/{LintingSection-DgBzjGZs.js → LintingSection-12fgbDnF.js} +1 -1
  46. package/dist/public/assets/ManagedArtifactProperties-BNV1pKhc.js +1 -0
  47. package/dist/public/assets/{ManagedArtifactProperties-CTtod0_a.js → ManagedArtifactProperties-vcuTAbYr.js} +1 -1
  48. package/dist/public/assets/McpConsentDialogBody-BwguVGDQ.js +1 -0
  49. package/dist/public/assets/{Mermaid-DqNhHNi1.js → Mermaid-Dqzqybsn.js} +2 -2
  50. package/dist/public/assets/{MermaidDocEditor-BcG4K_to.js → MermaidDocEditor-BCNSGhNo.js} +1 -1
  51. package/dist/public/assets/{NetworkAccessSection-Cy0LxQmR.js → NetworkAccessSection-Cxln0QK5.js} +1 -1
  52. package/dist/public/assets/{OkignoreSection-DplnnxQb.js → OkignoreSection-BudJQycp.js} +2 -2
  53. package/dist/public/assets/{ProjectTemplatesSection-BEchYRnN.js → ProjectTemplatesSection-DCliKsre.js} +1 -1
  54. package/dist/public/assets/{PropertyDisplayRow-DW6FdMEL.js → PropertyDisplayRow-CGpmYjl6.js} +1 -1
  55. package/dist/public/assets/{PublishToGitHubDialog-D1Uh7qtW.js → PublishToGitHubDialog-BCeR1wkm.js} +1 -1
  56. package/dist/public/assets/{RegisteredAgentIcon-B0qjAvei.js → RegisteredAgentIcon-FmoZTlpS.js} +1 -1
  57. package/dist/public/assets/ReportBugDialogBody-J5o6Nxwn.js +3 -0
  58. package/dist/public/assets/ReportBugMenuTrigger-CAUKQKXn.js +1 -0
  59. package/dist/public/assets/SchemaConfigEditor-CHGUkiVe.js +1 -0
  60. package/dist/public/assets/{SearchSection-BknR36A2.js → SearchSection-Bcm55yb6.js} +1 -1
  61. package/dist/public/assets/{SessionsHost-DvUyFdCY.js → SessionsHost-DQ1ys2Oj.js} +2 -2
  62. package/dist/public/assets/{SettingsDialogBody-PdoC-MQs.js → SettingsDialogBody-BZpyRgRK.js} +2 -2
  63. package/dist/public/assets/{SettingsSectionHeader-BKhNIRp2.js → SettingsSectionHeader-DDNA1hrR.js} +1 -1
  64. package/dist/public/assets/{ShareReceiveDialog-DJbtqR4t.js → ShareReceiveDialog-DVtBOlIm.js} +1 -1
  65. package/dist/public/assets/{ShareReceiveMissDialog-sP8z3G5P.js → ShareReceiveMissDialog-NFqekHGn.js} +1 -1
  66. package/dist/public/assets/{SharingSection-C-9tTPow.js → SharingSection-Y4AD8HPt.js} +1 -1
  67. package/dist/public/assets/SkillCostValue-DBT6aDG-.js +1 -0
  68. package/dist/public/assets/{SkillForkDialog-BHqkO5bK.js → SkillForkDialog-CPkWchji.js} +1 -1
  69. package/dist/public/assets/{SkillInstallMenu-29VzNm-A.js → SkillInstallMenu-DyKWxkEY.js} +1 -1
  70. package/dist/public/assets/{SkillOriginInline-Z5JCe0T2.js → SkillOriginInline-D6YyylB6.js} +1 -1
  71. package/dist/public/assets/{SkillPluginBundleDialog-BnQu_DSM.js → SkillPluginBundleDialog-BmLQqQms.js} +1 -1
  72. package/dist/public/assets/{SkillToolbarControls-BPOzusb_.js → SkillToolbarControls-Bs8p51PI.js} +1 -1
  73. package/dist/public/assets/{SkillsManagerSection-D4YW1uOY.js → SkillsManagerSection-C0pgRzfs.js} +1 -1
  74. package/dist/public/assets/{SlidesPluginSection-BhUKklqb.js → SlidesPluginSection-B8KiQkqa.js} +1 -1
  75. package/dist/public/assets/{SlidesToolbarControls-DXn_DkWH.js → SlidesToolbarControls-DxIDubwo.js} +1 -1
  76. package/dist/public/assets/{SourceEditor-yhX950MP.js → SourceEditor-DP0HyTpn.js} +1 -1
  77. package/dist/public/assets/{SpellingSettings-C72xD-Zu.js → SpellingSettings-CElN7mrA.js} +1 -1
  78. package/dist/public/assets/{SyncSection-DEAqGf0b.js → SyncSection-C1jLDoRh.js} +1 -1
  79. package/dist/public/assets/SyncStatusBadge-uu4Is4Gu.js +1 -0
  80. package/dist/public/assets/{TemplateRow-4LHta_yW.js → TemplateRow-DsoFn6-i.js} +2 -2
  81. package/dist/public/assets/{TerminalLaunchContext-DprnLNoQ.js → TerminalLaunchContext-DWUMDSpw.js} +1 -1
  82. package/dist/public/assets/{TerminalPanel-BKIxzbz3.js → TerminalPanel-ByCiyPt3.js} +2 -2
  83. package/dist/public/assets/{TerminalSection-DWmHmbOA.js → TerminalSection-C8HHQC_K.js} +1 -1
  84. package/dist/public/assets/{TerminalWindowApp-BIUBwFQi.js → TerminalWindowApp-D6hHsUKZ.js} +1 -1
  85. package/dist/public/assets/{TextDocEditor-BMuqILyo.js → TextDocEditor-BZCB5p1t.js} +1 -1
  86. package/dist/public/assets/ThemePluginSection-McKmY5If.js +6 -0
  87. package/dist/public/assets/ThreadView-OBNSZb0r.js +28 -0
  88. package/dist/public/assets/{TimelineDiffPane-DR_RrBZ6.js → TimelineDiffPane-BiVpBG0u.js} +1 -1
  89. package/dist/public/assets/agent-connections-DSKODCmO.js +1 -0
  90. package/dist/public/assets/{agent-registry-BdHe0AEQ.js → agent-registry-DoeDgmSS.js} +1 -1
  91. package/dist/public/assets/badge-DmdA1C7r.js +1 -0
  92. package/dist/public/assets/{bridge-BMIee44l.js → bridge-BeevbgaB.js} +1 -1
  93. package/dist/public/assets/{catalog-CEXii1s5.js → catalog-C1GEA-Va.js} +1 -1
  94. package/dist/public/assets/{client-version-Dc8ZfyVQ.js → client-version-CVbC_NDn.js} +1 -1
  95. package/dist/public/assets/{comment-chips-DQThyCWT.js → comment-chips-bT3Pgeu8.js} +1 -1
  96. package/dist/public/assets/{config-provider-CbAqLe4d.js → config-provider-4lMZjvv1.js} +1 -1
  97. package/dist/public/assets/config-schema-CIaXsCAX.js +1 -0
  98. package/dist/public/assets/{css-color-to-hex-Csde6-Qs.js → css-color-to-hex-BRv_r6oZ.js} +1 -1
  99. package/dist/public/assets/{dist-DjMGDcCv.js → dist-BrKroYq_.js} +2 -2
  100. package/dist/public/assets/{doc-undo-manager-CcFJXnEc.js → doc-undo-manager-BKDHRnV-.js} +1 -1
  101. package/dist/public/assets/field-controls-CCcf2ybM.js +1 -0
  102. package/dist/public/assets/field-controls-CKb1JSHS.js +6 -0
  103. package/dist/public/assets/globals-Cr0S8PDH.css +1 -0
  104. package/dist/public/assets/{ime-composition-DSJh5ynW.js → ime-composition-_BDVzXn4.js} +1 -1
  105. package/dist/public/assets/index-xygm6gU4.js +2209 -0
  106. package/dist/public/assets/{lint-config-client-B249C1D2.js → lint-config-client-DRJNyM2s.js} +1 -1
  107. package/dist/public/assets/{lint-plugins-CDlvtEdY.js → lint-plugins-Dufc6pEn.js} +1 -1
  108. package/dist/public/assets/{markdown-lint-BMeMGAz_.js → markdown-lint-BuEapKhE.js} +1 -1
  109. package/dist/public/assets/{markdownlint-rule-browser-Bt2f856y.js → markdownlint-rule-browser-BQ4c4vDN.js} +1 -1
  110. package/dist/public/assets/{pending-receive-nav-store-Dwn-Grcg.js → pending-receive-nav-store-3JlvmWi7.js} +1 -1
  111. package/dist/public/assets/{preferred-session-events-Dea5tKqj.js → preferred-session-events-Crz1K3Z-.js} +1 -1
  112. package/dist/public/assets/{progress-j_RRfCwk.js → progress-BK046Tty.js} +1 -1
  113. package/dist/public/assets/saved-themes-client-D09wxYQm.js +1 -0
  114. package/dist/public/assets/{schema-section-BHt16UFk.js → schema-section-CalUQFIh.js} +1 -1
  115. package/dist/public/assets/{schemas-api-CL5ZXlEj.js → schemas-api-CD98jV86.js} +4 -4
  116. package/dist/public/assets/{selection-context-zHJJfwcl.js → selection-context-BbfG0HO9.js} +1 -1
  117. package/dist/public/assets/{skills-api-CCijBzjo.js → skills-api-zXSg3eSX.js} +1 -1
  118. package/dist/public/assets/{src-BtdIgOwW.js → src-D_7G4loI.js} +1 -1
  119. package/dist/public/assets/storage-scope-ldi41iCU.js +1 -0
  120. package/dist/public/assets/{tag-pill-input-qgfgpKpV.js → tag-pill-input-D6mNhknm.js} +1 -1
  121. package/dist/public/assets/{telemetry-impl-nMGOgbw4.js → telemetry-impl-C8ZWEJkv.js} +1 -1
  122. package/dist/public/assets/{telemetry-startup-D3T7VL4B.js → telemetry-startup-DNrsQYjz.js} +1 -1
  123. package/dist/public/assets/{terminal-launch-events-3vnER_eI.js → terminal-launch-events-BhFGIVo_.js} +1 -1
  124. package/dist/public/assets/typing-burst-detector-DQWG6VAz.js +8 -0
  125. package/dist/public/assets/{uninstall-Is26Mh1k.js → uninstall-DFTOzPT_.js} +1 -1
  126. package/dist/public/assets/{use-activity-panel-CWIHW25Z.js → use-activity-panel-D5VDwOQt.js} +1 -1
  127. package/dist/public/assets/{use-apply-config-color-theme-Bpi7AD0s.js → use-apply-config-color-theme-hiddt1uL.js} +2 -2
  128. package/dist/public/assets/{use-conflicts-CIjDyM9c.js → use-conflicts-BAjZ5TAV.js} +1 -1
  129. package/dist/public/assets/use-installed-clis-BopBqnEZ.js +2 -0
  130. package/dist/public/assets/{use-live-xterm-theme-BJbDRXxo.js → use-live-xterm-theme-C1wLG0Im.js} +1 -1
  131. package/dist/public/assets/{use-open-skill-1k63vqHX.js → use-open-skill-CFZd4B8h.js} +1 -1
  132. package/dist/public/assets/{use-semantic-search-status-7_z6UOU1.js → use-semantic-search-status-CRj98qO1.js} +1 -1
  133. package/dist/public/assets/{use-skill-origin-B9YRoKsz.js → use-skill-origin-BAc45a3e.js} +1 -1
  134. package/dist/public/assets/{use-skill-targets-DZmqRDS7.js → use-skill-targets-DIBQkXNG.js} +1 -1
  135. package/dist/public/assets/{use-skills-CkvdjORj.js → use-skills-B2fLFrq6.js} +1 -1
  136. package/dist/public/assets/{use-terminal-enabled-DtkTmXug.js → use-terminal-enabled-B51ji6oG.js} +1 -1
  137. package/dist/public/assets/{use-timeline-entry-diff-DEUoncMF.js → use-timeline-entry-diff-B6Z6EtU2.js} +1 -1
  138. package/dist/public/assets/{use-workspace-h2j0Puyv.js → use-workspace-Bgh-YT5K.js} +1 -1
  139. package/dist/public/index.html +54 -54
  140. package/dist/public/uninstall.html +4 -4
  141. package/dist/{registry-probes-BEuvSKiI.mjs → registry-probes-DPKKrRUM.mjs} +1 -1
  142. package/dist/{removal-file-path-fm1EdWve.mjs → removal-file-path-Bxa6y1-K.mjs} +1 -1
  143. package/dist/{repair-launch-json-DudH3biV.mjs → repair-launch-json-GQqTV6X4.mjs} +1 -1
  144. package/dist/{repair-mcp-configs-BWr46lfB.mjs → repair-mcp-configs-CZ1wHZDY.mjs} +1 -1
  145. package/dist/src-DJMiqowA.mjs +1 -0
  146. package/dist/{src-BXUDHSfS.mjs → src-DZwvkGg3.mjs} +1 -1
  147. package/dist/start-BAXRLMKN.mjs +1 -0
  148. package/dist/{start-CqbqD_2d.mjs → start-DGllIRmH.mjs} +3 -3
  149. package/package.json +4 -4
  150. package/dist/constants-B9YjCc7P.mjs +0 -1
  151. package/dist/dist-Ds1SZERP.mjs +0 -2213
  152. package/dist/init-Clxr_W9L.mjs +0 -1
  153. package/dist/loader-DmtMrpFK.mjs +0 -1
  154. package/dist/preview-D9-6_Bf3.mjs +0 -1
  155. package/dist/public/assets/ActivityModeContent-Bb1cRQG1.js +0 -1
  156. package/dist/public/assets/AgentConnectionsSection-B9_oKPEW.js +0 -1
  157. package/dist/public/assets/AuthModal-YZGpNH__.js +0 -3
  158. package/dist/public/assets/FeedbackForm-Dvwt-CM6.js +0 -1
  159. package/dist/public/assets/ManagedArtifactProperties-BEbt7Vxo.js +0 -1
  160. package/dist/public/assets/McpConsentDialogBody-CVZcuVhW.js +0 -1
  161. package/dist/public/assets/ReportBugDialogBody-jHepd9au.js +0 -3
  162. package/dist/public/assets/ReportBugMenuTrigger-KsljCE5p.js +0 -1
  163. package/dist/public/assets/SchemaConfigEditor-DHiFHGBL.js +0 -1
  164. package/dist/public/assets/SkillCostValue-DK-VfwfI.js +0 -1
  165. package/dist/public/assets/SyncStatusBadge-BL7bCFlF.js +0 -1
  166. package/dist/public/assets/ThemePluginSection-BHfep7sw.js +0 -6
  167. package/dist/public/assets/ThreadView-BKmp-rsR.js +0 -28
  168. package/dist/public/assets/agent-connections-D6YhmKlS.js +0 -1
  169. package/dist/public/assets/badge-BIamhtRR.js +0 -1
  170. package/dist/public/assets/config-schema-zP71feeS.js +0 -1
  171. package/dist/public/assets/field-controls-B49FSs4r.js +0 -1
  172. package/dist/public/assets/field-controls-DBnF9Har.js +0 -6
  173. package/dist/public/assets/globals-kLKgmkBv.css +0 -1
  174. package/dist/public/assets/index-ycdaC75s.js +0 -2209
  175. package/dist/public/assets/saved-themes-client-DFijgxrT.js +0 -1
  176. package/dist/public/assets/storage-scope-GPc8n3Ml.js +0 -1
  177. package/dist/public/assets/typing-burst-detector-CM_YQNeI.js +0 -8
  178. package/dist/public/assets/use-installed-clis-BTrIR9--.js +0 -2
  179. package/dist/src-BajjToGT.mjs +0 -1
  180. package/dist/start-DL2m-1AX.mjs +0 -1
  181. /package/dist/public/assets/{globals-CcgTjZMO.js → globals-DHDe92Ga.js} +0 -0
@@ -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{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o,r as s,t as c}from"./AgentIconCluster-DYP1yNXm.js";import{a as l,c as u,i as d,l as f,o as p,r as m,s as h,t as g}from"./alert-dialog-BA3e7-10.js";import{t as _}from"./button-DzgjsZzC.js";import{n as v}from"./dist-BGzUo_18.js";import{c as y}from"./documents-events-ddyuXdQl.js";import{t as b}from"./createLucideIcon-DdBzwsHe.js";import{t as x}from"./arrow-right-NOQZeKIW.js";import{a as S,h as C,r as w,t as T}from"./dropdown-menu-5XqyQTVx.js";import{t as E}from"./copy-DpWa6i2v.js";import{t as D}from"./trash-2-CchZ0T47.js";import{a as O,c as k,i as A,n as j,o as M,s as N,t as P}from"./dialog-BJEjKJjL.js";import"./constants-skills-BLHVRW90.js";import{t as F}from"./tool-list-format-CS7MZY1Q.js";import{n as I}from"./perf-CPPbaRwr.js";import{t as L}from"./input-BsFOyzfK.js";import{a as R}from"./skill-scope-DOTLd4gL.js";import{t as z}from"./use-skills-CkvdjORj.js";import{n as B}from"./open-managed-artifact-tab-Bgndx1BG.js";import{t as V}from"./skeleton-CrbF9ppq.js";import{t as H}from"./ChangedOutsideBadge-BfH3veLO.js";import{t as U}from"./use-skill-targets-DZmqRDS7.js";import{t as ee}from"./SettingsSectionHeader-BKhNIRp2.js";var te=b(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),W=e(n(),1),G=a(),K=t();function q(e){let t=(0,G.c)(25),{icon:n,label:r,detail:i,names:a,tone:o,testId:s}=e,c=o===`destructive`?`text-destructive`:o===`muted`?`text-muted-foreground`:`text-foreground`,l=`mt-0.5 shrink-0 ${c}`,u;t[0]!==n||t[1]!==l?(u=(0,K.jsx)(`span`,{className:l,"aria-hidden":!0,children:n}),t[0]=n,t[1]=l,t[2]=u):u=t[2];let d=`font-medium text-xs ${c}`,f;t[3]!==r||t[4]!==d?(f=(0,K.jsx)(`span`,{className:d,children:r}),t[3]=r,t[4]=d,t[5]=f):f=t[5];let p;t[6]===a.length?p=t[7]:(p=(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:a.length}),t[6]=a.length,t[7]=p);let m;t[8]!==f||t[9]!==p?(m=(0,K.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[f,p]}),t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]===i?h=t[12]:(h=i?(0,K.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:i}):null,t[11]=i,t[12]=h);let g;t[13]===a?g=t[14]:(g=a.map(ne),t[13]=a,t[14]=g);let _;t[15]===g?_=t[16]:(_=(0,K.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5`,children:g}),t[15]=g,t[16]=_);let v;t[17]!==m||t[18]!==h||t[19]!==_?(v=(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h,_]}),t[17]=m,t[18]=h,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u||t[23]!==s?(y=(0,K.jsxs)(`div`,{className:`flex gap-2.5`,"data-testid":s,children:[u,v]}),t[21]=v,t[22]=u,t[23]=s,t[24]=y):y=t[24],y}function ne(e){return(0,K.jsx)(`code`,{className:`break-all text-[11px] text-muted-foreground`,children:e},e)}function re(e){let t=(0,G.c)(51),{open:n,onOpenChange:a,pick:o,keep:s,preview:c,onConfirm:v}=e,{_:y}=i(),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,K.jsx)(f,{children:(0,K.jsx)(r,{id:`Eu-LIb`})}),t[0]=b):b=t[0];let S;t[1]===s?S=t[2]:(S=(0,K.jsxs)(u,{children:[b,(0,K.jsx)(p,{children:(0,K.jsx)(r,{id:`IvKbeq`,values:{keep:s}})})]}),t[1]=s,t[2]=S);let C;t[3]===o?C=t[4]:(C=(0,K.jsx)(`code`,{className:`block break-all font-mono text-[11px]`,children:o}),t[3]=o,t[4]=C);let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:(0,K.jsx)(r,{id:`kjlQ9D`})}),t[5]=w):w=t[5];let T;t[6]===C?T=t[7]:(T=(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 rounded border border-border/60 px-2 py-1.5`,children:[C,w]}),t[6]=C,t[7]=T);let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(x,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),t[8]=O):O=t[8];let k;t[9]===s?k=t[10]:(k=(0,K.jsx)(`code`,{className:`block break-all font-mono text-[11px]`,children:s}),t[9]=s,t[10]=k);let A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:(0,K.jsx)(r,{id:`f1-q9m`})}),t[11]=A):A=t[11];let j;t[12]===k?j=t[13]:(j=(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 rounded border border-border/60 bg-muted/40 px-2 py-1.5`,children:[k,A]}),t[12]=k,t[13]=j);let M;t[14]!==T||t[15]!==j?(M=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`skill-folder-link-direction`,children:[T,O,j]}),t[14]=T,t[15]=j,t[16]=M):M=t[16];let N;t[17]===c.moves?N=t[18]:(N=c.moves.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-moves`,icon:(0,K.jsx)(x,{className:`size-3.5`}),tone:`default`,label:(0,K.jsx)(r,{id:`2Ce6hp`}),names:c.moves}):null,t[17]=c.moves,t[18]=N);let P;t[19]!==y||t[20]!==o||t[21]!==c.drops?(P=c.drops.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-drops`,icon:(0,K.jsx)(E,{className:`size-3.5`}),tone:`muted`,label:(0,K.jsx)(r,{id:`RxF-am`}),detail:y({id:`H8DVOJ`,values:{pick:o}}),names:c.drops}):null,t[19]=y,t[20]=o,t[21]=c.drops,t[22]=P):P=t[22];let F;t[23]!==y||t[24]!==s||t[25]!==c.replaces?(F=c.replaces.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-replaces`,icon:(0,K.jsx)(te,{className:`size-3.5`}),tone:`destructive`,label:(0,K.jsx)(r,{id:`0m4Snh`}),detail:y({id:`jEVipR`,values:{keep:s}}),names:c.replaces}):null,t[23]=y,t[24]=s,t[25]=c.replaces,t[26]=F):F=t[26];let I;t[27]!==y||t[28]!==o||t[29]!==c.removes?(I=c.removes.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-removes`,icon:(0,K.jsx)(D,{className:`size-3.5`}),tone:`destructive`,label:(0,K.jsx)(r,{id:`hs5BRR`}),detail:y({id:`beHZo4`,values:{pick:o}}),names:c.removes}):null,t[27]=y,t[28]=o,t[29]=c.removes,t[30]=I):I=t[30];let L;t[31]!==N||t[32]!==P||t[33]!==F||t[34]!==I?(L=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[N,P,F,I]}),t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L):L=t[35];let R;t[36]!==M||t[37]!==L?(R=(0,K.jsxs)(m,{className:`flex flex-col gap-4 py-1`,children:[M,L]}),t[36]=M,t[37]=L,t[38]=R):R=t[38];let z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,K.jsx)(d,{children:(0,K.jsx)(r,{id:`dEgA5A`})}),t[39]=z):z=t[39];let B;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,K.jsx)(r,{id:`rf0tV1`}),t[40]=B):B=t[40];let V;t[41]===v?V=t[42]:(V=(0,K.jsxs)(h,{children:[z,(0,K.jsx)(_,{onClick:v,"data-testid":`skill-folder-link-confirm`,children:B})]}),t[41]=v,t[42]=V);let H;t[43]!==R||t[44]!==V||t[45]!==S?(H=(0,K.jsxs)(l,{children:[S,R,V]}),t[43]=R,t[44]=V,t[45]=S,t[46]=H):H=t[46];let U;return t[47]!==a||t[48]!==n||t[49]!==H?(U=(0,K.jsx)(g,{open:n,onOpenChange:a,children:H}),t[47]=a,t[48]=n,t[49]=H,t[50]=U):U=t[50],U}function ie(e){let t=(0,G.c)(67),{scope:n}=e,{i18n:a,_:o}=i(),{state:l,saving:u,folderAction:d}=U(),[f,p]=(0,W.useState)(``),[m,h]=(0,W.useState)(null),g,y,b,x,E;if(t[0]!==o||t[1]!==d||t[2]!==a||t[3]!==m||t[4]!==u||t[5]!==n||t[6]!==l.data||t[7]!==l.message||t[8]!==l.status){let e=l.status===`ready`?(l.data.folders??[]).filter(e=>e.scope===n):[],i=new Map(e.map(de)),f=e=>(e.state===`linked`||e.state===`linked-parent`)&&typeof e.target==`string`&&i.has(e.target),p=new Map;for(let t of e){if(!f(t))continue;let e=t.target;p.set(e,[...p.get(e)??[],t])}let D;t[14]===f?D=t[15]:(D=e=>!f(e),t[14]=f,t[15]=D);let O=e.filter(D),k;t[16]!==d||t[17]!==n?(k=(e,t,r)=>{d({scope:n,root:e,action:t,...r===void 0?{}:{target:r}}).catch(ue)},t[16]=d,t[17]=n,t[18]=k):k=t[18];let A=k,j;t[19]===n?j=t[20]:(j=e=>n===`global`?`~/${e}`:e,t[19]=n,t[20]=j);let M=j,N;t[21]!==o||t[22]!==M||t[23]!==d||t[24]!==n?(N=(e,t)=>{let r=M(e),i=M(t);d({scope:n,root:e,action:`link`,target:t,preview:!0}).then(a=>{if(!a){v.error(o({id:`KkRyMI`}));return}if(a.conflicts.length>0){v.error(o({id:`l2BOXd`,values:{0:a.conflicts.join(`, `),pick:r,keep:i}}));return}if(a.strays.length>0){v.error(o({id:`-qBQVd`,values:{0:a.strays.join(`, `),pick:r}}));return}if(a.moves.length+a.removes.length+a.replaces.length>0){h({root:e,target:t,pick:r,keep:i,preview:a});return}return d({scope:n,root:e,action:`link`,target:t})}).catch(le)},t[21]=o,t[22]=M,t[23]=d,t[24]=n,t[25]=N):N=t[25];let P=N,I;t[26]!==d||t[27]!==m||t[28]!==n?(I=()=>{if(!m)return;let{root:e,target:t}=m;h(null),d({scope:n,root:e,action:`link`,target:t}).catch(ce)},t[26]=d,t[27]=m,t[28]=n,t[29]=I):I=t[29],g=I,y=`space-y-2 rounded-lg border bg-card p-3`,b=`settings-skill-folders`;let L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,K.jsx)(`h4`,{className:`text-sm font-medium`,children:(0,K.jsx)(r,{id:`59CUI8`})}),t[30]=L):L=t[30],t[31]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,K.jsxs)(`div`,{children:[L,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`J_jZ5z`})})]}),t[31]=x):x=t[31],E=l.status===`error`?(0,K.jsx)(`div`,{className:`text-1sm text-destructive`,role:`alert`,"data-testid":`skill-targets-error`,children:(0,K.jsx)(r,{id:`ACKMCN`,values:{0:l.message}})}):l.status===`ready`?(0,K.jsx)(`ul`,{className:`space-y-1 pt-1`,children:O.map(t=>{let i=M(t.root),l=p.get(t.root)??[],d=se,f=e.filter(e=>e.root!==t.root&&(e.state===`own`||e.state===`absent`)&&!d(e)),m=(t.state===`own`||t.state===`absent`)&&!d(t);return(0,K.jsxs)(`li`,{className:`text-sm`,"data-testid":`skill-folder-row-${t.host}`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(c,{host:t.host,"aria-hidden":!0,className:`size-4 shrink-0`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:[i,t.state===`linked`||t.state===`linked-parent`?(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[` → `,t.target??`?`]}):null]}),t.drift?(0,K.jsx)(H,{testId:`skill-folder-drift-${t.host}`,title:o({id:`p3m_Gk`,values:{0:t.expected??``}})}):null,t.state===`linked-parent`?(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground uppercase tracking-wide`,title:o({id:`yLwx9e`}),children:(0,K.jsx)(r,{id:`nf0wk0`})}):null,d(t)?(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,title:o({id:`QP9OU3`}),"data-testid":`skill-folder-hub-destination-only`,children:(0,K.jsx)(r,{id:`mPoOmg`})}):null,m&&f.length>0?(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{asChild:!0,children:(0,K.jsx)(_,{size:`sm`,variant:`ghost`,disabled:u,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] uppercase tracking-wide text-muted-foreground hover:text-foreground`,title:o({id:`g5w1sF`,values:{display:i}}),"data-testid":`skill-folder-link-${t.host}`,children:(0,K.jsx)(r,{id:`yzF66j`})})}),(0,K.jsx)(w,{align:`end`,className:`w-auto`,children:f.map(e=>(0,K.jsxs)(S,{onSelect:()=>P(e.root,t.root),"data-testid":`skill-folder-link-${t.host}-to-${e.root}`,children:[(0,K.jsx)(c,{host:e.host,"aria-hidden":!0,className:`size-4`}),(0,K.jsx)(`span`,{className:`font-mono text-xs`,children:n===`global`?`~/${e.root}`:e.root})]},e.root))})]}):null,t.state===`linked`?(0,K.jsx)(_,{size:`sm`,variant:`ghost`,disabled:u,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] uppercase tracking-wide text-muted-foreground hover:text-foreground`,title:o({id:`MQ5LOx`,values:{display:i}}),onClick:()=>A(t.root,`unlink`),"data-testid":`skill-folder-unlink-${t.host}`,children:(0,K.jsx)(r,{id:`ptQ3_N`})}):null]}),l.length>0?(0,K.jsx)(`p`,{className:`mt-1 ml-6 text-muted-foreground text-xs`,"data-testid":`skill-folder-shared-${t.host}`,children:o({id:`OOLsBh`,values:{0:F([t.host,...l.map(oe)].map(s),a.locale)}})}):null,l.length>0?(0,K.jsx)(`ul`,{className:`mt-1 ml-2 space-y-1 border-border/60 border-l pl-3`,"data-testid":`skill-folder-followers-${t.host}`,children:l.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(c,{host:e.host,"aria-hidden":!0,className:`size-4 shrink-0`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground text-xs`,children:n===`global`?`~/${e.root}`:e.root}),e.drift?(0,K.jsx)(H,{testId:`skill-folder-drift-${e.host}`,title:o({id:`p3m_Gk`,values:{0:e.expected??``}})}):null,e.state===`linked-parent`?(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground uppercase tracking-wide`,title:o({id:`yLwx9e`}),children:(0,K.jsx)(r,{id:`Ef6ukL`})}):(0,K.jsx)(_,{size:`sm`,variant:`ghost`,disabled:u,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide hover:text-foreground`,title:o({id:`9_2oe6`,values:{0:n===`global`?`~/${e.root}`:e.root}}),onClick:()=>A(e.root,`unlink`),"data-testid":`skill-folder-unlink-${e.host}`,children:(0,K.jsx)(r,{id:`ptQ3_N`})})]},e.host))}):null]},t.host)})}):(0,K.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,K.jsx)(V,{className:`h-5 w-56`}),(0,K.jsx)(V,{className:`h-5 w-56`})]}),t[0]=o,t[1]=d,t[2]=a,t[3]=m,t[4]=u,t[5]=n,t[6]=l.data,t[7]=l.message,t[8]=l.status,t[9]=g,t[10]=y,t[11]=b,t[12]=x,t[13]=E}else g=t[9],y=t[10],b=t[11],x=t[12],E=t[13];let D;t[32]!==d||t[33]!==f||t[34]!==n?(D=e=>{e.preventDefault();let t=f.trim().replace(/^~\//,``);t!==``&&d({scope:n,root:t,action:`add-root`}).then(()=>p(``)).catch(ae)},t[32]=d,t[33]=f,t[34]=n,t[35]=D):D=t[35];let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>p(e.target.value),t[36]=O):O=t[36];let k;t[37]===o?k=t[38]:(k=o({id:`oyBV3W`}),t[37]=o,t[38]=k);let A;t[39]!==o||t[40]!==n?(A=o(n===`global`?{id:`Wboy1j`}:{id:`jpoCue`}),t[39]=o,t[40]=n,t[41]=A):A=t[41];let j;t[42]!==f||t[43]!==u||t[44]!==k||t[45]!==A?(j=(0,K.jsx)(L,{value:f,onChange:O,"aria-label":k,placeholder:A,className:`h-7 flex-1 font-mono text-xs`,disabled:u,"data-testid":`skill-folders-add-root-input`}),t[42]=f,t[43]=u,t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==f||t[48]!==u?(M=u||f.trim()===``,t[47]=f,t[48]=u,t[49]=M):M=t[49];let N;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,K.jsx)(r,{id:`ZW2yR_`}),t[50]=N):N=t[50];let P;t[51]===M?P=t[52]:(P=(0,K.jsx)(_,{type:`submit`,size:`sm`,variant:`secondary`,disabled:M,className:`h-7 px-2 font-normal text-xs`,children:N}),t[51]=M,t[52]=P);let I;t[53]!==P||t[54]!==D||t[55]!==j?(I=(0,K.jsxs)(`form`,{className:`flex items-center gap-2 pt-1`,onSubmit:D,"data-testid":`skill-folders-add-root`,children:[j,P]}),t[53]=P,t[54]=D,t[55]=j,t[56]=I):I=t[56];let R;t[57]!==g||t[58]!==m?(R=m?(0,K.jsx)(re,{open:!0,onOpenChange:e=>{e||h(null)},pick:m.pick,keep:m.keep,preview:m.preview,onConfirm:g}):null,t[57]=g,t[58]=m,t[59]=R):R=t[59];let z;return t[60]!==y||t[61]!==I||t[62]!==R||t[63]!==b||t[64]!==x||t[65]!==E?(z=(0,K.jsxs)(`section`,{className:y,"data-testid":b,children:[x,E,I,R]}),t[60]=y,t[61]=I,t[62]=R,t[63]=b,t[64]=x,t[65]=E,t[66]=z):z=t[66],z}function ae(e){return v.error(e instanceof Error?e.message:String(e))}function oe(e){return e.host}function se(e){return e.root===`.agents/skills`&&e.state===`absent`}function ce(e){return v.error(e instanceof Error?e.message:String(e))}function le(e){return v.error(e instanceof Error?e.message:String(e))}function ue(e){return v.error(e instanceof Error?e.message:String(e))}function de(e){return[e.root,e]}function J(e){let t=(0,G.c)(22),{name:n,description:i,hosts:a,emptyHosts:s,onActivate:c,ariaExpanded:l,control:u}=e,d;t[0]===n?d=t[1]:(d=(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground group-hover/button:underline`,children:(0,K.jsx)(`code`,{children:n})}),t[0]=n,t[1]=d);let f;t[2]===i?f=t[3]:(f=(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i}),t[2]=i,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,K.jsxs)(K.Fragment,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m=p,h;t[7]!==l||t[8]!==m||t[9]!==c?(h=c?(0,K.jsx)(_,{variant:`ghost`,onClick:c,"aria-expanded":l,className:`group/button h-auto w-full flex-col items-start justify-start gap-0.5 whitespace-normal p-0 text-left hover:bg-transparent`,"data-testid":`skill-consent-row-preview`,children:m}):(0,K.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:m}),t[7]=l,t[8]=m,t[9]=c,t[10]=h):h=t[10];let g;t[11]!==s||t[12]!==a?(g=(0,K.jsx)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.length>0?(0,K.jsx)(o,{hosts:a}):(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`skill-consent-row-no-hosts`,children:s===`not-added`?(0,K.jsx)(r,{id:`zP6U1P`}):(0,K.jsx)(r,{id:`yOjRUV`})})}),t[11]=s,t[12]=a,t[13]=g):g=t[13];let v;t[14]!==h||t[15]!==g?(v=(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[h,g]}),t[14]=h,t[15]=g,t[16]=v):v=t[16];let y;t[17]===u?y=t[18]:(y=u?(0,K.jsx)(`span`,{className:`shrink-0`,children:u}):null,t[17]=u,t[18]=y);let b;return t[19]!==v||t[20]!==y?(b=(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5 px-3 py-2.5`,"data-testid":`skill-consent-row`,children:[v,y]}),t[19]=v,t[20]=y,t[21]=b):b=t[21],b}function fe(e){let t=(0,G.c)(4),{paths:n}=e,r;t[0]===n?r=t[1]:(r=n.map(pe),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,K.jsx)(`ul`,{className:`flex flex-col gap-0.5`,"data-testid":`skill-destination-list`,children:r}),t[2]=r,t[3]=i),i}function pe(e){return(0,K.jsx)(`li`,{children:(0,K.jsx)(`code`,{className:`break-all text-xs text-muted-foreground`,children:e})},e)}function Y(){let{_:e}=i();return t=>{switch(t){case`discovery`:case`open-knowledge-discovery`:return e({id:`olb6oq`});case`write-skill`:case`open-knowledge-write-skill`:return e({id:`I-6_4S`});case`project`:case`open-knowledge`:return e({id:`UMT9C9`});default:return null}}}function X(e){if(!e)return null;let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>0?e.slice(0,t):null}function me(e){let t=(0,G.c)(22),{open:n,onDismiss:a,offer:o,onInstall:s,busy:c}=e,l=c===void 0?!1:c,{_:u}=i(),d=Y(),f=o!==null&&o.resolvedHosts.length>0,p;t[0]===a?p=t[1]:(p=e=>{e||a()},t[0]=a,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(k,{children:(0,K.jsx)(r,{id:`w7LRoP`})}),t[2]=m):m=t[2];let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsxs)(N,{children:[m,(0,K.jsx)(O,{children:(0,K.jsx)(r,{id:`tX8FLX`})})]}),t[3]=h):h=t[3];let g;t[4]!==d||t[5]!==f||t[6]!==o?(g=o!==null&&(0,K.jsxs)(j,{className:`flex flex-col gap-3 py-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,K.jsx)(r,{id:`oy5bJW`})}),(0,K.jsx)(`div`,{className:`rounded-md border border-border bg-card/50`,children:(0,K.jsx)(J,{name:o.name,description:d(o.id)??o.description,hosts:o.resolvedHosts.map(he),emptyHosts:`none-detected`})}),f&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,K.jsx)(r,{id:`0CvV_9`})}),(0,K.jsx)(fe,{paths:o.paths})]})]}),t[4]=d,t[5]=f,t[6]=o,t[7]=g):g=t[7];let v;t[8]!==u||t[9]!==l||t[10]!==f||t[11]!==o||t[12]!==a||t[13]!==s?(v=(0,K.jsx)(M,{children:o===null?(0,K.jsx)(_,{onClick:a,"data-testid":`skills-studio-intro-ack`,children:(0,K.jsx)(r,{id:`76gPWk`})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{variant:`outline`,onClick:a,"data-testid":`skills-studio-intro-dismiss`,children:(0,K.jsx)(r,{id:`PBxg_E`})}),(0,K.jsx)(_,{onClick:s,disabled:l||!f,"aria-label":u({id:`fGqEFq`,values:{0:o.name}}),"data-testid":`skills-studio-intro-install`,children:(0,K.jsx)(r,{id:`TKQ7K-`})})]})}),t[8]=u,t[9]=l,t[10]=f,t[11]=o,t[12]=a,t[13]=s,t[14]=v):v=t[14];let y;t[15]!==g||t[16]!==v?(y=(0,K.jsxs)(A,{className:`sm:max-w-md`,"data-testid":`skills-studio-intro`,children:[h,g,v]}),t[15]=g,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==n||t[19]!==p||t[20]!==y?(b=(0,K.jsx)(P,{open:n,onOpenChange:p,children:y}),t[18]=n,t[19]=p,t[20]=y,t[21]=b):b=t[21],b}function he(e){return e.editor}var Z=`ok-skills-studio-intro-seen-v1`;function Q(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function ge(e){let t=e===void 0?Q():e;if(!t)return!0;try{return t.getItem(Z)!==null}catch{return!0}}function _e(e){let t=e===void 0?Q():e;if(t)try{t.setItem(Z,new Date().toISOString())}catch{}}function ve(){let e=(0,G.c)(41),{_:t}=i(),n=Y(),a=z(),o=typeof window<`u`?window.okDesktop??null:null,[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d]=(0,W.useState)($),[f,p]=(0,W.useState)(!1),m=!d&&!f,h,g;e[0]===m?(h=e[1],g=e[2]):(h=()=>{if(!o||!m)return;let e=!1;return o.integrations.status().then(t=>{e||c(t)}).catch(t=>{console.warn(`[skills-studio] bridge integrations.status failed; intro skipped:`,t),e||p(!0)}),()=>{e=!0}},g=[o,m],e[0]=m,e[1]=h,e[2]=g),(0,W.useEffect)(h,g);let y;e[3]===t?y=e[4]:(y=async function(e,n){if(o){u(!0);try{let t=await o.integrations.setComponent({component:{kind:`skill`,id:e},enabled:n});c(t.status),t.ok||v.error(t.error)}catch(e){let n=e;v.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}u(!1)}},e[3]=t,e[4]=y);let b=y,x;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){_e(),p(!0)},e[5]=x):x=e[5];let S=x,C;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,K.jsx)(`h4`,{className:`text-sm font-medium`,children:(0,K.jsx)(r,{id:`RojU4W`})}),e[6]=C):C=e[6];let w;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(`div`,{children:[C,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`kEiVv6`})})]}),e[7]=w):w=e[7];let T=w;if(a.status===`error`){let t;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-builtin-skills`,children:[T,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`builtin-skills-unavailable`,children:(0,K.jsx)(r,{id:`annvv7`})})]}),e[8]=t):t=e[8],t}if(a.status!==`ready`){let t;return e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-builtin-skills`,children:[T,(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 pt-1`,"data-testid":`builtin-skills-loading`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:(0,K.jsx)(r,{id:`VeVIIk`})}),(0,K.jsx)(V,{className:`h-12 w-full`}),(0,K.jsx)(V,{className:`h-12 w-full`})]})]}),e[9]=t):t=e[9],t}let E=a.data,D,O,k,A,j,M,N,P;if(e[10]!==n||e[11]!==s?.skills||e[12]!==l||e[13]!==a.data){j=Symbol.for(`react.early_return_sentinel`);bb0:{let t=E.filter(be);if(t.length===0){j=null;break bb0}D=l;let i;e[22]===s?.skills?i=e[23]:(i=s?.skills.find(ye)??null,e[22]=s?.skills,e[23]=i),O=i,P=`space-y-2 rounded-lg border bg-card p-3`,k=`settings-builtin-skills`,A=T,M=`divide-y divide-border overflow-hidden rounded-md border border-border bg-background/50`;let a;e[24]===n?a=e[25]:(a=e=>{let t=X(e.absolutePath);return(0,K.jsx)(`li`,{className:`hover:bg-accent`,children:(0,K.jsx)(J,{name:e.name,description:n(e.name)??e.description??``,hosts:R(e),emptyHosts:`not-added`,onActivate:t?()=>{I(`ok/skill/preview-open`,{surface:`settings`,skill:e.name}),B({flavor:`builtin`,source:t,name:e.name,subtitle:``,level:`global`})}:void 0,control:t?(0,K.jsx)(_,{variant:`outline`,size:`sm`,"data-testid":`builtin-skill-manage-${e.name}`,onClick:()=>{I(`ok/skill/preview-open`,{surface:`settings`,skill:e.name}),B({flavor:`builtin`,source:t,name:e.name,subtitle:``,level:`global`})},children:(0,K.jsx)(r,{id:`wckWOP`})}):void 0})},e.name)},e[24]=n,e[25]=a),N=t.map(a)}e[10]=n,e[11]=s?.skills,e[12]=l,e[13]=a.data,e[14]=D,e[15]=O,e[16]=k,e[17]=A,e[18]=j,e[19]=M,e[20]=N,e[21]=P}else D=e[14],O=e[15],k=e[16],A=e[17],j=e[18],M=e[19],N=e[20],P=e[21];if(j!==Symbol.for(`react.early_return_sentinel`))return j;let F;e[26]!==M||e[27]!==N?(F=(0,K.jsx)(`ul`,{className:M,children:N}),e[26]=M,e[27]=N,e[28]=F):F=e[28];let L;e[29]!==b||e[30]!==D||e[31]!==O||e[32]!==s||e[33]!==m?(L=m&&s!==null&&(0,K.jsx)(me,{open:!0,offer:O,busy:D,onDismiss:S,onInstall:()=>{O&&(I(`ok/skill/install`,{surface:`skills-studio-intro`,mode:`install`,skill:O.id,hostCount:O.resolvedHosts.length}),S(),b(O.id,!0))}}),e[29]=b,e[30]=D,e[31]=O,e[32]=s,e[33]=m,e[34]=L):L=e[34];let H;return e[35]!==k||e[36]!==A||e[37]!==F||e[38]!==L||e[39]!==P?(H=(0,K.jsxs)(`section`,{className:P,"data-testid":k,children:[A,F,L]}),e[35]=k,e[36]=A,e[37]=F,e[38]=L,e[39]=P,e[40]=H):H=e[40],H}function ye(e){return!e.installed&&!e.onboarding}function be(e){return e.managed===!0&&e.scope===`global`}function $(){return ge()}function xe(){let e=(0,G.c)(48),{_:t}=i(),n=Y(),a=z(),o=typeof window<`u`?window.okDesktop:void 0,[s,c]=(0,W.useState)(!1),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(`h4`,{className:`text-sm font-medium`,children:(0,K.jsx)(r,{id:`RojU4W`})}),e[0]=l):l=e[0];let u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsxs)(`div`,{children:[l,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`9hEdtC`})})]}),e[1]=u):u=e[1];let d=u;if(a.status===`error`){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-project-skill`,children:[d,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`project-skill-unavailable`,children:(0,K.jsx)(r,{id:`CXDYfm`})})]}),e[2]=t):t=e[2],t}if(a.status!==`ready`){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-project-skill`,children:[d,(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`pt-1`,"data-testid":`project-skill-loading`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:(0,K.jsx)(r,{id:`VeVIIk`})}),(0,K.jsx)(V,{className:`h-12 w-full`})]})]}),e[3]=t):t=e[3],t}let f,p,m,h,g,y,b,x,S,C,w;if(e[4]!==t||e[5]!==n||e[6]!==s||e[7]!==a.data){m=Symbol.for(`react.early_return_sentinel`);bb0:{let i=a.data.find(Ce)??null;if(i===null){if(!o){m=null;break bb0}let n;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`JHv7ti`})}),e[19]=n):n=e[19];let i;e[20]===t?i=e[21]:(i=()=>{c(!0),o.projectIntegrations.setComponent({component:{kind:`skill`},enabled:!0}).then(Se).catch(e=>{v.error(t({id:`faAcQ3`,values:{0:e instanceof Error?e.message:String(e)}}))}).then(()=>c(!1))},e[20]=t,e[21]=i);let a;e[22]===s?a=e[23]:(a=s?(0,K.jsx)(r,{id:`Wtw22s`}):(0,K.jsx)(r,{id:`TKQ7K-`}),e[22]=s,e[23]=a);let l;e[24]!==s||e[25]!==i||e[26]!==a?(l=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-project-skill`,children:[d,(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border bg-background/50 p-3`,children:[n,(0,K.jsx)(_,{size:`sm`,disabled:s,"data-testid":`project-skill-install`,onClick:i,children:a})]})]}),e[24]=s,e[25]=i,e[26]=a,e[27]=l):l=e[27],m=l;break bb0}let l=X(i.absolutePath),u=n(`project`)??i.description??``;p=l?()=>B({flavor:`builtin`,source:l,name:i.name,subtitle:``,level:`project`}):void 0,S=`space-y-2 rounded-lg border bg-card p-3`,C=`settings-project-skill`,w=d,x=`overflow-hidden rounded-md border border-border bg-background/50`,b=`hover:bg-accent`,f=J,h=i.name,g=u,y=R(i)}e[4]=t,e[5]=n,e[6]=s,e[7]=a.data,e[8]=f,e[9]=p,e[10]=m,e[11]=h,e[12]=g,e[13]=y,e[14]=b,e[15]=x,e[16]=S,e[17]=C,e[18]=w}else f=e[8],p=e[9],m=e[10],h=e[11],g=e[12],y=e[13],b=e[14],x=e[15],S=e[16],C=e[17],w=e[18];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let T;e[28]===p?T=e[29]:(T=p?(0,K.jsx)(_,{variant:`outline`,size:`sm`,onClick:p,"data-testid":`project-skill-manage`,children:(0,K.jsx)(r,{id:`wckWOP`})}):void 0,e[28]=p,e[29]=T);let E;e[30]!==f||e[31]!==p||e[32]!==T||e[33]!==h||e[34]!==g||e[35]!==y?(E=(0,K.jsx)(f,{name:h,description:g,hosts:y,emptyHosts:`not-added`,onActivate:p,control:T}),e[30]=f,e[31]=p,e[32]=T,e[33]=h,e[34]=g,e[35]=y,e[36]=E):E=e[36];let D;e[37]!==E||e[38]!==b?(D=(0,K.jsx)(`li`,{className:b,children:E}),e[37]=E,e[38]=b,e[39]=D):D=e[39];let O;e[40]!==D||e[41]!==x?(O=(0,K.jsx)(`ul`,{className:x,children:D}),e[40]=D,e[41]=x,e[42]=O):O=e[42];let k;return e[43]!==O||e[44]!==S||e[45]!==C||e[46]!==w?(k=(0,K.jsxs)(`section`,{className:S,"data-testid":C,children:[w,O]}),e[43]=O,e[44]=S,e[45]=C,e[46]=w,e[47]=k):k=e[47],k}function Se(e){e.ok?y():v.error(e.error)}function Ce(e){return e.managed===!0&&e.scope===`project`}function we(e){let t=(0,G.c)(15),{scope:n}=e,i=`settings-skills-title-${n}`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(r,{id:`w7LRoP`}),t[0]=a):a=t[0];let o=n===`project`?`project`:`user`,s;t[1]===n?s=t[2]:(s=n===`project`?(0,K.jsx)(r,{id:`0ExRWt`}):(0,K.jsx)(r,{id:`ee15Vl`}),t[1]=n,t[2]=s);let c;t[3]!==o||t[4]!==s||t[5]!==i?(c=(0,K.jsx)(ee,{titleId:i,title:a,scope:o,children:s}),t[3]=o,t[4]=s,t[5]=i,t[6]=c):c=t[6];let l,u;t[7]===n?(l=t[8],u=t[9]):(l=n===`project`?(0,K.jsx)(xe,{}):(0,K.jsx)(ve,{}),u=(0,K.jsx)(ie,{scope:n}),t[7]=n,t[8]=l,t[9]=u);let d;return t[10]!==c||t[11]!==l||t[12]!==u||t[13]!==i?(d=(0,K.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-4`,"data-testid":`settings-skills-section`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=i,t[14]=d):d=t[14],d}export{we as SkillsManagerSection};
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{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o,r as s,t as c}from"./AgentIconCluster-DYP1yNXm.js";import{a as l,c as u,i as d,l as f,o as p,r as m,s as h,t as g}from"./alert-dialog-BA3e7-10.js";import{t as _}from"./button-DzgjsZzC.js";import{n as v}from"./dist-BGzUo_18.js";import{c as y}from"./documents-events-ddyuXdQl.js";import{t as b}from"./createLucideIcon-DdBzwsHe.js";import{t as x}from"./arrow-right-NOQZeKIW.js";import{a as S,h as C,r as w,t as T}from"./dropdown-menu-5XqyQTVx.js";import{t as E}from"./copy-DpWa6i2v.js";import{t as D}from"./trash-2-CchZ0T47.js";import{a as O,c as k,i as A,n as j,o as M,s as N,t as P}from"./dialog-BJEjKJjL.js";import"./constants-skills-BLHVRW90.js";import{t as F}from"./tool-list-format-CS7MZY1Q.js";import{n as I}from"./perf-CPPbaRwr.js";import{t as L}from"./input-BsFOyzfK.js";import{a as R}from"./skill-scope-DOTLd4gL.js";import{t as z}from"./use-skills-B2fLFrq6.js";import{n as B}from"./open-managed-artifact-tab-Bgndx1BG.js";import{t as V}from"./skeleton-CrbF9ppq.js";import{t as H}from"./ChangedOutsideBadge-DhpGZlDx.js";import{t as U}from"./use-skill-targets-DIBQkXNG.js";import{t as ee}from"./SettingsSectionHeader-DDNA1hrR.js";var te=b(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),W=e(n(),1),G=a(),K=t();function q(e){let t=(0,G.c)(25),{icon:n,label:r,detail:i,names:a,tone:o,testId:s}=e,c=o===`destructive`?`text-destructive`:o===`muted`?`text-muted-foreground`:`text-foreground`,l=`mt-0.5 shrink-0 ${c}`,u;t[0]!==n||t[1]!==l?(u=(0,K.jsx)(`span`,{className:l,"aria-hidden":!0,children:n}),t[0]=n,t[1]=l,t[2]=u):u=t[2];let d=`font-medium text-xs ${c}`,f;t[3]!==r||t[4]!==d?(f=(0,K.jsx)(`span`,{className:d,children:r}),t[3]=r,t[4]=d,t[5]=f):f=t[5];let p;t[6]===a.length?p=t[7]:(p=(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:a.length}),t[6]=a.length,t[7]=p);let m;t[8]!==f||t[9]!==p?(m=(0,K.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[f,p]}),t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]===i?h=t[12]:(h=i?(0,K.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:i}):null,t[11]=i,t[12]=h);let g;t[13]===a?g=t[14]:(g=a.map(ne),t[13]=a,t[14]=g);let _;t[15]===g?_=t[16]:(_=(0,K.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5`,children:g}),t[15]=g,t[16]=_);let v;t[17]!==m||t[18]!==h||t[19]!==_?(v=(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h,_]}),t[17]=m,t[18]=h,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u||t[23]!==s?(y=(0,K.jsxs)(`div`,{className:`flex gap-2.5`,"data-testid":s,children:[u,v]}),t[21]=v,t[22]=u,t[23]=s,t[24]=y):y=t[24],y}function ne(e){return(0,K.jsx)(`code`,{className:`break-all text-[11px] text-muted-foreground`,children:e},e)}function re(e){let t=(0,G.c)(51),{open:n,onOpenChange:a,pick:o,keep:s,preview:c,onConfirm:v}=e,{_:y}=i(),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,K.jsx)(f,{children:(0,K.jsx)(r,{id:`Eu-LIb`})}),t[0]=b):b=t[0];let S;t[1]===s?S=t[2]:(S=(0,K.jsxs)(u,{children:[b,(0,K.jsx)(p,{children:(0,K.jsx)(r,{id:`IvKbeq`,values:{keep:s}})})]}),t[1]=s,t[2]=S);let C;t[3]===o?C=t[4]:(C=(0,K.jsx)(`code`,{className:`block break-all font-mono text-[11px]`,children:o}),t[3]=o,t[4]=C);let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:(0,K.jsx)(r,{id:`kjlQ9D`})}),t[5]=w):w=t[5];let T;t[6]===C?T=t[7]:(T=(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 rounded border border-border/60 px-2 py-1.5`,children:[C,w]}),t[6]=C,t[7]=T);let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(x,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),t[8]=O):O=t[8];let k;t[9]===s?k=t[10]:(k=(0,K.jsx)(`code`,{className:`block break-all font-mono text-[11px]`,children:s}),t[9]=s,t[10]=k);let A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:(0,K.jsx)(r,{id:`f1-q9m`})}),t[11]=A):A=t[11];let j;t[12]===k?j=t[13]:(j=(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 rounded border border-border/60 bg-muted/40 px-2 py-1.5`,children:[k,A]}),t[12]=k,t[13]=j);let M;t[14]!==T||t[15]!==j?(M=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`skill-folder-link-direction`,children:[T,O,j]}),t[14]=T,t[15]=j,t[16]=M):M=t[16];let N;t[17]===c.moves?N=t[18]:(N=c.moves.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-moves`,icon:(0,K.jsx)(x,{className:`size-3.5`}),tone:`default`,label:(0,K.jsx)(r,{id:`2Ce6hp`}),names:c.moves}):null,t[17]=c.moves,t[18]=N);let P;t[19]!==y||t[20]!==o||t[21]!==c.drops?(P=c.drops.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-drops`,icon:(0,K.jsx)(E,{className:`size-3.5`}),tone:`muted`,label:(0,K.jsx)(r,{id:`RxF-am`}),detail:y({id:`H8DVOJ`,values:{pick:o}}),names:c.drops}):null,t[19]=y,t[20]=o,t[21]=c.drops,t[22]=P):P=t[22];let F;t[23]!==y||t[24]!==s||t[25]!==c.replaces?(F=c.replaces.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-replaces`,icon:(0,K.jsx)(te,{className:`size-3.5`}),tone:`destructive`,label:(0,K.jsx)(r,{id:`0m4Snh`}),detail:y({id:`jEVipR`,values:{keep:s}}),names:c.replaces}):null,t[23]=y,t[24]=s,t[25]=c.replaces,t[26]=F):F=t[26];let I;t[27]!==y||t[28]!==o||t[29]!==c.removes?(I=c.removes.length>0?(0,K.jsx)(q,{testId:`skill-folder-link-removes`,icon:(0,K.jsx)(D,{className:`size-3.5`}),tone:`destructive`,label:(0,K.jsx)(r,{id:`hs5BRR`}),detail:y({id:`beHZo4`,values:{pick:o}}),names:c.removes}):null,t[27]=y,t[28]=o,t[29]=c.removes,t[30]=I):I=t[30];let L;t[31]!==N||t[32]!==P||t[33]!==F||t[34]!==I?(L=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[N,P,F,I]}),t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L):L=t[35];let R;t[36]!==M||t[37]!==L?(R=(0,K.jsxs)(m,{className:`flex flex-col gap-4 py-1`,children:[M,L]}),t[36]=M,t[37]=L,t[38]=R):R=t[38];let z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,K.jsx)(d,{children:(0,K.jsx)(r,{id:`dEgA5A`})}),t[39]=z):z=t[39];let B;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,K.jsx)(r,{id:`rf0tV1`}),t[40]=B):B=t[40];let V;t[41]===v?V=t[42]:(V=(0,K.jsxs)(h,{children:[z,(0,K.jsx)(_,{onClick:v,"data-testid":`skill-folder-link-confirm`,children:B})]}),t[41]=v,t[42]=V);let H;t[43]!==R||t[44]!==V||t[45]!==S?(H=(0,K.jsxs)(l,{children:[S,R,V]}),t[43]=R,t[44]=V,t[45]=S,t[46]=H):H=t[46];let U;return t[47]!==a||t[48]!==n||t[49]!==H?(U=(0,K.jsx)(g,{open:n,onOpenChange:a,children:H}),t[47]=a,t[48]=n,t[49]=H,t[50]=U):U=t[50],U}function ie(e){let t=(0,G.c)(67),{scope:n}=e,{i18n:a,_:o}=i(),{state:l,saving:u,folderAction:d}=U(),[f,p]=(0,W.useState)(``),[m,h]=(0,W.useState)(null),g,y,b,x,E;if(t[0]!==o||t[1]!==d||t[2]!==a||t[3]!==m||t[4]!==u||t[5]!==n||t[6]!==l.data||t[7]!==l.message||t[8]!==l.status){let e=l.status===`ready`?(l.data.folders??[]).filter(e=>e.scope===n):[],i=new Map(e.map(de)),f=e=>(e.state===`linked`||e.state===`linked-parent`)&&typeof e.target==`string`&&i.has(e.target),p=new Map;for(let t of e){if(!f(t))continue;let e=t.target;p.set(e,[...p.get(e)??[],t])}let D;t[14]===f?D=t[15]:(D=e=>!f(e),t[14]=f,t[15]=D);let O=e.filter(D),k;t[16]!==d||t[17]!==n?(k=(e,t,r)=>{d({scope:n,root:e,action:t,...r===void 0?{}:{target:r}}).catch(ue)},t[16]=d,t[17]=n,t[18]=k):k=t[18];let A=k,j;t[19]===n?j=t[20]:(j=e=>n===`global`?`~/${e}`:e,t[19]=n,t[20]=j);let M=j,N;t[21]!==o||t[22]!==M||t[23]!==d||t[24]!==n?(N=(e,t)=>{let r=M(e),i=M(t);d({scope:n,root:e,action:`link`,target:t,preview:!0}).then(a=>{if(!a){v.error(o({id:`KkRyMI`}));return}if(a.conflicts.length>0){v.error(o({id:`l2BOXd`,values:{0:a.conflicts.join(`, `),pick:r,keep:i}}));return}if(a.strays.length>0){v.error(o({id:`-qBQVd`,values:{0:a.strays.join(`, `),pick:r}}));return}if(a.moves.length+a.removes.length+a.replaces.length>0){h({root:e,target:t,pick:r,keep:i,preview:a});return}return d({scope:n,root:e,action:`link`,target:t})}).catch(le)},t[21]=o,t[22]=M,t[23]=d,t[24]=n,t[25]=N):N=t[25];let P=N,I;t[26]!==d||t[27]!==m||t[28]!==n?(I=()=>{if(!m)return;let{root:e,target:t}=m;h(null),d({scope:n,root:e,action:`link`,target:t}).catch(ce)},t[26]=d,t[27]=m,t[28]=n,t[29]=I):I=t[29],g=I,y=`space-y-2 rounded-lg border bg-card p-3`,b=`settings-skill-folders`;let L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,K.jsx)(`h4`,{className:`text-sm font-medium`,children:(0,K.jsx)(r,{id:`59CUI8`})}),t[30]=L):L=t[30],t[31]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,K.jsxs)(`div`,{children:[L,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`J_jZ5z`})})]}),t[31]=x):x=t[31],E=l.status===`error`?(0,K.jsx)(`div`,{className:`text-1sm text-destructive`,role:`alert`,"data-testid":`skill-targets-error`,children:(0,K.jsx)(r,{id:`ACKMCN`,values:{0:l.message}})}):l.status===`ready`?(0,K.jsx)(`ul`,{className:`space-y-1 pt-1`,children:O.map(t=>{let i=M(t.root),l=p.get(t.root)??[],d=se,f=e.filter(e=>e.root!==t.root&&(e.state===`own`||e.state===`absent`)&&!d(e)),m=(t.state===`own`||t.state===`absent`)&&!d(t);return(0,K.jsxs)(`li`,{className:`text-sm`,"data-testid":`skill-folder-row-${t.host}`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(c,{host:t.host,"aria-hidden":!0,className:`size-4 shrink-0`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:[i,t.state===`linked`||t.state===`linked-parent`?(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[` → `,t.target??`?`]}):null]}),t.drift?(0,K.jsx)(H,{testId:`skill-folder-drift-${t.host}`,title:o({id:`p3m_Gk`,values:{0:t.expected??``}})}):null,t.state===`linked-parent`?(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground uppercase tracking-wide`,title:o({id:`yLwx9e`}),children:(0,K.jsx)(r,{id:`nf0wk0`})}):null,d(t)?(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,title:o({id:`QP9OU3`}),"data-testid":`skill-folder-hub-destination-only`,children:(0,K.jsx)(r,{id:`mPoOmg`})}):null,m&&f.length>0?(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{asChild:!0,children:(0,K.jsx)(_,{size:`sm`,variant:`ghost`,disabled:u,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] uppercase tracking-wide text-muted-foreground hover:text-foreground`,title:o({id:`g5w1sF`,values:{display:i}}),"data-testid":`skill-folder-link-${t.host}`,children:(0,K.jsx)(r,{id:`yzF66j`})})}),(0,K.jsx)(w,{align:`end`,className:`w-auto`,children:f.map(e=>(0,K.jsxs)(S,{onSelect:()=>P(e.root,t.root),"data-testid":`skill-folder-link-${t.host}-to-${e.root}`,children:[(0,K.jsx)(c,{host:e.host,"aria-hidden":!0,className:`size-4`}),(0,K.jsx)(`span`,{className:`font-mono text-xs`,children:n===`global`?`~/${e.root}`:e.root})]},e.root))})]}):null,t.state===`linked`?(0,K.jsx)(_,{size:`sm`,variant:`ghost`,disabled:u,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] uppercase tracking-wide text-muted-foreground hover:text-foreground`,title:o({id:`MQ5LOx`,values:{display:i}}),onClick:()=>A(t.root,`unlink`),"data-testid":`skill-folder-unlink-${t.host}`,children:(0,K.jsx)(r,{id:`ptQ3_N`})}):null]}),l.length>0?(0,K.jsx)(`p`,{className:`mt-1 ml-6 text-muted-foreground text-xs`,"data-testid":`skill-folder-shared-${t.host}`,children:o({id:`OOLsBh`,values:{0:F([t.host,...l.map(oe)].map(s),a.locale)}})}):null,l.length>0?(0,K.jsx)(`ul`,{className:`mt-1 ml-2 space-y-1 border-border/60 border-l pl-3`,"data-testid":`skill-folder-followers-${t.host}`,children:l.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(c,{host:e.host,"aria-hidden":!0,className:`size-4 shrink-0`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground text-xs`,children:n===`global`?`~/${e.root}`:e.root}),e.drift?(0,K.jsx)(H,{testId:`skill-folder-drift-${e.host}`,title:o({id:`p3m_Gk`,values:{0:e.expected??``}})}):null,e.state===`linked-parent`?(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground uppercase tracking-wide`,title:o({id:`yLwx9e`}),children:(0,K.jsx)(r,{id:`Ef6ukL`})}):(0,K.jsx)(_,{size:`sm`,variant:`ghost`,disabled:u,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide hover:text-foreground`,title:o({id:`9_2oe6`,values:{0:n===`global`?`~/${e.root}`:e.root}}),onClick:()=>A(e.root,`unlink`),"data-testid":`skill-folder-unlink-${e.host}`,children:(0,K.jsx)(r,{id:`ptQ3_N`})})]},e.host))}):null]},t.host)})}):(0,K.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,K.jsx)(V,{className:`h-5 w-56`}),(0,K.jsx)(V,{className:`h-5 w-56`})]}),t[0]=o,t[1]=d,t[2]=a,t[3]=m,t[4]=u,t[5]=n,t[6]=l.data,t[7]=l.message,t[8]=l.status,t[9]=g,t[10]=y,t[11]=b,t[12]=x,t[13]=E}else g=t[9],y=t[10],b=t[11],x=t[12],E=t[13];let D;t[32]!==d||t[33]!==f||t[34]!==n?(D=e=>{e.preventDefault();let t=f.trim().replace(/^~\//,``);t!==``&&d({scope:n,root:t,action:`add-root`}).then(()=>p(``)).catch(ae)},t[32]=d,t[33]=f,t[34]=n,t[35]=D):D=t[35];let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>p(e.target.value),t[36]=O):O=t[36];let k;t[37]===o?k=t[38]:(k=o({id:`oyBV3W`}),t[37]=o,t[38]=k);let A;t[39]!==o||t[40]!==n?(A=o(n===`global`?{id:`Wboy1j`}:{id:`jpoCue`}),t[39]=o,t[40]=n,t[41]=A):A=t[41];let j;t[42]!==f||t[43]!==u||t[44]!==k||t[45]!==A?(j=(0,K.jsx)(L,{value:f,onChange:O,"aria-label":k,placeholder:A,className:`h-7 flex-1 font-mono text-xs`,disabled:u,"data-testid":`skill-folders-add-root-input`}),t[42]=f,t[43]=u,t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==f||t[48]!==u?(M=u||f.trim()===``,t[47]=f,t[48]=u,t[49]=M):M=t[49];let N;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,K.jsx)(r,{id:`ZW2yR_`}),t[50]=N):N=t[50];let P;t[51]===M?P=t[52]:(P=(0,K.jsx)(_,{type:`submit`,size:`sm`,variant:`secondary`,disabled:M,className:`h-7 px-2 font-normal text-xs`,children:N}),t[51]=M,t[52]=P);let I;t[53]!==P||t[54]!==D||t[55]!==j?(I=(0,K.jsxs)(`form`,{className:`flex items-center gap-2 pt-1`,onSubmit:D,"data-testid":`skill-folders-add-root`,children:[j,P]}),t[53]=P,t[54]=D,t[55]=j,t[56]=I):I=t[56];let R;t[57]!==g||t[58]!==m?(R=m?(0,K.jsx)(re,{open:!0,onOpenChange:e=>{e||h(null)},pick:m.pick,keep:m.keep,preview:m.preview,onConfirm:g}):null,t[57]=g,t[58]=m,t[59]=R):R=t[59];let z;return t[60]!==y||t[61]!==I||t[62]!==R||t[63]!==b||t[64]!==x||t[65]!==E?(z=(0,K.jsxs)(`section`,{className:y,"data-testid":b,children:[x,E,I,R]}),t[60]=y,t[61]=I,t[62]=R,t[63]=b,t[64]=x,t[65]=E,t[66]=z):z=t[66],z}function ae(e){return v.error(e instanceof Error?e.message:String(e))}function oe(e){return e.host}function se(e){return e.root===`.agents/skills`&&e.state===`absent`}function ce(e){return v.error(e instanceof Error?e.message:String(e))}function le(e){return v.error(e instanceof Error?e.message:String(e))}function ue(e){return v.error(e instanceof Error?e.message:String(e))}function de(e){return[e.root,e]}function J(e){let t=(0,G.c)(22),{name:n,description:i,hosts:a,emptyHosts:s,onActivate:c,ariaExpanded:l,control:u}=e,d;t[0]===n?d=t[1]:(d=(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground group-hover/button:underline`,children:(0,K.jsx)(`code`,{children:n})}),t[0]=n,t[1]=d);let f;t[2]===i?f=t[3]:(f=(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i}),t[2]=i,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,K.jsxs)(K.Fragment,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m=p,h;t[7]!==l||t[8]!==m||t[9]!==c?(h=c?(0,K.jsx)(_,{variant:`ghost`,onClick:c,"aria-expanded":l,className:`group/button h-auto w-full flex-col items-start justify-start gap-0.5 whitespace-normal p-0 text-left hover:bg-transparent`,"data-testid":`skill-consent-row-preview`,children:m}):(0,K.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:m}),t[7]=l,t[8]=m,t[9]=c,t[10]=h):h=t[10];let g;t[11]!==s||t[12]!==a?(g=(0,K.jsx)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.length>0?(0,K.jsx)(o,{hosts:a}):(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`skill-consent-row-no-hosts`,children:s===`not-added`?(0,K.jsx)(r,{id:`zP6U1P`}):(0,K.jsx)(r,{id:`yOjRUV`})})}),t[11]=s,t[12]=a,t[13]=g):g=t[13];let v;t[14]!==h||t[15]!==g?(v=(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[h,g]}),t[14]=h,t[15]=g,t[16]=v):v=t[16];let y;t[17]===u?y=t[18]:(y=u?(0,K.jsx)(`span`,{className:`shrink-0`,children:u}):null,t[17]=u,t[18]=y);let b;return t[19]!==v||t[20]!==y?(b=(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5 px-3 py-2.5`,"data-testid":`skill-consent-row`,children:[v,y]}),t[19]=v,t[20]=y,t[21]=b):b=t[21],b}function fe(e){let t=(0,G.c)(4),{paths:n}=e,r;t[0]===n?r=t[1]:(r=n.map(pe),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,K.jsx)(`ul`,{className:`flex flex-col gap-0.5`,"data-testid":`skill-destination-list`,children:r}),t[2]=r,t[3]=i),i}function pe(e){return(0,K.jsx)(`li`,{children:(0,K.jsx)(`code`,{className:`break-all text-xs text-muted-foreground`,children:e})},e)}function Y(){let{_:e}=i();return t=>{switch(t){case`discovery`:case`open-knowledge-discovery`:return e({id:`olb6oq`});case`write-skill`:case`open-knowledge-write-skill`:return e({id:`I-6_4S`});case`project`:case`open-knowledge`:return e({id:`UMT9C9`});default:return null}}}function X(e){if(!e)return null;let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>0?e.slice(0,t):null}function me(e){let t=(0,G.c)(22),{open:n,onDismiss:a,offer:o,onInstall:s,busy:c}=e,l=c===void 0?!1:c,{_:u}=i(),d=Y(),f=o!==null&&o.resolvedHosts.length>0,p;t[0]===a?p=t[1]:(p=e=>{e||a()},t[0]=a,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(k,{children:(0,K.jsx)(r,{id:`w7LRoP`})}),t[2]=m):m=t[2];let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsxs)(N,{children:[m,(0,K.jsx)(O,{children:(0,K.jsx)(r,{id:`tX8FLX`})})]}),t[3]=h):h=t[3];let g;t[4]!==d||t[5]!==f||t[6]!==o?(g=o!==null&&(0,K.jsxs)(j,{className:`flex flex-col gap-3 py-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,K.jsx)(r,{id:`oy5bJW`})}),(0,K.jsx)(`div`,{className:`rounded-md border border-border bg-card/50`,children:(0,K.jsx)(J,{name:o.name,description:d(o.id)??o.description,hosts:o.resolvedHosts.map(he),emptyHosts:`none-detected`})}),f&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,K.jsx)(r,{id:`0CvV_9`})}),(0,K.jsx)(fe,{paths:o.paths})]})]}),t[4]=d,t[5]=f,t[6]=o,t[7]=g):g=t[7];let v;t[8]!==u||t[9]!==l||t[10]!==f||t[11]!==o||t[12]!==a||t[13]!==s?(v=(0,K.jsx)(M,{children:o===null?(0,K.jsx)(_,{onClick:a,"data-testid":`skills-studio-intro-ack`,children:(0,K.jsx)(r,{id:`76gPWk`})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{variant:`outline`,onClick:a,"data-testid":`skills-studio-intro-dismiss`,children:(0,K.jsx)(r,{id:`PBxg_E`})}),(0,K.jsx)(_,{onClick:s,disabled:l||!f,"aria-label":u({id:`fGqEFq`,values:{0:o.name}}),"data-testid":`skills-studio-intro-install`,children:(0,K.jsx)(r,{id:`TKQ7K-`})})]})}),t[8]=u,t[9]=l,t[10]=f,t[11]=o,t[12]=a,t[13]=s,t[14]=v):v=t[14];let y;t[15]!==g||t[16]!==v?(y=(0,K.jsxs)(A,{className:`sm:max-w-md`,"data-testid":`skills-studio-intro`,children:[h,g,v]}),t[15]=g,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==n||t[19]!==p||t[20]!==y?(b=(0,K.jsx)(P,{open:n,onOpenChange:p,children:y}),t[18]=n,t[19]=p,t[20]=y,t[21]=b):b=t[21],b}function he(e){return e.editor}var Z=`ok-skills-studio-intro-seen-v1`;function Q(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function ge(e){let t=e===void 0?Q():e;if(!t)return!0;try{return t.getItem(Z)!==null}catch{return!0}}function _e(e){let t=e===void 0?Q():e;if(t)try{t.setItem(Z,new Date().toISOString())}catch{}}function ve(){let e=(0,G.c)(41),{_:t}=i(),n=Y(),a=z(),o=typeof window<`u`?window.okDesktop??null:null,[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d]=(0,W.useState)($),[f,p]=(0,W.useState)(!1),m=!d&&!f,h,g;e[0]===m?(h=e[1],g=e[2]):(h=()=>{if(!o||!m)return;let e=!1;return o.integrations.status().then(t=>{e||c(t)}).catch(t=>{console.warn(`[skills-studio] bridge integrations.status failed; intro skipped:`,t),e||p(!0)}),()=>{e=!0}},g=[o,m],e[0]=m,e[1]=h,e[2]=g),(0,W.useEffect)(h,g);let y;e[3]===t?y=e[4]:(y=async function(e,n){if(o){u(!0);try{let t=await o.integrations.setComponent({component:{kind:`skill`,id:e},enabled:n});c(t.status),t.ok||v.error(t.error)}catch(e){let n=e;v.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}u(!1)}},e[3]=t,e[4]=y);let b=y,x;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){_e(),p(!0)},e[5]=x):x=e[5];let S=x,C;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,K.jsx)(`h4`,{className:`text-sm font-medium`,children:(0,K.jsx)(r,{id:`RojU4W`})}),e[6]=C):C=e[6];let w;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(`div`,{children:[C,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`kEiVv6`})})]}),e[7]=w):w=e[7];let T=w;if(a.status===`error`){let t;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-builtin-skills`,children:[T,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`builtin-skills-unavailable`,children:(0,K.jsx)(r,{id:`annvv7`})})]}),e[8]=t):t=e[8],t}if(a.status!==`ready`){let t;return e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-builtin-skills`,children:[T,(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 pt-1`,"data-testid":`builtin-skills-loading`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:(0,K.jsx)(r,{id:`VeVIIk`})}),(0,K.jsx)(V,{className:`h-12 w-full`}),(0,K.jsx)(V,{className:`h-12 w-full`})]})]}),e[9]=t):t=e[9],t}let E=a.data,D,O,k,A,j,M,N,P;if(e[10]!==n||e[11]!==s?.skills||e[12]!==l||e[13]!==a.data){j=Symbol.for(`react.early_return_sentinel`);bb0:{let t=E.filter(be);if(t.length===0){j=null;break bb0}D=l;let i;e[22]===s?.skills?i=e[23]:(i=s?.skills.find(ye)??null,e[22]=s?.skills,e[23]=i),O=i,P=`space-y-2 rounded-lg border bg-card p-3`,k=`settings-builtin-skills`,A=T,M=`divide-y divide-border overflow-hidden rounded-md border border-border bg-background/50`;let a;e[24]===n?a=e[25]:(a=e=>{let t=X(e.absolutePath);return(0,K.jsx)(`li`,{className:`hover:bg-accent`,children:(0,K.jsx)(J,{name:e.name,description:n(e.name)??e.description??``,hosts:R(e),emptyHosts:`not-added`,onActivate:t?()=>{I(`ok/skill/preview-open`,{surface:`settings`,skill:e.name}),B({flavor:`builtin`,source:t,name:e.name,subtitle:``,level:`global`})}:void 0,control:t?(0,K.jsx)(_,{variant:`outline`,size:`sm`,"data-testid":`builtin-skill-manage-${e.name}`,onClick:()=>{I(`ok/skill/preview-open`,{surface:`settings`,skill:e.name}),B({flavor:`builtin`,source:t,name:e.name,subtitle:``,level:`global`})},children:(0,K.jsx)(r,{id:`wckWOP`})}):void 0})},e.name)},e[24]=n,e[25]=a),N=t.map(a)}e[10]=n,e[11]=s?.skills,e[12]=l,e[13]=a.data,e[14]=D,e[15]=O,e[16]=k,e[17]=A,e[18]=j,e[19]=M,e[20]=N,e[21]=P}else D=e[14],O=e[15],k=e[16],A=e[17],j=e[18],M=e[19],N=e[20],P=e[21];if(j!==Symbol.for(`react.early_return_sentinel`))return j;let F;e[26]!==M||e[27]!==N?(F=(0,K.jsx)(`ul`,{className:M,children:N}),e[26]=M,e[27]=N,e[28]=F):F=e[28];let L;e[29]!==b||e[30]!==D||e[31]!==O||e[32]!==s||e[33]!==m?(L=m&&s!==null&&(0,K.jsx)(me,{open:!0,offer:O,busy:D,onDismiss:S,onInstall:()=>{O&&(I(`ok/skill/install`,{surface:`skills-studio-intro`,mode:`install`,skill:O.id,hostCount:O.resolvedHosts.length}),S(),b(O.id,!0))}}),e[29]=b,e[30]=D,e[31]=O,e[32]=s,e[33]=m,e[34]=L):L=e[34];let H;return e[35]!==k||e[36]!==A||e[37]!==F||e[38]!==L||e[39]!==P?(H=(0,K.jsxs)(`section`,{className:P,"data-testid":k,children:[A,F,L]}),e[35]=k,e[36]=A,e[37]=F,e[38]=L,e[39]=P,e[40]=H):H=e[40],H}function ye(e){return!e.installed&&!e.onboarding}function be(e){return e.managed===!0&&e.scope===`global`}function $(){return ge()}function xe(){let e=(0,G.c)(48),{_:t}=i(),n=Y(),a=z(),o=typeof window<`u`?window.okDesktop:void 0,[s,c]=(0,W.useState)(!1),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(`h4`,{className:`text-sm font-medium`,children:(0,K.jsx)(r,{id:`RojU4W`})}),e[0]=l):l=e[0];let u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsxs)(`div`,{children:[l,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`9hEdtC`})})]}),e[1]=u):u=e[1];let d=u;if(a.status===`error`){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-project-skill`,children:[d,(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`project-skill-unavailable`,children:(0,K.jsx)(r,{id:`CXDYfm`})})]}),e[2]=t):t=e[2],t}if(a.status!==`ready`){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-project-skill`,children:[d,(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`pt-1`,"data-testid":`project-skill-loading`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:(0,K.jsx)(r,{id:`VeVIIk`})}),(0,K.jsx)(V,{className:`h-12 w-full`})]})]}),e[3]=t):t=e[3],t}let f,p,m,h,g,y,b,x,S,C,w;if(e[4]!==t||e[5]!==n||e[6]!==s||e[7]!==a.data){m=Symbol.for(`react.early_return_sentinel`);bb0:{let i=a.data.find(Ce)??null;if(i===null){if(!o){m=null;break bb0}let n;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,K.jsx)(r,{id:`JHv7ti`})}),e[19]=n):n=e[19];let i;e[20]===t?i=e[21]:(i=()=>{c(!0),o.projectIntegrations.setComponent({component:{kind:`skill`},enabled:!0}).then(Se).catch(e=>{v.error(t({id:`faAcQ3`,values:{0:e instanceof Error?e.message:String(e)}}))}).then(()=>c(!1))},e[20]=t,e[21]=i);let a;e[22]===s?a=e[23]:(a=s?(0,K.jsx)(r,{id:`Wtw22s`}):(0,K.jsx)(r,{id:`TKQ7K-`}),e[22]=s,e[23]=a);let l;e[24]!==s||e[25]!==i||e[26]!==a?(l=(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border bg-card p-3`,"data-testid":`settings-project-skill`,children:[d,(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border bg-background/50 p-3`,children:[n,(0,K.jsx)(_,{size:`sm`,disabled:s,"data-testid":`project-skill-install`,onClick:i,children:a})]})]}),e[24]=s,e[25]=i,e[26]=a,e[27]=l):l=e[27],m=l;break bb0}let l=X(i.absolutePath),u=n(`project`)??i.description??``;p=l?()=>B({flavor:`builtin`,source:l,name:i.name,subtitle:``,level:`project`}):void 0,S=`space-y-2 rounded-lg border bg-card p-3`,C=`settings-project-skill`,w=d,x=`overflow-hidden rounded-md border border-border bg-background/50`,b=`hover:bg-accent`,f=J,h=i.name,g=u,y=R(i)}e[4]=t,e[5]=n,e[6]=s,e[7]=a.data,e[8]=f,e[9]=p,e[10]=m,e[11]=h,e[12]=g,e[13]=y,e[14]=b,e[15]=x,e[16]=S,e[17]=C,e[18]=w}else f=e[8],p=e[9],m=e[10],h=e[11],g=e[12],y=e[13],b=e[14],x=e[15],S=e[16],C=e[17],w=e[18];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let T;e[28]===p?T=e[29]:(T=p?(0,K.jsx)(_,{variant:`outline`,size:`sm`,onClick:p,"data-testid":`project-skill-manage`,children:(0,K.jsx)(r,{id:`wckWOP`})}):void 0,e[28]=p,e[29]=T);let E;e[30]!==f||e[31]!==p||e[32]!==T||e[33]!==h||e[34]!==g||e[35]!==y?(E=(0,K.jsx)(f,{name:h,description:g,hosts:y,emptyHosts:`not-added`,onActivate:p,control:T}),e[30]=f,e[31]=p,e[32]=T,e[33]=h,e[34]=g,e[35]=y,e[36]=E):E=e[36];let D;e[37]!==E||e[38]!==b?(D=(0,K.jsx)(`li`,{className:b,children:E}),e[37]=E,e[38]=b,e[39]=D):D=e[39];let O;e[40]!==D||e[41]!==x?(O=(0,K.jsx)(`ul`,{className:x,children:D}),e[40]=D,e[41]=x,e[42]=O):O=e[42];let k;return e[43]!==O||e[44]!==S||e[45]!==C||e[46]!==w?(k=(0,K.jsxs)(`section`,{className:S,"data-testid":C,children:[w,O]}),e[43]=O,e[44]=S,e[45]=C,e[46]=w,e[47]=k):k=e[47],k}function Se(e){e.ok?y():v.error(e.error)}function Ce(e){return e.managed===!0&&e.scope===`project`}function we(e){let t=(0,G.c)(15),{scope:n}=e,i=`settings-skills-title-${n}`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(r,{id:`w7LRoP`}),t[0]=a):a=t[0];let o=n===`project`?`project`:`user`,s;t[1]===n?s=t[2]:(s=n===`project`?(0,K.jsx)(r,{id:`0ExRWt`}):(0,K.jsx)(r,{id:`ee15Vl`}),t[1]=n,t[2]=s);let c;t[3]!==o||t[4]!==s||t[5]!==i?(c=(0,K.jsx)(ee,{titleId:i,title:a,scope:o,children:s}),t[3]=o,t[4]=s,t[5]=i,t[6]=c):c=t[6];let l,u;t[7]===n?(l=t[8],u=t[9]):(l=n===`project`?(0,K.jsx)(xe,{}):(0,K.jsx)(ve,{}),u=(0,K.jsx)(ie,{scope:n}),t[7]=n,t[8]=l,t[9]=u);let d;return t[10]!==c||t[11]!==l||t[12]!==u||t[13]!==i?(d=(0,K.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-4`,"data-testid":`settings-skills-section`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=i,t[14]=d):d=t[14],d}export{we as SkillsManagerSection};
@@ -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{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-DzgjsZzC.js";import{t as s}from"./arrow-up-right-nJaICi16.js";import{t as c}from"./terminal-Cpb4l1oH.js";import{n as l}from"./use-settings-route-Bj-m9X61.js";import{r as u,t as d}from"./terminal-command-events-h-p66odT.js";import{i as f,n as p,t as m}from"./input-group-xi315pKE.js";import{t as h}from"./external-link-8lDpeCuR.js";import{t as g}from"./CopyButton-BTy3joJd.js";import{t as _}from"./SettingsSectionHeader-BKhNIRp2.js";var v=a(),y=e(n(),1),b=t(),x=u(`install-slidev`)??``,S=`https://sli.dev/guide/install`,C=`https://openknowledge.ai/docs/plugins/slidev`;function w(){let e=(0,v.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={kind:`checking`},e[0]=t):t=e[0];let[n,r]=(0,y.useState)(t),i,a;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=!0,t=()=>{let t=window.okDesktop?.slides;if(t==null){r({kind:`unsupported`});return}t.status().then(t=>{e&&r(t.available?{kind:`available`,source:t.source}:{kind:`missing`})}).catch(t=>{console.warn(`[slides] settings availability probe failed:`,t),e&&r({kind:`check-failed`})})};return t(),window.addEventListener(`focus`,t),()=>{e=!1,window.removeEventListener(`focus`,t)}},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,y.useEffect)(i,a),n}function T(){let e=window.okDesktop;return e?.terminal!=null&&e.config?.ptyAvailable===!0}function E(e){let t=(0,v.c)(23),{availability:n}=e,{_:a}=i();if(n.kind===`checking`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-checking`,children:(0,b.jsx)(r,{id:`P8AnMN`})}),t[0]=e):e=t[0],e}if(n.kind===`check-failed`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-check-failed`,children:(0,b.jsx)(r,{id:`49Mb7P`})}),t[1]=e):e=t[1],e}if(n.kind===`unsupported`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-unsupported`,children:(0,b.jsx)(r,{id:`lScd1O`})}),t[2]=e):e=t[2],e}if(n.kind===`available`){let e;return t[3]===n.source?e=t[4]:(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-available`,children:n.source===`project-local`?(0,b.jsx)(r,{id:`el2KyL`}):(0,b.jsx)(r,{id:`xxRpzT`})}),t[3]=n.source,t[4]=e),e}let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,b.jsx)(`p`,{className:`text-sm text-warning`,children:(0,b.jsx)(r,{id:`HPaAxt`})}),t[5]=l):l=t[5];let u;t[6]===a?u=t[7]:(u=a({id:`hz076O`}),t[6]=a,t[7]=u);let d;t[8]===u?d=t[9]:(d=(0,b.jsx)(f,{readOnly:!0,value:x,"aria-label":u,className:`font-mono text-xs`,"data-testid":`slides-install-command`,onFocus:A}),t[8]=u,t[9]=d);let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,b.jsx)(p,{align:`inline-end`,children:(0,b.jsx)(g,{copyContent:x})}),t[10]=h):h=t[10];let _;t[11]===d?_=t[12]:(_=(0,b.jsxs)(m,{children:[d,h]}),t[11]=d,t[12]=_);let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y=T()?(0,b.jsxs)(o,{type:`button`,size:`sm`,variant:`outline`,"data-testid":`slides-run-install`,onClick:k,children:[(0,b.jsx)(c,{"aria-hidden":!0,className:`size-3.5`}),(0,b.jsx)(r,{id:`hVAkI8`})]}):null,t[13]=y):y=t[13];let C;t[14]===a?C=t[15]:(C=a({id:`NfraGd`}),t[14]=a,t[15]=C);let w,E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,b.jsx)(r,{id:`1NgrlY`}),E=(0,b.jsx)(s,{"aria-hidden":!0,className:`size-3`}),t[16]=w,t[17]=E):(w=t[16],E=t[17]);let j;t[18]===C?j=t[19]:(j=(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[y,(0,b.jsxs)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,onClick:O,onAuxClick:D,"aria-label":C,className:`inline-flex items-center gap-0.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`slides-install-docs-link`,children:[w,E]})]}),t[18]=C,t[19]=j);let M;return t[20]!==j||t[21]!==_?(M=(0,b.jsxs)(`div`,{className:`space-y-3`,"data-testid":`slides-status-missing`,children:[l,_,j]}),t[20]=j,t[21]=_,t[22]=M):M=t[22],M}function D(e){return h(e,S)}function O(e){return h(e,S)}function k(){typeof window<`u`&&l(window.location.hash)&&window.history.back(),d(`install-slidev`)}function A(e){return e.currentTarget.select()}function j(){let e=(0,v.c)(3),t=w(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,b.jsx)(_,{titleId:`settings-plugin-slides-title`,title:`Slidev`,scope:`user`,beta:!0,docUrl:C,children:(0,b.jsx)(r,{id:`L3w0_C`,components:{0:(0,b.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,b.jsxs)(`section`,{"aria-labelledby":`settings-plugin-slides-title`,className:`space-y-4`,"data-testid":`settings-plugin-slides`,children:[n,(0,b.jsx)(`div`,{"aria-live":`polite`,children:(0,b.jsx)(E,{availability:t})})]}),e[1]=t,e[2]=i),i}export{j as SlidesPluginSection};
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{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-DzgjsZzC.js";import{t as s}from"./arrow-up-right-nJaICi16.js";import{t as c}from"./terminal-Cpb4l1oH.js";import{n as l}from"./use-settings-route-Bj-m9X61.js";import{r as u,t as d}from"./terminal-command-events-h-p66odT.js";import{i as f,n as p,t as m}from"./input-group-xi315pKE.js";import{t as h}from"./external-link-8lDpeCuR.js";import{t as g}from"./CopyButton-BTy3joJd.js";import{t as _}from"./SettingsSectionHeader-DDNA1hrR.js";var v=a(),y=e(n(),1),b=t(),x=u(`install-slidev`)??``,S=`https://sli.dev/guide/install`,C=`https://openknowledge.ai/docs/plugins/slidev`;function w(){let e=(0,v.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={kind:`checking`},e[0]=t):t=e[0];let[n,r]=(0,y.useState)(t),i,a;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=!0,t=()=>{let t=window.okDesktop?.slides;if(t==null){r({kind:`unsupported`});return}t.status().then(t=>{e&&r(t.available?{kind:`available`,source:t.source}:{kind:`missing`})}).catch(t=>{console.warn(`[slides] settings availability probe failed:`,t),e&&r({kind:`check-failed`})})};return t(),window.addEventListener(`focus`,t),()=>{e=!1,window.removeEventListener(`focus`,t)}},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,y.useEffect)(i,a),n}function T(){let e=window.okDesktop;return e?.terminal!=null&&e.config?.ptyAvailable===!0}function E(e){let t=(0,v.c)(23),{availability:n}=e,{_:a}=i();if(n.kind===`checking`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-checking`,children:(0,b.jsx)(r,{id:`P8AnMN`})}),t[0]=e):e=t[0],e}if(n.kind===`check-failed`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-check-failed`,children:(0,b.jsx)(r,{id:`49Mb7P`})}),t[1]=e):e=t[1],e}if(n.kind===`unsupported`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-unsupported`,children:(0,b.jsx)(r,{id:`lScd1O`})}),t[2]=e):e=t[2],e}if(n.kind===`available`){let e;return t[3]===n.source?e=t[4]:(e=(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`slides-status-available`,children:n.source===`project-local`?(0,b.jsx)(r,{id:`el2KyL`}):(0,b.jsx)(r,{id:`xxRpzT`})}),t[3]=n.source,t[4]=e),e}let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,b.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,children:(0,b.jsx)(r,{id:`HPaAxt`})}),t[5]=l):l=t[5];let u;t[6]===a?u=t[7]:(u=a({id:`hz076O`}),t[6]=a,t[7]=u);let d;t[8]===u?d=t[9]:(d=(0,b.jsx)(f,{readOnly:!0,value:x,"aria-label":u,className:`font-mono text-xs`,"data-testid":`slides-install-command`,onFocus:A}),t[8]=u,t[9]=d);let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,b.jsx)(p,{align:`inline-end`,children:(0,b.jsx)(g,{copyContent:x})}),t[10]=h):h=t[10];let _;t[11]===d?_=t[12]:(_=(0,b.jsxs)(m,{children:[d,h]}),t[11]=d,t[12]=_);let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y=T()?(0,b.jsxs)(o,{type:`button`,size:`sm`,variant:`outline`,"data-testid":`slides-run-install`,onClick:k,children:[(0,b.jsx)(c,{"aria-hidden":!0,className:`size-3.5`}),(0,b.jsx)(r,{id:`hVAkI8`})]}):null,t[13]=y):y=t[13];let C;t[14]===a?C=t[15]:(C=a({id:`NfraGd`}),t[14]=a,t[15]=C);let w,E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,b.jsx)(r,{id:`1NgrlY`}),E=(0,b.jsx)(s,{"aria-hidden":!0,className:`size-3`}),t[16]=w,t[17]=E):(w=t[16],E=t[17]);let j;t[18]===C?j=t[19]:(j=(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[y,(0,b.jsxs)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,onClick:O,onAuxClick:D,"aria-label":C,className:`inline-flex items-center gap-0.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`slides-install-docs-link`,children:[w,E]})]}),t[18]=C,t[19]=j);let M;return t[20]!==j||t[21]!==_?(M=(0,b.jsxs)(`div`,{className:`space-y-3`,"data-testid":`slides-status-missing`,children:[l,_,j]}),t[20]=j,t[21]=_,t[22]=M):M=t[22],M}function D(e){return h(e,S)}function O(e){return h(e,S)}function k(){typeof window<`u`&&l(window.location.hash)&&window.history.back(),d(`install-slidev`)}function A(e){return e.currentTarget.select()}function j(){let e=(0,v.c)(3),t=w(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,b.jsx)(_,{titleId:`settings-plugin-slides-title`,title:`Slidev`,scope:`user`,beta:!0,docUrl:C,children:(0,b.jsx)(r,{id:`L3w0_C`,components:{0:(0,b.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,b.jsxs)(`section`,{"aria-labelledby":`settings-plugin-slides-title`,className:`space-y-4`,"data-testid":`settings-plugin-slides`,children:[n,(0,b.jsx)(`div`,{"aria-live":`polite`,children:(0,b.jsx)(E,{availability:t})})]}),e[1]=t,e[2]=i),i}export{j as SlidesPluginSection};
@@ -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{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{i as o,n as s,t as c}from"./tooltip-Bz6z4_se.js";import{t as l}from"./button-DzgjsZzC.js";import{n as u}from"./dist-BGzUo_18.js";import{n as d,t as f}from"./workspace-paths-BjilyZF6.js";import{t as p}from"./createLucideIcon-DdBzwsHe.js";import{n as m}from"./bridge-BMIee44l.js";import{n as h}from"./use-workspace-h2j0Puyv.js";import{t as g}from"./trace-api-BSvaJNnr.js";var _=p(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{g.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=m(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=m(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();async function E(e,t,n,r){let i=u.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){u.dismiss(i);return}if(a.reason===`cancelled`){u.dismiss(i);return}let o,s=!1;switch(a.reason){case`timeout`:o=n.timeout,s=!0;break;case`exited-early`:case`renderer-failed`:o=n.renderFailed,s=!0;break;case`load-failed`:o=n.openFailed,s=!0;break;case`unsupported-server`:o=n.unsupported;break;case`spawn-error`:case`port-error`:o=n.startFailed,s=!0;break;case`not-available`:case`invalid-path`:o=n.openFailed;break;default:a.reason,o=n.openFailed}u.error(o,{id:i,...s?{action:{label:n.retry,onClick:r}}:{}})}catch(e){console.warn(`[slides] open dispatch failed:`,e instanceof Error?e:String(e)),u.error(n.openFailed,{id:i,action:{label:n.retry,onClick:r}})}}async function D(e,t,n,r,i,a){if(!r.current.has(t)){r.current.add(t);try{i(new Set(r.current)),a&&S(),await E(e,t,n,()=>{D(e,t,n,r,i,!1)})}finally{r.current.delete(t),i(new Set(r.current))}}}function O(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function k(e){let t=(0,y.c)(12),{provider:n,docName:a}=e,{_:u}=i(),p=w(n,`slides`),m=O(p),g=h(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!p||m!==`available`)return null;let C=g==null?null:d(g.contentDir,f(a),g.pathSeparator),E=async function(){let e=window.okDesktop?.slides;e==null||C==null||await D(e,C,{opening:u({id:`PKLY-1`}),timeout:u({id:`NeY1Np`}),renderFailed:u({id:`Lm3r51`}),openFailed:u({id:`X59Fx2`}),unsupported:u({id:`T_j5G0`}),startFailed:u({id:`TBfy1C`}),retry:u({id:`KDw4GX`})},b,S,!0)},k=c,j=l,M;t[0]===u?M=t[1]:(M=u({id:`w52SKa`}),t[0]=u,t[1]=M);let N=C!=null&&x.has(C),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,T.jsx)(o,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[2]=P):P=t[2];let F;t[3]!==j||t[4]!==E||t[5]!==M||t[6]!==N?(F=(0,T.jsx)(j,{variant:`ghost`,size:`icon`,onClick:E,"aria-label":M,"aria-busy":N,"data-testid":`slides-toolbar-action`,asChild:!0,children:P}),t[3]=j,t[4]=E,t[5]=M,t[6]=N,t[7]=F):F=t[7];let I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,T.jsx)(s,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[8]=I):I=t[8];let L;return t[9]!==k||t[10]!==F?(L=(0,T.jsxs)(k,{children:[F,I]}),t[9]=k,t[10]=F,t[11]=L):L=t[11],L}function A(){return new Set}export{k as SlidesToolbarControls};
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{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{i as o,n as s,t as c}from"./tooltip-Bz6z4_se.js";import{t as l}from"./button-DzgjsZzC.js";import{n as u}from"./dist-BGzUo_18.js";import{n as d,t as f}from"./workspace-paths-BjilyZF6.js";import{t as p}from"./createLucideIcon-DdBzwsHe.js";import{n as m}from"./bridge-BeevbgaB.js";import{n as h}from"./use-workspace-Bgh-YT5K.js";import{t as g}from"./trace-api-BSvaJNnr.js";var _=p(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{g.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=m(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=m(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();async function E(e,t,n,r){let i=u.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){u.dismiss(i);return}if(a.reason===`cancelled`){u.dismiss(i);return}let o,s=!1;switch(a.reason){case`timeout`:o=n.timeout,s=!0;break;case`exited-early`:case`renderer-failed`:o=n.renderFailed,s=!0;break;case`load-failed`:o=n.openFailed,s=!0;break;case`unsupported-server`:o=n.unsupported;break;case`spawn-error`:case`port-error`:o=n.startFailed,s=!0;break;case`not-available`:case`invalid-path`:o=n.openFailed;break;default:a.reason,o=n.openFailed}u.error(o,{id:i,...s?{action:{label:n.retry,onClick:r}}:{}})}catch(e){console.warn(`[slides] open dispatch failed:`,e instanceof Error?e:String(e)),u.error(n.openFailed,{id:i,action:{label:n.retry,onClick:r}})}}async function D(e,t,n,r,i,a){if(!r.current.has(t)){r.current.add(t);try{i(new Set(r.current)),a&&S(),await E(e,t,n,()=>{D(e,t,n,r,i,!1)})}finally{r.current.delete(t),i(new Set(r.current))}}}function O(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function k(e){let t=(0,y.c)(12),{provider:n,docName:a}=e,{_:u}=i(),p=w(n,`slides`),m=O(p),g=h(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!p||m!==`available`)return null;let C=g==null?null:d(g.contentDir,f(a),g.pathSeparator),E=async function(){let e=window.okDesktop?.slides;e==null||C==null||await D(e,C,{opening:u({id:`PKLY-1`}),timeout:u({id:`NeY1Np`}),renderFailed:u({id:`Lm3r51`}),openFailed:u({id:`X59Fx2`}),unsupported:u({id:`T_j5G0`}),startFailed:u({id:`TBfy1C`}),retry:u({id:`KDw4GX`})},b,S,!0)},k=c,j=l,M;t[0]===u?M=t[1]:(M=u({id:`w52SKa`}),t[0]=u,t[1]=M);let N=C!=null&&x.has(C),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,T.jsx)(o,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[2]=P):P=t[2];let F;t[3]!==j||t[4]!==E||t[5]!==M||t[6]!==N?(F=(0,T.jsx)(j,{variant:`ghost`,size:`icon`,onClick:E,"aria-label":M,"aria-busy":N,"data-testid":`slides-toolbar-action`,asChild:!0,children:P}),t[3]=j,t[4]=E,t[5]=M,t[6]=N,t[7]=F):F=t[7];let I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,T.jsx)(s,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[8]=I):I=t[8];let L;return t[9]!==k||t[10]!==F?(L=(0,T.jsxs)(k,{children:[F,I]}),t[9]=k,t[10]=F,t[11]=L):L=t[11],L}function A(){return new Set}export{k as SlidesToolbarControls};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,Bt as r,Cn as i,Dt as a,Pt as o,Qn as s,Sn as c,an as l,kt as u,qn as ee,rn as te,st as ne,zt as d}from"./DocumentContext-B6jTblM-.js";import{t as f}from"./react-f2sANaYj.js";import{n as p}from"./dist-PQ5KMVDh.js";import{t as m}from"./compiler-runtime-BfE3aGVn.js";import{ht as h}from"./schemas-api-CL5ZXlEj.js";import{i as g}from"./use-apply-config-theme-CYFG76sS.js";import{H as re,I as _,L as ie,N as ae,T as oe,b as v,c as se,n as y,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-CM_YQNeI.js";import{Bn as fe,Hn as S,Q as C,a as pe,gt as w,i as me,mt as T,o as he,x as E}from"./CodeMirrorPropInput-BIVsUkip.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as A}from"./perf-CPPbaRwr.js";import{m as ge}from"./config-provider-CbAqLe4d.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-BosZaL03.js";import{i as xe,t as Se}from"./dist-DTvyxWzB.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-D2c3re7d.js";import{o as De,r as Oe}from"./selection-context-zHJJfwcl.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-BMeMGAz_.js";import{l as Me}from"./lint-config-client-B249C1D2.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CRnJUJYV.js";import{n as Be,t as Ve}from"./src-BtdIgOwW.js";var Q=e(f(),1),He=m();function Ue(){let e=d();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:o,to:s}of t)i.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),o=i.length-i.replace(/^`+/,``).length,s=i.length-i.replace(/`+$/,``).length,c=i.slice(o,i.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=a.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=n(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=d()?.get(a);return e===void 0?o():window.location.hash=r(a,e),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=u(t,e,c),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>T()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=w(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!h.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(h.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{i(t)}finally{S(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),i=r[t.index],a={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i)return k(y,{...a,outcome:`no-target`}),!1;let o=s(n,`outline`,()=>{e.dispatch({selection:be.cursor(i.from),effects:F.scrollIntoView(i.from,{y:`start`})}),e.focus()});return k(y,{...a,outcome:o?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number}),o}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);s(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(a),effects:F.scrollIntoView(a,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);return s(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:o}=e,s=(0,Q.useRef)(null),u=(0,Q.useRef)(null),[d,f]=(0,Q.useState)(null);if(d)throw d;let{resolvedTheme:m}=p(),{merged:h}=g(),v=(0,Q.useRef)(o),b=h?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==h?(S=x?.effective??(h?.contentRules?Ae(h.contentRules):je),t[0]=x?.effective,t[1]=h,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==o||t[7]!==C||t[8]!==a||t[9]!==i||t[10]!==m||t[11]!==b||t[12]!==r?(D=()=>{let e=s.current;if(!e)return;let t=i.configuration.name??``,d,p=zt;try{d=c({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=new ge(r);try{let c=ne({ydoc:i.document,ytext:r,docName:t}),u=new N,d=new N,f=new N,h=new N,g=new F({state:_e.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>ee(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(r,i.awareness,{undoManager:s}),K.of(Be),kt({docName:t,ytext:r,undoManager:s}),...me({themeCompartment:u,resolvedTheme:m,ydoc:i.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),Tt(),Ge(t),re(),h.of(it(C,n)),rt(n),c,F.updateListener.of(e=>{te(e)&&l(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ue(t,`source`,oe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),f.of(ve(a??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,p),_.addEventListener(`paste`,p),_.addEventListener(`drop`,p),_.addEventListener(`cut`,p),{view:g,ydoc:i.document,ytext:r,provider:i,undoManager:s,themeCompartment:u,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:h}}catch(e){let t=e;throw s.destroy(),t}}}),E.current=d,u.current=d.view,At(d.view,o),fe(n,d.view,`sourceEditor`),le()&&d.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,u.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,u.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=o,t[7]=C,t[8]=a,t[9]=i,t[10]=m,t[11]=b,t[12]=r,t[13]=D):D=t[13];let O;t[14]!==i||t[15]!==r?(O=[r,i],t[14]=i,t[15]=r,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===o?(A=t[18],j=t[19]):(A=()=>{v.current=o;let e=u.current;e&&At(e,o)},j=[o],t[17]=o,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===m?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(m===`dark`?pe:he)})},I=[m],t[23]=m,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===a?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(a??``))})},V=[a],t[29]=a,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==o?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!o)return;let r=u.current;if(!r){k(y,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n)&&t.onNavigated?.(r.contentDOM),_(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,o],t[37]=n,t[38]=o,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==n||t[42]!==o?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!o)return;let r=u.current;r&&It(r,t,n)&&(_(n),t.onNavigated?.(r.contentDOM))};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,o],t[41]=n,t[42]=o,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==o||t[47]!==i?(Y=()=>{if(!o)return;let e=u.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`lint`?It(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>v.current,n);return}let r=!1,a=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(a=ae({view:e,docName:n,navigation:t,ydoc:i.document,transition:{from:`wysiwyg`,to:`source`}}),a&&ie(n))}),()=>{r=!0,a?.cancel(`mode-flip`)}},X=[n,o,i],t[45]=n,t[46]=o,t[47]=i,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:s,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:E()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,Bt as r,Cn as i,Dt as a,Pt as o,Qn as s,Sn as c,an as l,kt as u,qn as ee,rn as te,st as ne,zt as d}from"./DocumentContext-DDDUTQJi.js";import{t as f}from"./react-f2sANaYj.js";import{n as p}from"./dist-PQ5KMVDh.js";import{t as m}from"./compiler-runtime-BfE3aGVn.js";import{ht as h}from"./schemas-api-CD98jV86.js";import{i as g}from"./use-apply-config-theme-CYFG76sS.js";import{H as re,I as _,L as ie,N as ae,T as oe,b as v,c as se,n as y,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-DQWG6VAz.js";import{Bn as fe,Hn as S,Q as C,a as pe,gt as w,i as me,mt as T,o as he,x as E}from"./CodeMirrorPropInput-C5fRuWf2.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as A}from"./perf-CPPbaRwr.js";import{m as ge}from"./config-provider-4lMZjvv1.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-BosZaL03.js";import{i as xe,t as Se}from"./dist-DTvyxWzB.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-D2c3re7d.js";import{o as De,r as Oe}from"./selection-context-BbfG0HO9.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-BuEapKhE.js";import{l as Me}from"./lint-config-client-DRJNyM2s.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CRnJUJYV.js";import{n as Be,t as Ve}from"./src-D_7G4loI.js";var Q=e(f(),1),He=m();function Ue(){let e=d();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:o,to:s}of t)i.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),o=i.length-i.replace(/^`+/,``).length,s=i.length-i.replace(/`+$/,``).length,c=i.slice(o,i.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=a.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=n(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=d()?.get(a);return e===void 0?o():window.location.hash=r(a,e),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=u(t,e,c),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>T()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=w(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!h.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(h.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{i(t)}finally{S(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),i=r[t.index],a={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i)return k(y,{...a,outcome:`no-target`}),!1;let o=s(n,`outline`,()=>{e.dispatch({selection:be.cursor(i.from),effects:F.scrollIntoView(i.from,{y:`start`})}),e.focus()});return k(y,{...a,outcome:o?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number}),o}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);s(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(a),effects:F.scrollIntoView(a,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);return s(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:o}=e,s=(0,Q.useRef)(null),u=(0,Q.useRef)(null),[d,f]=(0,Q.useState)(null);if(d)throw d;let{resolvedTheme:m}=p(),{merged:h}=g(),v=(0,Q.useRef)(o),b=h?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==h?(S=x?.effective??(h?.contentRules?Ae(h.contentRules):je),t[0]=x?.effective,t[1]=h,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==o||t[7]!==C||t[8]!==a||t[9]!==i||t[10]!==m||t[11]!==b||t[12]!==r?(D=()=>{let e=s.current;if(!e)return;let t=i.configuration.name??``,d,p=zt;try{d=c({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=new ge(r);try{let c=ne({ydoc:i.document,ytext:r,docName:t}),u=new N,d=new N,f=new N,h=new N,g=new F({state:_e.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>ee(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(r,i.awareness,{undoManager:s}),K.of(Be),kt({docName:t,ytext:r,undoManager:s}),...me({themeCompartment:u,resolvedTheme:m,ydoc:i.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),Tt(),Ge(t),re(),h.of(it(C,n)),rt(n),c,F.updateListener.of(e=>{te(e)&&l(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ue(t,`source`,oe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),f.of(ve(a??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,p),_.addEventListener(`paste`,p),_.addEventListener(`drop`,p),_.addEventListener(`cut`,p),{view:g,ydoc:i.document,ytext:r,provider:i,undoManager:s,themeCompartment:u,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:h}}catch(e){let t=e;throw s.destroy(),t}}}),E.current=d,u.current=d.view,At(d.view,o),fe(n,d.view,`sourceEditor`),le()&&d.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,u.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,u.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=o,t[7]=C,t[8]=a,t[9]=i,t[10]=m,t[11]=b,t[12]=r,t[13]=D):D=t[13];let O;t[14]!==i||t[15]!==r?(O=[r,i],t[14]=i,t[15]=r,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===o?(A=t[18],j=t[19]):(A=()=>{v.current=o;let e=u.current;e&&At(e,o)},j=[o],t[17]=o,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===m?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(m===`dark`?pe:he)})},I=[m],t[23]=m,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===a?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(a??``))})},V=[a],t[29]=a,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==o?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!o)return;let r=u.current;if(!r){k(y,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n)&&t.onNavigated?.(r.contentDOM),_(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,o],t[37]=n,t[38]=o,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==n||t[42]!==o?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!o)return;let r=u.current;r&&It(r,t,n)&&(_(n),t.onNavigated?.(r.contentDOM))};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,o],t[41]=n,t[42]=o,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==o||t[47]!==i?(Y=()=>{if(!o)return;let e=u.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`lint`?It(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>v.current,n);return}let r=!1,a=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(a=ae({view:e,docName:n,navigation:t,ydoc:i.document,transition:{from:`wysiwyg`,to:`source`}}),a&&ie(n))}),()=>{r=!0,a?.cancel(`mode-flip`)}},X=[n,o,i],t[45]=n,t[46]=o,t[47]=i,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:s,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:E()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};