@inkeep/open-knowledge 0.63.3 → 0.63.5
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.
- package/dist/{acp-harness-probe-BRVdx2Mx.mjs → acp-harness-probe-DWsC0HGJ.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-B-n_YWgP.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BTa8cPq4.mjs +1 -0
- package/dist/{init-BLfb1sRA.mjs → init-wSrUXJrK.mjs} +3 -3
- package/dist/{launch-json-removal-ChFdNqlh.mjs → launch-json-removal-BCt9s9EZ.mjs} +2 -2
- package/dist/{loader-CXFdSeyk.mjs → loader-Bqkd1CSo.mjs} +2 -2
- package/dist/loader-DemlsGk6.mjs +1 -0
- package/dist/{open-browser-DLqct6YK.mjs → open-browser-C8W8YLUr.mjs} +2 -2
- package/dist/preview-BGDZ2F6V.mjs +1 -0
- package/dist/{preview-Bb4XYlBa.mjs → preview-CGdqYnsr.mjs} +2 -2
- package/dist/public/assets/{AddPropertiesButton-1HbxHToc.js → AddPropertiesButton-BScpbmzY.js} +1 -1
- package/dist/public/assets/FeedbackForm-CTxes5S9.js +1 -0
- package/dist/public/assets/ManagedArtifactProperties-BA4A4hoD.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-B8CeX-0j.js → ManagedArtifactProperties-wz-anoGk.js} +1 -1
- package/dist/public/assets/{SessionsHost-BKtOAaVq.js → SessionsHost-h8_7B9cX.js} +2 -2
- package/dist/public/assets/{SkillToolbarControls-BNRjjmCR.js → SkillToolbarControls-BbX1X_qw.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BgLTo4oU.js → TerminalWindowApp-Cc4os4_H.js} +1 -1
- package/dist/public/assets/{ThreadView-DC1xOui5.js → ThreadView-D4ifWiSA.js} +1 -1
- package/dist/public/assets/comment-chips-ipbj1Q84.js +5 -0
- package/dist/public/assets/globals-DExKtDoE.css +1 -0
- package/dist/public/assets/{index-CVXtfbX0.js → index-BztAm1Wv.js} +5 -5
- package/dist/public/assets/{uninstall-kwpaLEMD.js → uninstall-SAQXZG17.js} +1 -1
- package/dist/public/index.html +6 -6
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-DZV-i0OU.mjs → repair-launch-json-DSDbWrfw.mjs} +2 -2
- package/dist/{repair-mcp-configs-Dr8SRYVX.mjs → repair-mcp-configs-Ia8AySAh.mjs} +2 -2
- package/dist/{repair-skills-C0uJGBYH.mjs → repair-skills-B7T9ybuC.mjs} +2 -2
- package/dist/repair-skills-D33RJQek.mjs +1 -0
- package/dist/{resolve-project-root-CIQP5bae.mjs → resolve-project-root-BF1NyEri.mjs} +2 -2
- package/dist/{skill-teardown-CZx0nQAt.mjs → skill-teardown-B9-HO2ID.mjs} +2 -2
- package/dist/{src-_jFQMicT.mjs → src-C7IJWx9K.mjs} +2 -2
- package/dist/{src-0BnQ9xtm.mjs → src-DQyTLMJF.mjs} +1 -1
- package/dist/src-DVSl6r9t.mjs +1 -0
- package/dist/{src-yn8SArMz.mjs → src-bhsVUHJJ.mjs} +343 -343
- package/dist/{start-CcGDBrj-.mjs → start-Be-1kSvv.mjs} +3 -3
- package/dist/start-CCbf73n-.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-ece63OR8.mjs +0 -2
- package/dist/init-BRXjI9La.mjs +0 -1
- package/dist/loader-B-5qtkZG.mjs +0 -1
- package/dist/preview-CmIBMra7.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BdXV9UuX.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-68kSk_SQ.js +0 -1
- package/dist/public/assets/comment-chips-CPDV2YlN.js +0 -5
- package/dist/public/assets/globals-CgRBo3fB.css +0 -1
- package/dist/repair-skills-BflLjGjq.mjs +0 -1
- package/dist/src-BVv588fI.mjs +0 -1
- package/dist/start-IXlE2_Hb.mjs +0 -1
- /package/dist/public/assets/{globals-4Lwslben.js → globals-KTXx85LN.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{pt as r}from"./sleep-D4NlDISj.mjs";import{Fs as i,ec as a,fs as o,ot as s,rt as c}from"./src-Bt6_UxL9.mjs";import{Ai as l,Ar as u,Fa as d,Mr as f,Or as p,Ri as m,_i as h,d as g,dn as _,er as v,f as y,fn as b,fr as x,hn as S,ji as C,kr as w,mn as ee,rr as te,tr as ne,u as re,ur as ie,vi as T,vn as ae,yi as oe}from"./src-yn8SArMz.mjs";import{F as E,N as se}from"./fs-traced-Dm4NQ6S5.mjs";import{C as ce,a as D,d as le,f as ue,i as de,l as fe,n as pe,o as me,s as he,t as ge,u as _e,x as ve,y as ye}from"./resolve-project-root-CIQP5bae.mjs";import{i as O,n as k,o as A,r as be,s as j,t as M}from"./colors-DSyAT9Cz.mjs";import{t as xe}from"./constants-ece63OR8.mjs";import{t as N}from"./is-object-Bw0-z8qH.mjs";import{t as Se}from"./preview-Bb4XYlBa.mjs";import{createRequire as Ce}from"node:module";import{execFileSync as we}from"node:child_process";import Te,{dirname as P,isAbsolute as Ee,join as F,relative as I,resolve as L,sep as De}from"node:path";import R from"node:process";import{fileURLToPath as Oe}from"node:url";import{existsSync as z,lstatSync as ke,mkdirSync as Ae,readFileSync as B,readlinkSync as je,realpathSync as Me,statSync as Ne,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import*as Ie from"node:readline";import{inspect as Le,stripVTControlCharacters as Re,styleText as V}from"node:util";import{AsyncLocalStorage as ze,AsyncResource as Be}from"node:async_hooks";const Ve=new Set([`emacs`,`vim`]);function He(e){return Ve.has(e)}function Ue(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(He))):[]}const H=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,We=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Ge=e=>e.name===`space`,Ke=e=>e.name===`backspace`,qe=e=>`1234567890`.includes(e.name),Je=e=>e.name===`enter`||e.name===`return`;var Ye=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Xe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Ze=class extends Error{name=`ExitPromptError`},Qe=class extends Error{name=`HookError`},$e=class extends Error{name=`ValidationError`};const et=new ze;function tt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function nt(e,t){let n=tt(e);return et.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function U(){let e=et.getStore();if(!e)throw new Qe(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function rt(){return U().rl}function it(e){return Be.bind((...t)=>{let n=U(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function at(e){let t=U(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ot(){U().handleChange()}const W={queue(e){let t=U(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(rt());if(r!=null&&typeof r!=`function`)throw new $e(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=U();it(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=U();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function st(e){return typeof e==`function`}function G(e){return at(t=>{let n=Be.bind(function(e){t.get()!==e&&(t.set(e),ot())});if(t.initialized)return[t.get(),n];let r=st(e)?e():e;return t.set(r),[r,n]})}function ct(e,t){at(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&W.queue(e),n.set(t)})}function lt(){return R.platform.startsWith(`win`)?!!R.env.CI||!!R.env.WT_SESSION||!!R.env.TERMINUS_SUBLIME||R.env.ConEmuTask===`{cmd::Cmder}`||R.env.TERM_PROGRAM===`Terminus-Sublime`||R.env.TERM_PROGRAM===`vscode`||R.env.TERM===`xterm-256color`||R.env.TERM===`alacritty`||R.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:R.env.TERM!==`linux`}const ut={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},dt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},ft={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},pt={...ut,...dt},mt={...ut,...ft},K=lt()?pt:mt;Object.entries(dt);const ht={prefix:{idle:V(`blue`,`?`),done:V(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>V(`yellow`,e))},keybindings:[],style:{answer:e=>V(`cyan`,e),message:e=>V(`bold`,e),error:e=>V(`red`,`> ${e}`),defaultAnswer:e=>V(`dim`,`(${e})`),help:e=>V(`dim`,e),highlight:e=>V(`cyan`,e),key:e=>V(`cyan`,V(`bold`,`<${e}>`))}};function gt(){return{...ht,keybindings:Ue()}}function _t(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function vt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=_t(n)&&_t(r)?vt(n,r):r}return t}function yt(...e){return vt(gt(),...e.filter(e=>e!=null))}function bt({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=yt(t);return ct(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function xt(e,t){return at(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function St(e){return G({current:e})[0]}function Ct(e){let t=St(e);t.current=e,ct(e=>{let n=!1,r=it((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var wt=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Tt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Et=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Dt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Ot=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,kt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,At=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,jt=/\t{1,1000}/y,Mt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Nt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Pt=/\p{M}+/gu,Ft={limit:1/0,ellipsis:``},It=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?It(i,Ft,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Nt,l],[Ot,0],[kt,o],[jt,s],[Mt,c],[At,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Pt,``)){let t=e.codePointAt(0)||0;if(S=Et(t)?2:Dt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===At?Tt(e.slice(p,n.lastIndex)):n===Mt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Lt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>It(e,Lt,t).width,Rt=`]8;;`,zt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Rt}(?<uri>.*))`,`y`),Bt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Vt=e=>`[${e}m`,Ht=e=>`${Rt}${e}`,Ut=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Rt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Wt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Gt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Ut(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Ut(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Ut(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Wt(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{pt as r}from"./sleep-D4NlDISj.mjs";import{Fs as i,ec as a,fs as o,ot as s,rt as c}from"./src-Bt6_UxL9.mjs";import{Ai as l,Ar as u,Fa as d,Mr as f,Or as p,Ri as m,_i as h,d as g,dn as _,er as v,f as y,fn as b,fr as x,hn as S,ji as C,kr as w,mn as ee,rr as te,tr as ne,u as re,ur as ie,vi as T,vn as ae,yi as oe}from"./src-bhsVUHJJ.mjs";import{F as E,N as se}from"./fs-traced-Dm4NQ6S5.mjs";import{C as ce,a as D,d as le,f as ue,i as de,l as fe,n as pe,o as me,s as he,t as ge,u as _e,x as ve,y as ye}from"./resolve-project-root-BF1NyEri.mjs";import{i as O,n as k,o as A,r as be,s as j,t as M}from"./colors-DSyAT9Cz.mjs";import{t as xe}from"./constants-B-n_YWgP.mjs";import{t as N}from"./is-object-Bw0-z8qH.mjs";import{t as Se}from"./preview-CGdqYnsr.mjs";import{createRequire as Ce}from"node:module";import{execFileSync as we}from"node:child_process";import Te,{dirname as P,isAbsolute as Ee,join as F,relative as I,resolve as L,sep as De}from"node:path";import R from"node:process";import{fileURLToPath as Oe}from"node:url";import{existsSync as z,lstatSync as ke,mkdirSync as Ae,readFileSync as B,readlinkSync as je,realpathSync as Me,statSync as Ne,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import*as Ie from"node:readline";import{inspect as Le,stripVTControlCharacters as Re,styleText as V}from"node:util";import{AsyncLocalStorage as ze,AsyncResource as Be}from"node:async_hooks";const Ve=new Set([`emacs`,`vim`]);function He(e){return Ve.has(e)}function Ue(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(He))):[]}const H=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,We=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Ge=e=>e.name===`space`,Ke=e=>e.name===`backspace`,qe=e=>`1234567890`.includes(e.name),Je=e=>e.name===`enter`||e.name===`return`;var Ye=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Xe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Ze=class extends Error{name=`ExitPromptError`},Qe=class extends Error{name=`HookError`},$e=class extends Error{name=`ValidationError`};const et=new ze;function tt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function nt(e,t){let n=tt(e);return et.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function U(){let e=et.getStore();if(!e)throw new Qe(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function rt(){return U().rl}function it(e){return Be.bind((...t)=>{let n=U(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function at(e){let t=U(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ot(){U().handleChange()}const W={queue(e){let t=U(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(rt());if(r!=null&&typeof r!=`function`)throw new $e(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=U();it(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=U();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function st(e){return typeof e==`function`}function G(e){return at(t=>{let n=Be.bind(function(e){t.get()!==e&&(t.set(e),ot())});if(t.initialized)return[t.get(),n];let r=st(e)?e():e;return t.set(r),[r,n]})}function ct(e,t){at(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&W.queue(e),n.set(t)})}function lt(){return R.platform.startsWith(`win`)?!!R.env.CI||!!R.env.WT_SESSION||!!R.env.TERMINUS_SUBLIME||R.env.ConEmuTask===`{cmd::Cmder}`||R.env.TERM_PROGRAM===`Terminus-Sublime`||R.env.TERM_PROGRAM===`vscode`||R.env.TERM===`xterm-256color`||R.env.TERM===`alacritty`||R.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:R.env.TERM!==`linux`}const ut={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},dt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},ft={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},pt={...ut,...dt},mt={...ut,...ft},K=lt()?pt:mt;Object.entries(dt);const ht={prefix:{idle:V(`blue`,`?`),done:V(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>V(`yellow`,e))},keybindings:[],style:{answer:e=>V(`cyan`,e),message:e=>V(`bold`,e),error:e=>V(`red`,`> ${e}`),defaultAnswer:e=>V(`dim`,`(${e})`),help:e=>V(`dim`,e),highlight:e=>V(`cyan`,e),key:e=>V(`cyan`,V(`bold`,`<${e}>`))}};function gt(){return{...ht,keybindings:Ue()}}function _t(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function vt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=_t(n)&&_t(r)?vt(n,r):r}return t}function yt(...e){return vt(gt(),...e.filter(e=>e!=null))}function bt({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=yt(t);return ct(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function xt(e,t){return at(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function St(e){return G({current:e})[0]}function Ct(e){let t=St(e);t.current=e,ct(e=>{let n=!1,r=it((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var wt=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Tt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Et=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Dt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Ot=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,kt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,At=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,jt=/\t{1,1000}/y,Mt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Nt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Pt=/\p{M}+/gu,Ft={limit:1/0,ellipsis:``},It=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?It(i,Ft,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Nt,l],[Ot,0],[kt,o],[jt,s],[Mt,c],[At,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Pt,``)){let t=e.codePointAt(0)||0;if(S=Et(t)?2:Dt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===At?Tt(e.slice(p,n.lastIndex)):n===Mt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Lt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>It(e,Lt,t).width,Rt=`]8;;`,zt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Rt}(?<uri>.*))`,`y`),Bt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Vt=e=>`[${e}m`,Ht=e=>`${Rt}${e}`,Ut=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Rt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Wt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Gt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Ut(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Ut(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Ut(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Wt(e)));let l=s.join(`
|
|
2
2
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){zt.lastIndex=e+1;let t=zt.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
3
3
|
`){a&&(r+=Ht(``));let e=i?Bt(i):void 0;i&&e&&(r+=Vt(e))}else t===`
|
|
4
4
|
`&&(i&&Bt(i)&&(r+=Vt(i)),a&&(r+=Ht(a)))}return r},Kt=/\r?\n/;function qt(e,t,n){return String(e).normalize().split(Kt).map(e=>Gt(e,t,n)).join(`
|
|
@@ -633,6 +633,6 @@ export default function okBridge(pi: {
|
|
|
633
633
|
`));let p=`${a?``:``}${d}`;return p!==i&&E(e,p,{mode:Gn(e)}),{kind:l?`overwritten`:`written`}}const wi=e=>e!==`project`,Ti=e=>e!==`user`;async function Ei(){let e=await er({message:`Where should the MCP server be configured?
|
|
634
634
|
`,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function Di(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Ei)():`both`}async function Oi(e){return ar({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json, project skills)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function ki(e){if(e.sharing!==void 0)return e.sharing;let t=Mn(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??Oi)(t):t}var $=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function Ai(e){if(e===void 0||e===!0)return new Set(T);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(oe.filter(e=>t.includes(e)))}function ji(e,t,n){let r=L(n,e),i;try{i=Ne(r)}catch(e){let t=e.code;throw t===`ENOENT`?new $(`--content-dir path does not exist: ${r}`):new $(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new $(`--content-dir must be a directory: ${r}`);let a=I(Mi(t),Mi(r));if(a.startsWith(`..`)||Ee(a))throw new $(`--content-dir must be inside the project root (${t}); got ${r}`);return a===``?`.`:a}function Mi(e){try{return Me(e)}catch{return e}}const Ni=`open-knowledge-ui`;function Pi(e,t,n){try{return z(e.detectPath?.(t,n)??P(e.configPath(t,n)))}catch{return!1}}function Fi(e,t,n){try{let r=L(P(e.configPath(t,n))),i=L(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+De)}catch{return!1}}function Ii(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Fi(e,t,r);if(!i&&s&&!Pi(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{pe(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Ri(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{Ae(P(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{se(`${o}.lock`,()=>{let t=Jr(o).writePath;if(Ae(P(t),{recursive:!0}),e.format===`toml`){let n=Si(ni(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=Ci(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=xi(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Li={pi:Br};function Ri(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=Li[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{Ae(P(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{se(`${t}.lock`,()=>{let e=null;try{e=B(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}E(t,c,e===null?void 0:{mode:Gn(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function zi(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!z(n)))return{editorId:e.id,label:e.label,path:n}}function Bi(e,t,n,r){let i=Hi(e,t,n,r);return i.kind===`present`?i.entry:null}function Vi(e,t,n,r){let i=bi(e,t,r);if(!N(i))return{kind:`no-entry`};let a=i[n];return N(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Hi(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!z(i))return{kind:`absent`};try{if(Ne(i).size>di)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=B(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:zr(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ni().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Vi(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,En.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Vi(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=oi(a);return s?si(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Vi(w(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ui(e={}){let t=L(e.cwd??process.cwd()),n=ge(t,{homeDir:e.home}),r=n.projectRoot;if(ae(r,e.home??Fe()))throw new S(r);let i=!z(F(r,`.ok`)),a=n.gitRootPromoted?I(r,t):void 0,s=e.contentDir===void 0?n.defaultContentDir:ji(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&s===`.`&&process.stderr.write(`${j(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let c={mode:e.devMcp?`dev`:`published`},l=await y(r),u;try{u=b(r,{contentDir:s})}catch(t){let i=he.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let d=u.created.includes(xe),f=!1;if(l.didInit)try{f=ee(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{_(r)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore entry at ${r}: ${e instanceof Error?e.message:String(e)}`)}let p=await re(r);p.kind===`untracked`&&console.warn(`[ok] Untracked the OpenKnowledge project skill (${p.dirs.join(`, `)}) — it is now local-only. Teammates will see this as a deletion on their next pull.`);let m=await Di({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),g=e.editors??Yi(r,e.home),C=e.editors??g,w=ye(g),T=ye(C),E=e.mcp===!1||m===null,se=Array.from(new Map([...w,...E?[]:T].map(e=>[e.id,e])).values()),ce=w.filter(t=>Pi(t,r,e.home)),D=[],le=[],ue=new Set;for(let t of se){if(E){let n=``;try{n=t.configPath(r,e.home)}catch{}D.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(wi(m)&&w.includes(t)&&t.scope===`global`&&D.push(Ii(t,r,c,e.home)),Ti(m)&&T.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ii(t,r,c,e.home,n);D.push(i),(i.action===`written`||i.action===`overwritten`)&&ue.add(n)}}let fe=new Set;for(let t of T){let n=t.projectSkillPath?.(r);!n||fe.has(n)||(fe.add(n),le.push(de(t,r,{home:e.home})))}let pe=le.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(pe.length>0){let t=e.home??Fe();te({source:o,skills:[h.project],agents:pe,scope:r},{home:t,enabled:x(t).enabled})}let me=!E&&m!==null&&Ti(m)?T.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,_e=E?[]:ce.map(e=>zi(e,r)).filter(e=>e!==void 0).filter(e=>!ue.has(e.path)),ve=e.installUserSkill??ne,O=e.home??Fe(),k=Ai(e.skills),A=!1,be=!1,M=!1,N=!1,Se=!1;for(let t of oe){if(!k.has(t))continue;await ie(O,h[t],!0).catch(()=>{}),A=!0;let n=await ve({home:e.home,bundleId:t,force:!0});n===`installed`?be=!0:n===`failed`?M=!0:n===`no-hosts`?Se=!0:N=!0}let Ce=M?`failed`:be?`installed`:A&&N?`skip-current`:A&&Se?`no-hosts`:`declined`,we=be?v(O).map(e=>e.editorId):[],Te=E?`skipped-flag`:`skipped-missing`,P=D.find(e=>e.editorId===`claude`)??D[0]??{action:Te,configPath:he.claude.configPath(r,e.home)},Ee=await Wi({projectRoot:r,desiredMode:await ki({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:u.created,contentUpdated:u.updated,contentSkipped:u.skipped,editors:D,projectSkills:le,legacyProjectConfigs:_e,skillInstall:Ce,skillHosts:we,didGitInit:l.didInit,rootGitignoreCreated:f,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:d?s:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:P.action,mcpPath:P.configPath,mcpError:`error`in P?P.error:void 0,projectScopeUnsupportedLabels:me,sharing:Ee}}async function Wi(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Mn(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=kn(t);if(n===`local-only`){let e=An(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Gi(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=jn(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Gi(t,o,`remove`)}function Gi(e,t,n){let r=Mn(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:[]}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Ki(e){switch(e){case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;default:return`config not readable`}}function qi(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=F(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(M(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(M(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(M(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(M(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(M(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?I(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${A(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${A(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${be(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Ki(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(M(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?I(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${A(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${A(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${be(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${I(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(M(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>me[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${A(`installed for ${r}`)}`),n.push(` ${k(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${k(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${A(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${k(`skipped for this run (--no-skills)`)}`),n.push(` ${k(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${k(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${k(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${k(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${j(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${j(` ok repair-skills`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(j(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(j(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(Se(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...Qi(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${A(`✓`)} ${M(`Next steps:`)}`),n.push(` 1. Open your editor (${O(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${O(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${O(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
|
|
635
635
|
`)}function Ji(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Yi(e,t){let n=[];for(let r of D)Pi(he[r],e,t)&&n.push(r);return n}function Xi(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Le(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Zi(){return new ve(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new ce(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new ce(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new ce(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Xi():null;try{let r;try{r=await Ui({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof $||e instanceof S){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof l||e instanceof C){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof g){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
|
|
636
|
-
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-
|
|
636
|
+
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-DemlsGk6.mjs`),{resolveContentDir:s}=await import(`./src-DQyTLMJF.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-BGDZ2F6V.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Ji(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${qi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Qi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(M(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?n.push(` ${A(`local-only`)} — appended ${e.appended.length} path(s) to ${M(`${t}/.git/info/exclude`)} (per-clone, not committed).`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${A(`local-only`)} — already excluded; nothing to do.`):n.push(` ${A(`local-only`)}`):e.action===`removed`?n.push(` ${A(`shared`)} — removed OK paths from ${M(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${A(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(j(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
|
|
637
637
|
`))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${O(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(j(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${O(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${O(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(j(`Sharing mode unavailable: ${e.reason}.`));return n}}export{Nn as A,yt as B,ar as C,Kn as D,Wn as E,jn as F,Je as H,Tn as I,pn as L,Fn as M,Mn as N,An as O,Pn as P,Ct as R,Rr as S,Gn as T,G as V,vi as _,Ji as a,ni as b,qi as c,Bi as d,Ai as f,Ui as g,ki as h,Wi as i,kn as j,In as k,Qi as l,ji as m,Ni as n,Hi as o,Di as p,Li as r,Yi as s,$ as t,Zi as u,Ii as v,er as w,Br as x,ri as y,bt as z};
|
|
638
|
-
//# sourceMappingURL=init-
|
|
638
|
+
//# sourceMappingURL=init-wSrUXJrK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Mr as e,kr as t}from"./src-
|
|
2
|
-
//# sourceMappingURL=launch-json-removal-
|
|
1
|
+
import{Mr as e,kr as t}from"./src-bhsVUHJJ.mjs";import{F as n}from"./fs-traced-Dm4NQ6S5.mjs";import{D as r,T as i}from"./init-wSrUXJrK.mjs";import{t as a}from"./is-object-Bw0-z8qH.mjs";import{join as o}from"node:path";import{existsSync as s,readFileSync as c}from"node:fs";const l={allowTrailingComma:!0,disallowComments:!1};function u(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function d(a){let d=o(a,`.claude`,`launch.json`);if(!s(d))return{kind:`not-present`};let p;try{p=c(d,`utf-8`)}catch{return{kind:`declined`}}let m=[],h=e(p,m,l)??void 0;if(m.some(e=>!u(e,p))||!h||h.type!==`object`)return{kind:`declined`};let g=t(h).configurations;if(!Array.isArray(g))return{kind:`not-present`};let _=g.findIndex(f);if(_===-1)return{kind:`not-present`};let{text:v,changed:y}=r(p,[`configurations`,_]);return y?(n(d,v,{mode:i(d)}),{kind:`removed`}):{kind:`not-present`}}function f(e){if(!a(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?p.some(e=>m(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const p=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function m(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{d as t};
|
|
2
|
+
//# sourceMappingURL=launch-json-removal-BCt9s9EZ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,l as t,p as n,pt as r,u as i}from"./sleep-D4NlDISj.mjs";import{bc as a,xc as o}from"./src-Bt6_UxL9.mjs";import{y as s}from"./src-
|
|
2
|
-
//# sourceMappingURL=loader-
|
|
1
|
+
import{h as e,l as t,p as n,pt as r,u as i}from"./sleep-D4NlDISj.mjs";import{bc as a,xc as o}from"./src-Bt6_UxL9.mjs";import{y as s}from"./src-bhsVUHJJ.mjs";import{I as c,k as l}from"./fs-traced-Dm4NQ6S5.mjs";import{t as u}from"./constants-B-n_YWgP.mjs";import{t as d}from"./is-object-Bw0-z8qH.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=r();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return d(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(t,n){return t.map(t=>{let r=t.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:t.message,issueCode:t.code};if(n.doc!==null&&n.source!==null){let t=e({file:n.path,source:n.source,doc:n.doc,path:r});if(t!==void 0)return{...i,source:t}}return i})}function b(e){let r=e??process.cwd(),d=[],p=[],m=[],h=[],g=l(`user`,r),_=c({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(e,n=!1)=>{let r=v(e);if(r.diagnostic!==void 0&&p.push(r.diagnostic),r.value===null)return{};let a=t({value:r.value,file:r.path,source:r.source,doc:r.doc});p.push(...a),d.push(e);let s=a.length>0?i(r.value):r.value;return n&&h.push(...o({value:s,file:r.path,source:r.source,doc:r.doc})),s},x=f(r,`.ok`,u),S=b(x,!0),C=b(l(`project-local`,r)),w=a(_.value,S,C),T=s.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(n(t))}return{config:T.data,sources:d,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
|
|
2
|
+
//# sourceMappingURL=loader-Bqkd1CSo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-Bqkd1CSo.mjs";export{e as loadConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Ri as e}from"./src-
|
|
2
|
-
//# sourceMappingURL=open-browser-
|
|
1
|
+
import{Ri as e}from"./src-bhsVUHJJ.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}t(process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,process.platform===`win32`?[`/c`,`start`,``,a]:[a],e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
|
|
2
|
+
//# sourceMappingURL=open-browser-C8W8YLUr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-CGdqYnsr.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Nr as e}from"./src-
|
|
1
|
+
import{Nr as e}from"./src-bhsVUHJJ.mjs";import"./constants-B-n_YWgP.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
|
|
2
2
|
`)}export{c as n,l as t};
|
|
3
|
-
//# sourceMappingURL=preview-
|
|
3
|
+
//# sourceMappingURL=preview-CGdqYnsr.mjs.map
|
package/dist/public/assets/{AddPropertiesButton-1HbxHToc.js → AddPropertiesButton-BScpbmzY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Jt as n,Z as r,br as i,i as a,tr as o,xr as s}from"./DocumentContext-DLZBeoOd.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{a as f,r as p}from"./local-menu-action-bus-BuSRFm5g.js";import{t as m}from"./utils-CPqDy6Hr.js";import{S as h,_ as g,c as _,d as v,f as y,h as b,l as x,n as S,o as C,r as w,s as T,t as E,u as D,w as O,x as k,y as A}from"./SkillInstallMenu-tVLtrElJ.js";import{t as j}from"./button-CA0dewJJ.js";import{i as M,n as N,t as P}from"./tooltip-DPvMEqsq.js";import{a as F,c as I,i as L,n as R,o as z,r as B,s as V,t as H}from"./dialog-BH80AfFt.js";import{t as U}from"./alert-dialog-C8E8SkhJ.js";import{C as W,M as G,S as K,T as q,_ as J,c as Y,d as X,f as ee,g as te,h as ne,l as re,n as ie,p as ae,r as oe,s as se,u as ce,w as le}from"./terminal-cli-display-BOx5rFUv.js";import{a as ue,c as de,d as fe,f as pe,i as me,l as he,m as ge,o as _e,p as ve,r as ye,t as be,u as xe}from"./dropdown-menu-BpLbh79a.js";import{t as Se}from"./label-Bbz2bT-a.js";import{$t as Ce,Bn as we,Cn as Te,Gn as Ee,Hn as De,Io as Oe,Jn as ke,Lo as Ae,Mt as je,Po as Me,Qt as Ne,Sn as Pe,Un as Fe,Uo as Ie,Vn as Le,Xn as Re,Yn as ze,bn as Be,ct as Ve,do as He,lt as Ue,pn as We,qn as Ge,ta as Ke}from"./dist-Ce8QgKUj2.js";import{n as Z}from"./dist-CuH7ikCn.js";import{i as qe}from"./use-settings-route-juHfAFnp.js";import{t as Je}from"./dist-BIGNzOeF2.js";import{d as Ye,h as Xe,m as Ze,n as Qe,p as $e,r as et,u as tt}from"./documents-events-xbEOOZ0r.js";import{i as nt}from"./use-apply-config-theme-B1eLRQeV.js";import{t as rt}from"./parse-api-error-DcnXKbfT.js";import{n as it,t as at}from"./workspace-paths-CD0W1etA.js";import{t as ot}from"./use-workspace-Cq3LTz0y.js";import{t as st}from"./createLucideIcon-CAkY8Blx.js";import{t as ct}from"./arrow-up-right-CXMA4cr5.js";import{t as lt}from"./RegisteredAgentIcon-D_jDwJpu.js";import{t as ut}from"./chevron-down-xENV92Te.js";import{n as dt,r as ft}from"./ManagedArtifactProperties-B8CeX-0j.js";import{t as pt}from"./folder-open-5aQb9yif.js";import{t as mt}from"./use-open-skill-DbMNgFC4.js";import{t as ht}from"./list-plus-1_iMFVqs.js";import{t as gt}from"./trash-2-BVoWHmfV.js";import{m as _t,p as vt}from"./page-list-cache-hdVNMZkU.js";import{E as yt,F as bt,T as xt,a as St,b as Ct,h as wt,n as Tt,r as Et,t as Dt,u as Ot,w as kt}from"./skills-api-MlE0X9DC.js";import{a as At,l as jt,o as Mt,p as Nt}from"./skill-scope-S38ho6V2.js";import{t as Pt}from"./input-Cy2M_Avq.js";import{t as Ft}from"./badge-DGD9B_-e.js";import{t as It}from"./use-skills-CFe_Pfyl.js";import{t as Lt}from"./DiffView-DBOYN8TZ.js";import{n as Rt}from"./platform-labels-CTgi7sF6.js";var Q=t(),$=e(c(),1),zt=d();function Bt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Vt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=rt(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:Je._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Je._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Je._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ht(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Bt(e):Vt()}var Ut=`ok:skill:cowork:installed`,Wt=`1`,Gt=250,Kt=`/api/skill/install-state`;function qt(e){return`${Ut}:v${e}`}var Jt=new Map;async function Yt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Jt.get(n);if(r)return r;let i=Xt(e,t);return Jt.set(n,i),i.finally(()=>{Jt.get(n)===i&&Jt.delete(n)}),i}async function Xt(e,t){let n=e.installer===void 0?Ht():e.installer,r=Zt(e.storage),i=e.fetchSnapshot??$t,a=e.serverTimeoutMs??Gt,o=null;if(!t.force){try{o=await en(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=qt(o?.currentVersion??e.fallbackSkillVersion??Qt());if(!t.force&&r?.getItem(s)===Wt)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Wt)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Zt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Qt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function $t(){let e;try{e=await fetch(Kt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function en(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function tn(e){return Yt({},e)}function nn(){return Yt({},{force:!0})}async function rn(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function an(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return rn({target:`claude-cowork`,url:Be({mode:`cowork`},e)},n);case`claude-code`:return rn({target:`claude-code`,url:Be({mode:`code`},e)},n);case`codex`:return rn({target:`codex`,url:Pe(e)},n);case`cursor`:return rn({target:`cursor`,url:Te(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function on(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var sn=`open-knowledge:agent-thread-launch`;function cn(e,t=typeof window>`u`?new EventTarget:window){f({kind:`agent-thread`,...e},t)||t.dispatchEvent(new CustomEvent(sn,{detail:e}))}function ln(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(sn,n),()=>t.removeEventListener(sn,n)}function un(e){if(!e.docName||!e.workspace)return null;let t=at(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:it(n,t,r)}}function dn(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function fn(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function pn(e){return q(e.installUrl).then(()=>void 0)}function mn(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function hn(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function gn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??at(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:it(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function _n(e){return`Opened in ${e}.`}function vn(e,t=1){return t>=3?Je._({id:`bi2C2s`,values:{displayName:e}}):t===2?Je._({id:`1J0c0X`,values:{displayName:e}}):Je._({id:`Xs7IcT`,values:{displayName:e}})}function yn(e){return e>=3?null:e===2?Je._({id:`Xp94R1`}):Je._({id:`6gRgw8`})}function bn(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function xn(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function Sn(e,t,n,r){return e.compose?We(xn(e.compose,t,n,r)):e.selection?Ge({...e.selection,target:t,transport:r}):e.skill?ke(e.skill.name,e.skill.scope,n):e.ask?we(e.ask.relativePath,e.ask.instruction,n,t,r):Ke(e.docContext===null?e.folderRelativePath?Ee(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?De(n,e.instruction,r):Le(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):Fe(e.docContext.relativePath,n,e.instruction,r))}function Cn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||n?`${Ve} ${Sn(e,Ne[t].handoffTarget,!1,`terminal`)}`:ze(e.docContext?.relativePath??null)}function wn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||t?`${Ue} ${Sn(e,`claude-code`,!1,`terminal`)}`:Re(e.docContext?.relativePath??null)}function Tn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function En(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function Dn(e,t){cn({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:wn(e),docName:Tn(e),titleHint:En(e)})}async function On(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(Je._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Je._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Je._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:Sn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=bn(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(_n(u));else{let i=yn(r),a=vn(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{On(e,t,n,r+1)}}})}return a}function kn(e){return W.find(t=>t.id===e)?.displayName??e}function An(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function jn(){return{dispatchHandoff:an,recordHandoff:on,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>An(),getDisplayName:kn,ensureCoworkSkillInstalled:tn,autoOpen:!0}}function Mn(){let e=(0,zt.c)(2),{merged:t}=nt(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>On(e,t,{...jn(),autoOpen:n}),reinstallCoworkSkill:nn},e[0]=n,e[1]=r),r}var Nn=st(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),Pn=st(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Fn=st(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]);function In(e){let t=(0,zt.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(l,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Ln(e){let t=(0,zt.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(l,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Rn(e){let t=(0,zt.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(l,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function zn(e){return e?Je._({id:`wTcjov`}):null}function Bn(e){let t=(0,zt.c)(48),{_:n}=u(),i=r(),a=k(),s=G(),c=K();if(i)return null;let{input:d,installStates:f,dispatch:m,onBeforeLaunch:h}=e,g=d===null,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==g||t[4]!==f||t[5]!==h||t[6]!==c||t[7]!==s||t[8]!==a){let e=zn(g),r;t[20]!==f||t[21]!==c?(r=e=>ne(c,e.id,f[e.id]?.installed),t[20]=f,t[21]=c,t[22]=r):r=t[22];let i=le.filter(r),u;t[23]===c?u=t[24]:(u=e=>te(c,e.source,e.id,!0,e.supported),t[23]=c,t[24]=u);let p=s.filter(u),O=a?Ce.filter(e=>J(c,e,a.installedClis)):[];y=i.length>0,b=a!==null&&O.length>0,x=p.length>0,v=fe,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[25]=D):D=t[25],_=pe,S=`max-h-80`,C=x?(0,Q.jsxs)(me,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(_e,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(ue,{onSelect:()=>{d!==null&&(h?.(),Dn(d,{agent:{source:t.source,id:t.id}}))},disabled:g,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(lt,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==y||t[27]!==b||t[28]!==x?(w=x&&(b||y)?(0,Q.jsx)(xe,{}):null,t[26]=y,t[27]=b,t[28]=x,t[29]=w):w=t[29],T=b?(0,Q.jsxs)(me,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(_e,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=Ne[t];return(0,Q.jsxs)(ue,{onSelect:()=>{d!==null&&(h?.(),a.launchInTerminal(d,t))},disabled:g,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(oe,{id:ie(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,E=y?(0,Q.jsxs)(Q.Fragment,{children:[b?(0,Q.jsx)(xe,{}):null,(0,Q.jsxs)(me,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(_e,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(ct,{"aria-hidden":`true`,className:`size-3`})]}),i.map(t=>{let r=!g,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(ue,{disabled:!r,onSelect:()=>{if(d){if(h?.(),f[t.id]?.installed!==!0){pn(t);return}m(t.id,d)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(oe,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(In,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=g,t[4]=f,t[5]=h,t[6]=c,t[7]=s,t[8]=a,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D}else _=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19];let O;t[30]!==y||t[31]!==b||t[32]!==x?(O=x||b||y?(0,Q.jsx)(xe,{}):null,t[30]=y,t[31]=b,t[32]=x,t[33]=O):O=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(p,{"aria-hidden":`true`}),t[34]=A):A=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(ue,{onSelect:qe,"data-testid":`file-tree-open-in-settings`,children:[A,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`jRAGrQ`})})]}),t[35]=j):j=t[35];let M;t[36]!==_||t[37]!==S||t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E||t[42]!==O?(M=(0,Q.jsxs)(_,{className:S,children:[C,w,T,E,O,j]}),t[36]=_,t[37]=S,t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=O,t[43]=M):M=t[43];let N;return t[44]!==v||t[45]!==D||t[46]!==M?(N=(0,Q.jsxs)(v,{children:[D,M]}),t[44]=v,t[45]=D,t[46]=M,t[47]=N):N=t[47],N}function Vn(e){return e?Je._({id:`wTcjov`}):null}function Hn(e){let t=(0,zt.c)(47),{_:n}=u(),i=r(),a=k(),s=G(),c=K();if(i)return null;let{input:d,installStates:f,dispatch:m}=e,h=d===null,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==h||t[4]!==f||t[5]!==c||t[6]!==s||t[7]!==a){let e=Vn(h),r;t[19]!==f||t[20]!==c?(r=e=>ne(c,e.id,f[e.id]?.installed),t[19]=f,t[20]=c,t[21]=r):r=t[21];let i=le.filter(r),u;t[22]===c?u=t[23]:(u=e=>te(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=u);let p=s.filter(u),D=a?Ce.filter(e=>J(c,e,a.installedClis)):[];v=i.length>0,y=a!==null&&D.length>0,b=p.length>0,_=X,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[24]=E):E=t[24],g=ee,x=`max-h-80`,S=b?(0,Q.jsxs)(se,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(re,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(Y,{onSelect:()=>{d!==null&&Dn(d,{agent:{source:t.source,id:t.id}})},disabled:h,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(lt,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==v||t[26]!==y||t[27]!==b?(C=b&&(y||v)?(0,Q.jsx)(ce,{}):null,t[25]=v,t[26]=y,t[27]=b,t[28]=C):C=t[28],w=y?(0,Q.jsxs)(se,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(re,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=Ne[t];return(0,Q.jsxs)(Y,{onSelect:()=>{d!==null&&a.launchInTerminal(d,t)},disabled:h,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(oe,{id:ie(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,T=v?(0,Q.jsxs)(Q.Fragment,{children:[y?(0,Q.jsx)(ce,{}):null,(0,Q.jsxs)(se,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(re,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(ct,{"aria-hidden":`true`,className:`size-3`})]}),i.map(t=>{let r=!h,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(Y,{disabled:!r,onSelect:()=>{if(d){if(f[t.id]?.installed!==!0){pn(t);return}m(t.id,d)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(oe,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(In,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=h,t[4]=f,t[5]=c,t[6]=s,t[7]=a,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E}else g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18];let D;t[29]!==v||t[30]!==y||t[31]!==b?(D=b||y||v?(0,Q.jsx)(ce,{}):null,t[29]=v,t[30]=y,t[31]=b,t[32]=D):D=t[32];let O;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(p,{"aria-hidden":`true`}),t[33]=O):O=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(Y,{onSelect:qe,"data-testid":`empty-space-open-in-settings`,children:[O,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`jRAGrQ`})})]}),t[34]=A):A=t[34];let j;t[35]!==g||t[36]!==x||t[37]!==S||t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==D?(j=(0,Q.jsxs)(g,{className:x,children:[S,C,w,T,D,A]}),t[35]=g,t[36]=x,t[37]=S,t[38]=C,t[39]=w,t[40]=T,t[41]=D,t[42]=j):j=t[42];let M;return t[43]!==_||t[44]!==E||t[45]!==j?(M=(0,Q.jsxs)(_,{children:[E,j]}),t[43]=_,t[44]=E,t[45]=j,t[46]=M):M=t[46],M}var Un=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Wn(e){let t=Ae(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=Me(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=Oe(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=Un.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Gn(e,t,r){return e.filter(e=>{let i=n(e);if(i.kind===`skill-file`)return i.scope===t&&i.name===r;if(i.kind!==`doc`)return!1;let a=Wn(i.docName);return a?.scope===t&&a.name===r})}function Kn(e,t,r){let i=vt(t,r);return e.filter(e=>{let a=n(e);return a.kind===`skill-file`?a.scope===t.scope&&a.name===t.name&&a.path===r:a.kind===`doc`&&a.docName===i})}function qn(e,t,n){let r=Wn(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return vt(i,a)===e?{skill:i,filePath:a}:null}function Jn(e,t,n=(e,t)=>$e(e,t)||Ze(e,t)){let r=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),i=[],a=new Set;for(let t of e){let e=Wn(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Wn(t);if(!e||r.has(`${e.scope}\u0000${e.name}`))continue;let o=e.scope===`project`?`global`:`project`,s=r.get(`${o}\u0000${e.name}`);e.rel===null&&s!==void 0?i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)}):n(e.scope,e.name)||(s!==void 0&&!a.has(`${e.scope}\u0000${e.name}`)?(a.add(`${e.scope}\u0000${e.name}`),i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)})):i.push({kind:`close`,docName:t}))}return i}function Yn(){let e=(0,zt.c)(15),{openTabs:t,closeDocument:n}=a(),r=dt(),i;e[0]===t?i=e[1]:(i=t.some(Zn),e[0]=t,e[1]=i);let o=i,s;e[2]===o?s=e[3]:(s={enabled:o},e[2]=o,e[3]=s);let c=It(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Xn).sort().join(``)}\u0002${Xe()}`;if(l.current===i)return;l.current=i;let a=Jn(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Xn(e){return`${e.scope}\u0000${e.name}`}function Zn(e){return Wn(e)!==null}function Qn(e){let t=(0,zt.c)(18),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:o}=u(),{closeTabs:s,openTabs:c}=a(),[l,d]=(0,$.useState)(!1),f;t[0]!==o||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==c?(f=async function(e){d(!0);let t=await Tt(e.scope,e.name,e.hostQualifier);if(d(!1),!t.ok){let{error:e}=t;Z.error(o({id:`AtBdnD`,values:{error:e}}));return}Z.success(o({id:`h9QFb9`,values:{0:e.name}})),s(Gn(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=o,t[1]=s,t[2]=i,t[3]=r,t[4]=c,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==l||t[7]!==r?(h=e=>{!e&&!l&&r(!1)},t[6]=l,t[7]=r,t[8]=h):h=t[8];let _;t[9]!==o||t[10]!==l||t[11]!==p||t[12]!==n?(_=n?(0,Q.jsx)(g,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?o({id:`WnsbUT`,values:{0:n.path}}):o({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=o,t[10]=l,t[11]=p,t[12]=n,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==_?(v=(0,Q.jsx)(U,{open:m,onOpenChange:h,children:_}),t[14]=m,t[15]=h,t[16]=_,t[17]=v):v=t[17],v}function $n(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function er(e){if(/\s/.test(e))return Je._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?Je._({id:`Zt7Ktx`}):t.some(e=>e===``)?Je._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?Je._({id:`yJkw6t`}):$n(e)?null:Je._({id:`oP-FQW`})}function tr(e){let t=(0,zt.c)(70),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:o}=a(),s=(0,$.useId)(),[c,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,x,S,C,w;if(t[6]!==c||t[7]!==f){w=c.trim(),x=w===``||w.endsWith(`/`),S=x?null:er(w),y=!(x||S!==null)&&!f,b=w.includes(`/`)?w.split(`/`).slice(0,-1).join(`/`):null;let e=w.split(`/`).pop()??``;C=e!==``&&!e.includes(`.`)?`${w}.md`:w,t[6]=c,t[7]=f,t[8]=y,t[9]=b,t[10]=x,t[11]=S,t[12]=C,t[13]=w}else y=t[8],b=t[9],x=t[10],S=t[11],C=t[12],w=t[13];let T=C,E;t[14]!==i||t[15]!==y||t[16]!==T||t[17]!==r||t[18]!==o||t[19]!==n?(E=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(T),t=await bt({scope:n.skill.scope,name:n.skill.name,path:T,content:e?`# ${T.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`DvGkXq`,values:{0:t.error,effective:T}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=vt(n.skill,T);o({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=y,t[16]=T,t[17]=r,t[18]=o,t[19]=n,t[20]=E):E=t[20];let D=E,O;t[21]!==r||t[22]!==f?(O=e=>{!e&&!f&&r(!1)},t[21]=r,t[22]=f,t[23]=O):O=t[23];let k;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`wQvvZY`})}),t[24]=k):k=t[24];let A;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(V,{children:[k,(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`lM4c-I`})})]}),t[25]=A):A=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(l,{id:`I6gXOa`}),t[26]=M):M=t[26];let N;t[27]===s?N=t[28]:(N=(0,Q.jsx)(Se,{htmlFor:s,children:M}),t[27]=s,t[28]=N);let P;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>d(e.target.value),t[29]=P):P=t[29];let R=S!==null,B;t[30]===D?B=t[31]:(B=e=>{e.key===`Enter`&&D()},t[30]=D,t[31]=B);let U;t[32]!==s||t[33]!==c||t[34]!==R||t[35]!==B?(U=(0,Q.jsx)(Pt,{id:s,value:c,onChange:P,placeholder:`references/notes.md`,"aria-invalid":R,onKeyDown:B}),t[32]=s,t[33]=c,t[34]=R,t[35]=B,t[36]=U):U=t[36];let W;t[37]!==T||t[38]!==b||t[39]!==x||t[40]!==S||t[41]!==w?(W=S===null?x&&w!==``?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`Vy6XCg`})}):T===w?b?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`9lso1Y`,values:{folderPart:b},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null:(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`zC5jrM`,values:{effective:T},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:S}),t[37]=T,t[38]=b,t[39]=x,t[40]=S,t[41]=w,t[42]=W):W=t[42];let G;t[43]!==N||t[44]!==U||t[45]!==W?(G=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,U,W]}),t[43]=N,t[44]=U,t[45]=W,t[46]=G):G=t[46];let K;t[47]===r?K=t[48]:(K=()=>r(!1),t[47]=r,t[48]=K);let q;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(l,{id:`dEgA5A`}),t[49]=q):q=t[49];let J;t[50]!==f||t[51]!==K?(J=(0,Q.jsx)(j,{variant:`outline`,onClick:K,disabled:f,children:q}),t[50]=f,t[51]=K,t[52]=J):J=t[52];let Y;t[53]===D?Y=t[54]:(Y=()=>void D(),t[53]=D,t[54]=Y);let X=!y,ee;t[55]===f?ee=t[56]:(ee=f?(0,Q.jsx)(l,{id:`E9bKSA`}):(0,Q.jsx)(l,{id:`hYgDIe`}),t[55]=f,t[56]=ee);let te;t[57]!==Y||t[58]!==X||t[59]!==ee?(te=(0,Q.jsx)(j,{onClick:Y,disabled:X,children:ee}),t[57]=Y,t[58]=X,t[59]=ee,t[60]=te):te=t[60];let ne;t[61]!==J||t[62]!==te?(ne=(0,Q.jsxs)(z,{children:[J,te]}),t[61]=J,t[62]=te,t[63]=ne):ne=t[63];let re;t[64]!==G||t[65]!==ne?(re=(0,Q.jsxs)(L,{className:`sm:max-w-md`,children:[A,G,ne]}),t[64]=G,t[65]=ne,t[66]=re):re=t[66];let ie;return t[67]!==re||t[68]!==O?(ie=(0,Q.jsx)(H,{open:!0,onOpenChange:O,children:re}),t[67]=re,t[68]=O,t[69]=ie):ie=t[69],ie}function nr(e){let t=(0,zt.c)(17),{target:n,onOpenChange:r}=e,{_:i}=u(),{closeTabs:o,openTabs:s}=a(),[c,l]=(0,$.useState)(!1),d;t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==s?(d=async function(e){let{skill:t,filePath:n}=e;l(!0);let a=await Et({scope:t.scope,name:t.name,path:n});if(l(!1),!a.ok){Z.error(i({id:`CBT70t`,values:{0:a.error}}));return}if(!a.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),o(Kn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=o,t[2]=r,t[3]=s,t[4]=d):d=t[4];let f=d,p=n!==null,m;t[5]!==c||t[6]!==r?(m=e=>{!e&&!c&&r(!1)},t[5]=c,t[6]=r,t[7]=m):m=t[7];let h;t[8]!==i||t[9]!==c||t[10]!==f||t[11]!==n?(h=n?(0,Q.jsx)(g,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:c,onDelete:()=>f(n),customDescription:i({id:`ppzof_`,values:{0:Mt(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[8]=i,t[9]=c,t[10]=f,t[11]=n,t[12]=h):h=t[12];let _;return t[13]!==p||t[14]!==m||t[15]!==h?(_=(0,Q.jsx)(U,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=_):_=t[16],_}function rr(e){let t=(0,zt.c)(64),{target:n,onOpenChange:r}=e,{_:i}=u(),a=dt(),o=(0,$.useId)(),[s,c]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==s||t[7]!==n.filePath?(y=s.trim(),b=y===n.filePath,v=y===``||!$n(y),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let x=v,S=!x&&!b&&!d,C;t[11]!==i||t[12]!==S||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(C=async function(){if(!n||!S)return;f(!0);let e=await xt({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=S,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=C):C=t[17];let w=C,T;t[18]!==r||t[19]!==d?(T=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`yckias`})}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(V,{children:[E,(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`HzVAoz`})})]}),t[22]=D):D=t[22];let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(l,{id:`I6gXOa`}),t[23]=O):O=t[23];let k;t[24]===o?k=t[25]:(k=(0,Q.jsx)(Se,{htmlFor:o,children:O}),t[24]=o,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>c(e.target.value),t[26]=A):A=t[26];let M=x&&y!==``,N;t[27]===w?N=t[28]:(N=e=>{e.key===`Enter`&&w()},t[27]=w,t[28]=N);let P;t[29]!==o||t[30]!==s||t[31]!==M||t[32]!==N?(P=(0,Q.jsx)(Pt,{id:o,value:s,onChange:A,"aria-invalid":M,onKeyDown:N}),t[29]=o,t[30]=s,t[31]=M,t[32]=N,t[33]=P):P=t[33];let R;t[34]!==x||t[35]!==y?(R=x&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):null,t[34]=x,t[35]=y,t[36]=R):R=t[36];let B;t[37]!==k||t[38]!==P||t[39]!==R?(B=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[k,P,R]}),t[37]=k,t[38]=P,t[39]=R,t[40]=B):B=t[40];let U;t[41]===r?U=t[42]:(U=()=>r(!1),t[41]=r,t[42]=U);let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(l,{id:`dEgA5A`}),t[43]=W):W=t[43];let G;t[44]!==d||t[45]!==U?(G=(0,Q.jsx)(j,{variant:`outline`,onClick:U,disabled:d,children:W}),t[44]=d,t[45]=U,t[46]=G):G=t[46];let K;t[47]===w?K=t[48]:(K=()=>void w(),t[47]=w,t[48]=K);let q=!S,J;t[49]===d?J=t[50]:(J=d?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[49]=d,t[50]=J);let Y;t[51]!==K||t[52]!==q||t[53]!==J?(Y=(0,Q.jsx)(j,{onClick:K,disabled:q,children:J}),t[51]=K,t[52]=q,t[53]=J,t[54]=Y):Y=t[54];let X;t[55]!==G||t[56]!==Y?(X=(0,Q.jsxs)(z,{children:[G,Y]}),t[55]=G,t[56]=Y,t[57]=X):X=t[57];let ee;t[58]!==B||t[59]!==X?(ee=(0,Q.jsxs)(L,{className:`sm:max-w-md`,children:[D,B,X]}),t[58]=B,t[59]=X,t[60]=ee):ee=t[60];let te;return t[61]!==ee||t[62]!==T?(te=(0,Q.jsx)(H,{open:!0,onOpenChange:T,children:ee}),t[61]=ee,t[62]=T,t[63]=te):te=t[63],te}function ir(e){let t=(0,zt.c)(59),{target:n,onOpenChange:r}=e,{_:i}=u(),a=(0,$.useId)(),[o,s]=(0,$.useState)(null),[c,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b;t[0]===n?b=t[1]:(b=()=>{if(s(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${jt(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,s]])Ot({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=b);let x=n?.skill.scope,S=n?.skill.name,C=n?.editor,w;if(t[2]!==x||t[3]!==S||t[4]!==C?(w=[x,S,C],t[2]=x,t[3]=S,t[4]=C,t[5]=w):w=t[5],(0,$.useEffect)(b,w),!n)return null;let{skill:T,editor:E}=n,D;t[6]!==i||t[7]!==E||t[8]!==r||t[9]!==T.name||t[10]!==T.scope||t[11]!==n||t[12]!==g?(D=async function(e){if(!n)return;y(!0);let t=await yt({scope:T.scope,name:T.name,editor:E,action:e,...e===`rename`?{toName:g.trim()}:{}});if(y(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:E}}:e===`make-source`?{id:`It9oAP`,values:{editor:E}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=E,t[8]=r,t[9]=T.name,t[10]=T.scope,t[11]=n,t[12]=g,t[13]=D):D=t[13];let O=D,k,A;t[14]!==T.name||t[15]!==g?(A=g.trim(),k=A===``||!je.test(A)||A===T.name,t[14]=T.name,t[15]=g,t[16]=k,t[17]=A):(k=t[16],A=t[17]);let M=k,N;t[18]!==v||t[19]!==r?(N=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=N):N=t[20];let P;t[21]!==E||t[22]!==T.name?(P=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`q8aCbb`,values:{0:T.name,editor:E}})}),t[21]=E,t[22]=T.name,t[23]=P):P=t[23];let B;t[24]===E?B=t[25]:(B=(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`QASTNu`,values:{editor:E}})}),t[24]=E,t[25]=B);let U;t[26]!==B||t[27]!==P?(U=(0,Q.jsxs)(V,{children:[P,B]}),t[26]=B,t[27]=P,t[28]=U):U=t[28];let W;t[29]!==c||t[30]!==o||t[31]!==f?(W=c!==null&&o!==null?(0,Q.jsx)(Lt,{oldContent:c,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`1V17kO`})}),t[29]=c,t[30]=o,t[31]=f,t[32]=W):W=t[32];let G;t[33]!==O||t[34]!==E||t[35]!==a||t[36]!==M||t[37]!==m||t[38]!==T.name||t[39]!==g||t[40]!==A?(G=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(Se,{htmlFor:a,children:(0,Q.jsx)(l,{id:`pSimwP`,values:{editor:E}})}),(0,Q.jsx)(Pt,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${T.name}-${E}`,"aria-invalid":M&&A!==``,onKeyDown:e=>{e.key===`Enter`&&!M&&O(`rename`)}})]}):null,t[33]=O,t[34]=E,t[35]=a,t[36]=M,t[37]=m,t[38]=T.name,t[39]=g,t[40]=A,t[41]=G):G=t[41];let K;t[42]!==W||t[43]!==G?(K=(0,Q.jsxs)(R,{className:`min-h-0 flex-1 overflow-auto`,children:[W,G]}),t[42]=W,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==O||t[46]!==v||t[47]!==E||t[48]!==M||t[49]!==m||t[50]!==T.name?(q=(0,Q.jsx)(z,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(j,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(l,{id:`iH8pgl`})}),(0,Q.jsx)(j,{onClick:()=>void O(`rename`),disabled:v||M,children:(0,Q.jsx)(l,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(j,{variant:`outline`,onClick:()=>{_(`${T.name}-${E}`),h(!0)},disabled:v,children:(0,Q.jsx)(l,{id:`AT0e50`})}),(0,Q.jsx)(j,{variant:`outline`,onClick:()=>void O(`make-source`),disabled:v,children:(0,Q.jsx)(l,{id:`xWomUD`,values:{editor:E}})}),(0,Q.jsx)(j,{onClick:()=>void O(`align`),disabled:v,children:(0,Q.jsx)(l,{id:`PZn2LP`})})]})}),t[45]=O,t[46]=v,t[47]=E,t[48]=M,t[49]=m,t[50]=T.name,t[51]=q):q=t[51];let J;t[52]!==U||t[53]!==K||t[54]!==q?(J=(0,Q.jsxs)(L,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[U,K,q]}),t[52]=U,t[53]=K,t[54]=q,t[55]=J):J=t[55];let Y;return t[56]!==J||t[57]!==N?(Y=(0,Q.jsx)(H,{open:!0,onOpenChange:N,children:J}),t[56]=J,t[57]=N,t[58]=Y):Y=t[58],Y}function ar(e){let t=(0,zt.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=ft(),s=n!==null,c=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,x,S,C;if(t[5]!==r||t[6]!==u||t[7]!==n.name){S=u.trim(),C=S===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,x=S.length>64,y=S===``||!je.test(S)||x,b=!y&&!C&&r.has(S),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13];let w=b,T=!y&&!w&&!C&&!f,E;t[17]!==T||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==S?(E=async function(){if(!n||!T)return;p(!0);let e=await o({scope:n.scope,name:n.name},S);p(!1),e.ok&&(a?.(S),i(!1))},t[17]=T,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=S,t[23]=E):E=t[23];let D=E,O;t[24]===i?O=t[25]:(O=e=>e?null:i(!1),t[24]=i,t[25]=O);let k;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`dw_3cv`})}),t[26]=k):k=t[26];let A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(V,{children:[k,(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`R9IDFz`})})]}),t[27]=A):A=t[27];let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(l,{id:`6YtxFj`}),t[28]=M):M=t[28];let N;t[29]===c?N=t[30]:(N=(0,Q.jsx)(Se,{htmlFor:c,children:M}),t[29]=c,t[30]=N);let P;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>d(e.target.value),t[31]=P):P=t[31];let R;t[32]===D?R=t[33]:(R=e=>{e.key===`Enter`&&D()},t[32]=D,t[33]=R);let B=y||w,U=y&&S!==``||w?`${c}-error`:void 0,W;t[34]!==c||t[35]!==u||t[36]!==R||t[37]!==B||t[38]!==U?(W=(0,Q.jsx)(Pt,{id:c,value:u,onChange:P,onKeyDown:R,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":B,"aria-describedby":U,className:`font-mono`}),t[34]=c,t[35]=u,t[36]=R,t[37]=B,t[38]=U,t[39]=W):W=t[39];let G;t[40]!==w||t[41]!==v||t[42]!==c||t[43]!==y||t[44]!==x||t[45]!==S?(G=y&&S!==``?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(l,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):x?(0,Q.jsx)(l,{id:`lK9c4T`}):(0,Q.jsx)(l,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):w?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(l,{id:`YJ1BTp`})}):null,t[40]=w,t[41]=v,t[42]=c,t[43]=y,t[44]=x,t[45]=S,t[46]=G):G=t[46];let K;t[47]!==N||t[48]!==W||t[49]!==G?(K=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,W,G]}),t[47]=N,t[48]=W,t[49]=G,t[50]=K):K=t[50];let q;t[51]===i?q=t[52]:(q=()=>i(!1),t[51]=i,t[52]=q);let J;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(l,{id:`dEgA5A`}),t[53]=J):J=t[53];let Y;t[54]!==f||t[55]!==q?(Y=(0,Q.jsx)(j,{variant:`outline`,className:`font-mono uppercase`,onClick:q,disabled:f,children:J}),t[54]=f,t[55]=q,t[56]=Y):Y=t[56];let X;t[57]===D?X=t[58]:(X=()=>void D(),t[57]=D,t[58]=X);let ee=!T,te;t[59]===f?te=t[60]:(te=f?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[59]=f,t[60]=te);let ne;t[61]!==X||t[62]!==ee||t[63]!==te?(ne=(0,Q.jsx)(j,{onClick:X,disabled:ee,children:te}),t[61]=X,t[62]=ee,t[63]=te,t[64]=ne):ne=t[64];let re;t[65]!==Y||t[66]!==ne?(re=(0,Q.jsxs)(z,{children:[Y,ne]}),t[65]=Y,t[66]=ne,t[67]=re):re=t[67];let ie;t[68]!==K||t[69]!==re?(ie=(0,Q.jsxs)(L,{children:[A,K,re]}),t[68]=K,t[69]=re,t[70]=ie):ie=t[70];let ae;return t[71]!==s||t[72]!==ie||t[73]!==O?(ae=(0,Q.jsx)(H,{open:s,onOpenChange:O,children:ie}),t[71]=s,t[72]=ie,t[73]=O,t[74]=ae):ae=t[74],ae}function or(){let e=(0,zt.c)(6),{_:t}=u(),n=Nt(),r=dt(),{openTabs:i}=a(),o=It(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==o?(s=async(e,a)=>{if(a===e.scope)return!1;et(e.scope,e.name),Qe(e.scope,e.name);let s=await Ct({name:e.name,fromScope:e.scope,toScope:a});if(tt(e.scope,e.name),!s.ok)return Ye(e.scope,e.name),Z.error(t({id:`07eGJB`,values:{0:s.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[a]}}));let c=o.status===`ready`?o.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,l=i.map(cr).filter(t=>{if(t.kind!==`doc`)return!1;let n=Wn(t.docName);return n?.scope===e.scope&&n.name===e.name}),u=l.find(sr)??l[0],d=u?.kind===`doc`?u.docName:c?_t(c):e.scope===`global`?Ie(e.scope,e.name):null,f=a===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:Ie(a,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return Ye(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s):s=e[5],s}function sr(e){return e.kind===`doc`&&Wn(e.docName)?.rel===null}function cr(e){return n(e)}function lr(e){let t=(0,zt.c)(38),{target:n,onOpenChange:r}=e,i=Nt(),a=or(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:c,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[c],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let x;t[13]!==m||t[14]!==b?(x=(0,Q.jsxs)(V,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(l,{id:`dEgA5A`}),t[16]=S):S=t[16];let C;t[17]===o?C=t[18]:(C=(0,Q.jsx)(B,{asChild:!0,children:(0,Q.jsx)(j,{variant:`outline`,disabled:o,children:S})}),t[17]=o,t[18]=C);let w;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==d?(w=async()=>{s(!0),await a({scope:c,name:u},d),s(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=c,t[23]=d,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(l,{id:`QWdKwH`}),t[25]=T):T=t[25];let E;t[26]!==o||t[27]!==w?(E=(0,Q.jsx)(j,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:w,children:T}),t[26]=o,t[27]=w,t[28]=E):E=t[28];let D;t[29]!==C||t[30]!==E?(D=(0,Q.jsxs)(z,{children:[C,E]}),t[29]=C,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==x||t[33]!==D?(O=(0,Q.jsxs)(L,{className:`sm:max-w-md`,children:[x,D]}),t[32]=x,t[33]=D,t[34]=O):O=t[34];let k;return t[35]!==f||t[36]!==O?(k=(0,Q.jsx)(H,{open:!0,onOpenChange:f,children:O}),t[35]=f,t[36]=O,t[37]=k):k=t[37],k}function ur(){let e=(0,zt.c)(53),{_:t}=u(),n=mt(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[l,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),et(e.scope,e.name);let i=await wt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(Ye(e.scope,e.name),y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=pr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),et(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await Dt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}Ye(e.scope,e.name),y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name),et(e.scope,e.name);let n=await t();return Ye(e.scope,e.name),y(null),n},e[3]=w):w=e[3];let T=w,E;e[4]!==t||e[5]!==n?(E=async function(e,r){let i=await St({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O;e[7]===t?O=e[8]:(O=async function(e){let n=[...e.names];if(n.length===0)return;for(let t of n)et(e.scope,t);y(n[0]??null);let r=await kt({scope:e.scope,names:n});for(let t of n)Ye(e.scope,t);if(y(null),!r.ok){Z.error(t({id:`nXHOFU`,values:{0:e.sourceLabel,1:r.error}}));return}let i=r.results.filter(fr),a=e.sourceLabel,o=r.updated,s=r.upToDate;if(i.length>0){let e=i.map(dr).join(`, `),n=i.length;Z.warning(t({id:`AgoIW4`,values:{source:a,updated:o,upToDate:s,failed:n,detail:e}}));return}Z.success(t(o>0?{id:`qd7L1J`,values:{source:a,updated:o,upToDate:s}}:{id:`XF1kgP`,values:{source:a}}))},e[7]=t,e[8]=O);let k=O,A,j;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||i(null)},j=()=>i(null),e[9]=A,e[10]=j):(A=e[9],j=e[10]);let M;e[11]===r?M=e[12]:(M=(0,Q.jsx)(Qn,{skill:r,onOpenChange:A,onDeleted:j}),e[11]=r,e[12]=M);let N=a?.skill??null,P=a?.existingNames??hr,F,I;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||o(null)},I=()=>o(null),e[13]=F,e[14]=I):(F=e[13],I=e[14]);let L;e[15]!==N||e[16]!==P?(L=(0,Q.jsx)(ar,{skill:N,existingNames:P,onOpenChange:F,onRenamed:I}),e[15]=N,e[16]=P,e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||c(null)},e[18]=R):R=e[18];let z;e[19]===s?z=e[20]:(z=(0,Q.jsx)(lr,{target:s,onOpenChange:R}),e[19]=s,e[20]=z);let B;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{e||d(null)},e[21]=B):B=e[21];let V;e[22]===l?V=e[23]:(V=(0,Q.jsx)(rr,{target:l,onOpenChange:B}),e[22]=l,e[23]=V);let H;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{e||p(null)},e[24]=H):H=e[24];let U;e[25]===f?U=e[26]:(U=(0,Q.jsx)(nr,{target:f,onOpenChange:H}),e[25]=f,e[26]=U);let W;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>{e||h(null)},e[27]=W):W=e[27];let G;e[28]===m?G=e[29]:(G=(0,Q.jsx)(tr,{target:m,onOpenChange:W}),e[28]=m,e[29]=G);let K;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{e||_(null)},e[30]=K):K=e[30];let q;e[31]===g?q=e[32]:(q=(0,Q.jsx)(ir,{target:g,onOpenChange:K}),e[31]=g,e[32]=q);let J;e[33]!==L||e[34]!==z||e[35]!==V||e[36]!==U||e[37]!==G||e[38]!==q||e[39]!==M?(J=(0,Q.jsxs)(Q.Fragment,{children:[M,L,z,V,U,G,q]}),e[33]=L,e[34]=z,e[35]=V,e[36]=U,e[37]=G,e[38]=q,e[39]=M,e[40]=J):J=e[40];let Y=J,X,ee,te,ne,re,ie;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(X=(e,t)=>o({skill:e,existingNames:t}),ee=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),te=(e,t)=>d({skill:e,filePath:t}),ne=(e,t)=>p({skill:e,filePath:t}),re=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),ie=(e,t)=>_({skill:e,editor:t}),e[41]=X,e[42]=ee,e[43]=te,e[44]=ne,e[45]=re,e[46]=ie):(X=e[41],ee=e[42],te=e[43],ne=e[44],re=e[45],ie=e[46]);let ae;return e[47]!==Y||e[48]!==D||e[49]!==x||e[50]!==v||e[51]!==k?(ae={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,updateAllFromSource:k,requestDelete:i,requestRename:X,requestScopeMove:ee,requestFileRename:te,requestFileDelete:ne,requestFileCreate:re,requestForkResolve:ie,dialogs:Y},e[47]=Y,e[48]=D,e[49]=x,e[50]=v,e[51]=k,e[52]=ae):ae=e[52],ae}function dr(e){return e.error?`${e.requested} (${e.error})`:e.requested}function fr(e){return e.status===`failed`||e.status===`not-found`}function pr(e){return e.map(mr).join(`, `)}function mr(e){return He[e]??e}var hr=new Set;function gr(e){let t=(0,zt.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(pt,{"aria-hidden":!0}),c=Rt(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(T,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function _r(e){let t=(0,zt.c)(68),{skill:n,filePath:r,actions:a,menuKind:o}=e,s=o===void 0?`dropdown`:o,{_:c}=u(),d;t[0]!==r||t[1]!==n.absolutePath?(d=n.absolutePath?`${Mt(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=d):d=t[2];let f=d,p;t[3]===n.path?p=t[4]:(p=Mt(n.path),t[3]=n.path,t[4]=p);let m=`${p}/${r}`,h;t[5]===c?h=t[6]:(h=async function(e){try{await A(e),Z.success(c({id:`SXCSQd`}))}catch{Z.error(c({id:`cRHuuI`}))}},t[5]=c,t[6]=h);let g=h,_;t[7]!==a||t[8]!==r||t[9]!==n?(_=()=>a.requestFileRename(n,r),t[7]=a,t[8]=r,t[9]=n,t[10]=_):_=t[10];let b,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(Fn,{"aria-hidden":!0}),S=(0,Q.jsx)(l,{id:`2wxgft`}),t[11]=b,t[12]=S):(b=t[11],S=t[12]);let w;t[13]!==s||t[14]!==_?(w=(0,Q.jsxs)(T,{menuKind:s,onSelect:_,children:[b,S]}),t[13]=s,t[14]=_,t[15]=w):w=t[15];let E;t[16]!==f||t[17]!==s?(E=(0,Q.jsx)(gr,{absolutePath:f,menuKind:s}),t[16]=f,t[17]=s,t[18]=E):E=t[18];let O,k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(i,{"aria-hidden":!0}),k=(0,Q.jsx)(l,{id:`zd00pH`}),t[19]=O,t[20]=k):(O=t[19],k=t[20]);let j;t[21]===s?j=t[22]:(j=(0,Q.jsxs)(y,{menuKind:s,children:[O,k]}),t[21]=s,t[22]=j);let M;t[23]!==f||t[24]!==g||t[25]!==s?(M=f?(0,Q.jsx)(T,{menuKind:s,onSelect:()=>void g(f),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[23]=f,t[24]=g,t[25]=s,t[26]=M):M=t[26];let N;t[27]!==g||t[28]!==m?(N=()=>void g(m),t[27]=g,t[28]=m,t[29]=N):N=t[29];let P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(l,{id:`xloBjn`}),t[30]=P):P=t[30];let F;t[31]!==s||t[32]!==N?(F=(0,Q.jsx)(T,{menuKind:s,onSelect:N,children:P}),t[31]=s,t[32]=N,t[33]=F):F=t[33];let I;t[34]!==s||t[35]!==M||t[36]!==F?(I=(0,Q.jsxs)(C,{menuKind:s,children:[M,F]}),t[34]=s,t[35]=M,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==s||t[39]!==I?(L=(0,Q.jsx)(v,{menuKind:s,children:I}),t[38]=s,t[39]=I,t[40]=L):L=t[40];let R;t[41]!==s||t[42]!==j||t[43]!==L?(R=(0,Q.jsxs)(D,{menuKind:s,children:[j,L]}),t[41]=s,t[42]=j,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==s||t[46]!==R||t[47]!==w||t[48]!==E?(z=(0,Q.jsxs)(C,{menuKind:s,children:[w,E,R]}),t[45]=s,t[46]=R,t[47]=w,t[48]=E,t[49]=z):z=t[49];let B;t[50]===s?B=t[51]:(B=(0,Q.jsx)(x,{menuKind:s}),t[50]=s,t[51]=B);let V;t[52]!==a||t[53]!==r||t[54]!==n?(V=()=>a.requestFileDelete(n,r),t[52]=a,t[53]=r,t[54]=n,t[55]=V):V=t[55];let H,U;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(gt,{"aria-hidden":!0}),U=(0,Q.jsx)(l,{id:`cnGeoo`}),t[56]=H,t[57]=U):(H=t[56],U=t[57]);let W;t[58]!==s||t[59]!==V?(W=(0,Q.jsxs)(T,{menuKind:s,variant:`destructive`,onSelect:V,children:[H,U]}),t[58]=s,t[59]=V,t[60]=W):W=t[60];let G;t[61]!==s||t[62]!==W?(G=(0,Q.jsx)(C,{menuKind:s,children:W}),t[61]=s,t[62]=W,t[63]=G):G=t[63];let K;return t[64]!==z||t[65]!==B||t[66]!==G?(K=(0,Q.jsxs)(Q.Fragment,{children:[z,B,G]}),t[64]=z,t[65]=B,t[66]=G,t[67]=K):K=t[67],K}function vr(e){let t=(0,zt.c)(42),{skill:n,actions:r,beforeDelete:a}=e,{_:o}=u(),s=w(n,r),c=n.absolutePath,d;t[0]===o?d=t[1]:(d=async function(e){try{await A(e),Z.success(o({id:`SXCSQd`}))}catch{Z.error(o({id:`cRHuuI`}))}},t[0]=o,t[1]=d);let f=d,p;t[2]===c?p=t[3]:(p=(0,Q.jsx)(gr,{absolutePath:c}),t[2]=c,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsxs)(y,{menuKind:`dropdown`,children:[(0,Q.jsx)(i,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[4]=m):m=t[4];let h;t[5]!==c||t[6]!==f?(h=c?(0,Q.jsx)(T,{menuKind:`dropdown`,onSelect:()=>void f(c),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[5]=c,t[6]=f,t[7]=h):h=t[7];let g;t[8]!==f||t[9]!==n.path?(g=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(l,{id:`xloBjn`}),t[11]=_):_=t[11];let b;t[12]===g?b=t[13]:(b=(0,Q.jsx)(T,{menuKind:`dropdown`,onSelect:g,children:_}),t[12]=g,t[13]=b);let O;t[14]!==h||t[15]!==b?(O=(0,Q.jsxs)(D,{menuKind:`dropdown`,children:[m,(0,Q.jsx)(v,{menuKind:`dropdown`,children:(0,Q.jsxs)(C,{menuKind:`dropdown`,children:[h,b]})})]}),t[14]=h,t[15]=b,t[16]=O):O=t[16];let k;t[17]!==p||t[18]!==O?(k=(0,Q.jsxs)(C,{menuKind:`dropdown`,children:[p,O]}),t[17]=p,t[18]=O,t[19]=k):k=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(x,{menuKind:`dropdown`}),t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(y,{menuKind:`dropdown`,children:[(0,Q.jsx)(Pn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),t[21]=M):M=t[21];let N;t[22]!==r||t[23]!==n?(N=e=>r.requestForkResolve(n,e),t[22]=r,t[23]=n,t[24]=N):N=t[24];let P;t[25]!==s||t[26]!==n||t[27]!==N?(P=(0,Q.jsx)(C,{menuKind:`dropdown`,children:(0,Q.jsxs)(D,{menuKind:`dropdown`,children:[M,(0,Q.jsx)(v,{menuKind:`dropdown`,className:E,children:(0,Q.jsx)(C,{menuKind:`dropdown`,children:(0,Q.jsx)(S,{toggles:s,skill:n,menuKind:`dropdown`,onResolveFork:N})})})]})}),t[25]=s,t[26]=n,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(x,{menuKind:`dropdown`}),t[29]=F):F=t[29];let I;t[30]!==r||t[31]!==n?(I=()=>r.requestDelete(n),t[30]=r,t[31]=n,t[32]=I):I=t[32];let L,R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(gt,{"aria-hidden":!0}),R=(0,Q.jsx)(l,{id:`cnGeoo`}),t[33]=L,t[34]=R):(L=t[33],R=t[34]);let z;t[35]===I?z=t[36]:(z=(0,Q.jsx)(C,{menuKind:`dropdown`,children:(0,Q.jsxs)(T,{menuKind:`dropdown`,variant:`destructive`,onSelect:I,children:[L,R]})}),t[35]=I,t[36]=z);let B;return t[37]!==a||t[38]!==P||t[39]!==z||t[40]!==k?(B=(0,Q.jsxs)(Q.Fragment,{children:[k,j,P,a,F,z]}),t[37]=a,t[38]=P,t[39]=z,t[40]=k,t[41]=B):B=t[41],B}function yr(e){let t=(0,zt.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=ot(),c=h().states,{dispatch:l}=Mn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=hn({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,p;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(p=o===`context`?(0,Q.jsx)(Hn,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(Bn,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=p):p=t[8];let m;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==p?(m=(0,Q.jsx)(br,{actions:r,existingNames:i,menuKind:o,skill:n,openWithAi:p}),t[9]=r,t[10]=i,t[11]=o,t[12]=n,t[13]=p,t[14]=m):m=t[14],m}function br(e){let t=(0,zt.c)(65),{actions:n,existingNames:r,menuKind:a,openWithAi:o,skill:c}=e,{_:d}=u(),f=Nt(),p=w(c,n),m=c.absolutePath,h=c.hostQualifier!==void 0,g;t[0]===d?g=t[1]:(g=async function(e){try{await A(e),Z.success(d({id:`SXCSQd`}))}catch{Z.error(d({id:`cRHuuI`}))}},t[0]=d,t[1]=g);let b=g,k;t[2]!==m||t[3]!==a?(k=(0,Q.jsx)(gr,{absolutePath:m,menuKind:a}),t[2]=m,t[3]=a,t[4]=k):k=t[4];let j,M;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(i,{"aria-hidden":!0}),M=(0,Q.jsx)(l,{id:`zd00pH`}),t[5]=j,t[6]=M):(j=t[5],M=t[6]);let N;t[7]===a?N=t[8]:(N=(0,Q.jsxs)(y,{menuKind:a,children:[j,M]}),t[7]=a,t[8]=N);let P;t[9]!==m||t[10]!==b||t[11]!==a?(P=m?(0,Q.jsx)(T,{menuKind:a,onSelect:()=>void b(m),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[9]=m,t[10]=b,t[11]=a,t[12]=P):P=t[12];let F;t[13]!==b||t[14]!==c.path?(F=()=>void b(c.path),t[13]=b,t[14]=c.path,t[15]=F):F=t[15];let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(l,{id:`xloBjn`}),t[16]=I):I=t[16];let L;t[17]!==a||t[18]!==F?(L=(0,Q.jsx)(T,{menuKind:a,onSelect:F,children:I}),t[17]=a,t[18]=F,t[19]=L):L=t[19];let R;t[20]!==a||t[21]!==P||t[22]!==L?(R=(0,Q.jsxs)(C,{menuKind:a,children:[P,L]}),t[20]=a,t[21]=P,t[22]=L,t[23]=R):R=t[23];let z;t[24]!==a||t[25]!==R?(z=(0,Q.jsx)(v,{menuKind:a,children:R}),t[24]=a,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==a||t[28]!==z||t[29]!==N?(B=(0,Q.jsxs)(D,{menuKind:a,children:[N,z]}),t[27]=a,t[28]=z,t[29]=N,t[30]=B):B=t[30];let V;t[31]!==a||t[32]!==o||t[33]!==B||t[34]!==k?(V=(0,Q.jsxs)(C,{menuKind:a,children:[k,o,B]}),t[31]=a,t[32]=o,t[33]=B,t[34]=k,t[35]=V):V=t[35];let H;t[36]===a?H=t[37]:(H=(0,Q.jsx)(x,{menuKind:a}),t[36]=a,t[37]=H);let U;t[38]!==n||t[39]!==r||t[40]!==p||t[41]!==a||t[42]!==h||t[43]!==f||t[44]!==c?(U=h?(0,Q.jsx)(C,{menuKind:a,children:(0,Q.jsx)(_,{menuKind:a,className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`D0CegO`})})}):(0,Q.jsxs)(C,{menuKind:a,children:[(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>void n.duplicate(c,r),children:[(0,Q.jsx)(s,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`euc6Ns`})]}),(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>n.requestRename(c,r),children:[(0,Q.jsx)(Fn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`2wxgft`})]}),(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>n.requestFileCreate(c),children:[(0,Q.jsx)(O,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`HdkSiO`})]}),(0,Q.jsxs)(D,{menuKind:a,children:[(0,Q.jsxs)(y,{menuKind:a,children:[(0,Q.jsx)(Pn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),(0,Q.jsx)(v,{menuKind:a,className:E,children:(0,Q.jsx)(C,{menuKind:a,children:(0,Q.jsx)(S,{toggles:p,skill:c,menuKind:a,onResolveFork:e=>n.requestForkResolve(c,e)})})})]}),(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>n.requestScopeMove(c,c.scope===`project`?`global`:`project`),children:[(0,Q.jsx)(Nn,{"aria-hidden":!0}),c.scope===`project`?(0,Q.jsx)(l,{id:`bpytj4`,values:{0:f.global}}):(0,Q.jsx)(l,{id:`bpytj4`,values:{0:f.project}})]})]}),t[38]=n,t[39]=r,t[40]=p,t[41]=a,t[42]=h,t[43]=f,t[44]=c,t[45]=U):U=t[45];let W;t[46]===a?W=t[47]:(W=(0,Q.jsx)(x,{menuKind:a}),t[46]=a,t[47]=W);let G;t[48]!==n||t[49]!==c?(G=()=>n.requestDelete(c),t[48]=n,t[49]=c,t[50]=G):G=t[50];let K,q;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(gt,{"aria-hidden":!0}),q=(0,Q.jsx)(l,{id:`cnGeoo`}),t[51]=K,t[52]=q):(K=t[51],q=t[52]);let J;t[53]!==a||t[54]!==G?(J=(0,Q.jsxs)(T,{menuKind:a,variant:`destructive`,onSelect:G,children:[K,q]}),t[53]=a,t[54]=G,t[55]=J):J=t[55];let Y;t[56]!==a||t[57]!==J?(Y=(0,Q.jsx)(C,{menuKind:a,children:J}),t[56]=a,t[57]=J,t[58]=Y):Y=t[58];let X;return t[59]!==V||t[60]!==H||t[61]!==U||t[62]!==W||t[63]!==Y?(X=(0,Q.jsxs)(Q.Fragment,{children:[V,H,U,W,Y]}),t[59]=V,t[60]=H,t[61]=U,t[62]=W,t[63]=Y,t[64]=X):X=t[64],X}function xr(e){let t=(0,zt.c)(48),{scope:n,name:r,showNewFile:i}=e,a=i===void 0?!0:i,{_:o}=u(),s=It(),c=ur(),d=s.status===`ready`?s.data:void 0,f;t[0]!==d||t[1]!==r||t[2]!==n?(f=d?.find(e=>e.scope===n&&e.name===r),t[0]=d,t[1]=r,t[2]=n,t[3]=f):f=t[3];let p=f,h;t[4]!==p||t[5]!==d||t[6]!==r?(h=p===void 0?d?.filter(e=>e.name===r):void 0,t[4]=p,t[5]=d,t[6]=r,t[7]=h):h=t[7];let g=h,_=p??(g?.length===1?g[0]:void 0),v;t[8]!==_||t[9]!==r||t[10]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=_,t[9]=r,t[10]=n,t[11]=v):v=t[11];let y=v,[x,C]=(0,$.useState)(!1),T=w(y,c),{installed:D,installing:k,hostSet:A}=T,M=_===void 0&&!D,N;t[12]!==_||t[13]!==A?(N=_?At(_,[...A]):[],t[12]=_,t[13]=A,t[14]=N):N=t[14];let P=N,F;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==y?(F=a?(0,Q.jsx)(j,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(y),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Q.jsx)(O,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=y,t[19]=F):F=t[19];let I=M?`resolving`:`installed`,L=M?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,R;t[20]===L?R=t[21]:(R=m(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,L),t[20]=L,t[21]=R);let z;t[22]!==P||t[23]!==k||t[24]!==M?(z=k?(0,Q.jsx)(l,{id:`b4itZn`}):M?(0,Q.jsx)(l,{id:`iKvAeG`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{id:`eQkgKV`}),(0,Q.jsx)(b,{hosts:P,className:`text-muted-foreground`})]}),t[22]=P,t[23]=k,t[24]=M,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(ut,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[26]=B):B=t[26];let V;t[27]!==k||t[28]!==z||t[29]!==I||t[30]!==R?(V=(0,Q.jsx)(ge,{asChild:!0,children:(0,Q.jsxs)(j,{variant:`outline`,size:`sm`,disabled:k,"data-testid":`skill-install-menu-trigger`,"data-state":I,className:R,children:[z,B]})}),t[27]=k,t[28]=z,t[29]=I,t[30]=R,t[31]=V):V=t[31];let H;t[32]!==c||t[33]!==y?(H=e=>c.requestForkResolve(y,e),t[32]=c,t[33]=y,t[34]=H):H=t[34];let U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>C(!1),t[35]=U):U=t[35];let W;t[36]!==y||t[37]!==H||t[38]!==T?(W=(0,Q.jsx)(ye,{align:`end`,className:E,children:(0,Q.jsx)(S,{toggles:T,skill:y,onResolveFork:H,onRunStart:U})}),t[36]=y,t[37]=H,t[38]=T,t[39]=W):W=t[39];let G;t[40]!==x||t[41]!==V||t[42]!==W?(G=(0,Q.jsxs)(be,{modal:!1,open:x,onOpenChange:C,children:[V,W]}),t[40]=x,t[41]=V,t[42]=W,t[43]=G):G=t[43];let K;return t[44]!==c.dialogs||t[45]!==G||t[46]!==F?(K=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[F,G,c.dialogs]}),t[44]=c.dialogs,t[45]=G,t[46]=F,t[47]=K):K=t[47],K}var Sr=`justify-center rounded-[5px] px-2 text-xs font-medium data-[state=checked]:bg-background data-[state=checked]:text-foreground data-[state=checked]:shadow-sm [&_[data-slot=dropdown-menu-radio-item-indicator]]:hidden`;function Cr(e){let t=(0,zt.c)(24),{value:n,onSelect:r,disabled:i}=e,a=(0,$.useId)(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(_e,{children:(0,Q.jsx)(l,{id:`YvwwqC`})}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=e=>r(e),t[1]=r,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(l,{id:`ZWyHmq`}),t[3]=c):c=t[3];let u;t[4]!==a||t[5]!==i?(u=(0,Q.jsx)(he,{value:`project`,disabled:i,onSelect:Tr,"aria-describedby":a,className:Sr,children:c}),t[4]=a,t[5]=i,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(l,{id:`ImTzPZ`}),t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==i?(f=(0,Q.jsx)(he,{value:`global`,disabled:i,onSelect:wr,"aria-describedby":a,className:Sr,children:d}),t[8]=a,t[9]=i,t[10]=f):f=t[10];let p;t[11]!==s||t[12]!==u||t[13]!==f||t[14]!==n?(p=(0,Q.jsxs)(de,{value:n,onValueChange:s,className:`mx-1 grid grid-cols-2 gap-0.5 rounded-md bg-muted/50 p-0.5`,"data-testid":`skill-scope-segment`,children:[u,f]}),t[11]=s,t[12]=u,t[13]=f,t[14]=n,t[15]=p):p=t[15];let m;t[16]===n?m=t[17]:(m=n===`project`?(0,Q.jsx)(l,{id:`9x-lMu`}):(0,Q.jsx)(l,{id:`AyKwqp`}),t[16]=n,t[17]=m);let h;t[18]!==a||t[19]!==m?(h=(0,Q.jsx)(`div`,{id:a,className:`px-2 pt-1 pb-1.5 text-xs leading-snug text-muted-foreground`,"data-testid":`skill-scope-consequence`,children:m}),t[18]=a,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[o,p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function wr(e){return e.preventDefault()}function Tr(e){return e.preventDefault()}function Er(e){let t=(0,zt.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:s}=u(),c=o>0,d;t[0]!==s||t[1]!==c||t[2]!==o?(d=s(c?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=s,t[1]=c,t[2]=o,t[3]=d):d=t[3];let f=d,p;t[4]===r?p=t[5]:(p=m(`relative`,r),t[4]=r,t[5]=p);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ht,{}),t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==o?(g=c?(0,Q.jsx)(Ft,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=c,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(M,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==f||t[13]!==n||t[14]!==p||t[15]!==_?(v=(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":f,onClick:n,"data-testid":`add-properties-button`,className:p,asChild:!0,children:_}),t[12]=f,t[13]=n,t[14]=p,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==c||t[18]!==a?(y=(0,Q.jsx)(N,{side:`bottom`,children:c?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(l,{id:`AwrGuz`})}),a?.map(Dr),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(l,{id:`yh5-4s`})})]}):(0,Q.jsx)(l,{id:`81H_23`})}),t[17]=c,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(P,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function Dr(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}export{Mn as A,un as C,kn as D,Cn as E,ln as M,pn as O,mn as S,hn as T,Ln as _,_r as a,gn as b,ur as c,Gn as d,Yn as f,In as g,Rn as h,yr as i,cn as j,Dn as k,lr as l,Bn as m,Cr as n,vr as o,Hn as p,xr as r,gr as s,Er as t,qn as u,Pn as v,dn as w,fn as x,Nn as y};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Jt as n,Z as r,br as i,i as a,tr as o,xr as s}from"./DocumentContext-DLZBeoOd.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{a as f,r as p}from"./local-menu-action-bus-BuSRFm5g.js";import{t as m}from"./utils-CPqDy6Hr.js";import{S as h,_ as g,c as _,d as v,f as y,h as b,l as x,n as S,o as C,r as w,s as T,t as E,u as D,w as O,x as k,y as A}from"./SkillInstallMenu-tVLtrElJ.js";import{t as j}from"./button-CA0dewJJ.js";import{i as M,n as N,t as P}from"./tooltip-DPvMEqsq.js";import{a as F,c as I,i as L,n as R,o as z,r as B,s as V,t as H}from"./dialog-BH80AfFt.js";import{t as U}from"./alert-dialog-C8E8SkhJ.js";import{C as W,M as G,S as K,T as q,_ as J,c as Y,d as X,f as ee,g as te,h as ne,l as re,n as ie,p as ae,r as oe,s as se,u as ce,w as le}from"./terminal-cli-display-BOx5rFUv.js";import{a as ue,c as de,d as fe,f as pe,i as me,l as he,m as ge,o as _e,p as ve,r as ye,t as be,u as xe}from"./dropdown-menu-BpLbh79a.js";import{t as Se}from"./label-Bbz2bT-a.js";import{$t as Ce,Bn as we,Cn as Te,Gn as Ee,Hn as De,Io as Oe,Jn as ke,Lo as Ae,Mt as je,Po as Me,Qt as Ne,Sn as Pe,Un as Fe,Uo as Ie,Vn as Le,Xn as Re,Yn as ze,bn as Be,ct as Ve,do as He,lt as Ue,pn as We,qn as Ge,ta as Ke}from"./dist-Ce8QgKUj2.js";import{n as Z}from"./dist-CuH7ikCn.js";import{i as qe}from"./use-settings-route-juHfAFnp.js";import{t as Je}from"./dist-BIGNzOeF2.js";import{d as Ye,h as Xe,m as Ze,n as Qe,p as $e,r as et,u as tt}from"./documents-events-xbEOOZ0r.js";import{i as nt}from"./use-apply-config-theme-B1eLRQeV.js";import{t as rt}from"./parse-api-error-DcnXKbfT.js";import{n as it,t as at}from"./workspace-paths-CD0W1etA.js";import{t as ot}from"./use-workspace-Cq3LTz0y.js";import{t as st}from"./createLucideIcon-CAkY8Blx.js";import{t as ct}from"./arrow-up-right-CXMA4cr5.js";import{t as lt}from"./RegisteredAgentIcon-D_jDwJpu.js";import{t as ut}from"./chevron-down-xENV92Te.js";import{n as dt,r as ft}from"./ManagedArtifactProperties-wz-anoGk.js";import{t as pt}from"./folder-open-5aQb9yif.js";import{t as mt}from"./use-open-skill-DbMNgFC4.js";import{t as ht}from"./list-plus-1_iMFVqs.js";import{t as gt}from"./trash-2-BVoWHmfV.js";import{m as _t,p as vt}from"./page-list-cache-hdVNMZkU.js";import{E as yt,F as bt,T as xt,a as St,b as Ct,h as wt,n as Tt,r as Et,t as Dt,u as Ot,w as kt}from"./skills-api-MlE0X9DC.js";import{a as At,l as jt,o as Mt,p as Nt}from"./skill-scope-S38ho6V2.js";import{t as Pt}from"./input-Cy2M_Avq.js";import{t as Ft}from"./badge-DGD9B_-e.js";import{t as It}from"./use-skills-CFe_Pfyl.js";import{t as Lt}from"./DiffView-DBOYN8TZ.js";import{n as Rt}from"./platform-labels-CTgi7sF6.js";var Q=t(),$=e(c(),1),zt=d();function Bt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Vt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=rt(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:Je._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Je._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Je._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ht(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Bt(e):Vt()}var Ut=`ok:skill:cowork:installed`,Wt=`1`,Gt=250,Kt=`/api/skill/install-state`;function qt(e){return`${Ut}:v${e}`}var Jt=new Map;async function Yt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Jt.get(n);if(r)return r;let i=Xt(e,t);return Jt.set(n,i),i.finally(()=>{Jt.get(n)===i&&Jt.delete(n)}),i}async function Xt(e,t){let n=e.installer===void 0?Ht():e.installer,r=Zt(e.storage),i=e.fetchSnapshot??$t,a=e.serverTimeoutMs??Gt,o=null;if(!t.force){try{o=await en(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=qt(o?.currentVersion??e.fallbackSkillVersion??Qt());if(!t.force&&r?.getItem(s)===Wt)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Wt)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Zt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Qt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function $t(){let e;try{e=await fetch(Kt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function en(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function tn(e){return Yt({},e)}function nn(){return Yt({},{force:!0})}async function rn(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function an(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return rn({target:`claude-cowork`,url:Be({mode:`cowork`},e)},n);case`claude-code`:return rn({target:`claude-code`,url:Be({mode:`code`},e)},n);case`codex`:return rn({target:`codex`,url:Pe(e)},n);case`cursor`:return rn({target:`cursor`,url:Te(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function on(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var sn=`open-knowledge:agent-thread-launch`;function cn(e,t=typeof window>`u`?new EventTarget:window){f({kind:`agent-thread`,...e},t)||t.dispatchEvent(new CustomEvent(sn,{detail:e}))}function ln(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(sn,n),()=>t.removeEventListener(sn,n)}function un(e){if(!e.docName||!e.workspace)return null;let t=at(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:it(n,t,r)}}function dn(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function fn(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function pn(e){return q(e.installUrl).then(()=>void 0)}function mn(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function hn(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function gn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??at(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:it(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function _n(e){return`Opened in ${e}.`}function vn(e,t=1){return t>=3?Je._({id:`bi2C2s`,values:{displayName:e}}):t===2?Je._({id:`1J0c0X`,values:{displayName:e}}):Je._({id:`Xs7IcT`,values:{displayName:e}})}function yn(e){return e>=3?null:e===2?Je._({id:`Xp94R1`}):Je._({id:`6gRgw8`})}function bn(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function xn(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function Sn(e,t,n,r){return e.compose?We(xn(e.compose,t,n,r)):e.selection?Ge({...e.selection,target:t,transport:r}):e.skill?ke(e.skill.name,e.skill.scope,n):e.ask?we(e.ask.relativePath,e.ask.instruction,n,t,r):Ke(e.docContext===null?e.folderRelativePath?Ee(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?De(n,e.instruction,r):Le(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):Fe(e.docContext.relativePath,n,e.instruction,r))}function Cn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||n?`${Ve} ${Sn(e,Ne[t].handoffTarget,!1,`terminal`)}`:ze(e.docContext?.relativePath??null)}function wn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||t?`${Ue} ${Sn(e,`claude-code`,!1,`terminal`)}`:Re(e.docContext?.relativePath??null)}function Tn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function En(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function Dn(e,t){cn({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:wn(e),docName:Tn(e),titleHint:En(e)})}async function On(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(Je._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Je._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Je._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:Sn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=bn(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(_n(u));else{let i=yn(r),a=vn(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{On(e,t,n,r+1)}}})}return a}function kn(e){return W.find(t=>t.id===e)?.displayName??e}function An(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function jn(){return{dispatchHandoff:an,recordHandoff:on,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>An(),getDisplayName:kn,ensureCoworkSkillInstalled:tn,autoOpen:!0}}function Mn(){let e=(0,zt.c)(2),{merged:t}=nt(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>On(e,t,{...jn(),autoOpen:n}),reinstallCoworkSkill:nn},e[0]=n,e[1]=r),r}var Nn=st(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),Pn=st(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Fn=st(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]);function In(e){let t=(0,zt.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(l,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Ln(e){let t=(0,zt.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(l,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Rn(e){let t=(0,zt.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(l,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function zn(e){return e?Je._({id:`wTcjov`}):null}function Bn(e){let t=(0,zt.c)(48),{_:n}=u(),i=r(),a=k(),s=G(),c=K();if(i)return null;let{input:d,installStates:f,dispatch:m,onBeforeLaunch:h}=e,g=d===null,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==g||t[4]!==f||t[5]!==h||t[6]!==c||t[7]!==s||t[8]!==a){let e=zn(g),r;t[20]!==f||t[21]!==c?(r=e=>ne(c,e.id,f[e.id]?.installed),t[20]=f,t[21]=c,t[22]=r):r=t[22];let i=le.filter(r),u;t[23]===c?u=t[24]:(u=e=>te(c,e.source,e.id,!0,e.supported),t[23]=c,t[24]=u);let p=s.filter(u),O=a?Ce.filter(e=>J(c,e,a.installedClis)):[];y=i.length>0,b=a!==null&&O.length>0,x=p.length>0,v=fe,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[25]=D):D=t[25],_=pe,S=`max-h-80`,C=x?(0,Q.jsxs)(me,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(_e,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(ue,{onSelect:()=>{d!==null&&(h?.(),Dn(d,{agent:{source:t.source,id:t.id}}))},disabled:g,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(lt,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==y||t[27]!==b||t[28]!==x?(w=x&&(b||y)?(0,Q.jsx)(xe,{}):null,t[26]=y,t[27]=b,t[28]=x,t[29]=w):w=t[29],T=b?(0,Q.jsxs)(me,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(_e,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=Ne[t];return(0,Q.jsxs)(ue,{onSelect:()=>{d!==null&&(h?.(),a.launchInTerminal(d,t))},disabled:g,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(oe,{id:ie(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,E=y?(0,Q.jsxs)(Q.Fragment,{children:[b?(0,Q.jsx)(xe,{}):null,(0,Q.jsxs)(me,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(_e,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(ct,{"aria-hidden":`true`,className:`size-3`})]}),i.map(t=>{let r=!g,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(ue,{disabled:!r,onSelect:()=>{if(d){if(h?.(),f[t.id]?.installed!==!0){pn(t);return}m(t.id,d)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(oe,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(In,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=g,t[4]=f,t[5]=h,t[6]=c,t[7]=s,t[8]=a,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D}else _=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19];let O;t[30]!==y||t[31]!==b||t[32]!==x?(O=x||b||y?(0,Q.jsx)(xe,{}):null,t[30]=y,t[31]=b,t[32]=x,t[33]=O):O=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(p,{"aria-hidden":`true`}),t[34]=A):A=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(ue,{onSelect:qe,"data-testid":`file-tree-open-in-settings`,children:[A,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`jRAGrQ`})})]}),t[35]=j):j=t[35];let M;t[36]!==_||t[37]!==S||t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E||t[42]!==O?(M=(0,Q.jsxs)(_,{className:S,children:[C,w,T,E,O,j]}),t[36]=_,t[37]=S,t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=O,t[43]=M):M=t[43];let N;return t[44]!==v||t[45]!==D||t[46]!==M?(N=(0,Q.jsxs)(v,{children:[D,M]}),t[44]=v,t[45]=D,t[46]=M,t[47]=N):N=t[47],N}function Vn(e){return e?Je._({id:`wTcjov`}):null}function Hn(e){let t=(0,zt.c)(47),{_:n}=u(),i=r(),a=k(),s=G(),c=K();if(i)return null;let{input:d,installStates:f,dispatch:m}=e,h=d===null,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==h||t[4]!==f||t[5]!==c||t[6]!==s||t[7]!==a){let e=Vn(h),r;t[19]!==f||t[20]!==c?(r=e=>ne(c,e.id,f[e.id]?.installed),t[19]=f,t[20]=c,t[21]=r):r=t[21];let i=le.filter(r),u;t[22]===c?u=t[23]:(u=e=>te(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=u);let p=s.filter(u),D=a?Ce.filter(e=>J(c,e,a.installedClis)):[];v=i.length>0,y=a!==null&&D.length>0,b=p.length>0,_=X,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[24]=E):E=t[24],g=ee,x=`max-h-80`,S=b?(0,Q.jsxs)(se,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(re,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(Y,{onSelect:()=>{d!==null&&Dn(d,{agent:{source:t.source,id:t.id}})},disabled:h,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(lt,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==v||t[26]!==y||t[27]!==b?(C=b&&(y||v)?(0,Q.jsx)(ce,{}):null,t[25]=v,t[26]=y,t[27]=b,t[28]=C):C=t[28],w=y?(0,Q.jsxs)(se,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(re,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=Ne[t];return(0,Q.jsxs)(Y,{onSelect:()=>{d!==null&&a.launchInTerminal(d,t)},disabled:h,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(oe,{id:ie(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,T=v?(0,Q.jsxs)(Q.Fragment,{children:[y?(0,Q.jsx)(ce,{}):null,(0,Q.jsxs)(se,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(re,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(ct,{"aria-hidden":`true`,className:`size-3`})]}),i.map(t=>{let r=!h,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(Y,{disabled:!r,onSelect:()=>{if(d){if(f[t.id]?.installed!==!0){pn(t);return}m(t.id,d)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(oe,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(In,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=h,t[4]=f,t[5]=c,t[6]=s,t[7]=a,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E}else g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18];let D;t[29]!==v||t[30]!==y||t[31]!==b?(D=b||y||v?(0,Q.jsx)(ce,{}):null,t[29]=v,t[30]=y,t[31]=b,t[32]=D):D=t[32];let O;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(p,{"aria-hidden":`true`}),t[33]=O):O=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(Y,{onSelect:qe,"data-testid":`empty-space-open-in-settings`,children:[O,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`jRAGrQ`})})]}),t[34]=A):A=t[34];let j;t[35]!==g||t[36]!==x||t[37]!==S||t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==D?(j=(0,Q.jsxs)(g,{className:x,children:[S,C,w,T,D,A]}),t[35]=g,t[36]=x,t[37]=S,t[38]=C,t[39]=w,t[40]=T,t[41]=D,t[42]=j):j=t[42];let M;return t[43]!==_||t[44]!==E||t[45]!==j?(M=(0,Q.jsxs)(_,{children:[E,j]}),t[43]=_,t[44]=E,t[45]=j,t[46]=M):M=t[46],M}var Un=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Wn(e){let t=Ae(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=Me(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=Oe(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=Un.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Gn(e,t,r){return e.filter(e=>{let i=n(e);if(i.kind===`skill-file`)return i.scope===t&&i.name===r;if(i.kind!==`doc`)return!1;let a=Wn(i.docName);return a?.scope===t&&a.name===r})}function Kn(e,t,r){let i=vt(t,r);return e.filter(e=>{let a=n(e);return a.kind===`skill-file`?a.scope===t.scope&&a.name===t.name&&a.path===r:a.kind===`doc`&&a.docName===i})}function qn(e,t,n){let r=Wn(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return vt(i,a)===e?{skill:i,filePath:a}:null}function Jn(e,t,n=(e,t)=>$e(e,t)||Ze(e,t)){let r=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),i=[],a=new Set;for(let t of e){let e=Wn(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Wn(t);if(!e||r.has(`${e.scope}\u0000${e.name}`))continue;let o=e.scope===`project`?`global`:`project`,s=r.get(`${o}\u0000${e.name}`);e.rel===null&&s!==void 0?i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)}):n(e.scope,e.name)||(s!==void 0&&!a.has(`${e.scope}\u0000${e.name}`)?(a.add(`${e.scope}\u0000${e.name}`),i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)})):i.push({kind:`close`,docName:t}))}return i}function Yn(){let e=(0,zt.c)(15),{openTabs:t,closeDocument:n}=a(),r=dt(),i;e[0]===t?i=e[1]:(i=t.some(Zn),e[0]=t,e[1]=i);let o=i,s;e[2]===o?s=e[3]:(s={enabled:o},e[2]=o,e[3]=s);let c=It(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Xn).sort().join(``)}\u0002${Xe()}`;if(l.current===i)return;l.current=i;let a=Jn(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Xn(e){return`${e.scope}\u0000${e.name}`}function Zn(e){return Wn(e)!==null}function Qn(e){let t=(0,zt.c)(18),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:o}=u(),{closeTabs:s,openTabs:c}=a(),[l,d]=(0,$.useState)(!1),f;t[0]!==o||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==c?(f=async function(e){d(!0);let t=await Tt(e.scope,e.name,e.hostQualifier);if(d(!1),!t.ok){let{error:e}=t;Z.error(o({id:`AtBdnD`,values:{error:e}}));return}Z.success(o({id:`h9QFb9`,values:{0:e.name}})),s(Gn(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=o,t[1]=s,t[2]=i,t[3]=r,t[4]=c,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==l||t[7]!==r?(h=e=>{!e&&!l&&r(!1)},t[6]=l,t[7]=r,t[8]=h):h=t[8];let _;t[9]!==o||t[10]!==l||t[11]!==p||t[12]!==n?(_=n?(0,Q.jsx)(g,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?o({id:`WnsbUT`,values:{0:n.path}}):o({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=o,t[10]=l,t[11]=p,t[12]=n,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==_?(v=(0,Q.jsx)(U,{open:m,onOpenChange:h,children:_}),t[14]=m,t[15]=h,t[16]=_,t[17]=v):v=t[17],v}function $n(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function er(e){if(/\s/.test(e))return Je._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?Je._({id:`Zt7Ktx`}):t.some(e=>e===``)?Je._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?Je._({id:`yJkw6t`}):$n(e)?null:Je._({id:`oP-FQW`})}function tr(e){let t=(0,zt.c)(70),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:o}=a(),s=(0,$.useId)(),[c,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,x,S,C,w;if(t[6]!==c||t[7]!==f){w=c.trim(),x=w===``||w.endsWith(`/`),S=x?null:er(w),y=!(x||S!==null)&&!f,b=w.includes(`/`)?w.split(`/`).slice(0,-1).join(`/`):null;let e=w.split(`/`).pop()??``;C=e!==``&&!e.includes(`.`)?`${w}.md`:w,t[6]=c,t[7]=f,t[8]=y,t[9]=b,t[10]=x,t[11]=S,t[12]=C,t[13]=w}else y=t[8],b=t[9],x=t[10],S=t[11],C=t[12],w=t[13];let T=C,E;t[14]!==i||t[15]!==y||t[16]!==T||t[17]!==r||t[18]!==o||t[19]!==n?(E=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(T),t=await bt({scope:n.skill.scope,name:n.skill.name,path:T,content:e?`# ${T.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`DvGkXq`,values:{0:t.error,effective:T}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=vt(n.skill,T);o({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=y,t[16]=T,t[17]=r,t[18]=o,t[19]=n,t[20]=E):E=t[20];let D=E,O;t[21]!==r||t[22]!==f?(O=e=>{!e&&!f&&r(!1)},t[21]=r,t[22]=f,t[23]=O):O=t[23];let k;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`wQvvZY`})}),t[24]=k):k=t[24];let A;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(V,{children:[k,(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`lM4c-I`})})]}),t[25]=A):A=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(l,{id:`I6gXOa`}),t[26]=M):M=t[26];let N;t[27]===s?N=t[28]:(N=(0,Q.jsx)(Se,{htmlFor:s,children:M}),t[27]=s,t[28]=N);let P;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>d(e.target.value),t[29]=P):P=t[29];let R=S!==null,B;t[30]===D?B=t[31]:(B=e=>{e.key===`Enter`&&D()},t[30]=D,t[31]=B);let U;t[32]!==s||t[33]!==c||t[34]!==R||t[35]!==B?(U=(0,Q.jsx)(Pt,{id:s,value:c,onChange:P,placeholder:`references/notes.md`,"aria-invalid":R,onKeyDown:B}),t[32]=s,t[33]=c,t[34]=R,t[35]=B,t[36]=U):U=t[36];let W;t[37]!==T||t[38]!==b||t[39]!==x||t[40]!==S||t[41]!==w?(W=S===null?x&&w!==``?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`Vy6XCg`})}):T===w?b?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`9lso1Y`,values:{folderPart:b},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null:(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`zC5jrM`,values:{effective:T},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:S}),t[37]=T,t[38]=b,t[39]=x,t[40]=S,t[41]=w,t[42]=W):W=t[42];let G;t[43]!==N||t[44]!==U||t[45]!==W?(G=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,U,W]}),t[43]=N,t[44]=U,t[45]=W,t[46]=G):G=t[46];let K;t[47]===r?K=t[48]:(K=()=>r(!1),t[47]=r,t[48]=K);let q;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(l,{id:`dEgA5A`}),t[49]=q):q=t[49];let J;t[50]!==f||t[51]!==K?(J=(0,Q.jsx)(j,{variant:`outline`,onClick:K,disabled:f,children:q}),t[50]=f,t[51]=K,t[52]=J):J=t[52];let Y;t[53]===D?Y=t[54]:(Y=()=>void D(),t[53]=D,t[54]=Y);let X=!y,ee;t[55]===f?ee=t[56]:(ee=f?(0,Q.jsx)(l,{id:`E9bKSA`}):(0,Q.jsx)(l,{id:`hYgDIe`}),t[55]=f,t[56]=ee);let te;t[57]!==Y||t[58]!==X||t[59]!==ee?(te=(0,Q.jsx)(j,{onClick:Y,disabled:X,children:ee}),t[57]=Y,t[58]=X,t[59]=ee,t[60]=te):te=t[60];let ne;t[61]!==J||t[62]!==te?(ne=(0,Q.jsxs)(z,{children:[J,te]}),t[61]=J,t[62]=te,t[63]=ne):ne=t[63];let re;t[64]!==G||t[65]!==ne?(re=(0,Q.jsxs)(L,{className:`sm:max-w-md`,children:[A,G,ne]}),t[64]=G,t[65]=ne,t[66]=re):re=t[66];let ie;return t[67]!==re||t[68]!==O?(ie=(0,Q.jsx)(H,{open:!0,onOpenChange:O,children:re}),t[67]=re,t[68]=O,t[69]=ie):ie=t[69],ie}function nr(e){let t=(0,zt.c)(17),{target:n,onOpenChange:r}=e,{_:i}=u(),{closeTabs:o,openTabs:s}=a(),[c,l]=(0,$.useState)(!1),d;t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==s?(d=async function(e){let{skill:t,filePath:n}=e;l(!0);let a=await Et({scope:t.scope,name:t.name,path:n});if(l(!1),!a.ok){Z.error(i({id:`CBT70t`,values:{0:a.error}}));return}if(!a.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),o(Kn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=o,t[2]=r,t[3]=s,t[4]=d):d=t[4];let f=d,p=n!==null,m;t[5]!==c||t[6]!==r?(m=e=>{!e&&!c&&r(!1)},t[5]=c,t[6]=r,t[7]=m):m=t[7];let h;t[8]!==i||t[9]!==c||t[10]!==f||t[11]!==n?(h=n?(0,Q.jsx)(g,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:c,onDelete:()=>f(n),customDescription:i({id:`ppzof_`,values:{0:Mt(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[8]=i,t[9]=c,t[10]=f,t[11]=n,t[12]=h):h=t[12];let _;return t[13]!==p||t[14]!==m||t[15]!==h?(_=(0,Q.jsx)(U,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=_):_=t[16],_}function rr(e){let t=(0,zt.c)(64),{target:n,onOpenChange:r}=e,{_:i}=u(),a=dt(),o=(0,$.useId)(),[s,c]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==s||t[7]!==n.filePath?(y=s.trim(),b=y===n.filePath,v=y===``||!$n(y),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let x=v,S=!x&&!b&&!d,C;t[11]!==i||t[12]!==S||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(C=async function(){if(!n||!S)return;f(!0);let e=await xt({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=S,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=C):C=t[17];let w=C,T;t[18]!==r||t[19]!==d?(T=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`yckias`})}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(V,{children:[E,(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`HzVAoz`})})]}),t[22]=D):D=t[22];let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(l,{id:`I6gXOa`}),t[23]=O):O=t[23];let k;t[24]===o?k=t[25]:(k=(0,Q.jsx)(Se,{htmlFor:o,children:O}),t[24]=o,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>c(e.target.value),t[26]=A):A=t[26];let M=x&&y!==``,N;t[27]===w?N=t[28]:(N=e=>{e.key===`Enter`&&w()},t[27]=w,t[28]=N);let P;t[29]!==o||t[30]!==s||t[31]!==M||t[32]!==N?(P=(0,Q.jsx)(Pt,{id:o,value:s,onChange:A,"aria-invalid":M,onKeyDown:N}),t[29]=o,t[30]=s,t[31]=M,t[32]=N,t[33]=P):P=t[33];let R;t[34]!==x||t[35]!==y?(R=x&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):null,t[34]=x,t[35]=y,t[36]=R):R=t[36];let B;t[37]!==k||t[38]!==P||t[39]!==R?(B=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[k,P,R]}),t[37]=k,t[38]=P,t[39]=R,t[40]=B):B=t[40];let U;t[41]===r?U=t[42]:(U=()=>r(!1),t[41]=r,t[42]=U);let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(l,{id:`dEgA5A`}),t[43]=W):W=t[43];let G;t[44]!==d||t[45]!==U?(G=(0,Q.jsx)(j,{variant:`outline`,onClick:U,disabled:d,children:W}),t[44]=d,t[45]=U,t[46]=G):G=t[46];let K;t[47]===w?K=t[48]:(K=()=>void w(),t[47]=w,t[48]=K);let q=!S,J;t[49]===d?J=t[50]:(J=d?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[49]=d,t[50]=J);let Y;t[51]!==K||t[52]!==q||t[53]!==J?(Y=(0,Q.jsx)(j,{onClick:K,disabled:q,children:J}),t[51]=K,t[52]=q,t[53]=J,t[54]=Y):Y=t[54];let X;t[55]!==G||t[56]!==Y?(X=(0,Q.jsxs)(z,{children:[G,Y]}),t[55]=G,t[56]=Y,t[57]=X):X=t[57];let ee;t[58]!==B||t[59]!==X?(ee=(0,Q.jsxs)(L,{className:`sm:max-w-md`,children:[D,B,X]}),t[58]=B,t[59]=X,t[60]=ee):ee=t[60];let te;return t[61]!==ee||t[62]!==T?(te=(0,Q.jsx)(H,{open:!0,onOpenChange:T,children:ee}),t[61]=ee,t[62]=T,t[63]=te):te=t[63],te}function ir(e){let t=(0,zt.c)(59),{target:n,onOpenChange:r}=e,{_:i}=u(),a=(0,$.useId)(),[o,s]=(0,$.useState)(null),[c,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b;t[0]===n?b=t[1]:(b=()=>{if(s(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${jt(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,s]])Ot({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=b);let x=n?.skill.scope,S=n?.skill.name,C=n?.editor,w;if(t[2]!==x||t[3]!==S||t[4]!==C?(w=[x,S,C],t[2]=x,t[3]=S,t[4]=C,t[5]=w):w=t[5],(0,$.useEffect)(b,w),!n)return null;let{skill:T,editor:E}=n,D;t[6]!==i||t[7]!==E||t[8]!==r||t[9]!==T.name||t[10]!==T.scope||t[11]!==n||t[12]!==g?(D=async function(e){if(!n)return;y(!0);let t=await yt({scope:T.scope,name:T.name,editor:E,action:e,...e===`rename`?{toName:g.trim()}:{}});if(y(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:E}}:e===`make-source`?{id:`It9oAP`,values:{editor:E}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=E,t[8]=r,t[9]=T.name,t[10]=T.scope,t[11]=n,t[12]=g,t[13]=D):D=t[13];let O=D,k,A;t[14]!==T.name||t[15]!==g?(A=g.trim(),k=A===``||!je.test(A)||A===T.name,t[14]=T.name,t[15]=g,t[16]=k,t[17]=A):(k=t[16],A=t[17]);let M=k,N;t[18]!==v||t[19]!==r?(N=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=N):N=t[20];let P;t[21]!==E||t[22]!==T.name?(P=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`q8aCbb`,values:{0:T.name,editor:E}})}),t[21]=E,t[22]=T.name,t[23]=P):P=t[23];let B;t[24]===E?B=t[25]:(B=(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`QASTNu`,values:{editor:E}})}),t[24]=E,t[25]=B);let U;t[26]!==B||t[27]!==P?(U=(0,Q.jsxs)(V,{children:[P,B]}),t[26]=B,t[27]=P,t[28]=U):U=t[28];let W;t[29]!==c||t[30]!==o||t[31]!==f?(W=c!==null&&o!==null?(0,Q.jsx)(Lt,{oldContent:c,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`1V17kO`})}),t[29]=c,t[30]=o,t[31]=f,t[32]=W):W=t[32];let G;t[33]!==O||t[34]!==E||t[35]!==a||t[36]!==M||t[37]!==m||t[38]!==T.name||t[39]!==g||t[40]!==A?(G=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(Se,{htmlFor:a,children:(0,Q.jsx)(l,{id:`pSimwP`,values:{editor:E}})}),(0,Q.jsx)(Pt,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${T.name}-${E}`,"aria-invalid":M&&A!==``,onKeyDown:e=>{e.key===`Enter`&&!M&&O(`rename`)}})]}):null,t[33]=O,t[34]=E,t[35]=a,t[36]=M,t[37]=m,t[38]=T.name,t[39]=g,t[40]=A,t[41]=G):G=t[41];let K;t[42]!==W||t[43]!==G?(K=(0,Q.jsxs)(R,{className:`min-h-0 flex-1 overflow-auto`,children:[W,G]}),t[42]=W,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==O||t[46]!==v||t[47]!==E||t[48]!==M||t[49]!==m||t[50]!==T.name?(q=(0,Q.jsx)(z,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(j,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(l,{id:`iH8pgl`})}),(0,Q.jsx)(j,{onClick:()=>void O(`rename`),disabled:v||M,children:(0,Q.jsx)(l,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(j,{variant:`outline`,onClick:()=>{_(`${T.name}-${E}`),h(!0)},disabled:v,children:(0,Q.jsx)(l,{id:`AT0e50`})}),(0,Q.jsx)(j,{variant:`outline`,onClick:()=>void O(`make-source`),disabled:v,children:(0,Q.jsx)(l,{id:`xWomUD`,values:{editor:E}})}),(0,Q.jsx)(j,{onClick:()=>void O(`align`),disabled:v,children:(0,Q.jsx)(l,{id:`PZn2LP`})})]})}),t[45]=O,t[46]=v,t[47]=E,t[48]=M,t[49]=m,t[50]=T.name,t[51]=q):q=t[51];let J;t[52]!==U||t[53]!==K||t[54]!==q?(J=(0,Q.jsxs)(L,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[U,K,q]}),t[52]=U,t[53]=K,t[54]=q,t[55]=J):J=t[55];let Y;return t[56]!==J||t[57]!==N?(Y=(0,Q.jsx)(H,{open:!0,onOpenChange:N,children:J}),t[56]=J,t[57]=N,t[58]=Y):Y=t[58],Y}function ar(e){let t=(0,zt.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=ft(),s=n!==null,c=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,x,S,C;if(t[5]!==r||t[6]!==u||t[7]!==n.name){S=u.trim(),C=S===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,x=S.length>64,y=S===``||!je.test(S)||x,b=!y&&!C&&r.has(S),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13];let w=b,T=!y&&!w&&!C&&!f,E;t[17]!==T||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==S?(E=async function(){if(!n||!T)return;p(!0);let e=await o({scope:n.scope,name:n.name},S);p(!1),e.ok&&(a?.(S),i(!1))},t[17]=T,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=S,t[23]=E):E=t[23];let D=E,O;t[24]===i?O=t[25]:(O=e=>e?null:i(!1),t[24]=i,t[25]=O);let k;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`dw_3cv`})}),t[26]=k):k=t[26];let A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(V,{children:[k,(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`R9IDFz`})})]}),t[27]=A):A=t[27];let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(l,{id:`6YtxFj`}),t[28]=M):M=t[28];let N;t[29]===c?N=t[30]:(N=(0,Q.jsx)(Se,{htmlFor:c,children:M}),t[29]=c,t[30]=N);let P;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>d(e.target.value),t[31]=P):P=t[31];let R;t[32]===D?R=t[33]:(R=e=>{e.key===`Enter`&&D()},t[32]=D,t[33]=R);let B=y||w,U=y&&S!==``||w?`${c}-error`:void 0,W;t[34]!==c||t[35]!==u||t[36]!==R||t[37]!==B||t[38]!==U?(W=(0,Q.jsx)(Pt,{id:c,value:u,onChange:P,onKeyDown:R,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":B,"aria-describedby":U,className:`font-mono`}),t[34]=c,t[35]=u,t[36]=R,t[37]=B,t[38]=U,t[39]=W):W=t[39];let G;t[40]!==w||t[41]!==v||t[42]!==c||t[43]!==y||t[44]!==x||t[45]!==S?(G=y&&S!==``?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(l,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):x?(0,Q.jsx)(l,{id:`lK9c4T`}):(0,Q.jsx)(l,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):w?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(l,{id:`YJ1BTp`})}):null,t[40]=w,t[41]=v,t[42]=c,t[43]=y,t[44]=x,t[45]=S,t[46]=G):G=t[46];let K;t[47]!==N||t[48]!==W||t[49]!==G?(K=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,W,G]}),t[47]=N,t[48]=W,t[49]=G,t[50]=K):K=t[50];let q;t[51]===i?q=t[52]:(q=()=>i(!1),t[51]=i,t[52]=q);let J;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(l,{id:`dEgA5A`}),t[53]=J):J=t[53];let Y;t[54]!==f||t[55]!==q?(Y=(0,Q.jsx)(j,{variant:`outline`,className:`font-mono uppercase`,onClick:q,disabled:f,children:J}),t[54]=f,t[55]=q,t[56]=Y):Y=t[56];let X;t[57]===D?X=t[58]:(X=()=>void D(),t[57]=D,t[58]=X);let ee=!T,te;t[59]===f?te=t[60]:(te=f?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[59]=f,t[60]=te);let ne;t[61]!==X||t[62]!==ee||t[63]!==te?(ne=(0,Q.jsx)(j,{onClick:X,disabled:ee,children:te}),t[61]=X,t[62]=ee,t[63]=te,t[64]=ne):ne=t[64];let re;t[65]!==Y||t[66]!==ne?(re=(0,Q.jsxs)(z,{children:[Y,ne]}),t[65]=Y,t[66]=ne,t[67]=re):re=t[67];let ie;t[68]!==K||t[69]!==re?(ie=(0,Q.jsxs)(L,{children:[A,K,re]}),t[68]=K,t[69]=re,t[70]=ie):ie=t[70];let ae;return t[71]!==s||t[72]!==ie||t[73]!==O?(ae=(0,Q.jsx)(H,{open:s,onOpenChange:O,children:ie}),t[71]=s,t[72]=ie,t[73]=O,t[74]=ae):ae=t[74],ae}function or(){let e=(0,zt.c)(6),{_:t}=u(),n=Nt(),r=dt(),{openTabs:i}=a(),o=It(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==o?(s=async(e,a)=>{if(a===e.scope)return!1;et(e.scope,e.name),Qe(e.scope,e.name);let s=await Ct({name:e.name,fromScope:e.scope,toScope:a});if(tt(e.scope,e.name),!s.ok)return Ye(e.scope,e.name),Z.error(t({id:`07eGJB`,values:{0:s.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[a]}}));let c=o.status===`ready`?o.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,l=i.map(cr).filter(t=>{if(t.kind!==`doc`)return!1;let n=Wn(t.docName);return n?.scope===e.scope&&n.name===e.name}),u=l.find(sr)??l[0],d=u?.kind===`doc`?u.docName:c?_t(c):e.scope===`global`?Ie(e.scope,e.name):null,f=a===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:Ie(a,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return Ye(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s):s=e[5],s}function sr(e){return e.kind===`doc`&&Wn(e.docName)?.rel===null}function cr(e){return n(e)}function lr(e){let t=(0,zt.c)(38),{target:n,onOpenChange:r}=e,i=Nt(),a=or(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:c,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(I,{children:(0,Q.jsx)(l,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[c],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(F,{children:(0,Q.jsx)(l,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let x;t[13]!==m||t[14]!==b?(x=(0,Q.jsxs)(V,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(l,{id:`dEgA5A`}),t[16]=S):S=t[16];let C;t[17]===o?C=t[18]:(C=(0,Q.jsx)(B,{asChild:!0,children:(0,Q.jsx)(j,{variant:`outline`,disabled:o,children:S})}),t[17]=o,t[18]=C);let w;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==d?(w=async()=>{s(!0),await a({scope:c,name:u},d),s(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=c,t[23]=d,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(l,{id:`QWdKwH`}),t[25]=T):T=t[25];let E;t[26]!==o||t[27]!==w?(E=(0,Q.jsx)(j,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:w,children:T}),t[26]=o,t[27]=w,t[28]=E):E=t[28];let D;t[29]!==C||t[30]!==E?(D=(0,Q.jsxs)(z,{children:[C,E]}),t[29]=C,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==x||t[33]!==D?(O=(0,Q.jsxs)(L,{className:`sm:max-w-md`,children:[x,D]}),t[32]=x,t[33]=D,t[34]=O):O=t[34];let k;return t[35]!==f||t[36]!==O?(k=(0,Q.jsx)(H,{open:!0,onOpenChange:f,children:O}),t[35]=f,t[36]=O,t[37]=k):k=t[37],k}function ur(){let e=(0,zt.c)(53),{_:t}=u(),n=mt(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[l,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),et(e.scope,e.name);let i=await wt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(Ye(e.scope,e.name),y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=pr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),et(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await Dt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}Ye(e.scope,e.name),y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name),et(e.scope,e.name);let n=await t();return Ye(e.scope,e.name),y(null),n},e[3]=w):w=e[3];let T=w,E;e[4]!==t||e[5]!==n?(E=async function(e,r){let i=await St({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O;e[7]===t?O=e[8]:(O=async function(e){let n=[...e.names];if(n.length===0)return;for(let t of n)et(e.scope,t);y(n[0]??null);let r=await kt({scope:e.scope,names:n});for(let t of n)Ye(e.scope,t);if(y(null),!r.ok){Z.error(t({id:`nXHOFU`,values:{0:e.sourceLabel,1:r.error}}));return}let i=r.results.filter(fr),a=e.sourceLabel,o=r.updated,s=r.upToDate;if(i.length>0){let e=i.map(dr).join(`, `),n=i.length;Z.warning(t({id:`AgoIW4`,values:{source:a,updated:o,upToDate:s,failed:n,detail:e}}));return}Z.success(t(o>0?{id:`qd7L1J`,values:{source:a,updated:o,upToDate:s}}:{id:`XF1kgP`,values:{source:a}}))},e[7]=t,e[8]=O);let k=O,A,j;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||i(null)},j=()=>i(null),e[9]=A,e[10]=j):(A=e[9],j=e[10]);let M;e[11]===r?M=e[12]:(M=(0,Q.jsx)(Qn,{skill:r,onOpenChange:A,onDeleted:j}),e[11]=r,e[12]=M);let N=a?.skill??null,P=a?.existingNames??hr,F,I;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||o(null)},I=()=>o(null),e[13]=F,e[14]=I):(F=e[13],I=e[14]);let L;e[15]!==N||e[16]!==P?(L=(0,Q.jsx)(ar,{skill:N,existingNames:P,onOpenChange:F,onRenamed:I}),e[15]=N,e[16]=P,e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||c(null)},e[18]=R):R=e[18];let z;e[19]===s?z=e[20]:(z=(0,Q.jsx)(lr,{target:s,onOpenChange:R}),e[19]=s,e[20]=z);let B;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{e||d(null)},e[21]=B):B=e[21];let V;e[22]===l?V=e[23]:(V=(0,Q.jsx)(rr,{target:l,onOpenChange:B}),e[22]=l,e[23]=V);let H;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{e||p(null)},e[24]=H):H=e[24];let U;e[25]===f?U=e[26]:(U=(0,Q.jsx)(nr,{target:f,onOpenChange:H}),e[25]=f,e[26]=U);let W;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>{e||h(null)},e[27]=W):W=e[27];let G;e[28]===m?G=e[29]:(G=(0,Q.jsx)(tr,{target:m,onOpenChange:W}),e[28]=m,e[29]=G);let K;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{e||_(null)},e[30]=K):K=e[30];let q;e[31]===g?q=e[32]:(q=(0,Q.jsx)(ir,{target:g,onOpenChange:K}),e[31]=g,e[32]=q);let J;e[33]!==L||e[34]!==z||e[35]!==V||e[36]!==U||e[37]!==G||e[38]!==q||e[39]!==M?(J=(0,Q.jsxs)(Q.Fragment,{children:[M,L,z,V,U,G,q]}),e[33]=L,e[34]=z,e[35]=V,e[36]=U,e[37]=G,e[38]=q,e[39]=M,e[40]=J):J=e[40];let Y=J,X,ee,te,ne,re,ie;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(X=(e,t)=>o({skill:e,existingNames:t}),ee=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),te=(e,t)=>d({skill:e,filePath:t}),ne=(e,t)=>p({skill:e,filePath:t}),re=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),ie=(e,t)=>_({skill:e,editor:t}),e[41]=X,e[42]=ee,e[43]=te,e[44]=ne,e[45]=re,e[46]=ie):(X=e[41],ee=e[42],te=e[43],ne=e[44],re=e[45],ie=e[46]);let ae;return e[47]!==Y||e[48]!==D||e[49]!==x||e[50]!==v||e[51]!==k?(ae={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,updateAllFromSource:k,requestDelete:i,requestRename:X,requestScopeMove:ee,requestFileRename:te,requestFileDelete:ne,requestFileCreate:re,requestForkResolve:ie,dialogs:Y},e[47]=Y,e[48]=D,e[49]=x,e[50]=v,e[51]=k,e[52]=ae):ae=e[52],ae}function dr(e){return e.error?`${e.requested} (${e.error})`:e.requested}function fr(e){return e.status===`failed`||e.status===`not-found`}function pr(e){return e.map(mr).join(`, `)}function mr(e){return He[e]??e}var hr=new Set;function gr(e){let t=(0,zt.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(pt,{"aria-hidden":!0}),c=Rt(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(T,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function _r(e){let t=(0,zt.c)(68),{skill:n,filePath:r,actions:a,menuKind:o}=e,s=o===void 0?`dropdown`:o,{_:c}=u(),d;t[0]!==r||t[1]!==n.absolutePath?(d=n.absolutePath?`${Mt(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=d):d=t[2];let f=d,p;t[3]===n.path?p=t[4]:(p=Mt(n.path),t[3]=n.path,t[4]=p);let m=`${p}/${r}`,h;t[5]===c?h=t[6]:(h=async function(e){try{await A(e),Z.success(c({id:`SXCSQd`}))}catch{Z.error(c({id:`cRHuuI`}))}},t[5]=c,t[6]=h);let g=h,_;t[7]!==a||t[8]!==r||t[9]!==n?(_=()=>a.requestFileRename(n,r),t[7]=a,t[8]=r,t[9]=n,t[10]=_):_=t[10];let b,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(Fn,{"aria-hidden":!0}),S=(0,Q.jsx)(l,{id:`2wxgft`}),t[11]=b,t[12]=S):(b=t[11],S=t[12]);let w;t[13]!==s||t[14]!==_?(w=(0,Q.jsxs)(T,{menuKind:s,onSelect:_,children:[b,S]}),t[13]=s,t[14]=_,t[15]=w):w=t[15];let E;t[16]!==f||t[17]!==s?(E=(0,Q.jsx)(gr,{absolutePath:f,menuKind:s}),t[16]=f,t[17]=s,t[18]=E):E=t[18];let O,k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(i,{"aria-hidden":!0}),k=(0,Q.jsx)(l,{id:`zd00pH`}),t[19]=O,t[20]=k):(O=t[19],k=t[20]);let j;t[21]===s?j=t[22]:(j=(0,Q.jsxs)(y,{menuKind:s,children:[O,k]}),t[21]=s,t[22]=j);let M;t[23]!==f||t[24]!==g||t[25]!==s?(M=f?(0,Q.jsx)(T,{menuKind:s,onSelect:()=>void g(f),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[23]=f,t[24]=g,t[25]=s,t[26]=M):M=t[26];let N;t[27]!==g||t[28]!==m?(N=()=>void g(m),t[27]=g,t[28]=m,t[29]=N):N=t[29];let P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(l,{id:`xloBjn`}),t[30]=P):P=t[30];let F;t[31]!==s||t[32]!==N?(F=(0,Q.jsx)(T,{menuKind:s,onSelect:N,children:P}),t[31]=s,t[32]=N,t[33]=F):F=t[33];let I;t[34]!==s||t[35]!==M||t[36]!==F?(I=(0,Q.jsxs)(C,{menuKind:s,children:[M,F]}),t[34]=s,t[35]=M,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==s||t[39]!==I?(L=(0,Q.jsx)(v,{menuKind:s,children:I}),t[38]=s,t[39]=I,t[40]=L):L=t[40];let R;t[41]!==s||t[42]!==j||t[43]!==L?(R=(0,Q.jsxs)(D,{menuKind:s,children:[j,L]}),t[41]=s,t[42]=j,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==s||t[46]!==R||t[47]!==w||t[48]!==E?(z=(0,Q.jsxs)(C,{menuKind:s,children:[w,E,R]}),t[45]=s,t[46]=R,t[47]=w,t[48]=E,t[49]=z):z=t[49];let B;t[50]===s?B=t[51]:(B=(0,Q.jsx)(x,{menuKind:s}),t[50]=s,t[51]=B);let V;t[52]!==a||t[53]!==r||t[54]!==n?(V=()=>a.requestFileDelete(n,r),t[52]=a,t[53]=r,t[54]=n,t[55]=V):V=t[55];let H,U;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(gt,{"aria-hidden":!0}),U=(0,Q.jsx)(l,{id:`cnGeoo`}),t[56]=H,t[57]=U):(H=t[56],U=t[57]);let W;t[58]!==s||t[59]!==V?(W=(0,Q.jsxs)(T,{menuKind:s,variant:`destructive`,onSelect:V,children:[H,U]}),t[58]=s,t[59]=V,t[60]=W):W=t[60];let G;t[61]!==s||t[62]!==W?(G=(0,Q.jsx)(C,{menuKind:s,children:W}),t[61]=s,t[62]=W,t[63]=G):G=t[63];let K;return t[64]!==z||t[65]!==B||t[66]!==G?(K=(0,Q.jsxs)(Q.Fragment,{children:[z,B,G]}),t[64]=z,t[65]=B,t[66]=G,t[67]=K):K=t[67],K}function vr(e){let t=(0,zt.c)(42),{skill:n,actions:r,beforeDelete:a}=e,{_:o}=u(),s=w(n,r),c=n.absolutePath,d;t[0]===o?d=t[1]:(d=async function(e){try{await A(e),Z.success(o({id:`SXCSQd`}))}catch{Z.error(o({id:`cRHuuI`}))}},t[0]=o,t[1]=d);let f=d,p;t[2]===c?p=t[3]:(p=(0,Q.jsx)(gr,{absolutePath:c}),t[2]=c,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsxs)(y,{menuKind:`dropdown`,children:[(0,Q.jsx)(i,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[4]=m):m=t[4];let h;t[5]!==c||t[6]!==f?(h=c?(0,Q.jsx)(T,{menuKind:`dropdown`,onSelect:()=>void f(c),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[5]=c,t[6]=f,t[7]=h):h=t[7];let g;t[8]!==f||t[9]!==n.path?(g=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(l,{id:`xloBjn`}),t[11]=_):_=t[11];let b;t[12]===g?b=t[13]:(b=(0,Q.jsx)(T,{menuKind:`dropdown`,onSelect:g,children:_}),t[12]=g,t[13]=b);let O;t[14]!==h||t[15]!==b?(O=(0,Q.jsxs)(D,{menuKind:`dropdown`,children:[m,(0,Q.jsx)(v,{menuKind:`dropdown`,children:(0,Q.jsxs)(C,{menuKind:`dropdown`,children:[h,b]})})]}),t[14]=h,t[15]=b,t[16]=O):O=t[16];let k;t[17]!==p||t[18]!==O?(k=(0,Q.jsxs)(C,{menuKind:`dropdown`,children:[p,O]}),t[17]=p,t[18]=O,t[19]=k):k=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(x,{menuKind:`dropdown`}),t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(y,{menuKind:`dropdown`,children:[(0,Q.jsx)(Pn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),t[21]=M):M=t[21];let N;t[22]!==r||t[23]!==n?(N=e=>r.requestForkResolve(n,e),t[22]=r,t[23]=n,t[24]=N):N=t[24];let P;t[25]!==s||t[26]!==n||t[27]!==N?(P=(0,Q.jsx)(C,{menuKind:`dropdown`,children:(0,Q.jsxs)(D,{menuKind:`dropdown`,children:[M,(0,Q.jsx)(v,{menuKind:`dropdown`,className:E,children:(0,Q.jsx)(C,{menuKind:`dropdown`,children:(0,Q.jsx)(S,{toggles:s,skill:n,menuKind:`dropdown`,onResolveFork:N})})})]})}),t[25]=s,t[26]=n,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(x,{menuKind:`dropdown`}),t[29]=F):F=t[29];let I;t[30]!==r||t[31]!==n?(I=()=>r.requestDelete(n),t[30]=r,t[31]=n,t[32]=I):I=t[32];let L,R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(gt,{"aria-hidden":!0}),R=(0,Q.jsx)(l,{id:`cnGeoo`}),t[33]=L,t[34]=R):(L=t[33],R=t[34]);let z;t[35]===I?z=t[36]:(z=(0,Q.jsx)(C,{menuKind:`dropdown`,children:(0,Q.jsxs)(T,{menuKind:`dropdown`,variant:`destructive`,onSelect:I,children:[L,R]})}),t[35]=I,t[36]=z);let B;return t[37]!==a||t[38]!==P||t[39]!==z||t[40]!==k?(B=(0,Q.jsxs)(Q.Fragment,{children:[k,j,P,a,F,z]}),t[37]=a,t[38]=P,t[39]=z,t[40]=k,t[41]=B):B=t[41],B}function yr(e){let t=(0,zt.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=ot(),c=h().states,{dispatch:l}=Mn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=hn({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,p;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(p=o===`context`?(0,Q.jsx)(Hn,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(Bn,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=p):p=t[8];let m;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==p?(m=(0,Q.jsx)(br,{actions:r,existingNames:i,menuKind:o,skill:n,openWithAi:p}),t[9]=r,t[10]=i,t[11]=o,t[12]=n,t[13]=p,t[14]=m):m=t[14],m}function br(e){let t=(0,zt.c)(65),{actions:n,existingNames:r,menuKind:a,openWithAi:o,skill:c}=e,{_:d}=u(),f=Nt(),p=w(c,n),m=c.absolutePath,h=c.hostQualifier!==void 0,g;t[0]===d?g=t[1]:(g=async function(e){try{await A(e),Z.success(d({id:`SXCSQd`}))}catch{Z.error(d({id:`cRHuuI`}))}},t[0]=d,t[1]=g);let b=g,k;t[2]!==m||t[3]!==a?(k=(0,Q.jsx)(gr,{absolutePath:m,menuKind:a}),t[2]=m,t[3]=a,t[4]=k):k=t[4];let j,M;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(i,{"aria-hidden":!0}),M=(0,Q.jsx)(l,{id:`zd00pH`}),t[5]=j,t[6]=M):(j=t[5],M=t[6]);let N;t[7]===a?N=t[8]:(N=(0,Q.jsxs)(y,{menuKind:a,children:[j,M]}),t[7]=a,t[8]=N);let P;t[9]!==m||t[10]!==b||t[11]!==a?(P=m?(0,Q.jsx)(T,{menuKind:a,onSelect:()=>void b(m),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[9]=m,t[10]=b,t[11]=a,t[12]=P):P=t[12];let F;t[13]!==b||t[14]!==c.path?(F=()=>void b(c.path),t[13]=b,t[14]=c.path,t[15]=F):F=t[15];let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(l,{id:`xloBjn`}),t[16]=I):I=t[16];let L;t[17]!==a||t[18]!==F?(L=(0,Q.jsx)(T,{menuKind:a,onSelect:F,children:I}),t[17]=a,t[18]=F,t[19]=L):L=t[19];let R;t[20]!==a||t[21]!==P||t[22]!==L?(R=(0,Q.jsxs)(C,{menuKind:a,children:[P,L]}),t[20]=a,t[21]=P,t[22]=L,t[23]=R):R=t[23];let z;t[24]!==a||t[25]!==R?(z=(0,Q.jsx)(v,{menuKind:a,children:R}),t[24]=a,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==a||t[28]!==z||t[29]!==N?(B=(0,Q.jsxs)(D,{menuKind:a,children:[N,z]}),t[27]=a,t[28]=z,t[29]=N,t[30]=B):B=t[30];let V;t[31]!==a||t[32]!==o||t[33]!==B||t[34]!==k?(V=(0,Q.jsxs)(C,{menuKind:a,children:[k,o,B]}),t[31]=a,t[32]=o,t[33]=B,t[34]=k,t[35]=V):V=t[35];let H;t[36]===a?H=t[37]:(H=(0,Q.jsx)(x,{menuKind:a}),t[36]=a,t[37]=H);let U;t[38]!==n||t[39]!==r||t[40]!==p||t[41]!==a||t[42]!==h||t[43]!==f||t[44]!==c?(U=h?(0,Q.jsx)(C,{menuKind:a,children:(0,Q.jsx)(_,{menuKind:a,className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`D0CegO`})})}):(0,Q.jsxs)(C,{menuKind:a,children:[(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>void n.duplicate(c,r),children:[(0,Q.jsx)(s,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`euc6Ns`})]}),(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>n.requestRename(c,r),children:[(0,Q.jsx)(Fn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`2wxgft`})]}),(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>n.requestFileCreate(c),children:[(0,Q.jsx)(O,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`HdkSiO`})]}),(0,Q.jsxs)(D,{menuKind:a,children:[(0,Q.jsxs)(y,{menuKind:a,children:[(0,Q.jsx)(Pn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),(0,Q.jsx)(v,{menuKind:a,className:E,children:(0,Q.jsx)(C,{menuKind:a,children:(0,Q.jsx)(S,{toggles:p,skill:c,menuKind:a,onResolveFork:e=>n.requestForkResolve(c,e)})})})]}),(0,Q.jsxs)(T,{menuKind:a,onSelect:()=>n.requestScopeMove(c,c.scope===`project`?`global`:`project`),children:[(0,Q.jsx)(Nn,{"aria-hidden":!0}),c.scope===`project`?(0,Q.jsx)(l,{id:`bpytj4`,values:{0:f.global}}):(0,Q.jsx)(l,{id:`bpytj4`,values:{0:f.project}})]})]}),t[38]=n,t[39]=r,t[40]=p,t[41]=a,t[42]=h,t[43]=f,t[44]=c,t[45]=U):U=t[45];let W;t[46]===a?W=t[47]:(W=(0,Q.jsx)(x,{menuKind:a}),t[46]=a,t[47]=W);let G;t[48]!==n||t[49]!==c?(G=()=>n.requestDelete(c),t[48]=n,t[49]=c,t[50]=G):G=t[50];let K,q;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(gt,{"aria-hidden":!0}),q=(0,Q.jsx)(l,{id:`cnGeoo`}),t[51]=K,t[52]=q):(K=t[51],q=t[52]);let J;t[53]!==a||t[54]!==G?(J=(0,Q.jsxs)(T,{menuKind:a,variant:`destructive`,onSelect:G,children:[K,q]}),t[53]=a,t[54]=G,t[55]=J):J=t[55];let Y;t[56]!==a||t[57]!==J?(Y=(0,Q.jsx)(C,{menuKind:a,children:J}),t[56]=a,t[57]=J,t[58]=Y):Y=t[58];let X;return t[59]!==V||t[60]!==H||t[61]!==U||t[62]!==W||t[63]!==Y?(X=(0,Q.jsxs)(Q.Fragment,{children:[V,H,U,W,Y]}),t[59]=V,t[60]=H,t[61]=U,t[62]=W,t[63]=Y,t[64]=X):X=t[64],X}function xr(e){let t=(0,zt.c)(48),{scope:n,name:r,showNewFile:i}=e,a=i===void 0?!0:i,{_:o}=u(),s=It(),c=ur(),d=s.status===`ready`?s.data:void 0,f;t[0]!==d||t[1]!==r||t[2]!==n?(f=d?.find(e=>e.scope===n&&e.name===r),t[0]=d,t[1]=r,t[2]=n,t[3]=f):f=t[3];let p=f,h;t[4]!==p||t[5]!==d||t[6]!==r?(h=p===void 0?d?.filter(e=>e.name===r):void 0,t[4]=p,t[5]=d,t[6]=r,t[7]=h):h=t[7];let g=h,_=p??(g?.length===1?g[0]:void 0),v;t[8]!==_||t[9]!==r||t[10]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=_,t[9]=r,t[10]=n,t[11]=v):v=t[11];let y=v,[x,C]=(0,$.useState)(!1),T=w(y,c),{installed:D,installing:k,hostSet:A}=T,M=_===void 0&&!D,N;t[12]!==_||t[13]!==A?(N=_?At(_,[...A]):[],t[12]=_,t[13]=A,t[14]=N):N=t[14];let P=N,F;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==y?(F=a?(0,Q.jsx)(j,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(y),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Q.jsx)(O,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=y,t[19]=F):F=t[19];let I=M?`resolving`:`installed`,L=M?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,R;t[20]===L?R=t[21]:(R=m(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,L),t[20]=L,t[21]=R);let z;t[22]!==P||t[23]!==k||t[24]!==M?(z=k?(0,Q.jsx)(l,{id:`b4itZn`}):M?(0,Q.jsx)(l,{id:`iKvAeG`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{id:`eQkgKV`}),(0,Q.jsx)(b,{hosts:P,className:`text-muted-foreground`})]}),t[22]=P,t[23]=k,t[24]=M,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(ut,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[26]=B):B=t[26];let V;t[27]!==k||t[28]!==z||t[29]!==I||t[30]!==R?(V=(0,Q.jsx)(ge,{asChild:!0,children:(0,Q.jsxs)(j,{variant:`outline`,size:`sm`,disabled:k,"data-testid":`skill-install-menu-trigger`,"data-state":I,className:R,children:[z,B]})}),t[27]=k,t[28]=z,t[29]=I,t[30]=R,t[31]=V):V=t[31];let H;t[32]!==c||t[33]!==y?(H=e=>c.requestForkResolve(y,e),t[32]=c,t[33]=y,t[34]=H):H=t[34];let U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>C(!1),t[35]=U):U=t[35];let W;t[36]!==y||t[37]!==H||t[38]!==T?(W=(0,Q.jsx)(ye,{align:`end`,className:E,children:(0,Q.jsx)(S,{toggles:T,skill:y,onResolveFork:H,onRunStart:U})}),t[36]=y,t[37]=H,t[38]=T,t[39]=W):W=t[39];let G;t[40]!==x||t[41]!==V||t[42]!==W?(G=(0,Q.jsxs)(be,{modal:!1,open:x,onOpenChange:C,children:[V,W]}),t[40]=x,t[41]=V,t[42]=W,t[43]=G):G=t[43];let K;return t[44]!==c.dialogs||t[45]!==G||t[46]!==F?(K=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[F,G,c.dialogs]}),t[44]=c.dialogs,t[45]=G,t[46]=F,t[47]=K):K=t[47],K}var Sr=`justify-center rounded-[5px] px-2 text-xs font-medium data-[state=checked]:bg-background data-[state=checked]:text-foreground data-[state=checked]:shadow-sm [&_[data-slot=dropdown-menu-radio-item-indicator]]:hidden`;function Cr(e){let t=(0,zt.c)(24),{value:n,onSelect:r,disabled:i}=e,a=(0,$.useId)(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(_e,{children:(0,Q.jsx)(l,{id:`YvwwqC`})}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=e=>r(e),t[1]=r,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(l,{id:`ZWyHmq`}),t[3]=c):c=t[3];let u;t[4]!==a||t[5]!==i?(u=(0,Q.jsx)(he,{value:`project`,disabled:i,onSelect:Tr,"aria-describedby":a,className:Sr,children:c}),t[4]=a,t[5]=i,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(l,{id:`ImTzPZ`}),t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==i?(f=(0,Q.jsx)(he,{value:`global`,disabled:i,onSelect:wr,"aria-describedby":a,className:Sr,children:d}),t[8]=a,t[9]=i,t[10]=f):f=t[10];let p;t[11]!==s||t[12]!==u||t[13]!==f||t[14]!==n?(p=(0,Q.jsxs)(de,{value:n,onValueChange:s,className:`mx-1 grid grid-cols-2 gap-0.5 rounded-md bg-muted/50 p-0.5`,"data-testid":`skill-scope-segment`,children:[u,f]}),t[11]=s,t[12]=u,t[13]=f,t[14]=n,t[15]=p):p=t[15];let m;t[16]===n?m=t[17]:(m=n===`project`?(0,Q.jsx)(l,{id:`9x-lMu`}):(0,Q.jsx)(l,{id:`AyKwqp`}),t[16]=n,t[17]=m);let h;t[18]!==a||t[19]!==m?(h=(0,Q.jsx)(`div`,{id:a,className:`px-2 pt-1 pb-1.5 text-xs leading-snug text-muted-foreground`,"data-testid":`skill-scope-consequence`,children:m}),t[18]=a,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[o,p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function wr(e){return e.preventDefault()}function Tr(e){return e.preventDefault()}function Er(e){let t=(0,zt.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:s}=u(),c=o>0,d;t[0]!==s||t[1]!==c||t[2]!==o?(d=s(c?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=s,t[1]=c,t[2]=o,t[3]=d):d=t[3];let f=d,p;t[4]===r?p=t[5]:(p=m(`relative`,r),t[4]=r,t[5]=p);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ht,{}),t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==o?(g=c?(0,Q.jsx)(Ft,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=c,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(M,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==f||t[13]!==n||t[14]!==p||t[15]!==_?(v=(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":f,onClick:n,"data-testid":`add-properties-button`,className:p,asChild:!0,children:_}),t[12]=f,t[13]=n,t[14]=p,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==c||t[18]!==a?(y=(0,Q.jsx)(N,{side:`bottom`,children:c?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(l,{id:`AwrGuz`})}),a?.map(Dr),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(l,{id:`yh5-4s`})})]}):(0,Q.jsx)(l,{id:`81H_23`})}),t[17]=c,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(P,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function Dr(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}export{Mn as A,un as C,kn as D,Cn as E,ln as M,pn as O,mn as S,hn as T,Ln as _,_r as a,gn as b,ur as c,Gn as d,Yn as f,In as g,Rn as h,yr as i,cn as j,Dn as k,lr as l,Bn as m,Cr as n,vr as o,Hn as p,xr as r,gr as s,Er as t,qn as u,Pn as v,dn as w,fn as x,Nn as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./index-BztAm1Wv.js";export{e as FeedbackForm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./ManagedArtifactProperties-wz-anoGk.js";export{e as ManagedArtifactProperties};
|