@inkeep/open-knowledge 0.79.2 → 0.79.3-beta.0

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 (148) hide show
  1. package/dist/cli.mjs +70 -68
  2. package/dist/constants-wVFbQ-W8.mjs +1 -0
  3. package/dist/{dist-Cmgb0r3p.mjs → dist-Bt-cb2ik.mjs} +472 -472
  4. package/dist/dist-CZBCHPnO.mjs +1 -0
  5. package/dist/index.mjs +188 -188
  6. package/dist/init-CqGfdMuB.mjs +1 -0
  7. package/dist/{init-CjbAcLHr.mjs → init-H4L4PCDm.mjs} +14 -14
  8. package/dist/{launch-json-removal-1V6_UV5_.mjs → launch-json-removal-DAf1fKWA.mjs} +1 -1
  9. package/dist/loader-BK3wGq2e.mjs +1 -0
  10. package/dist/{loader-Cmpu_239.mjs → loader-gbJWrT9X.mjs} +1 -1
  11. package/dist/native/native-config.win32-arm64-msvc.node +0 -0
  12. package/dist/native/native-config.win32-x64-msvc.node +0 -0
  13. package/dist/{open-browser-CNVUL-A_.mjs → open-browser-Co1psphf.mjs} +1 -1
  14. package/dist/{preview-CUsQsBjV.mjs → preview-CMgnC4UA.mjs} +1 -1
  15. package/dist/preview-DPQ4BPLK.mjs +1 -0
  16. package/dist/public/assets/{ActivityModeContent-CwiUBgGI.js → ActivityModeContent--2lvtA3c.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-B5wgFBcs.js → AddPropertiesButton-C-iLRZ1e.js} +2 -2
  18. package/dist/public/assets/{AgentDiffPane-DCr3QWvF.js → AgentDiffPane-D6x5wd4h.js} +1 -1
  19. package/dist/public/assets/{BugReportHistory-BQMbH-qH.js → BugReportHistory-DSKcw3JQ.js} +1 -1
  20. package/dist/public/assets/{BugReportHistoryDialog-BRdfOcWv.js → BugReportHistoryDialog-N-Ap1hJt.js} +1 -1
  21. package/dist/public/assets/{CodeMirrorPropInput-CjC1gT00.js → CodeMirrorPropInput-C6PE1vK2.js} +1 -1
  22. package/dist/public/assets/{ConsentDialogBody-DWjU5hm4.js → ConsentDialogBody-NBiDlYMd.js} +1 -1
  23. package/dist/public/assets/{DeleteConfirmationDialog-CJJ8Xo5u.js → DeleteConfirmationDialog-DYyGQK4Z.js} +1 -1
  24. package/dist/public/assets/{DiffViewBoundary-BGdnGPRv.js → DiffViewBoundary-_HbzD0gR.js} +1 -1
  25. package/dist/public/assets/{DocumentContext-Dlldf3A6.js → DocumentContext-DjP4XRJx.js} +1 -1
  26. package/dist/public/assets/{EditorModeToggle-CUFvhR2v.js → EditorModeToggle-BOmmVDPD.js} +1 -1
  27. package/dist/public/assets/{EnableSyncConfirmDialog-DfwumFEb.js → EnableSyncConfirmDialog-C6j7G_kd.js} +1 -1
  28. package/dist/public/assets/{ExcalidrawDocEditor-CylNX2Db.js → ExcalidrawDocEditor-CAYMSmAF.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-t3IG2SJR.js +1 -0
  30. package/dist/public/assets/{GraphPanel-BQaGu4a5.js → GraphPanel-BMOYeFVW.js} +1 -1
  31. package/dist/public/assets/{ImageAttachments-mkcDupGd.js → ImageAttachments-CIgN2ICo.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-DSya0fK3.js → ImportSkillDialog-BXsrd5h-.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-BsTgh8nL.js → LintConfigEditor-D5DY2Ucg.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-BnJzcs6f.js +1 -0
  35. package/dist/public/assets/ManagedArtifactProperties-sumfs_C-.js +1 -0
  36. package/dist/public/assets/{McpConsentDialogBody-BGioo7-j.js → McpConsentDialogBody-Dj5qWFur.js} +1 -1
  37. package/dist/public/assets/{Mermaid-DP2in8wt.js → Mermaid-BG4D_HOk.js} +1 -1
  38. package/dist/public/assets/{MermaidDocEditor-634q13Qg.js → MermaidDocEditor-CWmiEhhJ.js} +1 -1
  39. package/dist/public/assets/{PropertyDisplayRow-B_AEbfI7.js → PropertyDisplayRow-CrxEj3M3.js} +2 -2
  40. package/dist/public/assets/{ReportBugDialogBody-ABNMdMUU.js → ReportBugDialogBody-C-53A-0F.js} +1 -1
  41. package/dist/public/assets/{ReportBugMenuTrigger-DRki3qOn.js → ReportBugMenuTrigger-29birQ-y.js} +1 -1
  42. package/dist/public/assets/{RowDisclosure-B78fx5s2.js → RowDisclosure-roWTy1cj.js} +1 -1
  43. package/dist/public/assets/{SchemaConfigEditor-D6Ve-pbq.js → SchemaConfigEditor-DbbukpG5.js} +1 -1
  44. package/dist/public/assets/{SessionsHost-BqU3aWOR.js → SessionsHost-CKvXoA48.js} +2 -2
  45. package/dist/public/assets/{SettingsDialogBody-UKT3bDul.js → SettingsDialogBody-PbyK1LoL.js} +1 -1
  46. package/dist/public/assets/{ShareBranchSwitchDialog-DE7uyxww.js → ShareBranchSwitchDialog-KJzH1_kA.js} +1 -1
  47. package/dist/public/assets/{ShareReceiveDialog-D8d3_-15.js → ShareReceiveDialog-CLkMfCLe.js} +1 -1
  48. package/dist/public/assets/{ShareReceiveMissDialog-Bx29cMNb.js → ShareReceiveMissDialog-CLVrxv3V.js} +1 -1
  49. package/dist/public/assets/{SkillForkDialog-ho4FUABV.js → SkillForkDialog-Cg2OBoX4.js} +1 -1
  50. package/dist/public/assets/{SkillInstallMenu-DpmMcdPv.js → SkillInstallMenu-DBCnHXH-.js} +1 -1
  51. package/dist/public/assets/{SkillOriginInline-DmEjQplu.js → SkillOriginInline-kzOBcIFc.js} +2 -2
  52. package/dist/public/assets/{SkillToolbarControls-miZURo1o.js → SkillToolbarControls-DltyfwOH.js} +1 -1
  53. package/dist/public/assets/{SkillUpdateConflictDialog-BTP9zIit.js → SkillUpdateConflictDialog-kz67-4EX.js} +1 -1
  54. package/dist/public/assets/{SlidesToolbarControls-CUfeiKej.js → SlidesToolbarControls-CAxEUrS2.js} +1 -1
  55. package/dist/public/assets/{SourceEditor-DCGr3Oun.js → SourceEditor-DLEw1wic.js} +1 -1
  56. package/dist/public/assets/{TerminalPanel-DDye0ppp.js → TerminalPanel-Cb8KkKGX.js} +1 -1
  57. package/dist/public/assets/{TerminalStartingNotice-CANxPK71.js → TerminalStartingNotice-BbwsOE78.js} +1 -1
  58. package/dist/public/assets/{TerminalWindowApp-QDFQJvJI.js → TerminalWindowApp-BXIexfq8.js} +1 -1
  59. package/dist/public/assets/{TextDocEditor-Dy2g4z9H.js → TextDocEditor-DeqaHCag.js} +1 -1
  60. package/dist/public/assets/{ThreadView-e6Emlmew.js → ThreadView-D1YayNv3.js} +1 -1
  61. package/dist/public/assets/{TimelineDiffPane-9-8JYbua.js → TimelineDiffPane-BCk40u8c.js} +1 -1
  62. package/dist/public/assets/{agent-connection-status-BTfitB3U.js → agent-connection-status-BKDHFOP-.js} +1 -1
  63. package/dist/public/assets/{alert-Cp5DpEia.js → alert-Bqwsa0Kr.js} +1 -1
  64. package/dist/public/assets/{alert-dialog-BJIyfEVh.js → alert-dialog-CqqfqWNT.js} +1 -1
  65. package/dist/public/assets/{auth-state-cache-CIg70qGh.js → auth-state-cache-COORa9sc.js} +1 -1
  66. package/dist/public/assets/{badge-MuddhvBr.js → badge-lmgHBfMn.js} +1 -1
  67. package/dist/public/assets/button-BeFNZANd.js +1 -0
  68. package/dist/public/assets/{calendar-DLVK4LG7.js → calendar-BR8UVbAy.js} +1 -1
  69. package/dist/public/assets/{client-version-DA4kJKPj.js → client-version-yBzdRoMs.js} +1 -1
  70. package/dist/public/assets/{comment-chips-Cnc9lZ6c.js → comment-chips-BGRnR7X7.js} +1 -1
  71. package/dist/public/assets/{config-provider-owr5M3NH.js → config-provider-CTHdqAYx.js} +1 -1
  72. package/dist/public/assets/{dialog-Q2r_wm4I.js → dialog-BfHNtxM9.js} +1 -1
  73. package/dist/public/assets/{doc-undo-manager-CaLoly49.js → doc-undo-manager-DxMjEKx4.js} +1 -1
  74. package/dist/public/assets/{field-Cy222HIR.js → field-BLH6hVAa.js} +1 -1
  75. package/dist/public/assets/globals-Dg-24adS.css +1 -0
  76. package/dist/public/assets/index-CWenCiFy.js +2205 -0
  77. package/dist/public/assets/{input-group-D4IQIBdt.js → input-group-Brp49uT-.js} +1 -1
  78. package/dist/public/assets/{markdownlint-rule-browser-DYxq-YWd.js → markdownlint-rule-browser-D5yxtwtH.js} +1 -1
  79. package/dist/public/assets/messages-5nYhcGbk.js +1 -0
  80. package/dist/public/assets/messages-8wkpGWDl.js +1 -0
  81. package/dist/public/assets/messages-BE3F6wPf.js +1 -0
  82. package/dist/public/assets/messages-BYW3-b5z.js +1 -0
  83. package/dist/public/assets/messages-CE30qzpn.js +1 -0
  84. package/dist/public/assets/messages-CKBxrXnZ.js +1 -0
  85. package/dist/public/assets/messages-C_LttG3X.js +1 -0
  86. package/dist/public/assets/messages-Cd3H31Oo.js +1 -0
  87. package/dist/public/assets/messages-D-bBxZfD.js +1 -0
  88. package/dist/public/assets/messages-DLuudO75.js +1 -0
  89. package/dist/public/assets/messages-DoYSqXZ-.js +1 -0
  90. package/dist/public/assets/messages-nwFoZCFs.js +1 -0
  91. package/dist/public/assets/{pending-receive-nav-store-ru8vEtq1.js → pending-receive-nav-store-CQL0bv5o.js} +1 -1
  92. package/dist/public/assets/{preferred-session-events-Dhjm0Z1H.js → preferred-session-events-BEpzXSN8.js} +1 -1
  93. package/dist/public/assets/{progress-ChqYJ_wo.js → progress-C8ijsHox.js} +1 -1
  94. package/dist/public/assets/{project-paths-CDhA3hJy.js → project-paths-B-FMrj5U.js} +1 -1
  95. package/dist/public/assets/{selection-context-4lSNiVN-.js → selection-context-LrE0_TTe.js} +1 -1
  96. package/dist/public/assets/{src-C5n8TKJq.js → src-BxNPgEkh.js} +1 -1
  97. package/dist/public/assets/{tabs-BnFGmv6I.js → tabs-C7_T-n4e.js} +1 -1
  98. package/dist/public/assets/{tag-pill-input-BQX-_Adc.js → tag-pill-input-B28iAFxa.js} +1 -1
  99. package/dist/public/assets/{telemetry-impl-BjW04TM-.js → telemetry-impl-CDsHOhvm.js} +1 -1
  100. package/dist/public/assets/{telemetry-startup-BS9CaXrj.js → telemetry-startup-D-KW_NaP.js} +1 -1
  101. package/dist/public/assets/{terminal-launch-events-Dmdb2rMF.js → terminal-launch-events-E89-i5D1.js} +1 -1
  102. package/dist/public/assets/{toggle-group-ZKcYQ5bn.js → toggle-group-BxIyZnUJ.js} +1 -1
  103. package/dist/public/assets/{typing-burst-detector-BEdXQddD.js → typing-burst-detector-BI7H8DPb.js} +2 -2
  104. package/dist/public/assets/{uninstall-DXJMPkVq.js → uninstall-C5hq5xn8.js} +1 -1
  105. package/dist/public/assets/{use-activity-panel-CngLVlKx.js → use-activity-panel-D1MJ-kqr.js} +1 -1
  106. package/dist/public/assets/{use-apply-config-language-DgBG2Y3l.js → use-apply-config-language-DBt73Gpy.js} +2 -2
  107. package/dist/public/assets/{use-installed-clis-SziirqY4.js → use-installed-clis-F-bc0S3Y.js} +2 -2
  108. package/dist/public/assets/{use-open-skill-B-WzAe13.js → use-open-skill-BBxnHzMv.js} +1 -1
  109. package/dist/public/assets/{use-terminal-enabled-Dd55GJPP.js → use-terminal-enabled-BePo4VDS.js} +1 -1
  110. package/dist/public/assets/{use-timeline-entry-diff-D9Fyk7np.js → use-timeline-entry-diff-Cpz7ybaB.js} +1 -1
  111. package/dist/public/index.html +39 -39
  112. package/dist/public/uninstall.html +7 -7
  113. package/dist/registry-probes-DCe3rWZ7.mjs +17 -0
  114. package/dist/{removal-file-path-4H4PUJxJ.mjs → removal-file-path-DiyOqKix.mjs} +1 -1
  115. package/dist/{repair-launch-json-DAIGiTv8.mjs → repair-launch-json-CK7gSieg.mjs} +1 -1
  116. package/dist/{repair-mcp-configs-CO4UASHL.mjs → repair-mcp-configs-B2IwckuL.mjs} +1 -1
  117. package/dist/{src-CcEkY68s.mjs → src-7sNhM-_B.mjs} +5 -5
  118. package/dist/src-DZ44CKon.mjs +1 -0
  119. package/dist/{start-BuIYuZ-E.mjs → start-DYrDwaUD.mjs} +3 -3
  120. package/dist/start-DaOK3zKh.mjs +1 -0
  121. package/package.json +4 -4
  122. package/dist/constants-jpNm5-5s.mjs +0 -1
  123. package/dist/dist-DzdGKL8W.mjs +0 -1
  124. package/dist/init-BGM70oJ3.mjs +0 -1
  125. package/dist/loader-BVs3fR6_.mjs +0 -1
  126. package/dist/preview-DejneDxR.mjs +0 -1
  127. package/dist/public/assets/FeedbackForm-B2kRhtsR.js +0 -1
  128. package/dist/public/assets/ManagedArtifactProperties-CVIYFnTZ.js +0 -1
  129. package/dist/public/assets/ManagedArtifactProperties-DCWlX1Qg.js +0 -1
  130. package/dist/public/assets/button-HKX9wT1K.js +0 -1
  131. package/dist/public/assets/globals-uZ5VipkR.css +0 -1
  132. package/dist/public/assets/index-B4DpftwC.js +0 -2205
  133. package/dist/public/assets/messages-8is2no75.js +0 -1
  134. package/dist/public/assets/messages-BAuq9QNn.js +0 -1
  135. package/dist/public/assets/messages-BMB7_c7y.js +0 -1
  136. package/dist/public/assets/messages-C2mWhO6K.js +0 -1
  137. package/dist/public/assets/messages-CRnQAmA5.js +0 -1
  138. package/dist/public/assets/messages-CpKrli-X.js +0 -1
  139. package/dist/public/assets/messages-CuQCs__I.js +0 -1
  140. package/dist/public/assets/messages-DUAWetuM.js +0 -1
  141. package/dist/public/assets/messages-EThDD2lc.js +0 -1
  142. package/dist/public/assets/messages-JIbrz5bw.js +0 -1
  143. package/dist/public/assets/messages-eVBmDYMt.js +0 -1
  144. package/dist/public/assets/messages-tmp_OA3I.js +0 -1
  145. package/dist/registry-probes-ftrzXHET.mjs +0 -17
  146. package/dist/src--m06lQMP.mjs +0 -1
  147. package/dist/start-DqUv0wIj.mjs +0 -1
  148. /package/dist/public/assets/{globals-DS9_Iy6h.js → globals-BXFJsup3.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-HKX9wT1K.js";import{Bn as s,Ln as c}from"./dist-bQ5kvrpa.js";import{n as l}from"./dist-CJhtNlOm2.js";import{t as u}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ee}from"./spinner-D7ppCG-D.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-Q2r_wm4I.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-CU33mRR1.js";import{t as ie}from"./share-metadata-rows-BOIXw_N5.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function E(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=s(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=c(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M as ShareReceiveDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-BeFNZANd.js";import{Bn as s,Ln as c}from"./dist-bQ5kvrpa.js";import{n as l}from"./dist-CJhtNlOm2.js";import{t as u}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ee}from"./spinner-D7ppCG-D.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-BfHNtxM9.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-CU33mRR1.js";import{t as ie}from"./share-metadata-rows-BOIXw_N5.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function E(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=s(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=c(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M as ShareReceiveDialog};
@@ -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{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-ru8vEtq1.js";import{t as l}from"./miss-dialog-store-CWiUu3y7.js";import{f as u,p as d}from"./doc-paths-BKrv1Wyo.js";import{c as f,i as p,n as m,s as h,t as g}from"./dialog-Q2r_wm4I.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=d(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?d(e):u(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(h,{children:(0,y.jsx)(f,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(m,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(g,{open:!0,onOpenChange:D,children:(0,y.jsxs)(p,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
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{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-CQL0bv5o.js";import{t as l}from"./miss-dialog-store-CWiUu3y7.js";import{f as u,p as d}from"./doc-paths-BKrv1Wyo.js";import{c as f,i as p,n as m,s as h,t as g}from"./dialog-BfHNtxM9.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=d(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?d(e):u(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(h,{children:(0,y.jsx)(f,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(m,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(g,{open:!0,onOpenChange:D,children:(0,y.jsxs)(p,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-HKX9wT1K.js";import{t as ee}from"./label-D-K3fWtj.js";import{Lt as te}from"./dist-bQ5kvrpa.js";import{n as s}from"./dist-CJhtNlOm2.js";import{l as c}from"./skill-scope-B73Ci61z.js";import{a as l,c as u,i as d,n as f,o as p,s as m,t as h}from"./dialog-Q2r_wm4I.js";import{E as ne,u as re}from"./skills-api-BazLRy2N.js";import{t as ie}from"./input-B87iFAAQ.js";import{t as ae}from"./MultiFileDiff-DBMOvxJx.js";import{t as oe}from"./pierre-theme-DSY2leqq.js";var se=a(),g=e(n(),1),_=t();function v(e){let t=(0,se.c)(60),{target:n,onOpenChange:a}=e,{_:v}=i(),y=(0,g.useId)(),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),[A,j]=(0,g.useState)(!1),M;t[0]===n?M=t[1]:(M=()=>{if(x(null),C(null),T(!1),D(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){T(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${c(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,C],[a,x]])re({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):T(!0))}).catch(()=>{o.signal.aborted||T(!0)});return()=>o.abort()},t[0]=n,t[1]=M);let N=n?.skill.scope,P=n?.skill.name,F=n?.editor,I;if(t[2]!==N||t[3]!==P||t[4]!==F?(I=[N,P,F],t[2]=N,t[3]=P,t[4]=F,t[5]=I):I=t[5],(0,g.useEffect)(M,I),!n)return null;let{skill:L,editor:R}=n,z;t[6]!==v||t[7]!==R||t[8]!==a||t[9]!==L.name||t[10]!==L.scope||t[11]!==n||t[12]!==O?(z=async function(e){if(!n)return;j(!0);let t=await ne({scope:L.scope,name:L.name,editor:R,action:e,...e===`rename`?{toName:O.trim()}:{}});if(j(!1),!t.ok){s.error(v({id:`MIF36T`,values:{0:t.error}}));return}s.success(v(e===`align`?{id:`QKgePK`,values:{editor:R}}:e===`make-source`?{id:`It9oAP`,values:{editor:R}}:{id:`b2ezG_`,values:{0:O.trim()}})),a(!1)},t[6]=v,t[7]=R,t[8]=a,t[9]=L.name,t[10]=L.scope,t[11]=n,t[12]=O,t[13]=z):z=t[13];let B=z,V,H;t[14]!==L.name||t[15]!==O?(H=O.trim(),V=H===``||!te.test(H)||H===L.name,t[14]=L.name,t[15]=O,t[16]=V,t[17]=H):(V=t[16],H=t[17]);let U=V,W;t[18]!==A||t[19]!==a?(W=e=>{!e&&!A&&a(!1)},t[18]=A,t[19]=a,t[20]=W):W=t[20];let G;t[21]!==R||t[22]!==L.name?(G=(0,_.jsx)(u,{children:(0,_.jsx)(r,{id:`q8aCbb`,values:{0:L.name,editor:R}})}),t[21]=R,t[22]=L.name,t[23]=G):G=t[23];let K;t[24]===R?K=t[25]:(K=(0,_.jsx)(l,{children:(0,_.jsx)(r,{id:`QASTNu`,values:{editor:R}})}),t[24]=R,t[25]=K);let q;t[26]!==K||t[27]!==G?(q=(0,_.jsxs)(m,{children:[G,K]}),t[26]=K,t[27]=G,t[28]=q):q=t[28];let J;t[29]!==S||t[30]!==b||t[31]!==w||t[32]!==L.name?(J=S!==null&&b!==null?(0,_.jsx)(ae,{className:`pierre-diff`,oldFile:{name:L.name,contents:S},newFile:{name:L.name,contents:b},options:{overflow:`wrap`,diffStyle:`unified`,theme:oe()}}):w?(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`5BlXTD`})}):(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`1V17kO`})}),t[29]=S,t[30]=b,t[31]=w,t[32]=L.name,t[33]=J):J=t[33];let Y;t[34]!==B||t[35]!==R||t[36]!==y||t[37]!==U||t[38]!==E||t[39]!==L.name||t[40]!==O||t[41]!==H?(Y=E?(0,_.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,_.jsx)(ee,{htmlFor:y,children:(0,_.jsx)(r,{id:`pSimwP`,values:{editor:R}})}),(0,_.jsx)(ie,{id:y,value:O,onChange:e=>k(e.target.value),placeholder:`${L.name}-${R}`,"aria-invalid":U&&H!==``,onKeyDown:e=>{e.key===`Enter`&&!U&&B(`rename`)}})]}):null,t[34]=B,t[35]=R,t[36]=y,t[37]=U,t[38]=E,t[39]=L.name,t[40]=O,t[41]=H,t[42]=Y):Y=t[42];let X;t[43]!==J||t[44]!==Y?(X=(0,_.jsxs)(f,{className:`min-h-0 flex-1 overflow-auto`,children:[J,Y]}),t[43]=J,t[44]=Y,t[45]=X):X=t[45];let Z;t[46]!==B||t[47]!==A||t[48]!==R||t[49]!==U||t[50]!==E||t[51]!==L.name?(Z=(0,_.jsx)(p,{children:E?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>D(!1),disabled:A,children:(0,_.jsx)(r,{id:`iH8pgl`})}),(0,_.jsx)(o,{onClick:()=>void B(`rename`),disabled:A||U,children:(0,_.jsx)(r,{id:`AT0e50`})})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>{k(`${L.name}-${R}`),D(!0)},disabled:A,children:(0,_.jsx)(r,{id:`AT0e50`})}),(0,_.jsx)(o,{variant:`outline`,onClick:()=>void B(`make-source`),disabled:A,children:(0,_.jsx)(r,{id:`xWomUD`,values:{editor:R}})}),(0,_.jsx)(o,{onClick:()=>void B(`align`),disabled:A,children:(0,_.jsx)(r,{id:`PZn2LP`})})]})}),t[46]=B,t[47]=A,t[48]=R,t[49]=U,t[50]=E,t[51]=L.name,t[52]=Z):Z=t[52];let Q;t[53]!==q||t[54]!==X||t[55]!==Z?(Q=(0,_.jsxs)(d,{className:`flex max-h-[85vh] w-full flex-col sm:max-w-5xl`,children:[q,X,Z]}),t[53]=q,t[54]=X,t[55]=Z,t[56]=Q):Q=t[56];let $;return t[57]!==Q||t[58]!==W?($=(0,_.jsx)(h,{open:!0,onOpenChange:W,children:Q}),t[57]=Q,t[58]=W,t[59]=$):$=t[59],$}export{v as SkillForkDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-BeFNZANd.js";import{t as ee}from"./label-D-K3fWtj.js";import{Lt as te}from"./dist-bQ5kvrpa.js";import{n as s}from"./dist-CJhtNlOm2.js";import{l as c}from"./skill-scope-B73Ci61z.js";import{a as l,c as u,i as d,n as f,o as p,s as m,t as h}from"./dialog-BfHNtxM9.js";import{E as ne,u as re}from"./skills-api-BazLRy2N.js";import{t as ie}from"./input-B87iFAAQ.js";import{t as ae}from"./MultiFileDiff-DBMOvxJx.js";import{t as oe}from"./pierre-theme-DSY2leqq.js";var se=a(),g=e(n(),1),_=t();function v(e){let t=(0,se.c)(60),{target:n,onOpenChange:a}=e,{_:v}=i(),y=(0,g.useId)(),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),[A,j]=(0,g.useState)(!1),M;t[0]===n?M=t[1]:(M=()=>{if(x(null),C(null),T(!1),D(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){T(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${c(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,C],[a,x]])re({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):T(!0))}).catch(()=>{o.signal.aborted||T(!0)});return()=>o.abort()},t[0]=n,t[1]=M);let N=n?.skill.scope,P=n?.skill.name,F=n?.editor,I;if(t[2]!==N||t[3]!==P||t[4]!==F?(I=[N,P,F],t[2]=N,t[3]=P,t[4]=F,t[5]=I):I=t[5],(0,g.useEffect)(M,I),!n)return null;let{skill:L,editor:R}=n,z;t[6]!==v||t[7]!==R||t[8]!==a||t[9]!==L.name||t[10]!==L.scope||t[11]!==n||t[12]!==O?(z=async function(e){if(!n)return;j(!0);let t=await ne({scope:L.scope,name:L.name,editor:R,action:e,...e===`rename`?{toName:O.trim()}:{}});if(j(!1),!t.ok){s.error(v({id:`MIF36T`,values:{0:t.error}}));return}s.success(v(e===`align`?{id:`QKgePK`,values:{editor:R}}:e===`make-source`?{id:`It9oAP`,values:{editor:R}}:{id:`b2ezG_`,values:{0:O.trim()}})),a(!1)},t[6]=v,t[7]=R,t[8]=a,t[9]=L.name,t[10]=L.scope,t[11]=n,t[12]=O,t[13]=z):z=t[13];let B=z,V,H;t[14]!==L.name||t[15]!==O?(H=O.trim(),V=H===``||!te.test(H)||H===L.name,t[14]=L.name,t[15]=O,t[16]=V,t[17]=H):(V=t[16],H=t[17]);let U=V,W;t[18]!==A||t[19]!==a?(W=e=>{!e&&!A&&a(!1)},t[18]=A,t[19]=a,t[20]=W):W=t[20];let G;t[21]!==R||t[22]!==L.name?(G=(0,_.jsx)(u,{children:(0,_.jsx)(r,{id:`q8aCbb`,values:{0:L.name,editor:R}})}),t[21]=R,t[22]=L.name,t[23]=G):G=t[23];let K;t[24]===R?K=t[25]:(K=(0,_.jsx)(l,{children:(0,_.jsx)(r,{id:`QASTNu`,values:{editor:R}})}),t[24]=R,t[25]=K);let q;t[26]!==K||t[27]!==G?(q=(0,_.jsxs)(m,{children:[G,K]}),t[26]=K,t[27]=G,t[28]=q):q=t[28];let J;t[29]!==S||t[30]!==b||t[31]!==w||t[32]!==L.name?(J=S!==null&&b!==null?(0,_.jsx)(ae,{className:`pierre-diff`,oldFile:{name:L.name,contents:S},newFile:{name:L.name,contents:b},options:{overflow:`wrap`,diffStyle:`unified`,theme:oe()}}):w?(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`5BlXTD`})}):(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`1V17kO`})}),t[29]=S,t[30]=b,t[31]=w,t[32]=L.name,t[33]=J):J=t[33];let Y;t[34]!==B||t[35]!==R||t[36]!==y||t[37]!==U||t[38]!==E||t[39]!==L.name||t[40]!==O||t[41]!==H?(Y=E?(0,_.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,_.jsx)(ee,{htmlFor:y,children:(0,_.jsx)(r,{id:`pSimwP`,values:{editor:R}})}),(0,_.jsx)(ie,{id:y,value:O,onChange:e=>k(e.target.value),placeholder:`${L.name}-${R}`,"aria-invalid":U&&H!==``,onKeyDown:e=>{e.key===`Enter`&&!U&&B(`rename`)}})]}):null,t[34]=B,t[35]=R,t[36]=y,t[37]=U,t[38]=E,t[39]=L.name,t[40]=O,t[41]=H,t[42]=Y):Y=t[42];let X;t[43]!==J||t[44]!==Y?(X=(0,_.jsxs)(f,{className:`min-h-0 flex-1 overflow-auto`,children:[J,Y]}),t[43]=J,t[44]=Y,t[45]=X):X=t[45];let Z;t[46]!==B||t[47]!==A||t[48]!==R||t[49]!==U||t[50]!==E||t[51]!==L.name?(Z=(0,_.jsx)(p,{children:E?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>D(!1),disabled:A,children:(0,_.jsx)(r,{id:`iH8pgl`})}),(0,_.jsx)(o,{onClick:()=>void B(`rename`),disabled:A||U,children:(0,_.jsx)(r,{id:`AT0e50`})})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>{k(`${L.name}-${R}`),D(!0)},disabled:A,children:(0,_.jsx)(r,{id:`AT0e50`})}),(0,_.jsx)(o,{variant:`outline`,onClick:()=>void B(`make-source`),disabled:A,children:(0,_.jsx)(r,{id:`xWomUD`,values:{editor:R}})}),(0,_.jsx)(o,{onClick:()=>void B(`align`),disabled:A,children:(0,_.jsx)(r,{id:`PZn2LP`})})]})}),t[46]=B,t[47]=A,t[48]=R,t[49]=U,t[50]=E,t[51]=L.name,t[52]=Z):Z=t[52];let Q;t[53]!==q||t[54]!==X||t[55]!==Z?(Q=(0,_.jsxs)(d,{className:`flex max-h-[85vh] w-full flex-col sm:max-w-5xl`,children:[q,X,Z]}),t[53]=q,t[54]=X,t[55]=Z,t[56]=Q):Q=t[56];let $;return t[57]!==Q||t[58]!==W?($=(0,_.jsx)(h,{open:!0,onOpenChange:W,children:Q}),t[57]=Q,t[58]=W,t[59]=$):$=t[59],$}export{v as SkillForkDialog};
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./AgentIconCluster-CqUXZZMo.js";import{t as s}from"./button-HKX9wT1K.js";import{i as c,n as l,t as u}from"./tooltip-DVBVVaAs.js";import"./RegisteredAgentIcon-Cg6tPVU5.js";import{Cc as d,Qc as f,Si as p,en as m,nn as h}from"./dist-bQ5kvrpa.js";import{n as g}from"./dist-CJhtNlOm2.js";import{c as _}from"./documents-events-j9AAd1Uc.js";import{t as v}from"./createLucideIcon-B6ULg5PN.js";import{a as y,f as b,i as x,m as S,n as C,o as w,p as T,u as E}from"./dropdown-menu-raSZ06x1.js";import{t as ee}from"./folder-C4F4ia-z.js";import{i as te,l as D,n as ne,r as O}from"./skill-scope-B73Ci61z.js";import{F as k,S as re,j as A,x as j}from"./skills-api-BazLRy2N.js";import{t as M}from"./use-skills-BZixx2iF.js";import{a as N,c as P,d as F,f as I,l as L,p as R,s as z,u as B}from"./DeleteConfirmationDialog-CJJ8Xo5u.js";var V=v(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),ie=v(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),H=v(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),U=e(n(),1),W=a(),G=[...new Set(d.flatMap(e=>e.schemes))];function ae(e,t){let n=t.now?.()??Date.now(),r={};for(let t of d){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function K(e){return ae({},e)}async function q(e){let t=e.schemes??G,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var J=Object.fromEntries(G.map(e=>[e,{installed:!1}]));async function oe(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return J}if(!t.ok)return J;let n;try{n=await t.json()}catch{return J}if(typeof n!=`object`||!n||Array.isArray(n))return J;let r=n,i={};for(let e of G)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Y(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function X(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=K({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=ae(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Y(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function se(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function ce(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>q({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>oe({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function le(){let e=(0,W.c)(5),[t,n]=(0,U.useState)(ue),r=(0,U.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=X(ce());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,U.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function ue(){return K({isElectronHost:se(),now:Date.now})}var Z=t(),de=(0,U.createContext)(null);function fe(e){let t=(0,W.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(de,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function pe(){return(0,U.use)(de)}function me(e){let t=(0,W.c)(6),{testId:n,title:i}=e,a;t[0]===i?a=t[1]:(a=i===void 0?{}:{title:i},t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(r,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide`,"data-testid":n,...a,children:o}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s}function he(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(z,{...r}):(0,Z.jsx)(x,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ge(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(P,{...r}):(0,Z.jsx)(y,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function _e(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(N,{...r}):(0,Z.jsx)(C,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ve(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(L,{...r}):(0,Z.jsx)(w,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ye(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(B,{...r}):(0,Z.jsx)(E,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function be(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(F,{...r}):(0,Z.jsx)(b,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function xe(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(I,{...r}):(0,Z.jsx)(T,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Se(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(R,{...r}):(0,Z.jsx)(S,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Ce=Object.freeze({hosts:null,source:null}),we=new Map,Te=new Map;function Ee(e,t){return`${e}:${t}`}function De(e){return we.get(e)??Ce}function Oe(e,t){let n=Te.get(e)??new Set;return Te.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&Te.delete(e)}}function Q(e,t){let n=De(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?we.delete(e):we.set(e,r);for(let t of Te.get(e)??[])t()}}var ke=m.options,Ae=h.options,je=`.agents/`;function Me({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${D(t,e.scope)}/${e.name}`:null,o=e?.hubOffered??(e&&t!==null?t.find(t=>t.scope===e.scope)?.hubOffered:void 0),s=e!==void 0&&(o===!0||(e.hosts??[]).includes(`agents`)||t?.some(t=>t.scope===e.scope&&(t.hosts.includes(`agents`)||t.path.startsWith(je)))),c=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),l=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),u=l?new Set(l):null,d=e?.scope===`global`?Ae:ke,f=(s?[...d,`agents`]:d).filter(e=>!(e in c)).filter(e=>e===`agents`||u===null||u.has(e)||n.has(e)),p=new Set(f.map(e=>a(e))),m=e?.scope===`global`?`~/`:``,h=e?.path?.includes(`/`)?`${m}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,g=h!==null&&!p.has(h)?h:null,_=g===null?r??e?.hosts?.[0]:void 0,v=new Set(e?.conflictHosts??[]),y=new Set(e?.driftPaths??[]),b=new Set(e?.symlinkedHosts??[]),x=[...[...n].filter(e=>e!==_&&!(e in c)&&!v.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:b.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:O(e),display:`${m}${e.path}`,mode:e.mode}))],S=x.map(e=>e.mode),C=S.filter(e=>e===`link`).length,w=S.length===0?i?`link`:`copy`:C*2>=S.length?`link`:`copy`,T=new Map((e?.customPlacements??[]).map(e=>[O(e),e])),E=new Set(T.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=O(e);t!==``&&E.add(t)}}return{pathFor:a,aliases:c,rows:f,sourceRow:g,sourceHost:_,conflicted:v,drifted:y,linked:b,expectedMode:w,convertible:x,customRootRows:e===void 0?[]:[...E].sort().map(t=>({root:t,display:`${m}${t}/${e.name}`,placed:T.get(t)??null})).filter(e=>!p.has(e.display)&&e.display!==h&&!(e.root in c))}}var Ne=`min-w-[24rem]`;function Pe(e,t){let n=(0,W.c)(45),r=t.installingName===e.name,i=(0,U.useRef)(e),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,U.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,U.useEffect)(u,d);let f=r||a,m;n[6]!==e.name||n[7]!==e.scope?(m=Ee(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=m):m=n[8];let h=m,_,v;n[9]===h?(_=n[10],v=n[11]):(_=e=>Oe(h,e),v=()=>De(h),n[9]=h,n[10]=_,n[11]=v);let y=(0,U.useSyncExternalStore)(_,v),b=y.hosts,x=y.source,S,C;n[12]!==x||n[13]!==h||n[14]!==e.hosts?(S=()=>{x!==null&&e.hosts[0]===x&&Q(h,{source:null})},C=[e.hosts,x,h],n[12]=x,n[13]=h,n[14]=e.hosts,n[15]=S,n[16]=C):(S=n[15],C=n[16]),(0,U.useEffect)(S,C);let w=e.linkMode===!0,T=b??e.hosts,E;n[17]===T?E=n[18]:(E=new Set(T),n[17]=T,n[18]=E);let ee=E,te=b?b.length>0:e.installed,D=(0,U.useRef)(e.hosts),ne,O;n[19]!==b||n[20]!==e.hosts?(ne=()=>{b===null&&(D.current=e.hosts)},O=[b,e.hosts],n[19]=b,n[20]=e.hosts,n[21]=ne,n[22]=O):(ne=n[21],O=n[22]),(0,U.useEffect)(ne,O);let re;n[23]===e.hosts?re=n[24]:(re=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=re);let M=re,N,P;n[25]!==h||n[26]!==M?(N=()=>{let e=De(h).hosts;e&&[...e].sort().join(`,`)===M&&Q(h,{hosts:null})},P=[M,h],n[25]=h,n[26]=M,n[27]=N,n[28]=P):(N=n[27],P=n[28]),(0,U.useEffect)(N,P);let F=(0,U.useRef)(null),I=(0,U.useRef)(null),L,R;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>()=>{F.current&&clearTimeout(F.current),I.current?.(),I.current=null},R=[],n[29]=L,n[30]=R):(L=n[29],R=n[30]),(0,U.useEffect)(L,R);let z;n[31]!==t||n[32]!==h||n[33]!==e?(z=function(n,r){D.current=n,Q(h,{hosts:n}),F.current&&clearTimeout(F.current);let i=async()=>{I.current=null,F.current=null;let r=await t.install(e,n.filter(p));if(!r.ok){Q(h,{hosts:null});return}D.current=[...r.hosts],Q(h,{hosts:[...r.hosts]})};r?(I.current=()=>void i(),F.current=setTimeout(()=>void i(),350)):(I.current=null,i())},n[31]=t,n[32]=h,n[33]=e,n[34]=z):z=n[34];let B=z,V;return n[35]!==t||n[36]!==B||n[37]!==ee||n[38]!==te||n[39]!==f||n[40]!==x||n[41]!==h||n[42]!==w||n[43]!==e?(V={hostSet:ee,installed:te,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),B([...n],!0)},installAll(){let t=e.scope===`global`?Ae:ke,n=D.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||D.current.includes(e));B([...n,...i],!1)},linkMode:w,sourceHost:x??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>j({scope:e.scope,name:e.name,dir:n,mode:r})).then(Ie)},unplaceAt(n){t.runLocationWrite(e,()=>k({scope:e.scope,name:e.name,path:n})).then(Fe)},setSource(n){Q(h,{source:n}),t.runLocationWrite(e,()=>A({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Q(h,{source:null}),g.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=B,n[37]=ee,n[38]=te,n[39]=f,n[40]=x,n[41]=h,n[42]=w,n[43]=e,n[44]=V):V=n[44],V}function Fe(e){e.ok||g.error(e.error)}function Ie(e){e.ok||g.error(e.error)}function $(e){let t=(0,W.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(c,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Z.jsx)(l,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(u,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Le(e){let t=(0,W.c)(77),{toggles:n,skill:a,onResolveFork:c,onRunStart:l,menuKind:u}=e,d=u===void 0?`dropdown`:u,{_:p}=i(),{hostSet:m,toggleEditor:h,installAll:v}=n,y=M(),b,x,S,C,w,T,E,O,k,A;if(t[0]!==p||t[1]!==y.data||t[2]!==y.status||t[3]!==m||t[4]!==v||t[5]!==d||t[6]!==c||t[7]!==l||t[8]!==a||t[9]!==h||t[10]!==n){let{pathFor:e,aliases:i,rows:u,sourceRow:j,sourceHost:M,conflicted:N,drifted:P,linked:F,expectedMode:I,convertible:L,customRootRows:R}=Me({skill:a,allSkills:y.status===`ready`?y.data:null,hostSet:m,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});w=u,T=j,C=I,x=L,S=R;let z=e=>ne(i,e),B=We,V=e=>{let t=z(e);return t.length===0?!0:window.confirm(p({id:`Uobeu9`,values:{0:t.map(B).join(`, `),rootRel:e}}))},ie;t[21]!==p||t[22]!==a?(ie=(e,t)=>{let n=e.includes(`/`)?e:D(e,a?.scope??`project`);return(0,Z.jsx)($,{hint:p({id:`0dslv8`,values:{0:B(e),1:B(e),2:a?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":p({id:`G6Lrs_`,values:{0:B(e)}}),onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(p({id:`iiqOKM`,values:{0:B(e),1:a.name,2:B(e),subRoot:n,poolRootRel:t}}))&&re({scope:a.scope,root:n,action:`unlink`,exclude:[a.name]}).then(e=>{e.ok?_():g.error(p({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Z.jsx)(o,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=p,t[22]=a,t[23]=ie):ie=t[23];let H=ie;b=n.installing;let U=te(a),W=Ue,G;t[24]!==p||t[25]!==l||t[26]!==n?(G=(e,t,i)=>{let a=i===`link`?`copy`:`link`;return(0,Z.jsx)($,{hint:p(i===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(p(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(l?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:i===`link`?(0,Z.jsx)(r,{id:`uUCrBv`}):(0,Z.jsx)(r,{id:`iaPtht`})})})},t[24]=p,t[25]=l,t[26]=n,t[27]=G):G=t[27];let ae=G,K;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(r,{id:`npcziF`}),t[28]=K):K=t[28];let q;t[29]===p?q=t[30]:(q=p({id:`6f_UX4`}),t[29]=p,t[30]=q);let J;t[31]===v?J=t[32]:(J=()=>v(),t[31]=v,t[32]=J);let oe;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(r,{id:`N40H-G`}),t[33]=oe):oe=t[33];let Y;t[34]!==b||t[35]!==J?(Y=(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:b,onClick:J,"data-testid":`skill-install-all`,children:oe}),t[34]=b,t[35]=J,t[36]=Y):Y=t[36];let X;t[37]!==q||t[38]!==Y?(X=(0,Z.jsx)($,{hint:q,children:Y}),t[37]=q,t[38]=Y,t[39]=X):X=t[39],t[40]!==d||t[41]!==X?(E=(0,Z.jsxs)(ve,{menuKind:d,className:`flex items-center justify-between gap-2`,children:[K,X]}),t[40]=d,t[41]=X,t[42]=E):E=t[42],O=T===null?null:(0,Z.jsx)($,{hint:p({id:`pXB6SL`}),children:(0,Z.jsxs)(_e,{menuKind:d,disabled:b,checked:!0,onSelect:He,"data-testid":`skill-source-row`,children:[(0,Z.jsx)(ee,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:T}),(()=>{let e=W(T).split(`/`).slice(0,-1).join(`/`),t=z(e);return t.length>0?(0,Z.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>H(t,e))}):null})(),(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(r,{id:`tiFPjk`})})]})]})}),k=w.map(t=>{let i=e(t),l=t===`agents`?`.agents`:f[t],u=W(i).split(`/`).slice(0,-1).join(`/`),g=z(u);return(0,Z.jsx)($,{hint:N.has(t)?p({id:`8HvJlU`,values:{0:i??l}}):t===M?i?p({id:`ssk6rl`,values:{path:i}}):l:m.has(t)?p(i?{id:`9ieZhu`,values:{path:i}}:{id:`n3T3EE`,values:{label:l}}):U?.editor===t?p({id:`_3S4Ql`,values:{0:a?.name??``,1:U.plugin,2:i??l,label:l}}):p(i?M===void 0?{id:`xk133d`,values:{path:i}}:C===`link`?{id:`1LtA5r`,values:{path:i}}:{id:`opPbzN`,values:{path:i}}:{id:`Pp0Vgd`,values:{label:l}}),children:(0,Z.jsxs)(_e,{menuKind:d,disabled:b,checked:m.has(t),onCheckedChange:e=>{N.has(t)||e===!0&&!V(u)||h(t,e===!0)},onSelect:Ve,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,Z.jsx)(o,{host:t,"aria-hidden":!0,className:`size-4`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:i??l}),g.length>0?(0,Z.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:g.map(e=>H(e,u))}):null,U?.editor===t&&!m.has(t)?(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,"data-testid":`skill-row-plugin-covered-${t}`,children:(0,Z.jsx)(r,{id:`scRzTw`})}):null,N.has(t)?(0,Z.jsx)($,{hint:p({id:`_O7dJS`}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:e=>{e.preventDefault(),c?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,Z.jsx)(r,{id:`jng7Ko`})})}):t===M?(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(r,{id:`tiFPjk`})}):m.has(t)&&a?.hosts?(0,Z.jsxs)(Z.Fragment,{children:[!b&&(F.has(t)?`link`:`copy`)!==C?ae(t,i??l,F.has(t)?`link`:`copy`):null,(0,Z.jsx)($,{hint:p({id:`nBgzKO`}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n.setSource?.(t)},"data-testid":`skill-set-source-${t}`,children:(0,Z.jsx)(r,{id:`VNNRfN`})})})]}):null,!b&&P.has(W(i))?(0,Z.jsx)($,{hint:p({id:`iz1LdD`}),children:(0,Z.jsx)(me,{testId:`skill-drift-${t}`})}):null]})]})},t)}),A=S.map(e=>{let t=e.display;return(0,Z.jsx)($,{hint:e.placed===null?p(M===void 0?{id:`xk133d`,values:{path:t}}:C===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):p({id:`9ieZhu`,values:{path:t}}),children:(0,Z.jsxs)(_e,{menuKind:d,disabled:b,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!V(e.root))return;n.placeAt(e.root,C)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Be,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Z.jsx)(o,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Z.jsx)(ee,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),z(e.root).length>0?(0,Z.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:z(e.root).map(t=>H(t,e.root))}):null,!b&&e.placed!==null&&P.has(e.placed.path)?(0,Z.jsx)($,{hint:p({id:`iz1LdD`}),children:(0,Z.jsx)(me,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Z.jsxs)(Z.Fragment,{children:[!b&&e.placed.mode!==C?ae(e.root,e.display,e.placed.mode):null,(0,Z.jsx)($,{hint:p({id:`nBgzKO`}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Z.jsx)(r,{id:`VNNRfN`})})})]})]})]})},e.root)}),t[0]=p,t[1]=y.data,t[2]=y.status,t[3]=m,t[4]=v,t[5]=d,t[6]=c,t[7]=l,t[8]=a,t[9]=h,t[10]=n,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=O,t[19]=k,t[20]=A}else b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],O=t[18],k=t[19],A=t[20];let j;t[43]!==S||t[44]!==w.length||t[45]!==T?(j=w.length===0&&S.length===0&&T===null?(0,Z.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,Z.jsx)(r,{id:`MOAoFO`})}):null,t[43]=S,t[44]=w.length,t[45]=T,t[46]=j):j=t[46];let N;t[47]!==p||t[48]!==b||t[49]!==x||t[50]!==C||t[51]!==l||t[52]!==n?(N=x.length>0&&n.convertLocations?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=C===`link`?`copy`:`link`,r=x.filter(e=>e.mode!==t);if(r.length===0)return;let i=p(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=p(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(ze).join(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./AgentIconCluster-CqUXZZMo.js";import{t as s}from"./button-BeFNZANd.js";import{i as c,n as l,t as u}from"./tooltip-DVBVVaAs.js";import"./RegisteredAgentIcon-Cg6tPVU5.js";import{Cc as d,Qc as f,Si as p,en as m,nn as h}from"./dist-bQ5kvrpa.js";import{n as g}from"./dist-CJhtNlOm2.js";import{c as _}from"./documents-events-j9AAd1Uc.js";import{t as v}from"./createLucideIcon-B6ULg5PN.js";import{a as y,f as b,i as x,m as S,n as C,o as w,p as T,u as E}from"./dropdown-menu-raSZ06x1.js";import{t as ee}from"./folder-C4F4ia-z.js";import{i as te,l as D,n as ne,r as O}from"./skill-scope-B73Ci61z.js";import{F as k,S as re,j as A,x as j}from"./skills-api-BazLRy2N.js";import{t as M}from"./use-skills-BZixx2iF.js";import{a as N,c as P,d as F,f as I,l as L,p as R,s as z,u as B}from"./DeleteConfirmationDialog-DYyGQK4Z.js";var V=v(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),ie=v(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),H=v(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),U=e(n(),1),W=a(),G=[...new Set(d.flatMap(e=>e.schemes))];function ae(e,t){let n=t.now?.()??Date.now(),r={};for(let t of d){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function K(e){return ae({},e)}async function q(e){let t=e.schemes??G,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var J=Object.fromEntries(G.map(e=>[e,{installed:!1}]));async function oe(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return J}if(!t.ok)return J;let n;try{n=await t.json()}catch{return J}if(typeof n!=`object`||!n||Array.isArray(n))return J;let r=n,i={};for(let e of G)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Y(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function X(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=K({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=ae(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Y(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function se(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function ce(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>q({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>oe({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function le(){let e=(0,W.c)(5),[t,n]=(0,U.useState)(ue),r=(0,U.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=X(ce());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,U.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function ue(){return K({isElectronHost:se(),now:Date.now})}var Z=t(),de=(0,U.createContext)(null);function fe(e){let t=(0,W.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(de,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function pe(){return(0,U.use)(de)}function me(e){let t=(0,W.c)(6),{testId:n,title:i}=e,a;t[0]===i?a=t[1]:(a=i===void 0?{}:{title:i},t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(r,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide`,"data-testid":n,...a,children:o}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s}function he(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(z,{...r}):(0,Z.jsx)(x,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ge(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(P,{...r}):(0,Z.jsx)(y,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function _e(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(N,{...r}):(0,Z.jsx)(C,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ve(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(L,{...r}):(0,Z.jsx)(w,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ye(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(B,{...r}):(0,Z.jsx)(E,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function be(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(F,{...r}):(0,Z.jsx)(b,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function xe(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(I,{...r}):(0,Z.jsx)(T,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Se(e){let t=(0,W.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Z.jsx)(R,{...r}):(0,Z.jsx)(S,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Ce=Object.freeze({hosts:null,source:null}),we=new Map,Te=new Map;function Ee(e,t){return`${e}:${t}`}function De(e){return we.get(e)??Ce}function Oe(e,t){let n=Te.get(e)??new Set;return Te.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&Te.delete(e)}}function Q(e,t){let n=De(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?we.delete(e):we.set(e,r);for(let t of Te.get(e)??[])t()}}var ke=m.options,Ae=h.options,je=`.agents/`;function Me({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${D(t,e.scope)}/${e.name}`:null,o=e?.hubOffered??(e&&t!==null?t.find(t=>t.scope===e.scope)?.hubOffered:void 0),s=e!==void 0&&(o===!0||(e.hosts??[]).includes(`agents`)||t?.some(t=>t.scope===e.scope&&(t.hosts.includes(`agents`)||t.path.startsWith(je)))),c=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),l=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),u=l?new Set(l):null,d=e?.scope===`global`?Ae:ke,f=(s?[...d,`agents`]:d).filter(e=>!(e in c)).filter(e=>e===`agents`||u===null||u.has(e)||n.has(e)),p=new Set(f.map(e=>a(e))),m=e?.scope===`global`?`~/`:``,h=e?.path?.includes(`/`)?`${m}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,g=h!==null&&!p.has(h)?h:null,_=g===null?r??e?.hosts?.[0]:void 0,v=new Set(e?.conflictHosts??[]),y=new Set(e?.driftPaths??[]),b=new Set(e?.symlinkedHosts??[]),x=[...[...n].filter(e=>e!==_&&!(e in c)&&!v.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:b.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:O(e),display:`${m}${e.path}`,mode:e.mode}))],S=x.map(e=>e.mode),C=S.filter(e=>e===`link`).length,w=S.length===0?i?`link`:`copy`:C*2>=S.length?`link`:`copy`,T=new Map((e?.customPlacements??[]).map(e=>[O(e),e])),E=new Set(T.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=O(e);t!==``&&E.add(t)}}return{pathFor:a,aliases:c,rows:f,sourceRow:g,sourceHost:_,conflicted:v,drifted:y,linked:b,expectedMode:w,convertible:x,customRootRows:e===void 0?[]:[...E].sort().map(t=>({root:t,display:`${m}${t}/${e.name}`,placed:T.get(t)??null})).filter(e=>!p.has(e.display)&&e.display!==h&&!(e.root in c))}}var Ne=`min-w-[24rem]`;function Pe(e,t){let n=(0,W.c)(45),r=t.installingName===e.name,i=(0,U.useRef)(e),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,U.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,U.useEffect)(u,d);let f=r||a,m;n[6]!==e.name||n[7]!==e.scope?(m=Ee(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=m):m=n[8];let h=m,_,v;n[9]===h?(_=n[10],v=n[11]):(_=e=>Oe(h,e),v=()=>De(h),n[9]=h,n[10]=_,n[11]=v);let y=(0,U.useSyncExternalStore)(_,v),b=y.hosts,x=y.source,S,C;n[12]!==x||n[13]!==h||n[14]!==e.hosts?(S=()=>{x!==null&&e.hosts[0]===x&&Q(h,{source:null})},C=[e.hosts,x,h],n[12]=x,n[13]=h,n[14]=e.hosts,n[15]=S,n[16]=C):(S=n[15],C=n[16]),(0,U.useEffect)(S,C);let w=e.linkMode===!0,T=b??e.hosts,E;n[17]===T?E=n[18]:(E=new Set(T),n[17]=T,n[18]=E);let ee=E,te=b?b.length>0:e.installed,D=(0,U.useRef)(e.hosts),ne,O;n[19]!==b||n[20]!==e.hosts?(ne=()=>{b===null&&(D.current=e.hosts)},O=[b,e.hosts],n[19]=b,n[20]=e.hosts,n[21]=ne,n[22]=O):(ne=n[21],O=n[22]),(0,U.useEffect)(ne,O);let re;n[23]===e.hosts?re=n[24]:(re=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=re);let M=re,N,P;n[25]!==h||n[26]!==M?(N=()=>{let e=De(h).hosts;e&&[...e].sort().join(`,`)===M&&Q(h,{hosts:null})},P=[M,h],n[25]=h,n[26]=M,n[27]=N,n[28]=P):(N=n[27],P=n[28]),(0,U.useEffect)(N,P);let F=(0,U.useRef)(null),I=(0,U.useRef)(null),L,R;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>()=>{F.current&&clearTimeout(F.current),I.current?.(),I.current=null},R=[],n[29]=L,n[30]=R):(L=n[29],R=n[30]),(0,U.useEffect)(L,R);let z;n[31]!==t||n[32]!==h||n[33]!==e?(z=function(n,r){D.current=n,Q(h,{hosts:n}),F.current&&clearTimeout(F.current);let i=async()=>{I.current=null,F.current=null;let r=await t.install(e,n.filter(p));if(!r.ok){Q(h,{hosts:null});return}D.current=[...r.hosts],Q(h,{hosts:[...r.hosts]})};r?(I.current=()=>void i(),F.current=setTimeout(()=>void i(),350)):(I.current=null,i())},n[31]=t,n[32]=h,n[33]=e,n[34]=z):z=n[34];let B=z,V;return n[35]!==t||n[36]!==B||n[37]!==ee||n[38]!==te||n[39]!==f||n[40]!==x||n[41]!==h||n[42]!==w||n[43]!==e?(V={hostSet:ee,installed:te,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),B([...n],!0)},installAll(){let t=e.scope===`global`?Ae:ke,n=D.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||D.current.includes(e));B([...n,...i],!1)},linkMode:w,sourceHost:x??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>j({scope:e.scope,name:e.name,dir:n,mode:r})).then(Ie)},unplaceAt(n){t.runLocationWrite(e,()=>k({scope:e.scope,name:e.name,path:n})).then(Fe)},setSource(n){Q(h,{source:n}),t.runLocationWrite(e,()=>A({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Q(h,{source:null}),g.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=B,n[37]=ee,n[38]=te,n[39]=f,n[40]=x,n[41]=h,n[42]=w,n[43]=e,n[44]=V):V=n[44],V}function Fe(e){e.ok||g.error(e.error)}function Ie(e){e.ok||g.error(e.error)}function $(e){let t=(0,W.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(c,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Z.jsx)(l,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(u,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Le(e){let t=(0,W.c)(77),{toggles:n,skill:a,onResolveFork:c,onRunStart:l,menuKind:u}=e,d=u===void 0?`dropdown`:u,{_:p}=i(),{hostSet:m,toggleEditor:h,installAll:v}=n,y=M(),b,x,S,C,w,T,E,O,k,A;if(t[0]!==p||t[1]!==y.data||t[2]!==y.status||t[3]!==m||t[4]!==v||t[5]!==d||t[6]!==c||t[7]!==l||t[8]!==a||t[9]!==h||t[10]!==n){let{pathFor:e,aliases:i,rows:u,sourceRow:j,sourceHost:M,conflicted:N,drifted:P,linked:F,expectedMode:I,convertible:L,customRootRows:R}=Me({skill:a,allSkills:y.status===`ready`?y.data:null,hostSet:m,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});w=u,T=j,C=I,x=L,S=R;let z=e=>ne(i,e),B=We,V=e=>{let t=z(e);return t.length===0?!0:window.confirm(p({id:`Uobeu9`,values:{0:t.map(B).join(`, `),rootRel:e}}))},ie;t[21]!==p||t[22]!==a?(ie=(e,t)=>{let n=e.includes(`/`)?e:D(e,a?.scope??`project`);return(0,Z.jsx)($,{hint:p({id:`0dslv8`,values:{0:B(e),1:B(e),2:a?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":p({id:`G6Lrs_`,values:{0:B(e)}}),onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(p({id:`iiqOKM`,values:{0:B(e),1:a.name,2:B(e),subRoot:n,poolRootRel:t}}))&&re({scope:a.scope,root:n,action:`unlink`,exclude:[a.name]}).then(e=>{e.ok?_():g.error(p({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Z.jsx)(o,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=p,t[22]=a,t[23]=ie):ie=t[23];let H=ie;b=n.installing;let U=te(a),W=Ue,G;t[24]!==p||t[25]!==l||t[26]!==n?(G=(e,t,i)=>{let a=i===`link`?`copy`:`link`;return(0,Z.jsx)($,{hint:p(i===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(p(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(l?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:i===`link`?(0,Z.jsx)(r,{id:`uUCrBv`}):(0,Z.jsx)(r,{id:`iaPtht`})})})},t[24]=p,t[25]=l,t[26]=n,t[27]=G):G=t[27];let ae=G,K;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(r,{id:`npcziF`}),t[28]=K):K=t[28];let q;t[29]===p?q=t[30]:(q=p({id:`6f_UX4`}),t[29]=p,t[30]=q);let J;t[31]===v?J=t[32]:(J=()=>v(),t[31]=v,t[32]=J);let oe;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(r,{id:`N40H-G`}),t[33]=oe):oe=t[33];let Y;t[34]!==b||t[35]!==J?(Y=(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:b,onClick:J,"data-testid":`skill-install-all`,children:oe}),t[34]=b,t[35]=J,t[36]=Y):Y=t[36];let X;t[37]!==q||t[38]!==Y?(X=(0,Z.jsx)($,{hint:q,children:Y}),t[37]=q,t[38]=Y,t[39]=X):X=t[39],t[40]!==d||t[41]!==X?(E=(0,Z.jsxs)(ve,{menuKind:d,className:`flex items-center justify-between gap-2`,children:[K,X]}),t[40]=d,t[41]=X,t[42]=E):E=t[42],O=T===null?null:(0,Z.jsx)($,{hint:p({id:`pXB6SL`}),children:(0,Z.jsxs)(_e,{menuKind:d,disabled:b,checked:!0,onSelect:He,"data-testid":`skill-source-row`,children:[(0,Z.jsx)(ee,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:T}),(()=>{let e=W(T).split(`/`).slice(0,-1).join(`/`),t=z(e);return t.length>0?(0,Z.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>H(t,e))}):null})(),(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(r,{id:`tiFPjk`})})]})]})}),k=w.map(t=>{let i=e(t),l=t===`agents`?`.agents`:f[t],u=W(i).split(`/`).slice(0,-1).join(`/`),g=z(u);return(0,Z.jsx)($,{hint:N.has(t)?p({id:`8HvJlU`,values:{0:i??l}}):t===M?i?p({id:`ssk6rl`,values:{path:i}}):l:m.has(t)?p(i?{id:`9ieZhu`,values:{path:i}}:{id:`n3T3EE`,values:{label:l}}):U?.editor===t?p({id:`_3S4Ql`,values:{0:a?.name??``,1:U.plugin,2:i??l,label:l}}):p(i?M===void 0?{id:`xk133d`,values:{path:i}}:C===`link`?{id:`1LtA5r`,values:{path:i}}:{id:`opPbzN`,values:{path:i}}:{id:`Pp0Vgd`,values:{label:l}}),children:(0,Z.jsxs)(_e,{menuKind:d,disabled:b,checked:m.has(t),onCheckedChange:e=>{N.has(t)||e===!0&&!V(u)||h(t,e===!0)},onSelect:Ve,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,Z.jsx)(o,{host:t,"aria-hidden":!0,className:`size-4`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:i??l}),g.length>0?(0,Z.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:g.map(e=>H(e,u))}):null,U?.editor===t&&!m.has(t)?(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,"data-testid":`skill-row-plugin-covered-${t}`,children:(0,Z.jsx)(r,{id:`scRzTw`})}):null,N.has(t)?(0,Z.jsx)($,{hint:p({id:`_O7dJS`}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:e=>{e.preventDefault(),c?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,Z.jsx)(r,{id:`jng7Ko`})})}):t===M?(0,Z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(r,{id:`tiFPjk`})}):m.has(t)&&a?.hosts?(0,Z.jsxs)(Z.Fragment,{children:[!b&&(F.has(t)?`link`:`copy`)!==C?ae(t,i??l,F.has(t)?`link`:`copy`):null,(0,Z.jsx)($,{hint:p({id:`nBgzKO`}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n.setSource?.(t)},"data-testid":`skill-set-source-${t}`,children:(0,Z.jsx)(r,{id:`VNNRfN`})})})]}):null,!b&&P.has(W(i))?(0,Z.jsx)($,{hint:p({id:`iz1LdD`}),children:(0,Z.jsx)(me,{testId:`skill-drift-${t}`})}):null]})]})},t)}),A=S.map(e=>{let t=e.display;return(0,Z.jsx)($,{hint:e.placed===null?p(M===void 0?{id:`xk133d`,values:{path:t}}:C===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):p({id:`9ieZhu`,values:{path:t}}),children:(0,Z.jsxs)(_e,{menuKind:d,disabled:b,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!V(e.root))return;n.placeAt(e.root,C)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Be,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Z.jsx)(o,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Z.jsx)(ee,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),z(e.root).length>0?(0,Z.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:z(e.root).map(t=>H(t,e.root))}):null,!b&&e.placed!==null&&P.has(e.placed.path)?(0,Z.jsx)($,{hint:p({id:`iz1LdD`}),children:(0,Z.jsx)(me,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Z.jsxs)(Z.Fragment,{children:[!b&&e.placed.mode!==C?ae(e.root,e.display,e.placed.mode):null,(0,Z.jsx)($,{hint:p({id:`nBgzKO`}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Z.jsx)(r,{id:`VNNRfN`})})})]})]})]})},e.root)}),t[0]=p,t[1]=y.data,t[2]=y.status,t[3]=m,t[4]=v,t[5]=d,t[6]=c,t[7]=l,t[8]=a,t[9]=h,t[10]=n,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=O,t[19]=k,t[20]=A}else b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],O=t[18],k=t[19],A=t[20];let j;t[43]!==S||t[44]!==w.length||t[45]!==T?(j=w.length===0&&S.length===0&&T===null?(0,Z.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,Z.jsx)(r,{id:`MOAoFO`})}):null,t[43]=S,t[44]=w.length,t[45]=T,t[46]=j):j=t[46];let N;t[47]!==p||t[48]!==b||t[49]!==x||t[50]!==C||t[51]!==l||t[52]!==n?(N=x.length>0&&n.convertLocations?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=C===`link`?`copy`:`link`,r=x.filter(e=>e.mode!==t);if(r.length===0)return;let i=p(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=p(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(ze).join(`
2
2
  `);window.confirm(`${i}\n\n${a}\n\n${o}\n\n${p({id:`Cu6GXQ`})}`)&&(l?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:b,"data-testid":`skill-convert-all`,children:C===`link`?(0,Z.jsx)(r,{id:`rcJmK8`}):(0,Z.jsx)(r,{id:`LBv_TR`})}),(0,Z.jsx)($,{hint:p({id:`0J6nhG`}),children:(0,Z.jsx)(s,{variant:`ghost`,size:`sm`,"aria-label":p({id:`qJSo0_`}),className:`size-4 shrink-0 rounded-full border border-border/60 p-0 font-normal text-[9px] text-muted-foreground hover:border-foreground/40 hover:bg-transparent hover:text-foreground`,onClick:Re,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[47]=p,t[48]=b,t[49]=x,t[50]=C,t[51]=l,t[52]=n,t[53]=N):N=t[53];let P;t[54]===d?P=t[55]:(P=(0,Z.jsx)(ye,{menuKind:d}),t[54]=d,t[55]=P);let F;t[56]===p?F=t[57]:(F=p({id:`5ymuTA`}),t[56]=p,t[57]=F);let I;t[58]===a?.scope?I=t[59]:(I=()=>{window.location.hash=a?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[58]=a?.scope,t[59]=I);let L,R;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(H,{"aria-hidden":!0}),R=(0,Z.jsx)(r,{id:`ZBF9fn`}),t[60]=L,t[61]=R):(L=t[60],R=t[61]);let z;t[62]!==d||t[63]!==I?(z=(0,Z.jsxs)(ge,{menuKind:d,onSelect:I,children:[L,R]}),t[62]=d,t[63]=I,t[64]=z):z=t[64];let B;t[65]!==z||t[66]!==F?(B=(0,Z.jsx)($,{hint:F,children:z}),t[65]=z,t[66]=F,t[67]=B):B=t[67];let V;return t[68]!==B||t[69]!==E||t[70]!==O||t[71]!==k||t[72]!==A||t[73]!==j||t[74]!==N||t[75]!==P?(V=(0,Z.jsxs)(Z.Fragment,{children:[E,O,k,A,j,N,P,B]}),t[68]=B,t[69]=E,t[70]=O,t[71]=k,t[72]=A,t[73]=j,t[74]=N,t[75]=P,t[76]=V):V=t[76],V}function Re(e){return e.preventDefault()}function ze(e){return e.display}function Be(e){return e.preventDefault()}function Ve(e){return e.preventDefault()}function He(e){return e.preventDefault()}function Ue(e){return(e??``).replace(/^~\//,``)}function We(e){return e===`agents`?`.agents`:f[e]??e}export{H as _,ke as a,ve as c,xe as d,Se as f,le as g,pe as h,Ae as i,ye as l,fe as m,Le as n,he as o,me as p,Pe as r,ge as s,Ne as t,be as u,ie as v,V as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillUpdateConflictDialog-BTP9zIit.js","./dist-Nvb76hAm.js","./chunk-CYidjpOJ.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./pierre-theme-DSY2leqq.js","./preload-helper-Chd9yIcd.js","./engine-compile-DCy0BQ6p.js","./lib-DmueaA5E.js","./html-void-elements-zEl0KGqf.js","./ok-syntax-theme-CbtG1O48.js","./MultiFileDiff-DBMOvxJx.js","./button-HKX9wT1K.js","./dist-BHv-mziD.js","./bundle-mjs-SHeFpKGC.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./dialog-Q2r_wm4I.js","./electron-drag-strip-BgiQs0O3.js","./dist-BcvirUWL.js","./react-dom-DPxgxlDT.js","./dist-DRO03ovd.js","./es2015-B9_uRFGw.js","./x-BcfoD9-8.js","./createLucideIcon-B6ULg5PN.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-HKX9wT1K.js";import{i as c,n as l,t as u}from"./tooltip-DVBVVaAs.js";import{t as d}from"./switch-iwBsEWej.js";import{t as f}from"./arrow-up-right-B3B9a7te.js";import{t as p}from"./spinner-D7ppCG-D.js";import{t as m}from"./refresh-cw-DS83hBu6.js";import{t as h}from"./undo-2--eop4_Wq.js";import{t as g}from"./use-skill-origin-C2zSJntJ.js";var _=o(),v=e(r(),1),y=n(),b=(0,v.lazy)(async()=>({default:(await t(()=>import(`./SkillUpdateConflictDialog-BTP9zIit.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url)).SkillUpdateConflictDialog}));function x(e){let t=(0,_.c)(48),{scope:n,name:r}=e,{_:o}=a(),x;t[0]!==r||t[1]!==n?(x={scope:n,name:r},t[0]=r,t[1]=n,t[2]=x):x=t[2];let{origin:S,github:C,displaySource:w,importedTitle:T,canReimport:E,updateAvailable:D,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=g(x),[R,z]=(0,v.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!S)return null;let W;t[9]!==w||t[10]!==C||t[11]!==T?(W=C?(0,y.jsxs)(`a`,{href:C,target:`_blank`,rel:`noreferrer`,title:T??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:w}),(0,y.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,y.jsx)(`span`,{title:T??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:w}),t[9]=w,t[10]=C,t[11]=T,t[12]=W):W=t[12];let G;t[13]!==o||t[14]!==k||t[15]!==E||t[16]!==A||t[17]!==j?(G=E?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,y.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,y.jsx)(i,{id:`2M0JF6`})}),(0,y.jsx)(d,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":o({id:`o9fPtM`}),className:`scale-75`})]})}),(0,y.jsx)(l,{side:`bottom`,children:A?(0,y.jsx)(i,{id:`vy_VIN`}):k?(0,y.jsx)(i,{id:`vGQxBT`}):(0,y.jsx)(i,{id:`9p_QBN`})})]}):null,t[13]=o,t[14]=k,t[15]=E,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,y.jsx)(i,{id:`tgWuMB`})})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==o||t[22]!==E||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&E&&M?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":o({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[L?(0,y.jsx)(p,{icon:h,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(h,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,y.jsx)(i,{id:`fIJtam`}):(0,y.jsx)(i,{id:`jJdwCB`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`XSb9HS`})})]}):null,t[21]=o,t[22]=E,t[23]=O,t[24]=P,t[25]=I,t[26]=M,t[27]=L,t[28]=q):q=t[28];let J;t[29]!==o||t[30]!==E||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==D?(J=E&&D?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":o({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[P?(0,y.jsx)(p,{icon:m,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(m,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,y.jsx)(i,{id:`JL3si7`}):(0,y.jsx)(i,{id:`EkH9pt`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`GidGkh`})})]}):null,t[29]=o,t[30]=E,t[31]=V,t[32]=P,t[33]=L,t[34]=D,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==r||t[38]!==U||t[39]!==P?(Y=R?(0,y.jsx)(v.Suspense,{fallback:null,children:(0,y.jsx)(b,{open:!0,onOpenChange:e=>{e||z(null)},skillName:r,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()})}):null,t[36]=R,t[37]=r,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{x as SkillOriginInline};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillUpdateConflictDialog-kz67-4EX.js","./dist-Nvb76hAm.js","./chunk-CYidjpOJ.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./pierre-theme-DSY2leqq.js","./preload-helper-Chd9yIcd.js","./engine-compile-DCy0BQ6p.js","./lib-DmueaA5E.js","./html-void-elements-zEl0KGqf.js","./ok-syntax-theme-CbtG1O48.js","./MultiFileDiff-DBMOvxJx.js","./button-BeFNZANd.js","./dist-BHv-mziD.js","./bundle-mjs-SHeFpKGC.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./dialog-BfHNtxM9.js","./electron-drag-strip-BgiQs0O3.js","./dist-BcvirUWL.js","./react-dom-DPxgxlDT.js","./dist-DRO03ovd.js","./es2015-B9_uRFGw.js","./x-BcfoD9-8.js","./createLucideIcon-B6ULg5PN.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-BeFNZANd.js";import{i as c,n as l,t as u}from"./tooltip-DVBVVaAs.js";import{t as d}from"./switch-iwBsEWej.js";import{t as f}from"./arrow-up-right-B3B9a7te.js";import{t as p}from"./spinner-D7ppCG-D.js";import{t as m}from"./refresh-cw-DS83hBu6.js";import{t as h}from"./undo-2--eop4_Wq.js";import{t as g}from"./use-skill-origin-C2zSJntJ.js";var _=o(),v=e(r(),1),y=n(),b=(0,v.lazy)(async()=>({default:(await t(()=>import(`./SkillUpdateConflictDialog-kz67-4EX.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url)).SkillUpdateConflictDialog}));function x(e){let t=(0,_.c)(48),{scope:n,name:r}=e,{_:o}=a(),x;t[0]!==r||t[1]!==n?(x={scope:n,name:r},t[0]=r,t[1]=n,t[2]=x):x=t[2];let{origin:S,github:C,displaySource:w,importedTitle:T,canReimport:E,updateAvailable:D,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=g(x),[R,z]=(0,v.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!S)return null;let W;t[9]!==w||t[10]!==C||t[11]!==T?(W=C?(0,y.jsxs)(`a`,{href:C,target:`_blank`,rel:`noreferrer`,title:T??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:w}),(0,y.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,y.jsx)(`span`,{title:T??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:w}),t[9]=w,t[10]=C,t[11]=T,t[12]=W):W=t[12];let G;t[13]!==o||t[14]!==k||t[15]!==E||t[16]!==A||t[17]!==j?(G=E?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,y.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,y.jsx)(i,{id:`2M0JF6`})}),(0,y.jsx)(d,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":o({id:`o9fPtM`}),className:`scale-75`})]})}),(0,y.jsx)(l,{side:`bottom`,children:A?(0,y.jsx)(i,{id:`vy_VIN`}):k?(0,y.jsx)(i,{id:`vGQxBT`}):(0,y.jsx)(i,{id:`9p_QBN`})})]}):null,t[13]=o,t[14]=k,t[15]=E,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,y.jsx)(i,{id:`tgWuMB`})})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==o||t[22]!==E||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&E&&M?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":o({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[L?(0,y.jsx)(p,{icon:h,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(h,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,y.jsx)(i,{id:`fIJtam`}):(0,y.jsx)(i,{id:`jJdwCB`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`XSb9HS`})})]}):null,t[21]=o,t[22]=E,t[23]=O,t[24]=P,t[25]=I,t[26]=M,t[27]=L,t[28]=q):q=t[28];let J;t[29]!==o||t[30]!==E||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==D?(J=E&&D?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":o({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[P?(0,y.jsx)(p,{icon:m,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(m,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,y.jsx)(i,{id:`JL3si7`}):(0,y.jsx)(i,{id:`EkH9pt`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`GidGkh`})})]}):null,t[29]=o,t[30]=E,t[31]=V,t[32]=P,t[33]=L,t[34]=D,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==r||t[38]!==U||t[39]!==P?(Y=R?(0,y.jsx)(v.Suspense,{fallback:null,children:(0,y.jsx)(b,{open:!0,onOpenChange:e=>{e||z(null)},skillName:r,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()})}):null,t[36]=R,t[37]=r,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{x as SkillOriginInline};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-HKX9wT1K.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./select-D_BhUvh8.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-B5wgFBcs.js";import{a as y,h as b,r as x,t as S,u as C}from"./dropdown-menu-raSZ06x1.js";import{y as w}from"./SkillInstallMenu-DpmMcdPv.js";import{t as T}from"./list-plus-M50FahtU.js";import{p as E,t as D}from"./skill-scope-B73Ci61z.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(p,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(d,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(c,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(l,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(u,{align:`end`,children:(0,k.jsxs)(f,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==s||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(m,{value:n,onValueChange:v,disabled:s,children:[S,T]}),t[15]=s,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,k.jsx)(h,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:c,problemCount:l,problemMessages:u}=e,{_:d}=i(),f;t[0]!==a||t[1]!==n?(f={scope:n,name:a},t[0]=a,t[1]=n,t[2]=f):f=t[2];let p=M(f),m;t[3]!==p.requestMove||t[4]!==n?(m=(0,k.jsx)(A,{value:n,onRequestMove:p.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=p.requestMove,t[4]=n,t[5]=m):m=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==m||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,h]}),t[9]=m,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:c,problemCount:l,problemMessages:u,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=c,t[13]=l,t[14]=u,t[15]=o,t[16]=D):D=t[16];let j;t[17]===d?j=t[18]:(j=d({id:`Yzs3QX`}),t[17]=d,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(b,{asChild:!0,children:(0,k.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===p?F=t[23]:(F=e=>p.requestMove(e),t[22]=p,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==c||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(C,{}),(0,k.jsxs)(y,{onSelect:c,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=c,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(x,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(S,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==p.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,p.dialog]}),t[36]=p.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N as SkillToolbarControls};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-BeFNZANd.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./select-D_BhUvh8.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-C-iLRZ1e.js";import{a as y,h as b,r as x,t as S,u as C}from"./dropdown-menu-raSZ06x1.js";import{y as w}from"./SkillInstallMenu-DBCnHXH-.js";import{t as T}from"./list-plus-M50FahtU.js";import{p as E,t as D}from"./skill-scope-B73Ci61z.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(p,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(d,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(c,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(l,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(u,{align:`end`,children:(0,k.jsxs)(f,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==s||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(m,{value:n,onValueChange:v,disabled:s,children:[S,T]}),t[15]=s,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,k.jsx)(h,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:c,problemCount:l,problemMessages:u}=e,{_:d}=i(),f;t[0]!==a||t[1]!==n?(f={scope:n,name:a},t[0]=a,t[1]=n,t[2]=f):f=t[2];let p=M(f),m;t[3]!==p.requestMove||t[4]!==n?(m=(0,k.jsx)(A,{value:n,onRequestMove:p.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=p.requestMove,t[4]=n,t[5]=m):m=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==m||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,h]}),t[9]=m,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:c,problemCount:l,problemMessages:u,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=c,t[13]=l,t[14]=u,t[15]=o,t[16]=D):D=t[16];let j;t[17]===d?j=t[18]:(j=d({id:`Yzs3QX`}),t[17]=d,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(b,{asChild:!0,children:(0,k.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===p?F=t[23]:(F=e=>p.requestMove(e),t[22]=p,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==c||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(C,{}),(0,k.jsxs)(y,{onSelect:c,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=c,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(x,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(S,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==p.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,p.dialog]}),t[36]=p.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N as SkillToolbarControls};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./button-HKX9wT1K.js";import{a as i,c as a,i as o,n as s,o as c,s as l,t as u}from"./dialog-Q2r_wm4I.js";import{t as d}from"./MultiFileDiff-DBMOvxJx.js";import{t as f}from"./pierre-theme-DSY2leqq.js";var p=n(),m=e();function h(e){let n=(0,p.c)(38),{open:h,onOpenChange:g,skillName:_,localBody:v,upstreamBody:y,applying:b,onTakeUpstream:x}=e,S;n[0]===_?S=n[1]:(S=(0,m.jsx)(a,{children:(0,m.jsx)(t,{id:`EPKVES`,values:{skillName:_}})}),n[0]=_,n[1]=S);let C;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,m.jsx)(i,{children:(0,m.jsx)(t,{id:`kKw0H3`})}),n[2]=C):C=n[2];let w;n[3]===S?w=n[4]:(w=(0,m.jsxs)(l,{children:[S,C]}),n[3]=S,n[4]=w);let T;n[5]!==v||n[6]!==_?(T={name:_,contents:v},n[5]=v,n[6]=_,n[7]=T):T=n[7];let E;n[8]!==_||n[9]!==y?(E={name:_,contents:y},n[8]=_,n[9]=y,n[10]=E):E=n[10];let D;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(D={overflow:`wrap`,diffStyle:`unified`,theme:f()},n[11]=D):D=n[11];let O;n[12]!==T||n[13]!==E?(O=(0,m.jsx)(s,{className:`min-h-0 flex-1 overflow-auto`,children:(0,m.jsx)(d,{className:`pierre-diff`,oldFile:T,newFile:E,options:D})}),n[12]=T,n[13]=E,n[14]=O):O=n[14];let k;n[15]===g?k=n[16]:(k=()=>g(!1),n[15]=g,n[16]=k);let A;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,m.jsx)(t,{id:`Tq3pcs`}),n[17]=A):A=n[17];let j;n[18]!==b||n[19]!==k?(j=(0,m.jsx)(r,{variant:`outline`,onClick:k,disabled:b,children:A}),n[18]=b,n[19]=k,n[20]=j):j=n[20];let M;n[21]===b?M=n[22]:(M=b?(0,m.jsx)(t,{id:`JL3si7`}):(0,m.jsx)(t,{id:`qkqG0b`}),n[21]=b,n[22]=M);let N;n[23]!==b||n[24]!==x||n[25]!==M?(N=(0,m.jsx)(r,{onClick:x,disabled:b,children:M}),n[23]=b,n[24]=x,n[25]=M,n[26]=N):N=n[26];let P;n[27]!==j||n[28]!==N?(P=(0,m.jsxs)(c,{children:[j,N]}),n[27]=j,n[28]=N,n[29]=P):P=n[29];let F;n[30]!==P||n[31]!==w||n[32]!==O?(F=(0,m.jsxs)(o,{className:`flex max-h-[85vh] flex-col sm:max-w-5xl`,children:[w,O,P]}),n[30]=P,n[31]=w,n[32]=O,n[33]=F):F=n[33];let I;return n[34]!==g||n[35]!==h||n[36]!==F?(I=(0,m.jsx)(u,{open:h,onOpenChange:g,children:F}),n[34]=g,n[35]=h,n[36]=F,n[37]=I):I=n[37],I}export{h as SkillUpdateConflictDialog};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./button-BeFNZANd.js";import{a as i,c as a,i as o,n as s,o as c,s as l,t as u}from"./dialog-BfHNtxM9.js";import{t as d}from"./MultiFileDiff-DBMOvxJx.js";import{t as f}from"./pierre-theme-DSY2leqq.js";var p=n(),m=e();function h(e){let n=(0,p.c)(38),{open:h,onOpenChange:g,skillName:_,localBody:v,upstreamBody:y,applying:b,onTakeUpstream:x}=e,S;n[0]===_?S=n[1]:(S=(0,m.jsx)(a,{children:(0,m.jsx)(t,{id:`EPKVES`,values:{skillName:_}})}),n[0]=_,n[1]=S);let C;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,m.jsx)(i,{children:(0,m.jsx)(t,{id:`kKw0H3`})}),n[2]=C):C=n[2];let w;n[3]===S?w=n[4]:(w=(0,m.jsxs)(l,{children:[S,C]}),n[3]=S,n[4]=w);let T;n[5]!==v||n[6]!==_?(T={name:_,contents:v},n[5]=v,n[6]=_,n[7]=T):T=n[7];let E;n[8]!==_||n[9]!==y?(E={name:_,contents:y},n[8]=_,n[9]=y,n[10]=E):E=n[10];let D;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(D={overflow:`wrap`,diffStyle:`unified`,theme:f()},n[11]=D):D=n[11];let O;n[12]!==T||n[13]!==E?(O=(0,m.jsx)(s,{className:`min-h-0 flex-1 overflow-auto`,children:(0,m.jsx)(d,{className:`pierre-diff`,oldFile:T,newFile:E,options:D})}),n[12]=T,n[13]=E,n[14]=O):O=n[14];let k;n[15]===g?k=n[16]:(k=()=>g(!1),n[15]=g,n[16]=k);let A;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,m.jsx)(t,{id:`Tq3pcs`}),n[17]=A):A=n[17];let j;n[18]!==b||n[19]!==k?(j=(0,m.jsx)(r,{variant:`outline`,onClick:k,disabled:b,children:A}),n[18]=b,n[19]=k,n[20]=j):j=n[20];let M;n[21]===b?M=n[22]:(M=b?(0,m.jsx)(t,{id:`JL3si7`}):(0,m.jsx)(t,{id:`qkqG0b`}),n[21]=b,n[22]=M);let N;n[23]!==b||n[24]!==x||n[25]!==M?(N=(0,m.jsx)(r,{onClick:x,disabled:b,children:M}),n[23]=b,n[24]=x,n[25]=M,n[26]=N):N=n[26];let P;n[27]!==j||n[28]!==N?(P=(0,m.jsxs)(c,{children:[j,N]}),n[27]=j,n[28]=N,n[29]=P):P=n[29];let F;n[30]!==P||n[31]!==w||n[32]!==O?(F=(0,m.jsxs)(o,{className:`flex max-h-[85vh] flex-col sm:max-w-5xl`,children:[w,O,P]}),n[30]=P,n[31]=w,n[32]=O,n[33]=F):F=n[33];let I;return n[34]!==g||n[35]!==h||n[36]!==F?(I=(0,m.jsx)(u,{open:h,onOpenChange:g,children:F}),n[34]=g,n[35]=h,n[36]=F,n[37]=I):I=n[37],I}export{h as SkillUpdateConflictDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-HKX9wT1K.js";import{i as s,n as c,t as l}from"./tooltip-DVBVVaAs.js";import{On as u}from"./dist-bQ5kvrpa.js";import{t as d}from"./trace-api-BP9dN1Hz.js";import{n as f}from"./dist-CJhtNlOm2.js";import{n as p,t as m}from"./workspace-paths-Dczkx4vn.js";import{n as h}from"./use-workspace-CchUoI6W.js";import{t as g}from"./createLucideIcon-B6ULg5PN.js";var _=g(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{d.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=u(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=u(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();async function E(e,t,n,r){let i=f.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){f.dismiss(i);return}if(a.reason===`cancelled`){f.dismiss(i);return}let o,s=!1;switch(a.reason){case`timeout`:o=n.timeout,s=!0;break;case`exited-early`:case`renderer-failed`:o=n.renderFailed,s=!0;break;case`load-failed`:o=n.openFailed,s=!0;break;case`unsupported-server`:o=n.unsupported;break;case`spawn-error`:case`port-error`:o=n.startFailed,s=!0;break;case`not-available`:case`invalid-path`:o=n.openFailed;break;default:a.reason,o=n.openFailed}f.error(o,{id:i,...s?{action:{label:n.retry,onClick:r}}:{}})}catch(e){console.warn(`[slides] open dispatch failed:`,e instanceof Error?e:String(e)),f.error(n.openFailed,{id:i,action:{label:n.retry,onClick:r}})}}async function D(e,t,n,r,i,a){if(!r.current.has(t)){r.current.add(t);try{i(new Set(r.current)),a&&S(),await E(e,t,n,()=>{D(e,t,n,r,i,!1)})}finally{r.current.delete(t),i(new Set(r.current))}}}function O(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function k(e){let t=(0,y.c)(12),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),f=O(d),g=h(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!d||f!==`available`)return null;let C=g==null?null:p(g.contentDir,m(a),g.pathSeparator),E=async function(){let e=window.okDesktop?.slides;e==null||C==null||await D(e,C,{opening:u({id:`PKLY-1`}),timeout:u({id:`NeY1Np`}),renderFailed:u({id:`Lm3r51`}),openFailed:u({id:`X59Fx2`}),unsupported:u({id:`T_j5G0`}),startFailed:u({id:`TBfy1C`}),retry:u({id:`KDw4GX`})},b,S,!0)},k=l,j=o,M;t[0]===u?M=t[1]:(M=u({id:`w52SKa`}),t[0]=u,t[1]=M);let N=C!=null&&x.has(C),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[2]=P):P=t[2];let F;t[3]!==j||t[4]!==E||t[5]!==M||t[6]!==N?(F=(0,T.jsx)(j,{variant:`ghost`,size:`icon`,onClick:E,"aria-label":M,"aria-busy":N,"data-testid":`slides-toolbar-action`,asChild:!0,children:P}),t[3]=j,t[4]=E,t[5]=M,t[6]=N,t[7]=F):F=t[7];let I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[8]=I):I=t[8];let L;return t[9]!==k||t[10]!==F?(L=(0,T.jsxs)(k,{children:[F,I]}),t[9]=k,t[10]=F,t[11]=L):L=t[11],L}function A(){return new Set}export{k as SlidesToolbarControls};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-BeFNZANd.js";import{i as s,n as c,t as l}from"./tooltip-DVBVVaAs.js";import{On as u}from"./dist-bQ5kvrpa.js";import{t as d}from"./trace-api-BP9dN1Hz.js";import{n as f}from"./dist-CJhtNlOm2.js";import{n as p,t as m}from"./workspace-paths-Dczkx4vn.js";import{n as h}from"./use-workspace-CchUoI6W.js";import{t as g}from"./createLucideIcon-B6ULg5PN.js";var _=g(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{d.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=u(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=u(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();async function E(e,t,n,r){let i=f.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){f.dismiss(i);return}if(a.reason===`cancelled`){f.dismiss(i);return}let o,s=!1;switch(a.reason){case`timeout`:o=n.timeout,s=!0;break;case`exited-early`:case`renderer-failed`:o=n.renderFailed,s=!0;break;case`load-failed`:o=n.openFailed,s=!0;break;case`unsupported-server`:o=n.unsupported;break;case`spawn-error`:case`port-error`:o=n.startFailed,s=!0;break;case`not-available`:case`invalid-path`:o=n.openFailed;break;default:a.reason,o=n.openFailed}f.error(o,{id:i,...s?{action:{label:n.retry,onClick:r}}:{}})}catch(e){console.warn(`[slides] open dispatch failed:`,e instanceof Error?e:String(e)),f.error(n.openFailed,{id:i,action:{label:n.retry,onClick:r}})}}async function D(e,t,n,r,i,a){if(!r.current.has(t)){r.current.add(t);try{i(new Set(r.current)),a&&S(),await E(e,t,n,()=>{D(e,t,n,r,i,!1)})}finally{r.current.delete(t),i(new Set(r.current))}}}function O(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function k(e){let t=(0,y.c)(12),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),f=O(d),g=h(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!d||f!==`available`)return null;let C=g==null?null:p(g.contentDir,m(a),g.pathSeparator),E=async function(){let e=window.okDesktop?.slides;e==null||C==null||await D(e,C,{opening:u({id:`PKLY-1`}),timeout:u({id:`NeY1Np`}),renderFailed:u({id:`Lm3r51`}),openFailed:u({id:`X59Fx2`}),unsupported:u({id:`T_j5G0`}),startFailed:u({id:`TBfy1C`}),retry:u({id:`KDw4GX`})},b,S,!0)},k=l,j=o,M;t[0]===u?M=t[1]:(M=u({id:`w52SKa`}),t[0]=u,t[1]=M);let N=C!=null&&x.has(C),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[2]=P):P=t[2];let F;t[3]!==j||t[4]!==E||t[5]!==M||t[6]!==N?(F=(0,T.jsx)(j,{variant:`ghost`,size:`icon`,onClick:E,"aria-label":M,"aria-busy":N,"data-testid":`slides-toolbar-action`,asChild:!0,children:P}),t[3]=j,t[4]=E,t[5]=M,t[6]=N,t[7]=F):F=t[7];let I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[8]=I):I=t[8];let L;return t[9]!==k||t[10]!==F?(L=(0,T.jsxs)(k,{children:[F,I]}),t[9]=k,t[10]=F,t[11]=L):L=t[11],L}function A(){return new Set}export{k as SlidesToolbarControls};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Ct as n,In as r,Kt as i,Ot as a,Wt as o,X as s,gt as c,jn as l,kt as u,ln as d,un as f,vt as p,yt as m}from"./DocumentContext-Dlldf3A6.js";import{t as h}from"./react-f2sANaYj.js";import{n as g}from"./dist-PQ5KMVDh.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{Ei as v,Hs as y,O as b,ba as ee,qs as x,rc as S}from"./dist-bQ5kvrpa.js";import{i as te}from"./use-apply-config-theme-B5w38X1P.js";import{H as ne,I as re,L as ie,N as ae,T as oe,b as C,c as se,n as ce,o as w,r as le,t as ue,v as T,w as de,z as fe}from"./typing-burst-detector-BEdXQddD.js";import{S as E,a as pe,et as D,gt as me,i as he,nt as O,o as ge,vt as k,z as A}from"./CodeMirrorPropInput-CjC1gT00.js";import{t as j}from"./diagnostic-breadcrumb-BUuIuodI.js";import{a as M}from"./startup-marks-c2tjYHWa.js";import{p as _e}from"./config-provider-owr5M3NH.js";import{$ as N,At as P,Ct as F,E as I,J as L,K as R,Mt as z,N as B,Nt as V,Tt as ve,X as H,at as U,b as W,et as G,ft as ye,g as K,l as q,lt as be,ot as J,pt as Y,st as X,tt as Z,ut as xe,v as Se,wt as Ce}from"./dist-CYYyr4TA.js";import{i as we,t as Te}from"./dist-Cub9j0fk.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-CnckO2KZ.js";import{o as Ae,r as je}from"./selection-context-4lSNiVN-.js";import{l as Me}from"./lint-config-client-C26s8yTI.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-BndrMS2u.js";import{n as Be,t as Ve}from"./src-C5n8TKJq.js";var Q=e(h(),1),He=_();function Ue(){let e=a();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=B(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);x.lastIndex=0;for(let e=x.exec(t);e!==null;e=x.exec(t)){let t=e[2];if(!S(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(R.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(l!==void 0&&S(l)&&n!=null)return r.push(R.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=c.exec(s);if(u)return r.push(R.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(r)}function Ge(e){let t=m(e);return t===null?[]:[H.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),L.domEventHandlers({mousedown(r){let i=r.target?.closest?.(`[data-skill-ref]`),o=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(o!==void 0){r.preventDefault();let e=a()?.get(o);return e===void 0?n():window.location.hash=u(o,e),!0}let s=r.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(r.preventDefault(),window.location.hash=p(t,e,c),!0)}})]}var Ke=R.line({attributes:{dir:`auto`}});function qe(e){let t=new P;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=H.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[L.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=K(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:C(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=z.define();function rt(e){let t={findings:[]};return[Pe(e=>D()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),H.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=T(e,e=>{e.status===`loaded`&&r(e.findings)}),a=O(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await v(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[xe(),J(),X(),Se(),G(),Z(),ve.allowMultipleSelections.of(!0),I(),q(),ke(),De(),Y(),N(),U(),Ne(),be.of([...Ee,...Te,...Re,...W,...Oe,...Le])],ct=R.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return B(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),R.set(a)}var ht=V.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>L.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=R.mark({class:`cm-del`}),vt=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=R.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!y.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(y.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=B(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=R.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=R.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=H.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),M(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return H.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=z.define();function Nt(e,t){try{At(t.view,!1)}finally{try{f(t)}finally{k(e,t.view)}}}function Pt(e,t,n){let i=w(e.state.doc),a=i[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:i.length};if(!a){j(ce,{...o,outcome:`no-target`});return}let s=r(n,`outline`,()=>{e.dispatch({selection:Ce.cursor(a.from),effects:L.scrollIntoView(a.from,{y:`start`})}),e.focus()});j(ce,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,i){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);r(i,`raw-mdx`,()=>{e.dispatch({selection:Ce.cursor(o),effects:L.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let i=e.state.doc,a=Math.min(Math.max(t.line,1),i.lines),o=i.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return r(n,`problems-row`,()=>{e.dispatch({selection:Ce.cursor(s),effects:L.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:a,placeholder:c,isSourceModeActive:u}=e,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let{resolvedTheme:_}=g(),{merged:v}=te(),y=(0,Q.useRef)(u),x=v?.editor?.wordWrap??!0,{data:S}=Me(n),C;t[0]!==S?.effective||t[1]!==v?(C=S?.effective??(v?.contentRules?ee(v.contentRules):b),t[0]=S?.effective,t[1]=v,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,D=(0,Q.useRef)(null),O;t[5]!==n||t[6]!==u||t[7]!==w||t[8]!==c||t[9]!==a||t[10]!==_||t[11]!==x||t[12]!==r?(O=()=>{let e=f.current;if(!e)return;let t=a.configuration.name??``,m,g=zt;try{m=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let u=null,d=new _e(r);try{let f=s({ydoc:a.document,ytext:r,docName:t}),p=new F,m=new F,h=new F,v=new F,y=new L({state:ve.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>l(t,`find-match`)?L.scrollIntoView(e,{y:`start`}):Mt.of(null)}),be.of([we]),Ve(r,a.awareness,{undoManager:d}),be.of(Be),kt({docName:t,ytext:r,undoManager:d}),...he({themeCompartment:p,resolvedTheme:_,ydoc:a.document,wordWrapCompartment:m,wordWrap:x,currentDocName:t}),Tt(),Ge(t),ne(),v.of(it(w,n)),rt(n),f,L.updateListener.of(e=>{o(e)&&i(t)}),L.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(u!==null&&clearTimeout(u),u=setTimeout(()=>{u=null,de(t,`source`,oe(e.view)),je(t,`source`,Ae(e.view,t))},120))}),h.of(ye(c??``)),L.theme({"&":{height:`100%`}}),L.scrollMargins.of(Rt)]}),parent:e});de(t,`source`,oe(y)),je(t,`source`,Ae(y,t));let b=y.contentDOM;return b.addEventListener(`keydown`,g),b.addEventListener(`paste`,g),b.addEventListener(`drop`,g),b.addEventListener(`cut`,g),{view:y,ydoc:a.document,ytext:r,provider:a,undoManager:d,themeCompartment:p,wordWrapCompartment:m,placeholderCompartment:h,lintCompartment:v}}catch(e){let t=e;throw d.destroy(),t}}}),D.current=m,p.current=m.view,At(m.view,u),me(n,m.view,`sourceEditor`),ue()&&m.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),D.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=D.current;D.current=null,p.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=u,t[7]=w,t[8]=c,t[9]=a,t[10]=_,t[11]=x,t[12]=r,t[13]=O):O=t[13];let k;t[14]!==a||t[15]!==r?(k=[r,a],t[14]=a,t[15]=r,t[16]=k):k=t[16],(0,Q.useEffect)(O,k);let A,M;t[17]===u?(A=t[18],M=t[19]):(A=()=>{y.current=u;let e=p.current;e&&At(e,u)},M=[u],t[17]=u,t[18]=A,t[19]=M),(0,Q.useEffect)(A,M);let N,P;t[20]===n?(N=t[21],P=t[22]):(N=()=>{},P=[n],t[20]=n,t[21]=N,t[22]=P),(0,Q.useEffect)(N,P);let I,R;t[23]===_?(I=t[24],R=t[25]):(R=()=>{let e=D.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?pe:ge)})},I=[_],t[23]=_,t[24]=I,t[25]=R),(0,Q.useEffect)(R,I);let z,B;t[26]===x?(z=t[27],B=t[28]):(z=()=>{let e=D.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?L.lineWrapping:[])})},B=[x],t[26]=x,t[27]=z,t[28]=B),(0,Q.useEffect)(z,B);let V,H;t[29]===c?(V=t[30],H=t[31]):(V=()=>{let e=D.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ye(c??``))})},H=[c],t[29]=c,t[30]=V,t[31]=H),(0,Q.useEffect)(V,H);let U;t[32]!==n||t[33]!==w?(U=()=>{let e=D.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(w,n))})},t[32]=n,t[33]=w,t[34]=U):U=t[34];let W;t[35]===E?W=t[36]:(W=[E],t[35]=E,t[36]=W),(0,Q.useEffect)(U,W);let G,K;t[37]!==n||t[38]!==u?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!u)return;let r=p.current;if(!r){j(ce,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),re(n)};return window.addEventListener(le,e),()=>window.removeEventListener(le,e)},K=[n,u],t[37]=n,t[38]=u,t[39]=G,t[40]=K):(G=t[39],K=t[40]),(0,Q.useEffect)(G,K);let q,J;t[41]!==n||t[42]!==u?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!u)return;let r=p.current;r&&It(r,t,n)&&re(n)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,u],t[41]=n,t[42]=u,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==u||t[47]!==a?(Y=()=>{if(!u)return;let e=p.current;if(!e)return;let t=fe(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=fe(n);t?.kind===`selection-offset`&&(i=ae({view:e,docName:n,navigation:t,ydoc:a.document,transition:{from:`wysiwyg`,to:`source`}}),i&&ie(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},X=[n,u,a],t[45]=n,t[46]=u,t[47]=a,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:E()}}function zt(){return A()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Ct as n,In as r,Kt as i,Ot as a,Wt as o,X as s,gt as c,jn as l,kt as u,ln as d,un as f,vt as p,yt as m}from"./DocumentContext-DjP4XRJx.js";import{t as h}from"./react-f2sANaYj.js";import{n as g}from"./dist-PQ5KMVDh.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{Ei as v,Hs as y,O as b,ba as ee,qs as x,rc as S}from"./dist-bQ5kvrpa.js";import{i as te}from"./use-apply-config-theme-B5w38X1P.js";import{H as ne,I as re,L as ie,N as ae,T as oe,b as C,c as se,n as ce,o as w,r as le,t as ue,v as T,w as de,z as fe}from"./typing-burst-detector-BI7H8DPb.js";import{S as E,a as pe,et as D,gt as me,i as he,nt as O,o as ge,vt as k,z as A}from"./CodeMirrorPropInput-C6PE1vK2.js";import{t as j}from"./diagnostic-breadcrumb-BUuIuodI.js";import{a as M}from"./startup-marks-c2tjYHWa.js";import{p as _e}from"./config-provider-CTHdqAYx.js";import{$ as N,At as P,Ct as F,E as I,J as L,K as R,Mt as z,N as B,Nt as V,Tt as ve,X as H,at as U,b as W,et as G,ft as ye,g as K,l as q,lt as be,ot as J,pt as Y,st as X,tt as Z,ut as xe,v as Se,wt as Ce}from"./dist-CYYyr4TA.js";import{i as we,t as Te}from"./dist-Cub9j0fk.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-CnckO2KZ.js";import{o as Ae,r as je}from"./selection-context-LrE0_TTe.js";import{l as Me}from"./lint-config-client-C26s8yTI.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-BndrMS2u.js";import{n as Be,t as Ve}from"./src-BxNPgEkh.js";var Q=e(h(),1),He=_();function Ue(){let e=a();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=B(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);x.lastIndex=0;for(let e=x.exec(t);e!==null;e=x.exec(t)){let t=e[2];if(!S(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(R.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(l!==void 0&&S(l)&&n!=null)return r.push(R.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=c.exec(s);if(u)return r.push(R.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(r)}function Ge(e){let t=m(e);return t===null?[]:[H.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),L.domEventHandlers({mousedown(r){let i=r.target?.closest?.(`[data-skill-ref]`),o=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(o!==void 0){r.preventDefault();let e=a()?.get(o);return e===void 0?n():window.location.hash=u(o,e),!0}let s=r.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(r.preventDefault(),window.location.hash=p(t,e,c),!0)}})]}var Ke=R.line({attributes:{dir:`auto`}});function qe(e){let t=new P;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=H.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[L.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=K(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:C(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=z.define();function rt(e){let t={findings:[]};return[Pe(e=>D()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),H.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=T(e,e=>{e.status===`loaded`&&r(e.findings)}),a=O(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await v(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[xe(),J(),X(),Se(),G(),Z(),ve.allowMultipleSelections.of(!0),I(),q(),ke(),De(),Y(),N(),U(),Ne(),be.of([...Ee,...Te,...Re,...W,...Oe,...Le])],ct=R.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return B(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),R.set(a)}var ht=V.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>L.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=R.mark({class:`cm-del`}),vt=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=R.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!y.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(y.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=B(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=R.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=R.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||B(e.startState)!==B(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=H.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),M(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return H.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=z.define();function Nt(e,t){try{At(t.view,!1)}finally{try{f(t)}finally{k(e,t.view)}}}function Pt(e,t,n){let i=w(e.state.doc),a=i[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:i.length};if(!a){j(ce,{...o,outcome:`no-target`});return}let s=r(n,`outline`,()=>{e.dispatch({selection:Ce.cursor(a.from),effects:L.scrollIntoView(a.from,{y:`start`})}),e.focus()});j(ce,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,i){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);r(i,`raw-mdx`,()=>{e.dispatch({selection:Ce.cursor(o),effects:L.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let i=e.state.doc,a=Math.min(Math.max(t.line,1),i.lines),o=i.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return r(n,`problems-row`,()=>{e.dispatch({selection:Ce.cursor(s),effects:L.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:a,placeholder:c,isSourceModeActive:u}=e,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let{resolvedTheme:_}=g(),{merged:v}=te(),y=(0,Q.useRef)(u),x=v?.editor?.wordWrap??!0,{data:S}=Me(n),C;t[0]!==S?.effective||t[1]!==v?(C=S?.effective??(v?.contentRules?ee(v.contentRules):b),t[0]=S?.effective,t[1]=v,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,D=(0,Q.useRef)(null),O;t[5]!==n||t[6]!==u||t[7]!==w||t[8]!==c||t[9]!==a||t[10]!==_||t[11]!==x||t[12]!==r?(O=()=>{let e=f.current;if(!e)return;let t=a.configuration.name??``,m,g=zt;try{m=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let u=null,d=new _e(r);try{let f=s({ydoc:a.document,ytext:r,docName:t}),p=new F,m=new F,h=new F,v=new F,y=new L({state:ve.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>l(t,`find-match`)?L.scrollIntoView(e,{y:`start`}):Mt.of(null)}),be.of([we]),Ve(r,a.awareness,{undoManager:d}),be.of(Be),kt({docName:t,ytext:r,undoManager:d}),...he({themeCompartment:p,resolvedTheme:_,ydoc:a.document,wordWrapCompartment:m,wordWrap:x,currentDocName:t}),Tt(),Ge(t),ne(),v.of(it(w,n)),rt(n),f,L.updateListener.of(e=>{o(e)&&i(t)}),L.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(u!==null&&clearTimeout(u),u=setTimeout(()=>{u=null,de(t,`source`,oe(e.view)),je(t,`source`,Ae(e.view,t))},120))}),h.of(ye(c??``)),L.theme({"&":{height:`100%`}}),L.scrollMargins.of(Rt)]}),parent:e});de(t,`source`,oe(y)),je(t,`source`,Ae(y,t));let b=y.contentDOM;return b.addEventListener(`keydown`,g),b.addEventListener(`paste`,g),b.addEventListener(`drop`,g),b.addEventListener(`cut`,g),{view:y,ydoc:a.document,ytext:r,provider:a,undoManager:d,themeCompartment:p,wordWrapCompartment:m,placeholderCompartment:h,lintCompartment:v}}catch(e){let t=e;throw d.destroy(),t}}}),D.current=m,p.current=m.view,At(m.view,u),me(n,m.view,`sourceEditor`),ue()&&m.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),D.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=D.current;D.current=null,p.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=u,t[7]=w,t[8]=c,t[9]=a,t[10]=_,t[11]=x,t[12]=r,t[13]=O):O=t[13];let k;t[14]!==a||t[15]!==r?(k=[r,a],t[14]=a,t[15]=r,t[16]=k):k=t[16],(0,Q.useEffect)(O,k);let A,M;t[17]===u?(A=t[18],M=t[19]):(A=()=>{y.current=u;let e=p.current;e&&At(e,u)},M=[u],t[17]=u,t[18]=A,t[19]=M),(0,Q.useEffect)(A,M);let N,P;t[20]===n?(N=t[21],P=t[22]):(N=()=>{},P=[n],t[20]=n,t[21]=N,t[22]=P),(0,Q.useEffect)(N,P);let I,R;t[23]===_?(I=t[24],R=t[25]):(R=()=>{let e=D.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?pe:ge)})},I=[_],t[23]=_,t[24]=I,t[25]=R),(0,Q.useEffect)(R,I);let z,B;t[26]===x?(z=t[27],B=t[28]):(z=()=>{let e=D.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?L.lineWrapping:[])})},B=[x],t[26]=x,t[27]=z,t[28]=B),(0,Q.useEffect)(z,B);let V,H;t[29]===c?(V=t[30],H=t[31]):(V=()=>{let e=D.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ye(c??``))})},H=[c],t[29]=c,t[30]=V,t[31]=H),(0,Q.useEffect)(V,H);let U;t[32]!==n||t[33]!==w?(U=()=>{let e=D.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(w,n))})},t[32]=n,t[33]=w,t[34]=U):U=t[34];let W;t[35]===E?W=t[36]:(W=[E],t[35]=E,t[36]=W),(0,Q.useEffect)(U,W);let G,K;t[37]!==n||t[38]!==u?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!u)return;let r=p.current;if(!r){j(ce,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),re(n)};return window.addEventListener(le,e),()=>window.removeEventListener(le,e)},K=[n,u],t[37]=n,t[38]=u,t[39]=G,t[40]=K):(G=t[39],K=t[40]),(0,Q.useEffect)(G,K);let q,J;t[41]!==n||t[42]!==u?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!u)return;let r=p.current;r&&It(r,t,n)&&re(n)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,u],t[41]=n,t[42]=u,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==u||t[47]!==a?(Y=()=>{if(!u)return;let e=p.current;if(!e)return;let t=fe(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=fe(n);t?.kind===`selection-offset`&&(i=ae({view:e,docName:n,navigation:t,ydoc:a.document,transition:{from:`wysiwyg`,to:`source`}}),i&&ie(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},X=[n,u,a],t[45]=n,t[46]=u,t[47]=a,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:E()}}function zt(){return A()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
@@ -1,4 +1,4 @@
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{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-HKX9wT1K.js";import{Ac as c,Fc as l,Ic as u,Mc as d,Oc as f,Pc as p,jc as m,kc as h,wc as g}from"./dist-bQ5kvrpa.js";import{r as _}from"./use-apply-config-theme-B5w38X1P.js";import{t as v}from"./triangle-alert--Fl5KoVX.js";import{t as y}from"./x-BcfoD9-8.js";import{f as b,p as ee,u as te}from"./doc-paths-BKrv1Wyo.js";import{n as ne}from"./page-list-cache-DP24ij3W.js";import{f as x,h as S}from"./file-tree-adapter-BqzkXC53.js";import{t as re}from"./use-live-xterm-theme-CFX30um3.js";import{i as C,r as w}from"./terminal-command-events-BQFgUjko.js";import{t as T}from"./TerminalStartingNotice-CANxPK71.js";import{a as E,f as ie,m as ae,t as D,u as O,v as k,y as oe}from"./agent-connection-status-BTfitB3U.js";var se=a();function ce(e){throw Error(`unhandled pty create reason: ${String(e)}`)}function le(e){throw Error(`unhandled pty adopt reason: ${String(e)}`)}var ue=2,de=1,fe=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(ue,Math.floor(u/e.css.cell.width)),rows:Math.max(de,Math.floor(l/e.css.cell.height))}}},pe=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],me=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],A;function j(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var he=class{constructor(){if(this.version=`6`,!A){A=new Uint8Array(65536),A.fill(1),A[0]=0,A.fill(0,1,32),A.fill(0,127,160),A.fill(2,4352,4448),A[9001]=2,A[9002]=2,A.fill(2,11904,42192),A[12351]=1,A.fill(2,44032,55204),A.fill(2,63744,64256),A.fill(2,65040,65050),A.fill(2,65072,65136),A.fill(2,65280,65377),A.fill(2,65504,65511);for(let e=0;e<pe.length;++e)A.fill(0,pe[e][0],pe[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?A[e]:j(e,me)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=pt.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return pt.createPropertyValue(0,n,r)}},M=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?be.isErrorNoTelemetry(e)?new be(e.message+`
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{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-BeFNZANd.js";import{Ac as c,Fc as l,Ic as u,Mc as d,Oc as f,Pc as p,jc as m,kc as h,wc as g}from"./dist-bQ5kvrpa.js";import{r as _}from"./use-apply-config-theme-B5w38X1P.js";import{t as v}from"./triangle-alert--Fl5KoVX.js";import{t as y}from"./x-BcfoD9-8.js";import{f as b,p as ee,u as te}from"./doc-paths-BKrv1Wyo.js";import{n as ne}from"./page-list-cache-DP24ij3W.js";import{f as x,h as S}from"./file-tree-adapter-BqzkXC53.js";import{t as re}from"./use-live-xterm-theme-CFX30um3.js";import{i as C,r as w}from"./terminal-command-events-BQFgUjko.js";import{t as T}from"./TerminalStartingNotice-BbwsOE78.js";import{a as E,f as ie,m as ae,t as D,u as O,v as k,y as oe}from"./agent-connection-status-BKDHFOP-.js";var se=a();function ce(e){throw Error(`unhandled pty create reason: ${String(e)}`)}function le(e){throw Error(`unhandled pty adopt reason: ${String(e)}`)}var ue=2,de=1,fe=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(ue,Math.floor(u/e.css.cell.width)),rows:Math.max(de,Math.floor(l/e.css.cell.height))}}},pe=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],me=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],A;function j(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var he=class{constructor(){if(this.version=`6`,!A){A=new Uint8Array(65536),A.fill(1),A[0]=0,A.fill(0,1,32),A.fill(0,127,160),A.fill(2,4352,4448),A[9001]=2,A[9002]=2,A.fill(2,11904,42192),A[12351]=1,A.fill(2,44032,55204),A.fill(2,63744,64256),A.fill(2,65040,65050),A.fill(2,65072,65136),A.fill(2,65280,65377),A.fill(2,65504,65511);for(let e=0;e<pe.length;++e)A.fill(0,pe[e][0],pe[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?A[e]:j(e,me)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=pt.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return pt.createPropertyValue(0,n,r)}},M=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?be.isErrorNoTelemetry(e)?new be(e.message+`
2
2
 
3
3
  `+e.stack):Error(e.message+`
4
4
 
@@ -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{t as o}from"./button-HKX9wT1K.js";import{t as s}from"./spinner-D7ppCG-D.js";var c=i(),l=e(n(),1),u=t(),d=8e3;function f(e){let t=(0,c.c)(23),{className:n}=e,{_:i}=r(),[f,m]=(0,l.useState)(!1),h,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=window.setTimeout(()=>m(!0),d);return()=>window.clearTimeout(e)},g=[],t[0]=h,t[1]=g):(h=t[0],g=t[1]),(0,l.useEffect)(h,g);let _=f?`true`:void 0,v;t[2]===n?v=t[3]:(v=a(`flex h-full w-full flex-col items-center justify-center gap-3 overflow-y-auto bg-background px-6 text-center text-muted-foreground text-sm`,`fade-in-0 animate-in duration-200 [animation-delay:400ms] [animation-fill-mode:backwards] motion-reduce:duration-0`,n),t[2]=n,t[3]=v);let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,u.jsx)(s,{"aria-hidden":`true`}),t[4]=y):y=t[4];let b;t[5]===i?b=t[6]:(b=i({id:`GEyl32`}),t[5]=i,t[6]=b);let x;t[7]===b?x=t[8]:(x=(0,u.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[y,b]}),t[7]=b,t[8]=x);let S;t[9]!==i||t[10]!==f?(S=f?(0,u.jsx)(`p`,{className:`max-w-sm`,children:i({id:`gJ5Yso`})}):null,t[9]=i,t[10]=f,t[11]=S):S=t[11];let C;t[12]!==x||t[13]!==S?(C=(0,u.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-3`,children:[x,S]}),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==i||t[16]!==f?(w=f?(0,u.jsx)(o,{className:`pointer-events-auto`,onClick:p,children:i({id:`HpK_8d`})}):null,t[15]=i,t[16]=f,t[17]=w):w=t[17];let T;return t[18]!==w||t[19]!==_||t[20]!==v||t[21]!==C?(T=(0,u.jsxs)(`div`,{"data-testid":`terminal-starting-notice`,"data-slow":_,className:v,children:[C,w]}),t[18]=w,t[19]=_,t[20]=v,t[21]=C,t[22]=T):T=t[22],T}function p(){return window.location.reload()}export{f 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{t as o}from"./button-BeFNZANd.js";import{t as s}from"./spinner-D7ppCG-D.js";var c=i(),l=e(n(),1),u=t(),d=8e3;function f(e){let t=(0,c.c)(23),{className:n}=e,{_:i}=r(),[f,m]=(0,l.useState)(!1),h,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=window.setTimeout(()=>m(!0),d);return()=>window.clearTimeout(e)},g=[],t[0]=h,t[1]=g):(h=t[0],g=t[1]),(0,l.useEffect)(h,g);let _=f?`true`:void 0,v;t[2]===n?v=t[3]:(v=a(`flex h-full w-full flex-col items-center justify-center gap-3 overflow-y-auto bg-background px-6 text-center text-muted-foreground text-sm`,`fade-in-0 animate-in duration-200 [animation-delay:400ms] [animation-fill-mode:backwards] motion-reduce:duration-0`,n),t[2]=n,t[3]=v);let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,u.jsx)(s,{"aria-hidden":`true`}),t[4]=y):y=t[4];let b;t[5]===i?b=t[6]:(b=i({id:`GEyl32`}),t[5]=i,t[6]=b);let x;t[7]===b?x=t[8]:(x=(0,u.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[y,b]}),t[7]=b,t[8]=x);let S;t[9]!==i||t[10]!==f?(S=f?(0,u.jsx)(`p`,{className:`max-w-sm`,children:i({id:`gJ5Yso`})}):null,t[9]=i,t[10]=f,t[11]=S):S=t[11];let C;t[12]!==x||t[13]!==S?(C=(0,u.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-3`,children:[x,S]}),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==i||t[16]!==f?(w=f?(0,u.jsx)(o,{className:`pointer-events-auto`,onClick:p,children:i({id:`HpK_8d`})}):null,t[15]=i,t[16]=f,t[17]=w):w=t[17];let T;return t[18]!==w||t[19]!==_||t[20]!==v||t[21]!==C?(T=(0,u.jsxs)(`div`,{"data-testid":`terminal-starting-notice`,"data-slow":_,className:v,children:[C,w]}),t[18]=w,t[19]=_,t[20]=v,t[21]=C,t[22]=T):T=t[22],T}function p(){return window.location.reload()}export{f 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{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./use-installed-clis-SziirqY4.js";import{t as o}from"./config-provider-owr5M3NH.js";import{t as s}from"./use-live-xterm-theme-CFX30um3.js";import{t as c}from"./ReportBugMenuTrigger-DRki3qOn.js";import{SessionsHost as l}from"./SessionsHost-BqU3aWOR.js";var u=i(),d=e(n(),1),f=t();function p(e){let t=(0,u.c)(9),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i=r===null,a;t[0]===n?a=t[1]:(a=(0,f.jsx)(m,{bridge:n}),t[0]=n,t[1]=a);let s=r===null,l;t[2]===s?l=t[3]:(l=(0,f.jsx)(c,{systemWide:s}),t[2]=s,t[3]=l);let d;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==l?(d=(0,f.jsxs)(o,{collabUrl:r,collabTerminal:i,children:[a,l]}),t[4]=r,t[5]=i,t[6]=a,t[7]=l,t[8]=d):d=t[8],d}function m(e){let t=(0,u.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),o=s(i),c=a(),[p,m]=(0,d.useState)(null),_;t[0]===o.background?_=t[1]:(_=(0,f.jsx)(`div`,{ref:m,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:o.background}}),t[0]=o.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==c?(v=(0,f.jsx)(l,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:g,installedClis:c,container:p,isShowing:!0,onRequestEditorFocus:h}),t[2]=n,t[3]=p,t[4]=c,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,f.jsxs)(f.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function h(){}function g(e){e||window.close()}export{p as TerminalWindowApp};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./use-installed-clis-F-bc0S3Y.js";import{t as o}from"./config-provider-CTHdqAYx.js";import{t as s}from"./use-live-xterm-theme-CFX30um3.js";import{t as c}from"./ReportBugMenuTrigger-29birQ-y.js";import{SessionsHost as l}from"./SessionsHost-CKvXoA48.js";var u=i(),d=e(n(),1),f=t();function p(e){let t=(0,u.c)(9),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i=r===null,a;t[0]===n?a=t[1]:(a=(0,f.jsx)(m,{bridge:n}),t[0]=n,t[1]=a);let s=r===null,l;t[2]===s?l=t[3]:(l=(0,f.jsx)(c,{systemWide:s}),t[2]=s,t[3]=l);let d;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==l?(d=(0,f.jsxs)(o,{collabUrl:r,collabTerminal:i,children:[a,l]}),t[4]=r,t[5]=i,t[6]=a,t[7]=l,t[8]=d):d=t[8],d}function m(e){let t=(0,u.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),o=s(i),c=a(),[p,m]=(0,d.useState)(null),_;t[0]===o.background?_=t[1]:(_=(0,f.jsx)(`div`,{ref:m,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:o.background}}),t[0]=o.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==c?(v=(0,f.jsx)(l,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:g,installedClis:c,container:p,isShowing:!0,onRequestEditorFocus:h}),t[2]=n,t[3]=p,t[4]=c,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,f.jsxs)(f.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function h(){}function g(e){e||window.close()}export{p as TerminalWindowApp};
@@ -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{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{Ko as o,ss as s,wr as c}from"./dist-bQ5kvrpa.js";import{gt as l,n as u,vt as d}from"./CodeMirrorPropInput-CjC1gT00.js";import{Ct as f,J as p,M as m,Tt as h}from"./dist-CYYyr4TA.js";import{t as g}from"./cm-theme-KUu9krZW.js";import{t as _}from"./dist-D0hiAY5R.js";import{t as v}from"./text-viewer-languages-BlDNNpIP.js";import{t as y}from"./src-C5n8TKJq.js";import{t as b}from"./doc-undo-manager-CaLoly49.js";var x=a(),S=e(n(),1),C=t(),w=g({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),T=g({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function E(e){let t=(0,x.c)(18),{docName:n,provider:a}=e,{_:g}=r(),E=n.slice(n.lastIndexOf(`/`)+1),D=(0,S.useRef)(null),{resolvedTheme:O}=i(),k,A;t[0]===a?(k=t[1],A=t[2]):(A=a.document.getText(`source`),k=b(a,A),t[0]=a,t[1]=k,t[2]=A);let j=k,M;t[3]!==n||t[4]!==a.awareness||t[5]!==O||t[6]!==j||t[7]!==A?(M=()=>{let e=D.current;if(!e)return;let t=O===`dark`?w:T,r=new f,i=new f,g=(o[c(n)]??s(c(n)))!==null&&c(n)!==``,b=new p({state:h.create({doc:A.toString(),extensions:[_,y(A,a.awareness,{undoManager:j}),r.of([]),m(u),i.of(g?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e});l(n,b,`textDocEditor`);let x=!1,S=c(n)||null;return S&&v(S,o[S]??s(S)).then(e=>{x||!e||b.dispatch({effects:r.reconfigure(e)})}),()=>{x=!0,d(n,b),b.destroy()}},t[3]=n,t[4]=a.awareness,t[5]=O,t[6]=j,t[7]=A,t[8]=M):M=t[8];let N;t[9]!==n||t[10]!==a||t[11]!==O||t[12]!==j||t[13]!==A?(N=[A,a,O,n,j],t[9]=n,t[10]=a,t[11]=O,t[12]=j,t[13]=A,t[14]=N):N=t[14],(0,S.useEffect)(M,N);let P=g({id:`xAlHfe`,values:{basename:E}}),F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,C.jsx)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-auto`}),t[15]=F):F=t[15];let I;return t[16]===P?I=t[17]:(I=(0,C.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":P,"data-text-doc-editor":``,children:F}),t[16]=P,t[17]=I),I}export{E as TextDocEditor};
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{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{Ko as o,ss as s,wr as c}from"./dist-bQ5kvrpa.js";import{gt as l,n as u,vt as d}from"./CodeMirrorPropInput-C6PE1vK2.js";import{Ct as f,J as p,M as m,Tt as h}from"./dist-CYYyr4TA.js";import{t as g}from"./cm-theme-KUu9krZW.js";import{t as _}from"./dist-D0hiAY5R.js";import{t as v}from"./text-viewer-languages-BlDNNpIP.js";import{t as y}from"./src-BxNPgEkh.js";import{t as b}from"./doc-undo-manager-DxMjEKx4.js";var x=a(),S=e(n(),1),C=t(),w=g({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),T=g({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function E(e){let t=(0,x.c)(18),{docName:n,provider:a}=e,{_:g}=r(),E=n.slice(n.lastIndexOf(`/`)+1),D=(0,S.useRef)(null),{resolvedTheme:O}=i(),k,A;t[0]===a?(k=t[1],A=t[2]):(A=a.document.getText(`source`),k=b(a,A),t[0]=a,t[1]=k,t[2]=A);let j=k,M;t[3]!==n||t[4]!==a.awareness||t[5]!==O||t[6]!==j||t[7]!==A?(M=()=>{let e=D.current;if(!e)return;let t=O===`dark`?w:T,r=new f,i=new f,g=(o[c(n)]??s(c(n)))!==null&&c(n)!==``,b=new p({state:h.create({doc:A.toString(),extensions:[_,y(A,a.awareness,{undoManager:j}),r.of([]),m(u),i.of(g?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e});l(n,b,`textDocEditor`);let x=!1,S=c(n)||null;return S&&v(S,o[S]??s(S)).then(e=>{x||!e||b.dispatch({effects:r.reconfigure(e)})}),()=>{x=!0,d(n,b),b.destroy()}},t[3]=n,t[4]=a.awareness,t[5]=O,t[6]=j,t[7]=A,t[8]=M):M=t[8];let N;t[9]!==n||t[10]!==a||t[11]!==O||t[12]!==j||t[13]!==A?(N=[A,a,O,n,j],t[9]=n,t[10]=a,t[11]=O,t[12]=j,t[13]=A,t[14]=N):N=t[14],(0,S.useEffect)(M,N);let P=g({id:`xAlHfe`,values:{basename:E}}),F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,C.jsx)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-auto`}),t[15]=F):F=t[15];let I;return t[16]===P?I=t[17]:(I=(0,C.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":P,"data-text-doc-editor":``,children:F}),t[16]=P,t[17]=I),I}export{E as TextDocEditor};