@inkeep/open-knowledge 0.72.0-beta.1 → 0.72.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/THIRD_PARTY_NOTICES.md +24 -4
- package/dist/cli.mjs +6 -6
- package/dist/constants-BWwITVsY.mjs +1 -0
- package/dist/index.d.mts +50 -1
- package/dist/index.mjs +1 -1
- package/dist/init-B-wniKG4.mjs +1 -0
- package/dist/{init-D3uWps6V.mjs → init-CWcaDlCV.mjs} +2 -2
- package/dist/{launch-json-removal-Cb5JVjUJ.mjs → launch-json-removal-D0gfkVnw.mjs} +1 -1
- package/dist/loader-ClY3YXAr.mjs +1 -0
- package/dist/{loader-BJkJu_Y4.mjs → loader-hAzEG8eI.mjs} +1 -1
- package/dist/preview-C605fqZX.mjs +1 -0
- package/dist/{preview-CQGCCvOv.mjs → preview-FVftoA1B.mjs} +1 -1
- package/dist/public/assets/{ActivityModeContent-D6Br5xYs.js → ActivityModeContent-CSx6poL6.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-D2QC5a0y.js → AddPropertiesButton-DXjzjICF.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-Bbm1t3vi.js → AgentDiffPane-D3ZqC-5y.js} +1 -1
- package/dist/public/assets/{AgentIconCluster-RWclNpfz.js → AgentIconCluster-mIIoSODi.js} +1 -1
- package/dist/public/assets/{AppMenubar-B76J1mnO.js → AppMenubar-CCjUhkgg.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-CaBn84Ep.js → CodeMirrorPropInput-Bo7jcqv0.js} +1 -1
- package/dist/public/assets/{ConfigSharingInfoTooltip-BT8NSNpC.js → ConfigSharingInfoTooltip-CK9XrP2K.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-CdTmAsAj.js → ConsentDialogBody-CpPyfOOm.js} +1 -1
- package/dist/public/assets/{DocumentContext-avYx9HfE.js → DocumentContext-DW2Sgfp0.js} +2 -2
- package/dist/public/assets/{EditorModeToggle-Bw00uYRx.js → EditorModeToggle-CRx6a4xr.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-AIzGmViP.js → EnableSyncConfirmDialog-BbglKynl.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-B3lMLUyK.js → ExcalidrawDocEditor-Cx-PkkWC.js} +1 -1
- package/dist/public/assets/FeedbackForm-gNbKRMDT.js +1 -0
- package/dist/public/assets/{GraphPanel-BslSE6Rs.js → GraphPanel-BERS2Xxc.js} +1 -1
- package/dist/public/assets/{ImageAttachments-B3v4V_wq.js → ImageAttachments-n3q9E21B.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-_-_27gp-.js → ImportSkillDialog-Buq_cGPy.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-b5hf0c12.js → LintConfigEditor-oCqNvP7d.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-C4m9IvIx.js → ManagedArtifactProperties-CPB8QDOa.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DwP8yFwK.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-B0cKqNAZ.js → McpConsentDialogBody-DBFdcvuZ.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-Bw0spqld.js → MermaidDocEditor-DoSSJiAU.js} +1 -1
- package/dist/public/assets/{OpenInAgentMenuItem-BDg1hjU8.js → OpenInAgentMenuItem-B-A26xF4.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-CqAThkeg.js → PropertyDisplayRow-CqbjHwwA.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-D5gnrY-R.js → ReportBugDialogBody-ByKRBwrn.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-C3h3CSq-.js → ReportBugMenuTrigger-BT4k4UZV.js} +2 -2
- package/dist/public/assets/{RowDisclosure-7_AiotxM.js → RowDisclosure-D03pq8gd.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-D1R3Sh2v.js → SchemaConfigEditor-DLF8mr_B.js} +1 -1
- package/dist/public/assets/{SessionsHost-BZSJ7b41.js → SessionsHost-PvYlMZLt.js} +2 -2
- package/dist/public/assets/SettingsDialogBody-CGABSyyD.js +12 -0
- package/dist/public/assets/{ShareReceiveMissDialog-BLGRUEIB.js → ShareReceiveMissDialog-4JK4Afbo.js} +1 -1
- package/dist/public/assets/{SkillCostValue-n_G2nfYn.js → SkillCostValue-EajgoFy_.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-BuIpRm5q.js → SkillInstallMenu-vK6OSpiK.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-DkPpXgsk.js → SkillOriginInline-Dj_Ri0FX.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-o69NuC2o.js → SkillToolbarControls-C6eBVVk1.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-DRYjoVIj.js → SlidesToolbarControls-DY6ttC2a.js} +1 -1
- package/dist/public/assets/{SourceEditor-j0Oy5-Ub.js → SourceEditor-BRi3EW6e.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Dt20JtHr.js → TerminalPanel-lplfgXxO.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BmX3dvBA.js → TerminalWindowApp-CzStYFjF.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Dg49b5Fz.js → TextDocEditor-BVU_T1nc.js} +1 -1
- package/dist/public/assets/{ThreadView-DHQJWRJ8.js → ThreadView-B3rNh-vX.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-ihWm-KX_.js → TimelineDiffPane-Dz0cEdgE.js} +1 -1
- package/dist/public/assets/{agent-connection-status-DNcSO8Of.js → agent-connection-status-VLm1l6MH.js} +1 -1
- package/dist/public/assets/{auth-state-cache-BFwDxz1x.js → auth-state-cache-wQqrLqzV.js} +4 -4
- package/dist/public/assets/{comment-chips-MmWHfkrw.js → comment-chips-BTwi9aHu.js} +1 -1
- package/dist/public/assets/{config-provider-DDlH5XLd.js → config-provider-CkrfHldq.js} +3 -3
- package/dist/public/assets/{dist-BjJaywqn.js → dist-BX7qfUal.js} +1 -1
- package/dist/public/assets/{dist-DBMXz-r_.js → dist-CsrrNdnj.js} +1 -1
- package/dist/public/assets/dist-DYso7MCm.js +1 -0
- package/dist/public/assets/{dist-wcXwpuqG.js → dist-tLQ-ULW1.js} +1 -1
- package/dist/public/assets/{dist-GoOli512.js → dist-zcYT-cpc.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-CNOE_leW.js → doc-undo-manager-CPWQABEA.js} +1 -1
- package/dist/public/assets/{dropdown-menu--ZF4igWe.js → dropdown-menu-SORDKiaq.js} +1 -1
- package/dist/public/assets/floating-ui.dom-CDtYEnEj.js +1 -0
- package/dist/public/assets/globals-Dphjn3Yt.css +1 -0
- package/dist/public/assets/i18n-Da7WHZe6.js +1 -0
- package/dist/public/assets/index-pdO5v09U.js +2205 -0
- package/dist/public/assets/{markdownlint-rule-browser-C70syIyl.js → markdownlint-rule-browser-BhjLeHcZ.js} +1 -1
- package/dist/public/assets/messages--JnqpgOb.js +1 -0
- package/dist/public/assets/messages--gUdia_5.js +1 -0
- package/dist/public/assets/messages-Bg6waVkx.js +1 -0
- package/dist/public/assets/messages-BjU_8px0.js +1 -0
- package/dist/public/assets/messages-CPorGTui.js +1 -0
- package/dist/public/assets/messages-D2kPydYD.js +1 -0
- package/dist/public/assets/messages-DK2UgHWp.js +1 -0
- package/dist/public/assets/messages-DMbO4A7Z.js +1 -0
- package/dist/public/assets/messages-IESTLOtJ.js +1 -0
- package/dist/public/assets/messages-JiwS-kMF.js +1 -0
- package/dist/public/assets/messages-bHA62mu3.js +1 -0
- package/dist/public/assets/messages-hiCq1tp-.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-JHjfq5my.js → pending-receive-nav-store-D5-DrypM.js} +1 -1
- package/dist/public/assets/{popover-BYD_0UMt.js → popover-CBJqdXoA.js} +1 -1
- package/dist/public/assets/{prod-CjhMsIt8.js → prod-DDPjOXpF.js} +1 -1
- package/dist/public/assets/{progress-DyuMaHpo.js → progress-DeFcA31j.js} +1 -1
- package/dist/public/assets/{project-paths-CTKMJD3w.js → project-paths-BHj1N2_J.js} +1 -1
- package/dist/public/assets/{select-BKzcW_PB.js → select-ByJwKu6h.js} +1 -1
- package/dist/public/assets/{selection-context-b6fqlX7H.js → selection-context-BIa29kJ8.js} +1 -1
- package/dist/public/assets/{src-YPYliXpo.js → src-ByO9uVZB.js} +1 -1
- package/dist/public/assets/{tag-pill-input-NZmlTNmF.js → tag-pill-input-By-KRpAS.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-B4B1SuEp.js → terminal-cli-display-BNnRIpgq.js} +1 -1
- package/dist/public/assets/{tooltip-DttaCTqz.js → tooltip-BnyyQDRs.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B8XZFG6h.js → typing-burst-detector-PnjW2-x3.js} +1 -1
- package/dist/public/assets/{uninstall-BxVvvQ3I.js → uninstall-Cfx0qbqa.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BTpRB5o1.js → use-activity-panel-HmfzKdzs.js} +1 -1
- package/dist/public/assets/{use-open-skill-BRRyog-h.js → use-open-skill-DzszCWzx.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-D53OcVAl.js → use-terminal-enabled-Bre_0Sqg.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-BCOSn9yc.js → use-timeline-entry-diff-BexxkO9d.js} +1 -1
- package/dist/public/index.html +40 -40
- package/dist/public/uninstall.html +5 -5
- package/dist/{registry-probes-CTqRTiQ1.mjs → registry-probes-BK8Gw65W.mjs} +1 -1
- package/dist/{removal-file-path-rM4dCktp.mjs → removal-file-path-BhN_h0Rm.mjs} +1 -1
- package/dist/{repair-launch-json-DLTE7Wqq.mjs → repair-launch-json-QWDfpWfu.mjs} +1 -1
- package/dist/{repair-mcp-configs-DlzATFLc.mjs → repair-mcp-configs-CGM7N62T.mjs} +1 -1
- package/dist/src-2phljj3W.mjs +1 -0
- package/dist/{src-Bym5H5Rv.mjs → src-8U8NRuX2.mjs} +1 -1
- package/dist/{start-Gueh8pCQ.mjs → start-BcH8YieI.mjs} +2 -2
- package/dist/start-CWRlBbxO.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-BHyQgY7K.mjs +0 -1
- package/dist/init-sIZj5NtR.mjs +0 -1
- package/dist/loader-DsveScG9.mjs +0 -1
- package/dist/preview-C3mqQMyf.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CQP7-Thy.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-BTZ9pf__.js +0 -1
- package/dist/public/assets/SettingsDialogBody-DJlVd3Lf.js +0 -12
- package/dist/public/assets/dist-CMrReMig.js +0 -1
- package/dist/public/assets/floating-ui.dom-BcZPrP06.js +0 -1
- package/dist/public/assets/globals-Ch23_3FO.css +0 -1
- package/dist/public/assets/i18n-C4053E1c.js +0 -1
- package/dist/public/assets/index-CMIN3mxx.js +0 -2205
- package/dist/public/assets/messages-3gjCM9Hp.js +0 -1
- package/dist/public/assets/messages-4g9WFtqZ.js +0 -1
- package/dist/public/assets/messages-82g1isaV.js +0 -1
- package/dist/public/assets/messages-A3t6jG7o.js +0 -1
- package/dist/public/assets/messages-BYVte33c.js +0 -1
- package/dist/public/assets/messages-CFy1VdRh.js +0 -1
- package/dist/public/assets/messages-CHMCyj_H.js +0 -1
- package/dist/public/assets/messages-CvZuXVc5.js +0 -1
- package/dist/public/assets/messages-DCzNz6_z.js +0 -1
- package/dist/public/assets/messages-DN76EHsp.js +0 -1
- package/dist/public/assets/messages-QY_0Lilx.js +0 -1
- package/dist/public/assets/messages-tLVODCA0.js +0 -1
- package/dist/src-eF5Y6xOI.mjs +0 -1
- package/dist/start-BPZlYLgl.mjs +0 -1
- /package/dist/public/assets/{globals-CQVYUd1p.js → globals-Cs3w5NCz.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{El as r,Gs as i,Sl as a,_d as o,_u as s,as as c,cd as l,dd as u,fu as d,gu as f,jt as p,ld as m,md as h,ml as g,pd as _,ss as v,vd as y,xu as b}from"./md-manager-BGnqyqi1-hmuoZRep.mjs";import{B as x,Bi as S,Br as C,Ct as ee,Do as te,F as ne,I as re,No as ie,Pn as ae,Qa as oe,Ui as se,Vn as ce,Yt as le,_o as ue,go as de,ho as fe,kr as pe,m as me,mo as w,ro as he,rt as ge,ta as _e,to as ve,tt as ye,vo as be,vr as xe,wr as Se,xo as T,zi as Ce}from"./dist-C7Oi9AkI.mjs";import{i as E,n as D,o as O,r as we,s as k,t as A}from"./colors-r_owlCuY.mjs";import{t as j}from"./is-object-BGze3w87.mjs";import{t as Te}from"./constants-
|
|
1
|
+
import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{El as r,Gs as i,Sl as a,_d as o,_u as s,as as c,cd as l,dd as u,fu as d,gu as f,jt as p,ld as m,md as h,ml as g,pd as _,ss as v,vd as y,xu as b}from"./md-manager-BGnqyqi1-hmuoZRep.mjs";import{B as x,Bi as S,Br as C,Ct as ee,Do as te,F as ne,I as re,No as ie,Pn as ae,Qa as oe,Ui as se,Vn as ce,Yt as le,_o as ue,go as de,ho as fe,kr as pe,m as me,mo as w,ro as he,rt as ge,ta as _e,to as ve,tt as ye,vo as be,vr as xe,wr as Se,xo as T,zi as Ce}from"./dist-C7Oi9AkI.mjs";import{i as E,n as D,o as O,r as we,s as k,t as A}from"./colors-r_owlCuY.mjs";import{t as j}from"./is-object-BGze3w87.mjs";import{t as Te}from"./constants-BWwITVsY.mjs";import{t as Ee}from"./preview-FVftoA1B.mjs";import{createRequire as De}from"node:module";import{execFileSync as Oe}from"node:child_process";import ke,{basename as Ae,dirname as M,isAbsolute as je,join as N,posix as Me,relative as P,resolve as F,sep as I,win32 as Ne}from"node:path";import L from"node:process";import{fileURLToPath as Pe}from"node:url";import{cpSync as Fe,existsSync as R,lstatSync as Ie,mkdirSync as Le,readFileSync as z,readdirSync as Re,readlinkSync as ze,realpathSync as Be,rmSync as Ve,statSync as He,writeFileSync as Ue}from"node:fs";import{homedir as B}from"node:os";import*as We from"node:readline";import{inspect as Ge,stripVTControlCharacters as Ke,styleText as V}from"node:util";import{AsyncLocalStorage as qe,AsyncResource as Je}from"node:async_hooks";var Ye=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Xe=n((e=>{let{InvalidArgumentError:t}=Ye();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Ze=n((e=>{let{humanReadableArgName:t}=Xe();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
2
2
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
3
3
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
4
4
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),Qe=n((e=>{let{InvalidArgumentError:t}=Ye();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -689,5 +689,5 @@ export default function okBridge(pi: {
|
|
|
689
689
|
`));let g=`${s?``:``}${m}`;return g!==o&&T(e,g,{mode:ba(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const mo=e=>e!==`project`,ho=e=>e!==`user`;async function go(){let e=await ka({message:`Where should the MCP server be configured?
|
|
690
690
|
`,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 _o(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??go)():`both`}async function vo(e){return Pa({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 yo(e){if(e.sharing!==void 0)return e.sharing;let t=Wi(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??vo)(t):t}var bo=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function xo(e){if(e===void 0||e===!0)return new Set(ye);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(ee.filter(e=>t.includes(e)))}function So(e,t,n){let r=F(n,e),i;try{i=He(r)}catch(e){let t=e.code;throw t===`ENOENT`?new bo(`--content-dir path does not exist: ${r}`):new bo(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new bo(`--content-dir must be a directory: ${r}`);let a=Co(t),o=Co(r),s=P(a,o);if(s.startsWith(`..`)||je(s))throw new bo(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function Co(e){try{return Be(e)}catch{return e}}const wo=`open-knowledge-ui`;function To(e,t,n){try{let r=e.detectPath?.(t,n)??M(e.configPath(t,n));return R(r)}catch{return!1}}function Eo(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+I)}catch{return!1}}function Do(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.pruneOnly===!0;if(s&&(e.format===`file`||!R(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Eo(e,t,r);if(!i&&c&&!To(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{ra(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 ko(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=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{s||Le(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 u={action:`written`},d;try{te(`${o}.lock`,()=>{let t=qa(o).writePath;if(s||Le(M(t),{recursive:!0}),e.format===`toml`){let r=lo(Br(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=po(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=co(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Oo={pi:za};function ko(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=Oo[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{Le(M(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{te(`${t}.lock`,()=>{let e=null;try{e=z(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}T(t,c,e===null?void 0:{mode:ba(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 Ao(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!R(n)))return{editorId:e.id,label:e.label,path:n}}async function jo(e){let t=Li(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>Do(t,``,n,e.home))}function Mo(e,t,n,r){let i=Po(e,t,n,r);return i.kind===`present`?i.entry:null}function No(e,t,n,r){let i=so(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 Po(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!R(i))return{kind:`absent`};try{if(He(i).size>to)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:ga(e)}}let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`decline`,reason:ga(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Ra(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Br().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return No(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,kr.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:No(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=Xa(a);return s?Za(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:No(fe(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Fo(e={}){let t=F(e.cwd??process.cwd()),n=Ha(t,{homeDir:e.home}),i=n.projectRoot;if(pe(i,e.home??B()))throw new x(i);let a=!R(N(i,`.ok`)),o=n.gitRootPromoted?P(i,t):void 0,s=e.contentDir===void 0?n.defaultContentDir:So(e.contentDir,i,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${i}`):n.gitRootPromoted&&a&&s===`.`&&process.stderr.write(`${k(`[ok] Content scope promoted to the git repo root: ${i}`)}\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 ce(i),u;try{u=xe(i,{contentDir:s})}catch(t){let r=$.claude.configPath(i,e.home);return{projectRoot:i,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:r,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(Te),f=!1;if(l.didInit)try{f=he(i)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${i}: ${e instanceof Error?e.message:String(e)}`)}try{Ce(i)===`removed`&&console.warn(`[ok] Removed the OpenKnowledge project-skill lines from .gitignore. The skill is ordinary project content now — commit it if your team wants it on clone.`)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore cleanup at ${i}: ${e instanceof Error?e.message:String(e)}`)}let p=await _o({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),m=e.editors??Vo(i,e.home),h=e.editors??m,g=Li(m),_=Li(h),v=e.mcp===!1||p===null,y=Array.from(new Map([...g,...v?[]:_].map(e=>[e.id,e])).values()),b=g.filter(t=>To(t,i,e.home)),C=[],te=[],ne=new Set;for(let t of y){if(v){let n=``;try{n=t.configPath(i,e.home)}catch{}C.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(i)});continue}if(mo(p)&&g.includes(t)&&t.scope===`global`&&C.push(Do(t,i,c,e.home)),ho(p)&&_.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(i),r=Do(t,i,c,e.home,n);C.push(r),(r.action===`written`||r.action===`overwritten`)&&ne.add(n)}}let re=new Set;for(let t of _){let n=t.projectSkillPath?.(i);!n||re.has(n)||(re.add(n),te.push(ma(t,i,{home:e.home})))}let ie=pa(i,_.map(e=>e.id));ie&&te.push(ie);let oe=te.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(oe.length>0){let t=e.home??B();S({source:r,skills:[me.project],agents:oe,scope:i},{home:t,enabled:_e(t).enabled})}let se=!v&&p!==null&&ho(p)?_.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,le=v?[]:b.map(e=>Ao(e,i)).filter(e=>e!==void 0).filter(e=>!ne.has(e.path)),ue=e.installUserSkill??Se,de=e.home??B(),fe=xo(e.skills),w=!1,ge=!1,ye=!1,be=!1,T=!1;for(let t of ee){if(!fe.has(t))continue;await ve(de,me[t],!0).catch(()=>{}),w=!0;let n=await ue({home:e.home,bundleId:t,force:!0});n===`installed`?ge=!0:n===`failed`?ye=!0:n===`no-hosts`?T=!0:be=!0}let E=ye?`failed`:ge?`installed`:w&&be?`skip-current`:w&&T?`no-hosts`:`declined`,D=ge?ae(de).map(e=>e.editorId):[],O=v?`skipped-flag`:`skipped-missing`,we=C.find(e=>e.editorId===`claude`)??C[0]??{action:O,configPath:$.claude.configPath(i,e.home)},A=await Io({projectRoot:i,desiredMode:await yo({sharing:e.sharing,projectRoot:i,isTTY:e.isTTY,freshProject:a,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:i,contentCreated:u.created,contentUpdated:u.updated,contentSkipped:u.skipped,editors:C,projectSkills:te,legacyProjectConfigs:le,skillInstall:E,skillHosts:D,didGitInit:l.didInit,rootGitignoreCreated:f,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDir:d?s:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:we.action,mcpPath:we.configPath,mcpError:`error`in we?we.error:void 0,projectScopeUnsupportedLabels:se,sharing:A}}async function Io(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Wi(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=Bi(t);if(n===`local-only`){let e=Hi(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`}:Lo(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Ui(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Lo(t,o,`remove`)}function Lo(e,t,n){let r=Wi(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 Ro(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions`;case`unresolved-symlink`:return`could not resolve the path or symlink; check permissions and symlink cycles`;case`not-a-file`:return`config path is not a regular file`;case`disappeared`:return`config disappeared while being read; retry to check its current state`;case`unreadable`:return`could not read the config file; check that the path is accessible`;case`unparseable`:return`config could not be parsed`;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`;case void 0:return`config not readable`;default:throw Error(`unhandled MCP decline reason: ${e}`)}}function zo(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} ${we(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Ro(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} ${we(`FAILED`)}: ${r.error}`)}}}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=>X[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`)}`)}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(Ee(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...Wo(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(`
|
|
691
691
|
`)}function Bo(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 Vo(e,t){let n=[];for(let r of Hr)r!==`claude-desktop`&&To($[r],e,t)&&n.push(r);return n}function Ho(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Ge(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 Uo(){return new ct(`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 ut(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new ut(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new ut(`--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?Ho():null;try{let r;try{r=await Fo({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof bo||e instanceof x){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof ne||e instanceof re){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof ge){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.
|
|
692
|
-
`),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-
|
|
692
|
+
`),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-ClY3YXAr.mjs`),{resolveContentDir:s}=await import(`./dist-s4KdL8xn.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-C605fqZX.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(Bo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${zo(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Wo(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(`
|
|
693
693
|
`))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{gi as $,xa as A,Xi as B,Ha as C,ka as D,Pa as E,ia as F,Wi as G,Vi as H,ha as I,X as J,Ui as K,sa as L,ga as M,oa as N,ba as O,ra as P,_i as Q,ma as R,qa as S,La as T,Bi as U,Gi as V,Ki as W,Ur as X,$ as Y,Z,Fo as _,bt as _t,Bo as a,Q as at,jo as b,ut as bt,zo as c,oi as ct,To as d,Qn as dt,vi as et,Mo as f,Vn as ft,yo as g,U as gt,So as h,Kt as ht,Io as i,bi as it,_a as j,ya as k,Wo as l,Vr as lt,_o as m,qt as mt,wo as n,$r as nt,Po as o,xi as ot,xo as p,Xt as pt,Hr as q,Oo as r,ni as rt,Vo as s,Mi as st,bo as t,yi as tt,Uo as u,Br as ut,ao as v,ct as vt,za as w,Eo as x,Do as y,ot as yt,Hi as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ho as e,vo as t,xo as n}from"./dist-C7Oi9AkI.mjs";import{A as r,M as i,O as a}from"./init-
|
|
1
|
+
import{ho as e,vo as t,xo as n}from"./dist-C7Oi9AkI.mjs";import{A as r,M as i,O as a}from"./init-CWcaDlCV.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-BhN_h0Rm.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:i(e)}}let g=[],_=t(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=e(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=r(h,[`configurations`,y]);return x?(n(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(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`?m.some(e=>h(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 m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-hAzEG8eI.mjs";export{e as loadConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Gc as e,Ic as t,Rc as n,Xo as r,fu as i,nl as a,qa as o}from"./md-manager-BGnqyqi1-hmuoZRep.mjs";import{Co as s,To as c,b as l}from"./dist-C7Oi9AkI.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-
|
|
1
|
+
import{Gc as e,Ic as t,Rc as n,Xo as r,fu as i,nl as a,qa as o}from"./md-manager-BGnqyqi1-hmuoZRep.mjs";import{Co as s,To as c,b as l}from"./dist-C7Oi9AkI.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-BWwITVsY.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 u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(t,n){return t.map(t=>{let r=t.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:t.message,issueCode:t.code};if(n.doc!==null&&n.source!==null){let t=e({file:n.path,source:n.source,doc:n.doc,path:r});if(t!==void 0)return{...i,source:t}}return i})}function b(e){let i=e??process.cwd(),u=[],p=[],m=[],h=[],g=c(`user`,i),_=s({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(e,n=!1)=>{let r=v(e);if(r.diagnostic!==void 0&&p.push(r.diagnostic),r.value===null)return{};let i=t({value:r.value,file:r.path,source:r.source,doc:r.doc});p.push(...i),u.push(e);let s=i.length>0?a(r.value):r.value;return n&&h.push(...o({value:s,file:r.path,source:r.source,doc:r.doc})),s},x=f(i,`.ok`,d),S=b(x,!0),C=b(c(`project-local`,i)),w=r(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(n(t))}return{config:T.data,sources:u,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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-FVftoA1B.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{gn as e}from"./dist-C7Oi9AkI.mjs";import"./constants-
|
|
1
|
+
import{gn as e}from"./dist-C7Oi9AkI.mjs";import"./constants-BWwITVsY.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}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(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};
|
package/dist/public/assets/{ActivityModeContent-D6Br5xYs.js → ActivityModeContent-CSx6poL6.js}
RENAMED
|
@@ -1 +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-avYx9HfE.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-DgIQr9zS.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{m as b}from"./Mermaid-C8EPNkJP.js";import{n as x}from"./upload-DGQJhdiQ.js";import{i as S}from"./prop-types-BZCimyh-.js";import{t as C}from"./spinner-Bp2_BYkl.js";import{t as w}from"./undo-2-BQ-ulCEU.js";import{l as T}from"./doc-hash-BEmc5wpM.js";import{s as E}from"./navigation-targets-Fxss68va.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-DkuxiJNK.js";import{t as j}from"./timeline-diff-store-B803XeuZ.js";import{n as M}from"./use-activity-panel-BTpRB5o1.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};
|
|
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-DW2Sgfp0.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-BnyyQDRs.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-DgIQr9zS.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{m as b}from"./Mermaid-C8EPNkJP.js";import{n as x}from"./upload-DGQJhdiQ.js";import{i as S}from"./prop-types-BZCimyh-.js";import{t as C}from"./spinner-Bp2_BYkl.js";import{t as w}from"./undo-2-BQ-ulCEU.js";import{l as T}from"./doc-hash-BEmc5wpM.js";import{s as E}from"./navigation-targets-Fxss68va.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-DkuxiJNK.js";import{t as j}from"./timeline-diff-store-B803XeuZ.js";import{n as M}from"./use-activity-panel-HmfzKdzs.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-D2QC5a0y.js → AddPropertiesButton-DXjzjICF.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillForkDialog-B8iWPj-U.js","./chunk-CYidjpOJ.js","./dist-CyWcc58M.js","./preload-helper-Chd9yIcd.js","./trace-api-BP9dN1Hz.js","./lib-vOz_s3tj.js","./html-void-elements-zEl0KGqf.js","./lib-DmueaA5E.js","./markdownit-CugClK-K.js","./w3c-keyname-C7Rznu6R.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./pierre-theme-BfC-orGO.js","./engine-compile-yJ0DRa47.js","./ok-syntax-theme-Cl5CicS3.js","./MultiFileDiff-DwVUO4Du.js","./dialog-DgIQr9zS.js","./dist-BcvirUWL.js","./dist-BHv-mziD.js","./react-dom-DPxgxlDT.js","./dist-DRO03ovd.js","./es2015-B9_uRFGw.js","./button-Cym3gapE.js","./bundle-mjs-SHeFpKGC.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./x-DIayTyoR.js","./createLucideIcon-B6ULg5PN.js","./label-D-K3fWtj.js","./dist-CJhtNlOm2.js","./input-f41fkc3m.js","./skill-scope-N9lA7J2A.js","./skills-api-t8N6VdpP.js","./dist-Cr4-nBVI.js","./documents-events-D_K3dHNa.js","./parse-api-error-BtEdpaFC.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Dr as r,Or as i,i as a,it as o,rn as s}from"./DocumentContext-avYx9HfE.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{t as f}from"./utils-CPqDy6Hr.js";import{n as p}from"./AgentIconCluster-RWclNpfz.js";import{t as m}from"./button-Cym3gapE.js";import{i as h,n as g,t as _}from"./tooltip-DttaCTqz.js";import{a as v,c as y,i as b,o as x,r as S,s as C,t as w}from"./dialog-DgIQr9zS.js";import{t as T}from"./alert-dialog-CrZSZ5Zj.js";import{t as E}from"./label-D-K3fWtj.js";import{a as D,f as O,i as k,o as A,t as j,y as M}from"./RegisteredAgentIcon-D2Kzp4_r.js";import{Cn as N,En as P,Gn as F,Gs as I,Hn as L,Hs as R,It as z,Nc as B,Qn as V,Un as H,Wn as U,Ws as ee,Xn as te,Xs as W,Yn as G,Zn as ne,dc as K,hn as q,ht as re,la as J,lc as Y,mt as ie,oc as ae,qn as oe,uc as se,wn as ce}from"./dist-CyWcc58M.js";import{n as X}from"./dist-CJhtNlOm2.js";import{a as le}from"./use-settings-route-D7psIUas.js";import{t as ue}from"./dist-Cr4-nBVI.js";import{d as de,h as fe,m as pe,n as me,p as he,r as ge,u as _e}from"./documents-events-D_K3dHNa.js";import{a as ve,r as ye}from"./local-menu-action-bus-4I1Xm40D.js";import{i as be}from"./use-apply-config-theme-DpLdjUDN.js";import{t as xe}from"./parse-api-error-BtEdpaFC.js";import{n as Se,t as Ce}from"./OpenInAgentMenuItem-BDg1hjU8.js";import{n as we,t as Te}from"./workspace-paths-Dczkx4vn.js";import{n as Ee}from"./use-workspace-BY7Os3yY.js";import{t as De}from"./createLucideIcon-B6ULg5PN.js";import{t as Oe}from"./arrow-up-right-B3B9a7te.js";import{t as ke}from"./chevron-down-Dloks0wp.js";import{a as Ae,c as je,d as Me,f as Ne,i as Pe,l as Fe,m as Ie,o as Le,p as Re,r as ze,t as Be,u as Ve}from"./dropdown-menu--ZF4igWe.js";import{_ as He,c as Ue,d as We,f as Ge,g as Ke,l as qe,m as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et,y as tt}from"./SkillInstallMenu-BuIpRm5q.js";import{n as nt,r as rt}from"./ManagedArtifactProperties-C4m9IvIx.js";import{t as it}from"./folder-open-dlosmFj2.js";import{t as at}from"./list-plus-BmoxCvSM.js";import{t as ot}from"./sparkles-CKoBZZKl.js";import{t as st}from"./trash-2-B9Flu-41.js";import{l as ct,u as lt}from"./navigation-targets-Fxss68va.js";import{a as ut,o as dt,p as ft}from"./skill-scope-N9lA7J2A.js";import{L as pt,N as mt,T as ht,a as gt,b as _t,h as vt,n as yt,r as bt,t as xt,w as St}from"./skills-api-t8N6VdpP.js";import{t as Ct}from"./input-f41fkc3m.js";import{t as wt}from"./badge-Dk9RrOMI.js";import{t as Tt}from"./use-skills-Drb1FGEU.js";import{t as Et}from"./use-open-skill-BRRyog-h.js";import{c as Dt,d as Ot,f as kt,l as At,n as jt,o as Mt,s as Nt,u as Pt}from"./terminal-cli-display-B4B1SuEp.js";import{n as Ft}from"./clipboard-adapter-Tb7FST8m.js";import{n as It}from"./platform-labels-fd-fQwYV.js";var Z=n(),Q=e(c(),1),$=d();function Lt(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 Rt(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=xe(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:ue._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:ue._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??ue._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function zt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Lt(e):Rt()}var Bt=`ok:skill:cowork:installed`,Vt=`1`,Ht=250,Ut=`/api/skill/install-state`;function Wt(e){return`${Bt}:v${e}`}var Gt=new Map;async function Kt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Gt.get(n);if(r)return r;let i=qt(e,t);return Gt.set(n,i),i.finally(()=>{Gt.get(n)===i&&Gt.delete(n)}),i}async function qt(e,t){let n=e.installer===void 0?zt():e.installer,r=Jt(e.storage),i=e.fetchSnapshot??Xt,a=e.serverTimeoutMs??Ht,o=null;if(!t.force){try{o=await Zt(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=Wt(o?.currentVersion??e.fallbackSkillVersion??Yt());if(!t.force&&r?.getItem(s)===Vt)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,Vt)}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 Jt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Yt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Xt(){let e;try{e=await fetch(Ut,{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 Zt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Qt(e){return Kt({},e)}function $t(){return Kt({},{force:!0})}async function en(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 tn(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return en({target:`claude-cowork`,url:N({mode:`cowork`},e)},n);case`claude-code`:return en({target:`claude-code`,url:N({mode:`code`},e)},n);case`codex`:return en({target:`codex`,url:ce(e)},n);case`cursor`:return en({target:`cursor`,url:P(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 nn(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 rn=`open-knowledge:agent-thread-launch`;function an(e){let{agentSource:t,agentId:n,prompt:r,docName:i,titleHint:a}=e;return{kind:`agent-thread`,agentSource:t,agentId:n,prompt:r,docName:i,titleHint:a}}function on(e,t){let n=new Set(Object.keys(t));for(let[t,r]of Object.entries(e)){if(n.has(t))continue;let e=Array.isArray(r)?r.length:r==null?0:1;e>0&&console.warn(`[agent-threads] the note-window launch channel carries no ${t} — dropping`,e,`value(s) from the forwarded launch`)}}function sn(e,t=typeof window>`u`?new EventTarget:window){let n=an(e);if(ve(n,t)){on(e,n);return}t.dispatchEvent(new CustomEvent(rn,{detail:e}))}function cn(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(rn,n),()=>t.removeEventListener(rn,n)}function ln(e){if(!e.docName||!e.workspace)return null;let t=Te(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:we(n,t,r)}}function un(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function dn(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,...e.attachments!==void 0&&e.attachments.length>0?{attachments:e.attachments}:{},projectDir:e.workspace.contentDir,docPath:``}:null}function fn(e){return Se(e.installUrl).then(()=>void 0)}function pn(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function mn(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function hn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace,r=e.attachments!==void 0&&e.attachments.length>0?{attachments:e.attachments}:{};if(e.docName){let i=e.docRelativePath??Te(e.docName),a={scope:`doc`,docRelativePath:i,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?a:{...a,selection:e.selection},...r,projectDir:t,docPath:we(t,i,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},...r,projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},...r,projectDir:t,docPath:``}}function gn(e){return`Opened in ${e}.`}function _n(e,t=1){return t>=3?ue._({id:`bi2C2s`,values:{displayName:e}}):t===2?ue._({id:`1J0c0X`,values:{displayName:e}}):ue._({id:`Xs7IcT`,values:{displayName:e}})}function vn(e){return e>=3?null:e===2?ue._({id:`Xp94R1`}):ue._({id:`6gRgw8`})}function yn(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 bn(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 xn(e,t,n,r){return e.compose?q(bn(e.compose,t,n,r)):e.selection?G({...e.selection,target:t,transport:r}):e.skill?te(e.skill.name,e.skill.scope,n):e.ask?L(e.ask.relativePath,e.ask.instruction,n,t,r):J(e.docContext===null?e.folderRelativePath?oe(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?U(n,e.instruction,r):H(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):F(e.docContext.relativePath,n,e.instruction,r))}function Sn(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?`${ie} ${xn(e,Y[t].handoffTarget,!1,`terminal`)}`:ne(e.docContext?.relativePath??null)}function Cn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||t?`${re} ${xn(e,`claude-code`,!1,`terminal`)}`:V(e.docContext?.relativePath??null)}function wn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function Tn(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 En(e,t){sn({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:Cn(e),docName:wn(e),titleHint:Tn(e),attachments:e.attachments??null})}async function Dn(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(ue._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(ue._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(ue._({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:xn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=yn(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(gn(u));else{let i=vn(r),a=_n(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Dn(e,t,n,r+1)}}})}return a}function On(e){return ae.find(t=>t.id===e)?.displayName??e}function kn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function An(){return{dispatchHandoff:tn,recordHandoff:nn,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>kn(),getDisplayName:On,ensureCoworkSkillInstalled:Qt,autoOpen:!0}}function jn(){let e=(0,$.c)(2),{merged:t}=be(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>Dn(e,t,{...An(),autoOpen:n}),reinstallCoworkSkill:$t},e[0]=n,e[1]=r),r}var Mn=De(`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`}]]),Nn=De(`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`}]]),Pn=De(`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 Fn(e){let t=(0,$.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(l,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function In(e){let t=(0,$.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(l,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Ln(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(l,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function Rn(e){return e?ue._({id:`wTcjov`}):null}function zn(e){let t=(0,$.c)(48),{_:n}=u(),r=o(),i=Ke(),a=M(),s=O();if(r)return null;let{input:c,installStates:d,dispatch:f,onBeforeLaunch:p}=e,m=c===null,h,g,_,v,y,b,x,S,C,w,T;if(t[0]!==n||t[1]!==f||t[2]!==c||t[3]!==m||t[4]!==d||t[5]!==p||t[6]!==s||t[7]!==a||t[8]!==i){let e=Rn(m),r;t[20]!==d||t[21]!==s?(r=e=>k(s,e.id,d[e.id]?.installed),t[20]=d,t[21]=s,t[22]=r):r=t[22];let o=K.filter(r),u;t[23]===s?u=t[24]:(u=e=>D(s,e.source,e.id,!0,e.supported),t[23]=s,t[24]=u);let E=a.filter(u),O=i?se.filter(e=>A(s,e,i.installedClis)):[];_=o.length>0,v=i!==null&&O.length>0,y=E.length>0,g=Me,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsxs)(Re,{children:[(0,Z.jsx)(ot,{"aria-hidden":`true`}),(0,Z.jsx)(l,{id:`O7_W_a`})]}),t[25]=T):T=t[25],h=Ne,b=`max-h-80`,x=y?(0,Z.jsxs)(Pe,{"aria-label":n({id:`RXEbZy`}),children:[(0,Z.jsx)(Le,{children:(0,Z.jsx)(l,{id:`RXEbZy`})}),E.map(t=>{let r=t.name;return(0,Z.jsxs)(Ae,{onSelect:()=>{c!==null&&(p?.(),En(c,{agent:{source:t.source,id:t.id}}))},disabled:m,"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,Z.jsx)(j,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==_||t[27]!==v||t[28]!==y?(S=y&&(v||_)?(0,Z.jsx)(Ve,{}):null,t[26]=_,t[27]=v,t[28]=y,t[29]=S):S=t[29],C=v?(0,Z.jsxs)(Pe,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Le,{children:(0,Z.jsx)(l,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=Y[t];return(0,Z.jsxs)(Ae,{onSelect:()=>{c!==null&&(p?.(),i.launchInTerminal(c,t))},disabled:m,"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,Z.jsx)(Ce,{id:jt(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,w=_?(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(Ve,{}):null,(0,Z.jsxs)(Pe,{"aria-label":n({id:`BwKH4d`}),children:[(0,Z.jsxs)(Le,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(l,{id:`BwKH4d`}),(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3`})]}),o.map(t=>{let r=!m,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Z.jsxs)(Ae,{disabled:!r,onSelect:()=>{if(c){if(p?.(),d[t.id]?.installed!==!0){fn(t);return}f(t.id,c)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ce,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Fn,{displayName:i})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=f,t[2]=c,t[3]=m,t[4]=d,t[5]=p,t[6]=s,t[7]=a,t[8]=i,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T}else h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19];let E;t[30]!==_||t[31]!==v||t[32]!==y?(E=y||v||_?(0,Z.jsx)(Ve,{}):null,t[30]=_,t[31]=v,t[32]=y,t[33]=E):E=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ye,{"aria-hidden":`true`}),t[34]=N):N=t[34];let P;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(Ae,{onSelect:le,"data-testid":`file-tree-open-in-settings`,children:[N,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(l,{id:`jRAGrQ`})})]}),t[35]=P):P=t[35];let F;t[36]!==h||t[37]!==b||t[38]!==x||t[39]!==S||t[40]!==C||t[41]!==w||t[42]!==E?(F=(0,Z.jsxs)(h,{className:b,children:[x,S,C,w,E,P]}),t[36]=h,t[37]=b,t[38]=x,t[39]=S,t[40]=C,t[41]=w,t[42]=E,t[43]=F):F=t[43];let I;return t[44]!==g||t[45]!==T||t[46]!==F?(I=(0,Z.jsxs)(g,{children:[T,F]}),t[44]=g,t[45]=T,t[46]=F,t[47]=I):I=t[47],I}function Bn(e){return e?ue._({id:`wTcjov`}):null}function Vn(e){let t=(0,$.c)(47),{_:n}=u(),r=o(),i=Ke(),a=M(),s=O();if(r)return null;let{input:c,installStates:d,dispatch:f}=e,p=c===null,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==n||t[1]!==f||t[2]!==c||t[3]!==p||t[4]!==d||t[5]!==s||t[6]!==a||t[7]!==i){let e=Bn(p),r;t[19]!==d||t[20]!==s?(r=e=>k(s,e.id,d[e.id]?.installed),t[19]=d,t[20]=s,t[21]=r):r=t[21];let o=K.filter(r),u;t[22]===s?u=t[23]:(u=e=>D(s,e.source,e.id,!0,e.supported),t[22]=s,t[23]=u);let T=a.filter(u),E=i?se.filter(e=>A(s,e,i.installedClis)):[];g=o.length>0,_=i!==null&&E.length>0,v=T.length>0,h=Pt,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(ot,{"aria-hidden":`true`}),(0,Z.jsx)(l,{id:`O7_W_a`})]}),t[24]=w):w=t[24],m=Ot,y=`max-h-80`,b=v?(0,Z.jsxs)(Mt,{"aria-label":n({id:`RXEbZy`}),children:[(0,Z.jsx)(Dt,{children:(0,Z.jsx)(l,{id:`RXEbZy`})}),T.map(t=>{let r=t.name;return(0,Z.jsxs)(Nt,{onSelect:()=>{c!==null&&En(c,{agent:{source:t.source,id:t.id}})},disabled:p,"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,Z.jsx)(j,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==g||t[26]!==_||t[27]!==v?(x=v&&(_||g)?(0,Z.jsx)(At,{}):null,t[25]=g,t[26]=_,t[27]=v,t[28]=x):x=t[28],S=_?(0,Z.jsxs)(Mt,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Dt,{children:(0,Z.jsx)(l,{id:`ALhMYW`})}),E.map(t=>{let{displayName:r}=Y[t];return(0,Z.jsxs)(Nt,{onSelect:()=>{c!==null&&i.launchInTerminal(c,t)},disabled:p,"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,Z.jsx)(Ce,{id:jt(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,C=g?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(At,{}):null,(0,Z.jsxs)(Mt,{"aria-label":n({id:`BwKH4d`}),children:[(0,Z.jsxs)(Dt,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(l,{id:`BwKH4d`}),(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3`})]}),o.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Z.jsxs)(Nt,{disabled:!r,onSelect:()=>{if(c){if(d[t.id]?.installed!==!0){fn(t);return}f(t.id,c)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ce,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Fn,{displayName:i})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=f,t[2]=c,t[3]=p,t[4]=d,t[5]=s,t[6]=a,t[7]=i,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w}else m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18];let T;t[29]!==g||t[30]!==_||t[31]!==v?(T=v||_||g?(0,Z.jsx)(At,{}):null,t[29]=g,t[30]=_,t[31]=v,t[32]=T):T=t[32];let E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ye,{"aria-hidden":`true`}),t[33]=E):E=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Nt,{onSelect:le,"data-testid":`empty-space-open-in-settings`,children:[E,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(l,{id:`jRAGrQ`})})]}),t[34]=N):N=t[34];let P;t[35]!==m||t[36]!==y||t[37]!==b||t[38]!==x||t[39]!==S||t[40]!==C||t[41]!==T?(P=(0,Z.jsxs)(m,{className:y,children:[b,x,S,C,T,N]}),t[35]=m,t[36]=y,t[37]=b,t[38]=x,t[39]=S,t[40]=C,t[41]=T,t[42]=P):P=t[42];let F;return t[43]!==h||t[44]!==w||t[45]!==P?(F=(0,Z.jsxs)(h,{children:[w,P]}),t[43]=h,t[44]=w,t[45]=P,t[46]=F):F=t[46],F}var Hn=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Un(e){let t=I(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=R(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=ee(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=Hn.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Wn(e,t,n){return e.filter(e=>{let r=s(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=Un(r.docName);return i?.scope===t&&i.name===n})}function Gn(e,t,n){let r=ct(t,n);return e.filter(e=>{let i=s(e);return i.kind===`skill-file`?i.scope===t.scope&&i.name===t.name&&i.path===n:i.kind===`doc`&&i.docName===r})}function Kn(e,t,n){let r=Un(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 ct(i,a)===e?{skill:i,filePath:a}:null}function qn(e,t,n=(e,t)=>he(e,t)||pe(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=Un(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Un(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:lt(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:lt(s)})):i.push({kind:`close`,docName:t}))}return i}function Jn(){let e=(0,$.c)(15),{openTabs:t,closeDocument:n}=a(),r=nt(),i;e[0]===t?i=e[1]:(i=t.some(Xn),e[0]=t,e[1]=i);let o=i,s;e[2]===o?s=e[3]:(s={enabled:o},e[2]=o,e[3]=s);let c=Tt(s),l=(0,Q.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(Yn).sort().join(``)}\u0002${fe()}`;if(l.current===i)return;l.current=i;let a=qn(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,Q.useEffect)(u,d)}function Yn(e){return`${e.scope}\u0000${e.name}`}function Xn(e){return Un(e)!==null}function Zn(e){let t=(0,$.c)(18),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:o}=u(),{closeTabs:s,openTabs:c}=a(),[l,d]=(0,Q.useState)(!1),f;t[0]!==o||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==c?(f=async function(e){d(!0);let t=await yt(e.scope,e.name,e.hostQualifier);if(d(!1),!t.ok){let{error:e}=t;X.error(o({id:`AtBdnD`,values:{error:e}}));return}let n=o({id:`h9QFb9`,values:{0:e.name}});t.warnings.length>0?X.warning(n,{description:t.warnings.join(` `),duration:3e4}):X.success(n),s(Wn(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=o,t[1]=s,t[2]=i,t[3]=r,t[4]=c,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==l||t[7]!==r?(h=e=>{!e&&!l&&r(!1)},t[6]=l,t[7]=r,t[8]=h):h=t[8];let g;t[9]!==o||t[10]!==l||t[11]!==p||t[12]!==n?(g=n?(0,Z.jsx)(Je,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?o({id:`WnsbUT`,values:{0:n.path}}):o({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=o,t[10]=l,t[11]=p,t[12]=n,t[13]=g):g=t[13];let _;return t[14]!==m||t[15]!==h||t[16]!==g?(_=(0,Z.jsx)(T,{open:m,onOpenChange:h,children:g}),t[14]=m,t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function Qn(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 $n(e){if(/\s/.test(e))return ue._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?ue._({id:`Zt7Ktx`}):t.some(e=>e===``)?ue._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?ue._({id:`yJkw6t`}):Qn(e)?null:ue._({id:`oP-FQW`})}function er(e){let t=(0,$.c)(70),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:o}=a(),s=(0,Q.useId)(),[c,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),h;t[0]===n?h=t[1]:(h=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=h);let g=n?.skill.scope,_=n?.skill.name,S=n?.prefix,T;if(t[2]!==g||t[3]!==_||t[4]!==S?(T=[g,_,S],t[2]=g,t[3]=_,t[4]=S,t[5]=T):T=t[5],(0,Q.useEffect)(h,T),!n)return null;let D,O,k,A,j,M;if(t[6]!==c||t[7]!==f){M=c.trim(),k=M===``||M.endsWith(`/`),A=k?null:$n(M),D=!(k||A!==null)&&!f,O=M.includes(`/`)?M.split(`/`).slice(0,-1).join(`/`):null;let e=M.split(`/`).pop()??``;j=e!==``&&!e.includes(`.`)?`${M}.md`:M,t[6]=c,t[7]=f,t[8]=D,t[9]=O,t[10]=k,t[11]=A,t[12]=j,t[13]=M}else D=t[8],O=t[9],k=t[10],A=t[11],j=t[12],M=t[13];let N=j,P;t[14]!==i||t[15]!==D||t[16]!==N||t[17]!==r||t[18]!==o||t[19]!==n?(P=async function(){if(!n||!D)return;p(!0);let e=/\.mdx?$/i.test(N),t=await pt({scope:n.skill.scope,name:n.skill.name,path:N,content:e?`# ${N.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){X.error(i({id:`DvGkXq`,values:{0:t.error,effective:N}}));return}if(X.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=ct(n.skill,N);o({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=D,t[16]=N,t[17]=r,t[18]=o,t[19]=n,t[20]=P):P=t[20];let F=P,I;t[21]!==r||t[22]!==f?(I=e=>{!e&&!f&&r(!1)},t[21]=r,t[22]=f,t[23]=I):I=t[23];let L;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`wQvvZY`})}),t[24]=L):L=t[24];let R;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(C,{children:[L,(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`lM4c-I`})})]}),t[25]=R):R=t[25];let z;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(l,{id:`I6gXOa`}),t[26]=z):z=t[26];let B;t[27]===s?B=t[28]:(B=(0,Z.jsx)(E,{htmlFor:s,children:z}),t[27]=s,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>d(e.target.value),t[29]=V):V=t[29];let H=A!==null,U;t[30]===F?U=t[31]:(U=e=>{e.key===`Enter`&&F()},t[30]=F,t[31]=U);let ee;t[32]!==s||t[33]!==c||t[34]!==H||t[35]!==U?(ee=(0,Z.jsx)(Ct,{id:s,value:c,onChange:V,placeholder:`references/notes.md`,"aria-invalid":H,onKeyDown:U}),t[32]=s,t[33]=c,t[34]=H,t[35]=U,t[36]=ee):ee=t[36];let te;t[37]!==N||t[38]!==O||t[39]!==k||t[40]!==A||t[41]!==M?(te=A===null?k&&M!==``?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`Vy6XCg`})}):N===M?O?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`9lso1Y`,values:{folderPart:O},components:{0:(0,Z.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null:(0,Z.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`zC5jrM`,values:{effective:N},components:{0:(0,Z.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-destructive text-xs`,children:A}),t[37]=N,t[38]=O,t[39]=k,t[40]=A,t[41]=M,t[42]=te):te=t[42];let W;t[43]!==B||t[44]!==ee||t[45]!==te?(W=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[B,ee,te]}),t[43]=B,t[44]=ee,t[45]=te,t[46]=W):W=t[46];let G;t[47]===r?G=t[48]:(G=()=>r(!1),t[47]=r,t[48]=G);let ne;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(l,{id:`dEgA5A`}),t[49]=ne):ne=t[49];let K;t[50]!==f||t[51]!==G?(K=(0,Z.jsx)(m,{variant:`outline`,onClick:G,disabled:f,children:ne}),t[50]=f,t[51]=G,t[52]=K):K=t[52];let q;t[53]===F?q=t[54]:(q=()=>void F(),t[53]=F,t[54]=q);let re=!D,J;t[55]===f?J=t[56]:(J=f?(0,Z.jsx)(l,{id:`E9bKSA`}):(0,Z.jsx)(l,{id:`hYgDIe`}),t[55]=f,t[56]=J);let Y;t[57]!==q||t[58]!==re||t[59]!==J?(Y=(0,Z.jsx)(m,{onClick:q,disabled:re,children:J}),t[57]=q,t[58]=re,t[59]=J,t[60]=Y):Y=t[60];let ie;t[61]!==K||t[62]!==Y?(ie=(0,Z.jsxs)(x,{children:[K,Y]}),t[61]=K,t[62]=Y,t[63]=ie):ie=t[63];let ae;t[64]!==W||t[65]!==ie?(ae=(0,Z.jsxs)(b,{className:`sm:max-w-md`,children:[R,W,ie]}),t[64]=W,t[65]=ie,t[66]=ae):ae=t[66];let oe;return t[67]!==ae||t[68]!==I?(oe=(0,Z.jsx)(w,{open:!0,onOpenChange:I,children:ae}),t[67]=ae,t[68]=I,t[69]=oe):oe=t[69],oe}function tr(e){let t=(0,$.c)(17),{target:n,onOpenChange:r}=e,{_:i}=u(),{closeTabs:o,openTabs:s}=a(),[c,l]=(0,Q.useState)(!1),d;t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==s?(d=async function(e){let{skill:t,filePath:n}=e;l(!0);let a=await bt({scope:t.scope,name:t.name,path:n});if(l(!1),!a.ok){X.error(i({id:`CBT70t`,values:{0:a.error}}));return}if(!a.existed){X.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}X.success(i({id:`gOmloS`,values:{filePath:n}})),o(Gn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=o,t[2]=r,t[3]=s,t[4]=d):d=t[4];let f=d,p=n!==null,m;t[5]!==c||t[6]!==r?(m=e=>{!e&&!c&&r(!1)},t[5]=c,t[6]=r,t[7]=m):m=t[7];let h;t[8]!==i||t[9]!==c||t[10]!==f||t[11]!==n?(h=n?(0,Z.jsx)(Je,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:c,onDelete:()=>f(n),customDescription:i({id:`ppzof_`,values:{0:dt(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,Z.jsx)(T,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function nr(e){let t=(0,$.c)(64),{target:n,onOpenChange:r}=e,{_:i}=u(),a=nt(),o=(0,Q.useId)(),[s,c]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let h=n?.skill.scope,g=n?.skill.name,_=n?.filePath,S;if(t[2]!==h||t[3]!==g||t[4]!==_?(S=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=S):S=t[5],(0,Q.useEffect)(p,S),!n)return null;let T,D,O;t[6]!==s||t[7]!==n.filePath?(D=s.trim(),O=D===n.filePath,T=D===``||!Qn(D),t[6]=s,t[7]=n.filePath,t[8]=T,t[9]=D,t[10]=O):(T=t[8],D=t[9],O=t[10]);let k=T,A=!k&&!O&&!d,j;t[11]!==i||t[12]!==A||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==D?(j=async function(){if(!n||!A)return;f(!0);let e=await ht({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:D});if(f(!1),!e.ok){X.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),X.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=A,t[13]=r,t[14]=a,t[15]=n,t[16]=D,t[17]=j):j=t[17];let M=j,N;t[18]!==r||t[19]!==d?(N=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=N):N=t[20];let P;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`yckias`})}),t[21]=P):P=t[21];let F;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(C,{children:[P,(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`HzVAoz`})})]}),t[22]=F):F=t[22];let I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(l,{id:`I6gXOa`}),t[23]=I):I=t[23];let L;t[24]===o?L=t[25]:(L=(0,Z.jsx)(E,{htmlFor:o,children:I}),t[24]=o,t[25]=L);let R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>c(e.target.value),t[26]=R):R=t[26];let z=k&&D!==``,B;t[27]===M?B=t[28]:(B=e=>{e.key===`Enter`&&M()},t[27]=M,t[28]=B);let V;t[29]!==o||t[30]!==s||t[31]!==z||t[32]!==B?(V=(0,Z.jsx)(Ct,{id:o,value:s,onChange:R,"aria-invalid":z,onKeyDown:B}),t[29]=o,t[30]=s,t[31]=z,t[32]=B,t[33]=V):V=t[33];let H;t[34]!==k||t[35]!==D?(H=k&&D!==``?(0,Z.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Z.jsx)(l,{id:`fVzizW`})}):null,t[34]=k,t[35]=D,t[36]=H):H=t[36];let U;t[37]!==L||t[38]!==V||t[39]!==H?(U=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[L,V,H]}),t[37]=L,t[38]=V,t[39]=H,t[40]=U):U=t[40];let ee;t[41]===r?ee=t[42]:(ee=()=>r(!1),t[41]=r,t[42]=ee);let te;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(l,{id:`dEgA5A`}),t[43]=te):te=t[43];let W;t[44]!==d||t[45]!==ee?(W=(0,Z.jsx)(m,{variant:`outline`,onClick:ee,disabled:d,children:te}),t[44]=d,t[45]=ee,t[46]=W):W=t[46];let G;t[47]===M?G=t[48]:(G=()=>void M(),t[47]=M,t[48]=G);let ne=!A,K;t[49]===d?K=t[50]:(K=d?(0,Z.jsx)(l,{id:`tHKQ6j`}):(0,Z.jsx)(l,{id:`2wxgft`}),t[49]=d,t[50]=K);let q;t[51]!==G||t[52]!==ne||t[53]!==K?(q=(0,Z.jsx)(m,{onClick:G,disabled:ne,children:K}),t[51]=G,t[52]=ne,t[53]=K,t[54]=q):q=t[54];let re;t[55]!==W||t[56]!==q?(re=(0,Z.jsxs)(x,{children:[W,q]}),t[55]=W,t[56]=q,t[57]=re):re=t[57];let J;t[58]!==U||t[59]!==re?(J=(0,Z.jsxs)(b,{className:`sm:max-w-md`,children:[F,U,re]}),t[58]=U,t[59]=re,t[60]=J):J=t[60];let Y;return t[61]!==J||t[62]!==N?(Y=(0,Z.jsx)(w,{open:!0,onOpenChange:N,children:J}),t[61]=J,t[62]=N,t[63]=Y):Y=t[63],Y}function rr(e){let t=(0,$.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=rt(),s=n!==null,c=(0,Q.useId)(),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),h;t[0]===n?h=t[1]:(h=()=>{n&&d(n.name)},t[0]=n,t[1]=h);let g=n?.scope,_=n?.name,S;if(t[2]!==g||t[3]!==_?(S=[g,_],t[2]=g,t[3]=_,t[4]=S):S=t[4],(0,Q.useEffect)(h,S),!n)return null;let T,D,O,k,A,j;if(t[5]!==r||t[6]!==u||t[7]!==n.name){A=u.trim(),j=A===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),T=i,k=A.length>64,D=A===``||!z.test(A)||k,O=!D&&!j&&r.has(A),t[5]=r,t[6]=u,t[7]=n.name,t[8]=T,t[9]=D,t[10]=O,t[11]=k,t[12]=A,t[13]=j}else T=t[8],D=t[9],O=t[10],k=t[11],A=t[12],j=t[13];let M=O,N=!D&&!M&&!j&&!f,P;t[17]!==N||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==A?(P=async function(){if(!n||!N)return;p(!0);let e=await o({scope:n.scope,name:n.name},A);p(!1),e.ok&&(a?.(A),i(!1))},t[17]=N,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=A,t[23]=P):P=t[23];let F=P,I;t[24]===i?I=t[25]:(I=e=>e?null:i(!1),t[24]=i,t[25]=I);let L;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`dw_3cv`})}),t[26]=L):L=t[26];let R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(C,{children:[L,(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`R9IDFz`})})]}),t[27]=R):R=t[27];let B;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(l,{id:`6YtxFj`}),t[28]=B):B=t[28];let V;t[29]===c?V=t[30]:(V=(0,Z.jsx)(E,{htmlFor:c,children:B}),t[29]=c,t[30]=V);let H;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>d(e.target.value),t[31]=H):H=t[31];let U;t[32]===F?U=t[33]:(U=e=>{e.key===`Enter`&&F()},t[32]=F,t[33]=U);let ee=D||M,te=D&&A!==``||M?`${c}-error`:void 0,W;t[34]!==c||t[35]!==u||t[36]!==U||t[37]!==ee||t[38]!==te?(W=(0,Z.jsx)(Ct,{id:c,value:u,onChange:H,onKeyDown:U,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":ee,"aria-describedby":te,className:`font-mono`}),t[34]=c,t[35]=u,t[36]=U,t[37]=ee,t[38]=te,t[39]=W):W=t[39];let G;t[40]!==M||t[41]!==T||t[42]!==c||t[43]!==D||t[44]!==k||t[45]!==A?(G=D&&A!==``?(0,Z.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:T?(0,Z.jsx)(l,{id:`iUwpZI`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}}):k?(0,Z.jsx)(l,{id:`lK9c4T`}):(0,Z.jsx)(l,{id:`A50vr3`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):M?(0,Z.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(l,{id:`YJ1BTp`})}):null,t[40]=M,t[41]=T,t[42]=c,t[43]=D,t[44]=k,t[45]=A,t[46]=G):G=t[46];let ne;t[47]!==V||t[48]!==W||t[49]!==G?(ne=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[V,W,G]}),t[47]=V,t[48]=W,t[49]=G,t[50]=ne):ne=t[50];let K;t[51]===i?K=t[52]:(K=()=>i(!1),t[51]=i,t[52]=K);let q;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(l,{id:`dEgA5A`}),t[53]=q):q=t[53];let re;t[54]!==f||t[55]!==K?(re=(0,Z.jsx)(m,{variant:`outline`,onClick:K,disabled:f,children:q}),t[54]=f,t[55]=K,t[56]=re):re=t[56];let J;t[57]===F?J=t[58]:(J=()=>void F(),t[57]=F,t[58]=J);let Y=!N,ie;t[59]===f?ie=t[60]:(ie=f?(0,Z.jsx)(l,{id:`tHKQ6j`}):(0,Z.jsx)(l,{id:`2wxgft`}),t[59]=f,t[60]=ie);let ae;t[61]!==J||t[62]!==Y||t[63]!==ie?(ae=(0,Z.jsx)(m,{onClick:J,disabled:Y,children:ie}),t[61]=J,t[62]=Y,t[63]=ie,t[64]=ae):ae=t[64];let oe;t[65]!==re||t[66]!==ae?(oe=(0,Z.jsxs)(x,{children:[re,ae]}),t[65]=re,t[66]=ae,t[67]=oe):oe=t[67];let se;t[68]!==ne||t[69]!==oe?(se=(0,Z.jsxs)(b,{children:[R,ne,oe]}),t[68]=ne,t[69]=oe,t[70]=se):se=t[70];let ce;return t[71]!==s||t[72]!==se||t[73]!==I?(ce=(0,Z.jsx)(w,{open:s,onOpenChange:I,children:se}),t[71]=s,t[72]=se,t[73]=I,t[74]=ce):ce=t[74],ce}function ir(){let e=(0,$.c)(6),{_:t}=u(),n=ft(),r=nt(),{openTabs:i}=a(),o=Tt(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==o?(s=async(e,a)=>{if(a===e.scope)return!1;ge(e.scope,e.name),me(e.scope,e.name);let s=await _t({name:e.name,fromScope:e.scope,toScope:a});if(_e(e.scope,e.name),!s.ok)return de(e.scope,e.name),X.error(t({id:`07eGJB`,values:{0:s.error}}),mt({outcome:s.outcome,name:e.name,toScope:a,scopeLabel:n[a]})),!1;X.success(t({id:`yhI6P0`,values:{0:e.name,1:n[a]}}));let c=o.status===`ready`?o.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,l=i.map(or).filter(t=>{if(t.kind!==`doc`)return!1;let n=Un(t.docName);return n?.scope===e.scope&&n.name===e.name}),u=l.find(ar)??l[0],d=u?.kind===`doc`?u.docName:c?lt(c):e.scope===`global`?W(e.scope,e.name):null,f=a===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:W(a,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return de(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s):s=e[5],s}function ar(e){return e.kind===`doc`&&Un(e.docName)?.rel===null}function or(e){return s(e)}function sr(e){let t=(0,$.c)(38),{target:n,onOpenChange:r}=e,i=ft(),a=ir(),[o,s]=(0,Q.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],h;t[3]===p?h=t[4]:(h=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=h);let g=i[c],_=i[d],T=i[d],E;t[5]!==u||t[6]!==g||t[7]!==_||t[8]!==T?(E={0:g,1:_,2:T,name:u},t[5]=u,t[6]=g,t[7]=_,t[8]=T,t[9]=E):E=t[9];let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D={0:(0,Z.jsx)(`code`,{className:`font-mono`})},t[10]=D):D=t[10];let O;t[11]===E?O=t[12]:(O=(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`7bIiJ7`,values:E,components:D})}),t[11]=E,t[12]=O);let k;t[13]!==h||t[14]!==O?(k=(0,Z.jsxs)(C,{children:[h,O]}),t[13]=h,t[14]=O,t[15]=k):k=t[15];let A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(l,{id:`dEgA5A`}),t[16]=A):A=t[16];let j;t[17]===o?j=t[18]:(j=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(m,{variant:`outline`,disabled:o,children:A})}),t[17]=o,t[18]=j);let M;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==d?(M=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]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(l,{id:`QWdKwH`}),t[25]=N):N=t[25];let P;t[26]!==o||t[27]!==M?(P=(0,Z.jsx)(m,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:M,children:N}),t[26]=o,t[27]=M,t[28]=P):P=t[28];let F;t[29]!==j||t[30]!==P?(F=(0,Z.jsxs)(x,{children:[j,P]}),t[29]=j,t[30]=P,t[31]=F):F=t[31];let I;t[32]!==k||t[33]!==F?(I=(0,Z.jsxs)(b,{className:`sm:max-w-md`,children:[k,F]}),t[32]=k,t[33]=F,t[34]=I):I=t[34];let L;return t[35]!==f||t[36]!==I?(L=(0,Z.jsx)(w,{open:!0,onOpenChange:f,children:I}),t[35]=f,t[36]=I,t[37]=L):L=t[37],L}var cr=(0,Q.lazy)(async()=>({default:(await t(()=>import(`./SkillForkDialog-B8iWPj-U.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url)).SkillForkDialog}));function lr(){let e=(0,$.c)(52),{_:t}=u(),n=Et(),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),ge(e.scope,e.name);let i=await vt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(de(e.scope,e.name),y(null),!i.ok)return X.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=fr,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 X.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&X.warning(e);let t=l(`no-description`);t&&X.warning(t)}return i.hosts.length===0?X.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?X.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?X.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?X.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):X.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),ge(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await xt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){X.error(t.error);break}}de(e.scope,e.name),y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name),ge(e.scope,e.name);let n=await t();return de(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 gt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){X.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}X.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)ge(e.scope,t);y(n[0]??null);let r=await St({scope:e.scope,names:n});for(let t of n)de(e.scope,t);if(y(null),!r.ok){X.error(t({id:`nXHOFU`,values:{0:e.sourceLabel,1:r.error}}));return}let i=r.results.filter(dr),a=e.sourceLabel,o=r.updated,s=r.upToDate;if(i.length>0){let e=i.map(ur).join(`, `),n=i.length;X.warning(t({id:`AgoIW4`,values:{source:a,updated:o,upToDate:s,failed:n,detail:e}}));return}X.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,Z.jsx)(Zn,{skill:r,onOpenChange:A,onDeleted:j}),e[11]=r,e[12]=M);let N=a?.skill??null,P=a?.existingNames??mr,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,Z.jsx)(rr,{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,Z.jsx)(sr,{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,Z.jsx)(nr,{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,Z.jsx)(tr,{target:f,onOpenChange:H}),e[25]=f,e[26]=U);let ee;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>{e||h(null)},e[27]=ee):ee=e[27];let te;e[28]===m?te=e[29]:(te=(0,Z.jsx)(er,{target:m,onOpenChange:ee}),e[28]=m,e[29]=te);let W;e[30]===g?W=e[31]:(W=g?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(cr,{target:g,onOpenChange:e=>{e||_(null)}})}):null,e[30]=g,e[31]=W);let G;e[32]!==L||e[33]!==z||e[34]!==V||e[35]!==U||e[36]!==te||e[37]!==W||e[38]!==M?(G=(0,Z.jsxs)(Z.Fragment,{children:[M,L,z,V,U,te,W]}),e[32]=L,e[33]=z,e[34]=V,e[35]=U,e[36]=te,e[37]=W,e[38]=M,e[39]=G):G=e[39];let ne=G,K,q,re,J,Y,ie;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(K=(e,t)=>o({skill:e,existingNames:t}),q=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),re=(e,t)=>d({skill:e,filePath:t}),J=(e,t)=>p({skill:e,filePath:t}),Y=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),ie=(e,t)=>_({skill:e,editor:t}),e[40]=K,e[41]=q,e[42]=re,e[43]=J,e[44]=Y,e[45]=ie):(K=e[40],q=e[41],re=e[42],J=e[43],Y=e[44],ie=e[45]);let ae;return e[46]!==ne||e[47]!==D||e[48]!==x||e[49]!==v||e[50]!==k?(ae={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,updateAllFromSource:k,requestDelete:i,requestRename:K,requestScopeMove:q,requestFileRename:re,requestFileDelete:J,requestFileCreate:Y,requestForkResolve:ie,dialogs:ne},e[46]=ne,e[47]=D,e[48]=x,e[49]=v,e[50]=k,e[51]=ae):ae=e[51],ae}function ur(e){return e.error?`${e.requested} (${e.error})`:e.requested}function dr(e){return e.status===`failed`||e.status===`not-found`}function fr(e){return e.map(pr).join(`, `)}function pr(e){return B[e]??e}var mr=new Set;function hr(e){let t=(0,$.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,Z.jsx)(it,{"aria-hidden":!0}),c=It(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,Z.jsxs)(Qe,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function gr(e){let t=(0,$.c)(68),{skill:n,filePath:i,actions:a,menuKind:o}=e,s=o===void 0?`dropdown`:o,{_:c}=u(),d;t[0]!==i||t[1]!==n.absolutePath?(d=n.absolutePath?`${dt(n.absolutePath)}/${i}`:void 0,t[0]=i,t[1]=n.absolutePath,t[2]=d):d=t[2];let f=d,p;t[3]===n.path?p=t[4]:(p=dt(n.path),t[3]=n.path,t[4]=p);let m=`${p}/${i}`,h;t[5]===c?h=t[6]:(h=async function(e){try{await Ft(e),X.success(c({id:`SXCSQd`}))}catch{X.error(c({id:`cRHuuI`}))}},t[5]=c,t[6]=h);let g=h,_;t[7]!==a||t[8]!==i||t[9]!==n?(_=()=>a.requestFileRename(n,i),t[7]=a,t[8]=i,t[9]=n,t[10]=_):_=t[10];let v,y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Pn,{"aria-hidden":!0}),y=(0,Z.jsx)(l,{id:`2wxgft`}),t[11]=v,t[12]=y):(v=t[11],y=t[12]);let b;t[13]!==s||t[14]!==_?(b=(0,Z.jsxs)(Qe,{menuKind:s,onSelect:_,children:[v,y]}),t[13]=s,t[14]=_,t[15]=b):b=t[15];let x;t[16]!==f||t[17]!==s?(x=(0,Z.jsx)(hr,{absolutePath:f,menuKind:s}),t[16]=f,t[17]=s,t[18]=x):x=t[18];let S,C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(r,{"aria-hidden":!0}),C=(0,Z.jsx)(l,{id:`zd00pH`}),t[19]=S,t[20]=C):(S=t[19],C=t[20]);let w;t[21]===s?w=t[22]:(w=(0,Z.jsxs)(Ge,{menuKind:s,children:[S,C]}),t[21]=s,t[22]=w);let T;t[23]!==f||t[24]!==g||t[25]!==s?(T=f?(0,Z.jsx)(Qe,{menuKind:s,onSelect:()=>void g(f),children:(0,Z.jsx)(l,{id:`z2funE`})}):null,t[23]=f,t[24]=g,t[25]=s,t[26]=T):T=t[26];let E;t[27]!==g||t[28]!==m?(E=()=>void g(m),t[27]=g,t[28]=m,t[29]=E):E=t[29];let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(l,{id:`xloBjn`}),t[30]=D):D=t[30];let O;t[31]!==s||t[32]!==E?(O=(0,Z.jsx)(Qe,{menuKind:s,onSelect:E,children:D}),t[31]=s,t[32]=E,t[33]=O):O=t[33];let k;t[34]!==s||t[35]!==T||t[36]!==O?(k=(0,Z.jsxs)(Xe,{menuKind:s,children:[T,O]}),t[34]=s,t[35]=T,t[36]=O,t[37]=k):k=t[37];let A;t[38]!==s||t[39]!==k?(A=(0,Z.jsx)(We,{menuKind:s,children:k}),t[38]=s,t[39]=k,t[40]=A):A=t[40];let j;t[41]!==s||t[42]!==w||t[43]!==A?(j=(0,Z.jsxs)(et,{menuKind:s,children:[w,A]}),t[41]=s,t[42]=w,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==s||t[46]!==j||t[47]!==b||t[48]!==x?(M=(0,Z.jsxs)(Xe,{menuKind:s,children:[b,x,j]}),t[45]=s,t[46]=j,t[47]=b,t[48]=x,t[49]=M):M=t[49];let N;t[50]===s?N=t[51]:(N=(0,Z.jsx)(qe,{menuKind:s}),t[50]=s,t[51]=N);let P;t[52]!==a||t[53]!==i||t[54]!==n?(P=()=>a.requestFileDelete(n,i),t[52]=a,t[53]=i,t[54]=n,t[55]=P):P=t[55];let F,I;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(st,{"aria-hidden":!0}),I=(0,Z.jsx)(l,{id:`cnGeoo`}),t[56]=F,t[57]=I):(F=t[56],I=t[57]);let L;t[58]!==s||t[59]!==P?(L=(0,Z.jsxs)(Qe,{menuKind:s,variant:`destructive`,onSelect:P,children:[F,I]}),t[58]=s,t[59]=P,t[60]=L):L=t[60];let R;t[61]!==s||t[62]!==L?(R=(0,Z.jsx)(Xe,{menuKind:s,children:L}),t[61]=s,t[62]=L,t[63]=R):R=t[63];let z;return t[64]!==M||t[65]!==N||t[66]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[M,N,R]}),t[64]=M,t[65]=N,t[66]=R,t[67]=z):z=t[67],z}function _r(e){let t=(0,$.c)(42),{skill:n,actions:i,beforeDelete:a}=e,{_:o}=u(),s=Ze(n,i),c=n.absolutePath,d;t[0]===o?d=t[1]:(d=async function(e){try{await Ft(e),X.success(o({id:`SXCSQd`}))}catch{X.error(o({id:`cRHuuI`}))}},t[0]=o,t[1]=d);let f=d,p;t[2]===c?p=t[3]:(p=(0,Z.jsx)(hr,{absolutePath:c}),t[2]=c,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(Ge,{menuKind:`dropdown`,children:[(0,Z.jsx)(r,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`zd00pH`})]}),t[4]=m):m=t[4];let h;t[5]!==c||t[6]!==f?(h=c?(0,Z.jsx)(Qe,{menuKind:`dropdown`,onSelect:()=>void f(c),children:(0,Z.jsx)(l,{id:`z2funE`})}):null,t[5]=c,t[6]=f,t[7]=h):h=t[7];let g;t[8]!==f||t[9]!==n.path?(g=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(l,{id:`xloBjn`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Z.jsx)(Qe,{menuKind:`dropdown`,onSelect:g,children:_}),t[12]=g,t[13]=v);let y;t[14]!==h||t[15]!==v?(y=(0,Z.jsxs)(et,{menuKind:`dropdown`,children:[m,(0,Z.jsx)(We,{menuKind:`dropdown`,children:(0,Z.jsxs)(Xe,{menuKind:`dropdown`,children:[h,v]})})]}),t[14]=h,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==p||t[18]!==y?(b=(0,Z.jsxs)(Xe,{menuKind:`dropdown`,children:[p,y]}),t[17]=p,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(qe,{menuKind:`dropdown`}),t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsxs)(Ge,{menuKind:`dropdown`,children:[(0,Z.jsx)(Nn,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`TKQ7K-`})]}),t[21]=S):S=t[21];let C;t[22]!==i||t[23]!==n?(C=e=>i.requestForkResolve(n,e),t[22]=i,t[23]=n,t[24]=C):C=t[24];let w;t[25]!==s||t[26]!==n||t[27]!==C?(w=(0,Z.jsx)(Xe,{menuKind:`dropdown`,children:(0,Z.jsxs)(et,{menuKind:`dropdown`,children:[S,(0,Z.jsx)(We,{menuKind:`dropdown`,className:$e,children:(0,Z.jsx)(Xe,{menuKind:`dropdown`,children:(0,Z.jsx)(Ye,{toggles:s,skill:n,menuKind:`dropdown`,onResolveFork:C})})})]})}),t[25]=s,t[26]=n,t[27]=C,t[28]=w):w=t[28];let T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(qe,{menuKind:`dropdown`}),t[29]=T):T=t[29];let E;t[30]!==i||t[31]!==n?(E=()=>i.requestDelete(n),t[30]=i,t[31]=n,t[32]=E):E=t[32];let D,O;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(st,{"aria-hidden":!0}),O=(0,Z.jsx)(l,{id:`cnGeoo`}),t[33]=D,t[34]=O):(D=t[33],O=t[34]);let k;t[35]===E?k=t[36]:(k=(0,Z.jsx)(Xe,{menuKind:`dropdown`,children:(0,Z.jsxs)(Qe,{menuKind:`dropdown`,variant:`destructive`,onSelect:E,children:[D,O]})}),t[35]=E,t[36]=k);let A;return t[37]!==a||t[38]!==w||t[39]!==k||t[40]!==b?(A=(0,Z.jsxs)(Z.Fragment,{children:[b,x,w,a,T,k]}),t[37]=a,t[38]=w,t[39]=k,t[40]=b,t[41]=A):A=t[41],A}function vr(e){let t=(0,$.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Ee(),c=He().states,{dispatch:l}=jn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=mn({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,Z.jsx)(Vn,{input:f,installStates:c,dispatch:l}):(0,Z.jsx)(zn,{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,Z.jsx)(yr,{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 yr(e){let t=(0,$.c)(65),{actions:n,existingNames:a,menuKind:o,openWithAi:s,skill:c}=e,{_:d}=u(),f=ft(),p=Ze(c,n),m=c.absolutePath,h=c.hostQualifier!==void 0,g;t[0]===d?g=t[1]:(g=async function(e){try{await Ft(e),X.success(d({id:`SXCSQd`}))}catch{X.error(d({id:`cRHuuI`}))}},t[0]=d,t[1]=g);let _=g,v;t[2]!==m||t[3]!==o?(v=(0,Z.jsx)(hr,{absolutePath:m,menuKind:o}),t[2]=m,t[3]=o,t[4]=v):v=t[4];let y,b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(r,{"aria-hidden":!0}),b=(0,Z.jsx)(l,{id:`zd00pH`}),t[5]=y,t[6]=b):(y=t[5],b=t[6]);let x;t[7]===o?x=t[8]:(x=(0,Z.jsxs)(Ge,{menuKind:o,children:[y,b]}),t[7]=o,t[8]=x);let S;t[9]!==m||t[10]!==_||t[11]!==o?(S=m?(0,Z.jsx)(Qe,{menuKind:o,onSelect:()=>void _(m),children:(0,Z.jsx)(l,{id:`z2funE`})}):null,t[9]=m,t[10]=_,t[11]=o,t[12]=S):S=t[12];let C;t[13]!==_||t[14]!==c.path?(C=()=>void _(c.path),t[13]=_,t[14]=c.path,t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(l,{id:`xloBjn`}),t[16]=w):w=t[16];let T;t[17]!==o||t[18]!==C?(T=(0,Z.jsx)(Qe,{menuKind:o,onSelect:C,children:w}),t[17]=o,t[18]=C,t[19]=T):T=t[19];let E;t[20]!==o||t[21]!==S||t[22]!==T?(E=(0,Z.jsxs)(Xe,{menuKind:o,children:[S,T]}),t[20]=o,t[21]=S,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==o||t[25]!==E?(D=(0,Z.jsx)(We,{menuKind:o,children:E}),t[24]=o,t[25]=E,t[26]=D):D=t[26];let O;t[27]!==o||t[28]!==D||t[29]!==x?(O=(0,Z.jsxs)(et,{menuKind:o,children:[x,D]}),t[27]=o,t[28]=D,t[29]=x,t[30]=O):O=t[30];let k;t[31]!==o||t[32]!==s||t[33]!==O||t[34]!==v?(k=(0,Z.jsxs)(Xe,{menuKind:o,children:[v,s,O]}),t[31]=o,t[32]=s,t[33]=O,t[34]=v,t[35]=k):k=t[35];let A;t[36]===o?A=t[37]:(A=(0,Z.jsx)(qe,{menuKind:o}),t[36]=o,t[37]=A);let j;t[38]!==n||t[39]!==a||t[40]!==p||t[41]!==o||t[42]!==h||t[43]!==f||t[44]!==c?(j=h?(0,Z.jsx)(Xe,{menuKind:o,children:(0,Z.jsx)(Ue,{menuKind:o,className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`D0CegO`})})}):(0,Z.jsxs)(Xe,{menuKind:o,children:[(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>void n.duplicate(c,a),children:[(0,Z.jsx)(i,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`euc6Ns`})]}),(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>n.requestRename(c,a),children:[(0,Z.jsx)(Pn,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`2wxgft`})]}),(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>n.requestFileCreate(c),children:[(0,Z.jsx)(tt,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`HdkSiO`})]}),(0,Z.jsxs)(et,{menuKind:o,children:[(0,Z.jsxs)(Ge,{menuKind:o,children:[(0,Z.jsx)(Nn,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`TKQ7K-`})]}),(0,Z.jsx)(We,{menuKind:o,className:$e,children:(0,Z.jsx)(Xe,{menuKind:o,children:(0,Z.jsx)(Ye,{toggles:p,skill:c,menuKind:o,onResolveFork:e=>n.requestForkResolve(c,e)})})})]}),(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>n.requestScopeMove(c,c.scope===`project`?`global`:`project`),children:[(0,Z.jsx)(Mn,{"aria-hidden":!0}),c.scope===`project`?(0,Z.jsx)(l,{id:`bpytj4`,values:{0:f.global}}):(0,Z.jsx)(l,{id:`bpytj4`,values:{0:f.project}})]})]}),t[38]=n,t[39]=a,t[40]=p,t[41]=o,t[42]=h,t[43]=f,t[44]=c,t[45]=j):j=t[45];let M;t[46]===o?M=t[47]:(M=(0,Z.jsx)(qe,{menuKind:o}),t[46]=o,t[47]=M);let N;t[48]!==n||t[49]!==c?(N=()=>n.requestDelete(c),t[48]=n,t[49]=c,t[50]=N):N=t[50];let P,F;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(st,{"aria-hidden":!0}),F=(0,Z.jsx)(l,{id:`cnGeoo`}),t[51]=P,t[52]=F):(P=t[51],F=t[52]);let I;t[53]!==o||t[54]!==N?(I=(0,Z.jsxs)(Qe,{menuKind:o,variant:`destructive`,onSelect:N,children:[P,F]}),t[53]=o,t[54]=N,t[55]=I):I=t[55];let L;t[56]!==o||t[57]!==I?(L=(0,Z.jsx)(Xe,{menuKind:o,children:I}),t[56]=o,t[57]=I,t[58]=L):L=t[58];let R;return t[59]!==k||t[60]!==A||t[61]!==j||t[62]!==M||t[63]!==L?(R=(0,Z.jsxs)(Z.Fragment,{children:[k,A,j,M,L]}),t[59]=k,t[60]=A,t[61]=j,t[62]=M,t[63]=L,t[64]=R):R=t[64],R}function br(e){let t=(0,$.c)(48),{scope:n,name:r,showNewFile:i}=e,a=i===void 0?!0:i,{_:o}=u(),s=Tt(),c=lr(),d=s.status===`ready`?s.data:void 0,h;t[0]!==d||t[1]!==r||t[2]!==n?(h=d?.find(e=>e.scope===n&&e.name===r),t[0]=d,t[1]=r,t[2]=n,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==d||t[6]!==r?(_=g===void 0?d?.filter(e=>e.name===r):void 0,t[4]=g,t[5]=d,t[6]=r,t[7]=_):_=t[7];let v=_,y=g??(v?.length===1?v[0]:void 0),b;t[8]!==y||t[9]!==r||t[10]!==n?(b=y??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=y,t[9]=r,t[10]=n,t[11]=b):b=t[11];let x=b,[S,C]=(0,Q.useState)(!1),w=Ze(x,c),{installed:T,installing:E,hostSet:D}=w,O=y===void 0&&!T,k;t[12]!==y||t[13]!==D?(k=y?ut(y,[...D]):[],t[12]=y,t[13]=D,t[14]=k):k=t[14];let A=k,j;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==x?(j=a?(0,Z.jsx)(m,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(x),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Z.jsx)(tt,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=x,t[19]=j):j=t[19];let M=O?`resolving`:`installed`,N=O?`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`,P;t[20]===N?P=t[21]:(P=f(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,N),t[20]=N,t[21]=P);let F;t[22]!==A||t[23]!==E||t[24]!==O?(F=E?(0,Z.jsx)(l,{id:`b4itZn`}):O?(0,Z.jsx)(l,{id:`iKvAeG`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{id:`eQkgKV`}),(0,Z.jsx)(p,{hosts:A,className:`text-muted-foreground`})]}),t[22]=A,t[23]=E,t[24]=O,t[25]=F):F=t[25];let I;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ke,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[26]=I):I=t[26];let L;t[27]!==E||t[28]!==F||t[29]!==M||t[30]!==P?(L=(0,Z.jsx)(Ie,{asChild:!0,children:(0,Z.jsxs)(m,{variant:`outline`,size:`sm`,disabled:E,"data-testid":`skill-install-menu-trigger`,"data-state":M,className:P,children:[F,I]})}),t[27]=E,t[28]=F,t[29]=M,t[30]=P,t[31]=L):L=t[31];let R;t[32]!==c||t[33]!==x?(R=e=>c.requestForkResolve(x,e),t[32]=c,t[33]=x,t[34]=R):R=t[34];let z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>C(!1),t[35]=z):z=t[35];let B;t[36]!==x||t[37]!==R||t[38]!==w?(B=(0,Z.jsx)(ze,{align:`end`,className:$e,children:(0,Z.jsx)(Ye,{toggles:w,skill:x,onResolveFork:R,onRunStart:z})}),t[36]=x,t[37]=R,t[38]=w,t[39]=B):B=t[39];let V;t[40]!==S||t[41]!==L||t[42]!==B?(V=(0,Z.jsxs)(Be,{modal:!1,open:S,onOpenChange:C,children:[L,B]}),t[40]=S,t[41]=L,t[42]=B,t[43]=V):V=t[43];let H;return t[44]!==c.dialogs||t[45]!==V||t[46]!==j?(H=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[j,V,c.dialogs]}),t[44]=c.dialogs,t[45]=V,t[46]=j,t[47]=H):H=t[47],H}var xr=`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 Sr(e){let t=(0,$.c)(24),{value:n,onSelect:r,disabled:i}=e,a=(0,Q.useId)(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Le,{children:(0,Z.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,Z.jsx)(l,{id:`ZWyHmq`}),t[3]=c):c=t[3];let u;t[4]!==a||t[5]!==i?(u=(0,Z.jsx)(Fe,{value:`project`,disabled:i,onSelect:wr,"aria-describedby":a,className:xr,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,Z.jsx)(l,{id:`ImTzPZ`}),t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==i?(f=(0,Z.jsx)(Fe,{value:`global`,disabled:i,onSelect:Cr,"aria-describedby":a,className:xr,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,Z.jsxs)(je,{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,Z.jsx)(l,{id:`9x-lMu`}):(0,Z.jsx)(l,{id:`AyKwqp`}),t[16]=n,t[17]=m);let h;t[18]!==a||t[19]!==m?(h=(0,Z.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,Z.jsxs)(Z.Fragment,{children:[o,p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Cr(e){return e.preventDefault()}function wr(e){return e.preventDefault()}function Tr(e){let t=(0,$.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 p=d,v;t[4]===r?v=t[5]:(v=f(`relative`,r),t[4]=r,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(at,{}),t[6]=y):y=t[6];let b;t[7]!==c||t[8]!==o?(b=c?(0,Z.jsx)(wt,{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]=b):b=t[9];let x;t[10]===b?x=t[11]:(x=(0,Z.jsxs)(h,{children:[y,b]}),t[10]=b,t[11]=x);let S;t[12]!==p||t[13]!==n||t[14]!==v||t[15]!==x?(S=(0,Z.jsx)(m,{variant:`ghost`,size:`icon`,"aria-label":p,onClick:n,"data-testid":`add-properties-button`,className:v,asChild:!0,children:x}),t[12]=p,t[13]=n,t[14]=v,t[15]=x,t[16]=S):S=t[16];let C;t[17]!==c||t[18]!==a?(C=(0,Z.jsx)(g,{side:`bottom`,children:c?(0,Z.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:(0,Z.jsx)(l,{id:`AwrGuz`})}),a?.map(Er),(0,Z.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Z.jsx)(l,{id:`yh5-4s`})})]}):(0,Z.jsx)(l,{id:`81H_23`})}),t[17]=c,t[18]=a,t[19]=C):C=t[19];let w;return t[20]!==S||t[21]!==C?(w=(0,Z.jsxs)(_,{children:[S,C]}),t[20]=S,t[21]=C,t[22]=w):w=t[22],w}function Er(e,t){return(0,Z.jsx)(`span`,{className:`opacity-90`,children:e},t)}export{jn as A,ln as C,On as D,Sn as E,cn as M,fn as O,pn as S,mn as T,In as _,gr as a,hn as b,lr as c,Wn as d,Jn as f,Fn as g,Ln as h,vr as i,sn as j,En as k,sr as l,zn as m,Sr as n,_r as o,Vn as p,br as r,hr as s,Tr as t,Kn as u,Nn as v,un as w,dn as x,Mn as y};
|
|
2
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Dr as r,Or as i,i as a,it as o,rn as s}from"./DocumentContext-DW2Sgfp0.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{t as f}from"./utils-CPqDy6Hr.js";import{n as p}from"./AgentIconCluster-mIIoSODi.js";import{t as m}from"./button-Cym3gapE.js";import{i as h,n as g,t as _}from"./tooltip-BnyyQDRs.js";import{a as v,c as y,i as b,o as x,r as S,s as C,t as w}from"./dialog-DgIQr9zS.js";import{t as T}from"./alert-dialog-CrZSZ5Zj.js";import{t as E}from"./label-D-K3fWtj.js";import{a as D,f as O,i as k,o as A,t as j,y as M}from"./RegisteredAgentIcon-D2Kzp4_r.js";import{Cn as N,En as P,Gn as F,Gs as I,Hn as L,Hs as R,It as z,Nc as B,Qn as V,Un as H,Wn as U,Ws as ee,Xn as te,Xs as W,Yn as G,Zn as ne,dc as K,hn as q,ht as re,la as J,lc as Y,mt as ie,oc as ae,qn as oe,uc as se,wn as ce}from"./dist-CyWcc58M.js";import{n as X}from"./dist-CJhtNlOm2.js";import{a as le}from"./use-settings-route-D7psIUas.js";import{t as ue}from"./dist-Cr4-nBVI.js";import{d as de,h as fe,m as pe,n as me,p as he,r as ge,u as _e}from"./documents-events-D_K3dHNa.js";import{a as ve,r as ye}from"./local-menu-action-bus-4I1Xm40D.js";import{i as be}from"./use-apply-config-theme-DpLdjUDN.js";import{t as xe}from"./parse-api-error-BtEdpaFC.js";import{n as Se,t as Ce}from"./OpenInAgentMenuItem-B-A26xF4.js";import{n as we,t as Te}from"./workspace-paths-Dczkx4vn.js";import{n as Ee}from"./use-workspace-BY7Os3yY.js";import{t as De}from"./createLucideIcon-B6ULg5PN.js";import{t as Oe}from"./arrow-up-right-B3B9a7te.js";import{t as ke}from"./chevron-down-Dloks0wp.js";import{a as Ae,c as je,d as Me,f as Ne,i as Pe,l as Fe,m as Ie,o as Le,p as Re,r as ze,t as Be,u as Ve}from"./dropdown-menu-SORDKiaq.js";import{_ as He,c as Ue,d as We,f as Ge,g as Ke,l as qe,m as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et,y as tt}from"./SkillInstallMenu-vK6OSpiK.js";import{n as nt,r as rt}from"./ManagedArtifactProperties-CPB8QDOa.js";import{t as it}from"./folder-open-dlosmFj2.js";import{t as at}from"./list-plus-BmoxCvSM.js";import{t as ot}from"./sparkles-CKoBZZKl.js";import{t as st}from"./trash-2-B9Flu-41.js";import{l as ct,u as lt}from"./navigation-targets-Fxss68va.js";import{a as ut,o as dt,p as ft}from"./skill-scope-N9lA7J2A.js";import{L as pt,N as mt,T as ht,a as gt,b as _t,h as vt,n as yt,r as bt,t as xt,w as St}from"./skills-api-t8N6VdpP.js";import{t as Ct}from"./input-f41fkc3m.js";import{t as wt}from"./badge-Dk9RrOMI.js";import{t as Tt}from"./use-skills-Drb1FGEU.js";import{t as Et}from"./use-open-skill-DzszCWzx.js";import{c as Dt,d as Ot,f as kt,l as At,n as jt,o as Mt,s as Nt,u as Pt}from"./terminal-cli-display-BNnRIpgq.js";import{n as Ft}from"./clipboard-adapter-Tb7FST8m.js";import{n as It}from"./platform-labels-fd-fQwYV.js";var Z=n(),Q=e(c(),1),$=d();function Lt(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 Rt(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=xe(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:ue._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:ue._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??ue._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function zt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Lt(e):Rt()}var Bt=`ok:skill:cowork:installed`,Vt=`1`,Ht=250,Ut=`/api/skill/install-state`;function Wt(e){return`${Bt}:v${e}`}var Gt=new Map;async function Kt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Gt.get(n);if(r)return r;let i=qt(e,t);return Gt.set(n,i),i.finally(()=>{Gt.get(n)===i&&Gt.delete(n)}),i}async function qt(e,t){let n=e.installer===void 0?zt():e.installer,r=Jt(e.storage),i=e.fetchSnapshot??Xt,a=e.serverTimeoutMs??Ht,o=null;if(!t.force){try{o=await Zt(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=Wt(o?.currentVersion??e.fallbackSkillVersion??Yt());if(!t.force&&r?.getItem(s)===Vt)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,Vt)}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 Jt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Yt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Xt(){let e;try{e=await fetch(Ut,{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 Zt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Qt(e){return Kt({},e)}function $t(){return Kt({},{force:!0})}async function en(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 tn(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return en({target:`claude-cowork`,url:N({mode:`cowork`},e)},n);case`claude-code`:return en({target:`claude-code`,url:N({mode:`code`},e)},n);case`codex`:return en({target:`codex`,url:ce(e)},n);case`cursor`:return en({target:`cursor`,url:P(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 nn(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 rn=`open-knowledge:agent-thread-launch`;function an(e){let{agentSource:t,agentId:n,prompt:r,docName:i,titleHint:a}=e;return{kind:`agent-thread`,agentSource:t,agentId:n,prompt:r,docName:i,titleHint:a}}function on(e,t){let n=new Set(Object.keys(t));for(let[t,r]of Object.entries(e)){if(n.has(t))continue;let e=Array.isArray(r)?r.length:r==null?0:1;e>0&&console.warn(`[agent-threads] the note-window launch channel carries no ${t} — dropping`,e,`value(s) from the forwarded launch`)}}function sn(e,t=typeof window>`u`?new EventTarget:window){let n=an(e);if(ve(n,t)){on(e,n);return}t.dispatchEvent(new CustomEvent(rn,{detail:e}))}function cn(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(rn,n),()=>t.removeEventListener(rn,n)}function ln(e){if(!e.docName||!e.workspace)return null;let t=Te(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:we(n,t,r)}}function un(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function dn(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,...e.attachments!==void 0&&e.attachments.length>0?{attachments:e.attachments}:{},projectDir:e.workspace.contentDir,docPath:``}:null}function fn(e){return Se(e.installUrl).then(()=>void 0)}function pn(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function mn(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function hn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace,r=e.attachments!==void 0&&e.attachments.length>0?{attachments:e.attachments}:{};if(e.docName){let i=e.docRelativePath??Te(e.docName),a={scope:`doc`,docRelativePath:i,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?a:{...a,selection:e.selection},...r,projectDir:t,docPath:we(t,i,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},...r,projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},...r,projectDir:t,docPath:``}}function gn(e){return`Opened in ${e}.`}function _n(e,t=1){return t>=3?ue._({id:`bi2C2s`,values:{displayName:e}}):t===2?ue._({id:`1J0c0X`,values:{displayName:e}}):ue._({id:`Xs7IcT`,values:{displayName:e}})}function vn(e){return e>=3?null:e===2?ue._({id:`Xp94R1`}):ue._({id:`6gRgw8`})}function yn(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 bn(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 xn(e,t,n,r){return e.compose?q(bn(e.compose,t,n,r)):e.selection?G({...e.selection,target:t,transport:r}):e.skill?te(e.skill.name,e.skill.scope,n):e.ask?L(e.ask.relativePath,e.ask.instruction,n,t,r):J(e.docContext===null?e.folderRelativePath?oe(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?U(n,e.instruction,r):H(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):F(e.docContext.relativePath,n,e.instruction,r))}function Sn(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?`${ie} ${xn(e,Y[t].handoffTarget,!1,`terminal`)}`:ne(e.docContext?.relativePath??null)}function Cn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||t?`${re} ${xn(e,`claude-code`,!1,`terminal`)}`:V(e.docContext?.relativePath??null)}function wn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function Tn(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 En(e,t){sn({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:Cn(e),docName:wn(e),titleHint:Tn(e),attachments:e.attachments??null})}async function Dn(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(ue._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(ue._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(ue._({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:xn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=yn(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(gn(u));else{let i=vn(r),a=_n(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Dn(e,t,n,r+1)}}})}return a}function On(e){return ae.find(t=>t.id===e)?.displayName??e}function kn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function An(){return{dispatchHandoff:tn,recordHandoff:nn,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>kn(),getDisplayName:On,ensureCoworkSkillInstalled:Qt,autoOpen:!0}}function jn(){let e=(0,$.c)(2),{merged:t}=be(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>Dn(e,t,{...An(),autoOpen:n}),reinstallCoworkSkill:$t},e[0]=n,e[1]=r),r}var Mn=De(`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`}]]),Nn=De(`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`}]]),Pn=De(`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 Fn(e){let t=(0,$.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(l,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function In(e){let t=(0,$.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(l,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Ln(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(l,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function Rn(e){return e?ue._({id:`wTcjov`}):null}function zn(e){let t=(0,$.c)(48),{_:n}=u(),r=o(),i=Ke(),a=M(),s=O();if(r)return null;let{input:c,installStates:d,dispatch:f,onBeforeLaunch:p}=e,m=c===null,h,g,_,v,y,b,x,S,C,w,T;if(t[0]!==n||t[1]!==f||t[2]!==c||t[3]!==m||t[4]!==d||t[5]!==p||t[6]!==s||t[7]!==a||t[8]!==i){let e=Rn(m),r;t[20]!==d||t[21]!==s?(r=e=>k(s,e.id,d[e.id]?.installed),t[20]=d,t[21]=s,t[22]=r):r=t[22];let o=K.filter(r),u;t[23]===s?u=t[24]:(u=e=>D(s,e.source,e.id,!0,e.supported),t[23]=s,t[24]=u);let E=a.filter(u),O=i?se.filter(e=>A(s,e,i.installedClis)):[];_=o.length>0,v=i!==null&&O.length>0,y=E.length>0,g=Me,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsxs)(Re,{children:[(0,Z.jsx)(ot,{"aria-hidden":`true`}),(0,Z.jsx)(l,{id:`O7_W_a`})]}),t[25]=T):T=t[25],h=Ne,b=`max-h-80`,x=y?(0,Z.jsxs)(Pe,{"aria-label":n({id:`RXEbZy`}),children:[(0,Z.jsx)(Le,{children:(0,Z.jsx)(l,{id:`RXEbZy`})}),E.map(t=>{let r=t.name;return(0,Z.jsxs)(Ae,{onSelect:()=>{c!==null&&(p?.(),En(c,{agent:{source:t.source,id:t.id}}))},disabled:m,"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,Z.jsx)(j,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==_||t[27]!==v||t[28]!==y?(S=y&&(v||_)?(0,Z.jsx)(Ve,{}):null,t[26]=_,t[27]=v,t[28]=y,t[29]=S):S=t[29],C=v?(0,Z.jsxs)(Pe,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Le,{children:(0,Z.jsx)(l,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=Y[t];return(0,Z.jsxs)(Ae,{onSelect:()=>{c!==null&&(p?.(),i.launchInTerminal(c,t))},disabled:m,"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,Z.jsx)(Ce,{id:jt(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,w=_?(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(Ve,{}):null,(0,Z.jsxs)(Pe,{"aria-label":n({id:`BwKH4d`}),children:[(0,Z.jsxs)(Le,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(l,{id:`BwKH4d`}),(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3`})]}),o.map(t=>{let r=!m,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Z.jsxs)(Ae,{disabled:!r,onSelect:()=>{if(c){if(p?.(),d[t.id]?.installed!==!0){fn(t);return}f(t.id,c)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ce,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Fn,{displayName:i})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=f,t[2]=c,t[3]=m,t[4]=d,t[5]=p,t[6]=s,t[7]=a,t[8]=i,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T}else h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19];let E;t[30]!==_||t[31]!==v||t[32]!==y?(E=y||v||_?(0,Z.jsx)(Ve,{}):null,t[30]=_,t[31]=v,t[32]=y,t[33]=E):E=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ye,{"aria-hidden":`true`}),t[34]=N):N=t[34];let P;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(Ae,{onSelect:le,"data-testid":`file-tree-open-in-settings`,children:[N,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(l,{id:`jRAGrQ`})})]}),t[35]=P):P=t[35];let F;t[36]!==h||t[37]!==b||t[38]!==x||t[39]!==S||t[40]!==C||t[41]!==w||t[42]!==E?(F=(0,Z.jsxs)(h,{className:b,children:[x,S,C,w,E,P]}),t[36]=h,t[37]=b,t[38]=x,t[39]=S,t[40]=C,t[41]=w,t[42]=E,t[43]=F):F=t[43];let I;return t[44]!==g||t[45]!==T||t[46]!==F?(I=(0,Z.jsxs)(g,{children:[T,F]}),t[44]=g,t[45]=T,t[46]=F,t[47]=I):I=t[47],I}function Bn(e){return e?ue._({id:`wTcjov`}):null}function Vn(e){let t=(0,$.c)(47),{_:n}=u(),r=o(),i=Ke(),a=M(),s=O();if(r)return null;let{input:c,installStates:d,dispatch:f}=e,p=c===null,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==n||t[1]!==f||t[2]!==c||t[3]!==p||t[4]!==d||t[5]!==s||t[6]!==a||t[7]!==i){let e=Bn(p),r;t[19]!==d||t[20]!==s?(r=e=>k(s,e.id,d[e.id]?.installed),t[19]=d,t[20]=s,t[21]=r):r=t[21];let o=K.filter(r),u;t[22]===s?u=t[23]:(u=e=>D(s,e.source,e.id,!0,e.supported),t[22]=s,t[23]=u);let T=a.filter(u),E=i?se.filter(e=>A(s,e,i.installedClis)):[];g=o.length>0,_=i!==null&&E.length>0,v=T.length>0,h=Pt,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(ot,{"aria-hidden":`true`}),(0,Z.jsx)(l,{id:`O7_W_a`})]}),t[24]=w):w=t[24],m=Ot,y=`max-h-80`,b=v?(0,Z.jsxs)(Mt,{"aria-label":n({id:`RXEbZy`}),children:[(0,Z.jsx)(Dt,{children:(0,Z.jsx)(l,{id:`RXEbZy`})}),T.map(t=>{let r=t.name;return(0,Z.jsxs)(Nt,{onSelect:()=>{c!==null&&En(c,{agent:{source:t.source,id:t.id}})},disabled:p,"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,Z.jsx)(j,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==g||t[26]!==_||t[27]!==v?(x=v&&(_||g)?(0,Z.jsx)(At,{}):null,t[25]=g,t[26]=_,t[27]=v,t[28]=x):x=t[28],S=_?(0,Z.jsxs)(Mt,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Dt,{children:(0,Z.jsx)(l,{id:`ALhMYW`})}),E.map(t=>{let{displayName:r}=Y[t];return(0,Z.jsxs)(Nt,{onSelect:()=>{c!==null&&i.launchInTerminal(c,t)},disabled:p,"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,Z.jsx)(Ce,{id:jt(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,C=g?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(At,{}):null,(0,Z.jsxs)(Mt,{"aria-label":n({id:`BwKH4d`}),children:[(0,Z.jsxs)(Dt,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(l,{id:`BwKH4d`}),(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3`})]}),o.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Z.jsxs)(Nt,{disabled:!r,onSelect:()=>{if(c){if(d[t.id]?.installed!==!0){fn(t);return}f(t.id,c)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ce,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Fn,{displayName:i})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=f,t[2]=c,t[3]=p,t[4]=d,t[5]=s,t[6]=a,t[7]=i,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w}else m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18];let T;t[29]!==g||t[30]!==_||t[31]!==v?(T=v||_||g?(0,Z.jsx)(At,{}):null,t[29]=g,t[30]=_,t[31]=v,t[32]=T):T=t[32];let E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ye,{"aria-hidden":`true`}),t[33]=E):E=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Nt,{onSelect:le,"data-testid":`empty-space-open-in-settings`,children:[E,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(l,{id:`jRAGrQ`})})]}),t[34]=N):N=t[34];let P;t[35]!==m||t[36]!==y||t[37]!==b||t[38]!==x||t[39]!==S||t[40]!==C||t[41]!==T?(P=(0,Z.jsxs)(m,{className:y,children:[b,x,S,C,T,N]}),t[35]=m,t[36]=y,t[37]=b,t[38]=x,t[39]=S,t[40]=C,t[41]=T,t[42]=P):P=t[42];let F;return t[43]!==h||t[44]!==w||t[45]!==P?(F=(0,Z.jsxs)(h,{children:[w,P]}),t[43]=h,t[44]=w,t[45]=P,t[46]=F):F=t[46],F}var Hn=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Un(e){let t=I(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=R(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=ee(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=Hn.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Wn(e,t,n){return e.filter(e=>{let r=s(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=Un(r.docName);return i?.scope===t&&i.name===n})}function Gn(e,t,n){let r=ct(t,n);return e.filter(e=>{let i=s(e);return i.kind===`skill-file`?i.scope===t.scope&&i.name===t.name&&i.path===n:i.kind===`doc`&&i.docName===r})}function Kn(e,t,n){let r=Un(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 ct(i,a)===e?{skill:i,filePath:a}:null}function qn(e,t,n=(e,t)=>he(e,t)||pe(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=Un(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Un(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:lt(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:lt(s)})):i.push({kind:`close`,docName:t}))}return i}function Jn(){let e=(0,$.c)(15),{openTabs:t,closeDocument:n}=a(),r=nt(),i;e[0]===t?i=e[1]:(i=t.some(Xn),e[0]=t,e[1]=i);let o=i,s;e[2]===o?s=e[3]:(s={enabled:o},e[2]=o,e[3]=s);let c=Tt(s),l=(0,Q.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(Yn).sort().join(``)}\u0002${fe()}`;if(l.current===i)return;l.current=i;let a=qn(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,Q.useEffect)(u,d)}function Yn(e){return`${e.scope}\u0000${e.name}`}function Xn(e){return Un(e)!==null}function Zn(e){let t=(0,$.c)(18),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:o}=u(),{closeTabs:s,openTabs:c}=a(),[l,d]=(0,Q.useState)(!1),f;t[0]!==o||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==c?(f=async function(e){d(!0);let t=await yt(e.scope,e.name,e.hostQualifier);if(d(!1),!t.ok){let{error:e}=t;X.error(o({id:`AtBdnD`,values:{error:e}}));return}let n=o({id:`h9QFb9`,values:{0:e.name}});t.warnings.length>0?X.warning(n,{description:t.warnings.join(` `),duration:3e4}):X.success(n),s(Wn(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=o,t[1]=s,t[2]=i,t[3]=r,t[4]=c,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==l||t[7]!==r?(h=e=>{!e&&!l&&r(!1)},t[6]=l,t[7]=r,t[8]=h):h=t[8];let g;t[9]!==o||t[10]!==l||t[11]!==p||t[12]!==n?(g=n?(0,Z.jsx)(Je,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?o({id:`WnsbUT`,values:{0:n.path}}):o({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=o,t[10]=l,t[11]=p,t[12]=n,t[13]=g):g=t[13];let _;return t[14]!==m||t[15]!==h||t[16]!==g?(_=(0,Z.jsx)(T,{open:m,onOpenChange:h,children:g}),t[14]=m,t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function Qn(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 $n(e){if(/\s/.test(e))return ue._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?ue._({id:`Zt7Ktx`}):t.some(e=>e===``)?ue._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?ue._({id:`yJkw6t`}):Qn(e)?null:ue._({id:`oP-FQW`})}function er(e){let t=(0,$.c)(70),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:o}=a(),s=(0,Q.useId)(),[c,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),h;t[0]===n?h=t[1]:(h=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=h);let g=n?.skill.scope,_=n?.skill.name,S=n?.prefix,T;if(t[2]!==g||t[3]!==_||t[4]!==S?(T=[g,_,S],t[2]=g,t[3]=_,t[4]=S,t[5]=T):T=t[5],(0,Q.useEffect)(h,T),!n)return null;let D,O,k,A,j,M;if(t[6]!==c||t[7]!==f){M=c.trim(),k=M===``||M.endsWith(`/`),A=k?null:$n(M),D=!(k||A!==null)&&!f,O=M.includes(`/`)?M.split(`/`).slice(0,-1).join(`/`):null;let e=M.split(`/`).pop()??``;j=e!==``&&!e.includes(`.`)?`${M}.md`:M,t[6]=c,t[7]=f,t[8]=D,t[9]=O,t[10]=k,t[11]=A,t[12]=j,t[13]=M}else D=t[8],O=t[9],k=t[10],A=t[11],j=t[12],M=t[13];let N=j,P;t[14]!==i||t[15]!==D||t[16]!==N||t[17]!==r||t[18]!==o||t[19]!==n?(P=async function(){if(!n||!D)return;p(!0);let e=/\.mdx?$/i.test(N),t=await pt({scope:n.skill.scope,name:n.skill.name,path:N,content:e?`# ${N.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){X.error(i({id:`DvGkXq`,values:{0:t.error,effective:N}}));return}if(X.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=ct(n.skill,N);o({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=D,t[16]=N,t[17]=r,t[18]=o,t[19]=n,t[20]=P):P=t[20];let F=P,I;t[21]!==r||t[22]!==f?(I=e=>{!e&&!f&&r(!1)},t[21]=r,t[22]=f,t[23]=I):I=t[23];let L;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`wQvvZY`})}),t[24]=L):L=t[24];let R;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(C,{children:[L,(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`lM4c-I`})})]}),t[25]=R):R=t[25];let z;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(l,{id:`I6gXOa`}),t[26]=z):z=t[26];let B;t[27]===s?B=t[28]:(B=(0,Z.jsx)(E,{htmlFor:s,children:z}),t[27]=s,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>d(e.target.value),t[29]=V):V=t[29];let H=A!==null,U;t[30]===F?U=t[31]:(U=e=>{e.key===`Enter`&&F()},t[30]=F,t[31]=U);let ee;t[32]!==s||t[33]!==c||t[34]!==H||t[35]!==U?(ee=(0,Z.jsx)(Ct,{id:s,value:c,onChange:V,placeholder:`references/notes.md`,"aria-invalid":H,onKeyDown:U}),t[32]=s,t[33]=c,t[34]=H,t[35]=U,t[36]=ee):ee=t[36];let te;t[37]!==N||t[38]!==O||t[39]!==k||t[40]!==A||t[41]!==M?(te=A===null?k&&M!==``?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`Vy6XCg`})}):N===M?O?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`9lso1Y`,values:{folderPart:O},components:{0:(0,Z.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null:(0,Z.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`zC5jrM`,values:{effective:N},components:{0:(0,Z.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-destructive text-xs`,children:A}),t[37]=N,t[38]=O,t[39]=k,t[40]=A,t[41]=M,t[42]=te):te=t[42];let W;t[43]!==B||t[44]!==ee||t[45]!==te?(W=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[B,ee,te]}),t[43]=B,t[44]=ee,t[45]=te,t[46]=W):W=t[46];let G;t[47]===r?G=t[48]:(G=()=>r(!1),t[47]=r,t[48]=G);let ne;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(l,{id:`dEgA5A`}),t[49]=ne):ne=t[49];let K;t[50]!==f||t[51]!==G?(K=(0,Z.jsx)(m,{variant:`outline`,onClick:G,disabled:f,children:ne}),t[50]=f,t[51]=G,t[52]=K):K=t[52];let q;t[53]===F?q=t[54]:(q=()=>void F(),t[53]=F,t[54]=q);let re=!D,J;t[55]===f?J=t[56]:(J=f?(0,Z.jsx)(l,{id:`E9bKSA`}):(0,Z.jsx)(l,{id:`hYgDIe`}),t[55]=f,t[56]=J);let Y;t[57]!==q||t[58]!==re||t[59]!==J?(Y=(0,Z.jsx)(m,{onClick:q,disabled:re,children:J}),t[57]=q,t[58]=re,t[59]=J,t[60]=Y):Y=t[60];let ie;t[61]!==K||t[62]!==Y?(ie=(0,Z.jsxs)(x,{children:[K,Y]}),t[61]=K,t[62]=Y,t[63]=ie):ie=t[63];let ae;t[64]!==W||t[65]!==ie?(ae=(0,Z.jsxs)(b,{className:`sm:max-w-md`,children:[R,W,ie]}),t[64]=W,t[65]=ie,t[66]=ae):ae=t[66];let oe;return t[67]!==ae||t[68]!==I?(oe=(0,Z.jsx)(w,{open:!0,onOpenChange:I,children:ae}),t[67]=ae,t[68]=I,t[69]=oe):oe=t[69],oe}function tr(e){let t=(0,$.c)(17),{target:n,onOpenChange:r}=e,{_:i}=u(),{closeTabs:o,openTabs:s}=a(),[c,l]=(0,Q.useState)(!1),d;t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==s?(d=async function(e){let{skill:t,filePath:n}=e;l(!0);let a=await bt({scope:t.scope,name:t.name,path:n});if(l(!1),!a.ok){X.error(i({id:`CBT70t`,values:{0:a.error}}));return}if(!a.existed){X.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}X.success(i({id:`gOmloS`,values:{filePath:n}})),o(Gn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=o,t[2]=r,t[3]=s,t[4]=d):d=t[4];let f=d,p=n!==null,m;t[5]!==c||t[6]!==r?(m=e=>{!e&&!c&&r(!1)},t[5]=c,t[6]=r,t[7]=m):m=t[7];let h;t[8]!==i||t[9]!==c||t[10]!==f||t[11]!==n?(h=n?(0,Z.jsx)(Je,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:c,onDelete:()=>f(n),customDescription:i({id:`ppzof_`,values:{0:dt(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,Z.jsx)(T,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function nr(e){let t=(0,$.c)(64),{target:n,onOpenChange:r}=e,{_:i}=u(),a=nt(),o=(0,Q.useId)(),[s,c]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let h=n?.skill.scope,g=n?.skill.name,_=n?.filePath,S;if(t[2]!==h||t[3]!==g||t[4]!==_?(S=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=S):S=t[5],(0,Q.useEffect)(p,S),!n)return null;let T,D,O;t[6]!==s||t[7]!==n.filePath?(D=s.trim(),O=D===n.filePath,T=D===``||!Qn(D),t[6]=s,t[7]=n.filePath,t[8]=T,t[9]=D,t[10]=O):(T=t[8],D=t[9],O=t[10]);let k=T,A=!k&&!O&&!d,j;t[11]!==i||t[12]!==A||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==D?(j=async function(){if(!n||!A)return;f(!0);let e=await ht({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:D});if(f(!1),!e.ok){X.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),X.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=A,t[13]=r,t[14]=a,t[15]=n,t[16]=D,t[17]=j):j=t[17];let M=j,N;t[18]!==r||t[19]!==d?(N=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=N):N=t[20];let P;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`yckias`})}),t[21]=P):P=t[21];let F;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(C,{children:[P,(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`HzVAoz`})})]}),t[22]=F):F=t[22];let I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(l,{id:`I6gXOa`}),t[23]=I):I=t[23];let L;t[24]===o?L=t[25]:(L=(0,Z.jsx)(E,{htmlFor:o,children:I}),t[24]=o,t[25]=L);let R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>c(e.target.value),t[26]=R):R=t[26];let z=k&&D!==``,B;t[27]===M?B=t[28]:(B=e=>{e.key===`Enter`&&M()},t[27]=M,t[28]=B);let V;t[29]!==o||t[30]!==s||t[31]!==z||t[32]!==B?(V=(0,Z.jsx)(Ct,{id:o,value:s,onChange:R,"aria-invalid":z,onKeyDown:B}),t[29]=o,t[30]=s,t[31]=z,t[32]=B,t[33]=V):V=t[33];let H;t[34]!==k||t[35]!==D?(H=k&&D!==``?(0,Z.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Z.jsx)(l,{id:`fVzizW`})}):null,t[34]=k,t[35]=D,t[36]=H):H=t[36];let U;t[37]!==L||t[38]!==V||t[39]!==H?(U=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[L,V,H]}),t[37]=L,t[38]=V,t[39]=H,t[40]=U):U=t[40];let ee;t[41]===r?ee=t[42]:(ee=()=>r(!1),t[41]=r,t[42]=ee);let te;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(l,{id:`dEgA5A`}),t[43]=te):te=t[43];let W;t[44]!==d||t[45]!==ee?(W=(0,Z.jsx)(m,{variant:`outline`,onClick:ee,disabled:d,children:te}),t[44]=d,t[45]=ee,t[46]=W):W=t[46];let G;t[47]===M?G=t[48]:(G=()=>void M(),t[47]=M,t[48]=G);let ne=!A,K;t[49]===d?K=t[50]:(K=d?(0,Z.jsx)(l,{id:`tHKQ6j`}):(0,Z.jsx)(l,{id:`2wxgft`}),t[49]=d,t[50]=K);let q;t[51]!==G||t[52]!==ne||t[53]!==K?(q=(0,Z.jsx)(m,{onClick:G,disabled:ne,children:K}),t[51]=G,t[52]=ne,t[53]=K,t[54]=q):q=t[54];let re;t[55]!==W||t[56]!==q?(re=(0,Z.jsxs)(x,{children:[W,q]}),t[55]=W,t[56]=q,t[57]=re):re=t[57];let J;t[58]!==U||t[59]!==re?(J=(0,Z.jsxs)(b,{className:`sm:max-w-md`,children:[F,U,re]}),t[58]=U,t[59]=re,t[60]=J):J=t[60];let Y;return t[61]!==J||t[62]!==N?(Y=(0,Z.jsx)(w,{open:!0,onOpenChange:N,children:J}),t[61]=J,t[62]=N,t[63]=Y):Y=t[63],Y}function rr(e){let t=(0,$.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=rt(),s=n!==null,c=(0,Q.useId)(),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),h;t[0]===n?h=t[1]:(h=()=>{n&&d(n.name)},t[0]=n,t[1]=h);let g=n?.scope,_=n?.name,S;if(t[2]!==g||t[3]!==_?(S=[g,_],t[2]=g,t[3]=_,t[4]=S):S=t[4],(0,Q.useEffect)(h,S),!n)return null;let T,D,O,k,A,j;if(t[5]!==r||t[6]!==u||t[7]!==n.name){A=u.trim(),j=A===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),T=i,k=A.length>64,D=A===``||!z.test(A)||k,O=!D&&!j&&r.has(A),t[5]=r,t[6]=u,t[7]=n.name,t[8]=T,t[9]=D,t[10]=O,t[11]=k,t[12]=A,t[13]=j}else T=t[8],D=t[9],O=t[10],k=t[11],A=t[12],j=t[13];let M=O,N=!D&&!M&&!j&&!f,P;t[17]!==N||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==A?(P=async function(){if(!n||!N)return;p(!0);let e=await o({scope:n.scope,name:n.name},A);p(!1),e.ok&&(a?.(A),i(!1))},t[17]=N,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=A,t[23]=P):P=t[23];let F=P,I;t[24]===i?I=t[25]:(I=e=>e?null:i(!1),t[24]=i,t[25]=I);let L;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`dw_3cv`})}),t[26]=L):L=t[26];let R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(C,{children:[L,(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`R9IDFz`})})]}),t[27]=R):R=t[27];let B;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(l,{id:`6YtxFj`}),t[28]=B):B=t[28];let V;t[29]===c?V=t[30]:(V=(0,Z.jsx)(E,{htmlFor:c,children:B}),t[29]=c,t[30]=V);let H;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>d(e.target.value),t[31]=H):H=t[31];let U;t[32]===F?U=t[33]:(U=e=>{e.key===`Enter`&&F()},t[32]=F,t[33]=U);let ee=D||M,te=D&&A!==``||M?`${c}-error`:void 0,W;t[34]!==c||t[35]!==u||t[36]!==U||t[37]!==ee||t[38]!==te?(W=(0,Z.jsx)(Ct,{id:c,value:u,onChange:H,onKeyDown:U,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":ee,"aria-describedby":te,className:`font-mono`}),t[34]=c,t[35]=u,t[36]=U,t[37]=ee,t[38]=te,t[39]=W):W=t[39];let G;t[40]!==M||t[41]!==T||t[42]!==c||t[43]!==D||t[44]!==k||t[45]!==A?(G=D&&A!==``?(0,Z.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:T?(0,Z.jsx)(l,{id:`iUwpZI`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}}):k?(0,Z.jsx)(l,{id:`lK9c4T`}):(0,Z.jsx)(l,{id:`A50vr3`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):M?(0,Z.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(l,{id:`YJ1BTp`})}):null,t[40]=M,t[41]=T,t[42]=c,t[43]=D,t[44]=k,t[45]=A,t[46]=G):G=t[46];let ne;t[47]!==V||t[48]!==W||t[49]!==G?(ne=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[V,W,G]}),t[47]=V,t[48]=W,t[49]=G,t[50]=ne):ne=t[50];let K;t[51]===i?K=t[52]:(K=()=>i(!1),t[51]=i,t[52]=K);let q;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(l,{id:`dEgA5A`}),t[53]=q):q=t[53];let re;t[54]!==f||t[55]!==K?(re=(0,Z.jsx)(m,{variant:`outline`,onClick:K,disabled:f,children:q}),t[54]=f,t[55]=K,t[56]=re):re=t[56];let J;t[57]===F?J=t[58]:(J=()=>void F(),t[57]=F,t[58]=J);let Y=!N,ie;t[59]===f?ie=t[60]:(ie=f?(0,Z.jsx)(l,{id:`tHKQ6j`}):(0,Z.jsx)(l,{id:`2wxgft`}),t[59]=f,t[60]=ie);let ae;t[61]!==J||t[62]!==Y||t[63]!==ie?(ae=(0,Z.jsx)(m,{onClick:J,disabled:Y,children:ie}),t[61]=J,t[62]=Y,t[63]=ie,t[64]=ae):ae=t[64];let oe;t[65]!==re||t[66]!==ae?(oe=(0,Z.jsxs)(x,{children:[re,ae]}),t[65]=re,t[66]=ae,t[67]=oe):oe=t[67];let se;t[68]!==ne||t[69]!==oe?(se=(0,Z.jsxs)(b,{children:[R,ne,oe]}),t[68]=ne,t[69]=oe,t[70]=se):se=t[70];let ce;return t[71]!==s||t[72]!==se||t[73]!==I?(ce=(0,Z.jsx)(w,{open:s,onOpenChange:I,children:se}),t[71]=s,t[72]=se,t[73]=I,t[74]=ce):ce=t[74],ce}function ir(){let e=(0,$.c)(6),{_:t}=u(),n=ft(),r=nt(),{openTabs:i}=a(),o=Tt(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==o?(s=async(e,a)=>{if(a===e.scope)return!1;ge(e.scope,e.name),me(e.scope,e.name);let s=await _t({name:e.name,fromScope:e.scope,toScope:a});if(_e(e.scope,e.name),!s.ok)return de(e.scope,e.name),X.error(t({id:`07eGJB`,values:{0:s.error}}),mt({outcome:s.outcome,name:e.name,toScope:a,scopeLabel:n[a]})),!1;X.success(t({id:`yhI6P0`,values:{0:e.name,1:n[a]}}));let c=o.status===`ready`?o.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,l=i.map(or).filter(t=>{if(t.kind!==`doc`)return!1;let n=Un(t.docName);return n?.scope===e.scope&&n.name===e.name}),u=l.find(ar)??l[0],d=u?.kind===`doc`?u.docName:c?lt(c):e.scope===`global`?W(e.scope,e.name):null,f=a===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:W(a,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return de(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s):s=e[5],s}function ar(e){return e.kind===`doc`&&Un(e.docName)?.rel===null}function or(e){return s(e)}function sr(e){let t=(0,$.c)(38),{target:n,onOpenChange:r}=e,i=ft(),a=ir(),[o,s]=(0,Q.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],h;t[3]===p?h=t[4]:(h=(0,Z.jsx)(y,{children:(0,Z.jsx)(l,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=h);let g=i[c],_=i[d],T=i[d],E;t[5]!==u||t[6]!==g||t[7]!==_||t[8]!==T?(E={0:g,1:_,2:T,name:u},t[5]=u,t[6]=g,t[7]=_,t[8]=T,t[9]=E):E=t[9];let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D={0:(0,Z.jsx)(`code`,{className:`font-mono`})},t[10]=D):D=t[10];let O;t[11]===E?O=t[12]:(O=(0,Z.jsx)(v,{children:(0,Z.jsx)(l,{id:`7bIiJ7`,values:E,components:D})}),t[11]=E,t[12]=O);let k;t[13]!==h||t[14]!==O?(k=(0,Z.jsxs)(C,{children:[h,O]}),t[13]=h,t[14]=O,t[15]=k):k=t[15];let A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(l,{id:`dEgA5A`}),t[16]=A):A=t[16];let j;t[17]===o?j=t[18]:(j=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(m,{variant:`outline`,disabled:o,children:A})}),t[17]=o,t[18]=j);let M;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==d?(M=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]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(l,{id:`QWdKwH`}),t[25]=N):N=t[25];let P;t[26]!==o||t[27]!==M?(P=(0,Z.jsx)(m,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:M,children:N}),t[26]=o,t[27]=M,t[28]=P):P=t[28];let F;t[29]!==j||t[30]!==P?(F=(0,Z.jsxs)(x,{children:[j,P]}),t[29]=j,t[30]=P,t[31]=F):F=t[31];let I;t[32]!==k||t[33]!==F?(I=(0,Z.jsxs)(b,{className:`sm:max-w-md`,children:[k,F]}),t[32]=k,t[33]=F,t[34]=I):I=t[34];let L;return t[35]!==f||t[36]!==I?(L=(0,Z.jsx)(w,{open:!0,onOpenChange:f,children:I}),t[35]=f,t[36]=I,t[37]=L):L=t[37],L}var cr=(0,Q.lazy)(async()=>({default:(await t(()=>import(`./SkillForkDialog-B8iWPj-U.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url)).SkillForkDialog}));function lr(){let e=(0,$.c)(52),{_:t}=u(),n=Et(),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),ge(e.scope,e.name);let i=await vt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(de(e.scope,e.name),y(null),!i.ok)return X.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=fr,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 X.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&X.warning(e);let t=l(`no-description`);t&&X.warning(t)}return i.hosts.length===0?X.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?X.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?X.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?X.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):X.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),ge(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await xt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){X.error(t.error);break}}de(e.scope,e.name),y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name),ge(e.scope,e.name);let n=await t();return de(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 gt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){X.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}X.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)ge(e.scope,t);y(n[0]??null);let r=await St({scope:e.scope,names:n});for(let t of n)de(e.scope,t);if(y(null),!r.ok){X.error(t({id:`nXHOFU`,values:{0:e.sourceLabel,1:r.error}}));return}let i=r.results.filter(dr),a=e.sourceLabel,o=r.updated,s=r.upToDate;if(i.length>0){let e=i.map(ur).join(`, `),n=i.length;X.warning(t({id:`AgoIW4`,values:{source:a,updated:o,upToDate:s,failed:n,detail:e}}));return}X.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,Z.jsx)(Zn,{skill:r,onOpenChange:A,onDeleted:j}),e[11]=r,e[12]=M);let N=a?.skill??null,P=a?.existingNames??mr,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,Z.jsx)(rr,{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,Z.jsx)(sr,{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,Z.jsx)(nr,{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,Z.jsx)(tr,{target:f,onOpenChange:H}),e[25]=f,e[26]=U);let ee;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>{e||h(null)},e[27]=ee):ee=e[27];let te;e[28]===m?te=e[29]:(te=(0,Z.jsx)(er,{target:m,onOpenChange:ee}),e[28]=m,e[29]=te);let W;e[30]===g?W=e[31]:(W=g?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(cr,{target:g,onOpenChange:e=>{e||_(null)}})}):null,e[30]=g,e[31]=W);let G;e[32]!==L||e[33]!==z||e[34]!==V||e[35]!==U||e[36]!==te||e[37]!==W||e[38]!==M?(G=(0,Z.jsxs)(Z.Fragment,{children:[M,L,z,V,U,te,W]}),e[32]=L,e[33]=z,e[34]=V,e[35]=U,e[36]=te,e[37]=W,e[38]=M,e[39]=G):G=e[39];let ne=G,K,q,re,J,Y,ie;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(K=(e,t)=>o({skill:e,existingNames:t}),q=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),re=(e,t)=>d({skill:e,filePath:t}),J=(e,t)=>p({skill:e,filePath:t}),Y=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),ie=(e,t)=>_({skill:e,editor:t}),e[40]=K,e[41]=q,e[42]=re,e[43]=J,e[44]=Y,e[45]=ie):(K=e[40],q=e[41],re=e[42],J=e[43],Y=e[44],ie=e[45]);let ae;return e[46]!==ne||e[47]!==D||e[48]!==x||e[49]!==v||e[50]!==k?(ae={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,updateAllFromSource:k,requestDelete:i,requestRename:K,requestScopeMove:q,requestFileRename:re,requestFileDelete:J,requestFileCreate:Y,requestForkResolve:ie,dialogs:ne},e[46]=ne,e[47]=D,e[48]=x,e[49]=v,e[50]=k,e[51]=ae):ae=e[51],ae}function ur(e){return e.error?`${e.requested} (${e.error})`:e.requested}function dr(e){return e.status===`failed`||e.status===`not-found`}function fr(e){return e.map(pr).join(`, `)}function pr(e){return B[e]??e}var mr=new Set;function hr(e){let t=(0,$.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,Z.jsx)(it,{"aria-hidden":!0}),c=It(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,Z.jsxs)(Qe,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function gr(e){let t=(0,$.c)(68),{skill:n,filePath:i,actions:a,menuKind:o}=e,s=o===void 0?`dropdown`:o,{_:c}=u(),d;t[0]!==i||t[1]!==n.absolutePath?(d=n.absolutePath?`${dt(n.absolutePath)}/${i}`:void 0,t[0]=i,t[1]=n.absolutePath,t[2]=d):d=t[2];let f=d,p;t[3]===n.path?p=t[4]:(p=dt(n.path),t[3]=n.path,t[4]=p);let m=`${p}/${i}`,h;t[5]===c?h=t[6]:(h=async function(e){try{await Ft(e),X.success(c({id:`SXCSQd`}))}catch{X.error(c({id:`cRHuuI`}))}},t[5]=c,t[6]=h);let g=h,_;t[7]!==a||t[8]!==i||t[9]!==n?(_=()=>a.requestFileRename(n,i),t[7]=a,t[8]=i,t[9]=n,t[10]=_):_=t[10];let v,y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Pn,{"aria-hidden":!0}),y=(0,Z.jsx)(l,{id:`2wxgft`}),t[11]=v,t[12]=y):(v=t[11],y=t[12]);let b;t[13]!==s||t[14]!==_?(b=(0,Z.jsxs)(Qe,{menuKind:s,onSelect:_,children:[v,y]}),t[13]=s,t[14]=_,t[15]=b):b=t[15];let x;t[16]!==f||t[17]!==s?(x=(0,Z.jsx)(hr,{absolutePath:f,menuKind:s}),t[16]=f,t[17]=s,t[18]=x):x=t[18];let S,C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(r,{"aria-hidden":!0}),C=(0,Z.jsx)(l,{id:`zd00pH`}),t[19]=S,t[20]=C):(S=t[19],C=t[20]);let w;t[21]===s?w=t[22]:(w=(0,Z.jsxs)(Ge,{menuKind:s,children:[S,C]}),t[21]=s,t[22]=w);let T;t[23]!==f||t[24]!==g||t[25]!==s?(T=f?(0,Z.jsx)(Qe,{menuKind:s,onSelect:()=>void g(f),children:(0,Z.jsx)(l,{id:`z2funE`})}):null,t[23]=f,t[24]=g,t[25]=s,t[26]=T):T=t[26];let E;t[27]!==g||t[28]!==m?(E=()=>void g(m),t[27]=g,t[28]=m,t[29]=E):E=t[29];let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(l,{id:`xloBjn`}),t[30]=D):D=t[30];let O;t[31]!==s||t[32]!==E?(O=(0,Z.jsx)(Qe,{menuKind:s,onSelect:E,children:D}),t[31]=s,t[32]=E,t[33]=O):O=t[33];let k;t[34]!==s||t[35]!==T||t[36]!==O?(k=(0,Z.jsxs)(Xe,{menuKind:s,children:[T,O]}),t[34]=s,t[35]=T,t[36]=O,t[37]=k):k=t[37];let A;t[38]!==s||t[39]!==k?(A=(0,Z.jsx)(We,{menuKind:s,children:k}),t[38]=s,t[39]=k,t[40]=A):A=t[40];let j;t[41]!==s||t[42]!==w||t[43]!==A?(j=(0,Z.jsxs)(et,{menuKind:s,children:[w,A]}),t[41]=s,t[42]=w,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==s||t[46]!==j||t[47]!==b||t[48]!==x?(M=(0,Z.jsxs)(Xe,{menuKind:s,children:[b,x,j]}),t[45]=s,t[46]=j,t[47]=b,t[48]=x,t[49]=M):M=t[49];let N;t[50]===s?N=t[51]:(N=(0,Z.jsx)(qe,{menuKind:s}),t[50]=s,t[51]=N);let P;t[52]!==a||t[53]!==i||t[54]!==n?(P=()=>a.requestFileDelete(n,i),t[52]=a,t[53]=i,t[54]=n,t[55]=P):P=t[55];let F,I;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(st,{"aria-hidden":!0}),I=(0,Z.jsx)(l,{id:`cnGeoo`}),t[56]=F,t[57]=I):(F=t[56],I=t[57]);let L;t[58]!==s||t[59]!==P?(L=(0,Z.jsxs)(Qe,{menuKind:s,variant:`destructive`,onSelect:P,children:[F,I]}),t[58]=s,t[59]=P,t[60]=L):L=t[60];let R;t[61]!==s||t[62]!==L?(R=(0,Z.jsx)(Xe,{menuKind:s,children:L}),t[61]=s,t[62]=L,t[63]=R):R=t[63];let z;return t[64]!==M||t[65]!==N||t[66]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[M,N,R]}),t[64]=M,t[65]=N,t[66]=R,t[67]=z):z=t[67],z}function _r(e){let t=(0,$.c)(42),{skill:n,actions:i,beforeDelete:a}=e,{_:o}=u(),s=Ze(n,i),c=n.absolutePath,d;t[0]===o?d=t[1]:(d=async function(e){try{await Ft(e),X.success(o({id:`SXCSQd`}))}catch{X.error(o({id:`cRHuuI`}))}},t[0]=o,t[1]=d);let f=d,p;t[2]===c?p=t[3]:(p=(0,Z.jsx)(hr,{absolutePath:c}),t[2]=c,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(Ge,{menuKind:`dropdown`,children:[(0,Z.jsx)(r,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`zd00pH`})]}),t[4]=m):m=t[4];let h;t[5]!==c||t[6]!==f?(h=c?(0,Z.jsx)(Qe,{menuKind:`dropdown`,onSelect:()=>void f(c),children:(0,Z.jsx)(l,{id:`z2funE`})}):null,t[5]=c,t[6]=f,t[7]=h):h=t[7];let g;t[8]!==f||t[9]!==n.path?(g=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(l,{id:`xloBjn`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Z.jsx)(Qe,{menuKind:`dropdown`,onSelect:g,children:_}),t[12]=g,t[13]=v);let y;t[14]!==h||t[15]!==v?(y=(0,Z.jsxs)(et,{menuKind:`dropdown`,children:[m,(0,Z.jsx)(We,{menuKind:`dropdown`,children:(0,Z.jsxs)(Xe,{menuKind:`dropdown`,children:[h,v]})})]}),t[14]=h,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==p||t[18]!==y?(b=(0,Z.jsxs)(Xe,{menuKind:`dropdown`,children:[p,y]}),t[17]=p,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(qe,{menuKind:`dropdown`}),t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsxs)(Ge,{menuKind:`dropdown`,children:[(0,Z.jsx)(Nn,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`TKQ7K-`})]}),t[21]=S):S=t[21];let C;t[22]!==i||t[23]!==n?(C=e=>i.requestForkResolve(n,e),t[22]=i,t[23]=n,t[24]=C):C=t[24];let w;t[25]!==s||t[26]!==n||t[27]!==C?(w=(0,Z.jsx)(Xe,{menuKind:`dropdown`,children:(0,Z.jsxs)(et,{menuKind:`dropdown`,children:[S,(0,Z.jsx)(We,{menuKind:`dropdown`,className:$e,children:(0,Z.jsx)(Xe,{menuKind:`dropdown`,children:(0,Z.jsx)(Ye,{toggles:s,skill:n,menuKind:`dropdown`,onResolveFork:C})})})]})}),t[25]=s,t[26]=n,t[27]=C,t[28]=w):w=t[28];let T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(qe,{menuKind:`dropdown`}),t[29]=T):T=t[29];let E;t[30]!==i||t[31]!==n?(E=()=>i.requestDelete(n),t[30]=i,t[31]=n,t[32]=E):E=t[32];let D,O;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(st,{"aria-hidden":!0}),O=(0,Z.jsx)(l,{id:`cnGeoo`}),t[33]=D,t[34]=O):(D=t[33],O=t[34]);let k;t[35]===E?k=t[36]:(k=(0,Z.jsx)(Xe,{menuKind:`dropdown`,children:(0,Z.jsxs)(Qe,{menuKind:`dropdown`,variant:`destructive`,onSelect:E,children:[D,O]})}),t[35]=E,t[36]=k);let A;return t[37]!==a||t[38]!==w||t[39]!==k||t[40]!==b?(A=(0,Z.jsxs)(Z.Fragment,{children:[b,x,w,a,T,k]}),t[37]=a,t[38]=w,t[39]=k,t[40]=b,t[41]=A):A=t[41],A}function vr(e){let t=(0,$.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Ee(),c=He().states,{dispatch:l}=jn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=mn({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,Z.jsx)(Vn,{input:f,installStates:c,dispatch:l}):(0,Z.jsx)(zn,{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,Z.jsx)(yr,{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 yr(e){let t=(0,$.c)(65),{actions:n,existingNames:a,menuKind:o,openWithAi:s,skill:c}=e,{_:d}=u(),f=ft(),p=Ze(c,n),m=c.absolutePath,h=c.hostQualifier!==void 0,g;t[0]===d?g=t[1]:(g=async function(e){try{await Ft(e),X.success(d({id:`SXCSQd`}))}catch{X.error(d({id:`cRHuuI`}))}},t[0]=d,t[1]=g);let _=g,v;t[2]!==m||t[3]!==o?(v=(0,Z.jsx)(hr,{absolutePath:m,menuKind:o}),t[2]=m,t[3]=o,t[4]=v):v=t[4];let y,b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(r,{"aria-hidden":!0}),b=(0,Z.jsx)(l,{id:`zd00pH`}),t[5]=y,t[6]=b):(y=t[5],b=t[6]);let x;t[7]===o?x=t[8]:(x=(0,Z.jsxs)(Ge,{menuKind:o,children:[y,b]}),t[7]=o,t[8]=x);let S;t[9]!==m||t[10]!==_||t[11]!==o?(S=m?(0,Z.jsx)(Qe,{menuKind:o,onSelect:()=>void _(m),children:(0,Z.jsx)(l,{id:`z2funE`})}):null,t[9]=m,t[10]=_,t[11]=o,t[12]=S):S=t[12];let C;t[13]!==_||t[14]!==c.path?(C=()=>void _(c.path),t[13]=_,t[14]=c.path,t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(l,{id:`xloBjn`}),t[16]=w):w=t[16];let T;t[17]!==o||t[18]!==C?(T=(0,Z.jsx)(Qe,{menuKind:o,onSelect:C,children:w}),t[17]=o,t[18]=C,t[19]=T):T=t[19];let E;t[20]!==o||t[21]!==S||t[22]!==T?(E=(0,Z.jsxs)(Xe,{menuKind:o,children:[S,T]}),t[20]=o,t[21]=S,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==o||t[25]!==E?(D=(0,Z.jsx)(We,{menuKind:o,children:E}),t[24]=o,t[25]=E,t[26]=D):D=t[26];let O;t[27]!==o||t[28]!==D||t[29]!==x?(O=(0,Z.jsxs)(et,{menuKind:o,children:[x,D]}),t[27]=o,t[28]=D,t[29]=x,t[30]=O):O=t[30];let k;t[31]!==o||t[32]!==s||t[33]!==O||t[34]!==v?(k=(0,Z.jsxs)(Xe,{menuKind:o,children:[v,s,O]}),t[31]=o,t[32]=s,t[33]=O,t[34]=v,t[35]=k):k=t[35];let A;t[36]===o?A=t[37]:(A=(0,Z.jsx)(qe,{menuKind:o}),t[36]=o,t[37]=A);let j;t[38]!==n||t[39]!==a||t[40]!==p||t[41]!==o||t[42]!==h||t[43]!==f||t[44]!==c?(j=h?(0,Z.jsx)(Xe,{menuKind:o,children:(0,Z.jsx)(Ue,{menuKind:o,className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(l,{id:`D0CegO`})})}):(0,Z.jsxs)(Xe,{menuKind:o,children:[(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>void n.duplicate(c,a),children:[(0,Z.jsx)(i,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`euc6Ns`})]}),(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>n.requestRename(c,a),children:[(0,Z.jsx)(Pn,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`2wxgft`})]}),(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>n.requestFileCreate(c),children:[(0,Z.jsx)(tt,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`HdkSiO`})]}),(0,Z.jsxs)(et,{menuKind:o,children:[(0,Z.jsxs)(Ge,{menuKind:o,children:[(0,Z.jsx)(Nn,{"aria-hidden":!0}),(0,Z.jsx)(l,{id:`TKQ7K-`})]}),(0,Z.jsx)(We,{menuKind:o,className:$e,children:(0,Z.jsx)(Xe,{menuKind:o,children:(0,Z.jsx)(Ye,{toggles:p,skill:c,menuKind:o,onResolveFork:e=>n.requestForkResolve(c,e)})})})]}),(0,Z.jsxs)(Qe,{menuKind:o,onSelect:()=>n.requestScopeMove(c,c.scope===`project`?`global`:`project`),children:[(0,Z.jsx)(Mn,{"aria-hidden":!0}),c.scope===`project`?(0,Z.jsx)(l,{id:`bpytj4`,values:{0:f.global}}):(0,Z.jsx)(l,{id:`bpytj4`,values:{0:f.project}})]})]}),t[38]=n,t[39]=a,t[40]=p,t[41]=o,t[42]=h,t[43]=f,t[44]=c,t[45]=j):j=t[45];let M;t[46]===o?M=t[47]:(M=(0,Z.jsx)(qe,{menuKind:o}),t[46]=o,t[47]=M);let N;t[48]!==n||t[49]!==c?(N=()=>n.requestDelete(c),t[48]=n,t[49]=c,t[50]=N):N=t[50];let P,F;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(st,{"aria-hidden":!0}),F=(0,Z.jsx)(l,{id:`cnGeoo`}),t[51]=P,t[52]=F):(P=t[51],F=t[52]);let I;t[53]!==o||t[54]!==N?(I=(0,Z.jsxs)(Qe,{menuKind:o,variant:`destructive`,onSelect:N,children:[P,F]}),t[53]=o,t[54]=N,t[55]=I):I=t[55];let L;t[56]!==o||t[57]!==I?(L=(0,Z.jsx)(Xe,{menuKind:o,children:I}),t[56]=o,t[57]=I,t[58]=L):L=t[58];let R;return t[59]!==k||t[60]!==A||t[61]!==j||t[62]!==M||t[63]!==L?(R=(0,Z.jsxs)(Z.Fragment,{children:[k,A,j,M,L]}),t[59]=k,t[60]=A,t[61]=j,t[62]=M,t[63]=L,t[64]=R):R=t[64],R}function br(e){let t=(0,$.c)(48),{scope:n,name:r,showNewFile:i}=e,a=i===void 0?!0:i,{_:o}=u(),s=Tt(),c=lr(),d=s.status===`ready`?s.data:void 0,h;t[0]!==d||t[1]!==r||t[2]!==n?(h=d?.find(e=>e.scope===n&&e.name===r),t[0]=d,t[1]=r,t[2]=n,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==d||t[6]!==r?(_=g===void 0?d?.filter(e=>e.name===r):void 0,t[4]=g,t[5]=d,t[6]=r,t[7]=_):_=t[7];let v=_,y=g??(v?.length===1?v[0]:void 0),b;t[8]!==y||t[9]!==r||t[10]!==n?(b=y??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=y,t[9]=r,t[10]=n,t[11]=b):b=t[11];let x=b,[S,C]=(0,Q.useState)(!1),w=Ze(x,c),{installed:T,installing:E,hostSet:D}=w,O=y===void 0&&!T,k;t[12]!==y||t[13]!==D?(k=y?ut(y,[...D]):[],t[12]=y,t[13]=D,t[14]=k):k=t[14];let A=k,j;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==x?(j=a?(0,Z.jsx)(m,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(x),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Z.jsx)(tt,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=x,t[19]=j):j=t[19];let M=O?`resolving`:`installed`,N=O?`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`,P;t[20]===N?P=t[21]:(P=f(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,N),t[20]=N,t[21]=P);let F;t[22]!==A||t[23]!==E||t[24]!==O?(F=E?(0,Z.jsx)(l,{id:`b4itZn`}):O?(0,Z.jsx)(l,{id:`iKvAeG`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{id:`eQkgKV`}),(0,Z.jsx)(p,{hosts:A,className:`text-muted-foreground`})]}),t[22]=A,t[23]=E,t[24]=O,t[25]=F):F=t[25];let I;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ke,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[26]=I):I=t[26];let L;t[27]!==E||t[28]!==F||t[29]!==M||t[30]!==P?(L=(0,Z.jsx)(Ie,{asChild:!0,children:(0,Z.jsxs)(m,{variant:`outline`,size:`sm`,disabled:E,"data-testid":`skill-install-menu-trigger`,"data-state":M,className:P,children:[F,I]})}),t[27]=E,t[28]=F,t[29]=M,t[30]=P,t[31]=L):L=t[31];let R;t[32]!==c||t[33]!==x?(R=e=>c.requestForkResolve(x,e),t[32]=c,t[33]=x,t[34]=R):R=t[34];let z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>C(!1),t[35]=z):z=t[35];let B;t[36]!==x||t[37]!==R||t[38]!==w?(B=(0,Z.jsx)(ze,{align:`end`,className:$e,children:(0,Z.jsx)(Ye,{toggles:w,skill:x,onResolveFork:R,onRunStart:z})}),t[36]=x,t[37]=R,t[38]=w,t[39]=B):B=t[39];let V;t[40]!==S||t[41]!==L||t[42]!==B?(V=(0,Z.jsxs)(Be,{modal:!1,open:S,onOpenChange:C,children:[L,B]}),t[40]=S,t[41]=L,t[42]=B,t[43]=V):V=t[43];let H;return t[44]!==c.dialogs||t[45]!==V||t[46]!==j?(H=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[j,V,c.dialogs]}),t[44]=c.dialogs,t[45]=V,t[46]=j,t[47]=H):H=t[47],H}var xr=`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 Sr(e){let t=(0,$.c)(24),{value:n,onSelect:r,disabled:i}=e,a=(0,Q.useId)(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Le,{children:(0,Z.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,Z.jsx)(l,{id:`ZWyHmq`}),t[3]=c):c=t[3];let u;t[4]!==a||t[5]!==i?(u=(0,Z.jsx)(Fe,{value:`project`,disabled:i,onSelect:wr,"aria-describedby":a,className:xr,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,Z.jsx)(l,{id:`ImTzPZ`}),t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==i?(f=(0,Z.jsx)(Fe,{value:`global`,disabled:i,onSelect:Cr,"aria-describedby":a,className:xr,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,Z.jsxs)(je,{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,Z.jsx)(l,{id:`9x-lMu`}):(0,Z.jsx)(l,{id:`AyKwqp`}),t[16]=n,t[17]=m);let h;t[18]!==a||t[19]!==m?(h=(0,Z.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,Z.jsxs)(Z.Fragment,{children:[o,p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Cr(e){return e.preventDefault()}function wr(e){return e.preventDefault()}function Tr(e){let t=(0,$.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 p=d,v;t[4]===r?v=t[5]:(v=f(`relative`,r),t[4]=r,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(at,{}),t[6]=y):y=t[6];let b;t[7]!==c||t[8]!==o?(b=c?(0,Z.jsx)(wt,{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]=b):b=t[9];let x;t[10]===b?x=t[11]:(x=(0,Z.jsxs)(h,{children:[y,b]}),t[10]=b,t[11]=x);let S;t[12]!==p||t[13]!==n||t[14]!==v||t[15]!==x?(S=(0,Z.jsx)(m,{variant:`ghost`,size:`icon`,"aria-label":p,onClick:n,"data-testid":`add-properties-button`,className:v,asChild:!0,children:x}),t[12]=p,t[13]=n,t[14]=v,t[15]=x,t[16]=S):S=t[16];let C;t[17]!==c||t[18]!==a?(C=(0,Z.jsx)(g,{side:`bottom`,children:c?(0,Z.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:(0,Z.jsx)(l,{id:`AwrGuz`})}),a?.map(Er),(0,Z.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Z.jsx)(l,{id:`yh5-4s`})})]}):(0,Z.jsx)(l,{id:`81H_23`})}),t[17]=c,t[18]=a,t[19]=C):C=t[19];let w;return t[20]!==S||t[21]!==C?(w=(0,Z.jsxs)(_,{children:[S,C]}),t[20]=S,t[21]=C,t[22]=w):w=t[22],w}function Er(e,t){return(0,Z.jsx)(`span`,{className:`opacity-90`,children:e},t)}export{jn as A,ln as C,On as D,Sn as E,cn as M,fn as O,pn as S,mn as T,In as _,gr as a,hn as b,lr as c,Wn as d,Jn as f,Fn as g,Ln as h,vr as i,sn as j,En as k,sr as l,zn as m,Sr as n,_r as o,Vn as p,br as r,hr as s,Tr as t,Kn as u,Nn as v,un as w,dn as x,Mn as y};
|