@inkeep/open-knowledge 0.64.0-beta.0 → 0.64.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/{acp-harness-probe-Dfn4DdCk.mjs → acp-harness-probe-BIJwJbj6.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-D4rLyMMU.mjs +2 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/init-D0MbeFzu.mjs +1 -0
  6. package/dist/{init-BcrcnD3R.mjs → init-jptp5zSo.mjs} +3 -3
  7. package/dist/{launch-json-removal-B3kM3m3f.mjs → launch-json-removal-CuuCa9b6.mjs} +2 -2
  8. package/dist/{loader-BwwPkGMH.mjs → loader-DUJSLkMb.mjs} +2 -2
  9. package/dist/loader-YQ1uWp0m.mjs +1 -0
  10. package/dist/{preview-JbKzJSop.mjs → preview-6WmRL9Cz.mjs} +2 -2
  11. package/dist/preview-s_wVFW_U.mjs +1 -0
  12. package/dist/public/assets/{ActivityModeContent-BVDRGbN_.js → ActivityModeContent-Ckg5Pq_4.js} +1 -1
  13. package/dist/public/assets/{AddPropertiesButton-7dCoyBvE.js → AddPropertiesButton-gQRcjJmF.js} +1 -1
  14. package/dist/public/assets/{AgentDiffPane-Fcqpkkvc.js → AgentDiffPane-D-ZLGFAR.js} +1 -1
  15. package/dist/public/assets/{CodeMirrorPropInput-CZg3NpYe.js → CodeMirrorPropInput-DjB69jRg.js} +1 -1
  16. package/dist/public/assets/{DocumentContext-CpeWitiW.js → DocumentContext-iKEZSiB2.js} +1 -1
  17. package/dist/public/assets/{EditorModeToggle-kVdR62fb.js → EditorModeToggle-DEPlArB5.js} +1 -1
  18. package/dist/public/assets/{EnableSyncConfirmDialog-vDAKs3w2.js → EnableSyncConfirmDialog-CwJc4GMj.js} +1 -1
  19. package/dist/public/assets/{ExcalidrawDocEditor-Bt_Sc1ig.js → ExcalidrawDocEditor-BCYrkDNU.js} +1 -1
  20. package/dist/public/assets/FeedbackForm-Bmmb6Lzs.js +1 -0
  21. package/dist/public/assets/{ImportSkillDialog-CspiU9oF.js → ImportSkillDialog-BKP46Eid.js} +1 -1
  22. package/dist/public/assets/{LintConfigEditor-D4Lyz3en.js → LintConfigEditor-HYgFdkkR.js} +1 -1
  23. package/dist/public/assets/ManagedArtifactProperties-CluUiwa8.js +1 -0
  24. package/dist/public/assets/{ManagedArtifactProperties-DOw_G7X-.js → ManagedArtifactProperties-VBkp3E3_.js} +1 -1
  25. package/dist/public/assets/{MermaidDocEditor-C0wc8LzX.js → MermaidDocEditor-CLbFOZa8.js} +1 -1
  26. package/dist/public/assets/{PropertyDisplayRow-wkm3Dp2m.js → PropertyDisplayRow-D7ELTVgR.js} +2 -2
  27. package/dist/public/assets/{SchemaConfigEditor-D9rcrwmV.js → SchemaConfigEditor-B7rMT9lS.js} +1 -1
  28. package/dist/public/assets/SessionsHost-BxDNMNVk.js +2 -0
  29. package/dist/public/assets/{SettingsDialogBody-CteLfmRG.js → SettingsDialogBody-Cg-2MbSs.js} +1 -1
  30. package/dist/public/assets/{ShareBranchSwitchDialog-BPCd6Quz.js → ShareBranchSwitchDialog-COPm8JOC.js} +1 -1
  31. package/dist/public/assets/{ShareReceiveDialog-CoAGSmZ4.js → ShareReceiveDialog-qD-iDy_7.js} +1 -1
  32. package/dist/public/assets/{ShareReceiveMissDialog-D1sjGAKG.js → ShareReceiveMissDialog-BkGSRaoZ.js} +1 -1
  33. package/dist/public/assets/{SkillInstallMenu-BYR9N4q6.js → SkillInstallMenu-CP0nLWRp.js} +1 -1
  34. package/dist/public/assets/{SkillToolbarControls-DJM37Tzc.js → SkillToolbarControls-DQAXaxz9.js} +1 -1
  35. package/dist/public/assets/{SourceEditor-DfCkS8Fs.js → SourceEditor-iZTT-gls.js} +1 -1
  36. package/dist/public/assets/{TerminalPanel-B9EgBHqz.js → TerminalPanel-hYpLMc82.js} +37 -37
  37. package/dist/public/assets/TerminalStartingNotice-7XmsKQfW.js +1 -0
  38. package/dist/public/assets/{TerminalWindowApp-t4MYEnaS.js → TerminalWindowApp-CqhdtLqo.js} +1 -1
  39. package/dist/public/assets/{TextDocEditor-CWU6LK-8.js → TextDocEditor-lp_L8pQg.js} +1 -1
  40. package/dist/public/assets/{ThreadView-DvUL6MIe.js → ThreadView-B0bXdy0X.js} +3 -3
  41. package/dist/public/assets/{TimelineDiffPane-CF5MGNaw.js → TimelineDiffPane-jTy3D_Yh.js} +1 -1
  42. package/dist/public/assets/{agent-diff-store-DFJS7b5r.js → agent-diff-store-B7QUf8gQ.js} +1 -1
  43. package/dist/public/assets/{auth-state-cache-CjWyvr0L.js → auth-state-cache-CcdfpjLM.js} +1 -1
  44. package/dist/public/assets/{comment-chips-M-vXJPiy.js → comment-chips-z8F67ebz.js} +1 -1
  45. package/dist/public/assets/{config-provider-Bavv18lD.js → config-provider-DcdQLVo-.js} +3 -3
  46. package/dist/public/assets/globals-DMaCiviB.css +1 -0
  47. package/dist/public/assets/i18n-CwbBw0OU.js +1 -0
  48. package/dist/public/assets/{index-B0xoBPyb.js → index-Cx0Su1s3.js} +18 -18
  49. package/dist/public/assets/messages-10f1hPWP.js +1 -0
  50. package/dist/public/assets/messages-5TeeUeS0.js +1 -0
  51. package/dist/public/assets/messages-8WTqq3Mp.js +1 -0
  52. package/dist/public/assets/messages-BRgdD2wL.js +1 -0
  53. package/dist/public/assets/messages-Bbr1HKxw.js +1 -0
  54. package/dist/public/assets/messages-Bo2D8MSU.js +1 -0
  55. package/dist/public/assets/messages-BoTpi3Tc.js +1 -0
  56. package/dist/public/assets/messages-CCrzx-Sh.js +1 -0
  57. package/dist/public/assets/messages-CxY3xIzN.js +1 -0
  58. package/dist/public/assets/messages-DpV3A7jU.js +1 -0
  59. package/dist/public/assets/messages-DyWXi2qN.js +1 -0
  60. package/dist/public/assets/messages-ZkMy8GOy.js +1 -0
  61. package/dist/public/assets/{pending-receive-nav-store-CqRn5nAG.js → pending-receive-nav-store-kFxMX_hs.js} +1 -1
  62. package/dist/public/assets/{progress-DANvCJmk.js → progress-BOWBNgYM.js} +1 -1
  63. package/dist/public/assets/{selection-context-BVomF0mV.js → selection-context-CYahjTQ5.js} +1 -1
  64. package/dist/public/assets/{src-Dpmb3U7E.js → src-DMJQ5Vxd.js} +1 -1
  65. package/dist/public/assets/{telemetry-impl-DLHtoY00.js → telemetry-impl-Bbh5su9o.js} +2 -2
  66. package/dist/public/assets/{telemetry-startup-D2bGuqRD.js → telemetry-startup-DVLjCMTC.js} +1 -1
  67. package/dist/public/assets/terminal-launch-events-CwapFFW5.js +1 -0
  68. package/dist/public/assets/{typing-burst-detector-DlSk3HmB.js → typing-burst-detector-DOfSmyLX.js} +1 -1
  69. package/dist/public/assets/{uninstall-B_ye2J4j.js → uninstall-3RuzHXuR.js} +1 -1
  70. package/dist/public/assets/{use-activity-panel-yR4XBbM0.js → use-activity-panel-ewhIckJf.js} +1 -1
  71. package/dist/public/assets/{use-open-skill-BOlvJ9db.js → use-open-skill-Bwm3tOLL.js} +1 -1
  72. package/dist/public/assets/{use-terminal-enabled-DTcNcDac.js → use-terminal-enabled-Chvkm0XM.js} +1 -1
  73. package/dist/public/assets/{use-timeline-entry-diff-D79rgyyp.js → use-timeline-entry-diff-BN_8QKGi.js} +1 -1
  74. package/dist/public/index.html +23 -23
  75. package/dist/public/uninstall.html +5 -5
  76. package/dist/{repair-launch-json-COgJwsBT.mjs → repair-launch-json-Dt2DnkVy.mjs} +2 -2
  77. package/dist/{repair-mcp-configs-DYDyOGXO.mjs → repair-mcp-configs-CLqwAV3v.mjs} +2 -2
  78. package/dist/{src-D_KoKQ_4.mjs → src-n3-0MFKq.mjs} +2 -2
  79. package/dist/src-qXQmI8Jk.mjs +1 -0
  80. package/dist/start-BDTbxwBO.mjs +1 -0
  81. package/dist/{start-CDpy3ivM.mjs → start-XFu22D2G.mjs} +2 -2
  82. package/package.json +4 -4
  83. package/dist/constants-BU4eKKFx.mjs +0 -2
  84. package/dist/init-DxGZlS0A.mjs +0 -1
  85. package/dist/loader-B4icgd7A.mjs +0 -1
  86. package/dist/preview-S3f8BiEi.mjs +0 -1
  87. package/dist/public/assets/FeedbackForm-DbHLRCGV.js +0 -1
  88. package/dist/public/assets/ManagedArtifactProperties-wSMmw4k7.js +0 -1
  89. package/dist/public/assets/SessionsHost-D8_fdp2Z.js +0 -2
  90. package/dist/public/assets/globals-Df7vQ3KZ.css +0 -1
  91. package/dist/public/assets/i18n-BAClLrqy.js +0 -1
  92. package/dist/public/assets/messages-BCzdglIs.js +0 -1
  93. package/dist/public/assets/messages-BNXhZIvP.js +0 -1
  94. package/dist/public/assets/messages-BTOATtFo.js +0 -1
  95. package/dist/public/assets/messages-CEAIJ2vr.js +0 -1
  96. package/dist/public/assets/messages-CP6EucXo.js +0 -1
  97. package/dist/public/assets/messages-CZYMn827.js +0 -1
  98. package/dist/public/assets/messages-DSiLvtAQ.js +0 -1
  99. package/dist/public/assets/messages-DeCaehhs.js +0 -1
  100. package/dist/public/assets/messages-Ds6A6ql_.js +0 -1
  101. package/dist/public/assets/messages-LQQZNjF5.js +0 -1
  102. package/dist/public/assets/messages-hYFi4d1C.js +0 -1
  103. package/dist/public/assets/messages-natrutgz.js +0 -1
  104. package/dist/public/assets/terminal-launch-events-vGjuKPQL.js +0 -1
  105. package/dist/src-CbNsCrxc.mjs +0 -1
  106. package/dist/start-Baqd7RHG.mjs +0 -1
  107. /package/dist/public/assets/{AgentThreadClientBinder-ZfgVB5_1.js → AgentThreadClientBinder-D4jxeqvH.js} +0 -0
  108. /package/dist/public/assets/{SkillEditBanner-lLVIBnoB.js → SkillEditBanner-CVlq-SCL.js} +0 -0
  109. /package/dist/public/assets/{SkillOriginInline-TGIhdkZT.js → SkillOriginInline-6IYNkHCE.js} +0 -0
  110. /package/dist/public/assets/{SlidesToolbarControls-CaS6tQ5s.js → SlidesToolbarControls-Caq-eS5D.js} +0 -0
  111. /package/dist/public/assets/{__vite-browser-external-BpzCr_ou.js → __vite-browser-external-Ci1NQTFf.js} +0 -0
  112. /package/dist/public/assets/{calendar-Dl_OvZ6j.js → calendar-C9Zcn0Ol.js} +0 -0
  113. /package/dist/public/assets/{code-highlighter-impl-CqBvFNiv.js → code-highlighter-impl-Cd7bLu8y.js} +0 -0
  114. /package/dist/public/assets/{globals-CTP2Nuyu.js → globals-BFYzJ2RB.js} +0 -0
  115. /package/dist/public/assets/{share-metadata-rows-CSTN28dW.js → share-metadata-rows-JAHDqWDY.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Qn as n}from"./DocumentContext-CpeWitiW.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"./utils-CPqDy6Hr.js";import{t as c}from"./mascot-outline-CtS592mc.js";import{t as l}from"./button-CA0dewJJ.js";import{i as u,n as d,t as f}from"./tooltip-DPvMEqsq.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y}from"./alert-dialog-C8E8SkhJ.js";import{C as b,a as x,c as S,d as C,f as w,l as T,p as E,r as D,s as O,u as k}from"./terminal-cli-display-C-s_gqLX.js";import{a as A,d as j,f as M,i as N,n as P,o as F,p as I,u as L}from"./dropdown-menu-BpLbh79a.js";import{Yt as R,fo as z,ni as B,qt as V}from"./dist-DSS3ixln2.js";import{n as H}from"./dist-CuH7ikCn.js";import{c as ee}from"./documents-events-DCcMe0wm.js";import{t as U}from"./createLucideIcon-CAkY8Blx.js";import{c as W}from"./use-open-skill-BOlvJ9db.js";import{t as te}from"./spinner-DmibE6UV.js";import{N as ne,S as re,j as G,x as K}from"./skills-api-BLXzXEC-.js";import{i as ie,l as ae,n as oe,r as q}from"./skill-scope-DWsJ838z.js";import{t as J}from"./use-skills-szHEgJLb.js";var Y=t(),X=e(r(),1),Z=o(),se=3100,ce=3;function le(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??ce;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var ue={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},de=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function fe(e,t={}){let n=t.rng??Math.random,r=t.colors??de,i=ue[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var pe=1.8,me=90,he=16,ge=380,_e=.025,ve=.1,ye=.18,be=400,xe=9.2736,Se=18.1799,Ce=14.5244,we={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Te(e,t){let{halfWidth:n,apexLift:r}=we[t];return`M${e-n} ${Ce+.3} Q${e} ${Ce-r}, ${e+n} ${Ce+.3}`}function Ee(e){let t=1.5,n=.3;return`M${e-t} ${Ce-n} Q${e} ${Ce+1.4}, ${e+t} ${Ce-n}`}var De=15,Oe=15;function ke(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function Ae(e){let t=(0,Z.c)(73),{size:n,className:r,style:i,trackMouse:a,variant:o,celebrateSignal:l,onRage:u}=e,d=n===void 0?48:n,f=a===void 0?!0:a,p=o===void 0?`default`:o,m=l===void 0?0:l,h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(null),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={x:0,y:0},t[0]=v):v=t[0];let y=(0,X.useRef)(v),[b,x]=(0,X.useState)(0),[S,C]=(0,X.useState)(0),[w,T]=(0,X.useState)(0),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,O]=(0,X.useState)(E),k=(0,X.useRef)(0),A=(0,X.useRef)(0),j=(0,X.useRef)(void 0),M=p===`sleeping`,N;t[2]!==b||t[3]!==M||t[4]!==u?(N=function(){if(M)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=A.current===0?1/0:e-A.current;A.current=e;let n=le(b,t),r=b===3&&e-k.current<3100,i=n===3&&r;n===3&&u?.(),x(n),C(Ie),i||(O(fe(n)),n===3&&(k.current=e,T(Fe))),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se)},t[2]=b,t[3]=M,t[4]=u,t[5]=N):N=t[5];let P=N,F,I;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>()=>clearTimeout(j.current),I=[],t[6]=F,t[7]=I):(F=t[6],I=t[7]),(0,X.useEffect)(F,I);let L,R;t[8]!==m||t[9]!==M?(L=()=>{m===0||M||(x(3),C(Pe),O(fe(3)),k.current=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),T(Ne),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se))},R=[m,M],t[8]=m,t[9]=M,t[10]=L,t[11]=R):(L=t[10],R=t[11]),(0,X.useEffect)(L,R);let z,B;t[12]!==M||t[13]!==f?(z=()=>{if(!f||M||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,c=function(){s===0&&(s=requestAnimationFrame(u))},l=function(r){e=r.clientX,t=r.clientY,n=!0,c()};function u(){s=0;let l=g.current,u=h.current;if(!l||!u){c();return}let d=n;n=!1;let f=l.getBoundingClientRect(),p=f.left+f.width/2,m=f.top+f.height*.48,v=e-p,b=t-m,x=Math.hypot(v,b),S=Math.max(-1,Math.min(1,v/ge)),C=-Math.max(-1,Math.min(1,b/ge))*he,w=S*he,T=0,E=0;if(x>=1){let e=Math.min(x/me,1)*pe;T=v/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!d&&D)return;c(),r+=(C-r)*ve,i+=(w-i)*ve,u.style.transform=`perspective(${be}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*ye,o+=(E-o)*ye;let O=i*_e,k=-r*_e,A=a+O,j=o+k;y.current.x=A,y.current.y=j,_.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,l,{passive:!0}),c(),()=>{document.removeEventListener(`mousemove`,l),s!==0&&cancelAnimationFrame(s),s=0,h.current&&(h.current.style.transform=``),y.current={x:0,y:0},_.current?.removeAttribute(`transform`)}},B=[f,M],t[12]=M,t[13]=f,t[14]=z,t[15]=B):(z=t[14],B=t[15]),(0,X.useEffect)(z,B);let V;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{let e=_.current;if(!e)return;let{x:t,y:n}=y.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=V):V=t[16],(0,X.useLayoutEffect)(V);let H=b>0,ee=H?b:1,U=H?`ok-blob-clicked-${b}`:null,W;t[17]===r?W=t[18]:(W=s(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=W);let te=M?`cursor-default`:`cursor-pointer`,ne=`body-${S}`,re=M&&`ok-blob-sleeping`,G;t[19]!==U||t[20]!==re?(G=s(`ok-blob-group`,re,U),t[19]=U,t[20]=re,t[21]=G):G=t[21];let K;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Y.jsx)(`path`,{d:c,className:`ok-blob-body`}),t[22]=K):K=t[22];let ie=(H||M)&&`ok-blob-eye-hidden`,ae;t[23]===ie?ae=t[24]:(ae=s(`ok-blob-eye`,ie),t[23]=ie,t[24]=ae);let oe;t[25]===ae?oe=t[26]:(oe=(0,Y.jsx)(`ellipse`,{cx:xe,cy:Ce,rx:1.2722,ry:1.9083,className:ae}),t[25]=ae,t[26]=oe);let q=(H||M)&&`ok-blob-eye-hidden`,J;t[27]===q?J=t[28]:(J=s(`ok-blob-eye ok-blob-eye-right`,q),t[27]=q,t[28]=J);let ce;t[29]===J?ce=t[30]:(ce=(0,Y.jsx)(`ellipse`,{cx:Se,cy:Ce,rx:1.2722,ry:1.9083,className:J}),t[29]=J,t[30]=ce);let ue;t[31]===ee?ue=t[32]:(ue=Te(xe,ee),t[31]=ee,t[32]=ue);let de=(!H||M)&&`ok-blob-eye-hidden`,we;t[33]===de?we=t[34]:(we=s(`ok-blob-happy-eye`,de),t[33]=de,t[34]=we);let De;t[35]!==ue||t[36]!==we?(De=(0,Y.jsx)(`path`,{d:ue,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:we}),t[35]=ue,t[36]=we,t[37]=De):De=t[37];let Oe;t[38]===ee?Oe=t[39]:(Oe=Te(Se,ee),t[38]=ee,t[39]=Oe);let ke=(!H||M)&&`ok-blob-eye-hidden`,Ae;t[40]===ke?Ae=t[41]:(Ae=s(`ok-blob-happy-eye`,ke),t[40]=ke,t[41]=Ae);let Le;t[42]!==Oe||t[43]!==Ae?(Le=(0,Y.jsx)(`path`,{d:Oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:Ae}),t[42]=Oe,t[43]=Ae,t[44]=Le):Le=t[44];let Re;t[45]===M?Re=t[46]:(Re=M?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:Ee(xe),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Y.jsx)(`path`,{d:Ee(Se),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=M,t[46]=Re);let ze;t[47]!==oe||t[48]!==ce||t[49]!==De||t[50]!==Le||t[51]!==Re?(ze=(0,Y.jsxs)(`g`,{ref:_,children:[oe,ce,De,Le,Re]}),t[47]=oe,t[48]=ce,t[49]=De,t[50]=Le,t[51]=Re,t[52]=ze):ze=t[52];let Q;t[53]!==ne||t[54]!==G||t[55]!==ze?(Q=(0,Y.jsxs)(`g`,{className:G,children:[K,ze]},ne),t[53]=ne,t[54]=G,t[55]=ze,t[56]=Q):Q=t[56];let Be;t[57]===M?Be=t[58]:(Be=M?(0,Y.jsxs)(`g`,{children:[(0,Y.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Y.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=M,t[58]=Be);let Ve;t[59]!==w||t[60]!==D?(Ve=D.length>0&&(0,Y.jsx)(`g`,{"data-slot":`ok-blob-burst`,children:D.map(je)},`firework-${w}`),t[59]=w,t[60]=D,t[61]=Ve):Ve=t[61];let He;t[62]!==P||t[63]!==d||t[64]!==te||t[65]!==Q||t[66]!==Be||t[67]!==Ve?(He=(0,Y.jsxs)(`svg`,{ref:g,width:d,height:d,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:te,"aria-hidden":`true`,onClick:P,onMouseDown:Me,children:[Q,Be,Ve]}),t[62]=P,t[63]=d,t[64]=te,t[65]=Q,t[66]=Be,t[67]=Ve,t[68]=He):He=t[68];let Ue;return t[69]!==i||t[70]!==W||t[71]!==He?(Ue=(0,Y.jsx)(`span`,{ref:h,className:W,style:i,children:He}),t[69]=i,t[70]=W,t[71]=He,t[72]=Ue):Ue=t[72],Ue}function je(e){return(0,Y.jsx)(`circle`,{cx:De+e.originDx,cy:Oe+e.originDy,r:e.size,className:`ok-blob-firework`,style:ke(e)},e.id)}function Me(e){return e.preventDefault()}function Ne(e){return e+1}function Pe(e){return e+1}function Fe(e){return e+1}function Ie(e){return e+1}var Le=U(`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`}]]),Re=U(`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`}]]),ze=U(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=[...new Set(b.flatMap(e=>e.schemes))];function Be(e,t){let n=t.now?.()??Date.now(),r={};for(let t of b){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 Ve(e){return Be({},e)}async function He(e){let t=e.schemes??Q,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 Ue=Object.fromEntries(Q.map(e=>[e,{installed:!1}]));async function We(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 Ue}if(!t.ok)return Ue;let n;try{n=await t.json()}catch{return Ue}if(typeof n!=`object`||!n||Array.isArray(n))return Ue;let r=n,i={};for(let e of Q)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Ge(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 Ke(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Ve({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Be(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=!Ge(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 qe(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Je(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>He({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>We({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Ye(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(Xe),r=(0,X.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Ke(Je());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,X.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 Xe(){return Ve({isElectronHost:qe(),now:Date.now})}var Ze=(0,X.createContext)(null);function Qe(e){let t=(0,Z.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Y.jsx)(Ze,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function $e(){return(0,X.use)(Ze)}function et(e){return!(e instanceof Error)||e.name!==`NotAllowedError`?!1:/permission denied|permissions policy/i.test(e.message)}function tt(e){let t=globalThis.document;if(!t?.body||typeof t.createElement!=`function`||typeof t.execCommand!=`function`)return!1;let n=t.createElement(`textarea`);n.value=e,n.style.position=`fixed`,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`readonly`,``),t.body.appendChild(n);try{return n.focus(),n.select(),t.execCommand(`copy`)}catch{return!1}finally{n.remove()}}async function nt(e){let t=globalThis.okDesktop?.clipboard;if(t&&typeof t.writeText==`function`){await t.writeText(e);return}let n=globalThis.navigator?.clipboard;if(n&&typeof n.writeText==`function`)try{await n.writeText(e);return}catch(t){if(tt(e))return;throw t}if(!tt(e))throw Error(`clipboard API unavailable`)}function rt(e){let t=(0,Z.c)(48),{itemName:n,isSubmitting:r,onDelete:o,customTitle:s,customDescription:c,customDetail:u,customConfirmLabel:d,customConfirmLabelBusy:f,children:b}=e,{_:x}=a(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==d?(w=d??x({id:`cnGeoo`}),t[3]=x,t[4]=d,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==d||t[8]!==f?(E=f??d??x({id:`s3caR3`}),t[6]=x,t[7]=d,t[8]=f,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==s||t[12]!==C?(O=s??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=s,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,Y.jsx)(g,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==c||t[18]!==C?(A=c??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=c,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,Y.jsx)(_,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===u?M=t[23]:(M=u?(0,Y.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:u}):null,t[22]=u,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,Y.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,Y.jsx)(v,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsx)(i,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===r?I=t[32]:(I=(0,Y.jsx)(h,{disabled:r,children:F}),t[31]=r,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==r?(L=r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(te,{"aria-hidden":`true`,className:`size-4`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=r,t[36]=L):L=t[36];let R;t[37]!==r||t[38]!==o||t[39]!==L?(R=(0,Y.jsx)(l,{variant:`destructive`,onClick:o,disabled:r,children:L}),t[37]=r,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,Y.jsxs)(y,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,Y.jsxs)(p,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function it(e){return e===`agents`||e===`.agents`||e.startsWith(`.agents/`)?`.agents`:e.includes(`/`)?e:z[e]??e}function at(e){return e===`claude`?`claude-code`:e}function ot(e){let t=(0,Z.c)(18),r,i;if(t[0]===e?(r=t[1],i=t[2]):({host:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`agents`){let e;return t[3]===i?e=t[4]:(e=(0,Y.jsx)(n,{...i}),t[3]=i,t[4]=e),e}if(r.includes(`/`)){if(r===`.agents`||r.startsWith(`.agents/`)){let e;return t[5]===i?e=t[6]:(e=(0,Y.jsx)(n,{...i}),t[5]=i,t[6]=e),e}if(r===`.ok`||r.startsWith(`.ok/`)){let e;if(t[7]!==i){let{className:n,...r}=i;e=r,t[7]=i,t[8]=e}else e=t[8];let n=e,r;return t[9]===n?r=t[10]:(r=(0,Y.jsx)(Ae,{size:14,...n}),t[9]=n,t[10]=r),r}let e;return t[11]===i?e=t[12]:(e=(0,Y.jsx)(W,{...i}),t[11]=i,t[12]=e),e}let a;t[13]===r?a=t[14]:(a=at(r),t[13]=r,t[14]=a);let o;return t[15]!==i||t[16]!==a?(o=(0,Y.jsx)(D,{...i,id:a}),t[15]=i,t[16]=a,t[17]=o):o=t[17],o}function st(e){let t=(0,Z.c)(14),{hosts:n,className:r,iconClassName:i}=e,a,o,c;if(t[0]!==r||t[1]!==n||t[2]!==i){let e=n.slice(0,2),l=n.slice(2);t[6]===r?a=t[7]:(a=s(`flex items-center gap-1`,r),t[6]=r,t[7]=a);let p;t[8]===i?p=t[9]:(p=e=>(0,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,Y.jsx)(ot,{host:e,className:s(`size-3.5 shrink-0`,i),"aria-label":it(e)})})}),(0,Y.jsx)(d,{children:it(e)})]},e),t[8]=i,t[9]=p),o=e.map(p),c=l.length>0?(0,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsxs)(`span`,{className:`ml-0.5 cursor-default`,children:[`+`,l.length]})}),(0,Y.jsx)(d,{children:l.map(it).join(`, `)})]}):null,t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=c}else a=t[3],o=t[4],c=t[5];let l;return t[10]!==a||t[11]!==o||t[12]!==c?(l=(0,Y.jsxs)(`span`,{className:a,children:[o,c]}),t[10]=a,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function ct(e){let t=(0,Z.c)(6),{testId:n,title:r}=e,a;t[0]===r?a=t[1]:(a=r===void 0?{}:{title:r},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,Y.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 lt(e){let t=(0,Z.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,Y.jsx)(O,{...r}):(0,Y.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ut(e){let t=(0,Z.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,Y.jsx)(S,{...r}):(0,Y.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function dt(e){let t=(0,Z.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,Y.jsx)(x,{...r}):(0,Y.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ft(e){let t=(0,Z.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,Y.jsx)(T,{...r}):(0,Y.jsx)(F,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function pt(e){let t=(0,Z.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,Y.jsx)(k,{...r}):(0,Y.jsx)(L,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function mt(e){let t=(0,Z.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,Y.jsx)(C,{...r}):(0,Y.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ht(e){let t=(0,Z.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,Y.jsx)(w,{...r}):(0,Y.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function gt(e){let t=(0,Z.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,Y.jsx)(E,{...r}):(0,Y.jsx)(I,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var _t=Object.freeze({hosts:null,source:null}),vt=new Map,yt=new Map;function bt(e,t){return`${e}:${t}`}function xt(e){return vt.get(e)??_t}function St(e,t){let n=yt.get(e)??new Set;return yt.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&yt.delete(e)}}function Ct(e,t){let n=xt(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?vt.delete(e):vt.set(e,r);for(let t of yt.get(e)??[])t()}}var wt=V.options,Tt=R.options,Et=`.agents/`;function Dt({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${ae(t,e.scope)}/${e.name}`:null,o=e!==void 0&&((e.hosts??[]).includes(`agents`)||t?.some(e=>e.hosts.includes(`agents`)||e.path.startsWith(Et))),s=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),c=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),l=c?new Set(c):null,u=e?.scope===`global`?Tt:wt,d=(o?[...u,`agents`]:u).filter(e=>!(e in s)).filter(e=>e===`agents`||l===null||l.has(e)||n.has(e)),f=new Set(d.map(e=>a(e))),p=e?.scope===`global`?`~/`:``,m=e?.path?.includes(`/`)?`${p}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,h=m!==null&&!f.has(m)?m:null,g=h===null?r??e?.hosts?.[0]:void 0,_=new Set(e?.conflictHosts??[]),v=new Set(e?.driftPaths??[]),y=new Set(e?.symlinkedHosts??[]),b=[...[...n].filter(e=>e!==g&&!(e in s)&&!_.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:y.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:q(e),display:`${p}${e.path}`,mode:e.mode}))],x=b.map(e=>e.mode),S=x.filter(e=>e===`link`).length,C=x.length===0?i?`link`:`copy`:S*2>=x.length?`link`:`copy`,w=new Map((e?.customPlacements??[]).map(e=>[q(e),e])),T=new Set(w.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=q(e);t!==``&&T.add(t)}}return{pathFor:a,aliases:s,rows:d,sourceRow:h,sourceHost:g,conflicted:_,drifted:v,linked:y,expectedMode:C,convertible:b,customRootRows:e===void 0?[]:[...T].sort().map(t=>({root:t,display:`${p}${t}/${e.name}`,placed:w.get(t)??null})).filter(e=>!f.has(e.display)&&e.display!==m&&!(e.root in s))}}var Ot=`min-w-[24rem]`;function kt(e,t){let n=(0,Z.c)(45),r=t.installingName===e.name,i=(0,X.useRef)(e),[a,o]=(0,X.useState)(!1),s=(0,X.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,X.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,X.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=bt(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>St(m,e),g=()=>xt(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,X.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&Ct(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,X.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,X.useRef)(e.hosts),O,k;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},k=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=k):(O=n[21],k=n[22]),(0,X.useEffect)(O,k);let A;n[23]===e.hosts?A=n[24]:(A=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=A);let j=A,M,N;n[25]!==m||n[26]!==j?(M=()=>{let e=xt(m).hosts;e&&[...e].sort().join(`,`)===j&&Ct(m,{hosts:null})},N=[j,m],n[25]=m,n[26]=j,n[27]=M,n[28]=N):(M=n[27],N=n[28]),(0,X.useEffect)(M,N);let P=(0,X.useRef)(null),F=(0,X.useRef)(null),I,L;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current),F.current?.(),F.current=null},L=[],n[29]=I,n[30]=L):(I=n[29],L=n[30]),(0,X.useEffect)(I,L);let R;n[31]!==t||n[32]!==m||n[33]!==e?(R=function(n,r){D.current=n,Ct(m,{hosts:n}),P.current&&clearTimeout(P.current);let i=async()=>{F.current=null,P.current=null;let r=await t.install(e,n.filter(B));if(!r.ok){Ct(m,{hosts:null});return}D.current=[...r.hosts],Ct(m,{hosts:[...r.hosts]})};r?(F.current=()=>void i(),P.current=setTimeout(()=>void i(),350)):(F.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=R):R=n[34];let z=R,V;return n[35]!==t||n[36]!==z||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(V={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)},installAll(){let t=e.scope===`global`?Tt:wt,n=D.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||D.current.includes(e));z([...n,...i],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>K({scope:e.scope,name:e.name,dir:n,mode:r})).then(jt)},unplaceAt(n){t.runLocationWrite(e,()=>ne({scope:e.scope,name:e.name,path:n})).then(At)},setSource(n){Ct(m,{source:n}),t.runLocationWrite(e,()=>G({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Ct(m,{source:null}),H.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=z,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=V):V=n[44],V}function At(e){e.ok||H.error(e.error)}function jt(e){e.ok||H.error(e.error)}function $(e){let t=(0,Z.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Y.jsx)(u,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Y.jsx)(d,{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,Y.jsxs)(f,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Mt(e){let t=(0,Z.c)(77),{toggles:n,skill:r,onResolveFork:o,onRunStart:s,menuKind:c}=e,u=c===void 0?`dropdown`:c,{_:d}=a(),{hostSet:f,toggleEditor:p,installAll:m}=n,h=J(),g,_,v,y,b,x,S,C,w,T;if(t[0]!==d||t[1]!==h.data||t[2]!==h.status||t[3]!==f||t[4]!==m||t[5]!==u||t[6]!==o||t[7]!==s||t[8]!==r||t[9]!==p||t[10]!==n){let{pathFor:e,aliases:a,rows:c,sourceRow:E,sourceHost:D,conflicted:O,drifted:k,linked:A,expectedMode:j,convertible:M,customRootRows:N}=Dt({skill:r,allSkills:h.status===`ready`?h.data:null,hostSet:f,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});b=c,x=E,y=j,_=M,v=N;let P=e=>oe(a,e),F=zt,I=e=>{let t=P(e);return t.length===0?!0:window.confirm(d({id:`Uobeu9`,values:{0:t.map(F).join(`, `),rootRel:e}}))},L;t[21]!==d||t[22]!==r?(L=(e,t)=>{let n=e.includes(`/`)?e:ae(e,r?.scope??`project`);return(0,Y.jsx)($,{hint:d({id:`0dslv8`,values:{0:F(e),1:F(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Y.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":d({id:`G6Lrs_`,values:{0:F(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(d({id:`iiqOKM`,values:{0:F(e),1:r.name,2:F(e),subRoot:n,poolRootRel:t}}))&&re({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?ee():H.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Y.jsx)(ot,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=d,t[22]=r,t[23]=L):L=t[23];let R=L;g=n.installing;let B=ie(r),V=Rt,U;t[24]!==d||t[25]!==s||t[26]!==n?(U=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,Y.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Y.jsx)(l,{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(d(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(s?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Y.jsx)(i,{id:`uUCrBv`}):(0,Y.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=s,t[26]=n,t[27]=U):U=t[27];let te=U,ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Y.jsx)(i,{id:`npcziF`}),t[28]=ne):ne=t[28];let G;t[29]===d?G=t[30]:(G=d({id:`6f_UX4`}),t[29]=d,t[30]=G);let K;t[31]===m?K=t[32]:(K=()=>m(),t[31]=m,t[32]=K);let q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Y.jsx)(i,{id:`N40H-G`}),t[33]=q):q=t[33];let J;t[34]!==g||t[35]!==K?(J=(0,Y.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:g,onClick:K,"data-testid":`skill-install-all`,children:q}),t[34]=g,t[35]=K,t[36]=J):J=t[36];let X;t[37]!==G||t[38]!==J?(X=(0,Y.jsx)($,{hint:G,children:J}),t[37]=G,t[38]=J,t[39]=X):X=t[39],t[40]!==u||t[41]!==X?(S=(0,Y.jsxs)(ft,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[ne,X]}),t[40]=u,t[41]=X,t[42]=S):S=t[42],C=x===null?null:(0,Y.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,Y.jsxs)(dt,{menuKind:u,disabled:g,checked:!0,onSelect:Lt,"data-testid":`skill-source-row`,children:[(0,Y.jsx)(W,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:x}),(()=>{let e=V(x).split(`/`).slice(0,-1).join(`/`),t=P(e);return t.length>0?(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>R(t,e))}):null})(),(0,Y.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,Y.jsx)(i,{id:`tiFPjk`})})]})]})}),w=b.map(t=>{let a=e(t),s=t===`agents`?`.agents`:z[t],c=V(a).split(`/`).slice(0,-1).join(`/`),m=P(c);return(0,Y.jsx)($,{hint:O.has(t)?d({id:`8HvJlU`,values:{0:a??s}}):t===D?a?d({id:`ssk6rl`,values:{path:a}}):s:f.has(t)?d(a?{id:`9ieZhu`,values:{path:a}}:{id:`n3T3EE`,values:{label:s}}):B?.editor===t?d({id:`_3S4Ql`,values:{0:r?.name??``,1:B.plugin,2:a??s,label:s}}):d(a?D===void 0?{id:`xk133d`,values:{path:a}}:y===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:s}}),children:(0,Y.jsxs)(dt,{menuKind:u,disabled:g,checked:f.has(t),onCheckedChange:e=>{O.has(t)||e===!0&&!I(c)||p(t,e===!0)},onSelect:It,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,Y.jsx)(ot,{host:t,"aria-hidden":!0,className:`size-4`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??s}),m.length>0?(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:m.map(e=>R(e,c))}):null,B?.editor===t&&!f.has(t)?(0,Y.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,Y.jsx)(i,{id:`scRzTw`})}):null,O.has(t)?(0,Y.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,Y.jsx)(l,{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(),o?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,Y.jsx)(i,{id:`jng7Ko`})})}):t===D?(0,Y.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,Y.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,Y.jsxs)(Y.Fragment,{children:[!g&&(A.has(t)?`link`:`copy`)!==y?te(t,a??s,A.has(t)?`link`:`copy`):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.jsx)(l,{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,Y.jsx)(i,{id:`VNNRfN`})})})]}):null,!g&&k.has(V(a))?(0,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(ct,{testId:`skill-drift-${t}`})}):null]})]})},t)}),T=v.map(e=>{let t=e.display;return(0,Y.jsx)($,{hint:e.placed===null?d(D===void 0?{id:`xk133d`,values:{path:t}}:y===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):d({id:`9ieZhu`,values:{path:t}}),children:(0,Y.jsxs)(dt,{menuKind:u,disabled:g,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!I(e.root))return;n.placeAt(e.root,y)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Ft,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Y.jsx)(ot,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Y.jsx)(W,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),P(e.root).length>0?(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:P(e.root).map(t=>R(t,e.root))}):null,!g&&e.placed!==null&&k.has(e.placed.path)?(0,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(ct,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Y.jsxs)(Y.Fragment,{children:[!g&&e.placed.mode!==y?te(e.root,e.display,e.placed.mode):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.jsx)(l,{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,Y.jsx)(i,{id:`VNNRfN`})})})]})]})]})},e.root)}),t[0]=d,t[1]=h.data,t[2]=h.status,t[3]=f,t[4]=m,t[5]=u,t[6]=o,t[7]=s,t[8]=r,t[9]=p,t[10]=n,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T}else g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20];let E;t[43]!==v||t[44]!==b.length||t[45]!==x?(E=b.length===0&&v.length===0&&x===null?(0,Y.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,Y.jsx)(i,{id:`MOAoFO`})}):null,t[43]=v,t[44]=b.length,t[45]=x,t[46]=E):E=t[46];let D;t[47]!==d||t[48]!==g||t[49]!==_||t[50]!==y||t[51]!==s||t[52]!==n?(D=_.length>0&&n.convertLocations?(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Y.jsx)(l,{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=y===`link`?`copy`:`link`,r=_.filter(e=>e.mode!==t);if(r.length===0)return;let i=d(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=d(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(Pt).join(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Qn as n}from"./DocumentContext-iKEZSiB2.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"./utils-CPqDy6Hr.js";import{t as c}from"./mascot-outline-CtS592mc.js";import{t as l}from"./button-CA0dewJJ.js";import{i as u,n as d,t as f}from"./tooltip-DPvMEqsq.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y}from"./alert-dialog-C8E8SkhJ.js";import{C as b,a as x,c as S,d as C,f as w,l as T,p as E,r as D,s as O,u as k}from"./terminal-cli-display-C-s_gqLX.js";import{a as A,d as j,f as M,i as N,n as P,o as F,p as I,u as L}from"./dropdown-menu-BpLbh79a.js";import{Yt as R,fo as z,ni as B,qt as V}from"./dist-DSS3ixln2.js";import{n as H}from"./dist-CuH7ikCn.js";import{c as ee}from"./documents-events-DCcMe0wm.js";import{t as U}from"./createLucideIcon-CAkY8Blx.js";import{c as W}from"./use-open-skill-Bwm3tOLL.js";import{t as te}from"./spinner-DmibE6UV.js";import{N as ne,S as re,j as G,x as K}from"./skills-api-BLXzXEC-.js";import{i as ie,l as ae,n as oe,r as q}from"./skill-scope-DWsJ838z.js";import{t as J}from"./use-skills-szHEgJLb.js";var Y=t(),X=e(r(),1),Z=o(),se=3100,ce=3;function le(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??ce;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var ue={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},de=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function fe(e,t={}){let n=t.rng??Math.random,r=t.colors??de,i=ue[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var pe=1.8,me=90,he=16,ge=380,_e=.025,ve=.1,ye=.18,be=400,xe=9.2736,Se=18.1799,Ce=14.5244,we={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Te(e,t){let{halfWidth:n,apexLift:r}=we[t];return`M${e-n} ${Ce+.3} Q${e} ${Ce-r}, ${e+n} ${Ce+.3}`}function Ee(e){let t=1.5,n=.3;return`M${e-t} ${Ce-n} Q${e} ${Ce+1.4}, ${e+t} ${Ce-n}`}var De=15,Oe=15;function ke(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function Ae(e){let t=(0,Z.c)(73),{size:n,className:r,style:i,trackMouse:a,variant:o,celebrateSignal:l,onRage:u}=e,d=n===void 0?48:n,f=a===void 0?!0:a,p=o===void 0?`default`:o,m=l===void 0?0:l,h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(null),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={x:0,y:0},t[0]=v):v=t[0];let y=(0,X.useRef)(v),[b,x]=(0,X.useState)(0),[S,C]=(0,X.useState)(0),[w,T]=(0,X.useState)(0),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,O]=(0,X.useState)(E),k=(0,X.useRef)(0),A=(0,X.useRef)(0),j=(0,X.useRef)(void 0),M=p===`sleeping`,N;t[2]!==b||t[3]!==M||t[4]!==u?(N=function(){if(M)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=A.current===0?1/0:e-A.current;A.current=e;let n=le(b,t),r=b===3&&e-k.current<3100,i=n===3&&r;n===3&&u?.(),x(n),C(Ie),i||(O(fe(n)),n===3&&(k.current=e,T(Fe))),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se)},t[2]=b,t[3]=M,t[4]=u,t[5]=N):N=t[5];let P=N,F,I;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>()=>clearTimeout(j.current),I=[],t[6]=F,t[7]=I):(F=t[6],I=t[7]),(0,X.useEffect)(F,I);let L,R;t[8]!==m||t[9]!==M?(L=()=>{m===0||M||(x(3),C(Pe),O(fe(3)),k.current=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),T(Ne),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se))},R=[m,M],t[8]=m,t[9]=M,t[10]=L,t[11]=R):(L=t[10],R=t[11]),(0,X.useEffect)(L,R);let z,B;t[12]!==M||t[13]!==f?(z=()=>{if(!f||M||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,c=function(){s===0&&(s=requestAnimationFrame(u))},l=function(r){e=r.clientX,t=r.clientY,n=!0,c()};function u(){s=0;let l=g.current,u=h.current;if(!l||!u){c();return}let d=n;n=!1;let f=l.getBoundingClientRect(),p=f.left+f.width/2,m=f.top+f.height*.48,v=e-p,b=t-m,x=Math.hypot(v,b),S=Math.max(-1,Math.min(1,v/ge)),C=-Math.max(-1,Math.min(1,b/ge))*he,w=S*he,T=0,E=0;if(x>=1){let e=Math.min(x/me,1)*pe;T=v/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!d&&D)return;c(),r+=(C-r)*ve,i+=(w-i)*ve,u.style.transform=`perspective(${be}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*ye,o+=(E-o)*ye;let O=i*_e,k=-r*_e,A=a+O,j=o+k;y.current.x=A,y.current.y=j,_.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,l,{passive:!0}),c(),()=>{document.removeEventListener(`mousemove`,l),s!==0&&cancelAnimationFrame(s),s=0,h.current&&(h.current.style.transform=``),y.current={x:0,y:0},_.current?.removeAttribute(`transform`)}},B=[f,M],t[12]=M,t[13]=f,t[14]=z,t[15]=B):(z=t[14],B=t[15]),(0,X.useEffect)(z,B);let V;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{let e=_.current;if(!e)return;let{x:t,y:n}=y.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=V):V=t[16],(0,X.useLayoutEffect)(V);let H=b>0,ee=H?b:1,U=H?`ok-blob-clicked-${b}`:null,W;t[17]===r?W=t[18]:(W=s(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=W);let te=M?`cursor-default`:`cursor-pointer`,ne=`body-${S}`,re=M&&`ok-blob-sleeping`,G;t[19]!==U||t[20]!==re?(G=s(`ok-blob-group`,re,U),t[19]=U,t[20]=re,t[21]=G):G=t[21];let K;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Y.jsx)(`path`,{d:c,className:`ok-blob-body`}),t[22]=K):K=t[22];let ie=(H||M)&&`ok-blob-eye-hidden`,ae;t[23]===ie?ae=t[24]:(ae=s(`ok-blob-eye`,ie),t[23]=ie,t[24]=ae);let oe;t[25]===ae?oe=t[26]:(oe=(0,Y.jsx)(`ellipse`,{cx:xe,cy:Ce,rx:1.2722,ry:1.9083,className:ae}),t[25]=ae,t[26]=oe);let q=(H||M)&&`ok-blob-eye-hidden`,J;t[27]===q?J=t[28]:(J=s(`ok-blob-eye ok-blob-eye-right`,q),t[27]=q,t[28]=J);let ce;t[29]===J?ce=t[30]:(ce=(0,Y.jsx)(`ellipse`,{cx:Se,cy:Ce,rx:1.2722,ry:1.9083,className:J}),t[29]=J,t[30]=ce);let ue;t[31]===ee?ue=t[32]:(ue=Te(xe,ee),t[31]=ee,t[32]=ue);let de=(!H||M)&&`ok-blob-eye-hidden`,we;t[33]===de?we=t[34]:(we=s(`ok-blob-happy-eye`,de),t[33]=de,t[34]=we);let De;t[35]!==ue||t[36]!==we?(De=(0,Y.jsx)(`path`,{d:ue,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:we}),t[35]=ue,t[36]=we,t[37]=De):De=t[37];let Oe;t[38]===ee?Oe=t[39]:(Oe=Te(Se,ee),t[38]=ee,t[39]=Oe);let ke=(!H||M)&&`ok-blob-eye-hidden`,Ae;t[40]===ke?Ae=t[41]:(Ae=s(`ok-blob-happy-eye`,ke),t[40]=ke,t[41]=Ae);let Le;t[42]!==Oe||t[43]!==Ae?(Le=(0,Y.jsx)(`path`,{d:Oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:Ae}),t[42]=Oe,t[43]=Ae,t[44]=Le):Le=t[44];let Re;t[45]===M?Re=t[46]:(Re=M?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:Ee(xe),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Y.jsx)(`path`,{d:Ee(Se),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=M,t[46]=Re);let ze;t[47]!==oe||t[48]!==ce||t[49]!==De||t[50]!==Le||t[51]!==Re?(ze=(0,Y.jsxs)(`g`,{ref:_,children:[oe,ce,De,Le,Re]}),t[47]=oe,t[48]=ce,t[49]=De,t[50]=Le,t[51]=Re,t[52]=ze):ze=t[52];let Q;t[53]!==ne||t[54]!==G||t[55]!==ze?(Q=(0,Y.jsxs)(`g`,{className:G,children:[K,ze]},ne),t[53]=ne,t[54]=G,t[55]=ze,t[56]=Q):Q=t[56];let Be;t[57]===M?Be=t[58]:(Be=M?(0,Y.jsxs)(`g`,{children:[(0,Y.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Y.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=M,t[58]=Be);let Ve;t[59]!==w||t[60]!==D?(Ve=D.length>0&&(0,Y.jsx)(`g`,{"data-slot":`ok-blob-burst`,children:D.map(je)},`firework-${w}`),t[59]=w,t[60]=D,t[61]=Ve):Ve=t[61];let He;t[62]!==P||t[63]!==d||t[64]!==te||t[65]!==Q||t[66]!==Be||t[67]!==Ve?(He=(0,Y.jsxs)(`svg`,{ref:g,width:d,height:d,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:te,"aria-hidden":`true`,onClick:P,onMouseDown:Me,children:[Q,Be,Ve]}),t[62]=P,t[63]=d,t[64]=te,t[65]=Q,t[66]=Be,t[67]=Ve,t[68]=He):He=t[68];let Ue;return t[69]!==i||t[70]!==W||t[71]!==He?(Ue=(0,Y.jsx)(`span`,{ref:h,className:W,style:i,children:He}),t[69]=i,t[70]=W,t[71]=He,t[72]=Ue):Ue=t[72],Ue}function je(e){return(0,Y.jsx)(`circle`,{cx:De+e.originDx,cy:Oe+e.originDy,r:e.size,className:`ok-blob-firework`,style:ke(e)},e.id)}function Me(e){return e.preventDefault()}function Ne(e){return e+1}function Pe(e){return e+1}function Fe(e){return e+1}function Ie(e){return e+1}var Le=U(`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`}]]),Re=U(`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`}]]),ze=U(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=[...new Set(b.flatMap(e=>e.schemes))];function Be(e,t){let n=t.now?.()??Date.now(),r={};for(let t of b){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 Ve(e){return Be({},e)}async function He(e){let t=e.schemes??Q,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 Ue=Object.fromEntries(Q.map(e=>[e,{installed:!1}]));async function We(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 Ue}if(!t.ok)return Ue;let n;try{n=await t.json()}catch{return Ue}if(typeof n!=`object`||!n||Array.isArray(n))return Ue;let r=n,i={};for(let e of Q)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Ge(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 Ke(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Ve({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Be(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=!Ge(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 qe(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Je(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>He({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>We({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Ye(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(Xe),r=(0,X.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Ke(Je());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,X.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 Xe(){return Ve({isElectronHost:qe(),now:Date.now})}var Ze=(0,X.createContext)(null);function Qe(e){let t=(0,Z.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Y.jsx)(Ze,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function $e(){return(0,X.use)(Ze)}function et(e){return!(e instanceof Error)||e.name!==`NotAllowedError`?!1:/permission denied|permissions policy/i.test(e.message)}function tt(e){let t=globalThis.document;if(!t?.body||typeof t.createElement!=`function`||typeof t.execCommand!=`function`)return!1;let n=t.createElement(`textarea`);n.value=e,n.style.position=`fixed`,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`readonly`,``),t.body.appendChild(n);try{return n.focus(),n.select(),t.execCommand(`copy`)}catch{return!1}finally{n.remove()}}async function nt(e){let t=globalThis.okDesktop?.clipboard;if(t&&typeof t.writeText==`function`){await t.writeText(e);return}let n=globalThis.navigator?.clipboard;if(n&&typeof n.writeText==`function`)try{await n.writeText(e);return}catch(t){if(tt(e))return;throw t}if(!tt(e))throw Error(`clipboard API unavailable`)}function rt(e){let t=(0,Z.c)(48),{itemName:n,isSubmitting:r,onDelete:o,customTitle:s,customDescription:c,customDetail:u,customConfirmLabel:d,customConfirmLabelBusy:f,children:b}=e,{_:x}=a(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==d?(w=d??x({id:`cnGeoo`}),t[3]=x,t[4]=d,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==d||t[8]!==f?(E=f??d??x({id:`s3caR3`}),t[6]=x,t[7]=d,t[8]=f,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==s||t[12]!==C?(O=s??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=s,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,Y.jsx)(g,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==c||t[18]!==C?(A=c??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=c,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,Y.jsx)(_,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===u?M=t[23]:(M=u?(0,Y.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:u}):null,t[22]=u,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,Y.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,Y.jsx)(v,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsx)(i,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===r?I=t[32]:(I=(0,Y.jsx)(h,{disabled:r,children:F}),t[31]=r,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==r?(L=r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(te,{"aria-hidden":`true`,className:`size-4`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=r,t[36]=L):L=t[36];let R;t[37]!==r||t[38]!==o||t[39]!==L?(R=(0,Y.jsx)(l,{variant:`destructive`,onClick:o,disabled:r,children:L}),t[37]=r,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,Y.jsxs)(y,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,Y.jsxs)(p,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function it(e){return e===`agents`||e===`.agents`||e.startsWith(`.agents/`)?`.agents`:e.includes(`/`)?e:z[e]??e}function at(e){return e===`claude`?`claude-code`:e}function ot(e){let t=(0,Z.c)(18),r,i;if(t[0]===e?(r=t[1],i=t[2]):({host:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`agents`){let e;return t[3]===i?e=t[4]:(e=(0,Y.jsx)(n,{...i}),t[3]=i,t[4]=e),e}if(r.includes(`/`)){if(r===`.agents`||r.startsWith(`.agents/`)){let e;return t[5]===i?e=t[6]:(e=(0,Y.jsx)(n,{...i}),t[5]=i,t[6]=e),e}if(r===`.ok`||r.startsWith(`.ok/`)){let e;if(t[7]!==i){let{className:n,...r}=i;e=r,t[7]=i,t[8]=e}else e=t[8];let n=e,r;return t[9]===n?r=t[10]:(r=(0,Y.jsx)(Ae,{size:14,...n}),t[9]=n,t[10]=r),r}let e;return t[11]===i?e=t[12]:(e=(0,Y.jsx)(W,{...i}),t[11]=i,t[12]=e),e}let a;t[13]===r?a=t[14]:(a=at(r),t[13]=r,t[14]=a);let o;return t[15]!==i||t[16]!==a?(o=(0,Y.jsx)(D,{...i,id:a}),t[15]=i,t[16]=a,t[17]=o):o=t[17],o}function st(e){let t=(0,Z.c)(14),{hosts:n,className:r,iconClassName:i}=e,a,o,c;if(t[0]!==r||t[1]!==n||t[2]!==i){let e=n.slice(0,2),l=n.slice(2);t[6]===r?a=t[7]:(a=s(`flex items-center gap-1`,r),t[6]=r,t[7]=a);let p;t[8]===i?p=t[9]:(p=e=>(0,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,Y.jsx)(ot,{host:e,className:s(`size-3.5 shrink-0`,i),"aria-label":it(e)})})}),(0,Y.jsx)(d,{children:it(e)})]},e),t[8]=i,t[9]=p),o=e.map(p),c=l.length>0?(0,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsxs)(`span`,{className:`ml-0.5 cursor-default`,children:[`+`,l.length]})}),(0,Y.jsx)(d,{children:l.map(it).join(`, `)})]}):null,t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=c}else a=t[3],o=t[4],c=t[5];let l;return t[10]!==a||t[11]!==o||t[12]!==c?(l=(0,Y.jsxs)(`span`,{className:a,children:[o,c]}),t[10]=a,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function ct(e){let t=(0,Z.c)(6),{testId:n,title:r}=e,a;t[0]===r?a=t[1]:(a=r===void 0?{}:{title:r},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,Y.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 lt(e){let t=(0,Z.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,Y.jsx)(O,{...r}):(0,Y.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ut(e){let t=(0,Z.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,Y.jsx)(S,{...r}):(0,Y.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function dt(e){let t=(0,Z.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,Y.jsx)(x,{...r}):(0,Y.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ft(e){let t=(0,Z.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,Y.jsx)(T,{...r}):(0,Y.jsx)(F,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function pt(e){let t=(0,Z.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,Y.jsx)(k,{...r}):(0,Y.jsx)(L,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function mt(e){let t=(0,Z.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,Y.jsx)(C,{...r}):(0,Y.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ht(e){let t=(0,Z.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,Y.jsx)(w,{...r}):(0,Y.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function gt(e){let t=(0,Z.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,Y.jsx)(E,{...r}):(0,Y.jsx)(I,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var _t=Object.freeze({hosts:null,source:null}),vt=new Map,yt=new Map;function bt(e,t){return`${e}:${t}`}function xt(e){return vt.get(e)??_t}function St(e,t){let n=yt.get(e)??new Set;return yt.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&yt.delete(e)}}function Ct(e,t){let n=xt(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?vt.delete(e):vt.set(e,r);for(let t of yt.get(e)??[])t()}}var wt=V.options,Tt=R.options,Et=`.agents/`;function Dt({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${ae(t,e.scope)}/${e.name}`:null,o=e!==void 0&&((e.hosts??[]).includes(`agents`)||t?.some(e=>e.hosts.includes(`agents`)||e.path.startsWith(Et))),s=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),c=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),l=c?new Set(c):null,u=e?.scope===`global`?Tt:wt,d=(o?[...u,`agents`]:u).filter(e=>!(e in s)).filter(e=>e===`agents`||l===null||l.has(e)||n.has(e)),f=new Set(d.map(e=>a(e))),p=e?.scope===`global`?`~/`:``,m=e?.path?.includes(`/`)?`${p}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,h=m!==null&&!f.has(m)?m:null,g=h===null?r??e?.hosts?.[0]:void 0,_=new Set(e?.conflictHosts??[]),v=new Set(e?.driftPaths??[]),y=new Set(e?.symlinkedHosts??[]),b=[...[...n].filter(e=>e!==g&&!(e in s)&&!_.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:y.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:q(e),display:`${p}${e.path}`,mode:e.mode}))],x=b.map(e=>e.mode),S=x.filter(e=>e===`link`).length,C=x.length===0?i?`link`:`copy`:S*2>=x.length?`link`:`copy`,w=new Map((e?.customPlacements??[]).map(e=>[q(e),e])),T=new Set(w.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=q(e);t!==``&&T.add(t)}}return{pathFor:a,aliases:s,rows:d,sourceRow:h,sourceHost:g,conflicted:_,drifted:v,linked:y,expectedMode:C,convertible:b,customRootRows:e===void 0?[]:[...T].sort().map(t=>({root:t,display:`${p}${t}/${e.name}`,placed:w.get(t)??null})).filter(e=>!f.has(e.display)&&e.display!==m&&!(e.root in s))}}var Ot=`min-w-[24rem]`;function kt(e,t){let n=(0,Z.c)(45),r=t.installingName===e.name,i=(0,X.useRef)(e),[a,o]=(0,X.useState)(!1),s=(0,X.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,X.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,X.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=bt(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>St(m,e),g=()=>xt(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,X.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&Ct(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,X.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,X.useRef)(e.hosts),O,k;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},k=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=k):(O=n[21],k=n[22]),(0,X.useEffect)(O,k);let A;n[23]===e.hosts?A=n[24]:(A=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=A);let j=A,M,N;n[25]!==m||n[26]!==j?(M=()=>{let e=xt(m).hosts;e&&[...e].sort().join(`,`)===j&&Ct(m,{hosts:null})},N=[j,m],n[25]=m,n[26]=j,n[27]=M,n[28]=N):(M=n[27],N=n[28]),(0,X.useEffect)(M,N);let P=(0,X.useRef)(null),F=(0,X.useRef)(null),I,L;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current),F.current?.(),F.current=null},L=[],n[29]=I,n[30]=L):(I=n[29],L=n[30]),(0,X.useEffect)(I,L);let R;n[31]!==t||n[32]!==m||n[33]!==e?(R=function(n,r){D.current=n,Ct(m,{hosts:n}),P.current&&clearTimeout(P.current);let i=async()=>{F.current=null,P.current=null;let r=await t.install(e,n.filter(B));if(!r.ok){Ct(m,{hosts:null});return}D.current=[...r.hosts],Ct(m,{hosts:[...r.hosts]})};r?(F.current=()=>void i(),P.current=setTimeout(()=>void i(),350)):(F.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=R):R=n[34];let z=R,V;return n[35]!==t||n[36]!==z||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(V={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)},installAll(){let t=e.scope===`global`?Tt:wt,n=D.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||D.current.includes(e));z([...n,...i],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>K({scope:e.scope,name:e.name,dir:n,mode:r})).then(jt)},unplaceAt(n){t.runLocationWrite(e,()=>ne({scope:e.scope,name:e.name,path:n})).then(At)},setSource(n){Ct(m,{source:n}),t.runLocationWrite(e,()=>G({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Ct(m,{source:null}),H.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=z,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=V):V=n[44],V}function At(e){e.ok||H.error(e.error)}function jt(e){e.ok||H.error(e.error)}function $(e){let t=(0,Z.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Y.jsx)(u,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Y.jsx)(d,{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,Y.jsxs)(f,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Mt(e){let t=(0,Z.c)(77),{toggles:n,skill:r,onResolveFork:o,onRunStart:s,menuKind:c}=e,u=c===void 0?`dropdown`:c,{_:d}=a(),{hostSet:f,toggleEditor:p,installAll:m}=n,h=J(),g,_,v,y,b,x,S,C,w,T;if(t[0]!==d||t[1]!==h.data||t[2]!==h.status||t[3]!==f||t[4]!==m||t[5]!==u||t[6]!==o||t[7]!==s||t[8]!==r||t[9]!==p||t[10]!==n){let{pathFor:e,aliases:a,rows:c,sourceRow:E,sourceHost:D,conflicted:O,drifted:k,linked:A,expectedMode:j,convertible:M,customRootRows:N}=Dt({skill:r,allSkills:h.status===`ready`?h.data:null,hostSet:f,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});b=c,x=E,y=j,_=M,v=N;let P=e=>oe(a,e),F=zt,I=e=>{let t=P(e);return t.length===0?!0:window.confirm(d({id:`Uobeu9`,values:{0:t.map(F).join(`, `),rootRel:e}}))},L;t[21]!==d||t[22]!==r?(L=(e,t)=>{let n=e.includes(`/`)?e:ae(e,r?.scope??`project`);return(0,Y.jsx)($,{hint:d({id:`0dslv8`,values:{0:F(e),1:F(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Y.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":d({id:`G6Lrs_`,values:{0:F(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(d({id:`iiqOKM`,values:{0:F(e),1:r.name,2:F(e),subRoot:n,poolRootRel:t}}))&&re({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?ee():H.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Y.jsx)(ot,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=d,t[22]=r,t[23]=L):L=t[23];let R=L;g=n.installing;let B=ie(r),V=Rt,U;t[24]!==d||t[25]!==s||t[26]!==n?(U=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,Y.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Y.jsx)(l,{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(d(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(s?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Y.jsx)(i,{id:`uUCrBv`}):(0,Y.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=s,t[26]=n,t[27]=U):U=t[27];let te=U,ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Y.jsx)(i,{id:`npcziF`}),t[28]=ne):ne=t[28];let G;t[29]===d?G=t[30]:(G=d({id:`6f_UX4`}),t[29]=d,t[30]=G);let K;t[31]===m?K=t[32]:(K=()=>m(),t[31]=m,t[32]=K);let q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Y.jsx)(i,{id:`N40H-G`}),t[33]=q):q=t[33];let J;t[34]!==g||t[35]!==K?(J=(0,Y.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:g,onClick:K,"data-testid":`skill-install-all`,children:q}),t[34]=g,t[35]=K,t[36]=J):J=t[36];let X;t[37]!==G||t[38]!==J?(X=(0,Y.jsx)($,{hint:G,children:J}),t[37]=G,t[38]=J,t[39]=X):X=t[39],t[40]!==u||t[41]!==X?(S=(0,Y.jsxs)(ft,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[ne,X]}),t[40]=u,t[41]=X,t[42]=S):S=t[42],C=x===null?null:(0,Y.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,Y.jsxs)(dt,{menuKind:u,disabled:g,checked:!0,onSelect:Lt,"data-testid":`skill-source-row`,children:[(0,Y.jsx)(W,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:x}),(()=>{let e=V(x).split(`/`).slice(0,-1).join(`/`),t=P(e);return t.length>0?(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>R(t,e))}):null})(),(0,Y.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,Y.jsx)(i,{id:`tiFPjk`})})]})]})}),w=b.map(t=>{let a=e(t),s=t===`agents`?`.agents`:z[t],c=V(a).split(`/`).slice(0,-1).join(`/`),m=P(c);return(0,Y.jsx)($,{hint:O.has(t)?d({id:`8HvJlU`,values:{0:a??s}}):t===D?a?d({id:`ssk6rl`,values:{path:a}}):s:f.has(t)?d(a?{id:`9ieZhu`,values:{path:a}}:{id:`n3T3EE`,values:{label:s}}):B?.editor===t?d({id:`_3S4Ql`,values:{0:r?.name??``,1:B.plugin,2:a??s,label:s}}):d(a?D===void 0?{id:`xk133d`,values:{path:a}}:y===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:s}}),children:(0,Y.jsxs)(dt,{menuKind:u,disabled:g,checked:f.has(t),onCheckedChange:e=>{O.has(t)||e===!0&&!I(c)||p(t,e===!0)},onSelect:It,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,Y.jsx)(ot,{host:t,"aria-hidden":!0,className:`size-4`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??s}),m.length>0?(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:m.map(e=>R(e,c))}):null,B?.editor===t&&!f.has(t)?(0,Y.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,Y.jsx)(i,{id:`scRzTw`})}):null,O.has(t)?(0,Y.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,Y.jsx)(l,{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(),o?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,Y.jsx)(i,{id:`jng7Ko`})})}):t===D?(0,Y.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,Y.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,Y.jsxs)(Y.Fragment,{children:[!g&&(A.has(t)?`link`:`copy`)!==y?te(t,a??s,A.has(t)?`link`:`copy`):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.jsx)(l,{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,Y.jsx)(i,{id:`VNNRfN`})})})]}):null,!g&&k.has(V(a))?(0,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(ct,{testId:`skill-drift-${t}`})}):null]})]})},t)}),T=v.map(e=>{let t=e.display;return(0,Y.jsx)($,{hint:e.placed===null?d(D===void 0?{id:`xk133d`,values:{path:t}}:y===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):d({id:`9ieZhu`,values:{path:t}}),children:(0,Y.jsxs)(dt,{menuKind:u,disabled:g,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!I(e.root))return;n.placeAt(e.root,y)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Ft,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Y.jsx)(ot,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Y.jsx)(W,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),P(e.root).length>0?(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:P(e.root).map(t=>R(t,e.root))}):null,!g&&e.placed!==null&&k.has(e.placed.path)?(0,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(ct,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Y.jsxs)(Y.Fragment,{children:[!g&&e.placed.mode!==y?te(e.root,e.display,e.placed.mode):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.jsx)(l,{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,Y.jsx)(i,{id:`VNNRfN`})})})]})]})]})},e.root)}),t[0]=d,t[1]=h.data,t[2]=h.status,t[3]=f,t[4]=m,t[5]=u,t[6]=o,t[7]=s,t[8]=r,t[9]=p,t[10]=n,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T}else g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20];let E;t[43]!==v||t[44]!==b.length||t[45]!==x?(E=b.length===0&&v.length===0&&x===null?(0,Y.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,Y.jsx)(i,{id:`MOAoFO`})}):null,t[43]=v,t[44]=b.length,t[45]=x,t[46]=E):E=t[46];let D;t[47]!==d||t[48]!==g||t[49]!==_||t[50]!==y||t[51]!==s||t[52]!==n?(D=_.length>0&&n.convertLocations?(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Y.jsx)(l,{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=y===`link`?`copy`:`link`,r=_.filter(e=>e.mode!==t);if(r.length===0)return;let i=d(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=d(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(Pt).join(`
2
2
  `);window.confirm(`${i}\n\n${a}\n\n${o}\n\n${d({id:`Cu6GXQ`})}`)&&(s?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:g,"data-testid":`skill-convert-all`,children:y===`link`?(0,Y.jsx)(i,{id:`rcJmK8`}):(0,Y.jsx)(i,{id:`LBv_TR`})}),(0,Y.jsx)($,{hint:d({id:`0J6nhG`}),children:(0,Y.jsx)(l,{variant:`ghost`,size:`sm`,"aria-label":d({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:Nt,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[47]=d,t[48]=g,t[49]=_,t[50]=y,t[51]=s,t[52]=n,t[53]=D):D=t[53];let O;t[54]===u?O=t[55]:(O=(0,Y.jsx)(pt,{menuKind:u}),t[54]=u,t[55]=O);let k;t[56]===d?k=t[57]:(k=d({id:`5ymuTA`}),t[56]=d,t[57]=k);let A;t[58]===r?.scope?A=t[59]:(A=()=>{window.location.hash=r?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[58]=r?.scope,t[59]=A);let j,M;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Y.jsx)(ze,{"aria-hidden":!0}),M=(0,Y.jsx)(i,{id:`ZBF9fn`}),t[60]=j,t[61]=M):(j=t[60],M=t[61]);let N;t[62]!==u||t[63]!==A?(N=(0,Y.jsxs)(ut,{menuKind:u,onSelect:A,children:[j,M]}),t[62]=u,t[63]=A,t[64]=N):N=t[64];let P;t[65]!==N||t[66]!==k?(P=(0,Y.jsx)($,{hint:k,children:N}),t[65]=N,t[66]=k,t[67]=P):P=t[67];let F;return t[68]!==P||t[69]!==S||t[70]!==C||t[71]!==w||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==O?(F=(0,Y.jsxs)(Y.Fragment,{children:[S,C,w,T,E,D,O,P]}),t[68]=P,t[69]=S,t[70]=C,t[71]=w,t[72]=T,t[73]=E,t[74]=D,t[75]=O,t[76]=F):F=t[76],F}function Nt(e){return e.preventDefault()}function Pt(e){return e.display}function Ft(e){return e.preventDefault()}function It(e){return e.preventDefault()}function Lt(e){return e.preventDefault()}function Rt(e){return(e??``).replace(/^~\//,``)}function zt(e){return e===`agents`?`.agents`:z[e]??e}export{ze as C,Ae as E,Ye as S,Le as T,rt as _,wt as a,Qe as b,ft as c,ht as d,gt as f,it as g,st as h,Tt as i,pt as l,ot as m,Mt as n,lt as o,ct as p,kt as r,ut as s,Ot as t,mt as u,et as v,Re as w,$e as x,nt as y};
@@ -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"./SkillInstallMenu-BYR9N4q6.js";import{t as c}from"./button-CA0dewJJ.js";import{a as l,m as u,r as d,t as f,u as p}from"./dropdown-menu-BpLbh79a.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./select-fWSYgcDA.js";import{l as x,n as S,r as C,t as w}from"./AddPropertiesButton-7dCoyBvE.js";import{t as T}from"./list-plus-1_iMFVqs.js";import{p as E,t as D}from"./skill-scope-DWsJ838z.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=E(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(y,{}),t[6]=x):x=t[6];let S;t[7]!==f||t[8]!==p?(S=(0,k.jsx)(_,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:x}),t[7]=f,t[8]=p,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(m,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===u?w=t[12]:(w=D.map(e=>(0,k.jsx)(h,{value:e,children:u[e]},e)),t[11]=u,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(g,{align:`end`,children:(0,k.jsxs)(v,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==s||t[16]!==d||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(b,{value:n,onValueChange:d,disabled:s,children:[S,T]}),t[15]=s,t[16]=d,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)(x,{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:m,problemCount:h,problemMessages:g}=e,{_}=i(),v;t[0]!==a||t[1]!==n?(v={scope:n,name:a},t[0]=a,t[1]=n,t[2]=v):v=t[2];let y=M(v),b;t[3]!==y.requestMove||t[4]!==n?(b=(0,k.jsx)(A,{value:n,onRequestMove:y.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=y.requestMove,t[4]=n,t[5]=b):b=t[5];let x;t[6]!==a||t[7]!==n?(x=(0,k.jsx)(C,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=x):x=t[8];let E;t[9]!==b||t[10]!==x?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,x]}),t[9]=b,t[10]=x,t[11]=E):E=t[11];let D;t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==o?(D=o?(0,k.jsx)(w,{onAddProperty:m,problemCount:h,problemMessages:g,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=m,t[13]=h,t[14]=g,t[15]=o,t[16]=D):D=t[16];let j;t[17]===_?j=t[18]:(j=_({id:`Yzs3QX`}),t[17]=_,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(u,{asChild:!0,children:(0,k.jsx)(c,{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]===y?F=t[23]:(F=e=>y.requestMove(e),t[22]=y,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(S,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==m||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(p,{}),(0,k.jsxs)(l,{onSelect:m,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=m,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(d,{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)(f,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==y.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,y.dialog]}),t[36]=y.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"./SkillInstallMenu-CP0nLWRp.js";import{t as c}from"./button-CA0dewJJ.js";import{a as l,m as u,r as d,t as f,u as p}from"./dropdown-menu-BpLbh79a.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./select-fWSYgcDA.js";import{l as x,n as S,r as C,t as w}from"./AddPropertiesButton-gQRcjJmF.js";import{t as T}from"./list-plus-1_iMFVqs.js";import{p as E,t as D}from"./skill-scope-DWsJ838z.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=E(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(y,{}),t[6]=x):x=t[6];let S;t[7]!==f||t[8]!==p?(S=(0,k.jsx)(_,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:x}),t[7]=f,t[8]=p,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(m,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===u?w=t[12]:(w=D.map(e=>(0,k.jsx)(h,{value:e,children:u[e]},e)),t[11]=u,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(g,{align:`end`,children:(0,k.jsxs)(v,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==s||t[16]!==d||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(b,{value:n,onValueChange:d,disabled:s,children:[S,T]}),t[15]=s,t[16]=d,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)(x,{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:m,problemCount:h,problemMessages:g}=e,{_}=i(),v;t[0]!==a||t[1]!==n?(v={scope:n,name:a},t[0]=a,t[1]=n,t[2]=v):v=t[2];let y=M(v),b;t[3]!==y.requestMove||t[4]!==n?(b=(0,k.jsx)(A,{value:n,onRequestMove:y.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=y.requestMove,t[4]=n,t[5]=b):b=t[5];let x;t[6]!==a||t[7]!==n?(x=(0,k.jsx)(C,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=x):x=t[8];let E;t[9]!==b||t[10]!==x?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,x]}),t[9]=b,t[10]=x,t[11]=E):E=t[11];let D;t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==o?(D=o?(0,k.jsx)(w,{onAddProperty:m,problemCount:h,problemMessages:g,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=m,t[13]=h,t[14]=g,t[15]=o,t[16]=D):D=t[16];let j;t[17]===_?j=t[18]:(j=_({id:`Yzs3QX`}),t[17]=_,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(u,{asChild:!0,children:(0,k.jsx)(c,{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]===y?F=t[23]:(F=e=>y.requestMove(e),t[22]=y,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(S,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==m||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(p,{}),(0,k.jsxs)(l,{onSelect:m,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=m,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(d,{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)(f,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==y.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,y.dialog]}),t[36]=y.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{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{En as n,It as r,Rt as i,U as a,_n as o,bt as s,en as c,hn as l,jn as u,lt as d,mt as f,st as p,tn as m,ut as h,yt as g}from"./DocumentContext-CpeWitiW.js";import{t as _}from"./react-f2sANaYj.js";import{n as v}from"./dist-PQ5KMVDh.js";import{t as ee}from"./compiler-runtime-BfE3aGVn.js";import{J as y,M as b,X as x,a as te,b as S,i as ne,o as re}from"./CodeMirrorPropInput-CZg3NpYe.js";import{Co as C,No as w,T as ie,Xi as ae,_o as T,ai as E}from"./dist-DSS3ixln2.js";import{i as oe}from"./use-apply-config-theme-B1eLRQeV.js";import{C as D,F as se,M as ce,N as le,R as ue,T as O,f as k,i as de,k as fe,p as pe,r as me,t as he,u as ge}from"./typing-burst-detector-DlSk3HmB.js";import"./config-provider-Bavv18lD.js";import{$ as A,D as j,Dt as M,F as N,It as P,Lt as F,Ot as I,Pt as L,Y as R,Z as z,b as B,ct as V,ft as _e,g as H,gt as U,ht as ve,it as W,kt as ye,l as G,lt as K,nt as q,pt as J,rt as Y,ut as X,v as Z}from"./dist-EbTHn-HD.js";import{a as be,n as xe}from"./cm-theme-CqnwWjn0.js";import{i as Se,n as Ce,o as we,r as Te}from"./dist-ezYezphN.js";import{o as Ee,r as De}from"./selection-context-BVomF0mV.js";import{l as Oe}from"./lint-config-client-CumTSl-t.js";import{a as ke,i as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./dist-BFkXO51e2.js";import{n as Ie,t as Le}from"./src-Dpmb3U7E.js";var Q=e(_(),1),Re=ee();function ze(){let e=g();return e===null?null:new Set(e.keys())}function Be(e,t,n){let r=[],i=N(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);C.lastIndex=0;for(let e=C.exec(t);e!==null;e=C.exec(t)){let t=e[2];if(!w(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),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&w(c)&&n!=null)return r.push(R.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=p.exec(s);if(l)return r.push(R.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[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 Ve(e){let t=h(e);return t===null?[]:[A.fromClass(class{decorations;constructor(e){this.decorations=Be(e.state,e.visibleRanges,ze())}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=Be(e.view.state,e.view.visibleRanges,ze()))}},{decorations:e=>e.decorations}),z.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=g()?.get(i);return e===void 0?f():window.location.hash=s(i,e),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=d(t,e,o),!0)}})]}var He=R.line({attributes:{dir:`auto`}});function Ue(e){let t=new L;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,He),r=n.to+1}return t.finish()}var We=A.fromClass(class{decorations;constructor(e){this.decorations=Ue(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ue(e.view))}},{decorations:e=>e.decorations}),Ge=[z.perLineTextDirection.of(!0),We],Ke=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),qe=`cm-lint-local-target`;function Je(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 Ye(e,t){let n=H(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Ke.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function Xe(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function Ze(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Ye(e,Je(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:Xe(i.severity),message:O(i),source:`${i.source}/${i.code}`,markClass:qe})}return r}var Qe=P.define();function $e(e){let t={findings:[]};return[Ae(e=>y()?Ze(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(Qe)))}),A.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:Qe.of(null)}),Fe(n)},i=D(e,e=>{e.status===`loaded`&&r(e.findings)}),a=x(()=>r(t.findings));return{destroy(){i(),a()}}})]}function et(e,t){return e.enabled?[je(),Ae(async n=>tt(n.state.doc,await E(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 tt(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=nt(r);o&&(a.actions=[o]),n.push(a)}return n}function nt(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 rt=[J(),K(),X(),Z(),Y(),W(),ye.allowMultipleSelections.of(!0),j(),G(),Te(),Ce(),U(),q(),V(),ke(),_e.of([...Se,...xe,...Pe,...B,...we,...Ne])],it=R.mark({class:`cm-link-ref-broken`}),at=/^\s{0,3}\[([^\]]+)\]:\s/,ot=/\[([^\]]*)\]\[([^\]]*)\]/g,st=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ct(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 lt(e){let t=[];return N(e).iterate({enter(e){if(st.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function ut(e){let t=new Set,n=[],r=e.doc,i=lt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ct(n.from,i))continue;let a=at.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ct(t.from,i)&&!at.test(t.text))for(ot.lastIndex=0;;){let e=ot.exec(t.text);if(!e)break;let r=t.from+e.index;if(ct(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(it.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),R.set(a)}var dt=F.define({create(e){return ut(e)},update(e,t){return t.docChanged?ut(t.state):e},provide:e=>z.decorations.from(e)}),ft=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,pt=R.mark({class:`cm-del`}),mt=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),ht=R.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function gt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function _t(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!T.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(T.test(r.text))return{from:t.from,to:r.to}}return null}function vt(e,t){let n=[],r=N(e),i=_t(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(pt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=ft.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=gt(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(mt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(ht.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(ht.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(n)}var yt=class{decorations;constructor(e){this.decorations=vt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=vt(e.view.state,e.view.visibleRanges))}},bt=A.fromClass(yt,{decorations:e=>e.decorations});function xt(){return[bt,dt]}var St=t(),Ct=P.define();function wt(e,t,n){let r=k(e.state.doc)[t.index];r&&u(n,()=>{e.dispatch({selection:I.cursor(r.from),effects:z.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function Tt(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);u(r,()=>{e.dispatch({selection:I.cursor(a),effects:z.scrollIntoView(a,{y:`center`})}),e.focus()})})}function Et(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);u(n,()=>{e.dispatch({selection:I.cursor(o),effects:z.scrollIntoView(o,{y:`start`})}),e.focus()})}function Dt(e){let t=(0,Re.c)(50),{docName:s,ytext:u,provider:d,placeholder:f,isSourceModeActive:p}=e,h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,ee]=(0,Q.useState)(null);if(_)throw _;let{resolvedTheme:y}=v(),{merged:b}=oe(),x=(0,Q.useRef)(p),S=b?.editor?.wordWrap??!0,{data:C}=Oe(s),w;t[0]!==C?.effective||t[1]!==b?(w=C?.effective??(b?.contentRules?ae(b.contentRules):ie),t[0]=C?.effective,t[1]=b,t[2]=w):w=t[2];let T=w,E;t[3]===T?E=t[4]:(E=JSON.stringify(T),t[3]=T,t[4]=E);let D=E,O,k;t[5]===p?(O=t[6],k=t[7]):(O=()=>{x.current=p},k=[p],t[5]=p,t[6]=O,t[7]=k),(0,Q.useEffect)(O,k);let A=(0,Q.useRef)(null),j;t[8]!==s||t[9]!==T||t[10]!==f||t[11]!==d||t[12]!==y||t[13]!==S||t[14]!==u?(j=()=>{let e=h.current;if(!e)return;let t=d.configuration.name??``,p,_=kt;try{p=c({docName:t,container:e,sizeStats:{viewCount:0,bytes:u.length},factory:e=>{let o=null,c=a({ydoc:d.document,ytext:u,docName:t}),l=new M,p=new M,m=new M,h=new M,g=new z({state:ye.create({doc:u.toString(),extensions:[rt,Ge,Me({scrollToMatch:e=>n(t)?z.scrollIntoView(e,{y:`start`}):Ct.of(null)}),_e.of([be]),Le(u,d.awareness),_e.of(Ie),...ne({themeCompartment:l,resolvedTheme:y,ydoc:d.document,wordWrapCompartment:p,wordWrap:S,currentDocName:t}),xt(),Ve(t),ue(),h.of(et(T,s)),$e(s),c,z.updateListener.of(e=>{r(e)&&i(t)}),z.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,me(t,`source`,de(e.view)),De(t,`source`,Ee(e.view,t))},120))}),m.of(ve(f??``)),z.theme({"&":{height:`100%`}}),z.scrollMargins.of(Ot)]}),parent:e});me(t,`source`,de(g)),De(t,`source`,Ee(g,t));let v=g.contentDOM;return v.addEventListener(`keydown`,_),v.addEventListener(`paste`,_),v.addEventListener(`drop`,_),v.addEventListener(`cut`,_),{view:g,ydoc:d.document,ytext:u,provider:d,themeCompartment:l,wordWrapCompartment:p,placeholderCompartment:m,lintCompartment:h}}}),A.current=p,g.current=p.view,l(s,p.view),he()&&p.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),A.current=null,g.current=null,ee(t instanceof Error?t:Error(String(t)))}return()=>{let e=A.current;e&&(m(e),o(s,e.view)),A.current=null,g.current=null}},t[8]=s,t[9]=T,t[10]=f,t[11]=d,t[12]=y,t[13]=S,t[14]=u,t[15]=j):j=t[15];let N;t[16]!==d||t[17]!==u?(N=[u,d],t[16]=d,t[17]=u,t[18]=N):N=t[18],(0,Q.useEffect)(j,N);let P,F;t[19]===s?(P=t[20],F=t[21]):(P=()=>{},F=[s],t[19]=s,t[20]=P,t[21]=F),(0,Q.useEffect)(P,F);let I,L;t[22]===y?(I=t[23],L=t[24]):(L=()=>{let e=A.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(y===`dark`?te:re)})},I=[y],t[22]=y,t[23]=I,t[24]=L),(0,Q.useEffect)(L,I);let R,B;t[25]===S?(R=t[26],B=t[27]):(R=()=>{let e=A.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(S?z.lineWrapping:[])})},B=[S],t[25]=S,t[26]=R,t[27]=B),(0,Q.useEffect)(R,B);let V,H;t[28]===f?(V=t[29],H=t[30]):(V=()=>{let e=A.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(f??``))})},H=[f],t[28]=f,t[29]=V,t[30]=H),(0,Q.useEffect)(V,H);let U;t[31]!==s||t[32]!==T?(U=()=>{let e=A.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(et(T,s))})},t[31]=s,t[32]=T,t[33]=U):U=t[33];let W;t[34]===D?W=t[35]:(W=[D],t[34]=D,t[35]=W),(0,Q.useEffect)(U,W);let G,K;t[36]!==s||t[37]!==p?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==s||t.mode!==`source`||!p)return;let n=g.current;n&&(wt(n,t,s),ce(s))};return window.addEventListener(ge,e),()=>window.removeEventListener(ge,e)},K=[s,p],t[36]=s,t[37]=p,t[38]=G,t[39]=K):(G=t[38],K=t[39]),(0,Q.useEffect)(G,K);let q,J;t[40]!==s||t[41]!==p?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==s||!p)return;let n=g.current;n&&(Et(n,t,s),ce(s))};return window.addEventListener(pe,e),()=>window.removeEventListener(pe,e)},J=[s,p],t[40]=s,t[41]=p,t[42]=q,t[43]=J):(q=t[42],J=t[43]),(0,Q.useEffect)(q,J);let Y,X;t[44]!==s||t[45]!==p||t[46]!==d?(Y=()=>{if(!p)return;let e=g.current;if(!e)return;let t=se(s);if(!t)return;if(t.kind!==`selection-offset`){le(s),t.kind===`outline`?wt(e,t.detail,s):t.kind===`lint`?Et(e,t.detail,s):t.kind===`raw-mdx`&&Tt(e,t.detail,()=>x.current,s);return}let n=!1,r=null;return queueMicrotask(()=>{if(n)return;let t=se(s);t?.kind===`selection-offset`&&(r=fe({view:e,docName:s,navigation:t,ydoc:d.document,transition:{from:`wysiwyg`,to:`source`}}),r&&le(s))}),()=>{n=!0,r?.cancel(`mode-flip`)}},X=[s,p,d],t[44]=s,t[45]=p,t[46]=d,t[47]=Y,t[48]=X):(Y=t[47],X=t[48]),(0,Q.useEffect)(Y,X);let Z;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,St.jsx)(`div`,{ref:h,className:`source-editor h-full pb-3`}),t[49]=Z):Z=t[49],Z}function Ot(){return{top:S()}}function kt(){return b()}export{Dt as SourceEditor,Tt as applyRawMdxNavigation};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{En as n,It as r,Rt as i,U as a,_n as o,bt as s,en as c,hn as l,jn as u,lt as d,mt as f,st as p,tn as m,ut as h,yt as g}from"./DocumentContext-iKEZSiB2.js";import{t as _}from"./react-f2sANaYj.js";import{n as v}from"./dist-PQ5KMVDh.js";import{t as ee}from"./compiler-runtime-BfE3aGVn.js";import{J as y,M as b,X as x,a as te,b as S,i as ne,o as re}from"./CodeMirrorPropInput-DjB69jRg.js";import{Co as C,No as w,T as ie,Xi as ae,_o as T,ai as E}from"./dist-DSS3ixln2.js";import{i as oe}from"./use-apply-config-theme-B1eLRQeV.js";import{C as D,F as se,M as ce,N as le,R as ue,T as O,f as k,i as de,k as fe,p as pe,r as me,t as he,u as ge}from"./typing-burst-detector-DOfSmyLX.js";import"./config-provider-DcdQLVo-.js";import{$ as A,D as j,Dt as M,F as N,It as P,Lt as F,Ot as I,Pt as L,Y as R,Z as z,b as B,ct as V,ft as _e,g as H,gt as U,ht as ve,it as W,kt as ye,l as G,lt as K,nt as q,pt as J,rt as Y,ut as X,v as Z}from"./dist-EbTHn-HD.js";import{a as be,n as xe}from"./cm-theme-CqnwWjn0.js";import{i as Se,n as Ce,o as we,r as Te}from"./dist-ezYezphN.js";import{o as Ee,r as De}from"./selection-context-CYahjTQ5.js";import{l as Oe}from"./lint-config-client-CumTSl-t.js";import{a as ke,i as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./dist-BFkXO51e2.js";import{n as Ie,t as Le}from"./src-DMJQ5Vxd.js";var Q=e(_(),1),Re=ee();function ze(){let e=g();return e===null?null:new Set(e.keys())}function Be(e,t,n){let r=[],i=N(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);C.lastIndex=0;for(let e=C.exec(t);e!==null;e=C.exec(t)){let t=e[2];if(!w(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),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&w(c)&&n!=null)return r.push(R.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=p.exec(s);if(l)return r.push(R.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[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 Ve(e){let t=h(e);return t===null?[]:[A.fromClass(class{decorations;constructor(e){this.decorations=Be(e.state,e.visibleRanges,ze())}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=Be(e.view.state,e.view.visibleRanges,ze()))}},{decorations:e=>e.decorations}),z.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=g()?.get(i);return e===void 0?f():window.location.hash=s(i,e),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=d(t,e,o),!0)}})]}var He=R.line({attributes:{dir:`auto`}});function Ue(e){let t=new L;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,He),r=n.to+1}return t.finish()}var We=A.fromClass(class{decorations;constructor(e){this.decorations=Ue(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ue(e.view))}},{decorations:e=>e.decorations}),Ge=[z.perLineTextDirection.of(!0),We],Ke=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),qe=`cm-lint-local-target`;function Je(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 Ye(e,t){let n=H(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Ke.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function Xe(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function Ze(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Ye(e,Je(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:Xe(i.severity),message:O(i),source:`${i.source}/${i.code}`,markClass:qe})}return r}var Qe=P.define();function $e(e){let t={findings:[]};return[Ae(e=>y()?Ze(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(Qe)))}),A.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:Qe.of(null)}),Fe(n)},i=D(e,e=>{e.status===`loaded`&&r(e.findings)}),a=x(()=>r(t.findings));return{destroy(){i(),a()}}})]}function et(e,t){return e.enabled?[je(),Ae(async n=>tt(n.state.doc,await E(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 tt(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=nt(r);o&&(a.actions=[o]),n.push(a)}return n}function nt(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 rt=[J(),K(),X(),Z(),Y(),W(),ye.allowMultipleSelections.of(!0),j(),G(),Te(),Ce(),U(),q(),V(),ke(),_e.of([...Se,...xe,...Pe,...B,...we,...Ne])],it=R.mark({class:`cm-link-ref-broken`}),at=/^\s{0,3}\[([^\]]+)\]:\s/,ot=/\[([^\]]*)\]\[([^\]]*)\]/g,st=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ct(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 lt(e){let t=[];return N(e).iterate({enter(e){if(st.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function ut(e){let t=new Set,n=[],r=e.doc,i=lt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ct(n.from,i))continue;let a=at.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ct(t.from,i)&&!at.test(t.text))for(ot.lastIndex=0;;){let e=ot.exec(t.text);if(!e)break;let r=t.from+e.index;if(ct(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(it.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),R.set(a)}var dt=F.define({create(e){return ut(e)},update(e,t){return t.docChanged?ut(t.state):e},provide:e=>z.decorations.from(e)}),ft=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,pt=R.mark({class:`cm-del`}),mt=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),ht=R.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function gt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function _t(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!T.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(T.test(r.text))return{from:t.from,to:r.to}}return null}function vt(e,t){let n=[],r=N(e),i=_t(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(pt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=ft.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=gt(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(mt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(ht.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(ht.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(n)}var yt=class{decorations;constructor(e){this.decorations=vt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=vt(e.view.state,e.view.visibleRanges))}},bt=A.fromClass(yt,{decorations:e=>e.decorations});function xt(){return[bt,dt]}var St=t(),Ct=P.define();function wt(e,t,n){let r=k(e.state.doc)[t.index];r&&u(n,()=>{e.dispatch({selection:I.cursor(r.from),effects:z.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function Tt(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);u(r,()=>{e.dispatch({selection:I.cursor(a),effects:z.scrollIntoView(a,{y:`center`})}),e.focus()})})}function Et(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);u(n,()=>{e.dispatch({selection:I.cursor(o),effects:z.scrollIntoView(o,{y:`start`})}),e.focus()})}function Dt(e){let t=(0,Re.c)(50),{docName:s,ytext:u,provider:d,placeholder:f,isSourceModeActive:p}=e,h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,ee]=(0,Q.useState)(null);if(_)throw _;let{resolvedTheme:y}=v(),{merged:b}=oe(),x=(0,Q.useRef)(p),S=b?.editor?.wordWrap??!0,{data:C}=Oe(s),w;t[0]!==C?.effective||t[1]!==b?(w=C?.effective??(b?.contentRules?ae(b.contentRules):ie),t[0]=C?.effective,t[1]=b,t[2]=w):w=t[2];let T=w,E;t[3]===T?E=t[4]:(E=JSON.stringify(T),t[3]=T,t[4]=E);let D=E,O,k;t[5]===p?(O=t[6],k=t[7]):(O=()=>{x.current=p},k=[p],t[5]=p,t[6]=O,t[7]=k),(0,Q.useEffect)(O,k);let A=(0,Q.useRef)(null),j;t[8]!==s||t[9]!==T||t[10]!==f||t[11]!==d||t[12]!==y||t[13]!==S||t[14]!==u?(j=()=>{let e=h.current;if(!e)return;let t=d.configuration.name??``,p,_=kt;try{p=c({docName:t,container:e,sizeStats:{viewCount:0,bytes:u.length},factory:e=>{let o=null,c=a({ydoc:d.document,ytext:u,docName:t}),l=new M,p=new M,m=new M,h=new M,g=new z({state:ye.create({doc:u.toString(),extensions:[rt,Ge,Me({scrollToMatch:e=>n(t)?z.scrollIntoView(e,{y:`start`}):Ct.of(null)}),_e.of([be]),Le(u,d.awareness),_e.of(Ie),...ne({themeCompartment:l,resolvedTheme:y,ydoc:d.document,wordWrapCompartment:p,wordWrap:S,currentDocName:t}),xt(),Ve(t),ue(),h.of(et(T,s)),$e(s),c,z.updateListener.of(e=>{r(e)&&i(t)}),z.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,me(t,`source`,de(e.view)),De(t,`source`,Ee(e.view,t))},120))}),m.of(ve(f??``)),z.theme({"&":{height:`100%`}}),z.scrollMargins.of(Ot)]}),parent:e});me(t,`source`,de(g)),De(t,`source`,Ee(g,t));let v=g.contentDOM;return v.addEventListener(`keydown`,_),v.addEventListener(`paste`,_),v.addEventListener(`drop`,_),v.addEventListener(`cut`,_),{view:g,ydoc:d.document,ytext:u,provider:d,themeCompartment:l,wordWrapCompartment:p,placeholderCompartment:m,lintCompartment:h}}}),A.current=p,g.current=p.view,l(s,p.view),he()&&p.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),A.current=null,g.current=null,ee(t instanceof Error?t:Error(String(t)))}return()=>{let e=A.current;e&&(m(e),o(s,e.view)),A.current=null,g.current=null}},t[8]=s,t[9]=T,t[10]=f,t[11]=d,t[12]=y,t[13]=S,t[14]=u,t[15]=j):j=t[15];let N;t[16]!==d||t[17]!==u?(N=[u,d],t[16]=d,t[17]=u,t[18]=N):N=t[18],(0,Q.useEffect)(j,N);let P,F;t[19]===s?(P=t[20],F=t[21]):(P=()=>{},F=[s],t[19]=s,t[20]=P,t[21]=F),(0,Q.useEffect)(P,F);let I,L;t[22]===y?(I=t[23],L=t[24]):(L=()=>{let e=A.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(y===`dark`?te:re)})},I=[y],t[22]=y,t[23]=I,t[24]=L),(0,Q.useEffect)(L,I);let R,B;t[25]===S?(R=t[26],B=t[27]):(R=()=>{let e=A.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(S?z.lineWrapping:[])})},B=[S],t[25]=S,t[26]=R,t[27]=B),(0,Q.useEffect)(R,B);let V,H;t[28]===f?(V=t[29],H=t[30]):(V=()=>{let e=A.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(f??``))})},H=[f],t[28]=f,t[29]=V,t[30]=H),(0,Q.useEffect)(V,H);let U;t[31]!==s||t[32]!==T?(U=()=>{let e=A.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(et(T,s))})},t[31]=s,t[32]=T,t[33]=U):U=t[33];let W;t[34]===D?W=t[35]:(W=[D],t[34]=D,t[35]=W),(0,Q.useEffect)(U,W);let G,K;t[36]!==s||t[37]!==p?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==s||t.mode!==`source`||!p)return;let n=g.current;n&&(wt(n,t,s),ce(s))};return window.addEventListener(ge,e),()=>window.removeEventListener(ge,e)},K=[s,p],t[36]=s,t[37]=p,t[38]=G,t[39]=K):(G=t[38],K=t[39]),(0,Q.useEffect)(G,K);let q,J;t[40]!==s||t[41]!==p?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==s||!p)return;let n=g.current;n&&(Et(n,t,s),ce(s))};return window.addEventListener(pe,e),()=>window.removeEventListener(pe,e)},J=[s,p],t[40]=s,t[41]=p,t[42]=q,t[43]=J):(q=t[42],J=t[43]),(0,Q.useEffect)(q,J);let Y,X;t[44]!==s||t[45]!==p||t[46]!==d?(Y=()=>{if(!p)return;let e=g.current;if(!e)return;let t=se(s);if(!t)return;if(t.kind!==`selection-offset`){le(s),t.kind===`outline`?wt(e,t.detail,s):t.kind===`lint`?Et(e,t.detail,s):t.kind===`raw-mdx`&&Tt(e,t.detail,()=>x.current,s);return}let n=!1,r=null;return queueMicrotask(()=>{if(n)return;let t=se(s);t?.kind===`selection-offset`&&(r=fe({view:e,docName:s,navigation:t,ydoc:d.document,transition:{from:`wysiwyg`,to:`source`}}),r&&le(s))}),()=>{n=!0,r?.cancel(`mode-flip`)}},X=[s,p,d],t[44]=s,t[45]=p,t[46]=d,t[47]=Y,t[48]=X):(Y=t[47],X=t[48]),(0,Q.useEffect)(Y,X);let Z;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,St.jsx)(`div`,{ref:h,className:`source-editor h-full pb-3`}),t[49]=Z):Z=t[49],Z}function Ot(){return{top:S()}}function kt(){return b()}export{Dt as SourceEditor,Tt as applyRawMdxNavigation};