@inkeep/open-knowledge 0.65.0-beta.2 → 0.65.0-beta.3
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-CHx2c6Xy.mjs → acp-harness-probe-DQQnlizp.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-WlQ6Ul94.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-DaC2kklC.mjs → init-BSohnsOd.mjs} +3 -3
- package/dist/init-DjRxGcOV.mjs +1 -0
- package/dist/{launch-json-removal-CjMePBv2.mjs → launch-json-removal-cA-XEwIM.mjs} +2 -2
- package/dist/{loader-ByiK8B0y.mjs → loader-BSWlIhHW.mjs} +2 -2
- package/dist/loader-DOqrWZZ1.mjs +1 -0
- package/dist/{preview-BHSqHeEY.mjs → preview-BSBsz04I.mjs} +2 -2
- package/dist/preview-BU6qghZM.mjs +1 -0
- package/dist/public/assets/ActivityModeContent-iVCQqweq.js +1 -0
- package/dist/public/assets/{AddPropertiesButton-9t8UeUNv.js → AddPropertiesButton-CPf02Fwa.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BvDitbHq.js → AgentDiffPane-BtpGOC45.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DNGiFRk8.js → CodeMirrorPropInput-B6CoPdiS.js} +1 -1
- package/dist/public/assets/{DocumentContext-Bk80raJj.js → DocumentContext-cm1ZiCIR.js} +2 -2
- package/dist/public/assets/{ExcalidrawDocEditor-BWLBbxLq.js → ExcalidrawDocEditor-Du-VDkG1.js} +1 -1
- package/dist/public/assets/FeedbackForm-DUIxFfzS.js +1 -0
- package/dist/public/assets/{GraphPanel-K2faabwd.js → GraphPanel-BV1qD1M6.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DLKdaZ6I.js → ImportSkillDialog-D3CIOCxg.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-CzW_w-4f.js → ManagedArtifactProperties-B8EqUoZ3.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BPguuakJ.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-CDn6-Fov.js → MermaidDocEditor-DX11737F.js} +1 -1
- package/dist/public/assets/PropertyDisplayRow-DFgojvKc.js +2 -0
- package/dist/public/assets/{SessionsHost-8iO-Oxzn.js → SessionsHost-CL1ekzh8.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-DoFf01rI.js → SettingsDialogBody-CcLAF7VK.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-CeoC4ilK.js → ShareReceiveMissDialog-DbZQyqUj.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-BaSmsppZ.js → SkillInstallMenu-DsV7Zg_N.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DATGJXM1.js → SkillToolbarControls-CK1hDwSR.js} +1 -1
- package/dist/public/assets/{SourceEditor-0mDursJe.js → SourceEditor-BAFCEDOW.js} +1 -1
- package/dist/public/assets/{TerminalPanel-DQEsTAkz.js → TerminalPanel-BCS-RzlD.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BKhgsE0L.js → TerminalWindowApp-Pr86JmqX.js} +1 -1
- package/dist/public/assets/{TextDocEditor-CP3oBl2D.js → TextDocEditor-CuXA3fG7.js} +1 -1
- package/dist/public/assets/{ThreadView-pyPgmkfY.js → ThreadView-D7sS5GXu.js} +9 -9
- package/dist/public/assets/{TimelineDiffPane-DRlrJx49.js → TimelineDiffPane-C4-v6VKa.js} +1 -1
- package/dist/public/assets/{agent-diff-store-BElTL-ML.js → agent-diff-store-BD87nz3F.js} +1 -1
- package/dist/public/assets/{auth-state-cache-D6Cxeoj1.js → auth-state-cache-BmBuSpVr.js} +1 -1
- package/dist/public/assets/{comment-chips-BGcavUXY.js → comment-chips-DsXikPkv.js} +1 -1
- package/dist/public/assets/doc-paths-D_8UvPYx.js +1 -0
- package/dist/public/assets/{file-tree-adapter-DrxbV_WA.js → file-tree-adapter-DNXscpMG.js} +1 -1
- package/dist/public/assets/{index-BSwv1Rw5.js → index-BE2TsSEM.js} +7 -7
- package/dist/public/assets/{page-list-cache-CxugyRo5.js → page-list-cache-prUKRtRa.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-Cr3OD90e.js → pending-receive-nav-store-DC3PrSPg.js} +1 -1
- package/dist/public/assets/{progress-CUepiQlU.js → progress-BEXaBNIb.js} +1 -1
- package/dist/public/assets/{prop-types-od8fkHx5.js → prop-types-BOXmr7Q9.js} +1 -1
- package/dist/public/assets/{selection-context-BVxaQFmi.js → selection-context-CLtjNgSV.js} +1 -1
- package/dist/public/assets/{src-BjCeKzAx.js → src-Dq3nd0Lx.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-D1U0wgoR.js → target-navigation-intent-zJ017p9i.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BYabNAeK.js → typing-burst-detector-EBpBvXLS.js} +1 -1
- package/dist/public/assets/{use-activity-panel-c_ainl8v.js → use-activity-panel-BP6cVXAM.js} +1 -1
- package/dist/public/assets/{use-open-skill-C7C43Dh9.js → use-open-skill-C2S8Ju9E.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-_CYbMi4O.js → use-timeline-entry-diff-7MYmjURO.js} +1 -1
- package/dist/public/index.html +20 -20
- package/dist/{repair-launch-json-CFSsshJL.mjs → repair-launch-json-CNEyG1iy.mjs} +2 -2
- package/dist/{repair-mcp-configs-BUu99jfG.mjs → repair-mcp-configs-B0AIoQsw.mjs} +2 -2
- package/dist/{src-CCt_qZ--.mjs → src-BIzvFai3.mjs} +2 -2
- package/dist/src-PgKZrUu6.mjs +1 -0
- package/dist/{start-B23Yqasm.mjs → start-D8mbQnet.mjs} +2 -2
- package/dist/start-tsYshIKA.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-DpFB1Ejf.mjs +0 -2
- package/dist/init-DYHTY-c_.mjs +0 -1
- package/dist/loader-D6emV1eI.mjs +0 -1
- package/dist/preview-gKPCnBBj.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-Dt2OreGc.js +0 -1
- package/dist/public/assets/FeedbackForm-BeQoIdnE.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CsTCtTzq.js +0 -1
- package/dist/public/assets/PropertyDisplayRow-DXs5QLCp.js +0 -2
- package/dist/public/assets/doc-paths-CPq6txqF.js +0 -1
- package/dist/src-BsWoco8l.mjs +0 -1
- package/dist/start-BJMDVyKO.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{yt as r}from"./sleep-DyLEGHvt.mjs";import{Bs as i,_s as a,oc as o,ot as s,rt as c}from"./src-Ct2lVbOu.mjs";import{Ar as l,Bi as u,La as d,Mi as f,Mr as p,Ni as m,Or as h,_n as g,bi as _,bn as v,d as y,er as b,f as x,fr as S,gn as ee,kr as C,mn as te,p as ne,pn as re,rr as ie,tr as ae,ur as oe,xi as se,yi as ce}from"./src-DeoDqJay.mjs";import{I as w,P as le}from"./fs-traced-C5oeVBiQ.mjs";import{C as ue,a as T,d as de,f as fe,i as pe,l as me,n as he,o as ge,s as _e,t as ve,u as ye,x as be,y as xe}from"./resolve-project-root-DZ8FUmWA.mjs";import{i as E,n as D,o as O,r as Se,s as k,t as A}from"./colors-DSyAT9Cz.mjs";import{t as Ce}from"./constants-DpFB1Ejf.mjs";import{t as j}from"./is-object-Bw0-z8qH.mjs";import{t as we}from"./preview-BHSqHeEY.mjs";import{createRequire as Te}from"node:module";import{execFileSync as Ee}from"node:child_process";import De,{dirname as M,isAbsolute as Oe,join as N,relative as P,resolve as F,sep as ke}from"node:path";import I from"node:process";import{fileURLToPath as Ae}from"node:url";import{existsSync as L,lstatSync as je,mkdirSync as Me,readFileSync as R,readlinkSync as Ne,realpathSync as Pe,statSync as Fe,writeFileSync as Ie}from"node:fs";import{homedir as Le}from"node:os";import*as Re from"node:readline";import{inspect as ze,stripVTControlCharacters as Be,styleText as z}from"node:util";import{AsyncLocalStorage as Ve,AsyncResource as He}from"node:async_hooks";const Ue=new Set([`emacs`,`vim`]);function We(e){return Ue.has(e)}function Ge(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(We))):[]}const B=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ke=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,qe=e=>e.name===`space`,Je=e=>e.name===`backspace`,Ye=e=>`1234567890`.includes(e.name),Xe=e=>e.name===`enter`||e.name===`return`;var Ze=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$e=class extends Error{name=`ExitPromptError`},et=class extends Error{name=`HookError`},tt=class extends Error{name=`ValidationError`};const nt=new Ve;function rt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function it(e,t){let n=rt(e);return nt.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function V(){let e=nt.getStore();if(!e)throw new et(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function at(){return V().rl}function ot(e){return He.bind((...t)=>{let n=V(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function st(e){let t=V(),{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 ct(){V().handleChange()}const H={queue(e){let t=V(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(at());if(r!=null&&typeof r!=`function`)throw new tt(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=V();ot(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=V();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function lt(e){return typeof e==`function`}function U(e){return st(t=>{let n=He.bind(function(e){t.get()!==e&&(t.set(e),ct())});if(t.initialized)return[t.get(),n];let r=lt(e)?e():e;return t.set(r),[r,n]})}function ut(e,t){st(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&H.queue(e),n.set(t)})}function dt(){return I.platform.startsWith(`win`)?!!I.env.CI||!!I.env.WT_SESSION||!!I.env.TERMINUS_SUBLIME||I.env.ConEmuTask===`{cmd::Cmder}`||I.env.TERM_PROGRAM===`Terminus-Sublime`||I.env.TERM_PROGRAM===`vscode`||I.env.TERM===`xterm-256color`||I.env.TERM===`alacritty`||I.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:I.env.TERM!==`linux`}const ft={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:`╱`},pt={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:`⅒`},mt={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`},ht={...ft,...pt},gt={...ft,...mt},W=dt()?ht:gt;Object.entries(pt);const _t={prefix:{idle:z(`blue`,`?`),done:z(`green`,W.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>z(`yellow`,e))},keybindings:[],style:{answer:e=>z(`cyan`,e),message:e=>z(`bold`,e),error:e=>z(`red`,`> ${e}`),defaultAnswer:e=>z(`dim`,`(${e})`),help:e=>z(`dim`,e),highlight:e=>z(`cyan`,e),key:e=>z(`cyan`,z(`bold`,`<${e}>`))}};function vt(){return{..._t,keybindings:Ge()}}function yt(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 bt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=yt(n)&&yt(r)?bt(n,r):r}return t}function xt(...e){return bt(vt(),...e.filter(e=>e!=null))}function St({status:e=`idle`,theme:t}){let[n,r]=U(!1),[i,a]=U(0),{prefix:o,spinner:s}=xt(t);return ut(()=>{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 Ct(e,t){return st(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 wt(e){return U({current:e})[0]}function Tt(e){let t=wt(e);t.current=e,ut(e=>{let n=!1,r=ot((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Et=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 Dt=(()=>{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}})(),Ot=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,kt=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,At=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,jt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Mt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Nt=/\t{1,1000}/y,Pt=/[\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,Ft=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,It=/\p{M}+/gu,Lt={limit:1/0,ellipsis:``},Rt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Rt(i,Lt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Ft,l],[At,0],[jt,o],[Nt,s],[Pt,c],[Mt,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(It,``)){let t=e.codePointAt(0)||0;if(S=Ot(t)?2:kt(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===Mt?Dt(e.slice(p,n.lastIndex)):n===Pt?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}},zt={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Rt(e,zt,t).width,Bt=`]8;;`,Vt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bt}(?<uri>.*))`,`y`),Ht=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},Ut=e=>`[${e}m`,Wt=e=>`${Bt}${e}`,Gt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Bt,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())},Kt=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qt=(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=G(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=G(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(``),Gt(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gt(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gt(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kt(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{yt as r}from"./sleep-DyLEGHvt.mjs";import{Bs as i,_s as a,oc as o,ot as s,rt as c}from"./src-Ct2lVbOu.mjs";import{Ar as l,Bi as u,La as d,Mi as f,Mr as p,Ni as m,Or as h,_n as g,bi as _,bn as v,d as y,er as b,f as x,fr as S,gn as ee,kr as C,mn as te,p as ne,pn as re,rr as ie,tr as ae,ur as oe,xi as se,yi as ce}from"./src-DeoDqJay.mjs";import{I as w,P as le}from"./fs-traced-C5oeVBiQ.mjs";import{C as ue,a as T,d as de,f as fe,i as pe,l as me,n as he,o as ge,s as _e,t as ve,u as ye,x as be,y as xe}from"./resolve-project-root-DZ8FUmWA.mjs";import{i as E,n as D,o as O,r as Se,s as k,t as A}from"./colors-DSyAT9Cz.mjs";import{t as Ce}from"./constants-WlQ6Ul94.mjs";import{t as j}from"./is-object-Bw0-z8qH.mjs";import{t as we}from"./preview-BSBsz04I.mjs";import{createRequire as Te}from"node:module";import{execFileSync as Ee}from"node:child_process";import De,{dirname as M,isAbsolute as Oe,join as N,relative as P,resolve as F,sep as ke}from"node:path";import I from"node:process";import{fileURLToPath as Ae}from"node:url";import{existsSync as L,lstatSync as je,mkdirSync as Me,readFileSync as R,readlinkSync as Ne,realpathSync as Pe,statSync as Fe,writeFileSync as Ie}from"node:fs";import{homedir as Le}from"node:os";import*as Re from"node:readline";import{inspect as ze,stripVTControlCharacters as Be,styleText as z}from"node:util";import{AsyncLocalStorage as Ve,AsyncResource as He}from"node:async_hooks";const Ue=new Set([`emacs`,`vim`]);function We(e){return Ue.has(e)}function Ge(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(We))):[]}const B=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ke=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,qe=e=>e.name===`space`,Je=e=>e.name===`backspace`,Ye=e=>`1234567890`.includes(e.name),Xe=e=>e.name===`enter`||e.name===`return`;var Ze=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$e=class extends Error{name=`ExitPromptError`},et=class extends Error{name=`HookError`},tt=class extends Error{name=`ValidationError`};const nt=new Ve;function rt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function it(e,t){let n=rt(e);return nt.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function V(){let e=nt.getStore();if(!e)throw new et(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function at(){return V().rl}function ot(e){return He.bind((...t)=>{let n=V(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function st(e){let t=V(),{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 ct(){V().handleChange()}const H={queue(e){let t=V(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(at());if(r!=null&&typeof r!=`function`)throw new tt(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=V();ot(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=V();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function lt(e){return typeof e==`function`}function U(e){return st(t=>{let n=He.bind(function(e){t.get()!==e&&(t.set(e),ct())});if(t.initialized)return[t.get(),n];let r=lt(e)?e():e;return t.set(r),[r,n]})}function ut(e,t){st(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&H.queue(e),n.set(t)})}function dt(){return I.platform.startsWith(`win`)?!!I.env.CI||!!I.env.WT_SESSION||!!I.env.TERMINUS_SUBLIME||I.env.ConEmuTask===`{cmd::Cmder}`||I.env.TERM_PROGRAM===`Terminus-Sublime`||I.env.TERM_PROGRAM===`vscode`||I.env.TERM===`xterm-256color`||I.env.TERM===`alacritty`||I.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:I.env.TERM!==`linux`}const ft={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:`╱`},pt={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:`⅒`},mt={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`},ht={...ft,...pt},gt={...ft,...mt},W=dt()?ht:gt;Object.entries(pt);const _t={prefix:{idle:z(`blue`,`?`),done:z(`green`,W.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>z(`yellow`,e))},keybindings:[],style:{answer:e=>z(`cyan`,e),message:e=>z(`bold`,e),error:e=>z(`red`,`> ${e}`),defaultAnswer:e=>z(`dim`,`(${e})`),help:e=>z(`dim`,e),highlight:e=>z(`cyan`,e),key:e=>z(`cyan`,z(`bold`,`<${e}>`))}};function vt(){return{..._t,keybindings:Ge()}}function yt(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 bt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=yt(n)&&yt(r)?bt(n,r):r}return t}function xt(...e){return bt(vt(),...e.filter(e=>e!=null))}function St({status:e=`idle`,theme:t}){let[n,r]=U(!1),[i,a]=U(0),{prefix:o,spinner:s}=xt(t);return ut(()=>{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 Ct(e,t){return st(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 wt(e){return U({current:e})[0]}function Tt(e){let t=wt(e);t.current=e,ut(e=>{let n=!1,r=ot((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Et=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 Dt=(()=>{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}})(),Ot=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,kt=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,At=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,jt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Mt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Nt=/\t{1,1000}/y,Pt=/[\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,Ft=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,It=/\p{M}+/gu,Lt={limit:1/0,ellipsis:``},Rt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Rt(i,Lt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Ft,l],[At,0],[jt,o],[Nt,s],[Pt,c],[Mt,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(It,``)){let t=e.codePointAt(0)||0;if(S=Ot(t)?2:kt(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===Mt?Dt(e.slice(p,n.lastIndex)):n===Pt?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}},zt={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Rt(e,zt,t).width,Bt=`]8;;`,Vt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bt}(?<uri>.*))`,`y`),Ht=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},Ut=e=>`[${e}m`,Wt=e=>`${Bt}${e}`,Gt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Bt,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())},Kt=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qt=(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=G(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=G(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(``),Gt(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gt(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gt(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kt(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===``){Vt.lastIndex=e+1;let t=Vt.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+=Wt(``));let e=i?Ht(i):void 0;i&&e&&(r+=Ut(e))}else t===`
|
|
4
4
|
`&&(i&&Ht(i)&&(r+=Ut(i)),a&&(r+=Wt(a)))}return r},Jt=/\r?\n/;function Yt(e,t,n){return String(e).normalize().split(Jt).map(e=>qt(e,t,n)).join(`
|
|
@@ -635,6 +635,6 @@ export default function okBridge(pi: {
|
|
|
635
635
|
`));let p=`${a?``:``}${d}`;return p!==i&&w(e,p,{mode:Y(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?
|
|
636
636
|
`,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)?`,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=Pn(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(_);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(se.filter(e=>t.includes(e)))}function ji(e,t,n){let r=F(n,e),i;try{i=Fe(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=P(Mi(t),Mi(r));if(a.startsWith(`..`)||Oe(a))throw new $(`--content-dir must be inside the project root (${t}); got ${r}`);return a===``?`.`:a}function Mi(e){try{return Pe(e)}catch{return e}}const Ni=`open-knowledge-ui`;function Pi(e,t,n){try{return L(e.detectPath?.(t,n)??M(e.configPath(t,n)))}catch{return!1}}function Fi(e,t,n){try{let r=F(M(e.configPath(t,n))),i=F(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+ke)}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{he(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{Me(M(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{le(`${o}.lock`,()=>{let t=Jr(o).writePath;if(Me(M(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{Me(M(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{le(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}w(t,c,e===null?void 0:{mode:Y(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||!L(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(!j(i))return{kind:`no-entry`};let a=i[n];return j(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(!L(i))return{kind:`absent`};try{if(Fe(i).size>di)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=R(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,J.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(C(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ui(e={}){let t=F(e.cwd??process.cwd()),n=ve(t,{homeDir:e.home}),r=n.projectRoot;if(v(r,e.home??Le()))throw new g(r);let i=!L(N(r,`.ok`)),o=n.gitRootPromoted?P(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(`${k(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${o}/, 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: ${o} in .ok/config.yml.\n`);let c={mode:e.devMcp?`dev`:`published`},l=await ne(r),u;try{u=te(r,{contentDir:s})}catch(t){let i=_e.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,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(Ce),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{re(r)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore entry at ${r}: ${e instanceof Error?e.message:String(e)}`)}let p=await y(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}),h=e.editors??Yi(r,e.home),_=e.editors??h,x=xe(h),C=xe(_),w=e.mcp===!1||m===null,le=Array.from(new Map([...x,...w?[]:C].map(e=>[e.id,e])).values()),ue=x.filter(t=>Pi(t,r,e.home)),T=[],de=[],fe=new Set;for(let t of le){if(w){let n=``;try{n=t.configPath(r,e.home)}catch{}T.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(wi(m)&&x.includes(t)&&t.scope===`global`&&T.push(Ii(t,r,c,e.home)),Ti(m)&&C.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ii(t,r,c,e.home,n);T.push(i),(i.action===`written`||i.action===`overwritten`)&&fe.add(n)}}let me=new Set;for(let t of C){let n=t.projectSkillPath?.(r);!n||me.has(n)||(me.add(n),de.push(pe(t,r,{home:e.home})))}let he=de.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(he.length>0){let t=e.home??Le();ie({source:a,skills:[ce.project],agents:he,scope:r},{home:t,enabled:S(t).enabled})}let ge=!w&&m!==null&&Ti(m)?C.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,ye=w?[]:ue.map(e=>zi(e,r)).filter(e=>e!==void 0).filter(e=>!fe.has(e.path)),be=e.installUserSkill??ae,E=e.home??Le(),D=Ai(e.skills),O=!1,Se=!1,A=!1,j=!1,we=!1;for(let t of se){if(!D.has(t))continue;await oe(E,ce[t],!0).catch(()=>{}),O=!0;let n=await be({home:e.home,bundleId:t,force:!0});n===`installed`?Se=!0:n===`failed`?A=!0:n===`no-hosts`?we=!0:j=!0}let Te=A?`failed`:Se?`installed`:O&&j?`skip-current`:O&&we?`no-hosts`:`declined`,Ee=Se?b(E).map(e=>e.editorId):[],De=w?`skipped-flag`:`skipped-missing`,M=T.find(e=>e.editorId===`claude`)??T[0]??{action:De,configPath:_e.claude.configPath(r,e.home)},Oe=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:T,projectSkills:de,legacyProjectConfigs:ye,skillInstall:Te,skillHosts:Ee,didGitInit:l.didInit,rootGitignoreCreated:f,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDir:d?s:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:M.action,mcpPath:M.configPath,mcpError:`error`in M?M.error:void 0,projectScopeUnsupportedLabels:ge,sharing:Oe}}async function Wi(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Pn(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=An(t);if(n===`local-only`){let e=Mn(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=Nn(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=Pn(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.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=N(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(A(`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(A(`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(A(`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(A(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(A(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?P(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} ${O(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${O(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${Se(`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(A(`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?P(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${O(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${O(`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} ${Se(`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} ${P(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(A(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>ge[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${O(`installed for ${r}`)}`),n.push(` ${D(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${D(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${O(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${D(`skipped for this run (--no-skills)`)}`),n.push(` ${D(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${D(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${D(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${D(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${k(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${k(` ok repair-skills`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(k(`⚠ --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(k(`⚠ 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(we(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(`${O(`✓`)} ${A(`Next steps:`)}`),n.push(` 1. Open your editor (${E(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${E(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${E(`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(`
|
|
637
637
|
`)}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 T)Pi(_e[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:ze(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 be(`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 ue(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new ue(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new ue(`--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 g){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof f||e instanceof m){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof x){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.
|
|
638
|
-
`),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-
|
|
638
|
+
`),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-DOqrWZZ1.mjs`),{resolveContentDir:s}=await import(`./src-DHmPa1LN.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-BU6qghZM.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(A(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${O(`local-only`)} — appended ${e.appended.length} path(s) to ${A(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${O(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${O(`local-only`)} — already excluded; nothing to do.`):n.push(` ${O(`local-only`)}`):e.action===`removed`?n.push(` ${O(`shared`)} — removed OK paths from ${A(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${O(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(k(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
|
|
639
639
|
`))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${E(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(k(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${E(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${E(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(k(`Sharing mode unavailable: ${e.reason}.`));return n}}export{Fn as A,xt as B,ar as C,Kn as D,Gn as E,Nn as F,Xe as H,Dn as I,hn as L,An as M,In as N,Mn as O,Pn as P,Tt as R,Rr as S,Y as T,U 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,jn as j,Ln 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,St as z};
|
|
640
|
-
//# sourceMappingURL=init-
|
|
640
|
+
//# sourceMappingURL=init-BSohnsOd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-DeoDqJay.mjs";import{g as e}from"./init-BSohnsOd.mjs";export{e as runInit};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Mr as e,kr as t}from"./src-DeoDqJay.mjs";import{I as n}from"./fs-traced-C5oeVBiQ.mjs";import{D as r,T as i}from"./init-
|
|
2
|
-
//# sourceMappingURL=launch-json-removal-
|
|
1
|
+
import{Mr as e,kr as t}from"./src-DeoDqJay.mjs";import{I as n}from"./fs-traced-C5oeVBiQ.mjs";import{D as r,T as i}from"./init-BSohnsOd.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-cA-XEwIM.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as e,h as t,x as n,y as r,yt as i}from"./sleep-DyLEGHvt.mjs";import{Dc as a,Ec as o}from"./src-Ct2lVbOu.mjs";import{b as s}from"./src-DeoDqJay.mjs";import{A as c,L as l}from"./fs-traced-C5oeVBiQ.mjs";import{t as u}from"./constants-
|
|
2
|
-
//# sourceMappingURL=loader-
|
|
1
|
+
import{g as e,h as t,x as n,y as r,yt as i}from"./sleep-DyLEGHvt.mjs";import{Dc as a,Ec as o}from"./src-Ct2lVbOu.mjs";import{b as s}from"./src-DeoDqJay.mjs";import{A as c,L as l}from"./fs-traced-C5oeVBiQ.mjs";import{t as u}from"./constants-WlQ6Ul94.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=i();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(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(n){let i=n??process.cwd(),d=[],p=[],m=[],h=[],g=c(`user`,i),_=l({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(n,r=!1)=>{let i=v(n);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let o=t({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...o),d.push(n);let s=o.length>0?e(i.value):i.value;return r&&h.push(...a({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(i,`.ok`,u),S=b(x,!0),C=b(c(`project-local`,i)),w=o(_.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(r(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-BSWlIhHW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-BSWlIhHW.mjs";export{e as loadConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Nr as e}from"./src-DeoDqJay.mjs";import"./constants-
|
|
1
|
+
import{Nr as e}from"./src-DeoDqJay.mjs";import"./constants-WlQ6Ul94.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-BSBsz04I.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-BSBsz04I.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-cm1ZiCIR.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./button-Cym3gapE.js";import{i as l,n as u,t as d}from"./tooltip-DttaCTqz.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-CTNat3T_.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{u as b}from"./Mermaid-B4Oa2diB.js";import{t as x}from"./circle-alert-b-E0_BIP.js";import{i as S}from"./prop-types-BOXmr7Q9.js";import{t as C}from"./spinner-t7GahFcQ.js";import{t as w}from"./undo-2-XcI_wHcs.js";import{f as T}from"./doc-paths-D_8UvPYx.js";import{d as E}from"./page-list-cache-prUKRtRa.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-BD87nz3F.js";import{t as j}from"./timeline-diff-store-ym5Oz1UF.js";import{n as M}from"./use-activity-panel-BP6cVXAM.js";var N=s(),P=e(i(),1),F=t();function te(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function I(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:v,onOpenDiff:y,onRestore:b}=e,{_:x}=o(),[S,T]=(0,P.useState)(ne),E,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=E,t[1]=O):(E=t[0],O=t[1]),(0,P.useEffect)(E,O);let[k,A]=(0,P.useState)(!1),ee=D(),j=n.stackIndex+1,M=ee?.docName===r&&ee.keptCount===j,I=i-j,re=!s||v||I<=0,ie;t[2]!==I||t[3]!==b?(ie=function(){A(!1),b(I)},t[2]=I,t[3]=b,t[4]=ie):ie=t[4];let ae=ie,L;t[5]!==n||t[6]!==y?(L=()=>y(n),t[5]=n,t[6]=y,t[7]=L):L=t[7];let R;t[8]!==x||t[9]!==j||t[10]!==r?(R=x({id:`Z79bnE`,values:{burstNumber:j,docName:r}}),t[8]=x,t[9]=j,t[10]=r,t[11]=R):R=t[11];let oe=M?`bg-muted`:`hover:bg-muted/40`,se;t[12]===oe?se=t[13]:(se=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,oe],t[12]=oe,t[13]=se);let ce=se.join(` `),z;t[14]!==n.ts||t[15]!==S?(z=te(n.ts,S),t[14]=n.ts,t[15]=S,t[16]=z):z=t[16];let B;t[17]===z?B=t[18]:(B=(0,F.jsx)(`span`,{className:`font-mono`,children:z}),t[17]=z,t[18]=B);let V;t[19]===n.additions?V=t[20]:(V=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=V);let H;t[21]===n.deletions?H=t[22]:(H=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=H);let U;t[23]!==V||t[24]!==H?(U=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[V,` `,H]}),t[23]=V,t[24]=H,t[25]=U):U=t[25];let W;t[26]!==M||t[27]!==B||t[28]!==U||t[29]!==L||t[30]!==R||t[31]!==ce?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:L,"aria-pressed":M,"aria-label":R,"data-testid":`activity-panel-burst-open`,className:ce,children:[B,U]}),t[26]=M,t[27]=B,t[28]=U,t[29]=L,t[30]=R,t[31]=ce,t[32]=W):W=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=le):le=t[33];let G;t[34]!==x||t[35]!==j||t[36]!==r?(G=x({id:`Zhe80e`,values:{burstNumber:j,docName:r}}),t[34]=x,t[35]=j,t[36]=r,t[37]=G):G=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>A(!0),t[38]=ue):ue=t[38];let K;t[39]===v?K=t[40]:(K=v?(0,F.jsx)(C,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(w,{className:`size-3`,"aria-hidden":`true`}),t[39]=v,t[40]=K);let q;t[41]!==re||t[42]!==G||t[43]!==K?(q=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":G,disabled:re,onClick:ue,children:K})}),t[41]=re,t[42]=G,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==x||t[46]!==I||t[47]!==s?(J=x(s?I>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=x,t[46]=I,t[47]=s,t[48]=J):J=t[48];let Y;t[49]===J?Y=t[50]:(Y=(0,F.jsx)(u,{side:`left`,children:J}),t[49]=J,t[50]=Y);let X;t[51]!==q||t[52]!==Y?(X=(0,F.jsxs)(d,{children:[q,Y]}),t[51]=q,t[52]=Y,t[53]=X):X=t[53];let Z;t[54]!==W||t[55]!==X?(Z=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[W,le,X]}),t[54]=W,t[55]=X,t[56]=Z):Z=t[56];let Q;t[57]===v?Q=t[58]:(Q=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=Q);let de;t[59]===x?de=t[60]:(de=x({id:`a4FRQv`}),t[59]=x,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(p,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===I?pe=t[64]:(pe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:I}})}),t[63]=I,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(g,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(c,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===v?he=t[70]:(he=v?(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=v,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ae||t[73]!==v||t[74]!==he?(_e=(0,F.jsxs)(h,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:v,onClick:ae,children:[he,ge]})]}),t[72]=ae,t[73]=v,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==Q||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:Q,children:ve}),t[79]=k,t[80]=Q,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Z||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Z,ye]}),t[83]=Z,t[84]=ye,t[85]=be):be=t[85],be}function ne(){return Date.now()}function re(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return y._({id:`nYeBmY`,values:{hours:r}})}function ie(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(ae),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),ee()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=re(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=A):A=t[35];let j;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(I,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],j=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=j}else j=t[43];let M;t[51]===j?M=t[52]:(M=(0,F.jsx)(`div`,{children:j}),t[51]=j,t[52]=M);let te;return t[53]!==A||t[54]!==M?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,M]}),t[53]=A,t[54]=M,t[55]=te):te=t[55],te}function ae(){return Date.now()}async function L(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){typeof window>`u`||(window.location.hash=T(e))}function oe(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function se(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(x,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,F.jsx)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function ce(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function z(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(B,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function B(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(b,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(u,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let m;return t[7]===f?m=t[8]:(m=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=m),m}function V(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(H),i;t[0]!==n||t[1]!==r?(i=n?U(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function H(){return Date.now()}function U(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return y._({id:`nYeBmY`,values:{hours:n}})}function W(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(A,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function le(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(B,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(W,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(oe,{}):r===`error`&&i?(0,F.jsx)(se,{error:i,onRetry:s}):n===null?(0,F.jsx)(ce,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(V,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(ce,{}):n.files.map(e=>(0,F.jsx)(ie,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function G(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=r(),{openTargetTransition:d}=n(),{pageMeta:f}=S(),{data:p,status:m,error:h,reload:g}=M(l),_,y;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)O(l,e.docName,e.bursts.length)},y=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=y):(_=t[4],y=t[5]),(0,P.useEffect)(_,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(z,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==f?(b=e=>{d(E({kind:`doc`,target:e,docName:e},f),{disposition:`permanent`,consumeActiveNewTab:!0}),R(e)},t[9]=d,t[10]=f,t[11]=b):b=t[11];let x=b,C;t[12]!==p||t[13]!==l?(C=(e,t)=>{if(!p?.agent||l===null)return;j();let n=e.bursts.length;k({agentId:l,agentName:p.agent.displayName,agentColor:p.agent.color,agentIcon:p.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=p,t[13]=l,t[14]=C):C=t[14];let w=C,T;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(T=async(e,t)=>{if(!(t<=0))try{await L({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),v.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);v.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=T):T=t[19];let D=T,A;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==w||t[25]!==D||t[26]!==g||t[27]!==s||t[28]!==m?(A=(0,F.jsx)(le,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:D,onSetVersion:w,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=w,t[25]=D,t[26]=g,t[27]=s,t[28]=m,t[29]=A):A=t[29],A}export{G as ActivityModeContent};
|
package/dist/public/assets/{AddPropertiesButton-9t8UeUNv.js → AddPropertiesButton-CPf02Fwa.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Yt as n,Z as r,br as i,er as a,i as o,yr as s}from"./DocumentContext-Bk80raJj.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-BLEUyEvu.js";import{t as m}from"./utils-CPqDy6Hr.js";import{n as h}from"./clipboard-adapter-815RzzoI.js";import{S as g,_,b as v,c as y,d as b,f as x,h as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k,y as A}from"./SkillInstallMenu-BaSmsppZ.js";import{t as j}from"./button-Cym3gapE.js";import{i as M,n as N,t as P}from"./tooltip-DttaCTqz.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-CTNat3T_.js";import{t as U}from"./alert-dialog-D9BtoYXB.js";import{c as W,d as G,f as K,h as q,l as J,n as Y,p as X,r as ee,s as te,u as ne}from"./terminal-cli-display-2og2-PQg.js";import{a as re,c as ie,d as ae,f as oe,i as se,l as ce,m as le,o as ue,p as de,r as fe,t as pe,u as me}from"./dropdown-menu-CRvS0_4-.js";import{t as he}from"./label-D-K3fWtj.js";import{a as ge,b as _e,d as ve,f as ye,i as be,o as xe,p as Se,t as Ce}from"./RegisteredAgentIcon-CDl1h-4U.js";import{$t as we,Cn as Te,Go as Ee,Hn as De,Io as Oe,Jn as ke,Kn as Ae,Nt as je,Ro as Me,Un as Ne,Vn as Pe,Wn as Fe,Xn as Ie,Yn as Le,Zn as Re,en as ze,lt as Be,mn as Ve,na as He,po as Ue,ut as We,wn as Ge,xn as Ke,zo as qe}from"./dist-7elyeD1s.js";import{n as Z}from"./dist-CJhtNlOm2.js";import{a as Je}from"./use-settings-route-DHPJ3RaJ.js";import{t as Ye}from"./dist-Cr4-nBVI.js";import{d as Xe,h as Ze,m as Qe,n as $e,p as et,r as tt,u as nt}from"./documents-events--JsHluy4.js";import{i as rt}from"./use-apply-config-theme-CBmHKD_B.js";import{t as it}from"./parse-api-error-Dd8VI2eu.js";import{n as at,t as ot}from"./workspace-paths-CAsMig07.js";import{n as st}from"./use-workspace-BiK7U2Dp.js";import{t as ct}from"./createLucideIcon-BulbvLvN.js";import{t as lt}from"./arrow-up-right-BTi7mHwL.js";import{t as ut}from"./chevron-down-DNO3PgI_.js";import{n as dt,r as ft}from"./ManagedArtifactProperties-CzW_w-4f.js";import{t as pt}from"./folder-open-BWpLO6wT.js";import{t as mt}from"./use-open-skill-C7C43Dh9.js";import{t as ht}from"./list-plus-nPRgk4Qi.js";import{t as gt}from"./trash-2-DSqYvaPJ.js";import{m as _t,p as vt}from"./page-list-cache-CxugyRo5.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-DHpABbiE.js";import{a as At,l as jt,o as Mt,p as Nt}from"./skill-scope-CVSSymVB.js";import{t as Pt}from"./input-DJ1c1x-M.js";import{t as Ft}from"./badge-BWfmbBoh.js";import{t as It}from"./use-skills-D56xe4F0.js";import{t as Lt}from"./DiffView-DS16M3wC.js";import{n as Rt}from"./platform-labels-DWuGftrI.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=it(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:Ye._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Ye._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Ye._({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:Ke({mode:`cowork`},e)},n);case`claude-code`:return rn({target:`claude-code`,url:Ke({mode:`code`},e)},n);case`codex`:return rn({target:`codex`,url:Te(e)},n);case`cursor`:return rn({target:`cursor`,url:Ge(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=ot(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:at(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??ot(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:at(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?Ye._({id:`bi2C2s`,values:{displayName:e}}):t===2?Ye._({id:`1J0c0X`,values:{displayName:e}}):Ye._({id:`Xs7IcT`,values:{displayName:e}})}function yn(e){return e>=3?null:e===2?Ye._({id:`Xp94R1`}):Ye._({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?Ve(xn(e.compose,t,n,r)):e.selection?ke({...e.selection,target:t,transport:r}):e.skill?Le(e.skill.name,e.skill.scope,n):e.ask?Pe(e.ask.relativePath,e.ask.instruction,n,t,r):He(e.docContext===null?e.folderRelativePath?Ae(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?Ne(n,e.instruction,r):De(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?`${Be} ${Sn(e,we[t].handoffTarget,!1,`terminal`)}`:Ie(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?`${We} ${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(Ye._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Ye._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Ye._({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 ye.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}=rt(),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=ct(`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=ct(`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=ct(`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?Ye._({id:`wTcjov`}):null}function Bn(e){let t=(0,zt.c)(48),{_:n}=u(),i=r(),o=A(),s=_e(),c=ve();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]!==o){let e=zn(g),r;t[20]!==f||t[21]!==c?(r=e=>be(c,e.id,f[e.id]?.installed),t[20]=f,t[21]=c,t[22]=r):r=t[22];let i=Se.filter(r),u;t[23]===c?u=t[24]:(u=e=>ge(c,e.source,e.id,!0,e.supported),t[23]=c,t[24]=u);let p=s.filter(u),O=o?ze.filter(e=>xe(c,e,o.installedClis)):[];y=i.length>0,b=o!==null&&O.length>0,x=p.length>0,v=ae,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(de,{children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[25]=D):D=t[25],_=oe,S=`max-h-80`,C=x?(0,Q.jsxs)(se,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(ue,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(re,{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)(Ce,{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)(me,{}):null,t[26]=y,t[27]=b,t[28]=x,t[29]=w):w=t[29],T=b?(0,Q.jsxs)(se,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(ue,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=we[t];return(0,Q.jsxs)(re,{onSelect:()=>{d!==null&&(h?.(),o.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)(ee,{id:Y(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)(me,{}):null,(0,Q.jsxs)(se,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(lt,{"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)(re,{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)(ee,{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]=o,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)(me,{}):null,t[30]=y,t[31]=b,t[32]=x,t[33]=O):O=t[33];let k;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(p,{"aria-hidden":`true`}),t[34]=k):k=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(re,{onSelect:Je,"data-testid":`file-tree-open-in-settings`,children:[k,(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?Ye._({id:`wTcjov`}):null}function Hn(e){let t=(0,zt.c)(47),{_:n}=u(),i=r(),o=A(),s=_e(),c=ve();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]!==o){let e=Vn(h),r;t[19]!==f||t[20]!==c?(r=e=>be(c,e.id,f[e.id]?.installed),t[19]=f,t[20]=c,t[21]=r):r=t[21];let i=Se.filter(r),u;t[22]===c?u=t[23]:(u=e=>ge(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=u);let p=s.filter(u),D=o?ze.filter(e=>xe(c,e,o.installedClis)):[];v=i.length>0,y=o!==null&&D.length>0,b=p.length>0,_=G,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(X,{children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[24]=E):E=t[24],g=K,x=`max-h-80`,S=b?(0,Q.jsxs)(te,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(J,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(W,{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)(Ce,{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)(ne,{}):null,t[25]=v,t[26]=y,t[27]=b,t[28]=C):C=t[28],w=y?(0,Q.jsxs)(te,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(J,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=we[t];return(0,Q.jsxs)(W,{onSelect:()=>{d!==null&&o.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)(ee,{id:Y(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)(ne,{}):null,(0,Q.jsxs)(te,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(J,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(lt,{"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)(W,{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)(ee,{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]=o,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)(ne,{}):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 k;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(W,{onSelect:Je,"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]=k):k=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,k]}),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=qe(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=Oe(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=Me(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)=>et(e,t)||Qe(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}=o(),r=dt(),i;e[0]===t?i=e[1]:(i=t.some(Zn),e[0]=t,e[1]=i);let a=i,s;e[2]===a?s=e[3]:(s={enabled:a},e[2]=a,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${Ze()}`;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,{_:a}=u(),{closeTabs:s,openTabs:c}=o(),[l,d]=(0,$.useState)(!1),f;t[0]!==a||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(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),s(Gn(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,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 g;t[9]!==a||t[10]!==l||t[11]!==p||t[12]!==n?(g=n?(0,Q.jsx)(_,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=a,t[10]=l,t[11]=p,t[12]=n,t[13]=g):g=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==g?(v=(0,Q.jsx)(U,{open:m,onOpenChange:h,children:g}),t[14]=m,t[15]=h,t[16]=g,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 Ye._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?Ye._({id:`Zt7Ktx`}):t.some(e=>e===``)?Ye._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?Ye._({id:`yJkw6t`}):$n(e)?null:Ye._({id:`oP-FQW`})}function tr(e){let t=(0,zt.c)(70),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:a}=o(),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]!==a||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);a({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=y,t[16]=T,t[17]=r,t[18]=a,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)(he,{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:a,openTabs:s}=o(),[c,l]=(0,$.useState)(!1),d;t[0]!==i||t[1]!==a||t[2]!==r||t[3]!==s?(d=async function(e){let{skill:t,filePath:n}=e;l(!0);let o=await Et({scope:t.scope,name:t.name,path:n});if(l(!1),!o.ok){Z.error(i({id:`CBT70t`,values:{0:o.error}}));return}if(!o.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),a(Kn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=a,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)(_,{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 g;return t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Q.jsx)(U,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}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)(he,{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)(he,{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)(he,{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}=o(),a=It(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==a?(s=async(e,o)=>{if(o===e.scope)return!1;tt(e.scope,e.name),$e(e.scope,e.name);let s=await Ct({name:e.name,fromScope:e.scope,toScope:o});if(nt(e.scope,e.name),!s.ok)return Xe(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[o]}}));let c=a.status===`ready`?a.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`?Ee(e.scope,e.name):null,f=o===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:Ee(o,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return Xe(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,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),tt(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(Xe(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),tt(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}}Xe(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),tt(e.scope,e.name);let n=await t();return Xe(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)tt(e.scope,t);y(n[0]??null);let r=await kt({scope:e.scope,names:n});for(let t of n)Xe(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 Ue[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)(D,{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:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,{_: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}`,g;t[5]===c?g=t[6]:(g=async function(e){try{await h(e),Z.success(c({id:`SXCSQd`}))}catch{Z.error(c({id:`cRHuuI`}))}},t[5]=c,t[6]=g);let _=g,v;t[7]!==i||t[8]!==r||t[9]!==n?(v=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=v):v=t[10];let y,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(Fn,{"aria-hidden":!0}),S=(0,Q.jsx)(l,{id:`2wxgft`}),t[11]=y,t[12]=S):(y=t[11],S=t[12]);let w;t[13]!==o||t[14]!==v?(w=(0,Q.jsxs)(D,{menuKind:o,onSelect:v,children:[y,S]}),t[13]=o,t[14]=v,t[15]=w):w=t[15];let E;t[16]!==f||t[17]!==o?(E=(0,Q.jsx)(gr,{absolutePath:f,menuKind:o}),t[16]=f,t[17]=o,t[18]=E):E=t[18];let O,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(s,{"aria-hidden":!0}),A=(0,Q.jsx)(l,{id:`zd00pH`}),t[19]=O,t[20]=A):(O=t[19],A=t[20]);let j;t[21]===o?j=t[22]:(j=(0,Q.jsxs)(x,{menuKind:o,children:[O,A]}),t[21]=o,t[22]=j);let M;t[23]!==f||t[24]!==_||t[25]!==o?(M=f?(0,Q.jsx)(D,{menuKind:o,onSelect:()=>void _(f),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[23]=f,t[24]=_,t[25]=o,t[26]=M):M=t[26];let N;t[27]!==_||t[28]!==m?(N=()=>void _(m),t[27]=_,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]!==o||t[32]!==N?(F=(0,Q.jsx)(D,{menuKind:o,onSelect:N,children:P}),t[31]=o,t[32]=N,t[33]=F):F=t[33];let I;t[34]!==o||t[35]!==M||t[36]!==F?(I=(0,Q.jsxs)(T,{menuKind:o,children:[M,F]}),t[34]=o,t[35]=M,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==o||t[39]!==I?(L=(0,Q.jsx)(b,{menuKind:o,children:I}),t[38]=o,t[39]=I,t[40]=L):L=t[40];let R;t[41]!==o||t[42]!==j||t[43]!==L?(R=(0,Q.jsxs)(k,{menuKind:o,children:[j,L]}),t[41]=o,t[42]=j,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==o||t[46]!==R||t[47]!==w||t[48]!==E?(z=(0,Q.jsxs)(T,{menuKind:o,children:[w,E,R]}),t[45]=o,t[46]=R,t[47]=w,t[48]=E,t[49]=z):z=t[49];let B;t[50]===o?B=t[51]:(B=(0,Q.jsx)(C,{menuKind:o}),t[50]=o,t[51]=B);let V;t[52]!==i||t[53]!==r||t[54]!==n?(V=()=>i.requestFileDelete(n,r),t[52]=i,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]!==o||t[59]!==V?(W=(0,Q.jsxs)(D,{menuKind:o,variant:`destructive`,onSelect:V,children:[H,U]}),t[58]=o,t[59]=V,t[60]=W):W=t[60];let G;t[61]!==o||t[62]!==W?(G=(0,Q.jsx)(T,{menuKind:o,children:W}),t[61]=o,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:i}=e,{_:a}=u(),o=E(n,r),c=n.absolutePath,d;t[0]===a?d=t[1]:(d=async function(e){try{await h(e),Z.success(a({id:`SXCSQd`}))}catch{Z.error(a({id:`cRHuuI`}))}},t[0]=a,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)(x,{menuKind:`dropdown`,children:[(0,Q.jsx)(s,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[4]=m):m=t[4];let g;t[5]!==c||t[6]!==f?(g=c?(0,Q.jsx)(D,{menuKind:`dropdown`,onSelect:()=>void f(c),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[5]=c,t[6]=f,t[7]=g):g=t[7];let _;t[8]!==f||t[9]!==n.path?(_=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=_):_=t[10];let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(l,{id:`xloBjn`}),t[11]=v):v=t[11];let y;t[12]===_?y=t[13]:(y=(0,Q.jsx)(D,{menuKind:`dropdown`,onSelect:_,children:v}),t[12]=_,t[13]=y);let S;t[14]!==g||t[15]!==y?(S=(0,Q.jsxs)(k,{menuKind:`dropdown`,children:[m,(0,Q.jsx)(b,{menuKind:`dropdown`,children:(0,Q.jsxs)(T,{menuKind:`dropdown`,children:[g,y]})})]}),t[14]=g,t[15]=y,t[16]=S):S=t[16];let A;t[17]!==p||t[18]!==S?(A=(0,Q.jsxs)(T,{menuKind:`dropdown`,children:[p,S]}),t[17]=p,t[18]=S,t[19]=A):A=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(C,{menuKind:`dropdown`}),t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(x,{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]!==o||t[26]!==n||t[27]!==N?(P=(0,Q.jsx)(T,{menuKind:`dropdown`,children:(0,Q.jsxs)(k,{menuKind:`dropdown`,children:[M,(0,Q.jsx)(b,{menuKind:`dropdown`,className:O,children:(0,Q.jsx)(T,{menuKind:`dropdown`,children:(0,Q.jsx)(w,{toggles:o,skill:n,menuKind:`dropdown`,onResolveFork:N})})})]})}),t[25]=o,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)(C,{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)(T,{menuKind:`dropdown`,children:(0,Q.jsxs)(D,{menuKind:`dropdown`,variant:`destructive`,onSelect:I,children:[L,R]})}),t[35]=I,t[36]=z);let B;return t[37]!==i||t[38]!==P||t[39]!==z||t[40]!==A?(B=(0,Q.jsxs)(Q.Fragment,{children:[A,j,P,i,F,z]}),t[37]=i,t[38]=P,t[39]=z,t[40]=A,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=st(),c=v().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=E(c,n),m=c.absolutePath,_=c.hostQualifier!==void 0,v;t[0]===d?v=t[1]:(v=async function(e){try{await h(e),Z.success(d({id:`SXCSQd`}))}catch{Z.error(d({id:`cRHuuI`}))}},t[0]=d,t[1]=v);let S=v,A;t[2]!==m||t[3]!==a?(A=(0,Q.jsx)(gr,{absolutePath:m,menuKind:a}),t[2]=m,t[3]=a,t[4]=A):A=t[4];let j,M;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(s,{"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)(x,{menuKind:a,children:[j,M]}),t[7]=a,t[8]=N);let P;t[9]!==m||t[10]!==S||t[11]!==a?(P=m?(0,Q.jsx)(D,{menuKind:a,onSelect:()=>void S(m),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[9]=m,t[10]=S,t[11]=a,t[12]=P):P=t[12];let F;t[13]!==S||t[14]!==c.path?(F=()=>void S(c.path),t[13]=S,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)(D,{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)(T,{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)(b,{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)(k,{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]!==A?(V=(0,Q.jsxs)(T,{menuKind:a,children:[A,o,B]}),t[31]=a,t[32]=o,t[33]=B,t[34]=A,t[35]=V):V=t[35];let H;t[36]===a?H=t[37]:(H=(0,Q.jsx)(C,{menuKind:a}),t[36]=a,t[37]=H);let U;t[38]!==n||t[39]!==r||t[40]!==p||t[41]!==a||t[42]!==_||t[43]!==f||t[44]!==c?(U=_?(0,Q.jsx)(T,{menuKind:a,children:(0,Q.jsx)(y,{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)(T,{menuKind:a,children:[(0,Q.jsxs)(D,{menuKind:a,onSelect:()=>void n.duplicate(c,r),children:[(0,Q.jsx)(i,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`euc6Ns`})]}),(0,Q.jsxs)(D,{menuKind:a,onSelect:()=>n.requestRename(c,r),children:[(0,Q.jsx)(Fn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`2wxgft`})]}),(0,Q.jsxs)(D,{menuKind:a,onSelect:()=>n.requestFileCreate(c),children:[(0,Q.jsx)(g,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`HdkSiO`})]}),(0,Q.jsxs)(k,{menuKind:a,children:[(0,Q.jsxs)(x,{menuKind:a,children:[(0,Q.jsx)(Pn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),(0,Q.jsx)(b,{menuKind:a,className:O,children:(0,Q.jsx)(T,{menuKind:a,children:(0,Q.jsx)(w,{toggles:p,skill:c,menuKind:a,onResolveFork:e=>n.requestForkResolve(c,e)})})})]}),(0,Q.jsxs)(D,{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]=_,t[43]=f,t[44]=c,t[45]=U):U=t[45];let W;t[46]===a?W=t[47]:(W=(0,Q.jsx)(C,{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)(D,{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)(T,{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 _=h,v=p??(_?.length===1?_[0]:void 0),y;t[8]!==v||t[9]!==r||t[10]!==n?(y=v??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=v,t[9]=r,t[10]=n,t[11]=y):y=t[11];let b=y,[x,C]=(0,$.useState)(!1),T=E(b,c),{installed:D,installing:k,hostSet:A}=T,M=v===void 0&&!D,N;t[12]!==v||t[13]!==A?(N=v?At(v,[...A]):[],t[12]=v,t[13]=A,t[14]=N):N=t[14];let P=N,F;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==b?(F=a?(0,Q.jsx)(j,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(b),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=b,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)(S,{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)(le,{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]!==b?(H=e=>c.requestForkResolve(b,e),t[32]=c,t[33]=b,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]!==b||t[37]!==H||t[38]!==T?(W=(0,Q.jsx)(fe,{align:`end`,className:O,children:(0,Q.jsx)(w,{toggles:T,skill:b,onResolveFork:H,onRunStart:U})}),t[36]=b,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)(pe,{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)(ue,{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)(ce,{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)(ce,{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)(ie,{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{Yt as n,Z as r,br as i,er as a,i as o,yr as s}from"./DocumentContext-cm1ZiCIR.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-BLEUyEvu.js";import{t as m}from"./utils-CPqDy6Hr.js";import{n as h}from"./clipboard-adapter-815RzzoI.js";import{S as g,_,b as v,c as y,d as b,f as x,h as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k,y as A}from"./SkillInstallMenu-DsV7Zg_N.js";import{t as j}from"./button-Cym3gapE.js";import{i as M,n as N,t as P}from"./tooltip-DttaCTqz.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-CTNat3T_.js";import{t as U}from"./alert-dialog-D9BtoYXB.js";import{c as W,d as G,f as K,h as q,l as J,n as Y,p as X,r as ee,s as te,u as ne}from"./terminal-cli-display-2og2-PQg.js";import{a as re,c as ie,d as ae,f as oe,i as se,l as ce,m as le,o as ue,p as de,r as fe,t as pe,u as me}from"./dropdown-menu-CRvS0_4-.js";import{t as he}from"./label-D-K3fWtj.js";import{a as ge,b as _e,d as ve,f as ye,i as be,o as xe,p as Se,t as Ce}from"./RegisteredAgentIcon-CDl1h-4U.js";import{$t as we,Cn as Te,Go as Ee,Hn as De,Io as Oe,Jn as ke,Kn as Ae,Nt as je,Ro as Me,Un as Ne,Vn as Pe,Wn as Fe,Xn as Ie,Yn as Le,Zn as Re,en as ze,lt as Be,mn as Ve,na as He,po as Ue,ut as We,wn as Ge,xn as Ke,zo as qe}from"./dist-7elyeD1s.js";import{n as Z}from"./dist-CJhtNlOm2.js";import{a as Je}from"./use-settings-route-DHPJ3RaJ.js";import{t as Ye}from"./dist-Cr4-nBVI.js";import{d as Xe,h as Ze,m as Qe,n as $e,p as et,r as tt,u as nt}from"./documents-events--JsHluy4.js";import{i as rt}from"./use-apply-config-theme-CBmHKD_B.js";import{t as it}from"./parse-api-error-Dd8VI2eu.js";import{n as at,t as ot}from"./workspace-paths-CAsMig07.js";import{n as st}from"./use-workspace-BiK7U2Dp.js";import{t as ct}from"./createLucideIcon-BulbvLvN.js";import{t as lt}from"./arrow-up-right-BTi7mHwL.js";import{t as ut}from"./chevron-down-DNO3PgI_.js";import{n as dt,r as ft}from"./ManagedArtifactProperties-B8EqUoZ3.js";import{t as pt}from"./folder-open-BWpLO6wT.js";import{t as mt}from"./use-open-skill-C2S8Ju9E.js";import{t as ht}from"./list-plus-nPRgk4Qi.js";import{t as gt}from"./trash-2-DSqYvaPJ.js";import{m as _t,p as vt}from"./page-list-cache-prUKRtRa.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-DHpABbiE.js";import{a as At,l as jt,o as Mt,p as Nt}from"./skill-scope-CVSSymVB.js";import{t as Pt}from"./input-DJ1c1x-M.js";import{t as Ft}from"./badge-BWfmbBoh.js";import{t as It}from"./use-skills-D56xe4F0.js";import{t as Lt}from"./DiffView-DS16M3wC.js";import{n as Rt}from"./platform-labels-DWuGftrI.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=it(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:Ye._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Ye._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Ye._({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:Ke({mode:`cowork`},e)},n);case`claude-code`:return rn({target:`claude-code`,url:Ke({mode:`code`},e)},n);case`codex`:return rn({target:`codex`,url:Te(e)},n);case`cursor`:return rn({target:`cursor`,url:Ge(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=ot(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:at(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??ot(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:at(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?Ye._({id:`bi2C2s`,values:{displayName:e}}):t===2?Ye._({id:`1J0c0X`,values:{displayName:e}}):Ye._({id:`Xs7IcT`,values:{displayName:e}})}function yn(e){return e>=3?null:e===2?Ye._({id:`Xp94R1`}):Ye._({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?Ve(xn(e.compose,t,n,r)):e.selection?ke({...e.selection,target:t,transport:r}):e.skill?Le(e.skill.name,e.skill.scope,n):e.ask?Pe(e.ask.relativePath,e.ask.instruction,n,t,r):He(e.docContext===null?e.folderRelativePath?Ae(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?Ne(n,e.instruction,r):De(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?`${Be} ${Sn(e,we[t].handoffTarget,!1,`terminal`)}`:Ie(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?`${We} ${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(Ye._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Ye._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Ye._({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 ye.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}=rt(),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=ct(`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=ct(`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=ct(`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?Ye._({id:`wTcjov`}):null}function Bn(e){let t=(0,zt.c)(48),{_:n}=u(),i=r(),o=A(),s=_e(),c=ve();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]!==o){let e=zn(g),r;t[20]!==f||t[21]!==c?(r=e=>be(c,e.id,f[e.id]?.installed),t[20]=f,t[21]=c,t[22]=r):r=t[22];let i=Se.filter(r),u;t[23]===c?u=t[24]:(u=e=>ge(c,e.source,e.id,!0,e.supported),t[23]=c,t[24]=u);let p=s.filter(u),O=o?ze.filter(e=>xe(c,e,o.installedClis)):[];y=i.length>0,b=o!==null&&O.length>0,x=p.length>0,v=ae,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(de,{children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[25]=D):D=t[25],_=oe,S=`max-h-80`,C=x?(0,Q.jsxs)(se,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(ue,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(re,{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)(Ce,{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)(me,{}):null,t[26]=y,t[27]=b,t[28]=x,t[29]=w):w=t[29],T=b?(0,Q.jsxs)(se,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(ue,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=we[t];return(0,Q.jsxs)(re,{onSelect:()=>{d!==null&&(h?.(),o.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)(ee,{id:Y(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)(me,{}):null,(0,Q.jsxs)(se,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(lt,{"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)(re,{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)(ee,{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]=o,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)(me,{}):null,t[30]=y,t[31]=b,t[32]=x,t[33]=O):O=t[33];let k;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(p,{"aria-hidden":`true`}),t[34]=k):k=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(re,{onSelect:Je,"data-testid":`file-tree-open-in-settings`,children:[k,(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?Ye._({id:`wTcjov`}):null}function Hn(e){let t=(0,zt.c)(47),{_:n}=u(),i=r(),o=A(),s=_e(),c=ve();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]!==o){let e=Vn(h),r;t[19]!==f||t[20]!==c?(r=e=>be(c,e.id,f[e.id]?.installed),t[19]=f,t[20]=c,t[21]=r):r=t[21];let i=Se.filter(r),u;t[22]===c?u=t[23]:(u=e=>ge(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=u);let p=s.filter(u),D=o?ze.filter(e=>xe(c,e,o.installedClis)):[];v=i.length>0,y=o!==null&&D.length>0,b=p.length>0,_=G,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(X,{children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[24]=E):E=t[24],g=K,x=`max-h-80`,S=b?(0,Q.jsxs)(te,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(J,{children:(0,Q.jsx)(l,{id:`RXEbZy`})}),p.map(t=>{let r=t.name;return(0,Q.jsxs)(W,{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)(Ce,{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)(ne,{}):null,t[25]=v,t[26]=y,t[27]=b,t[28]=C):C=t[28],w=y?(0,Q.jsxs)(te,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(J,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=we[t];return(0,Q.jsxs)(W,{onSelect:()=>{d!==null&&o.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)(ee,{id:Y(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)(ne,{}):null,(0,Q.jsxs)(te,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(J,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`BwKH4d`}),(0,Q.jsx)(lt,{"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)(W,{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)(ee,{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]=o,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)(ne,{}):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 k;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(W,{onSelect:Je,"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]=k):k=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,k]}),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=qe(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=Oe(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=Me(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)=>et(e,t)||Qe(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}=o(),r=dt(),i;e[0]===t?i=e[1]:(i=t.some(Zn),e[0]=t,e[1]=i);let a=i,s;e[2]===a?s=e[3]:(s={enabled:a},e[2]=a,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${Ze()}`;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,{_:a}=u(),{closeTabs:s,openTabs:c}=o(),[l,d]=(0,$.useState)(!1),f;t[0]!==a||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(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),s(Gn(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,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 g;t[9]!==a||t[10]!==l||t[11]!==p||t[12]!==n?(g=n?(0,Q.jsx)(_,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=a,t[10]=l,t[11]=p,t[12]=n,t[13]=g):g=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==g?(v=(0,Q.jsx)(U,{open:m,onOpenChange:h,children:g}),t[14]=m,t[15]=h,t[16]=g,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 Ye._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?Ye._({id:`Zt7Ktx`}):t.some(e=>e===``)?Ye._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?Ye._({id:`yJkw6t`}):$n(e)?null:Ye._({id:`oP-FQW`})}function tr(e){let t=(0,zt.c)(70),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:a}=o(),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]!==a||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);a({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=y,t[16]=T,t[17]=r,t[18]=a,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)(he,{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:a,openTabs:s}=o(),[c,l]=(0,$.useState)(!1),d;t[0]!==i||t[1]!==a||t[2]!==r||t[3]!==s?(d=async function(e){let{skill:t,filePath:n}=e;l(!0);let o=await Et({scope:t.scope,name:t.name,path:n});if(l(!1),!o.ok){Z.error(i({id:`CBT70t`,values:{0:o.error}}));return}if(!o.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),a(Kn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=a,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)(_,{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 g;return t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Q.jsx)(U,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}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)(he,{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)(he,{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)(he,{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}=o(),a=It(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==a?(s=async(e,o)=>{if(o===e.scope)return!1;tt(e.scope,e.name),$e(e.scope,e.name);let s=await Ct({name:e.name,fromScope:e.scope,toScope:o});if(nt(e.scope,e.name),!s.ok)return Xe(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[o]}}));let c=a.status===`ready`?a.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`?Ee(e.scope,e.name):null,f=o===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:Ee(o,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return Xe(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,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),tt(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(Xe(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),tt(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}}Xe(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),tt(e.scope,e.name);let n=await t();return Xe(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)tt(e.scope,t);y(n[0]??null);let r=await kt({scope:e.scope,names:n});for(let t of n)Xe(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 Ue[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)(D,{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:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,{_: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}`,g;t[5]===c?g=t[6]:(g=async function(e){try{await h(e),Z.success(c({id:`SXCSQd`}))}catch{Z.error(c({id:`cRHuuI`}))}},t[5]=c,t[6]=g);let _=g,v;t[7]!==i||t[8]!==r||t[9]!==n?(v=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=v):v=t[10];let y,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(Fn,{"aria-hidden":!0}),S=(0,Q.jsx)(l,{id:`2wxgft`}),t[11]=y,t[12]=S):(y=t[11],S=t[12]);let w;t[13]!==o||t[14]!==v?(w=(0,Q.jsxs)(D,{menuKind:o,onSelect:v,children:[y,S]}),t[13]=o,t[14]=v,t[15]=w):w=t[15];let E;t[16]!==f||t[17]!==o?(E=(0,Q.jsx)(gr,{absolutePath:f,menuKind:o}),t[16]=f,t[17]=o,t[18]=E):E=t[18];let O,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(s,{"aria-hidden":!0}),A=(0,Q.jsx)(l,{id:`zd00pH`}),t[19]=O,t[20]=A):(O=t[19],A=t[20]);let j;t[21]===o?j=t[22]:(j=(0,Q.jsxs)(x,{menuKind:o,children:[O,A]}),t[21]=o,t[22]=j);let M;t[23]!==f||t[24]!==_||t[25]!==o?(M=f?(0,Q.jsx)(D,{menuKind:o,onSelect:()=>void _(f),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[23]=f,t[24]=_,t[25]=o,t[26]=M):M=t[26];let N;t[27]!==_||t[28]!==m?(N=()=>void _(m),t[27]=_,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]!==o||t[32]!==N?(F=(0,Q.jsx)(D,{menuKind:o,onSelect:N,children:P}),t[31]=o,t[32]=N,t[33]=F):F=t[33];let I;t[34]!==o||t[35]!==M||t[36]!==F?(I=(0,Q.jsxs)(T,{menuKind:o,children:[M,F]}),t[34]=o,t[35]=M,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==o||t[39]!==I?(L=(0,Q.jsx)(b,{menuKind:o,children:I}),t[38]=o,t[39]=I,t[40]=L):L=t[40];let R;t[41]!==o||t[42]!==j||t[43]!==L?(R=(0,Q.jsxs)(k,{menuKind:o,children:[j,L]}),t[41]=o,t[42]=j,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==o||t[46]!==R||t[47]!==w||t[48]!==E?(z=(0,Q.jsxs)(T,{menuKind:o,children:[w,E,R]}),t[45]=o,t[46]=R,t[47]=w,t[48]=E,t[49]=z):z=t[49];let B;t[50]===o?B=t[51]:(B=(0,Q.jsx)(C,{menuKind:o}),t[50]=o,t[51]=B);let V;t[52]!==i||t[53]!==r||t[54]!==n?(V=()=>i.requestFileDelete(n,r),t[52]=i,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]!==o||t[59]!==V?(W=(0,Q.jsxs)(D,{menuKind:o,variant:`destructive`,onSelect:V,children:[H,U]}),t[58]=o,t[59]=V,t[60]=W):W=t[60];let G;t[61]!==o||t[62]!==W?(G=(0,Q.jsx)(T,{menuKind:o,children:W}),t[61]=o,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:i}=e,{_:a}=u(),o=E(n,r),c=n.absolutePath,d;t[0]===a?d=t[1]:(d=async function(e){try{await h(e),Z.success(a({id:`SXCSQd`}))}catch{Z.error(a({id:`cRHuuI`}))}},t[0]=a,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)(x,{menuKind:`dropdown`,children:[(0,Q.jsx)(s,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[4]=m):m=t[4];let g;t[5]!==c||t[6]!==f?(g=c?(0,Q.jsx)(D,{menuKind:`dropdown`,onSelect:()=>void f(c),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[5]=c,t[6]=f,t[7]=g):g=t[7];let _;t[8]!==f||t[9]!==n.path?(_=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=_):_=t[10];let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(l,{id:`xloBjn`}),t[11]=v):v=t[11];let y;t[12]===_?y=t[13]:(y=(0,Q.jsx)(D,{menuKind:`dropdown`,onSelect:_,children:v}),t[12]=_,t[13]=y);let S;t[14]!==g||t[15]!==y?(S=(0,Q.jsxs)(k,{menuKind:`dropdown`,children:[m,(0,Q.jsx)(b,{menuKind:`dropdown`,children:(0,Q.jsxs)(T,{menuKind:`dropdown`,children:[g,y]})})]}),t[14]=g,t[15]=y,t[16]=S):S=t[16];let A;t[17]!==p||t[18]!==S?(A=(0,Q.jsxs)(T,{menuKind:`dropdown`,children:[p,S]}),t[17]=p,t[18]=S,t[19]=A):A=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(C,{menuKind:`dropdown`}),t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(x,{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]!==o||t[26]!==n||t[27]!==N?(P=(0,Q.jsx)(T,{menuKind:`dropdown`,children:(0,Q.jsxs)(k,{menuKind:`dropdown`,children:[M,(0,Q.jsx)(b,{menuKind:`dropdown`,className:O,children:(0,Q.jsx)(T,{menuKind:`dropdown`,children:(0,Q.jsx)(w,{toggles:o,skill:n,menuKind:`dropdown`,onResolveFork:N})})})]})}),t[25]=o,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)(C,{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)(T,{menuKind:`dropdown`,children:(0,Q.jsxs)(D,{menuKind:`dropdown`,variant:`destructive`,onSelect:I,children:[L,R]})}),t[35]=I,t[36]=z);let B;return t[37]!==i||t[38]!==P||t[39]!==z||t[40]!==A?(B=(0,Q.jsxs)(Q.Fragment,{children:[A,j,P,i,F,z]}),t[37]=i,t[38]=P,t[39]=z,t[40]=A,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=st(),c=v().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=E(c,n),m=c.absolutePath,_=c.hostQualifier!==void 0,v;t[0]===d?v=t[1]:(v=async function(e){try{await h(e),Z.success(d({id:`SXCSQd`}))}catch{Z.error(d({id:`cRHuuI`}))}},t[0]=d,t[1]=v);let S=v,A;t[2]!==m||t[3]!==a?(A=(0,Q.jsx)(gr,{absolutePath:m,menuKind:a}),t[2]=m,t[3]=a,t[4]=A):A=t[4];let j,M;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(s,{"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)(x,{menuKind:a,children:[j,M]}),t[7]=a,t[8]=N);let P;t[9]!==m||t[10]!==S||t[11]!==a?(P=m?(0,Q.jsx)(D,{menuKind:a,onSelect:()=>void S(m),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[9]=m,t[10]=S,t[11]=a,t[12]=P):P=t[12];let F;t[13]!==S||t[14]!==c.path?(F=()=>void S(c.path),t[13]=S,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)(D,{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)(T,{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)(b,{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)(k,{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]!==A?(V=(0,Q.jsxs)(T,{menuKind:a,children:[A,o,B]}),t[31]=a,t[32]=o,t[33]=B,t[34]=A,t[35]=V):V=t[35];let H;t[36]===a?H=t[37]:(H=(0,Q.jsx)(C,{menuKind:a}),t[36]=a,t[37]=H);let U;t[38]!==n||t[39]!==r||t[40]!==p||t[41]!==a||t[42]!==_||t[43]!==f||t[44]!==c?(U=_?(0,Q.jsx)(T,{menuKind:a,children:(0,Q.jsx)(y,{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)(T,{menuKind:a,children:[(0,Q.jsxs)(D,{menuKind:a,onSelect:()=>void n.duplicate(c,r),children:[(0,Q.jsx)(i,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`euc6Ns`})]}),(0,Q.jsxs)(D,{menuKind:a,onSelect:()=>n.requestRename(c,r),children:[(0,Q.jsx)(Fn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`2wxgft`})]}),(0,Q.jsxs)(D,{menuKind:a,onSelect:()=>n.requestFileCreate(c),children:[(0,Q.jsx)(g,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`HdkSiO`})]}),(0,Q.jsxs)(k,{menuKind:a,children:[(0,Q.jsxs)(x,{menuKind:a,children:[(0,Q.jsx)(Pn,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),(0,Q.jsx)(b,{menuKind:a,className:O,children:(0,Q.jsx)(T,{menuKind:a,children:(0,Q.jsx)(w,{toggles:p,skill:c,menuKind:a,onResolveFork:e=>n.requestForkResolve(c,e)})})})]}),(0,Q.jsxs)(D,{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]=_,t[43]=f,t[44]=c,t[45]=U):U=t[45];let W;t[46]===a?W=t[47]:(W=(0,Q.jsx)(C,{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)(D,{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)(T,{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 _=h,v=p??(_?.length===1?_[0]:void 0),y;t[8]!==v||t[9]!==r||t[10]!==n?(y=v??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=v,t[9]=r,t[10]=n,t[11]=y):y=t[11];let b=y,[x,C]=(0,$.useState)(!1),T=E(b,c),{installed:D,installing:k,hostSet:A}=T,M=v===void 0&&!D,N;t[12]!==v||t[13]!==A?(N=v?At(v,[...A]):[],t[12]=v,t[13]=A,t[14]=N):N=t[14];let P=N,F;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==b?(F=a?(0,Q.jsx)(j,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(b),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=b,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)(S,{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)(le,{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]!==b?(H=e=>c.requestForkResolve(b,e),t[32]=c,t[33]=b,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]!==b||t[37]!==H||t[38]!==T?(W=(0,Q.jsx)(fe,{align:`end`,className:O,children:(0,Q.jsx)(w,{toggles:T,skill:b,onResolveFork:H,onRunStart:U})}),t[36]=b,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)(pe,{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)(ue,{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)(ce,{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)(ce,{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)(ie,{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};
|