@inkeep/open-knowledge 0.59.0-beta.12 → 0.59.0-beta.14

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 (137) hide show
  1. package/dist/{acp-harness-probe-1nwnlbS0.mjs → acp-harness-probe-CNFNCUGz.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-DN-9zlW1.mjs +2 -0
  4. package/dist/fs-traced-C1nHpvFb.mjs +1 -0
  5. package/dist/{fs-traced-CJ0NSnI0.mjs → fs-traced-Dy67FR5_.mjs} +2 -2
  6. package/dist/git-handle-BPPRdjZZ.mjs +1 -0
  7. package/dist/{git-handle-DGgEJR3Q.mjs → git-handle-KDk0khh5.mjs} +3 -3
  8. package/dist/index.mjs +2 -2
  9. package/dist/{init-C3tiLV4q.mjs → init-CfD5NARM.mjs} +3 -3
  10. package/dist/init-DWv8tT4O.mjs +1 -0
  11. package/dist/{launch-json-removal-DskngHoZ.mjs → launch-json-removal-D2sBQ6Ur.mjs} +2 -2
  12. package/dist/loader-BGkwEr7t.mjs +1 -0
  13. package/dist/{loader-wkIqjWKU.mjs → loader-BofTct4Y.mjs} +2 -2
  14. package/dist/md-manager-CdRw_aqi.mjs +2 -0
  15. package/dist/{open-browser-B-Kf-THH.mjs → open-browser-BklPlV75.mjs} +2 -2
  16. package/dist/parse-worker.mjs +1 -1
  17. package/dist/{preview-DNmmZiVV.mjs → preview-B2a1S7UT.mjs} +2 -2
  18. package/dist/preview-D13Am20B.mjs +1 -0
  19. package/dist/public/assets/{ActivityModeContent-Dm80EO6I.js → ActivityModeContent-BIn008__.js} +1 -1
  20. package/dist/public/assets/{AgentDiffPane-CiDRNNtB.js → AgentDiffPane-3GMOCb2c.js} +1 -1
  21. package/dist/public/assets/{AgentThreadClientBinder-q7HjbS_V.js → AgentThreadClientBinder-Di2dPu4h.js} +1 -1
  22. package/dist/public/assets/{CodeMirrorPropInput-CAuN39X3.js → CodeMirrorPropInput-BKSuOOVi.js} +1 -1
  23. package/dist/public/assets/{DocumentContext-BQwDWNIp.js → DocumentContext-C-X4T4d9.js} +1 -1
  24. package/dist/public/assets/{EditorModeToggle-BPsUpNqB.js → EditorModeToggle-CPKSIpqP.js} +1 -1
  25. package/dist/public/assets/{EnableSyncConfirmDialog-SztigQDp.js → EnableSyncConfirmDialog-B9GQfDxa.js} +1 -1
  26. package/dist/public/assets/{ExcalidrawDocEditor-DUpN3hmr.js → ExcalidrawDocEditor-CiuG3mW7.js} +1 -1
  27. package/dist/public/assets/FeedbackForm-DYjADexF.js +1 -0
  28. package/dist/public/assets/{GraphPanel-B_Mg9p1O.js → GraphPanel-DT-1F3b4.js} +1 -1
  29. package/dist/public/assets/{ImportSkillDialog-Dlx0DBn5.js → ImportSkillDialog-d6lkfU9h.js} +1 -1
  30. package/dist/public/assets/{LintConfigEditor-DZNYgrQG.js → LintConfigEditor-BEaCP-Xa.js} +1 -1
  31. package/dist/public/assets/{ManagedArtifactProperties-B-0nFc46.js → ManagedArtifactProperties-CI77JvTy.js} +1 -1
  32. package/dist/public/assets/ManagedArtifactProperties-RawOG82I.js +1 -0
  33. package/dist/public/assets/{MermaidDocEditor-Bu0vzdBQ.js → MermaidDocEditor-3Qy_xxrY.js} +1 -1
  34. package/dist/public/assets/{PropertyDisplayRow-DFpnExTR.js → PropertyDisplayRow-jv0QSvvc.js} +1 -1
  35. package/dist/public/assets/{ReportBugDialogBody-CVQgnZSP.js → ReportBugDialogBody-CD42zSIE.js} +1 -1
  36. package/dist/public/assets/{SchemaConfigEditor-BQ_qrwXQ.js → SchemaConfigEditor-DRPb60r3.js} +1 -1
  37. package/dist/public/assets/{SessionsHost-CednqHmx.js → SessionsHost-0wztntvc.js} +2 -2
  38. package/dist/public/assets/{SettingsDialogBody-CDLuNlbr.js → SettingsDialogBody-CguEJilL.js} +2 -2
  39. package/dist/public/assets/{ShareBranchSwitchDialog-DIQmuIkz.js → ShareBranchSwitchDialog-DD3l5H06.js} +1 -1
  40. package/dist/public/assets/{ShareReceiveDialog-BWuqWxsw.js → ShareReceiveDialog-D5BGQzdA.js} +1 -1
  41. package/dist/public/assets/{ShareReceiveMissDialog-CEG6W1Ev.js → ShareReceiveMissDialog-QiuppiTF.js} +1 -1
  42. package/dist/public/assets/{SkillCostValue-6xiHOBnl.js → SkillCostValue-D8ebP6Zc.js} +1 -1
  43. package/dist/public/assets/{SkillEditBanner-BqzwArWv.js → SkillEditBanner-BkzopHHR.js} +1 -1
  44. package/dist/public/assets/{SkillInstallMenu-CiSsB_my.js → SkillInstallMenu-B7luagyu.js} +1 -1
  45. package/dist/public/assets/{SkillOriginInline-B1B3kTSz.js → SkillOriginInline-BvpULx0r.js} +1 -1
  46. package/dist/public/assets/{SkillToolbarControls-DzZ0Gk1t.js → SkillToolbarControls-Dzsdm7PA.js} +1 -1
  47. package/dist/public/assets/{SlidesToolbarControls-BZvu5Syj.js → SlidesToolbarControls-CoX9pn5-.js} +1 -1
  48. package/dist/public/assets/{SourceEditor-qlPmt6ym.js → SourceEditor-QZM8qnoP.js} +1 -1
  49. package/dist/public/assets/{TerminalPanel-DkxYnA6s.js → TerminalPanel-gvD8j_Io.js} +1 -1
  50. package/dist/public/assets/{TerminalWindowApp-BhcRGz-t.js → TerminalWindowApp-CAceqDR9.js} +1 -1
  51. package/dist/public/assets/{TextDocEditor-CCvc4Q5l.js → TextDocEditor-tkRGKEq5.js} +1 -1
  52. package/dist/public/assets/{ThreadView-BbaUHoL7.js → ThreadView-BMvSxzC4.js} +1 -1
  53. package/dist/public/assets/{TimelineDiffPane-QLS0U_1C.js → TimelineDiffPane-DDkbig_i.js} +1 -1
  54. package/dist/public/assets/{agent-diff-store-J11a-4Bd.js → agent-diff-store-kz-Y8I6f.js} +1 -1
  55. package/dist/public/assets/{auth-state-cache-_thFjwl-.js → auth-state-cache-CXBlrCdD.js} +2 -2
  56. package/dist/public/assets/client-version-B1ECEFiM.js +1 -0
  57. package/dist/public/assets/{comment-chips-CLyRlBJL.js → comment-chips-ZBz8P1qB.js} +1 -1
  58. package/dist/public/assets/{config-provider-C7upY2Yd.js → config-provider-j9ER9l4W.js} +1 -1
  59. package/dist/public/assets/{dist-DGemBD_J.js → dist-7P3QNiAv.js} +2 -2
  60. package/dist/public/assets/{doc-paths-BkpejoFL.js → doc-paths-DPQCXAM6.js} +1 -1
  61. package/dist/public/assets/{documents-events-B2g_1xMi.js → documents-events-DSYMSbrh.js} +1 -1
  62. package/dist/public/assets/{file-tree-adapter-Bo3rGytc.js → file-tree-adapter-DWQqMzJU.js} +1 -1
  63. package/dist/public/assets/{file-tree-utils-CzXn1zjH.js → file-tree-utils-CCGJg4dv.js} +1 -1
  64. package/dist/public/assets/{folder-config-api-DPWmRi8a.js → folder-config-api-BFcRWayL.js} +1 -1
  65. package/dist/public/assets/{follow-file-DaYTg7AY.js → follow-file-DInAFQK_.js} +1 -1
  66. package/dist/public/assets/{globals-t_AE56h0.css → globals-DZLrtRra.css} +1 -1
  67. package/dist/public/assets/i18n-8WVAXtMP.js +1 -0
  68. package/dist/public/assets/{index-8x_9u23T.js → index-CW5V3fEN.js} +7 -7
  69. package/dist/public/assets/{lint-config-client-sK38eqbj.js → lint-config-client-D0R0SOyp.js} +1 -1
  70. package/dist/public/assets/{markdownlint-rule-browser-T68WxSIo.js → markdownlint-rule-browser-C-ng_hpW.js} +1 -1
  71. package/dist/public/assets/{navigation-targets-D6rHX3Pq.js → navigation-targets-BI4fIUSN.js} +1 -1
  72. package/dist/public/assets/{open-managed-artifact-tab-ENQgQOde.js → open-managed-artifact-tab-DUwaeWfA.js} +1 -1
  73. package/dist/public/assets/{pending-receive-nav-store-CC2XknmZ.js → pending-receive-nav-store-Crc_XCGA.js} +1 -1
  74. package/dist/public/assets/{prop-types-CizsurD0.js → prop-types-tU6-fOmD.js} +1 -1
  75. package/dist/public/assets/{receive-store-DHalgzeU.js → receive-store-BzLz5gZK.js} +1 -1
  76. package/dist/public/assets/{selection-context-DdO1wltB.js → selection-context-CnpF-Ed9.js} +1 -1
  77. package/dist/public/assets/{skill-actions-BSweQ1qx.js → skill-actions-BdLNV2ET.js} +1 -1
  78. package/dist/public/assets/{skill-scope-gUkJkFRO.js → skill-scope-CRZYtnmj.js} +1 -1
  79. package/dist/public/assets/{skills-api-DO54o34O.js → skills-api-DT1cIHsu.js} +1 -1
  80. package/dist/public/assets/{src-B5lvdvjM.js → src-BHnBKao9.js} +1 -1
  81. package/dist/public/assets/{tag-pill-input-D2qVy9HA.js → tag-pill-input-Bcant_jp.js} +1 -1
  82. package/dist/public/assets/{target-navigation-intent-BqElNT05.js → target-navigation-intent-Bd_1P8q5.js} +1 -1
  83. package/dist/public/assets/{telemetry-impl-BcdvjHjJ.js → telemetry-impl-u08eIZFn.js} +1 -1
  84. package/dist/public/assets/{telemetry-startup-CmDjO4so.js → telemetry-startup-PYGQzY-J.js} +1 -1
  85. package/dist/public/assets/{terminal-cli-display-BTQdEy1j.js → terminal-cli-display-Dcm1esjR.js} +1 -1
  86. package/dist/public/assets/{terminal-launch-events-DNmxO4ft.js → terminal-launch-events-D8ytCf2E.js} +1 -1
  87. package/dist/public/assets/{terminal-telemetry-BC3JNC05.js → terminal-telemetry-LPAWl6sJ.js} +1 -1
  88. package/dist/public/assets/{typing-burst-detector-ChW315nG.js → typing-burst-detector-MvNJwskd.js} +1 -1
  89. package/dist/public/assets/{uninstall-C1RXngJE.js → uninstall-ACcONsCi.js} +1 -1
  90. package/dist/public/assets/{use-activity-panel-SBXuDVLV.js → use-activity-panel-DO4-UumZ.js} +1 -1
  91. package/dist/public/assets/{use-apply-config-color-theme-DZRctrdg.js → use-apply-config-color-theme-DpUYtbRe.js} +1 -1
  92. package/dist/public/assets/{use-collab-url-B7oEo69p.js → use-collab-url-B1V6TiLU.js} +1 -1
  93. package/dist/public/assets/{use-live-xterm-theme-C1EtEd_i.js → use-live-xterm-theme-DYp4WjiU.js} +1 -1
  94. package/dist/public/assets/{use-open-skill-DI2x1PKF.js → use-open-skill-8o6IZoY2.js} +1 -1
  95. package/dist/public/assets/{use-popular-skills-DfFoUUYd.js → use-popular-skills-CC2urVQ6.js} +1 -1
  96. package/dist/public/assets/{use-settings-route-BrzzIll2.js → use-settings-route-DYSuZnve.js} +1 -1
  97. package/dist/public/assets/{use-skill-origin-FTbTIS5Y.js → use-skill-origin-Cd9ipAH-.js} +1 -1
  98. package/dist/public/assets/{use-terminal-enabled-BL8teAd-.js → use-terminal-enabled-pw2WV2qk.js} +1 -1
  99. package/dist/public/assets/{use-timeline-entry-diff-BjMCsEI9.js → use-timeline-entry-diff-B3StRSt9.js} +1 -1
  100. package/dist/public/assets/{use-workspace-8Sxb8Z6Q.js → use-workspace-BP0fuu9O.js} +1 -1
  101. package/dist/public/index.html +47 -47
  102. package/dist/public/uninstall.html +5 -5
  103. package/dist/{repair-launch-json-C21vqdF1.mjs → repair-launch-json-DNViuYZ7.mjs} +2 -2
  104. package/dist/{repair-mcp-configs-BUKx8wz_.mjs → repair-mcp-configs-BM4qXgds.mjs} +2 -2
  105. package/dist/{repair-skills-CI9y4QbJ.mjs → repair-skills-BoMh5uOr.mjs} +2 -2
  106. package/dist/repair-skills-D3qrrU25.mjs +1 -0
  107. package/dist/{resolve-project-root-CRcZU2OU.mjs → resolve-project-root-DpSmoodv.mjs} +2 -2
  108. package/dist/{server-lock-BmwIVWMl.mjs → server-lock-CSO3K0Ok.mjs} +2 -2
  109. package/dist/server-lock-D_MF6GOb.mjs +1 -0
  110. package/dist/{skill-teardown-DLV1OiQx.mjs → skill-teardown-D66Xjjil.mjs} +2 -2
  111. package/dist/{sleep-B416PNUo.mjs → sleep-CEs13Om_.mjs} +2 -2
  112. package/dist/src-8LdfqLwC.mjs +2029 -0
  113. package/dist/{src-BxdlvOrw.mjs → src-BimG4LM6.mjs} +3 -3
  114. package/dist/{src-suK9PJ_z.mjs → src-D72th7in.mjs} +2 -2
  115. package/dist/{src-DCqESfWX.mjs → src-DorV8gmN.mjs} +1 -1
  116. package/dist/src-bwfEbl1P.mjs +1 -0
  117. package/dist/{start-TsNChes_.mjs → start-BfQkBca_.mjs} +4 -4
  118. package/dist/start-C3q0F7F6.mjs +1 -0
  119. package/dist/{ui-DZeKrf4E.mjs → ui-DRrmB9yI.mjs} +3 -3
  120. package/package.json +4 -4
  121. package/dist/constants-BplwuXJr.mjs +0 -2
  122. package/dist/fs-traced-Bmqe7SqT.mjs +0 -1
  123. package/dist/git-handle-CNjG3dz9.mjs +0 -1
  124. package/dist/init-BdwdCUiN.mjs +0 -1
  125. package/dist/loader-DCfDuFIB.mjs +0 -1
  126. package/dist/md-manager-30E0O9b-.mjs +0 -2
  127. package/dist/preview-DtCiQeRn.mjs +0 -1
  128. package/dist/public/assets/FeedbackForm-BTUVYyRh.js +0 -1
  129. package/dist/public/assets/ManagedArtifactProperties-FyJ6IPjk.js +0 -1
  130. package/dist/public/assets/client-version-CR8MBZoD.js +0 -1
  131. package/dist/public/assets/i18n-BmV9TpxI.js +0 -1
  132. package/dist/repair-skills-QaEJT3NL.mjs +0 -1
  133. package/dist/server-lock-e6dYuoeq.mjs +0 -1
  134. package/dist/src-DuQCE3HO.mjs +0 -1
  135. package/dist/src-_fp0S8Pp.mjs +0 -2029
  136. package/dist/start-DZCxW5no.mjs +0 -1
  137. /package/dist/public/assets/{globals-BEtYwZKH.js → globals-CQk8qCgW.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Mn as n,Zn as r,a as i,z as a}from"./DocumentContext-BQwDWNIp.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{l as u,s as d}from"./local-menu-action-bus-CIYp0C2E.js";import{t as f}from"./utils-CPqDy6Hr.js";import{D as p,E as m,a as h,c as g,g as _,h as v,k as y,l as b,n as x,o as S,r as C,s as w,t as T,u as E}from"./SkillInstallMenu-CiSsB_my.js";import{t as D}from"./button-CA0dewJJ.js";import{i as O,n as k,t as A}from"./tooltip-DHXgxWLL.js";import{a as j,c as M,i as N,n as P,o as ee,r as F,s as te,t as ne}from"./dialog-HdfR4WGm.js";import{C as I,E as L,N as R,T as z,_ as B,c as V,d as H,f as U,g as W,i as G,l as K,m as q,n as J,p as Y,r as X,u as re,v as ie,w as ae}from"./terminal-cli-display-BTQdEy1j.js";import{a as oe,d as se,f as ce,i as le,o as ue,p as de,u as fe}from"./dropdown-menu-CLgDYkh1.js";import{t as pe}from"./label-B5yNUINo.js";import{Bn as me,Gn as he,Hn as ge,Kn as _e,Ln as ve,Lo as ye,Mo as be,Rn as xe,Wn as Se,Xi as Ce,Xt as we,Zt as Te,bn as Ee,ct as De,dn as Oe,jo as ke,jt as Ae,ko as je,lt as Me,oo as Ne,qn as Pe,vn as Fe,xn as Ie,zn as Le}from"./dist-DGemBD_J.js";import{n as Z}from"./dist-D81TFAXh.js";import{i as Re}from"./use-settings-route-BrzzIll2.js";import{t as ze}from"./dist-XgwTV-oh2.js";import{f as Be,l as Ve,m as He,n as Ue,p as We,r as Ge,u as Ke}from"./documents-events-B2g_1xMi.js";import{h as qe}from"./use-apply-config-color-theme-DZRctrdg.js";import{t as Je}from"./parse-api-error-DsopQ8yv.js";import{n as Ye,t as Xe}from"./workspace-paths-CKUFX0v6.js";import{t as Ze}from"./use-workspace-8Sxb8Z6Q.js";import{t as Qe}from"./createLucideIcon-Bhw2PmPp.js";import{t as $e}from"./arrow-up-right-CGe6dTck.js";import{t as et}from"./RegisteredAgentIcon-CP1iDML-.js";import{n as tt}from"./CopyButton-CKyZY1PL.js";import{n as nt,r as rt}from"./ManagedArtifactProperties-B-0nFc46.js";import{t as it}from"./folder-open-BapQa7r-.js";import{t as at}from"./use-open-skill-DI2x1PKF.js";import{t as ot}from"./list-plus-CT84Vd_h.js";import{t as st}from"./trash-2-Co21mefL.js";import{a as ct,c as lt,f as ut}from"./skill-scope-gUkJkFRO.js";import{t as dt}from"./input-lp6-d0mX.js";import{J as ft,q as pt,x as mt}from"./navigation-targets-D6rHX3Pq.js";import{t as ht}from"./badge-BG5JKjNK.js";import{F as gt,P as _t,T as vt,a as yt,b as bt,h as xt,n as St,r as Ct,t as wt,u as Tt,w as Et}from"./skills-api-DO54o34O.js";import{n as Dt}from"./clipboard-adapter-DqemxSWT.js";import{t as Ot}from"./DiffView-B-B3fi5F.js";import{n as kt}from"./platform-labels-B2q9roOE.js";var Q=t(),$=e(o(),1),At=l();function jt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Mt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Je(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:ze._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:ze._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??ze._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Nt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?jt(e):Mt()}var Pt=`ok:skill:cowork:installed`,Ft=`1`,It=250,Lt=`/api/skill/install-state`;function Rt(e){return`${Pt}:v${e}`}var zt=new Map;async function Bt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=zt.get(n);if(r)return r;let i=Vt(e,t);return zt.set(n,i),i.finally(()=>{zt.get(n)===i&&zt.delete(n)}),i}async function Vt(e,t){let n=e.installer===void 0?Nt():e.installer,r=Ht(e.storage),i=e.fetchSnapshot??Wt,a=e.serverTimeoutMs??It,o=null;if(!t.force){try{o=await Gt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Rt(o?.currentVersion??e.fallbackSkillVersion??Ut());if(!t.force&&r?.getItem(s)===Ft)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Ft)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Ht(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ut(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Wt(){let e;try{e=await fetch(Lt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Gt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Kt(e){return Bt({},e)}function qt(){return Bt({},{force:!0})}async function Jt(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Yt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Jt({target:`claude-cowork`,url:Fe({mode:`cowork`},e)},n);case`claude-code`:return Jt({target:`claude-code`,url:Fe({mode:`code`},e)},n);case`codex`:return Jt({target:`codex`,url:Ee(e)},n);case`cursor`:return Jt({target:`cursor`,url:Ie(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Xt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Zt=`open-knowledge:agent-thread-launch`;function Qt(e,t=typeof window>`u`?new EventTarget:window){u({kind:`agent-thread`,...e},t)||t.dispatchEvent(new CustomEvent(Zt,{detail:e}))}function $t(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Zt,n),()=>t.removeEventListener(Zt,n)}function en(e){if(!e.docName||!e.workspace)return null;let t=Xe(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Ye(n,t,r)}}function tn(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function nn(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function rn(e){return L(e.installUrl).then(()=>void 0)}function an(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function on(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function sn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??Xe(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:Ye(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function cn(e){return`Opened in ${e}.`}function ln(e,t=1){return t>=3?ze._({id:`bi2C2s`,values:{displayName:e}}):t===2?ze._({id:`1J0c0X`,values:{displayName:e}}):ze._({id:`Xs7IcT`,values:{displayName:e}})}function un(e){return e>=3?null:e===2?ze._({id:`Xp94R1`}):ze._({id:`6gRgw8`})}function dn(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function fn(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function pn(e,t,n,r){return e.compose?Oe(fn(e.compose,t,n,r)):e.selection?Se({...e.selection,target:t,transport:r}):e.skill?he(e.skill.name,e.skill.scope,n):e.ask?ve(e.ask.relativePath,e.ask.instruction,n,t,r):Ce(e.docContext===null?e.folderRelativePath?ge(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?Le(n,e.instruction,r):xe(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):me(e.docContext.relativePath,n,e.instruction,r))}function mn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${De} ${pn(e,we[t].handoffTarget,!1,`terminal`)}`:_e(e.docContext?.relativePath??null)}function hn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${Me} ${pn(e,`claude-code`,!1,`terminal`)}`:Pe(e.docContext?.relativePath??null)}function gn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function _n(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function vn(e,t){Qt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:hn(e),docName:gn(e),titleHint:_n(e)})}async function yn(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(ze._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(ze._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(ze._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:pn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=dn(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(cn(u));else{let i=un(r),a=ln(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{yn(e,t,n,r+1)}}})}return a}function bn(e){return ae.find(t=>t.id===e)?.displayName??e}function xn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Sn(){return{dispatchHandoff:Yt,recordHandoff:Xt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>xn(),getDisplayName:bn,ensureCoworkSkillInstalled:Kt,autoOpen:!0}}function Cn(){let e=(0,At.c)(2),{merged:t}=qe(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>yn(e,t,{...Sn(),autoOpen:n}),reinstallCoworkSkill:qt},e[0]=n,e[1]=r),r}var wn=Qe(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),Tn=Qe(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),En=Qe(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]);function Dn(e){let t=(0,At.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(s,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function On(e){let t=(0,At.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(s,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function kn(e){let t=(0,At.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(s,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function An(e){let t=(0,At.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:l}=c(),u=o>0,d;t[0]!==l||t[1]!==u||t[2]!==o?(d=l(u?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=l,t[1]=u,t[2]=o,t[3]=d):d=t[3];let p=d,m;t[4]===r?m=t[5]:(m=f(`relative`,r),t[4]=r,t[5]=m);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ot,{}),t[6]=h):h=t[6];let g;t[7]!==u||t[8]!==o?(g=u?(0,Q.jsx)(ht,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=u,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(O,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==p||t[13]!==n||t[14]!==m||t[15]!==_?(v=(0,Q.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":p,onClick:n,"data-testid":`add-properties-button`,className:m,asChild:!0,children:_}),t[12]=p,t[13]=n,t[14]=m,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==u||t[18]!==a?(y=(0,Q.jsx)(k,{side:`bottom`,children:u?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(s,{id:`AwrGuz`})}),a?.map(jn),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(s,{id:`yh5-4s`})})]}):(0,Q.jsx)(s,{id:`81H_23`})}),t[17]=u,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(A,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function jn(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}function Mn(e){return e?ze._({id:`wTcjov`}):null}function Nn(e){let t=(0,At.c)(47),{_:r}=c(),i=a(),o=m(),l=R(),u=I();if(i)return null;let{input:f,installStates:p,dispatch:h}=e,g=f===null,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==r||t[1]!==h||t[2]!==f||t[3]!==g||t[4]!==p||t[5]!==u||t[6]!==l||t[7]!==o){let e=Mn(g),i;t[19]!==p||t[20]!==u?(i=e=>W(u,e.id,p[e.id]?.installed),t[19]=p,t[20]=u,t[21]=i):i=t[21];let a=z.filter(i),c;t[22]===u?c=t[23]:(c=e=>B(u,e.source,e.id,!0,e.supported),t[22]=u,t[23]=c);let d=l.filter(c),m=o?Te.filter(e=>ie(u,e,o.installedClis)):[];y=a.length>0,b=o!==null&&m.length>0,x=d.length>0,v=U,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(q,{children:[(0,Q.jsx)(n,{"aria-hidden":`true`}),(0,Q.jsx)(s,{id:`O7_W_a`})]}),t[24]=D):D=t[24],_=Y,S=`max-h-80`,C=x?(0,Q.jsxs)(V,{"aria-label":r({id:`vPKX2i`}),children:[(0,Q.jsxs)(re,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`RXEbZy`}),(0,Q.jsx)(G,{})]}),d.map(t=>{let n=t.name;return(0,Q.jsxs)(K,{onSelect:()=>{f!==null&&vn(f,{agent:{source:t.source,id:t.id}})},disabled:g,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":r(e?{id:`7Ag-Xu`,values:{agentName:n,hint:e}}:{id:`g4e0hS`,values:{agentName:n}}),children:[(0,Q.jsx)(et,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==y||t[26]!==b||t[27]!==x?(w=x&&(b||y)?(0,Q.jsx)(H,{}):null,t[25]=y,t[26]=b,t[27]=x,t[28]=w):w=t[28],T=b?(0,Q.jsxs)(V,{"aria-label":r({id:`ALhMYW`}),children:[(0,Q.jsx)(re,{children:(0,Q.jsx)(s,{id:`ALhMYW`})}),m.map(t=>{let{displayName:n}=we[t];return(0,Q.jsxs)(K,{onSelect:()=>{f!==null&&o.launchInTerminal(f,t)},disabled:g,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":r(e?{id:`AIn2Yv`,values:{displayName:n,hint:e}}:{id:`QYfQdv`,values:{displayName:n}}),children:[(0,Q.jsx)(X,{id:J(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,E=y?(0,Q.jsxs)(Q.Fragment,{children:[b?(0,Q.jsx)(H,{}):null,(0,Q.jsxs)(V,{"aria-label":r({id:`BwKH4d`}),children:[(0,Q.jsxs)(re,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`BwKH4d`}),(0,Q.jsx)($e,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let n=!g,{displayName:i}=t,a=r(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(K,{disabled:!n,onSelect:()=>{if(f){if(p[t.id]?.installed!==!0){rn(t);return}h(t.id,f)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(X,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Dn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=r,t[1]=h,t[2]=f,t[3]=g,t[4]=p,t[5]=u,t[6]=l,t[7]=o,t[8]=_,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D}else _=t[8],v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18];let O;t[29]!==y||t[30]!==b||t[31]!==x?(O=x||b||y?(0,Q.jsx)(H,{}):null,t[29]=y,t[30]=b,t[31]=x,t[32]=O):O=t[32];let k;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(d,{"aria-hidden":`true`}),t[33]=k):k=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(K,{onSelect:Re,"data-testid":`empty-space-open-in-settings`,children:[k,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`jRAGrQ`})})]}),t[34]=A):A=t[34];let j;t[35]!==_||t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E||t[41]!==O?(j=(0,Q.jsxs)(_,{className:S,children:[C,w,T,E,O,A]}),t[35]=_,t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=O,t[42]=j):j=t[42];let M;return t[43]!==v||t[44]!==D||t[45]!==j?(M=(0,Q.jsxs)(v,{children:[D,j]}),t[43]=v,t[44]=D,t[45]=j,t[46]=M):M=t[46],M}function Pn(e){return e?ze._({id:`wTcjov`}):null}function Fn(e){let t=(0,At.c)(48),{_:r}=c(),i=a(),o=m(),l=R(),u=I();if(i)return null;let{input:f,installStates:p,dispatch:h,onBeforeLaunch:g}=e,_=f===null,v,y,b,x,S,C,w,T,E,D,O;if(t[0]!==r||t[1]!==h||t[2]!==f||t[3]!==_||t[4]!==p||t[5]!==g||t[6]!==u||t[7]!==l||t[8]!==o){let e=Pn(_),i;t[20]!==p||t[21]!==u?(i=e=>W(u,e.id,p[e.id]?.installed),t[20]=p,t[21]=u,t[22]=i):i=t[22];let a=z.filter(i),c;t[23]===u?c=t[24]:(c=e=>B(u,e.source,e.id,!0,e.supported),t[23]=u,t[24]=c);let d=l.filter(c),m=o?Te.filter(e=>ie(u,e,o.installedClis)):[];b=a.length>0,x=o!==null&&m.length>0,S=d.length>0,y=se,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(de,{children:[(0,Q.jsx)(n,{"aria-hidden":`true`}),(0,Q.jsx)(s,{id:`O7_W_a`})]}),t[25]=O):O=t[25],v=ce,C=`max-h-80`,w=S?(0,Q.jsxs)(le,{"aria-label":r({id:`vPKX2i`}),children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`RXEbZy`}),(0,Q.jsx)(G,{})]}),d.map(t=>{let n=t.name;return(0,Q.jsxs)(oe,{onSelect:()=>{f!==null&&(g?.(),vn(f,{agent:{source:t.source,id:t.id}}))},disabled:_,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":r(e?{id:`7Ag-Xu`,values:{agentName:n,hint:e}}:{id:`g4e0hS`,values:{agentName:n}}),children:[(0,Q.jsx)(et,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==b||t[27]!==x||t[28]!==S?(T=S&&(x||b)?(0,Q.jsx)(fe,{}):null,t[26]=b,t[27]=x,t[28]=S,t[29]=T):T=t[29],E=x?(0,Q.jsxs)(le,{"aria-label":r({id:`ALhMYW`}),children:[(0,Q.jsx)(ue,{children:(0,Q.jsx)(s,{id:`ALhMYW`})}),m.map(t=>{let{displayName:n}=we[t];return(0,Q.jsxs)(oe,{onSelect:()=>{f!==null&&(g?.(),o.launchInTerminal(f,t))},disabled:_,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":r(e?{id:`AIn2Yv`,values:{displayName:n,hint:e}}:{id:`QYfQdv`,values:{displayName:n}}),children:[(0,Q.jsx)(X,{id:J(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,D=b?(0,Q.jsxs)(Q.Fragment,{children:[x?(0,Q.jsx)(fe,{}):null,(0,Q.jsxs)(le,{"aria-label":r({id:`BwKH4d`}),children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`BwKH4d`}),(0,Q.jsx)($e,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let n=!_,{displayName:i}=t,a=r(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(oe,{disabled:!n,onSelect:()=>{if(f){if(g?.(),p[t.id]?.installed!==!0){rn(t);return}h(t.id,f)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(X,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Dn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=r,t[1]=h,t[2]=f,t[3]=_,t[4]=p,t[5]=g,t[6]=u,t[7]=l,t[8]=o,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O}else v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let k;t[30]!==b||t[31]!==x||t[32]!==S?(k=S||x||b?(0,Q.jsx)(fe,{}):null,t[30]=b,t[31]=x,t[32]=S,t[33]=k):k=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(d,{"aria-hidden":`true`}),t[34]=A):A=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(oe,{onSelect:Re,"data-testid":`file-tree-open-in-settings`,children:[A,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`jRAGrQ`})})]}),t[35]=j):j=t[35];let M;t[36]!==v||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E||t[41]!==D||t[42]!==k?(M=(0,Q.jsxs)(v,{className:C,children:[w,T,E,D,k,j]}),t[36]=v,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D,t[42]=k,t[43]=M):M=t[43];let N;return t[44]!==y||t[45]!==O||t[46]!==M?(N=(0,Q.jsxs)(y,{children:[O,M]}),t[44]=y,t[45]=O,t[46]=M,t[47]=N):N=t[47],N}var In=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Ln(e){let t=be(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=je(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=ke(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=In.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Rn(e,t,n){return e.filter(e=>{let r=mt(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=Ln(r.docName);return i?.scope===t&&i.name===n})}function zn(e,t,n){let r=pt(t,n);return e.filter(e=>{let i=mt(e);return i.kind===`skill-file`?i.scope===t.scope&&i.name===t.name&&i.path===n:i.kind===`doc`&&i.docName===r})}function Bn(e,t,n){let r=Ln(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return pt(i,a)===e?{skill:i,filePath:a}:null}function Vn(e,t,n=(e,t)=>Be(e,t)||We(e,t)){let r=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),i=[],a=new Set;for(let t of e){let e=Ln(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Ln(t);if(!e||r.has(`${e.scope}\u0000${e.name}`))continue;let o=e.scope===`project`?`global`:`project`,s=r.get(`${o}\u0000${e.name}`);e.rel===null&&s!==void 0?i.push({kind:`retarget`,fromDocName:t,toDocName:ft(s)}):n(e.scope,e.name)||(s!==void 0&&!a.has(`${e.scope}\u0000${e.name}`)?(a.add(`${e.scope}\u0000${e.name}`),i.push({kind:`retarget`,fromDocName:t,toDocName:ft(s)})):i.push({kind:`close`,docName:t}))}return i}function Hn(){let e=(0,At.c)(15),{openTabs:t,closeDocument:n}=i(),r=nt(),a;e[0]===t?a=e[1]:(a=t.some(Wn),e[0]=t,e[1]=a);let o=a,s;e[2]===o?s=e[3]:(s={enabled:o},e[2]=o,e[3]=s);let c=gt(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Un).sort().join(``)}\u0002${He()}`;if(l.current===i)return;l.current=i;let a=Vn(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Un(e){return`${e.scope}\u0000${e.name}`}function Wn(e){return Ln(e)!==null}function Gn(e){let t=(0,At.c)(19),{skill:n,onOpenChange:r,onDeleted:a}=e,{_:o}=c(),{setSkillsSidebar:s,closeTabs:l,openTabs:u}=i(),[d,f]=(0,$.useState)(!1),p;t[0]!==o||t[1]!==l||t[2]!==a||t[3]!==r||t[4]!==u||t[5]!==s?(p=async function(e){s(!0),f(!0);let t=await St(e.scope,e.name);if(f(!1),!t.ok){let{error:e}=t;Z.error(o({id:`AtBdnD`,values:{error:e}}));return}Z.success(o({id:`h9QFb9`,values:{0:e.name}})),l(Rn(u,e.scope,e.name),{force:!0}),a(),r(!1)},t[0]=o,t[1]=l,t[2]=a,t[3]=r,t[4]=u,t[5]=s,t[6]=p):p=t[6];let m=p,h=n!==null,g;t[7]!==d||t[8]!==r?(g=e=>{!e&&!d&&r(!1)},t[7]=d,t[8]=r,t[9]=g):g=t[9];let y;t[10]!==o||t[11]!==d||t[12]!==m||t[13]!==n?(y=n?(0,Q.jsx)(v,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:d,onDelete:()=>m(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?o({id:`WnsbUT`,values:{0:n.path}}):o({id:`E1Da_b`,values:{0:n.path}})}):null,t[10]=o,t[11]=d,t[12]=m,t[13]=n,t[14]=y):y=t[14];let b;return t[15]!==h||t[16]!==g||t[17]!==y?(b=(0,Q.jsx)(_,{open:h,onOpenChange:g,children:y}),t[15]=h,t[16]=g,t[17]=y,t[18]=b):b=t[18],b}function Kn(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function qn(e){let t=(0,At.c)(66),{target:n,onOpenChange:r}=e,{_:a}=c(),{openTarget:o}=i(),l=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,x,S;t[6]!==u||t[7]!==f?(S=u.trim(),b=S===``||!Kn(S),y=!b&&!f,x=S.includes(`/`)?S.split(`/`).slice(0,-1).join(`/`):null,t[6]=u,t[7]=f,t[8]=y,t[9]=b,t[10]=x,t[11]=S):(y=t[8],b=t[9],x=t[10],S=t[11]);let C=x,w;t[12]!==a||t[13]!==y||t[14]!==r||t[15]!==o||t[16]!==n||t[17]!==S?(w=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(S),t=await _t({scope:n.skill.scope,name:n.skill.name,path:S,content:e?`# ${S.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(a({id:`a_2_uB`,values:{0:t.error,trimmed:S}}));return}if(Z.success(a({id:`MXSt4t`,values:{0:t.path}})),e){let e=pt(n.skill,S);o({kind:`doc`,target:e,docName:e})}r(!1)},t[12]=a,t[13]=y,t[14]=r,t[15]=o,t[16]=n,t[17]=S,t[18]=w):w=t[18];let T=w,E;t[19]!==r||t[20]!==f?(E=e=>{!e&&!f&&r(!1)},t[19]=r,t[20]=f,t[21]=E):E=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`wQvvZY`})}),t[22]=O):O=t[22];let k;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(te,{children:[O,(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`lM4c-I`})})]}),t[23]=k):k=t[23];let A;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(s,{id:`I6gXOa`}),t[24]=A):A=t[24];let P;t[25]===l?P=t[26]:(P=(0,Q.jsx)(pe,{htmlFor:l,children:A}),t[25]=l,t[26]=P);let F;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>d(e.target.value),t[27]=F):F=t[27];let I=b&&S!==``,L;t[28]===T?L=t[29]:(L=e=>{e.key===`Enter`&&T()},t[28]=T,t[29]=L);let R;t[30]!==l||t[31]!==u||t[32]!==I||t[33]!==L?(R=(0,Q.jsx)(dt,{id:l,value:u,onChange:F,placeholder:`references/notes.md`,"aria-invalid":I,onKeyDown:L}),t[30]=l,t[31]=u,t[32]=I,t[33]=L,t[34]=R):R=t[34];let z;t[35]!==C||t[36]!==b||t[37]!==S?(z=b&&S!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(s,{id:`fVzizW`})}):C?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(s,{id:`9lso1Y`,values:{folderPart:C},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null,t[35]=C,t[36]=b,t[37]=S,t[38]=z):z=t[38];let B;t[39]!==P||t[40]!==R||t[41]!==z?(B=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[P,R,z]}),t[39]=P,t[40]=R,t[41]=z,t[42]=B):B=t[42];let V;t[43]===r?V=t[44]:(V=()=>r(!1),t[43]=r,t[44]=V);let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(s,{id:`dEgA5A`}),t[45]=H):H=t[45];let U;t[46]!==f||t[47]!==V?(U=(0,Q.jsx)(D,{variant:`outline`,onClick:V,disabled:f,children:H}),t[46]=f,t[47]=V,t[48]=U):U=t[48];let W;t[49]===T?W=t[50]:(W=()=>void T(),t[49]=T,t[50]=W);let G=!y,K;t[51]===f?K=t[52]:(K=f?(0,Q.jsx)(s,{id:`E9bKSA`}):(0,Q.jsx)(s,{id:`hYgDIe`}),t[51]=f,t[52]=K);let q;t[53]!==W||t[54]!==G||t[55]!==K?(q=(0,Q.jsx)(D,{onClick:W,disabled:G,children:K}),t[53]=W,t[54]=G,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==U||t[58]!==q?(J=(0,Q.jsxs)(ee,{children:[U,q]}),t[57]=U,t[58]=q,t[59]=J):J=t[59];let Y;t[60]!==B||t[61]!==J?(Y=(0,Q.jsxs)(N,{className:`sm:max-w-md`,children:[k,B,J]}),t[60]=B,t[61]=J,t[62]=Y):Y=t[62];let X;return t[63]!==Y||t[64]!==E?(X=(0,Q.jsx)(ne,{open:!0,onOpenChange:E,children:Y}),t[63]=Y,t[64]=E,t[65]=X):X=t[65],X}function Jn(e){let t=(0,At.c)(18),{target:n,onOpenChange:r}=e,{_:a}=c(),{setSkillsSidebar:o,closeTabs:s,openTabs:l}=i(),[u,d]=(0,$.useState)(!1),f;t[0]!==a||t[1]!==s||t[2]!==r||t[3]!==l||t[4]!==o?(f=async function(e){let{skill:t,filePath:n}=e;o(!0),d(!0);let i=await Ct({scope:t.scope,name:t.name,path:n});if(d(!1),!i.ok){Z.error(a({id:`CBT70t`,values:{0:i.error}}));return}if(!i.existed){Z.error(a({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(a({id:`gOmloS`,values:{filePath:n}})),s(zn(l,t,n),{force:!0}),r(!1)},t[0]=a,t[1]=s,t[2]=r,t[3]=l,t[4]=o,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==u||t[7]!==r?(h=e=>{!e&&!u&&r(!1)},t[6]=u,t[7]=r,t[8]=h):h=t[8];let g;t[9]!==a||t[10]!==u||t[11]!==p||t[12]!==n?(g=n?(0,Q.jsx)(v,{itemName:a({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:u,onDelete:()=>p(n),customDescription:a({id:`ppzof_`,values:{0:ct(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[9]=a,t[10]=u,t[11]=p,t[12]=n,t[13]=g):g=t[13];let y;return t[14]!==m||t[15]!==h||t[16]!==g?(y=(0,Q.jsx)(_,{open:m,onOpenChange:h,children:g}),t[14]=m,t[15]=h,t[16]=g,t[17]=y):y=t[17],y}function Yn(e){let t=(0,At.c)(64),{target:n,onOpenChange:r}=e,{_:i}=c(),a=nt(),o=(0,$.useId)(),[l,u]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&u(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==l||t[7]!==n.filePath?(y=l.trim(),b=y===n.filePath,v=y===``||!Kn(y),t[6]=l,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let x=v,S=!x&&!b&&!d,C;t[11]!==i||t[12]!==S||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(C=async function(){if(!n||!S)return;f(!0);let e=await Et({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=S,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=C):C=t[17];let w=C,T;t[18]!==r||t[19]!==d?(T=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`yckias`})}),t[21]=E):E=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(te,{children:[E,(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`HzVAoz`})})]}),t[22]=O):O=t[22];let k;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(s,{id:`I6gXOa`}),t[23]=k):k=t[23];let A;t[24]===o?A=t[25]:(A=(0,Q.jsx)(pe,{htmlFor:o,children:k}),t[24]=o,t[25]=A);let P;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>u(e.target.value),t[26]=P):P=t[26];let F=x&&y!==``,I;t[27]===w?I=t[28]:(I=e=>{e.key===`Enter`&&w()},t[27]=w,t[28]=I);let L;t[29]!==o||t[30]!==l||t[31]!==F||t[32]!==I?(L=(0,Q.jsx)(dt,{id:o,value:l,onChange:P,"aria-invalid":F,onKeyDown:I}),t[29]=o,t[30]=l,t[31]=F,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==x||t[35]!==y?(R=x&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(s,{id:`fVzizW`})}):null,t[34]=x,t[35]=y,t[36]=R):R=t[36];let z;t[37]!==A||t[38]!==L||t[39]!==R?(z=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[A,L,R]}),t[37]=A,t[38]=L,t[39]=R,t[40]=z):z=t[40];let B;t[41]===r?B=t[42]:(B=()=>r(!1),t[41]=r,t[42]=B);let V;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(s,{id:`dEgA5A`}),t[43]=V):V=t[43];let H;t[44]!==d||t[45]!==B?(H=(0,Q.jsx)(D,{variant:`outline`,onClick:B,disabled:d,children:V}),t[44]=d,t[45]=B,t[46]=H):H=t[46];let U;t[47]===w?U=t[48]:(U=()=>void w(),t[47]=w,t[48]=U);let W=!S,G;t[49]===d?G=t[50]:(G=d?(0,Q.jsx)(s,{id:`tHKQ6j`}):(0,Q.jsx)(s,{id:`2wxgft`}),t[49]=d,t[50]=G);let K;t[51]!==U||t[52]!==W||t[53]!==G?(K=(0,Q.jsx)(D,{onClick:U,disabled:W,children:G}),t[51]=U,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;t[55]!==H||t[56]!==K?(q=(0,Q.jsxs)(ee,{children:[H,K]}),t[55]=H,t[56]=K,t[57]=q):q=t[57];let J;t[58]!==z||t[59]!==q?(J=(0,Q.jsxs)(N,{className:`sm:max-w-md`,children:[O,z,q]}),t[58]=z,t[59]=q,t[60]=J):J=t[60];let Y;return t[61]!==J||t[62]!==T?(Y=(0,Q.jsx)(ne,{open:!0,onOpenChange:T,children:J}),t[61]=J,t[62]=T,t[63]=Y):Y=t[63],Y}function Xn(e){let t=(0,At.c)(59),{target:n,onOpenChange:r}=e,{_:i}=c(),a=(0,$.useId)(),[o,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b;t[0]===n?b=t[1]:(b=()=>{if(l(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${lt(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,l]])Tt({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=b);let x=n?.skill.scope,S=n?.skill.name,C=n?.editor,w;if(t[2]!==x||t[3]!==S||t[4]!==C?(w=[x,S,C],t[2]=x,t[3]=S,t[4]=C,t[5]=w):w=t[5],(0,$.useEffect)(b,w),!n)return null;let{skill:T,editor:E}=n,O;t[6]!==i||t[7]!==E||t[8]!==r||t[9]!==T.name||t[10]!==T.scope||t[11]!==n||t[12]!==g?(O=async function(e){if(!n)return;y(!0);let t=await vt({scope:T.scope,name:T.name,editor:E,action:e,...e===`rename`?{toName:g.trim()}:{}});if(y(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:E}}:e===`make-source`?{id:`It9oAP`,values:{editor:E}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=E,t[8]=r,t[9]=T.name,t[10]=T.scope,t[11]=n,t[12]=g,t[13]=O):O=t[13];let k=O,A,F;t[14]!==T.name||t[15]!==g?(F=g.trim(),A=F===``||!Ae.test(F)||F===T.name,t[14]=T.name,t[15]=g,t[16]=A,t[17]=F):(A=t[16],F=t[17]);let I=A,L;t[18]!==v||t[19]!==r?(L=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=L):L=t[20];let R;t[21]!==E||t[22]!==T.name?(R=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`q8aCbb`,values:{0:T.name,editor:E}})}),t[21]=E,t[22]=T.name,t[23]=R):R=t[23];let z;t[24]===E?z=t[25]:(z=(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`QASTNu`,values:{editor:E}})}),t[24]=E,t[25]=z);let B;t[26]!==z||t[27]!==R?(B=(0,Q.jsxs)(te,{children:[R,z]}),t[26]=z,t[27]=R,t[28]=B):B=t[28];let V;t[29]!==u||t[30]!==o||t[31]!==f?(V=u!==null&&o!==null?(0,Q.jsx)(Ot,{oldContent:u,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(s,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(s,{id:`1V17kO`})}),t[29]=u,t[30]=o,t[31]=f,t[32]=V):V=t[32];let H;t[33]!==k||t[34]!==E||t[35]!==a||t[36]!==I||t[37]!==m||t[38]!==T.name||t[39]!==g||t[40]!==F?(H=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(pe,{htmlFor:a,children:(0,Q.jsx)(s,{id:`pSimwP`,values:{editor:E}})}),(0,Q.jsx)(dt,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${T.name}-${E}`,"aria-invalid":I&&F!==``,onKeyDown:e=>{e.key===`Enter`&&!I&&k(`rename`)}})]}):null,t[33]=k,t[34]=E,t[35]=a,t[36]=I,t[37]=m,t[38]=T.name,t[39]=g,t[40]=F,t[41]=H):H=t[41];let U;t[42]!==V||t[43]!==H?(U=(0,Q.jsxs)(P,{className:`min-h-0 flex-1 overflow-auto`,children:[V,H]}),t[42]=V,t[43]=H,t[44]=U):U=t[44];let W;t[45]!==k||t[46]!==v||t[47]!==E||t[48]!==I||t[49]!==m||t[50]!==T.name?(W=(0,Q.jsx)(ee,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(s,{id:`iH8pgl`})}),(0,Q.jsx)(D,{onClick:()=>void k(`rename`),disabled:v||I,children:(0,Q.jsx)(s,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>{_(`${T.name}-${E}`),h(!0)},disabled:v,children:(0,Q.jsx)(s,{id:`AT0e50`})}),(0,Q.jsx)(D,{variant:`outline`,onClick:()=>void k(`make-source`),disabled:v,children:(0,Q.jsx)(s,{id:`xWomUD`,values:{editor:E}})}),(0,Q.jsx)(D,{onClick:()=>void k(`align`),disabled:v,children:(0,Q.jsx)(s,{id:`PZn2LP`})})]})}),t[45]=k,t[46]=v,t[47]=E,t[48]=I,t[49]=m,t[50]=T.name,t[51]=W):W=t[51];let G;t[52]!==B||t[53]!==U||t[54]!==W?(G=(0,Q.jsxs)(N,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[B,U,W]}),t[52]=B,t[53]=U,t[54]=W,t[55]=G):G=t[55];let K;return t[56]!==G||t[57]!==L?(K=(0,Q.jsx)(ne,{open:!0,onOpenChange:L,children:G}),t[56]=G,t[57]=L,t[58]=K):K=t[58],K}function Zn(e){let t=(0,At.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=rt(),c=n!==null,l=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,x,S,C;if(t[5]!==r||t[6]!==u||t[7]!==n.name){S=u.trim(),C=S===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,x=S.length>64,y=S===``||!Ae.test(S)||x,b=!y&&!C&&r.has(S),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13];let w=b,T=!y&&!w&&!C&&!f,E;t[17]!==T||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==S?(E=async function(){if(!n||!T)return;p(!0);let e=await o({scope:n.scope,name:n.name},S);p(!1),e.ok&&(a?.(S),i(!1))},t[17]=T,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=S,t[23]=E):E=t[23];let O=E,k;t[24]===i?k=t[25]:(k=e=>e?null:i(!1),t[24]=i,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`dw_3cv`})}),t[26]=A):A=t[26];let P;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsxs)(te,{children:[A,(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`R9IDFz`})})]}),t[27]=P):P=t[27];let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(s,{id:`6YtxFj`}),t[28]=F):F=t[28];let I;t[29]===l?I=t[30]:(I=(0,Q.jsx)(pe,{htmlFor:l,children:F}),t[29]=l,t[30]=I);let L;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>d(e.target.value),t[31]=L):L=t[31];let R;t[32]===O?R=t[33]:(R=e=>{e.key===`Enter`&&O()},t[32]=O,t[33]=R);let z=y||w,B=y&&S!==``||w?`${l}-error`:void 0,V;t[34]!==l||t[35]!==u||t[36]!==R||t[37]!==z||t[38]!==B?(V=(0,Q.jsx)(dt,{id:l,value:u,onChange:L,onKeyDown:R,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":z,"aria-describedby":B,className:`font-mono`}),t[34]=l,t[35]=u,t[36]=R,t[37]=z,t[38]=B,t[39]=V):V=t[39];let H;t[40]!==w||t[41]!==v||t[42]!==l||t[43]!==y||t[44]!==x||t[45]!==S?(H=y&&S!==``?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(s,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):x?(0,Q.jsx)(s,{id:`lK9c4T`}):(0,Q.jsx)(s,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):w?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(s,{id:`YJ1BTp`})}):null,t[40]=w,t[41]=v,t[42]=l,t[43]=y,t[44]=x,t[45]=S,t[46]=H):H=t[46];let U;t[47]!==I||t[48]!==V||t[49]!==H?(U=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[I,V,H]}),t[47]=I,t[48]=V,t[49]=H,t[50]=U):U=t[50];let W;t[51]===i?W=t[52]:(W=()=>i(!1),t[51]=i,t[52]=W);let G;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(s,{id:`dEgA5A`}),t[53]=G):G=t[53];let K;t[54]!==f||t[55]!==W?(K=(0,Q.jsx)(D,{variant:`outline`,className:`font-mono uppercase`,onClick:W,disabled:f,children:G}),t[54]=f,t[55]=W,t[56]=K):K=t[56];let q;t[57]===O?q=t[58]:(q=()=>void O(),t[57]=O,t[58]=q);let J=!T,Y;t[59]===f?Y=t[60]:(Y=f?(0,Q.jsx)(s,{id:`tHKQ6j`}):(0,Q.jsx)(s,{id:`2wxgft`}),t[59]=f,t[60]=Y);let X;t[61]!==q||t[62]!==J||t[63]!==Y?(X=(0,Q.jsx)(D,{onClick:q,disabled:J,children:Y}),t[61]=q,t[62]=J,t[63]=Y,t[64]=X):X=t[64];let re;t[65]!==K||t[66]!==X?(re=(0,Q.jsxs)(ee,{children:[K,X]}),t[65]=K,t[66]=X,t[67]=re):re=t[67];let ie;t[68]!==U||t[69]!==re?(ie=(0,Q.jsxs)(N,{children:[P,U,re]}),t[68]=U,t[69]=re,t[70]=ie):ie=t[70];let ae;return t[71]!==c||t[72]!==ie||t[73]!==k?(ae=(0,Q.jsx)(ne,{open:c,onOpenChange:k,children:ie}),t[71]=c,t[72]=ie,t[73]=k,t[74]=ae):ae=t[74],ae}function Qn(){let e=(0,At.c)(7),{_:t}=c(),n=ut(),r=nt(),{setSkillsSidebar:a,openTabs:o}=i(),s=gt(),l;return e[0]!==t||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==a||e[5]!==s?(l=async(e,i)=>{if(i===e.scope)return!1;Ge(e.scope,e.name),Ue(e.scope,e.name);let c=await bt({name:e.name,fromScope:e.scope,toScope:i});if(Ve(e.scope,e.name),!c.ok)return Ke(e.scope,e.name),Z.error(t({id:`07eGJB`,values:{0:c.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[i]}}));let l=s.status===`ready`?s.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,u=o.map(er).filter(t=>{if(t.kind!==`doc`)return!1;let n=Ln(t.docName);return n?.scope===e.scope&&n.name===e.name}),d=u.find($n)??u[0],f=d?.kind===`doc`?d.docName:l?ft(l):e.scope===`global`?ye(e.scope,e.name):null,p=i===`project`&&c.path!==void 0?`${c.path.replace(/\/+$/,``)}/SKILL`:ye(i,e.name);try{f!==null&&r(f,p)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return a(!0),Ke(e.scope,e.name),!0},e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l}function $n(e){return e.kind===`doc`&&Ln(e.docName)?.rel===null}function er(e){return mt(e)}function tr(e){let t=(0,At.c)(38),{target:n,onOpenChange:r}=e,i=ut(),a=Qn(),[o,c]=(0,$.useState)(!1);if(!n)return null;let{scope:l,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[l],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let x;t[13]!==m||t[14]!==b?(x=(0,Q.jsxs)(te,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(s,{id:`dEgA5A`}),t[16]=S):S=t[16];let C;t[17]===o?C=t[18]:(C=(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsx)(D,{variant:`outline`,disabled:o,children:S})}),t[17]=o,t[18]=C);let w;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==l||t[23]!==d?(w=async()=>{c(!0),await a({scope:l,name:u},d),c(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=l,t[23]=d,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(s,{id:`QWdKwH`}),t[25]=T):T=t[25];let E;t[26]!==o||t[27]!==w?(E=(0,Q.jsx)(D,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:w,children:T}),t[26]=o,t[27]=w,t[28]=E):E=t[28];let O;t[29]!==C||t[30]!==E?(O=(0,Q.jsxs)(ee,{children:[C,E]}),t[29]=C,t[30]=E,t[31]=O):O=t[31];let k;t[32]!==x||t[33]!==O?(k=(0,Q.jsxs)(N,{className:`sm:max-w-md`,children:[x,O]}),t[32]=x,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==f||t[36]!==k?(A=(0,Q.jsx)(ne,{open:!0,onOpenChange:f,children:k}),t[35]=f,t[36]=k,t[37]=A):A=t[37],A}function nr(){let e=(0,At.c)(50),{_:t}=c(),n=at(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),Ge(e.scope,e.name);let i=await xt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(Ke(e.scope,e.name),y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=rr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),Ge(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await wt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}Ke(e.scope,e.name),y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name),Ge(e.scope,e.name);let n=await t();return Ke(e.scope,e.name),y(null),n},e[3]=w):w=e[3];let T=w,E;e[4]!==t||e[5]!==n?(E=async function(e,r){let i=await yt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O,k;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{e||i(null)},k=()=>i(null),e[7]=O,e[8]=k):(O=e[7],k=e[8]);let A;e[9]===r?A=e[10]:(A=(0,Q.jsx)(Gn,{skill:r,onOpenChange:O,onDeleted:k}),e[9]=r,e[10]=A);let j=a?.skill??null,M=a?.existingNames??ar,N,P;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e||o(null)},N=()=>o(null),e[11]=N,e[12]=P):(N=e[11],P=e[12]);let ee;e[13]!==j||e[14]!==M?(ee=(0,Q.jsx)(Zn,{skill:j,existingNames:M,onOpenChange:P,onRenamed:N}),e[13]=j,e[14]=M,e[15]=ee):ee=e[15];let F;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||l(null)},e[16]=F):F=e[16];let te;e[17]===s?te=e[18]:(te=(0,Q.jsx)(tr,{target:s,onOpenChange:F}),e[17]=s,e[18]=te);let ne;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{e||d(null)},e[19]=ne):ne=e[19];let I;e[20]===u?I=e[21]:(I=(0,Q.jsx)(Yn,{target:u,onOpenChange:ne}),e[20]=u,e[21]=I);let L;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e||p(null)},e[22]=L):L=e[22];let R;e[23]===f?R=e[24]:(R=(0,Q.jsx)(Jn,{target:f,onOpenChange:L}),e[23]=f,e[24]=R);let z;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{e||h(null)},e[25]=z):z=e[25];let B;e[26]===m?B=e[27]:(B=(0,Q.jsx)(qn,{target:m,onOpenChange:z}),e[26]=m,e[27]=B);let V;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>{e||_(null)},e[28]=V):V=e[28];let H;e[29]===g?H=e[30]:(H=(0,Q.jsx)(Xn,{target:g,onOpenChange:V}),e[29]=g,e[30]=H);let U;e[31]!==ee||e[32]!==te||e[33]!==I||e[34]!==R||e[35]!==B||e[36]!==H||e[37]!==A?(U=(0,Q.jsxs)(Q.Fragment,{children:[A,ee,te,I,R,B,H]}),e[31]=ee,e[32]=te,e[33]=I,e[34]=R,e[35]=B,e[36]=H,e[37]=A,e[38]=U):U=e[38];let W=U,G,K,q,J,Y,X;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(G=(e,t)=>o({skill:e,existingNames:t}),K=(e,t)=>l({scope:e.scope,name:e.name,toScope:t}),q=(e,t)=>d({skill:e,filePath:t}),J=(e,t)=>p({skill:e,filePath:t}),Y=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),X=(e,t)=>_({skill:e,editor:t}),e[39]=G,e[40]=K,e[41]=q,e[42]=J,e[43]=Y,e[44]=X):(G=e[39],K=e[40],q=e[41],J=e[42],Y=e[43],X=e[44]);let re;return e[45]!==W||e[46]!==D||e[47]!==x||e[48]!==v?(re={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,requestDelete:i,requestRename:G,requestScopeMove:K,requestFileRename:q,requestFileDelete:J,requestFileCreate:Y,requestForkResolve:X,dialogs:W},e[45]=W,e[46]=D,e[47]=x,e[48]=v,e[49]=re):re=e[49],re}function rr(e){return e.map(ir).join(`, `)}function ir(e){return Ne[e]??e}var ar=new Set;function or(e){let t=(0,At.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(it,{"aria-hidden":!0}),c=kt(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(S,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function sr(e){let t=(0,At.c)(68),{skill:n,filePath:r,actions:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,{_:l}=c(),u;t[0]!==r||t[1]!==n.absolutePath?(u=n.absolutePath?`${ct(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=u):u=t[2];let d=u,f;t[3]===n.path?f=t[4]:(f=ct(n.path),t[3]=n.path,t[4]=f);let p=`${f}/${r}`,m;t[5]===l?m=t[6]:(m=async function(e){try{await Dt(e),Z.success(l({id:`SXCSQd`}))}catch{Z.error(l({id:`cRHuuI`}))}},t[5]=l,t[6]=m);let _=m,v;t[7]!==i||t[8]!==r||t[9]!==n?(v=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=v):v=t[10];let y,x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(En,{"aria-hidden":!0}),x=(0,Q.jsx)(s,{id:`2wxgft`}),t[11]=y,t[12]=x):(y=t[11],x=t[12]);let C;t[13]!==o||t[14]!==v?(C=(0,Q.jsxs)(S,{menuKind:o,onSelect:v,children:[y,x]}),t[13]=o,t[14]=v,t[15]=C):C=t[15];let T;t[16]!==d||t[17]!==o?(T=(0,Q.jsx)(or,{absolutePath:d,menuKind:o}),t[16]=d,t[17]=o,t[18]=T):T=t[18];let D,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(tt,{"aria-hidden":!0}),O=(0,Q.jsx)(s,{id:`zd00pH`}),t[19]=D,t[20]=O):(D=t[19],O=t[20]);let k;t[21]===o?k=t[22]:(k=(0,Q.jsxs)(E,{menuKind:o,children:[D,O]}),t[21]=o,t[22]=k);let A;t[23]!==d||t[24]!==_||t[25]!==o?(A=d?(0,Q.jsx)(S,{menuKind:o,onSelect:()=>void _(d),children:(0,Q.jsx)(s,{id:`z2funE`})}):null,t[23]=d,t[24]=_,t[25]=o,t[26]=A):A=t[26];let j;t[27]!==_||t[28]!==p?(j=()=>void _(p),t[27]=_,t[28]=p,t[29]=j):j=t[29];let M;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(s,{id:`xloBjn`}),t[30]=M):M=t[30];let N;t[31]!==o||t[32]!==j?(N=(0,Q.jsx)(S,{menuKind:o,onSelect:j,children:M}),t[31]=o,t[32]=j,t[33]=N):N=t[33];let P;t[34]!==o||t[35]!==A||t[36]!==N?(P=(0,Q.jsxs)(h,{menuKind:o,children:[A,N]}),t[34]=o,t[35]=A,t[36]=N,t[37]=P):P=t[37];let ee;t[38]!==o||t[39]!==P?(ee=(0,Q.jsx)(b,{menuKind:o,children:P}),t[38]=o,t[39]=P,t[40]=ee):ee=t[40];let F;t[41]!==o||t[42]!==k||t[43]!==ee?(F=(0,Q.jsxs)(g,{menuKind:o,children:[k,ee]}),t[41]=o,t[42]=k,t[43]=ee,t[44]=F):F=t[44];let te;t[45]!==o||t[46]!==F||t[47]!==C||t[48]!==T?(te=(0,Q.jsxs)(h,{menuKind:o,children:[C,T,F]}),t[45]=o,t[46]=F,t[47]=C,t[48]=T,t[49]=te):te=t[49];let ne;t[50]===o?ne=t[51]:(ne=(0,Q.jsx)(w,{menuKind:o}),t[50]=o,t[51]=ne);let I;t[52]!==i||t[53]!==r||t[54]!==n?(I=()=>i.requestFileDelete(n,r),t[52]=i,t[53]=r,t[54]=n,t[55]=I):I=t[55];let L,R;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(st,{"aria-hidden":!0}),R=(0,Q.jsx)(s,{id:`cnGeoo`}),t[56]=L,t[57]=R):(L=t[56],R=t[57]);let z;t[58]!==o||t[59]!==I?(z=(0,Q.jsxs)(S,{menuKind:o,variant:`destructive`,onSelect:I,children:[L,R]}),t[58]=o,t[59]=I,t[60]=z):z=t[60];let B;t[61]!==o||t[62]!==z?(B=(0,Q.jsx)(h,{menuKind:o,children:z}),t[61]=o,t[62]=z,t[63]=B):B=t[63];let V;return t[64]!==te||t[65]!==ne||t[66]!==B?(V=(0,Q.jsxs)(Q.Fragment,{children:[te,ne,B]}),t[64]=te,t[65]=ne,t[66]=B,t[67]=V):V=t[67],V}function cr(e){let t=(0,At.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Ze(),c=p().states,{dispatch:l}=Cn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=on({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,m;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(m=o===`context`?(0,Q.jsx)(Nn,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(Fn,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=m):m=t[8];let h;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==m?(h=(0,Q.jsx)(lr,{actions:r,existingNames:i,menuKind:o,skill:n,openWithAi:m}),t[9]=r,t[10]=i,t[11]=o,t[12]=n,t[13]=m,t[14]=h):h=t[14],h}function lr(e){let t=(0,At.c)(124),{actions:n,existingNames:i,menuKind:a,openWithAi:o,skill:l}=e,{_:u}=c(),d=ut(),f=C(l,n),p=l.absolutePath,m;t[0]===u?m=t[1]:(m=async function(e){try{await Dt(e),Z.success(u({id:`SXCSQd`}))}catch{Z.error(u({id:`cRHuuI`}))}},t[0]=u,t[1]=m);let _=m,v;t[2]!==p||t[3]!==a?(v=(0,Q.jsx)(or,{absolutePath:p,menuKind:a}),t[2]=p,t[3]=a,t[4]=v):v=t[4];let D,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(tt,{"aria-hidden":!0}),O=(0,Q.jsx)(s,{id:`zd00pH`}),t[5]=D,t[6]=O):(D=t[5],O=t[6]);let k;t[7]===a?k=t[8]:(k=(0,Q.jsxs)(E,{menuKind:a,children:[D,O]}),t[7]=a,t[8]=k);let A;t[9]!==p||t[10]!==_||t[11]!==a?(A=p?(0,Q.jsx)(S,{menuKind:a,onSelect:()=>void _(p),children:(0,Q.jsx)(s,{id:`z2funE`})}):null,t[9]=p,t[10]=_,t[11]=a,t[12]=A):A=t[12];let j;t[13]!==_||t[14]!==l.path?(j=()=>void _(l.path),t[13]=_,t[14]=l.path,t[15]=j):j=t[15];let M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(s,{id:`xloBjn`}),t[16]=M):M=t[16];let N;t[17]!==a||t[18]!==j?(N=(0,Q.jsx)(S,{menuKind:a,onSelect:j,children:M}),t[17]=a,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==a||t[21]!==A||t[22]!==N?(P=(0,Q.jsxs)(h,{menuKind:a,children:[A,N]}),t[20]=a,t[21]=A,t[22]=N,t[23]=P):P=t[23];let ee;t[24]!==a||t[25]!==P?(ee=(0,Q.jsx)(b,{menuKind:a,children:P}),t[24]=a,t[25]=P,t[26]=ee):ee=t[26];let F;t[27]!==a||t[28]!==ee||t[29]!==k?(F=(0,Q.jsxs)(g,{menuKind:a,children:[k,ee]}),t[27]=a,t[28]=ee,t[29]=k,t[30]=F):F=t[30];let te;t[31]!==a||t[32]!==o||t[33]!==F||t[34]!==v?(te=(0,Q.jsxs)(h,{menuKind:a,children:[v,o,F]}),t[31]=a,t[32]=o,t[33]=F,t[34]=v,t[35]=te):te=t[35];let ne;t[36]===a?ne=t[37]:(ne=(0,Q.jsx)(w,{menuKind:a}),t[36]=a,t[37]=ne);let I;t[38]!==n||t[39]!==i||t[40]!==l?(I=()=>void n.duplicate(l,i),t[38]=n,t[39]=i,t[40]=l,t[41]=I):I=t[41];let L,R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(r,{"aria-hidden":!0}),R=(0,Q.jsx)(s,{id:`euc6Ns`}),t[42]=L,t[43]=R):(L=t[42],R=t[43]);let z;t[44]!==a||t[45]!==I?(z=(0,Q.jsxs)(S,{menuKind:a,onSelect:I,children:[L,R]}),t[44]=a,t[45]=I,t[46]=z):z=t[46];let B;t[47]!==n||t[48]!==i||t[49]!==l?(B=()=>n.requestRename(l,i),t[47]=n,t[48]=i,t[49]=l,t[50]=B):B=t[50];let V,H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(En,{"aria-hidden":!0}),H=(0,Q.jsx)(s,{id:`2wxgft`}),t[51]=V,t[52]=H):(V=t[51],H=t[52]);let U;t[53]!==a||t[54]!==B?(U=(0,Q.jsxs)(S,{menuKind:a,onSelect:B,children:[V,H]}),t[53]=a,t[54]=B,t[55]=U):U=t[55];let W;t[56]!==n||t[57]!==l?(W=()=>n.requestFileCreate(l),t[56]=n,t[57]=l,t[58]=W):W=t[58];let G,K;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(y,{"aria-hidden":!0}),K=(0,Q.jsx)(s,{id:`HdkSiO`}),t[59]=G,t[60]=K):(G=t[59],K=t[60]);let q;t[61]!==a||t[62]!==W?(q=(0,Q.jsxs)(S,{menuKind:a,onSelect:W,children:[G,K]}),t[61]=a,t[62]=W,t[63]=q):q=t[63];let J,Y;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(Tn,{"aria-hidden":!0}),Y=(0,Q.jsx)(s,{id:`TKQ7K-`}),t[64]=J,t[65]=Y):(J=t[64],Y=t[65]);let X;t[66]===a?X=t[67]:(X=(0,Q.jsxs)(E,{menuKind:a,children:[J,Y]}),t[66]=a,t[67]=X);let re;t[68]!==n||t[69]!==l?(re=e=>n.requestForkResolve(l,e),t[68]=n,t[69]=l,t[70]=re):re=t[70];let ie;t[71]!==f||t[72]!==a||t[73]!==l||t[74]!==re?(ie=(0,Q.jsx)(x,{toggles:f,skill:l,menuKind:a,onResolveFork:re}),t[71]=f,t[72]=a,t[73]=l,t[74]=re,t[75]=ie):ie=t[75];let ae;t[76]!==a||t[77]!==ie?(ae=(0,Q.jsx)(h,{menuKind:a,children:ie}),t[76]=a,t[77]=ie,t[78]=ae):ae=t[78];let oe;t[79]!==a||t[80]!==ae?(oe=(0,Q.jsx)(b,{menuKind:a,className:T,children:ae}),t[79]=a,t[80]=ae,t[81]=oe):oe=t[81];let se;t[82]!==a||t[83]!==X||t[84]!==oe?(se=(0,Q.jsxs)(g,{menuKind:a,children:[X,oe]}),t[82]=a,t[83]=X,t[84]=oe,t[85]=se):se=t[85];let ce;t[86]!==n||t[87]!==l?(ce=()=>n.requestScopeMove(l,l.scope===`project`?`global`:`project`),t[86]=n,t[87]=l,t[88]=ce):ce=t[88];let le;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Q.jsx)(wn,{"aria-hidden":!0}),t[89]=le):le=t[89];let ue;t[90]!==d.global||t[91]!==d.project||t[92]!==l.scope?(ue=l.scope===`project`?(0,Q.jsx)(s,{id:`bpytj4`,values:{0:d.global}}):(0,Q.jsx)(s,{id:`bpytj4`,values:{0:d.project}}),t[90]=d.global,t[91]=d.project,t[92]=l.scope,t[93]=ue):ue=t[93];let de;t[94]!==a||t[95]!==ce||t[96]!==ue?(de=(0,Q.jsxs)(S,{menuKind:a,onSelect:ce,children:[le,ue]}),t[94]=a,t[95]=ce,t[96]=ue,t[97]=de):de=t[97];let fe;t[98]!==a||t[99]!==z||t[100]!==U||t[101]!==q||t[102]!==se||t[103]!==de?(fe=(0,Q.jsxs)(h,{menuKind:a,children:[z,U,q,se,de]}),t[98]=a,t[99]=z,t[100]=U,t[101]=q,t[102]=se,t[103]=de,t[104]=fe):fe=t[104];let pe;t[105]===a?pe=t[106]:(pe=(0,Q.jsx)(w,{menuKind:a}),t[105]=a,t[106]=pe);let me;t[107]!==n||t[108]!==l?(me=()=>n.requestDelete(l),t[107]=n,t[108]=l,t[109]=me):me=t[109];let he,ge;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Q.jsx)(st,{"aria-hidden":!0}),ge=(0,Q.jsx)(s,{id:`cnGeoo`}),t[110]=he,t[111]=ge):(he=t[110],ge=t[111]);let _e;t[112]!==a||t[113]!==me?(_e=(0,Q.jsxs)(S,{menuKind:a,variant:`destructive`,onSelect:me,children:[he,ge]}),t[112]=a,t[113]=me,t[114]=_e):_e=t[114];let ve;t[115]!==a||t[116]!==_e?(ve=(0,Q.jsx)(h,{menuKind:a,children:_e}),t[115]=a,t[116]=_e,t[117]=ve):ve=t[117];let ye;return t[118]!==te||t[119]!==ne||t[120]!==fe||t[121]!==pe||t[122]!==ve?(ye=(0,Q.jsxs)(Q.Fragment,{children:[te,ne,fe,pe,ve]}),t[118]=te,t[119]=ne,t[120]=fe,t[121]=pe,t[122]=ve,t[123]=ye):ye=t[123],ye}export{vn as C,$t as E,rn as S,Qt as T,an as _,tr as a,mn as b,Fn as c,kn as d,Dn as f,nn as g,sn as h,nr as i,Nn as l,wn as m,sr as n,Bn as o,On as p,or as r,Hn as s,cr as t,An as u,en as v,Cn as w,bn as x,tn as y};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Mn as n,Zn as r,a as i,z as a}from"./DocumentContext-C-X4T4d9.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{l as u,s as d}from"./local-menu-action-bus-CIYp0C2E.js";import{t as f}from"./utils-CPqDy6Hr.js";import{D as p,E as m,a as h,c as g,g as _,h as v,k as y,l as b,n as x,o as S,r as C,s as w,t as T,u as E}from"./SkillInstallMenu-B7luagyu.js";import{t as D}from"./button-CA0dewJJ.js";import{i as O,n as k,t as A}from"./tooltip-DHXgxWLL.js";import{a as j,c as M,i as N,n as P,o as ee,r as F,s as te,t as ne}from"./dialog-HdfR4WGm.js";import{C as I,E as L,N as R,T as z,_ as B,c as V,d as H,f as U,g as W,i as G,l as K,m as q,n as J,p as Y,r as X,u as re,v as ie,w as ae}from"./terminal-cli-display-Dcm1esjR.js";import{a as oe,d as se,f as ce,i as le,o as ue,p as de,u as fe}from"./dropdown-menu-CLgDYkh1.js";import{t as pe}from"./label-B5yNUINo.js";import{Bn as me,Gn as he,Hn as ge,Kn as _e,Ln as ve,Lo as ye,Mo as be,Rn as xe,Wn as Se,Xi as Ce,Xt as we,Zt as Te,bn as Ee,ct as De,dn as Oe,jo as ke,jt as Ae,ko as je,lt as Me,oo as Ne,qn as Pe,vn as Fe,xn as Ie,zn as Le}from"./dist-7P3QNiAv.js";import{n as Z}from"./dist-D81TFAXh.js";import{i as Re}from"./use-settings-route-DYSuZnve.js";import{t as ze}from"./dist-XgwTV-oh2.js";import{f as Be,l as Ve,m as He,n as Ue,p as We,r as Ge,u as Ke}from"./documents-events-DSYMSbrh.js";import{h as qe}from"./use-apply-config-color-theme-DpUYtbRe.js";import{t as Je}from"./parse-api-error-DsopQ8yv.js";import{n as Ye,t as Xe}from"./workspace-paths-CKUFX0v6.js";import{t as Ze}from"./use-workspace-BP0fuu9O.js";import{t as Qe}from"./createLucideIcon-Bhw2PmPp.js";import{t as $e}from"./arrow-up-right-CGe6dTck.js";import{t as et}from"./RegisteredAgentIcon-CP1iDML-.js";import{n as tt}from"./CopyButton-CKyZY1PL.js";import{n as nt,r as rt}from"./ManagedArtifactProperties-CI77JvTy.js";import{t as it}from"./folder-open-BapQa7r-.js";import{t as at}from"./use-open-skill-8o6IZoY2.js";import{t as ot}from"./list-plus-CT84Vd_h.js";import{t as st}from"./trash-2-Co21mefL.js";import{a as ct,c as lt,f as ut}from"./skill-scope-CRZYtnmj.js";import{t as dt}from"./input-lp6-d0mX.js";import{J as ft,q as pt,x as mt}from"./navigation-targets-BI4fIUSN.js";import{t as ht}from"./badge-BG5JKjNK.js";import{F as gt,P as _t,T as vt,a as yt,b as bt,h as xt,n as St,r as Ct,t as wt,u as Tt,w as Et}from"./skills-api-DT1cIHsu.js";import{n as Dt}from"./clipboard-adapter-DqemxSWT.js";import{t as Ot}from"./DiffView-B-B3fi5F.js";import{n as kt}from"./platform-labels-B2q9roOE.js";var Q=t(),$=e(o(),1),At=l();function jt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Mt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Je(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:ze._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:ze._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??ze._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Nt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?jt(e):Mt()}var Pt=`ok:skill:cowork:installed`,Ft=`1`,It=250,Lt=`/api/skill/install-state`;function Rt(e){return`${Pt}:v${e}`}var zt=new Map;async function Bt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=zt.get(n);if(r)return r;let i=Vt(e,t);return zt.set(n,i),i.finally(()=>{zt.get(n)===i&&zt.delete(n)}),i}async function Vt(e,t){let n=e.installer===void 0?Nt():e.installer,r=Ht(e.storage),i=e.fetchSnapshot??Wt,a=e.serverTimeoutMs??It,o=null;if(!t.force){try{o=await Gt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Rt(o?.currentVersion??e.fallbackSkillVersion??Ut());if(!t.force&&r?.getItem(s)===Ft)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Ft)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Ht(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ut(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Wt(){let e;try{e=await fetch(Lt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Gt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Kt(e){return Bt({},e)}function qt(){return Bt({},{force:!0})}async function Jt(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Yt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Jt({target:`claude-cowork`,url:Fe({mode:`cowork`},e)},n);case`claude-code`:return Jt({target:`claude-code`,url:Fe({mode:`code`},e)},n);case`codex`:return Jt({target:`codex`,url:Ee(e)},n);case`cursor`:return Jt({target:`cursor`,url:Ie(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Xt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Zt=`open-knowledge:agent-thread-launch`;function Qt(e,t=typeof window>`u`?new EventTarget:window){u({kind:`agent-thread`,...e},t)||t.dispatchEvent(new CustomEvent(Zt,{detail:e}))}function $t(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Zt,n),()=>t.removeEventListener(Zt,n)}function en(e){if(!e.docName||!e.workspace)return null;let t=Xe(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Ye(n,t,r)}}function tn(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function nn(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function rn(e){return L(e.installUrl).then(()=>void 0)}function an(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function on(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function sn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??Xe(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:Ye(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function cn(e){return`Opened in ${e}.`}function ln(e,t=1){return t>=3?ze._({id:`bi2C2s`,values:{displayName:e}}):t===2?ze._({id:`1J0c0X`,values:{displayName:e}}):ze._({id:`Xs7IcT`,values:{displayName:e}})}function un(e){return e>=3?null:e===2?ze._({id:`Xp94R1`}):ze._({id:`6gRgw8`})}function dn(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function fn(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function pn(e,t,n,r){return e.compose?Oe(fn(e.compose,t,n,r)):e.selection?Se({...e.selection,target:t,transport:r}):e.skill?he(e.skill.name,e.skill.scope,n):e.ask?ve(e.ask.relativePath,e.ask.instruction,n,t,r):Ce(e.docContext===null?e.folderRelativePath?ge(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?Le(n,e.instruction,r):xe(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):me(e.docContext.relativePath,n,e.instruction,r))}function mn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${De} ${pn(e,we[t].handoffTarget,!1,`terminal`)}`:_e(e.docContext?.relativePath??null)}function hn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${Me} ${pn(e,`claude-code`,!1,`terminal`)}`:Pe(e.docContext?.relativePath??null)}function gn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function _n(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function vn(e,t){Qt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:hn(e),docName:gn(e),titleHint:_n(e)})}async function yn(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(ze._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(ze._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(ze._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:pn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=dn(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(cn(u));else{let i=un(r),a=ln(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{yn(e,t,n,r+1)}}})}return a}function bn(e){return ae.find(t=>t.id===e)?.displayName??e}function xn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Sn(){return{dispatchHandoff:Yt,recordHandoff:Xt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>xn(),getDisplayName:bn,ensureCoworkSkillInstalled:Kt,autoOpen:!0}}function Cn(){let e=(0,At.c)(2),{merged:t}=qe(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>yn(e,t,{...Sn(),autoOpen:n}),reinstallCoworkSkill:qt},e[0]=n,e[1]=r),r}var wn=Qe(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),Tn=Qe(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),En=Qe(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]);function Dn(e){let t=(0,At.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(s,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function On(e){let t=(0,At.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(s,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function kn(e){let t=(0,At.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(s,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function An(e){let t=(0,At.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:l}=c(),u=o>0,d;t[0]!==l||t[1]!==u||t[2]!==o?(d=l(u?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=l,t[1]=u,t[2]=o,t[3]=d):d=t[3];let p=d,m;t[4]===r?m=t[5]:(m=f(`relative`,r),t[4]=r,t[5]=m);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ot,{}),t[6]=h):h=t[6];let g;t[7]!==u||t[8]!==o?(g=u?(0,Q.jsx)(ht,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=u,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(O,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==p||t[13]!==n||t[14]!==m||t[15]!==_?(v=(0,Q.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":p,onClick:n,"data-testid":`add-properties-button`,className:m,asChild:!0,children:_}),t[12]=p,t[13]=n,t[14]=m,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==u||t[18]!==a?(y=(0,Q.jsx)(k,{side:`bottom`,children:u?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(s,{id:`AwrGuz`})}),a?.map(jn),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(s,{id:`yh5-4s`})})]}):(0,Q.jsx)(s,{id:`81H_23`})}),t[17]=u,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(A,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function jn(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}function Mn(e){return e?ze._({id:`wTcjov`}):null}function Nn(e){let t=(0,At.c)(47),{_:r}=c(),i=a(),o=m(),l=R(),u=I();if(i)return null;let{input:f,installStates:p,dispatch:h}=e,g=f===null,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==r||t[1]!==h||t[2]!==f||t[3]!==g||t[4]!==p||t[5]!==u||t[6]!==l||t[7]!==o){let e=Mn(g),i;t[19]!==p||t[20]!==u?(i=e=>W(u,e.id,p[e.id]?.installed),t[19]=p,t[20]=u,t[21]=i):i=t[21];let a=z.filter(i),c;t[22]===u?c=t[23]:(c=e=>B(u,e.source,e.id,!0,e.supported),t[22]=u,t[23]=c);let d=l.filter(c),m=o?Te.filter(e=>ie(u,e,o.installedClis)):[];y=a.length>0,b=o!==null&&m.length>0,x=d.length>0,v=U,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(q,{children:[(0,Q.jsx)(n,{"aria-hidden":`true`}),(0,Q.jsx)(s,{id:`O7_W_a`})]}),t[24]=D):D=t[24],_=Y,S=`max-h-80`,C=x?(0,Q.jsxs)(V,{"aria-label":r({id:`vPKX2i`}),children:[(0,Q.jsxs)(re,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`RXEbZy`}),(0,Q.jsx)(G,{})]}),d.map(t=>{let n=t.name;return(0,Q.jsxs)(K,{onSelect:()=>{f!==null&&vn(f,{agent:{source:t.source,id:t.id}})},disabled:g,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":r(e?{id:`7Ag-Xu`,values:{agentName:n,hint:e}}:{id:`g4e0hS`,values:{agentName:n}}),children:[(0,Q.jsx)(et,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==y||t[26]!==b||t[27]!==x?(w=x&&(b||y)?(0,Q.jsx)(H,{}):null,t[25]=y,t[26]=b,t[27]=x,t[28]=w):w=t[28],T=b?(0,Q.jsxs)(V,{"aria-label":r({id:`ALhMYW`}),children:[(0,Q.jsx)(re,{children:(0,Q.jsx)(s,{id:`ALhMYW`})}),m.map(t=>{let{displayName:n}=we[t];return(0,Q.jsxs)(K,{onSelect:()=>{f!==null&&o.launchInTerminal(f,t)},disabled:g,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":r(e?{id:`AIn2Yv`,values:{displayName:n,hint:e}}:{id:`QYfQdv`,values:{displayName:n}}),children:[(0,Q.jsx)(X,{id:J(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,E=y?(0,Q.jsxs)(Q.Fragment,{children:[b?(0,Q.jsx)(H,{}):null,(0,Q.jsxs)(V,{"aria-label":r({id:`BwKH4d`}),children:[(0,Q.jsxs)(re,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`BwKH4d`}),(0,Q.jsx)($e,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let n=!g,{displayName:i}=t,a=r(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(K,{disabled:!n,onSelect:()=>{if(f){if(p[t.id]?.installed!==!0){rn(t);return}h(t.id,f)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(X,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Dn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=r,t[1]=h,t[2]=f,t[3]=g,t[4]=p,t[5]=u,t[6]=l,t[7]=o,t[8]=_,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D}else _=t[8],v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18];let O;t[29]!==y||t[30]!==b||t[31]!==x?(O=x||b||y?(0,Q.jsx)(H,{}):null,t[29]=y,t[30]=b,t[31]=x,t[32]=O):O=t[32];let k;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(d,{"aria-hidden":`true`}),t[33]=k):k=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(K,{onSelect:Re,"data-testid":`empty-space-open-in-settings`,children:[k,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`jRAGrQ`})})]}),t[34]=A):A=t[34];let j;t[35]!==_||t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E||t[41]!==O?(j=(0,Q.jsxs)(_,{className:S,children:[C,w,T,E,O,A]}),t[35]=_,t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=O,t[42]=j):j=t[42];let M;return t[43]!==v||t[44]!==D||t[45]!==j?(M=(0,Q.jsxs)(v,{children:[D,j]}),t[43]=v,t[44]=D,t[45]=j,t[46]=M):M=t[46],M}function Pn(e){return e?ze._({id:`wTcjov`}):null}function Fn(e){let t=(0,At.c)(48),{_:r}=c(),i=a(),o=m(),l=R(),u=I();if(i)return null;let{input:f,installStates:p,dispatch:h,onBeforeLaunch:g}=e,_=f===null,v,y,b,x,S,C,w,T,E,D,O;if(t[0]!==r||t[1]!==h||t[2]!==f||t[3]!==_||t[4]!==p||t[5]!==g||t[6]!==u||t[7]!==l||t[8]!==o){let e=Pn(_),i;t[20]!==p||t[21]!==u?(i=e=>W(u,e.id,p[e.id]?.installed),t[20]=p,t[21]=u,t[22]=i):i=t[22];let a=z.filter(i),c;t[23]===u?c=t[24]:(c=e=>B(u,e.source,e.id,!0,e.supported),t[23]=u,t[24]=c);let d=l.filter(c),m=o?Te.filter(e=>ie(u,e,o.installedClis)):[];b=a.length>0,x=o!==null&&m.length>0,S=d.length>0,y=se,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(de,{children:[(0,Q.jsx)(n,{"aria-hidden":`true`}),(0,Q.jsx)(s,{id:`O7_W_a`})]}),t[25]=O):O=t[25],v=ce,C=`max-h-80`,w=S?(0,Q.jsxs)(le,{"aria-label":r({id:`vPKX2i`}),children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`RXEbZy`}),(0,Q.jsx)(G,{})]}),d.map(t=>{let n=t.name;return(0,Q.jsxs)(oe,{onSelect:()=>{f!==null&&(g?.(),vn(f,{agent:{source:t.source,id:t.id}}))},disabled:_,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":r(e?{id:`7Ag-Xu`,values:{agentName:n,hint:e}}:{id:`g4e0hS`,values:{agentName:n}}),children:[(0,Q.jsx)(et,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==b||t[27]!==x||t[28]!==S?(T=S&&(x||b)?(0,Q.jsx)(fe,{}):null,t[26]=b,t[27]=x,t[28]=S,t[29]=T):T=t[29],E=x?(0,Q.jsxs)(le,{"aria-label":r({id:`ALhMYW`}),children:[(0,Q.jsx)(ue,{children:(0,Q.jsx)(s,{id:`ALhMYW`})}),m.map(t=>{let{displayName:n}=we[t];return(0,Q.jsxs)(oe,{onSelect:()=>{f!==null&&(g?.(),o.launchInTerminal(f,t))},disabled:_,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":r(e?{id:`AIn2Yv`,values:{displayName:n,hint:e}}:{id:`QYfQdv`,values:{displayName:n}}),children:[(0,Q.jsx)(X,{id:J(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,D=b?(0,Q.jsxs)(Q.Fragment,{children:[x?(0,Q.jsx)(fe,{}):null,(0,Q.jsxs)(le,{"aria-label":r({id:`BwKH4d`}),children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`BwKH4d`}),(0,Q.jsx)($e,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let n=!_,{displayName:i}=t,a=r(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(oe,{disabled:!n,onSelect:()=>{if(f){if(g?.(),p[t.id]?.installed!==!0){rn(t);return}h(t.id,f)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(X,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Dn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=r,t[1]=h,t[2]=f,t[3]=_,t[4]=p,t[5]=g,t[6]=u,t[7]=l,t[8]=o,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O}else v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let k;t[30]!==b||t[31]!==x||t[32]!==S?(k=S||x||b?(0,Q.jsx)(fe,{}):null,t[30]=b,t[31]=x,t[32]=S,t[33]=k):k=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(d,{"aria-hidden":`true`}),t[34]=A):A=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(oe,{onSelect:Re,"data-testid":`file-tree-open-in-settings`,children:[A,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`jRAGrQ`})})]}),t[35]=j):j=t[35];let M;t[36]!==v||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E||t[41]!==D||t[42]!==k?(M=(0,Q.jsxs)(v,{className:C,children:[w,T,E,D,k,j]}),t[36]=v,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D,t[42]=k,t[43]=M):M=t[43];let N;return t[44]!==y||t[45]!==O||t[46]!==M?(N=(0,Q.jsxs)(y,{children:[O,M]}),t[44]=y,t[45]=O,t[46]=M,t[47]=N):N=t[47],N}var In=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Ln(e){let t=be(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=je(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=ke(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=In.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Rn(e,t,n){return e.filter(e=>{let r=mt(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=Ln(r.docName);return i?.scope===t&&i.name===n})}function zn(e,t,n){let r=pt(t,n);return e.filter(e=>{let i=mt(e);return i.kind===`skill-file`?i.scope===t.scope&&i.name===t.name&&i.path===n:i.kind===`doc`&&i.docName===r})}function Bn(e,t,n){let r=Ln(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return pt(i,a)===e?{skill:i,filePath:a}:null}function Vn(e,t,n=(e,t)=>Be(e,t)||We(e,t)){let r=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),i=[],a=new Set;for(let t of e){let e=Ln(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Ln(t);if(!e||r.has(`${e.scope}\u0000${e.name}`))continue;let o=e.scope===`project`?`global`:`project`,s=r.get(`${o}\u0000${e.name}`);e.rel===null&&s!==void 0?i.push({kind:`retarget`,fromDocName:t,toDocName:ft(s)}):n(e.scope,e.name)||(s!==void 0&&!a.has(`${e.scope}\u0000${e.name}`)?(a.add(`${e.scope}\u0000${e.name}`),i.push({kind:`retarget`,fromDocName:t,toDocName:ft(s)})):i.push({kind:`close`,docName:t}))}return i}function Hn(){let e=(0,At.c)(15),{openTabs:t,closeDocument:n}=i(),r=nt(),a;e[0]===t?a=e[1]:(a=t.some(Wn),e[0]=t,e[1]=a);let o=a,s;e[2]===o?s=e[3]:(s={enabled:o},e[2]=o,e[3]=s);let c=gt(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Un).sort().join(``)}\u0002${He()}`;if(l.current===i)return;l.current=i;let a=Vn(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Un(e){return`${e.scope}\u0000${e.name}`}function Wn(e){return Ln(e)!==null}function Gn(e){let t=(0,At.c)(19),{skill:n,onOpenChange:r,onDeleted:a}=e,{_:o}=c(),{setSkillsSidebar:s,closeTabs:l,openTabs:u}=i(),[d,f]=(0,$.useState)(!1),p;t[0]!==o||t[1]!==l||t[2]!==a||t[3]!==r||t[4]!==u||t[5]!==s?(p=async function(e){s(!0),f(!0);let t=await St(e.scope,e.name);if(f(!1),!t.ok){let{error:e}=t;Z.error(o({id:`AtBdnD`,values:{error:e}}));return}Z.success(o({id:`h9QFb9`,values:{0:e.name}})),l(Rn(u,e.scope,e.name),{force:!0}),a(),r(!1)},t[0]=o,t[1]=l,t[2]=a,t[3]=r,t[4]=u,t[5]=s,t[6]=p):p=t[6];let m=p,h=n!==null,g;t[7]!==d||t[8]!==r?(g=e=>{!e&&!d&&r(!1)},t[7]=d,t[8]=r,t[9]=g):g=t[9];let y;t[10]!==o||t[11]!==d||t[12]!==m||t[13]!==n?(y=n?(0,Q.jsx)(v,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:d,onDelete:()=>m(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?o({id:`WnsbUT`,values:{0:n.path}}):o({id:`E1Da_b`,values:{0:n.path}})}):null,t[10]=o,t[11]=d,t[12]=m,t[13]=n,t[14]=y):y=t[14];let b;return t[15]!==h||t[16]!==g||t[17]!==y?(b=(0,Q.jsx)(_,{open:h,onOpenChange:g,children:y}),t[15]=h,t[16]=g,t[17]=y,t[18]=b):b=t[18],b}function Kn(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function qn(e){let t=(0,At.c)(66),{target:n,onOpenChange:r}=e,{_:a}=c(),{openTarget:o}=i(),l=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,x,S;t[6]!==u||t[7]!==f?(S=u.trim(),b=S===``||!Kn(S),y=!b&&!f,x=S.includes(`/`)?S.split(`/`).slice(0,-1).join(`/`):null,t[6]=u,t[7]=f,t[8]=y,t[9]=b,t[10]=x,t[11]=S):(y=t[8],b=t[9],x=t[10],S=t[11]);let C=x,w;t[12]!==a||t[13]!==y||t[14]!==r||t[15]!==o||t[16]!==n||t[17]!==S?(w=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(S),t=await _t({scope:n.skill.scope,name:n.skill.name,path:S,content:e?`# ${S.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(a({id:`a_2_uB`,values:{0:t.error,trimmed:S}}));return}if(Z.success(a({id:`MXSt4t`,values:{0:t.path}})),e){let e=pt(n.skill,S);o({kind:`doc`,target:e,docName:e})}r(!1)},t[12]=a,t[13]=y,t[14]=r,t[15]=o,t[16]=n,t[17]=S,t[18]=w):w=t[18];let T=w,E;t[19]!==r||t[20]!==f?(E=e=>{!e&&!f&&r(!1)},t[19]=r,t[20]=f,t[21]=E):E=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`wQvvZY`})}),t[22]=O):O=t[22];let k;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(te,{children:[O,(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`lM4c-I`})})]}),t[23]=k):k=t[23];let A;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(s,{id:`I6gXOa`}),t[24]=A):A=t[24];let P;t[25]===l?P=t[26]:(P=(0,Q.jsx)(pe,{htmlFor:l,children:A}),t[25]=l,t[26]=P);let F;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>d(e.target.value),t[27]=F):F=t[27];let I=b&&S!==``,L;t[28]===T?L=t[29]:(L=e=>{e.key===`Enter`&&T()},t[28]=T,t[29]=L);let R;t[30]!==l||t[31]!==u||t[32]!==I||t[33]!==L?(R=(0,Q.jsx)(dt,{id:l,value:u,onChange:F,placeholder:`references/notes.md`,"aria-invalid":I,onKeyDown:L}),t[30]=l,t[31]=u,t[32]=I,t[33]=L,t[34]=R):R=t[34];let z;t[35]!==C||t[36]!==b||t[37]!==S?(z=b&&S!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(s,{id:`fVzizW`})}):C?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(s,{id:`9lso1Y`,values:{folderPart:C},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null,t[35]=C,t[36]=b,t[37]=S,t[38]=z):z=t[38];let B;t[39]!==P||t[40]!==R||t[41]!==z?(B=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[P,R,z]}),t[39]=P,t[40]=R,t[41]=z,t[42]=B):B=t[42];let V;t[43]===r?V=t[44]:(V=()=>r(!1),t[43]=r,t[44]=V);let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(s,{id:`dEgA5A`}),t[45]=H):H=t[45];let U;t[46]!==f||t[47]!==V?(U=(0,Q.jsx)(D,{variant:`outline`,onClick:V,disabled:f,children:H}),t[46]=f,t[47]=V,t[48]=U):U=t[48];let W;t[49]===T?W=t[50]:(W=()=>void T(),t[49]=T,t[50]=W);let G=!y,K;t[51]===f?K=t[52]:(K=f?(0,Q.jsx)(s,{id:`E9bKSA`}):(0,Q.jsx)(s,{id:`hYgDIe`}),t[51]=f,t[52]=K);let q;t[53]!==W||t[54]!==G||t[55]!==K?(q=(0,Q.jsx)(D,{onClick:W,disabled:G,children:K}),t[53]=W,t[54]=G,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==U||t[58]!==q?(J=(0,Q.jsxs)(ee,{children:[U,q]}),t[57]=U,t[58]=q,t[59]=J):J=t[59];let Y;t[60]!==B||t[61]!==J?(Y=(0,Q.jsxs)(N,{className:`sm:max-w-md`,children:[k,B,J]}),t[60]=B,t[61]=J,t[62]=Y):Y=t[62];let X;return t[63]!==Y||t[64]!==E?(X=(0,Q.jsx)(ne,{open:!0,onOpenChange:E,children:Y}),t[63]=Y,t[64]=E,t[65]=X):X=t[65],X}function Jn(e){let t=(0,At.c)(18),{target:n,onOpenChange:r}=e,{_:a}=c(),{setSkillsSidebar:o,closeTabs:s,openTabs:l}=i(),[u,d]=(0,$.useState)(!1),f;t[0]!==a||t[1]!==s||t[2]!==r||t[3]!==l||t[4]!==o?(f=async function(e){let{skill:t,filePath:n}=e;o(!0),d(!0);let i=await Ct({scope:t.scope,name:t.name,path:n});if(d(!1),!i.ok){Z.error(a({id:`CBT70t`,values:{0:i.error}}));return}if(!i.existed){Z.error(a({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(a({id:`gOmloS`,values:{filePath:n}})),s(zn(l,t,n),{force:!0}),r(!1)},t[0]=a,t[1]=s,t[2]=r,t[3]=l,t[4]=o,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==u||t[7]!==r?(h=e=>{!e&&!u&&r(!1)},t[6]=u,t[7]=r,t[8]=h):h=t[8];let g;t[9]!==a||t[10]!==u||t[11]!==p||t[12]!==n?(g=n?(0,Q.jsx)(v,{itemName:a({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:u,onDelete:()=>p(n),customDescription:a({id:`ppzof_`,values:{0:ct(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[9]=a,t[10]=u,t[11]=p,t[12]=n,t[13]=g):g=t[13];let y;return t[14]!==m||t[15]!==h||t[16]!==g?(y=(0,Q.jsx)(_,{open:m,onOpenChange:h,children:g}),t[14]=m,t[15]=h,t[16]=g,t[17]=y):y=t[17],y}function Yn(e){let t=(0,At.c)(64),{target:n,onOpenChange:r}=e,{_:i}=c(),a=nt(),o=(0,$.useId)(),[l,u]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&u(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==l||t[7]!==n.filePath?(y=l.trim(),b=y===n.filePath,v=y===``||!Kn(y),t[6]=l,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let x=v,S=!x&&!b&&!d,C;t[11]!==i||t[12]!==S||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(C=async function(){if(!n||!S)return;f(!0);let e=await Et({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=S,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=C):C=t[17];let w=C,T;t[18]!==r||t[19]!==d?(T=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`yckias`})}),t[21]=E):E=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(te,{children:[E,(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`HzVAoz`})})]}),t[22]=O):O=t[22];let k;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(s,{id:`I6gXOa`}),t[23]=k):k=t[23];let A;t[24]===o?A=t[25]:(A=(0,Q.jsx)(pe,{htmlFor:o,children:k}),t[24]=o,t[25]=A);let P;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>u(e.target.value),t[26]=P):P=t[26];let F=x&&y!==``,I;t[27]===w?I=t[28]:(I=e=>{e.key===`Enter`&&w()},t[27]=w,t[28]=I);let L;t[29]!==o||t[30]!==l||t[31]!==F||t[32]!==I?(L=(0,Q.jsx)(dt,{id:o,value:l,onChange:P,"aria-invalid":F,onKeyDown:I}),t[29]=o,t[30]=l,t[31]=F,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==x||t[35]!==y?(R=x&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(s,{id:`fVzizW`})}):null,t[34]=x,t[35]=y,t[36]=R):R=t[36];let z;t[37]!==A||t[38]!==L||t[39]!==R?(z=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[A,L,R]}),t[37]=A,t[38]=L,t[39]=R,t[40]=z):z=t[40];let B;t[41]===r?B=t[42]:(B=()=>r(!1),t[41]=r,t[42]=B);let V;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(s,{id:`dEgA5A`}),t[43]=V):V=t[43];let H;t[44]!==d||t[45]!==B?(H=(0,Q.jsx)(D,{variant:`outline`,onClick:B,disabled:d,children:V}),t[44]=d,t[45]=B,t[46]=H):H=t[46];let U;t[47]===w?U=t[48]:(U=()=>void w(),t[47]=w,t[48]=U);let W=!S,G;t[49]===d?G=t[50]:(G=d?(0,Q.jsx)(s,{id:`tHKQ6j`}):(0,Q.jsx)(s,{id:`2wxgft`}),t[49]=d,t[50]=G);let K;t[51]!==U||t[52]!==W||t[53]!==G?(K=(0,Q.jsx)(D,{onClick:U,disabled:W,children:G}),t[51]=U,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;t[55]!==H||t[56]!==K?(q=(0,Q.jsxs)(ee,{children:[H,K]}),t[55]=H,t[56]=K,t[57]=q):q=t[57];let J;t[58]!==z||t[59]!==q?(J=(0,Q.jsxs)(N,{className:`sm:max-w-md`,children:[O,z,q]}),t[58]=z,t[59]=q,t[60]=J):J=t[60];let Y;return t[61]!==J||t[62]!==T?(Y=(0,Q.jsx)(ne,{open:!0,onOpenChange:T,children:J}),t[61]=J,t[62]=T,t[63]=Y):Y=t[63],Y}function Xn(e){let t=(0,At.c)(59),{target:n,onOpenChange:r}=e,{_:i}=c(),a=(0,$.useId)(),[o,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b;t[0]===n?b=t[1]:(b=()=>{if(l(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${lt(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,l]])Tt({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=b);let x=n?.skill.scope,S=n?.skill.name,C=n?.editor,w;if(t[2]!==x||t[3]!==S||t[4]!==C?(w=[x,S,C],t[2]=x,t[3]=S,t[4]=C,t[5]=w):w=t[5],(0,$.useEffect)(b,w),!n)return null;let{skill:T,editor:E}=n,O;t[6]!==i||t[7]!==E||t[8]!==r||t[9]!==T.name||t[10]!==T.scope||t[11]!==n||t[12]!==g?(O=async function(e){if(!n)return;y(!0);let t=await vt({scope:T.scope,name:T.name,editor:E,action:e,...e===`rename`?{toName:g.trim()}:{}});if(y(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:E}}:e===`make-source`?{id:`It9oAP`,values:{editor:E}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=E,t[8]=r,t[9]=T.name,t[10]=T.scope,t[11]=n,t[12]=g,t[13]=O):O=t[13];let k=O,A,F;t[14]!==T.name||t[15]!==g?(F=g.trim(),A=F===``||!Ae.test(F)||F===T.name,t[14]=T.name,t[15]=g,t[16]=A,t[17]=F):(A=t[16],F=t[17]);let I=A,L;t[18]!==v||t[19]!==r?(L=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=L):L=t[20];let R;t[21]!==E||t[22]!==T.name?(R=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`q8aCbb`,values:{0:T.name,editor:E}})}),t[21]=E,t[22]=T.name,t[23]=R):R=t[23];let z;t[24]===E?z=t[25]:(z=(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`QASTNu`,values:{editor:E}})}),t[24]=E,t[25]=z);let B;t[26]!==z||t[27]!==R?(B=(0,Q.jsxs)(te,{children:[R,z]}),t[26]=z,t[27]=R,t[28]=B):B=t[28];let V;t[29]!==u||t[30]!==o||t[31]!==f?(V=u!==null&&o!==null?(0,Q.jsx)(Ot,{oldContent:u,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(s,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(s,{id:`1V17kO`})}),t[29]=u,t[30]=o,t[31]=f,t[32]=V):V=t[32];let H;t[33]!==k||t[34]!==E||t[35]!==a||t[36]!==I||t[37]!==m||t[38]!==T.name||t[39]!==g||t[40]!==F?(H=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(pe,{htmlFor:a,children:(0,Q.jsx)(s,{id:`pSimwP`,values:{editor:E}})}),(0,Q.jsx)(dt,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${T.name}-${E}`,"aria-invalid":I&&F!==``,onKeyDown:e=>{e.key===`Enter`&&!I&&k(`rename`)}})]}):null,t[33]=k,t[34]=E,t[35]=a,t[36]=I,t[37]=m,t[38]=T.name,t[39]=g,t[40]=F,t[41]=H):H=t[41];let U;t[42]!==V||t[43]!==H?(U=(0,Q.jsxs)(P,{className:`min-h-0 flex-1 overflow-auto`,children:[V,H]}),t[42]=V,t[43]=H,t[44]=U):U=t[44];let W;t[45]!==k||t[46]!==v||t[47]!==E||t[48]!==I||t[49]!==m||t[50]!==T.name?(W=(0,Q.jsx)(ee,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(s,{id:`iH8pgl`})}),(0,Q.jsx)(D,{onClick:()=>void k(`rename`),disabled:v||I,children:(0,Q.jsx)(s,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>{_(`${T.name}-${E}`),h(!0)},disabled:v,children:(0,Q.jsx)(s,{id:`AT0e50`})}),(0,Q.jsx)(D,{variant:`outline`,onClick:()=>void k(`make-source`),disabled:v,children:(0,Q.jsx)(s,{id:`xWomUD`,values:{editor:E}})}),(0,Q.jsx)(D,{onClick:()=>void k(`align`),disabled:v,children:(0,Q.jsx)(s,{id:`PZn2LP`})})]})}),t[45]=k,t[46]=v,t[47]=E,t[48]=I,t[49]=m,t[50]=T.name,t[51]=W):W=t[51];let G;t[52]!==B||t[53]!==U||t[54]!==W?(G=(0,Q.jsxs)(N,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[B,U,W]}),t[52]=B,t[53]=U,t[54]=W,t[55]=G):G=t[55];let K;return t[56]!==G||t[57]!==L?(K=(0,Q.jsx)(ne,{open:!0,onOpenChange:L,children:G}),t[56]=G,t[57]=L,t[58]=K):K=t[58],K}function Zn(e){let t=(0,At.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=rt(),c=n!==null,l=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,x,S,C;if(t[5]!==r||t[6]!==u||t[7]!==n.name){S=u.trim(),C=S===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,x=S.length>64,y=S===``||!Ae.test(S)||x,b=!y&&!C&&r.has(S),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13];let w=b,T=!y&&!w&&!C&&!f,E;t[17]!==T||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==S?(E=async function(){if(!n||!T)return;p(!0);let e=await o({scope:n.scope,name:n.name},S);p(!1),e.ok&&(a?.(S),i(!1))},t[17]=T,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=S,t[23]=E):E=t[23];let O=E,k;t[24]===i?k=t[25]:(k=e=>e?null:i(!1),t[24]=i,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`dw_3cv`})}),t[26]=A):A=t[26];let P;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsxs)(te,{children:[A,(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`R9IDFz`})})]}),t[27]=P):P=t[27];let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(s,{id:`6YtxFj`}),t[28]=F):F=t[28];let I;t[29]===l?I=t[30]:(I=(0,Q.jsx)(pe,{htmlFor:l,children:F}),t[29]=l,t[30]=I);let L;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>d(e.target.value),t[31]=L):L=t[31];let R;t[32]===O?R=t[33]:(R=e=>{e.key===`Enter`&&O()},t[32]=O,t[33]=R);let z=y||w,B=y&&S!==``||w?`${l}-error`:void 0,V;t[34]!==l||t[35]!==u||t[36]!==R||t[37]!==z||t[38]!==B?(V=(0,Q.jsx)(dt,{id:l,value:u,onChange:L,onKeyDown:R,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":z,"aria-describedby":B,className:`font-mono`}),t[34]=l,t[35]=u,t[36]=R,t[37]=z,t[38]=B,t[39]=V):V=t[39];let H;t[40]!==w||t[41]!==v||t[42]!==l||t[43]!==y||t[44]!==x||t[45]!==S?(H=y&&S!==``?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(s,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):x?(0,Q.jsx)(s,{id:`lK9c4T`}):(0,Q.jsx)(s,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):w?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(s,{id:`YJ1BTp`})}):null,t[40]=w,t[41]=v,t[42]=l,t[43]=y,t[44]=x,t[45]=S,t[46]=H):H=t[46];let U;t[47]!==I||t[48]!==V||t[49]!==H?(U=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[I,V,H]}),t[47]=I,t[48]=V,t[49]=H,t[50]=U):U=t[50];let W;t[51]===i?W=t[52]:(W=()=>i(!1),t[51]=i,t[52]=W);let G;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(s,{id:`dEgA5A`}),t[53]=G):G=t[53];let K;t[54]!==f||t[55]!==W?(K=(0,Q.jsx)(D,{variant:`outline`,className:`font-mono uppercase`,onClick:W,disabled:f,children:G}),t[54]=f,t[55]=W,t[56]=K):K=t[56];let q;t[57]===O?q=t[58]:(q=()=>void O(),t[57]=O,t[58]=q);let J=!T,Y;t[59]===f?Y=t[60]:(Y=f?(0,Q.jsx)(s,{id:`tHKQ6j`}):(0,Q.jsx)(s,{id:`2wxgft`}),t[59]=f,t[60]=Y);let X;t[61]!==q||t[62]!==J||t[63]!==Y?(X=(0,Q.jsx)(D,{onClick:q,disabled:J,children:Y}),t[61]=q,t[62]=J,t[63]=Y,t[64]=X):X=t[64];let re;t[65]!==K||t[66]!==X?(re=(0,Q.jsxs)(ee,{children:[K,X]}),t[65]=K,t[66]=X,t[67]=re):re=t[67];let ie;t[68]!==U||t[69]!==re?(ie=(0,Q.jsxs)(N,{children:[P,U,re]}),t[68]=U,t[69]=re,t[70]=ie):ie=t[70];let ae;return t[71]!==c||t[72]!==ie||t[73]!==k?(ae=(0,Q.jsx)(ne,{open:c,onOpenChange:k,children:ie}),t[71]=c,t[72]=ie,t[73]=k,t[74]=ae):ae=t[74],ae}function Qn(){let e=(0,At.c)(7),{_:t}=c(),n=ut(),r=nt(),{setSkillsSidebar:a,openTabs:o}=i(),s=gt(),l;return e[0]!==t||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==a||e[5]!==s?(l=async(e,i)=>{if(i===e.scope)return!1;Ge(e.scope,e.name),Ue(e.scope,e.name);let c=await bt({name:e.name,fromScope:e.scope,toScope:i});if(Ve(e.scope,e.name),!c.ok)return Ke(e.scope,e.name),Z.error(t({id:`07eGJB`,values:{0:c.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[i]}}));let l=s.status===`ready`?s.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,u=o.map(er).filter(t=>{if(t.kind!==`doc`)return!1;let n=Ln(t.docName);return n?.scope===e.scope&&n.name===e.name}),d=u.find($n)??u[0],f=d?.kind===`doc`?d.docName:l?ft(l):e.scope===`global`?ye(e.scope,e.name):null,p=i===`project`&&c.path!==void 0?`${c.path.replace(/\/+$/,``)}/SKILL`:ye(i,e.name);try{f!==null&&r(f,p)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return a(!0),Ke(e.scope,e.name),!0},e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l}function $n(e){return e.kind===`doc`&&Ln(e.docName)?.rel===null}function er(e){return mt(e)}function tr(e){let t=(0,At.c)(38),{target:n,onOpenChange:r}=e,i=ut(),a=Qn(),[o,c]=(0,$.useState)(!1);if(!n)return null;let{scope:l,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(M,{children:(0,Q.jsx)(s,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[l],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(j,{children:(0,Q.jsx)(s,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let x;t[13]!==m||t[14]!==b?(x=(0,Q.jsxs)(te,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(s,{id:`dEgA5A`}),t[16]=S):S=t[16];let C;t[17]===o?C=t[18]:(C=(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsx)(D,{variant:`outline`,disabled:o,children:S})}),t[17]=o,t[18]=C);let w;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==l||t[23]!==d?(w=async()=>{c(!0),await a({scope:l,name:u},d),c(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=l,t[23]=d,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(s,{id:`QWdKwH`}),t[25]=T):T=t[25];let E;t[26]!==o||t[27]!==w?(E=(0,Q.jsx)(D,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:w,children:T}),t[26]=o,t[27]=w,t[28]=E):E=t[28];let O;t[29]!==C||t[30]!==E?(O=(0,Q.jsxs)(ee,{children:[C,E]}),t[29]=C,t[30]=E,t[31]=O):O=t[31];let k;t[32]!==x||t[33]!==O?(k=(0,Q.jsxs)(N,{className:`sm:max-w-md`,children:[x,O]}),t[32]=x,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==f||t[36]!==k?(A=(0,Q.jsx)(ne,{open:!0,onOpenChange:f,children:k}),t[35]=f,t[36]=k,t[37]=A):A=t[37],A}function nr(){let e=(0,At.c)(50),{_:t}=c(),n=at(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),Ge(e.scope,e.name);let i=await xt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(Ke(e.scope,e.name),y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=rr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),Ge(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await wt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}Ke(e.scope,e.name),y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name),Ge(e.scope,e.name);let n=await t();return Ke(e.scope,e.name),y(null),n},e[3]=w):w=e[3];let T=w,E;e[4]!==t||e[5]!==n?(E=async function(e,r){let i=await yt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O,k;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{e||i(null)},k=()=>i(null),e[7]=O,e[8]=k):(O=e[7],k=e[8]);let A;e[9]===r?A=e[10]:(A=(0,Q.jsx)(Gn,{skill:r,onOpenChange:O,onDeleted:k}),e[9]=r,e[10]=A);let j=a?.skill??null,M=a?.existingNames??ar,N,P;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e||o(null)},N=()=>o(null),e[11]=N,e[12]=P):(N=e[11],P=e[12]);let ee;e[13]!==j||e[14]!==M?(ee=(0,Q.jsx)(Zn,{skill:j,existingNames:M,onOpenChange:P,onRenamed:N}),e[13]=j,e[14]=M,e[15]=ee):ee=e[15];let F;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||l(null)},e[16]=F):F=e[16];let te;e[17]===s?te=e[18]:(te=(0,Q.jsx)(tr,{target:s,onOpenChange:F}),e[17]=s,e[18]=te);let ne;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{e||d(null)},e[19]=ne):ne=e[19];let I;e[20]===u?I=e[21]:(I=(0,Q.jsx)(Yn,{target:u,onOpenChange:ne}),e[20]=u,e[21]=I);let L;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e||p(null)},e[22]=L):L=e[22];let R;e[23]===f?R=e[24]:(R=(0,Q.jsx)(Jn,{target:f,onOpenChange:L}),e[23]=f,e[24]=R);let z;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{e||h(null)},e[25]=z):z=e[25];let B;e[26]===m?B=e[27]:(B=(0,Q.jsx)(qn,{target:m,onOpenChange:z}),e[26]=m,e[27]=B);let V;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>{e||_(null)},e[28]=V):V=e[28];let H;e[29]===g?H=e[30]:(H=(0,Q.jsx)(Xn,{target:g,onOpenChange:V}),e[29]=g,e[30]=H);let U;e[31]!==ee||e[32]!==te||e[33]!==I||e[34]!==R||e[35]!==B||e[36]!==H||e[37]!==A?(U=(0,Q.jsxs)(Q.Fragment,{children:[A,ee,te,I,R,B,H]}),e[31]=ee,e[32]=te,e[33]=I,e[34]=R,e[35]=B,e[36]=H,e[37]=A,e[38]=U):U=e[38];let W=U,G,K,q,J,Y,X;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(G=(e,t)=>o({skill:e,existingNames:t}),K=(e,t)=>l({scope:e.scope,name:e.name,toScope:t}),q=(e,t)=>d({skill:e,filePath:t}),J=(e,t)=>p({skill:e,filePath:t}),Y=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),X=(e,t)=>_({skill:e,editor:t}),e[39]=G,e[40]=K,e[41]=q,e[42]=J,e[43]=Y,e[44]=X):(G=e[39],K=e[40],q=e[41],J=e[42],Y=e[43],X=e[44]);let re;return e[45]!==W||e[46]!==D||e[47]!==x||e[48]!==v?(re={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,requestDelete:i,requestRename:G,requestScopeMove:K,requestFileRename:q,requestFileDelete:J,requestFileCreate:Y,requestForkResolve:X,dialogs:W},e[45]=W,e[46]=D,e[47]=x,e[48]=v,e[49]=re):re=e[49],re}function rr(e){return e.map(ir).join(`, `)}function ir(e){return Ne[e]??e}var ar=new Set;function or(e){let t=(0,At.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(it,{"aria-hidden":!0}),c=kt(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(S,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function sr(e){let t=(0,At.c)(68),{skill:n,filePath:r,actions:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,{_:l}=c(),u;t[0]!==r||t[1]!==n.absolutePath?(u=n.absolutePath?`${ct(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=u):u=t[2];let d=u,f;t[3]===n.path?f=t[4]:(f=ct(n.path),t[3]=n.path,t[4]=f);let p=`${f}/${r}`,m;t[5]===l?m=t[6]:(m=async function(e){try{await Dt(e),Z.success(l({id:`SXCSQd`}))}catch{Z.error(l({id:`cRHuuI`}))}},t[5]=l,t[6]=m);let _=m,v;t[7]!==i||t[8]!==r||t[9]!==n?(v=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=v):v=t[10];let y,x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(En,{"aria-hidden":!0}),x=(0,Q.jsx)(s,{id:`2wxgft`}),t[11]=y,t[12]=x):(y=t[11],x=t[12]);let C;t[13]!==o||t[14]!==v?(C=(0,Q.jsxs)(S,{menuKind:o,onSelect:v,children:[y,x]}),t[13]=o,t[14]=v,t[15]=C):C=t[15];let T;t[16]!==d||t[17]!==o?(T=(0,Q.jsx)(or,{absolutePath:d,menuKind:o}),t[16]=d,t[17]=o,t[18]=T):T=t[18];let D,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(tt,{"aria-hidden":!0}),O=(0,Q.jsx)(s,{id:`zd00pH`}),t[19]=D,t[20]=O):(D=t[19],O=t[20]);let k;t[21]===o?k=t[22]:(k=(0,Q.jsxs)(E,{menuKind:o,children:[D,O]}),t[21]=o,t[22]=k);let A;t[23]!==d||t[24]!==_||t[25]!==o?(A=d?(0,Q.jsx)(S,{menuKind:o,onSelect:()=>void _(d),children:(0,Q.jsx)(s,{id:`z2funE`})}):null,t[23]=d,t[24]=_,t[25]=o,t[26]=A):A=t[26];let j;t[27]!==_||t[28]!==p?(j=()=>void _(p),t[27]=_,t[28]=p,t[29]=j):j=t[29];let M;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(s,{id:`xloBjn`}),t[30]=M):M=t[30];let N;t[31]!==o||t[32]!==j?(N=(0,Q.jsx)(S,{menuKind:o,onSelect:j,children:M}),t[31]=o,t[32]=j,t[33]=N):N=t[33];let P;t[34]!==o||t[35]!==A||t[36]!==N?(P=(0,Q.jsxs)(h,{menuKind:o,children:[A,N]}),t[34]=o,t[35]=A,t[36]=N,t[37]=P):P=t[37];let ee;t[38]!==o||t[39]!==P?(ee=(0,Q.jsx)(b,{menuKind:o,children:P}),t[38]=o,t[39]=P,t[40]=ee):ee=t[40];let F;t[41]!==o||t[42]!==k||t[43]!==ee?(F=(0,Q.jsxs)(g,{menuKind:o,children:[k,ee]}),t[41]=o,t[42]=k,t[43]=ee,t[44]=F):F=t[44];let te;t[45]!==o||t[46]!==F||t[47]!==C||t[48]!==T?(te=(0,Q.jsxs)(h,{menuKind:o,children:[C,T,F]}),t[45]=o,t[46]=F,t[47]=C,t[48]=T,t[49]=te):te=t[49];let ne;t[50]===o?ne=t[51]:(ne=(0,Q.jsx)(w,{menuKind:o}),t[50]=o,t[51]=ne);let I;t[52]!==i||t[53]!==r||t[54]!==n?(I=()=>i.requestFileDelete(n,r),t[52]=i,t[53]=r,t[54]=n,t[55]=I):I=t[55];let L,R;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(st,{"aria-hidden":!0}),R=(0,Q.jsx)(s,{id:`cnGeoo`}),t[56]=L,t[57]=R):(L=t[56],R=t[57]);let z;t[58]!==o||t[59]!==I?(z=(0,Q.jsxs)(S,{menuKind:o,variant:`destructive`,onSelect:I,children:[L,R]}),t[58]=o,t[59]=I,t[60]=z):z=t[60];let B;t[61]!==o||t[62]!==z?(B=(0,Q.jsx)(h,{menuKind:o,children:z}),t[61]=o,t[62]=z,t[63]=B):B=t[63];let V;return t[64]!==te||t[65]!==ne||t[66]!==B?(V=(0,Q.jsxs)(Q.Fragment,{children:[te,ne,B]}),t[64]=te,t[65]=ne,t[66]=B,t[67]=V):V=t[67],V}function cr(e){let t=(0,At.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Ze(),c=p().states,{dispatch:l}=Cn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=on({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,m;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(m=o===`context`?(0,Q.jsx)(Nn,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(Fn,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=m):m=t[8];let h;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==m?(h=(0,Q.jsx)(lr,{actions:r,existingNames:i,menuKind:o,skill:n,openWithAi:m}),t[9]=r,t[10]=i,t[11]=o,t[12]=n,t[13]=m,t[14]=h):h=t[14],h}function lr(e){let t=(0,At.c)(124),{actions:n,existingNames:i,menuKind:a,openWithAi:o,skill:l}=e,{_:u}=c(),d=ut(),f=C(l,n),p=l.absolutePath,m;t[0]===u?m=t[1]:(m=async function(e){try{await Dt(e),Z.success(u({id:`SXCSQd`}))}catch{Z.error(u({id:`cRHuuI`}))}},t[0]=u,t[1]=m);let _=m,v;t[2]!==p||t[3]!==a?(v=(0,Q.jsx)(or,{absolutePath:p,menuKind:a}),t[2]=p,t[3]=a,t[4]=v):v=t[4];let D,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(tt,{"aria-hidden":!0}),O=(0,Q.jsx)(s,{id:`zd00pH`}),t[5]=D,t[6]=O):(D=t[5],O=t[6]);let k;t[7]===a?k=t[8]:(k=(0,Q.jsxs)(E,{menuKind:a,children:[D,O]}),t[7]=a,t[8]=k);let A;t[9]!==p||t[10]!==_||t[11]!==a?(A=p?(0,Q.jsx)(S,{menuKind:a,onSelect:()=>void _(p),children:(0,Q.jsx)(s,{id:`z2funE`})}):null,t[9]=p,t[10]=_,t[11]=a,t[12]=A):A=t[12];let j;t[13]!==_||t[14]!==l.path?(j=()=>void _(l.path),t[13]=_,t[14]=l.path,t[15]=j):j=t[15];let M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(s,{id:`xloBjn`}),t[16]=M):M=t[16];let N;t[17]!==a||t[18]!==j?(N=(0,Q.jsx)(S,{menuKind:a,onSelect:j,children:M}),t[17]=a,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==a||t[21]!==A||t[22]!==N?(P=(0,Q.jsxs)(h,{menuKind:a,children:[A,N]}),t[20]=a,t[21]=A,t[22]=N,t[23]=P):P=t[23];let ee;t[24]!==a||t[25]!==P?(ee=(0,Q.jsx)(b,{menuKind:a,children:P}),t[24]=a,t[25]=P,t[26]=ee):ee=t[26];let F;t[27]!==a||t[28]!==ee||t[29]!==k?(F=(0,Q.jsxs)(g,{menuKind:a,children:[k,ee]}),t[27]=a,t[28]=ee,t[29]=k,t[30]=F):F=t[30];let te;t[31]!==a||t[32]!==o||t[33]!==F||t[34]!==v?(te=(0,Q.jsxs)(h,{menuKind:a,children:[v,o,F]}),t[31]=a,t[32]=o,t[33]=F,t[34]=v,t[35]=te):te=t[35];let ne;t[36]===a?ne=t[37]:(ne=(0,Q.jsx)(w,{menuKind:a}),t[36]=a,t[37]=ne);let I;t[38]!==n||t[39]!==i||t[40]!==l?(I=()=>void n.duplicate(l,i),t[38]=n,t[39]=i,t[40]=l,t[41]=I):I=t[41];let L,R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(r,{"aria-hidden":!0}),R=(0,Q.jsx)(s,{id:`euc6Ns`}),t[42]=L,t[43]=R):(L=t[42],R=t[43]);let z;t[44]!==a||t[45]!==I?(z=(0,Q.jsxs)(S,{menuKind:a,onSelect:I,children:[L,R]}),t[44]=a,t[45]=I,t[46]=z):z=t[46];let B;t[47]!==n||t[48]!==i||t[49]!==l?(B=()=>n.requestRename(l,i),t[47]=n,t[48]=i,t[49]=l,t[50]=B):B=t[50];let V,H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(En,{"aria-hidden":!0}),H=(0,Q.jsx)(s,{id:`2wxgft`}),t[51]=V,t[52]=H):(V=t[51],H=t[52]);let U;t[53]!==a||t[54]!==B?(U=(0,Q.jsxs)(S,{menuKind:a,onSelect:B,children:[V,H]}),t[53]=a,t[54]=B,t[55]=U):U=t[55];let W;t[56]!==n||t[57]!==l?(W=()=>n.requestFileCreate(l),t[56]=n,t[57]=l,t[58]=W):W=t[58];let G,K;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(y,{"aria-hidden":!0}),K=(0,Q.jsx)(s,{id:`HdkSiO`}),t[59]=G,t[60]=K):(G=t[59],K=t[60]);let q;t[61]!==a||t[62]!==W?(q=(0,Q.jsxs)(S,{menuKind:a,onSelect:W,children:[G,K]}),t[61]=a,t[62]=W,t[63]=q):q=t[63];let J,Y;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(Tn,{"aria-hidden":!0}),Y=(0,Q.jsx)(s,{id:`TKQ7K-`}),t[64]=J,t[65]=Y):(J=t[64],Y=t[65]);let X;t[66]===a?X=t[67]:(X=(0,Q.jsxs)(E,{menuKind:a,children:[J,Y]}),t[66]=a,t[67]=X);let re;t[68]!==n||t[69]!==l?(re=e=>n.requestForkResolve(l,e),t[68]=n,t[69]=l,t[70]=re):re=t[70];let ie;t[71]!==f||t[72]!==a||t[73]!==l||t[74]!==re?(ie=(0,Q.jsx)(x,{toggles:f,skill:l,menuKind:a,onResolveFork:re}),t[71]=f,t[72]=a,t[73]=l,t[74]=re,t[75]=ie):ie=t[75];let ae;t[76]!==a||t[77]!==ie?(ae=(0,Q.jsx)(h,{menuKind:a,children:ie}),t[76]=a,t[77]=ie,t[78]=ae):ae=t[78];let oe;t[79]!==a||t[80]!==ae?(oe=(0,Q.jsx)(b,{menuKind:a,className:T,children:ae}),t[79]=a,t[80]=ae,t[81]=oe):oe=t[81];let se;t[82]!==a||t[83]!==X||t[84]!==oe?(se=(0,Q.jsxs)(g,{menuKind:a,children:[X,oe]}),t[82]=a,t[83]=X,t[84]=oe,t[85]=se):se=t[85];let ce;t[86]!==n||t[87]!==l?(ce=()=>n.requestScopeMove(l,l.scope===`project`?`global`:`project`),t[86]=n,t[87]=l,t[88]=ce):ce=t[88];let le;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Q.jsx)(wn,{"aria-hidden":!0}),t[89]=le):le=t[89];let ue;t[90]!==d.global||t[91]!==d.project||t[92]!==l.scope?(ue=l.scope===`project`?(0,Q.jsx)(s,{id:`bpytj4`,values:{0:d.global}}):(0,Q.jsx)(s,{id:`bpytj4`,values:{0:d.project}}),t[90]=d.global,t[91]=d.project,t[92]=l.scope,t[93]=ue):ue=t[93];let de;t[94]!==a||t[95]!==ce||t[96]!==ue?(de=(0,Q.jsxs)(S,{menuKind:a,onSelect:ce,children:[le,ue]}),t[94]=a,t[95]=ce,t[96]=ue,t[97]=de):de=t[97];let fe;t[98]!==a||t[99]!==z||t[100]!==U||t[101]!==q||t[102]!==se||t[103]!==de?(fe=(0,Q.jsxs)(h,{menuKind:a,children:[z,U,q,se,de]}),t[98]=a,t[99]=z,t[100]=U,t[101]=q,t[102]=se,t[103]=de,t[104]=fe):fe=t[104];let pe;t[105]===a?pe=t[106]:(pe=(0,Q.jsx)(w,{menuKind:a}),t[105]=a,t[106]=pe);let me;t[107]!==n||t[108]!==l?(me=()=>n.requestDelete(l),t[107]=n,t[108]=l,t[109]=me):me=t[109];let he,ge;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Q.jsx)(st,{"aria-hidden":!0}),ge=(0,Q.jsx)(s,{id:`cnGeoo`}),t[110]=he,t[111]=ge):(he=t[110],ge=t[111]);let _e;t[112]!==a||t[113]!==me?(_e=(0,Q.jsxs)(S,{menuKind:a,variant:`destructive`,onSelect:me,children:[he,ge]}),t[112]=a,t[113]=me,t[114]=_e):_e=t[114];let ve;t[115]!==a||t[116]!==_e?(ve=(0,Q.jsx)(h,{menuKind:a,children:_e}),t[115]=a,t[116]=_e,t[117]=ve):ve=t[117];let ye;return t[118]!==te||t[119]!==ne||t[120]!==fe||t[121]!==pe||t[122]!==ve?(ye=(0,Q.jsxs)(Q.Fragment,{children:[te,ne,fe,pe,ve]}),t[118]=te,t[119]=ne,t[120]=fe,t[121]=pe,t[122]=ve,t[123]=ye):ye=t[123],ye}export{vn as C,$t as E,rn as S,Qt as T,an as _,tr as a,mn as b,Fn as c,kn as d,Dn as f,nn as g,sn as h,nr as i,Nn as l,wn as m,sr as n,Bn as o,On as p,or as r,Hn as s,cr as t,An as u,en as v,Cn as w,bn as x,tn as y};
@@ -1 +1 @@
1
- import{r as e}from"./dist-Nvb76hAm.js";import{Kt as t,co as n,mo as r,to as i,uo as a}from"./dist-DGemBD_J.js";function o(e){return e.path.split(`/`).slice(0,-1).join(`/`)}var s=[`project`,`global`];function c(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}function l(e){return e.startsWith(`open-knowledge-pack-`)?e.slice(r.length):e}function u(e){let t=e.path.replace(/\/SKILL\.mdx?$/i,``);return e.scope===`global`?`~/${t}`:t}function d(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`).replace(/^\/root/,`~`)}function f(e){let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):e}function p(){let{_:t}=e();return{project:t({id:`e0NrBM`}),global:t({id:`2GT3Hf`})}}function m(){let{_:t}=e();return{project:t({id:`Es3G-g`}),global:t({id:`fvrHin`})}}function h(e,t){if(e.includes(`/`))return t===`global`?`~/${e}`:e;let r=e===`agents`?i:(t===`global`?a:n)[e]??`.${e}/skills`;return t===`global`?`~/${r}`:r}function g(e,t){return!e||t===``?[]:Object.keys(e).filter(n=>e[n]===t)}function _(e){let t=e.hostAliases??{},n=e=>e.split(`/`).slice(0,-1).join(`/`),r=new Set(e.hosts),i=new Set([...e.hosts.filter(e=>!e.includes(`/`)).map(t=>h(t,e.scope).replace(/^~\//,``)),...(e.customPlacements??[]).map(e=>n(e.path)),...e.path.includes(`/`)?[n(e.path.replace(/\/SKILL\.mdx?$/i,``))]:[]]);return Object.entries(t).filter(([e,t])=>!r.has(e)&&i.has(t)).map(([e])=>e)}function v(e){let t=new Set(e.symlinkedHosts??[]),n=[],r=new Set,i=(e,t)=>{r.has(e)||(r.add(e),n.push({dir:e,symlink:t}))};i(u(e),t.has(e.hosts[0]??``));for(let n of e.hosts)i(`${h(n,e.scope)}/${e.name}`,t.has(n));for(let t of e.customPlacements??[])i(t.path,t.mode===`link`);return n}function y(e,n=e.hosts){let r=t.options,i=_(e);return[...n.includes(`agents`)?[`agents`]:[],...r.filter(e=>n.includes(e)||i.includes(e)),...(e.customPlacements??[]).map(e=>o(e))]}export{f as a,h as c,m as d,p as f,y as i,c as l,g as n,l as o,o as r,v as s,s as t,d as u};
1
+ import{r as e}from"./dist-Nvb76hAm.js";import{Kt as t,co as n,mo as r,to as i,uo as a}from"./dist-7P3QNiAv.js";function o(e){return e.path.split(`/`).slice(0,-1).join(`/`)}var s=[`project`,`global`];function c(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}function l(e){return e.startsWith(`open-knowledge-pack-`)?e.slice(r.length):e}function u(e){let t=e.path.replace(/\/SKILL\.mdx?$/i,``);return e.scope===`global`?`~/${t}`:t}function d(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`).replace(/^\/root/,`~`)}function f(e){let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):e}function p(){let{_:t}=e();return{project:t({id:`e0NrBM`}),global:t({id:`2GT3Hf`})}}function m(){let{_:t}=e();return{project:t({id:`Es3G-g`}),global:t({id:`fvrHin`})}}function h(e,t){if(e.includes(`/`))return t===`global`?`~/${e}`:e;let r=e===`agents`?i:(t===`global`?a:n)[e]??`.${e}/skills`;return t===`global`?`~/${r}`:r}function g(e,t){return!e||t===``?[]:Object.keys(e).filter(n=>e[n]===t)}function _(e){let t=e.hostAliases??{},n=e=>e.split(`/`).slice(0,-1).join(`/`),r=new Set(e.hosts),i=new Set([...e.hosts.filter(e=>!e.includes(`/`)).map(t=>h(t,e.scope).replace(/^~\//,``)),...(e.customPlacements??[]).map(e=>n(e.path)),...e.path.includes(`/`)?[n(e.path.replace(/\/SKILL\.mdx?$/i,``))]:[]]);return Object.entries(t).filter(([e,t])=>!r.has(e)&&i.has(t)).map(([e])=>e)}function v(e){let t=new Set(e.symlinkedHosts??[]),n=[],r=new Set,i=(e,t)=>{r.has(e)||(r.add(e),n.push({dir:e,symlink:t}))};i(u(e),t.has(e.hosts[0]??``));for(let n of e.hosts)i(`${h(n,e.scope)}/${e.name}`,t.has(n));for(let t of e.customPlacements??[])i(t.path,t.mode===`link`);return n}function y(e,n=e.hosts){let r=t.options,i=_(e);return[...n.includes(`agents`)?[`agents`]:[],...r.filter(e=>n.includes(e)||i.includes(e)),...(e.customPlacements??[]).map(e=>o(e))]}export{f as a,h as c,m as d,p as f,y as i,c as l,g as n,l as o,o as r,v as s,s as t,d as u};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{Gt as r,Jt as i}from"./dist-DGemBD_J.js";import{t as a}from"./dist-XgwTV-oh2.js";import{_ as o,s,t as ee,v as c}from"./documents-events-B2g_1xMi.js";import{t as l}from"./parse-api-error-DsopQ8yv.js";import{i as u,r as d}from"./known-skill-dirs-toPil01C.js";var f=n(),p=e(t(),1),m=null,h=null,g=!1;function _(){h!==null&&(g=!0)}var v=!1;function y(){v||typeof window>`u`||(v=!0,c(_),o(e=>{e.includes(`files`)&&_()}))}var b=2e4;function x(){return fetch(`/api/skills`,{signal:AbortSignal.timeout(b)}).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(l(t)??`HTTP ${e.status}`)}return e.json()})}var S=3;function C(){if(y(),h!==null)return h;let e=(async()=>{for(let e=0;e<S;e++){g=!1;let e=await x();if(!g)return e}return g=!1,x()})().finally(()=>{h===e&&(h=null)});return h=e,e}function w(e){let t=(0,f.c)(9),n=e?.enabled??!0,[r,s]=(0,p.useState)(D),[l,h]=(0,p.useState)(0),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=null,t=()=>{e&&clearTimeout(e),e=setTimeout(()=>h(E),200)},n=c(t),r=o(e=>{e.includes(`files`)&&t()});return()=>{e&&clearTimeout(e),n(),r()}},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,p.useEffect)(g,_);let v;t[2]===n?v=t[3]:(v=()=>{if(!n)return;let e=!1;return s(T),C().then(t=>{if(e)return;let n=i.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),s({status:`error`,message:a._({id:`GbzBEk`})});return}m=n.data.skills,u(d(n.data.skills)),s({status:`ready`,data:n.data.skills})}).catch(t=>{e||s(e=>e.status===`ready`?e:{status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[2]=n,t[3]=v);let y;t[4]!==n||t[5]!==l?(y=[l,n],t[4]=n,t[5]=l,t[6]=y):y=t[6],(0,p.useEffect)(v,y);let b;return t[7]===r?b=t[8]:(b=r.status===`ready`?{status:`ready`,data:ee(r.data)}:r,t[7]=r,t[8]=b),b}function T(e){return e.status===`ready`?e:{status:`loading`}}function E(e){return e+1}function D(){return m===null?{status:`idle`}:{status:`ready`,data:m}}async function O(e){return l(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function k(e,t){try{let n=await fetch(e,t?{signal:t}:void 0);return n.ok?{ok:!0,...await n.json()}:{ok:!1,error:await O(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function A(e,t,n){try{let r=await fetch(e,{method:t,...n===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}});return r.ok?{ok:!0,...await r.json().catch(()=>null)??{}}:{ok:!1,error:await O(r)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function j(e){let t=e.trim();return t.length<2?{ok:!0,results:[],backend:`skills.sh`,degraded:!1}:k(`/api/skills/search?q=${encodeURIComponent(t)}`)}async function M(e){let t=await A(`/api/seed/install-pack-skill`,`POST`,{packId:e});return t.ok&&s(),t}async function N(){return k(`/api/skills/popular?limit=24`)}async function P(e,t){let n=await k(e?`/api/skills?scope=${e}`:`/api/skills`,t);if(!n.ok)return n;let{ok:r,...o}=n,s=i.safeParse(o);return s.success?{ok:!0,skills:s.data.skills}:{ok:!1,error:a._({id:`iXs0kt`})}}async function F(e){return k(`/api/skills/detail?${new URLSearchParams({source:e.source,name:e.name}).toString()}`)}async function I(e,t){return k(`/api/skills/preview?${new URLSearchParams({source:e.source,name:e.name}).toString()}`,t)}async function L(e,t){return k(`/api/skills/resolve-ref?${new URLSearchParams({ref:e.ref,scope:e.scope,from:e.from}).toString()}`,t)}async function R(e){return k(`/api/skills/publisher?source=${encodeURIComponent(e)}`)}async function z(e,t){return k(`/api/skills/discover?source=${encodeURIComponent(e)}`,t)}async function B(){return k(`/api/skills/installed`)}async function V(e){try{let t=await fetch(`/api/skill/edit-external`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return!n||typeof n.docName!=`string`?{ok:!1,error:a._({id:`iBVgIQ`})}:{ok:!0,docName:n.docName}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function te(e){try{let t=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,created:n?.created??!1,warnings:n?.warnings??[],...typeof n?.path==`string`?{path:n.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function H(e){try{let t=await fetch(`/api/skill/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null),n=l(e)??`HTTP ${t.status}`,r=typeof e?.detail==`string`&&/multiple skills/i.test(String(e?.title??``))?String(e.detail).split(`, `).map(e=>e.trim()).filter(Boolean):void 0;return r?{ok:!1,error:n,skills:r}:{ok:!1,error:n}}let n=await t.json().catch(()=>null);return!n||typeof n.name!=`string`?{ok:!1,error:a._({id:`HLoO-Z`})}:(s(),{ok:!0,name:n.name,alreadyImported:n?.alreadyImported??!1,collisionRenamedFrom:n?.collisionRenamedFrom,warnings:n?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function U(e){try{let t=await fetch(`/api/skills/import-bulk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return!n||!Array.isArray(n.results)?{ok:!1,error:a._({id:`HLoO-Z`})}:(s(),{ok:!0,...n})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function W(e,t){try{let n=await fetch(`/api/skill-upload?scope=${encodeURIComponent(t)}`,{method:`POST`,body:e});if(!n.ok)return{ok:!1,error:await O(n)};let r=await n.json().catch(()=>null);return!r||typeof r.name!=`string`?{ok:!1,error:a._({id:`iodl3p`})}:(s(),{ok:!0,name:r.name,alreadyImported:r?.alreadyImported??!1,collisionRenamedFrom:r?.collisionRenamedFrom,warnings:r?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function G(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function K(e){try{let t=G(e.name,e.existingNames),n=await fetch(`/api/skill/duplicate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,toName:t})});if(!n.ok)return{ok:!1,error:await O(n)};let r=await n.json().catch(()=>null);return typeof r?.name==`string`?(s(),{ok:!0,name:r.name}):{ok:!1,error:a._({id:`emMrXQ`})}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function q(e){let{name:t,fromScope:n,toScope:r}=e;if(n===r)return{ok:!0,scope:r};try{let e=await fetch(`/api/skill/move-scope`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,fromScope:n,toScope:r})});if(!e.ok)return{ok:!1,error:await O(e)};let i=await e.json().catch(()=>null);return s(),{ok:!0,scope:r,...typeof i?.path==`string`?{path:i.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function J(e){try{let t=await fetch(`/api/skill/track-in-git`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return e.apply===!0&&s(),{ok:!0,line:n?.line??``,gitignorePath:n?.gitignorePath??`.gitignore`,applied:n?.applied===!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Y(e){try{let t=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,committed:n?.committed??!1,...typeof n?.to==`string`?{to:n.to}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function X(e,t){try{let n=`?name=${encodeURIComponent(t)}&scope=${encodeURIComponent(e)}`,r=await fetch(`/api/skill${n}`,{method:`DELETE`});if(!r.ok)return{ok:!1,error:await O(r)};let i=await r.json().catch(()=>null);return s(),{ok:!0,existed:i?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Z(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,fork:{editor:e.editor,action:e.action,...e.toName===void 0?{}:{toName:e.toName}}});return t.ok?(s(),{ok:!0}):t}async function Q(e){try{let t=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,path:n?.path??e.path}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ne(e){try{let t=await fetch(`/api/skill-file/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,from:n?.from??e.from,to:n?.to??e.to,...n?.fromDocName===void 0?{}:{fromDocName:n.fromDocName},...n?.toDocName===void 0?{}:{toDocName:n.toDocName}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function re(e){try{let t=new URLSearchParams({scope:e.scope,name:e.name,path:e.path}),n=await fetch(`/api/skill-file?${t.toString()}`,{method:`DELETE`});if(!n.ok)return{ok:!1,error:await O(n)};let r=await n.json().catch(()=>null);return s(),{ok:!0,existed:r?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ie(e,t,n){try{let r=new URLSearchParams({name:t,scope:e,...n?{host:n}:{}}),i=await fetch(`/api/skill?${r.toString()}`);return i.ok?{ok:!0,files:(await i.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await O(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ae(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path,...e.host?{host:e.host}:{}}),n=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!n.ok)return{ok:!1,status:n.status,error:await O(n)};let r=await n.json().catch(()=>null);return typeof r?.text==`string`?{ok:!0,text:r.text}:{ok:!1,status:n.status,error:`HTTP ${n.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function oe(e,t){return ae({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function $(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,hosts:n?.hosts??[],scripts:n?.scripts??!1,warnings:n?.warnings??[],warningCodes:n?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function se(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,place:{dir:e.dir,mode:e.mode}})});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,placedAt:n?.placedAt??e.dir}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ce(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,unplace:{path:e.path}});return t.ok?(s(),{ok:!0}):t}async function le(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,setSource:e.target});return t.ok?(s(),{ok:!0}):t}async function ue(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,convert:{target:e.target,mode:e.mode}});return t.ok?(s(),{ok:!0}):t}async function de(e){try{let t=await fetch(`/api/skill-targets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folderAction:e})});if(!t.ok)return{ok:!1,error:await O(t)};if(!e.preview)return{ok:!0};let n=await t.json().catch(()=>null),i=typeof n==`object`&&n&&`preview`in n?n.preview:void 0,o=r.safeParse(i);return o.success?{ok:!0,preview:o.data}:{ok:!1,error:a._({id:`iBVgIQ`})}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function fe(e){try{let t=await fetch(`/api/skill/reimport`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return e.dryRun||s(),{ok:!0,updated:n?.updated??!1,source:n?.source??``,localBody:n?.localBody,upstreamBody:n?.upstreamBody,...n?.gitTracked===void 0?{}:{gitTracked:n.gitTracked},warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function pe(e){try{let t=await fetch(`/api/skill/revert`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{le as A,fe as C,pe as D,L as E,w as F,ce as M,W as N,te as O,Q as P,de as S,Z as T,P as _,K as a,q as b,R as c,ie as d,H as f,B as g,$ as h,z as i,J as j,j as k,F as l,M as m,X as n,V as o,U as p,re as r,N as s,ue as t,I as u,oe as v,ne as w,se as x,Y as y};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{Gt as r,Jt as i}from"./dist-7P3QNiAv.js";import{t as a}from"./dist-XgwTV-oh2.js";import{_ as o,s,t as ee,v as c}from"./documents-events-DSYMSbrh.js";import{t as l}from"./parse-api-error-DsopQ8yv.js";import{i as u,r as d}from"./known-skill-dirs-toPil01C.js";var f=n(),p=e(t(),1),m=null,h=null,g=!1;function _(){h!==null&&(g=!0)}var v=!1;function y(){v||typeof window>`u`||(v=!0,c(_),o(e=>{e.includes(`files`)&&_()}))}var b=2e4;function x(){return fetch(`/api/skills`,{signal:AbortSignal.timeout(b)}).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(l(t)??`HTTP ${e.status}`)}return e.json()})}var S=3;function C(){if(y(),h!==null)return h;let e=(async()=>{for(let e=0;e<S;e++){g=!1;let e=await x();if(!g)return e}return g=!1,x()})().finally(()=>{h===e&&(h=null)});return h=e,e}function w(e){let t=(0,f.c)(9),n=e?.enabled??!0,[r,s]=(0,p.useState)(D),[l,h]=(0,p.useState)(0),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=null,t=()=>{e&&clearTimeout(e),e=setTimeout(()=>h(E),200)},n=c(t),r=o(e=>{e.includes(`files`)&&t()});return()=>{e&&clearTimeout(e),n(),r()}},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,p.useEffect)(g,_);let v;t[2]===n?v=t[3]:(v=()=>{if(!n)return;let e=!1;return s(T),C().then(t=>{if(e)return;let n=i.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),s({status:`error`,message:a._({id:`GbzBEk`})});return}m=n.data.skills,u(d(n.data.skills)),s({status:`ready`,data:n.data.skills})}).catch(t=>{e||s(e=>e.status===`ready`?e:{status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[2]=n,t[3]=v);let y;t[4]!==n||t[5]!==l?(y=[l,n],t[4]=n,t[5]=l,t[6]=y):y=t[6],(0,p.useEffect)(v,y);let b;return t[7]===r?b=t[8]:(b=r.status===`ready`?{status:`ready`,data:ee(r.data)}:r,t[7]=r,t[8]=b),b}function T(e){return e.status===`ready`?e:{status:`loading`}}function E(e){return e+1}function D(){return m===null?{status:`idle`}:{status:`ready`,data:m}}async function O(e){return l(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function k(e,t){try{let n=await fetch(e,t?{signal:t}:void 0);return n.ok?{ok:!0,...await n.json()}:{ok:!1,error:await O(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function A(e,t,n){try{let r=await fetch(e,{method:t,...n===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}});return r.ok?{ok:!0,...await r.json().catch(()=>null)??{}}:{ok:!1,error:await O(r)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function j(e){let t=e.trim();return t.length<2?{ok:!0,results:[],backend:`skills.sh`,degraded:!1}:k(`/api/skills/search?q=${encodeURIComponent(t)}`)}async function M(e){let t=await A(`/api/seed/install-pack-skill`,`POST`,{packId:e});return t.ok&&s(),t}async function N(){return k(`/api/skills/popular?limit=24`)}async function P(e,t){let n=await k(e?`/api/skills?scope=${e}`:`/api/skills`,t);if(!n.ok)return n;let{ok:r,...o}=n,s=i.safeParse(o);return s.success?{ok:!0,skills:s.data.skills}:{ok:!1,error:a._({id:`iXs0kt`})}}async function F(e){return k(`/api/skills/detail?${new URLSearchParams({source:e.source,name:e.name}).toString()}`)}async function I(e,t){return k(`/api/skills/preview?${new URLSearchParams({source:e.source,name:e.name}).toString()}`,t)}async function L(e,t){return k(`/api/skills/resolve-ref?${new URLSearchParams({ref:e.ref,scope:e.scope,from:e.from}).toString()}`,t)}async function R(e){return k(`/api/skills/publisher?source=${encodeURIComponent(e)}`)}async function z(e,t){return k(`/api/skills/discover?source=${encodeURIComponent(e)}`,t)}async function B(){return k(`/api/skills/installed`)}async function V(e){try{let t=await fetch(`/api/skill/edit-external`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return!n||typeof n.docName!=`string`?{ok:!1,error:a._({id:`iBVgIQ`})}:{ok:!0,docName:n.docName}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function te(e){try{let t=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,created:n?.created??!1,warnings:n?.warnings??[],...typeof n?.path==`string`?{path:n.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function H(e){try{let t=await fetch(`/api/skill/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null),n=l(e)??`HTTP ${t.status}`,r=typeof e?.detail==`string`&&/multiple skills/i.test(String(e?.title??``))?String(e.detail).split(`, `).map(e=>e.trim()).filter(Boolean):void 0;return r?{ok:!1,error:n,skills:r}:{ok:!1,error:n}}let n=await t.json().catch(()=>null);return!n||typeof n.name!=`string`?{ok:!1,error:a._({id:`HLoO-Z`})}:(s(),{ok:!0,name:n.name,alreadyImported:n?.alreadyImported??!1,collisionRenamedFrom:n?.collisionRenamedFrom,warnings:n?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function U(e){try{let t=await fetch(`/api/skills/import-bulk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return!n||!Array.isArray(n.results)?{ok:!1,error:a._({id:`HLoO-Z`})}:(s(),{ok:!0,...n})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function W(e,t){try{let n=await fetch(`/api/skill-upload?scope=${encodeURIComponent(t)}`,{method:`POST`,body:e});if(!n.ok)return{ok:!1,error:await O(n)};let r=await n.json().catch(()=>null);return!r||typeof r.name!=`string`?{ok:!1,error:a._({id:`iodl3p`})}:(s(),{ok:!0,name:r.name,alreadyImported:r?.alreadyImported??!1,collisionRenamedFrom:r?.collisionRenamedFrom,warnings:r?.warnings??[]})}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function G(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function K(e){try{let t=G(e.name,e.existingNames),n=await fetch(`/api/skill/duplicate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,toName:t})});if(!n.ok)return{ok:!1,error:await O(n)};let r=await n.json().catch(()=>null);return typeof r?.name==`string`?(s(),{ok:!0,name:r.name}):{ok:!1,error:a._({id:`emMrXQ`})}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function q(e){let{name:t,fromScope:n,toScope:r}=e;if(n===r)return{ok:!0,scope:r};try{let e=await fetch(`/api/skill/move-scope`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,fromScope:n,toScope:r})});if(!e.ok)return{ok:!1,error:await O(e)};let i=await e.json().catch(()=>null);return s(),{ok:!0,scope:r,...typeof i?.path==`string`?{path:i.path}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function J(e){try{let t=await fetch(`/api/skill/track-in-git`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return e.apply===!0&&s(),{ok:!0,line:n?.line??``,gitignorePath:n?.gitignorePath??`.gitignore`,applied:n?.applied===!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Y(e){try{let t=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,committed:n?.committed??!1,...typeof n?.to==`string`?{to:n.to}:{}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function X(e,t){try{let n=`?name=${encodeURIComponent(t)}&scope=${encodeURIComponent(e)}`,r=await fetch(`/api/skill${n}`,{method:`DELETE`});if(!r.ok)return{ok:!1,error:await O(r)};let i=await r.json().catch(()=>null);return s(),{ok:!0,existed:i?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Z(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,fork:{editor:e.editor,action:e.action,...e.toName===void 0?{}:{toName:e.toName}}});return t.ok?(s(),{ok:!0}):t}async function Q(e){try{let t=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,path:n?.path??e.path}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ne(e){try{let t=await fetch(`/api/skill-file/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,from:n?.from??e.from,to:n?.to??e.to,...n?.fromDocName===void 0?{}:{fromDocName:n.fromDocName},...n?.toDocName===void 0?{}:{toDocName:n.toDocName}}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function re(e){try{let t=new URLSearchParams({scope:e.scope,name:e.name,path:e.path}),n=await fetch(`/api/skill-file?${t.toString()}`,{method:`DELETE`});if(!n.ok)return{ok:!1,error:await O(n)};let r=await n.json().catch(()=>null);return s(),{ok:!0,existed:r?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ie(e,t,n){try{let r=new URLSearchParams({name:t,scope:e,...n?{host:n}:{}}),i=await fetch(`/api/skill?${r.toString()}`);return i.ok?{ok:!0,files:(await i.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await O(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ae(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path,...e.host?{host:e.host}:{}}),n=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!n.ok)return{ok:!1,status:n.status,error:await O(n)};let r=await n.json().catch(()=>null);return typeof r?.text==`string`?{ok:!0,text:r.text}:{ok:!1,status:n.status,error:`HTTP ${n.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function oe(e,t){return ae({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function $(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,hosts:n?.hosts??[],scripts:n?.scripts??!1,warnings:n?.warnings??[],warningCodes:n?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function se(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({scope:e.scope,name:e.name,place:{dir:e.dir,mode:e.mode}})});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,placedAt:n?.placedAt??e.dir}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ce(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,unplace:{path:e.path}});return t.ok?(s(),{ok:!0}):t}async function le(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,setSource:e.target});return t.ok?(s(),{ok:!0}):t}async function ue(e){let t=await A(`/api/skill/install`,`POST`,{scope:e.scope,name:e.name,convert:{target:e.target,mode:e.mode}});return t.ok?(s(),{ok:!0}):t}async function de(e){try{let t=await fetch(`/api/skill-targets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folderAction:e})});if(!t.ok)return{ok:!1,error:await O(t)};if(!e.preview)return{ok:!0};let n=await t.json().catch(()=>null),i=typeof n==`object`&&n&&`preview`in n?n.preview:void 0,o=r.safeParse(i);return o.success?{ok:!0,preview:o.data}:{ok:!1,error:a._({id:`iBVgIQ`})}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function fe(e){try{let t=await fetch(`/api/skill/reimport`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return e.dryRun||s(),{ok:!0,updated:n?.updated??!1,source:n?.source??``,localBody:n?.localBody,upstreamBody:n?.upstreamBody,...n?.gitTracked===void 0?{}:{gitTracked:n.gitTracked},warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function pe(e){try{let t=await fetch(`/api/skill/revert`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await O(t)};let n=await t.json().catch(()=>null);return s(),{ok:!0,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{le as A,fe as C,pe as D,L as E,w as F,ce as M,W as N,te as O,Q as P,de as S,Z as T,P as _,K as a,q as b,R as c,ie as d,H as f,B as g,$ as h,z as i,J as j,j as k,F as l,M as m,X as n,V as o,U as p,re as r,N as s,ue as t,I as u,oe as v,ne as w,se as x,Y as y};
@@ -1,2 +1,2 @@
1
- import{I as e}from"./CodeMirrorPropInput-CAuN39X3.js";import{C as t,D as n,E as r,G as i,L as a,S as o,U as s,W as c,g as l,it as u,rt as d}from"./config-provider-C7upY2Yd.js";import{$ as f,At as p,Ct as m,Nt as h,Ot as g,Y as _,Z as v,et as y}from"./dist-ZfIywMZM.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:a(this.yanchor),yhead:a(this.yhead)}}static fromJSON(t){return new e(r(t.yanchor),r(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new l(e)}toYPos(e,t=0){return n(this.ytext,e,t)}fromYPos(e){let n=t(r(e),this.ytext.doc);if(n==null||n.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:n.index,assoc:n.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?g.cursor(n.pos,n.assoc):g.range(t.pos,n.pos)}},S=p.define({combine(e){return e[e.length-1]}}),C=m.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
1
+ import{I as e}from"./CodeMirrorPropInput-BKSuOOVi.js";import{C as t,D as n,E as r,G as i,L as a,S as o,U as s,W as c,g as l,it as u,rt as d}from"./config-provider-j9ER9l4W.js";import{$ as f,At as p,Ct as m,Nt as h,Ot as g,Y as _,Z as v,et as y}from"./dist-ZfIywMZM.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:a(this.yanchor),yhead:a(this.yhead)}}static fromJSON(t){return new e(r(t.yanchor),r(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new l(e)}toYPos(e,t=0){return n(this.ytext,e,t)}fromYPos(e){let n=t(r(e),this.ytext.doc);if(n==null||n.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:n.index,assoc:n.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?g.cursor(n.pos,n.assoc):g.range(t.pos,n.pos)}},S=p.define({combine(e){return e[e.length-1]}}),C=m.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
2
2
  `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},T=f.fromClass(w),E=v.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),D=m.define(),O=class extends y{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return s(`span`,[i(`class`,`cm-ySelectionCaret`),i(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[c(`⁠`),s(`div`,[i(`class`,`cm-ySelectionCaretDot`)]),c(`⁠`),s(`div`,[i(`class`,`cm-ySelectionInfo`)],[c(this.name)]),c(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},k=class{constructor(e){this.conf=e.state.facet(S),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[D.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=h.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let i=this.conf.ytext,a=i.doc,s=this.conf.awareness,c=[],l=this.conf.awareness.getLocalState();if(l!=null){let t=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),a=t?e.state.selection.main:null,c=l.cursor==null?null:r(l.cursor.anchor),u=l.cursor==null?null:r(l.cursor.head);if(a!=null){let e=n(i,a.anchor),t=n(i,a.head);(l.cursor==null||!o(c,e)||!o(u,t))&&s.setLocalStateField(`cursor`,{anchor:e,head:t})}else l.cursor!=null&&t&&s.setLocalStateField(`cursor`,null)}s.getStates().forEach((n,r)=>{if(r===s.doc.clientID)return;let o=n.cursor;if(o==null||o.anchor==null||o.head==null)return;let l=t(o.anchor,a),f=t(o.head,a);if(l==null||f==null||l.type!==i||f.type!==i)return;let{color:p=`#30bced`,name:m=`Anonymous`}=n.user||{},h=n.user&&n.user.colorLight||p+`33`,g=u(l.index,f.index),v=d(l.index,f.index),y=e.view.state.doc.lineAt(g),b=e.view.state.doc.lineAt(v);if(y.number===b.number)c.push({from:g,to:v,value:_.mark({attributes:{style:`background-color: ${h}`},class:`cm-ySelection`})});else{c.push({from:g,to:y.from+y.length,value:_.mark({attributes:{style:`background-color: ${h}`},class:`cm-ySelection`})}),c.push({from:b.from,to:v,value:_.mark({attributes:{style:`background-color: ${h}`},class:`cm-ySelection`})});for(let t=y.number+1;t<b.number;t++){let n=e.view.state.doc.line(t).from;c.push({from:n,to:n,value:_.line({attributes:{style:`background-color: ${h}`,class:`cm-yLineSelection`}})})}}c.push({from:f.index,to:f.index,value:_.widget({side:f.index-l.index>0?-1:1,block:!1,widget:new O(p,m)})})}),this.decorations=_.set(c,!0)}},A=f.fromClass(k,{decorations:e=>e.decorations}),j=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},M=p.define({combine(e){return e[e.length-1]}});m.define();var N=class{constructor(t){this.view=t,this.conf=t.state.facet(M),this._undoManager=this.conf.undoManager,this.syncConf=t.state.facet(S),this._beforeChangeSelection=null,this._mux=e(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:e})=>{let n=e.meta.get(this);if(n){let e=this.syncConf.fromYRange(n);t.dispatch(t.state.update({selection:e,effects:[v.scrollIntoView(e)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(C)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},P=f.fromClass(N),F=({state:e,dispatch:t})=>e.facet(M).undo()||!0,I=({state:e,dispatch:t})=>e.facet(M).redo()||!0,L=[{key:`Mod-z`,run:F,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:I,preventDefault:!0},{key:`Mod-Shift-z`,run:I,preventDefault:!0}],R=(e,t,{undoManager:n=new l(e)}={})=>{let r=new x(e,t),i=[S.of(r),T];return t&&i.push(E,A),n!==!1&&i.push(M.of(new j(n)),P,v.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?F(t):e.inputType===`historyRedo`?I(t):!1}})),i};export{L as n,R as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./utils-CPqDy6Hr.js";import{i as o,n as ee,t as te}from"./tooltip-DHXgxWLL.js";import{ei as ne}from"./dist-DGemBD_J.js";import{t as re}from"./x-DddVxTPq.js";import{t as ie}from"./badge-BG5JKjNK.js";var s=i(),c=e(n(),1),l=t();function u(e){let t=(0,s.c)(96),{value:n,onChange:i,onBlur:u,placeholder:d,id:f,disabled:p,grammar:ae,entryProblems:m,"aria-describedby":oe,"aria-invalid":se,ref:h}=e,ce=ae===void 0?`frontmatter-tag`:ae,{_:g}=r(),[_,le]=(0,c.useState)(``),[v,ue]=(0,c.useState)(null),[y,b]=(0,c.useState)(null),de=(0,c.useRef)(null),x;t[0]===h?x=t[1]:(x=e=>{de.current=e,typeof h==`function`?h(e):h&&(h.current=e)},t[0]=h,t[1]=x);let fe=x,[S,C]=(0,c.useState)(!1),pe=(0,c.useId)(),w=`${f??pe}-grammar-hint`,T=`${f??pe}-pill`,E;t[2]!==g||t[3]!==d?(E=d??g({id:`M5mfAe`}),t[2]=g,t[3]=d,t[4]=E):E=t[4];let me=E,D=ce===`frontmatter-tag`,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{le(``),C(!1),ue(null)},t[5]=O):O=t[5];let k=O,A;t[6]!==v||t[7]!==i||t[8]!==D||t[9]!==n?(A=e=>{let t=e.trim(),r=v===null?-1:n.indexOf(v);if(!t)return r!==-1&&i(n.filter((e,t)=>t!==r)),v!==null&&k(),!0;if(D&&!ne(t))return C(!0),!1;let a=D&&t.startsWith(`#`)?t.slice(1):t,o=n.indexOf(a);if(r===-1)return o===-1&&i([...n,a]),k(),!0;let ee=n.map((e,t)=>t===r?a:e);return i(o===-1||o===r?ee:ee.filter((e,t)=>t!==r)),k(),!0},t[6]=v,t[7]=i,t[8]=D,t[9]=n,t[10]=A):A=t[10];let j=A,M;t[11]!==i||t[12]!==n?(M=e=>{i(n.filter((t,n)=>n!==e))},t[11]=i,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==j||t[15]!==p||t[16]!==_?(P=e=>{p||(_.trim()!==``&&j(_),le(e),C(!1),b(null),ue(e))},t[14]=j,t[15]=p,t[16]=_,t[17]=P):P=t[17];let F=P,I;t[18]!==y||t[19]!==n?(I=y===null?-1:n.indexOf(y),t[18]=y,t[19]=n,t[20]=I):I=t[20];let L=I,R;t[21]===n?R=t[22]:(R=e=>{b(e===null?null:n[e]??null)},t[21]=n,t[22]=R);let z=R,B,V;t[23]===v?(B=t[24],V=t[25]):(B=()=>{v!==null&&(de.current?.focus(),de.current?.select())},V=[v],t[23]=v,t[24]=B,t[25]=V),(0,c.useEffect)(B,V);let H=S?`true`:se,he=p&&`pointer-events-none opacity-60`,U;t[26]===he?U=t[27]:(U=a(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,he),t[26]=he,t[27]=U);let W;if(t[28]!==g||t[29]!==F||t[30]!==p||t[31]!==v||t[32]!==m||t[33]!==y||t[34]!==T||t[35]!==N||t[36]!==D||t[37]!==n){let e;t[39]!==g||t[40]!==F||t[41]!==p||t[42]!==v||t[43]!==m||t[44]!==y||t[45]!==T||t[46]!==N||t[47]!==D?(e=(e,t)=>{if(e===v)return null;let n=D&&!ne(e),r=m?.get(e),i=n||r!==void 0,s=r??(n?`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`:void 0),c=e===y,u=(0,l.jsxs)(ie,{id:`${T}-${t}`,variant:i?`destructive`:`secondary`,"data-tag-invalid":n?`true`:void 0,"data-tag-problem":r===void 0?void 0:`true`,"data-highlighted":c?`true`:void 0,className:a(`gap-1 pl-2 pr-1 normal-case`,i&&`ring-1 ring-destructive/40`,c&&`ring-2 ring-ring/70`),children:[(0,l.jsx)(`button`,{type:`button`,tabIndex:-1,className:`cursor-pointer rounded-sm font-mono`,onDoubleClick:()=>F(e),disabled:p,"aria-label":g({id:`NkNfSr`,values:{tag:e}}),title:s===void 0?g({id:`vHlhDc`}):void 0,children:e}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>N(t),"aria-label":g({id:`D4H2N6`,values:{tag:e}}),className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:p,children:(0,l.jsx)(re,{className:`size-3`,"aria-hidden":`true`})})]},e);return s===void 0?u:(0,l.jsxs)(te,{children:[(0,l.jsx)(o,{asChild:!0,children:u}),(0,l.jsx)(ee,{children:s})]},e)},t[39]=g,t[40]=F,t[41]=p,t[42]=v,t[43]=m,t[44]=y,t[45]=T,t[46]=N,t[47]=D,t[48]=e):e=t[48],W=n.map(e),t[28]=g,t[29]=F,t[30]=p,t[31]=v,t[32]=m,t[33]=y,t[34]=T,t[35]=N,t[36]=D,t[37]=n,t[38]=W}else W=t[38];let G;t[49]!==S||t[50]!==y?(G=e=>{le(e.target.value),S&&C(!1),y!==null&&b(null)},t[49]=S,t[50]=y,t[51]=G):G=t[51];let K;t[52]!==j||t[53]!==F||t[54]!==_||t[55]!==S||t[56]!==v||t[57]!==z||t[58]!==L||t[59]!==N||t[60]!==n?(K=e=>{let t=e.currentTarget,r=t.selectionStart===0&&t.selectionEnd===0;if(v===null&&n.length>0){if(e.key===`ArrowLeft`&&(L!==-1||r)){e.preventDefault(),z(L===-1?n.length-1:Math.max(0,L-1));return}if(e.key===`ArrowRight`&&L!==-1){e.preventDefault(),z(L===n.length-1?null:L+1);return}if((e.key===`Home`||e.key===`End`)&&L!==-1){e.preventDefault(),z(e.key===`Home`?0:n.length-1);return}}if(L!==-1&&v===null){if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=n[L];t!==void 0&&F(t);return}if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let t=n[L-1]??null,r=n[L+1]??null;N(L),b(e.key===`Backspace`?t??r:r??t);return}}e.key===`Enter`?(_.trim()||v!==null)&&(e.preventDefault(),j(_)):e.key===`,`?(e.preventDefault(),_.trim()&&j(_)):e.key===`Tab`?_.trim()&&(e.preventDefault(),j(_)):e.key===`Backspace`&&_===``&&n.length>0&&v===null?(e.preventDefault(),N(n.length-1)):e.key===`Escape`&&(v!==null||S?(e.preventDefault(),k(),b(null)):L!==-1&&(e.preventDefault(),b(null)))},t[52]=j,t[53]=F,t[54]=_,t[55]=S,t[56]=v,t[57]=z,t[58]=L,t[59]=N,t[60]=n,t[61]=K):K=t[61];let q;t[62]!==j||t[63]!==_||t[64]!==v||t[65]!==u?(q=()=>{(_.trim()||v!==null)&&!j(_)&&v!==null&&k(),b(null),u?.()},t[62]=j,t[63]=_,t[64]=v,t[65]=u,t[66]=q):q=t[66];let ge=n.length===0?me:``,_e=S?`true`:void 0,J;t[67]!==oe||t[68]!==S||t[69]!==w?(J=[S?w:void 0,oe].filter(Boolean).join(` `)||void 0,t[67]=oe,t[68]=S,t[69]=w,t[70]=J):J=t[70];let ve=S?`true`:se,ye=L===-1?void 0:`${T}-${L}`,Y=S&&`text-destructive placeholder:text-destructive/60`,X;t[71]===Y?X=t[72]:(X=a(`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`,Y),t[71]=Y,t[72]=X);let Z;t[73]!==fe||t[74]!==p||t[75]!==_||t[76]!==f||t[77]!==G||t[78]!==K||t[79]!==q||t[80]!==ge||t[81]!==_e||t[82]!==J||t[83]!==ve||t[84]!==ye||t[85]!==X?(Z=(0,l.jsx)(`input`,{id:f,ref:fe,type:`text`,value:_,onChange:G,onKeyDown:K,onBlur:q,placeholder:ge,"data-tag-invalid":_e,"aria-describedby":J,"aria-invalid":ve,"aria-activedescendant":ye,disabled:p,className:X}),t[73]=fe,t[74]=p,t[75]=_,t[76]=f,t[77]=G,t[78]=K,t[79]=q,t[80]=ge,t[81]=_e,t[82]=J,t[83]=ve,t[84]=ye,t[85]=X,t[86]=Z):Z=t[86];let Q;t[87]!==S||t[88]!==w?(Q=S&&(0,l.jsx)(`span`,{id:w,role:`alert`,"data-testid":`tag-pill-input-error`,className:`w-full px-1 pt-0.5 text-xs text-destructive`,children:`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`}),t[87]=S,t[88]=w,t[89]=Q):Q=t[89];let $;return t[90]!==H||t[91]!==U||t[92]!==W||t[93]!==Z||t[94]!==Q?($=(0,l.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":H,className:U,children:[W,Z,Q]}),t[90]=H,t[91]=U,t[92]=W,t[93]=Z,t[94]=Q,t[95]=$):$=t[95],$}export{u as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./utils-CPqDy6Hr.js";import{i as o,n as ee,t as te}from"./tooltip-DHXgxWLL.js";import{ei as ne}from"./dist-7P3QNiAv.js";import{t as re}from"./x-DddVxTPq.js";import{t as ie}from"./badge-BG5JKjNK.js";var s=i(),c=e(n(),1),l=t();function u(e){let t=(0,s.c)(96),{value:n,onChange:i,onBlur:u,placeholder:d,id:f,disabled:p,grammar:ae,entryProblems:m,"aria-describedby":oe,"aria-invalid":se,ref:h}=e,ce=ae===void 0?`frontmatter-tag`:ae,{_:g}=r(),[_,le]=(0,c.useState)(``),[v,ue]=(0,c.useState)(null),[y,b]=(0,c.useState)(null),de=(0,c.useRef)(null),x;t[0]===h?x=t[1]:(x=e=>{de.current=e,typeof h==`function`?h(e):h&&(h.current=e)},t[0]=h,t[1]=x);let fe=x,[S,C]=(0,c.useState)(!1),pe=(0,c.useId)(),w=`${f??pe}-grammar-hint`,T=`${f??pe}-pill`,E;t[2]!==g||t[3]!==d?(E=d??g({id:`M5mfAe`}),t[2]=g,t[3]=d,t[4]=E):E=t[4];let me=E,D=ce===`frontmatter-tag`,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{le(``),C(!1),ue(null)},t[5]=O):O=t[5];let k=O,A;t[6]!==v||t[7]!==i||t[8]!==D||t[9]!==n?(A=e=>{let t=e.trim(),r=v===null?-1:n.indexOf(v);if(!t)return r!==-1&&i(n.filter((e,t)=>t!==r)),v!==null&&k(),!0;if(D&&!ne(t))return C(!0),!1;let a=D&&t.startsWith(`#`)?t.slice(1):t,o=n.indexOf(a);if(r===-1)return o===-1&&i([...n,a]),k(),!0;let ee=n.map((e,t)=>t===r?a:e);return i(o===-1||o===r?ee:ee.filter((e,t)=>t!==r)),k(),!0},t[6]=v,t[7]=i,t[8]=D,t[9]=n,t[10]=A):A=t[10];let j=A,M;t[11]!==i||t[12]!==n?(M=e=>{i(n.filter((t,n)=>n!==e))},t[11]=i,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==j||t[15]!==p||t[16]!==_?(P=e=>{p||(_.trim()!==``&&j(_),le(e),C(!1),b(null),ue(e))},t[14]=j,t[15]=p,t[16]=_,t[17]=P):P=t[17];let F=P,I;t[18]!==y||t[19]!==n?(I=y===null?-1:n.indexOf(y),t[18]=y,t[19]=n,t[20]=I):I=t[20];let L=I,R;t[21]===n?R=t[22]:(R=e=>{b(e===null?null:n[e]??null)},t[21]=n,t[22]=R);let z=R,B,V;t[23]===v?(B=t[24],V=t[25]):(B=()=>{v!==null&&(de.current?.focus(),de.current?.select())},V=[v],t[23]=v,t[24]=B,t[25]=V),(0,c.useEffect)(B,V);let H=S?`true`:se,he=p&&`pointer-events-none opacity-60`,U;t[26]===he?U=t[27]:(U=a(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,he),t[26]=he,t[27]=U);let W;if(t[28]!==g||t[29]!==F||t[30]!==p||t[31]!==v||t[32]!==m||t[33]!==y||t[34]!==T||t[35]!==N||t[36]!==D||t[37]!==n){let e;t[39]!==g||t[40]!==F||t[41]!==p||t[42]!==v||t[43]!==m||t[44]!==y||t[45]!==T||t[46]!==N||t[47]!==D?(e=(e,t)=>{if(e===v)return null;let n=D&&!ne(e),r=m?.get(e),i=n||r!==void 0,s=r??(n?`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`:void 0),c=e===y,u=(0,l.jsxs)(ie,{id:`${T}-${t}`,variant:i?`destructive`:`secondary`,"data-tag-invalid":n?`true`:void 0,"data-tag-problem":r===void 0?void 0:`true`,"data-highlighted":c?`true`:void 0,className:a(`gap-1 pl-2 pr-1 normal-case`,i&&`ring-1 ring-destructive/40`,c&&`ring-2 ring-ring/70`),children:[(0,l.jsx)(`button`,{type:`button`,tabIndex:-1,className:`cursor-pointer rounded-sm font-mono`,onDoubleClick:()=>F(e),disabled:p,"aria-label":g({id:`NkNfSr`,values:{tag:e}}),title:s===void 0?g({id:`vHlhDc`}):void 0,children:e}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>N(t),"aria-label":g({id:`D4H2N6`,values:{tag:e}}),className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:p,children:(0,l.jsx)(re,{className:`size-3`,"aria-hidden":`true`})})]},e);return s===void 0?u:(0,l.jsxs)(te,{children:[(0,l.jsx)(o,{asChild:!0,children:u}),(0,l.jsx)(ee,{children:s})]},e)},t[39]=g,t[40]=F,t[41]=p,t[42]=v,t[43]=m,t[44]=y,t[45]=T,t[46]=N,t[47]=D,t[48]=e):e=t[48],W=n.map(e),t[28]=g,t[29]=F,t[30]=p,t[31]=v,t[32]=m,t[33]=y,t[34]=T,t[35]=N,t[36]=D,t[37]=n,t[38]=W}else W=t[38];let G;t[49]!==S||t[50]!==y?(G=e=>{le(e.target.value),S&&C(!1),y!==null&&b(null)},t[49]=S,t[50]=y,t[51]=G):G=t[51];let K;t[52]!==j||t[53]!==F||t[54]!==_||t[55]!==S||t[56]!==v||t[57]!==z||t[58]!==L||t[59]!==N||t[60]!==n?(K=e=>{let t=e.currentTarget,r=t.selectionStart===0&&t.selectionEnd===0;if(v===null&&n.length>0){if(e.key===`ArrowLeft`&&(L!==-1||r)){e.preventDefault(),z(L===-1?n.length-1:Math.max(0,L-1));return}if(e.key===`ArrowRight`&&L!==-1){e.preventDefault(),z(L===n.length-1?null:L+1);return}if((e.key===`Home`||e.key===`End`)&&L!==-1){e.preventDefault(),z(e.key===`Home`?0:n.length-1);return}}if(L!==-1&&v===null){if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=n[L];t!==void 0&&F(t);return}if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let t=n[L-1]??null,r=n[L+1]??null;N(L),b(e.key===`Backspace`?t??r:r??t);return}}e.key===`Enter`?(_.trim()||v!==null)&&(e.preventDefault(),j(_)):e.key===`,`?(e.preventDefault(),_.trim()&&j(_)):e.key===`Tab`?_.trim()&&(e.preventDefault(),j(_)):e.key===`Backspace`&&_===``&&n.length>0&&v===null?(e.preventDefault(),N(n.length-1)):e.key===`Escape`&&(v!==null||S?(e.preventDefault(),k(),b(null)):L!==-1&&(e.preventDefault(),b(null)))},t[52]=j,t[53]=F,t[54]=_,t[55]=S,t[56]=v,t[57]=z,t[58]=L,t[59]=N,t[60]=n,t[61]=K):K=t[61];let q;t[62]!==j||t[63]!==_||t[64]!==v||t[65]!==u?(q=()=>{(_.trim()||v!==null)&&!j(_)&&v!==null&&k(),b(null),u?.()},t[62]=j,t[63]=_,t[64]=v,t[65]=u,t[66]=q):q=t[66];let ge=n.length===0?me:``,_e=S?`true`:void 0,J;t[67]!==oe||t[68]!==S||t[69]!==w?(J=[S?w:void 0,oe].filter(Boolean).join(` `)||void 0,t[67]=oe,t[68]=S,t[69]=w,t[70]=J):J=t[70];let ve=S?`true`:se,ye=L===-1?void 0:`${T}-${L}`,Y=S&&`text-destructive placeholder:text-destructive/60`,X;t[71]===Y?X=t[72]:(X=a(`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`,Y),t[71]=Y,t[72]=X);let Z;t[73]!==fe||t[74]!==p||t[75]!==_||t[76]!==f||t[77]!==G||t[78]!==K||t[79]!==q||t[80]!==ge||t[81]!==_e||t[82]!==J||t[83]!==ve||t[84]!==ye||t[85]!==X?(Z=(0,l.jsx)(`input`,{id:f,ref:fe,type:`text`,value:_,onChange:G,onKeyDown:K,onBlur:q,placeholder:ge,"data-tag-invalid":_e,"aria-describedby":J,"aria-invalid":ve,"aria-activedescendant":ye,disabled:p,className:X}),t[73]=fe,t[74]=p,t[75]=_,t[76]=f,t[77]=G,t[78]=K,t[79]=q,t[80]=ge,t[81]=_e,t[82]=J,t[83]=ve,t[84]=ye,t[85]=X,t[86]=Z):Z=t[86];let Q;t[87]!==S||t[88]!==w?(Q=S&&(0,l.jsx)(`span`,{id:w,role:`alert`,"data-testid":`tag-pill-input-error`,className:`w-full px-1 pt-0.5 text-xs text-destructive`,children:`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`}),t[87]=S,t[88]=w,t[89]=Q):Q=t[89];let $;return t[90]!==H||t[91]!==U||t[92]!==W||t[93]!==Z||t[94]!==Q?($=(0,l.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":H,className:U,children:[W,Z,Q]}),t[90]=H,t[91]=U,t[92]=W,t[93]=Z,t[94]=Q,t[95]=$):$=t[95],$}export{u as t};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-Bhw2PmPp.js";import{m as t}from"./doc-paths-BkpejoFL.js";import{s as n}from"./navigation-targets-D6rHX3Pq.js";var r=e(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]);function i(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`skill-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function a(e,r){let a=n(e,r);return{resolvedTarget:a,hashDocName:a.target,hash:a.kind===`skill-file`?t({scope:a.scope,name:a.name,path:a.path,...a.host?{host:a.host}:{}}):null,displayState:i(a)}}export{r as n,a as t};
1
+ import{t as e}from"./createLucideIcon-Bhw2PmPp.js";import{m as t}from"./doc-paths-DPQCXAM6.js";import{s as n}from"./navigation-targets-BI4fIUSN.js";var r=e(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]);function i(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`skill-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function a(e,r){let a=n(e,r);return{resolvedTarget:a,hashDocName:a.target,hash:a.kind===`skill-file`?t({scope:a.scope,name:a.name,path:a.path,...a.host?{host:a.host}:{}}):null,displayState:i(a)}}export{r as n,a as t};