@inkeep/open-knowledge 0.70.0-beta.1 → 0.70.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-Bc5xIETT.mjs +1 -0
  3. package/dist/index.d.mts +20 -5
  4. package/dist/index.mjs +1 -1
  5. package/dist/{init-BkJMnAZa.mjs → init-B8otmhem.mjs} +2 -2
  6. package/dist/init-VOay_9uk.mjs +1 -0
  7. package/dist/{launch-json-removal-BoCDtAfN.mjs → launch-json-removal-CSUPTNXq.mjs} +1 -1
  8. package/dist/loader-Bw8wLLLY.mjs +1 -0
  9. package/dist/{loader-BGPXyqhj.mjs → loader-DM3RDJSO.mjs} +1 -1
  10. package/dist/preview-BBMcu2-A.mjs +1 -0
  11. package/dist/{preview-CotlhiaD.mjs → preview-CYFnPQOv.mjs} +1 -1
  12. package/dist/public/assets/{ActivityModeContent-Cuw9ugjV.js → ActivityModeContent-DragaXza.js} +1 -1
  13. package/dist/public/assets/{AddPropertiesButton-D2St_Qd5.js → AddPropertiesButton-DFlCgtou.js} +1 -1
  14. package/dist/public/assets/{AgentDiffPane-CkOVOz1I.js → AgentDiffPane-yvytaUVs.js} +1 -1
  15. package/dist/public/assets/{CodeMirrorPropInput-CD5zsgNl.js → CodeMirrorPropInput-CUQWZHWI.js} +1 -1
  16. package/dist/public/assets/{DocumentContext-oN8QqYa2.js → DocumentContext-CCqrdOs8.js} +1 -1
  17. package/dist/public/assets/{EditorModeToggle-DI4jmk3U.js → EditorModeToggle-1weEywlb.js} +1 -1
  18. package/dist/public/assets/{EnableSyncConfirmDialog-mpA49E2T.js → EnableSyncConfirmDialog-d7C4dW9c.js} +1 -1
  19. package/dist/public/assets/{ExcalidrawDocEditor-DASVbwUk.js → ExcalidrawDocEditor-Dginkgvz.js} +1 -1
  20. package/dist/public/assets/FeedbackForm-ojPXbRqa.js +1 -0
  21. package/dist/public/assets/{ImportSkillDialog-CetaHd6k.js → ImportSkillDialog-BTamx01W.js} +1 -1
  22. package/dist/public/assets/{LintConfigEditor-ClxrzhCY.js → LintConfigEditor-sQ74NhCq.js} +1 -1
  23. package/dist/public/assets/ManagedArtifactProperties-BQ_Rtzjn.js +1 -0
  24. package/dist/public/assets/{ManagedArtifactProperties-CAt7YZHq.js → ManagedArtifactProperties-D3aoeLtI.js} +1 -1
  25. package/dist/public/assets/{MermaidDocEditor-l5bkloBd.js → MermaidDocEditor-DeKBCmeb.js} +1 -1
  26. package/dist/public/assets/{PropertyDisplayRow-vj3cLK4b.js → PropertyDisplayRow-gEjcWfq6.js} +1 -1
  27. package/dist/public/assets/{SchemaConfigEditor-CmT2upZz.js → SchemaConfigEditor-CIxijG-Z.js} +1 -1
  28. package/dist/public/assets/{SessionsHost-mwcjDHFb.js → SessionsHost-D_N77zo3.js} +2 -2
  29. package/dist/public/assets/{SettingsDialogBody-rcZHPDon.js → SettingsDialogBody-KFPdTdnB.js} +1 -1
  30. package/dist/public/assets/{ShareReceiveMissDialog-kCg3wfHd.js → ShareReceiveMissDialog-CwomSBtJ.js} +1 -1
  31. package/dist/public/assets/{SkillInstallMenu-lp4nu4hK.js → SkillInstallMenu-D6T8E32d.js} +1 -1
  32. package/dist/public/assets/{SkillToolbarControls-3IHdj_Il.js → SkillToolbarControls-CyeUXd0g.js} +1 -1
  33. package/dist/public/assets/{SourceEditor-BkKDyotX.js → SourceEditor-3QZVvj5K.js} +1 -1
  34. package/dist/public/assets/{TerminalPanel-G_cwmSp4.js → TerminalPanel-CV-qYO9k.js} +37 -37
  35. package/dist/public/assets/{TerminalWindowApp-D1jQOZHi.js → TerminalWindowApp-DGN2hBxh.js} +1 -1
  36. package/dist/public/assets/{TextDocEditor-BvIvA3-4.js → TextDocEditor-BgTfF3vK.js} +1 -1
  37. package/dist/public/assets/{ThreadView-C113ZFeG.js → ThreadView-DXA6kMQF.js} +1 -1
  38. package/dist/public/assets/{TimelineDiffPane-jzRCrk5N.js → TimelineDiffPane-UzOjUQi8.js} +1 -1
  39. package/dist/public/assets/{agent-diff-store-DCCnRltS.js → agent-diff-store-x6ALbH63.js} +1 -1
  40. package/dist/public/assets/{auth-state-cache-DO0r1WdV.js → auth-state-cache-D6FotIEW.js} +1 -1
  41. package/dist/public/assets/{comment-chips-9JFiylTf.js → comment-chips-BCzPwZfE.js} +1 -1
  42. package/dist/public/assets/{config-provider-DF7n85Nj.js → config-provider-E8aTSnD0.js} +3 -3
  43. package/dist/public/assets/{doc-undo-manager-e59jWgT6.js → doc-undo-manager-Dohw7WEh.js} +1 -1
  44. package/dist/public/assets/i18n-B7ZLDvza.js +1 -0
  45. package/dist/public/assets/{index-rU9fSXdV.js → index-K4zW7H4W.js} +7 -7
  46. package/dist/public/assets/messages-BTFjxU9n.js +1 -0
  47. package/dist/public/assets/messages-Brep2oKI.js +1 -0
  48. package/dist/public/assets/messages-Bs9DJqd5.js +1 -0
  49. package/dist/public/assets/messages-C9cITjkK.js +1 -0
  50. package/dist/public/assets/messages-CDnLA-DO.js +1 -0
  51. package/dist/public/assets/messages-CLyvRLHM.js +1 -0
  52. package/dist/public/assets/messages-CYuDalsI.js +1 -0
  53. package/dist/public/assets/messages-ClgLx-TE.js +1 -0
  54. package/dist/public/assets/messages-CvjxIZ7a.js +1 -0
  55. package/dist/public/assets/messages-DIf0D0KN.js +1 -0
  56. package/dist/public/assets/messages-DdK4xB83.js +1 -0
  57. package/dist/public/assets/messages-xs-q9MAy.js +1 -0
  58. package/dist/public/assets/{pending-receive-nav-store-Bc0ZN2bJ.js → pending-receive-nav-store-BBBf2Umy.js} +1 -1
  59. package/dist/public/assets/{progress-D8bGB3Df.js → progress-D3HqSAZp.js} +1 -1
  60. package/dist/public/assets/{selection-context-CW9hIqbB.js → selection-context-CTMzDsjU.js} +1 -1
  61. package/dist/public/assets/{src-CewCrtD3.js → src-Ha52QnYu.js} +1 -1
  62. package/dist/public/assets/{typing-burst-detector-D1A2sYl3.js → typing-burst-detector-Q1x_V1Np.js} +1 -1
  63. package/dist/public/assets/{uninstall-BoyHr3Cc.js → uninstall-DNrOrE2h.js} +1 -1
  64. package/dist/public/assets/{use-activity-panel-C4kTGW93.js → use-activity-panel-DjFXJ_db.js} +1 -1
  65. package/dist/public/assets/{use-open-skill-D3KG7pdB.js → use-open-skill-BRBShUEV.js} +1 -1
  66. package/dist/public/assets/{use-terminal-enabled-DG04fEiI.js → use-terminal-enabled-BsKs7ckE.js} +1 -1
  67. package/dist/public/assets/{use-timeline-entry-diff-Hd7p_m1U.js → use-timeline-entry-diff-DpqygKQG.js} +1 -1
  68. package/dist/public/index.html +20 -20
  69. package/dist/public/uninstall.html +3 -3
  70. package/dist/{registry-probes-DXcLFqVT.mjs → registry-probes-QaKSE8L7.mjs} +1 -1
  71. package/dist/{removal-file-path-D1d9Bfvc.mjs → removal-file-path-ucl0tG3x.mjs} +1 -1
  72. package/dist/{repair-launch-json-a-wCl-a0.mjs → repair-launch-json-2skQfy9M.mjs} +1 -1
  73. package/dist/{repair-mcp-configs-DfyolQ1H.mjs → repair-mcp-configs-BlbBPod2.mjs} +1 -1
  74. package/dist/src-BHAV63UV.mjs +1 -0
  75. package/dist/{src-BLfDAAYe.mjs → src-BSRKGNp2.mjs} +1 -1
  76. package/dist/start-B1MHILpQ.mjs +1 -0
  77. package/dist/{start-Mm-GMb4m.mjs → start-CsbVSNv_.mjs} +2 -2
  78. package/package.json +4 -4
  79. package/dist/constants-oXxsVSOP.mjs +0 -1
  80. package/dist/init-C1kwc9vl.mjs +0 -1
  81. package/dist/loader-CVGLLZ3N.mjs +0 -1
  82. package/dist/preview-C0qb1iLo.mjs +0 -1
  83. package/dist/public/assets/FeedbackForm-BxPikFK8.js +0 -1
  84. package/dist/public/assets/ManagedArtifactProperties-DkqTWkpt.js +0 -1
  85. package/dist/public/assets/i18n-C9VAY9zJ.js +0 -1
  86. package/dist/public/assets/messages-BBYrYZsy.js +0 -1
  87. package/dist/public/assets/messages-BcyBkq4W.js +0 -1
  88. package/dist/public/assets/messages-Bqr2oMT6.js +0 -1
  89. package/dist/public/assets/messages-CgbSkzso.js +0 -1
  90. package/dist/public/assets/messages-Cm38ZpUe.js +0 -1
  91. package/dist/public/assets/messages-D8Hzf8g7.js +0 -1
  92. package/dist/public/assets/messages-DAEuNlOj.js +0 -1
  93. package/dist/public/assets/messages-Dbxo_jCw.js +0 -1
  94. package/dist/public/assets/messages-Dip_YkZG.js +0 -1
  95. package/dist/public/assets/messages-Dj8MS9QD.js +0 -1
  96. package/dist/public/assets/messages-dqvUE8VB.js +0 -1
  97. package/dist/public/assets/messages-w76noEYL.js +0 -1
  98. package/dist/src-BTuKN-IA.mjs +0 -1
  99. package/dist/start-CsCpTOdD.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{Ku as r,Ot as i,Qc as a,Qu as o,Xl as s,Yu as c,Zu as l,au as u,eu as d,nd as f,ol as p,qo as m,qu as h,td as g,tu as _,ul as v}from"./md-manager-BGnqyqi1-BRU4tUy7.mjs";import{$a as y,$i as b,Bn as x,Dr as S,F as ee,Jt as te,Li as ne,Nn as re,P as C,Ri as ie,Rr as ae,Sr as oe,St as se,To as ce,Vi as le,Xa as ue,et as de,fo as fe,go as pe,gr as me,ho as he,jo as ge,m as _e,mo as ve,nt as ye,po as be,to as xe,yo as w,z as Se}from"./dist-C4d76Rpb.mjs";import{i as T,n as E,o as D,r as Ce,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as we}from"./constants-oXxsVSOP.mjs";import{t as Te}from"./preview-CotlhiaD.mjs";import{createRequire as Ee}from"node:module";import{execFileSync as De}from"node:child_process";import Oe,{basename as ke,dirname as j,isAbsolute as Ae,join as M,posix as je,relative as N,resolve as P,sep as F,win32 as Me}from"node:path";import I from"node:process";import{fileURLToPath as Ne}from"node:url";import{cpSync as Pe,existsSync as L,lstatSync as Fe,mkdirSync as Ie,readFileSync as R,readdirSync as Le,readlinkSync as Re,realpathSync as ze,rmSync as Be,statSync as Ve,writeFileSync as He}from"node:fs";import{homedir as z}from"node:os";import*as Ue from"node:readline";import{inspect as We,stripVTControlCharacters as Ge,styleText as B}from"node:util";import{AsyncLocalStorage as Ke,AsyncResource as qe}from"node:async_hooks";var Je=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})),Ye=n((e=>{let{InvalidArgumentError:t}=Je();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})),Xe=n((e=>{let{humanReadableArgName:t}=Ye();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(`
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{Ku as r,Ot as i,Qc as a,Qu as o,Xl as s,Yu as c,Zu as l,au as u,eu as d,nd as f,ol as p,qo as m,qu as h,td as g,tu as _,ul as v}from"./md-manager-BGnqyqi1-BRU4tUy7.mjs";import{$a as y,$i as b,Bn as x,Dr as S,F as ee,Jt as te,Li as ne,Nn as re,P as C,Ri as ie,Rr as ae,Sr as oe,St as se,To as ce,Vi as le,Xa as ue,et as de,fo as fe,go as pe,gr as me,ho as he,jo as ge,m as _e,mo as ve,nt as ye,po as be,to as xe,yo as w,z as Se}from"./dist-C4d76Rpb.mjs";import{i as T,n as E,o as D,r as Ce,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as we}from"./constants-Bc5xIETT.mjs";import{t as Te}from"./preview-CYFnPQOv.mjs";import{createRequire as Ee}from"node:module";import{execFileSync as De}from"node:child_process";import Oe,{basename as ke,dirname as j,isAbsolute as Ae,join as M,posix as je,relative as N,resolve as P,sep as F,win32 as Me}from"node:path";import I from"node:process";import{fileURLToPath as Ne}from"node:url";import{cpSync as Pe,existsSync as L,lstatSync as Fe,mkdirSync as Ie,readFileSync as R,readdirSync as Le,readlinkSync as Re,realpathSync as ze,rmSync as Be,statSync as Ve,writeFileSync as He}from"node:fs";import{homedir as z}from"node:os";import*as Ue from"node:readline";import{inspect as We,stripVTControlCharacters as Ge,styleText as B}from"node:util";import{AsyncLocalStorage as Ke,AsyncResource as qe}from"node:async_hooks";var Je=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})),Ye=n((e=>{let{InvalidArgumentError:t}=Je();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})),Xe=n((e=>{let{humanReadableArgName:t}=Ye();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})),Ze=n((e=>{let{InvalidArgumentError:t}=Je();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&&w(e,g,{mode:ha(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const co=e=>e!==`project`,lo=e=>e!==`user`;async function uo(){let e=await wa({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 fo(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??uo)():`both`}async function po(e){return ka({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 mo(e){if(e.sharing!==void 0)return e.sharing;let t=Hi(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??po)(t):t}var ho=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function go(e){if(e===void 0||e===!0)return new Set(de);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(se.filter(e=>t.includes(e)))}function _o(e,t,n){let r=P(n,e),i;try{i=Ve(r)}catch(e){let t=e.code;throw t===`ENOENT`?new ho(`--content-dir path does not exist: ${r}`):new ho(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new ho(`--content-dir must be a directory: ${r}`);let a=vo(t),o=vo(r),s=N(a,o);if(s.startsWith(`..`)||Ae(s))throw new ho(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function vo(e){try{return ze(e)}catch{return e}}const yo=`open-knowledge-ui`;function bo(e,t,n){try{let r=e.detectPath?.(t,n)??j(e.configPath(t,n));return L(r)}catch{return!1}}function xo(e,t,n){try{let r=P(j(e.configPath(t,n))),i=P(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+F)}catch{return!1}}function So(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`||!L(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||xo(e,t,r);if(!i&&c&&!bo(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{Qi(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 wo(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||Ie(j(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{ce(`${o}.lock`,()=>{let t=Ha(o).writePath;if(s||Ie(j(t),{recursive:!0}),e.format===`toml`){let r=io(Rr(),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=so(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=ro(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 Co={pi:Pa};function wo(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=Co[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{Ie(j(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{ce(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}w(t,c,e===null?void 0:{mode:ha(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 To(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function Eo(e){let t=Fi(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=>So(t,``,n,e.home))}function Do(e,t,n,r){let i=ko(e,t,n,r);return i.kind===`present`?i.entry:null}function Oo(e,t,n,r){let i=no(e,t,r);if(!A(i))return{kind:`no-entry`};let a=i[n];return A(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function ko(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(Ve(i).size>Xa)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:da(e)}}let a;try{a=R(i,`utf-8`)}catch(e){return{kind:`decline`,reason:da(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Na(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Rr().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Oo(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,Dr.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Oo(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=Ga(a);return s?Ka(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Oo(be(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ao(e={}){let t=P(e.cwd??process.cwd()),n=La(t,{homeDir:e.home}),r=n.projectRoot;if(S(r,e.home??z()))throw new Se(r);let i=!L(M(r,`.ok`)),a=n.gitRootPromoted?N(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:_o(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${O(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},c=await x(r),l;try{l=me(r,{contentDir:o})}catch(t){let i=$.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:c.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let u=l.created.includes(we),d=!1;if(c.didInit)try{d=xe(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{ne(r)===`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 ${r}: ${e instanceof Error?e.message:String(e)}`)}let f=await fo({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),p=e.editors??Io(r,e.home),m=e.editors??p,h=Fi(p),g=Fi(m),_=e.mcp===!1||f===null,ee=Array.from(new Map([...h,..._?[]:g].map(e=>[e.id,e])).values()),te=h.filter(t=>bo(t,r,e.home)),C=[],ae=[],ce=new Set;for(let t of ee){if(_){let n=``;try{n=t.configPath(r,e.home)}catch{}C.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(co(f)&&h.includes(t)&&t.scope===`global`&&C.push(So(t,r,s,e.home)),lo(f)&&g.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=So(t,r,s,e.home,n);C.push(i),(i.action===`written`||i.action===`overwritten`)&&ce.add(n)}}let le=new Set;for(let t of g){let n=t.projectSkillPath?.(r);!n||le.has(n)||(le.add(n),ae.push(la(t,r,{home:e.home})))}let ue=ca(r,g.map(e=>e.id));ue&&ae.push(ue);let de=ae.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(de.length>0){let t=e.home??z();ie({source:v,skills:[_e.project],agents:de,scope:r},{home:t,enabled:b(t).enabled})}let fe=!_&&f!==null&&lo(f)?g.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,pe=_?[]:te.map(e=>To(e,r)).filter(e=>e!==void 0).filter(e=>!ce.has(e.path)),he=e.installUserSkill??oe,ge=e.home??z(),ve=go(e.skills),ye=!1,be=!1,w=!1,T=!1,E=!1;for(let t of se){if(!ve.has(t))continue;await y(ge,_e[t],!0).catch(()=>{}),ye=!0;let n=await he({home:e.home,bundleId:t,force:!0});n===`installed`?be=!0:n===`failed`?w=!0:n===`no-hosts`?E=!0:T=!0}let D=w?`failed`:be?`installed`:ye&&T?`skip-current`:ye&&E?`no-hosts`:`declined`,Ce=be?re(ge).map(e=>e.editorId):[],k=_?`skipped-flag`:`skipped-missing`,A=C.find(e=>e.editorId===`claude`)??C[0]??{action:k,configPath:$.claude.configPath(r,e.home)},Te=await jo({projectRoot:r,desiredMode:await mo({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:l.created,contentUpdated:l.updated,contentSkipped:l.skipped,editors:C,projectSkills:ae,legacyProjectConfigs:pe,skillInstall:D,skillHosts:Ce,didGitInit:c.didInit,rootGitignoreCreated:d,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:u?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:A.action,mcpPath:A.configPath,mcpError:`error`in A?A.error:void 0,projectScopeUnsupportedLabels:fe,sharing:Te}}async function jo(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Hi(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=Ri(t);if(n===`local-only`){let e=Bi(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`}:Mo(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Vi(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Mo(t,o,`remove`)}function Mo(e,t,n){let r=Hi(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 No(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 Po(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=M(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(k(`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(k(`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(k(`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(k(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(k(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?N(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} ${D(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${D(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${Ce(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${No(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(k(`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?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${D(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${D(`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} ${Ce(`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} ${N(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(k(`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 ${D(`installed for ${r}`)}`),n.push(` ${E(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${E(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${D(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${E(`skipped for this run (--no-skills)`)}`),n.push(` ${E(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${E(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${E(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${E(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${O(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${O(` ok repair-skills`)}`)}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(O(`⚠ --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(O(`⚠ 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(Te(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...zo(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(`${D(`✓`)} ${k(`Next steps:`)}`),n.push(` 1. Open your editor (${T(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${T(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${T(`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 Fo(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 Io(e,t){let n=[];for(let r of Br)r!==`claude-desktop`&&bo($[r],e,t)&&n.push(r);return n}function Lo(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:We(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 Ro(){return new st(`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 lt(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new lt(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new lt(`--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?Lo():null;try{let r;try{r=await Ao({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof ho||e instanceof Se){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof C||e instanceof ee){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof ye){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-CVGLLZ3N.mjs`),{resolveContentDir:s}=await import(`./dist-DSfQybpf.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-C0qb1iLo.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(Fo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Po(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function zo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${D(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${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(` ${D(`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(` ${D(`local-only`)} — already excluded; nothing to do.`):n.push(` ${D(`local-only`)}`):e.action===`removed`?n.push(` ${D(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${D(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
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-Bw8wLLLY.mjs`),{resolveContentDir:s}=await import(`./dist-DSfQybpf.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-BBMcu2-A.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(Fo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Po(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function zo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${D(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${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(` ${D(`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(` ${D(`local-only`)} — already excluded; nothing to do.`):n.push(` ${D(`local-only`)}`):e.action===`removed`?n.push(` ${D(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${D(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`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 ${T(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(O(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${T(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${T(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(O(`Sharing mode unavailable: ${e.reason}.`));return n}}export{mi as $,ga as A,Gi as B,La as C,wa as D,ka as E,$i as F,Hi as G,zi as H,ua as I,X as J,Vi as K,na as L,da as M,ta as N,ha as O,Qi as P,hi as Q,la as R,Ha as S,Ma as T,Ri as U,Ui as V,Wi as W,Vr as X,$ as Y,Z,Ao as _,vt as _t,Fo as a,Q as at,Eo as b,lt as bt,Po as c,ii as ct,bo as d,Xn as dt,gi as et,Do as f,zn as ft,mo as g,U as gt,_o as h,Wt as ht,jo as i,vi as it,fa as j,ma as k,zo as l,zr as lt,fo as m,Gt as mt,yo as n,Zr as nt,ko as o,yi as ot,go as p,Jt as pt,Br as q,Co as r,ei as rt,Io as s,Ai as st,ho as t,_i as tt,Ro as u,Rr as ut,eo as v,st as vt,Pa as w,xo as x,So as y,at as yt,Bi as z};
@@ -0,0 +1 @@
1
+ import"./dist-C4d76Rpb.mjs";import{_ as e}from"./init-B8otmhem.mjs";export{e as runInit};
@@ -1 +1 @@
1
- import{go as e,po as t,yo as n}from"./dist-C4d76Rpb.mjs";import{A as r,M as i,O as a}from"./init-BkJMnAZa.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-D1d9Bfvc.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=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=t(_).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};
1
+ import{go as e,po as t,yo as n}from"./dist-C4d76Rpb.mjs";import{A as r,M as i,O as a}from"./init-B8otmhem.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-ucl0tG3x.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=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=t(_).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-DM3RDJSO.mjs";export{e as loadConfig};
@@ -1 +1 @@
1
- import{Bc as e,Sc as t,Xl as n,bc as r,kc as i,za as a,zo as o}from"./md-manager-BGnqyqi1-BRU4tUy7.mjs";import{Co as s,b as c,xo as l}from"./dist-C4d76Rpb.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-oXxsVSOP.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=n();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(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=i({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function b(n){let i=n??process.cwd(),u=[],p=[],m=[],h=[],g=s(`user`,i),_=l({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,n=!1)=>{let i=v(t);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let o=r({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...o),u.push(t);let s=o.length>0?e(i.value):i.value;return n&&h.push(...a({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(i,`.ok`,d),S=b(x,!0),C=b(s(`project-local`,i)),w=o(_.value,S,C),T=c.safeParse(w);if(!T.success){let e=v(x),n={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(t(n))}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};
1
+ import{Bc as e,Sc as t,Xl as n,bc as r,kc as i,za as a,zo as o}from"./md-manager-BGnqyqi1-BRU4tUy7.mjs";import{Co as s,b as c,xo as l}from"./dist-C4d76Rpb.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-Bc5xIETT.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=n();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(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=i({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function b(n){let i=n??process.cwd(),u=[],p=[],m=[],h=[],g=s(`user`,i),_=l({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,n=!1)=>{let i=v(t);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let o=r({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...o),u.push(t);let s=o.length>0?e(i.value):i.value;return n&&h.push(...a({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(i,`.ok`,d),S=b(x,!0),C=b(s(`project-local`,i)),w=o(_.value,S,C),T=c.safeParse(w);if(!T.success){let e=v(x),n={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(t(n))}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-CYFnPQOv.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,2 +1,2 @@
1
- import{hn as e}from"./dist-C4d76Rpb.mjs";import"./constants-oXxsVSOP.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(`
1
+ import{hn as e}from"./dist-C4d76Rpb.mjs";import"./constants-Bc5xIETT.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};
@@ -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-oN8QqYa2.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-BYTIciug.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{m as b}from"./Mermaid-vt1xgC6O.js";import{t as x}from"./circle-alert-Czw40trT.js";import{i as S}from"./prop-types-CasKVPOh.js";import{t as C}from"./spinner-Bp2_BYkl.js";import{t as w}from"./undo-2-Dg2S1Iz5.js";import{l as T}from"./doc-hash-BosQg4sh.js";import{d as E}from"./page-list-cache-BZ2ZBwsu.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-DCCnRltS.js";import{t as j}from"./timeline-diff-store-hP7gGEyc.js";import{n as M}from"./use-activity-panel-C4kTGW93.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-CCqrdOs8.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-BYTIciug.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{m as b}from"./Mermaid-vt1xgC6O.js";import{t as x}from"./circle-alert-Czw40trT.js";import{i as S}from"./prop-types-CasKVPOh.js";import{t as C}from"./spinner-Bp2_BYkl.js";import{t as w}from"./undo-2-Dg2S1Iz5.js";import{l as T}from"./doc-hash-BosQg4sh.js";import{d as E}from"./page-list-cache-BZ2ZBwsu.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-x6ALbH63.js";import{t as j}from"./timeline-diff-store-hP7gGEyc.js";import{n as M}from"./use-activity-panel-DjFXJ_db.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,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillForkDialog-dYxaj5dE.js","./chunk-CYidjpOJ.js","./dist-BAMccoiQ.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-DTYwy-r_.js","./engine-compile-CUzRCtim.js","./ok-syntax-theme-DjG_XKfz.js","./MultiFileDiff-CWf97riI.js","./dialog-BYTIciug.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-CnGRb1ER.js","./createLucideIcon-B6ULg5PN.js","./label-D-K3fWtj.js","./dist-CJhtNlOm2.js","./input-BJ0fEcsi.js","./skill-scope-C1Qgc63z.js","./skills-api-BMqLu4Hb.js","./dist-Cr4-nBVI.js","./documents-events-Bn2F4Kjs.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{Sr as r,Xt as i,Z as a,i as o,nr as s,xr as c}from"./DocumentContext-oN8QqYa2.js";import{t as l}from"./react-f2sANaYj.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{t as p}from"./utils-CPqDy6Hr.js";import{n as m}from"./clipboard-adapter-815RzzoI.js";import{S as h,_ as g,b as _,c as v,d as y,f as b,h as x,l as S,n as C,o as w,r as T,s as E,t as D,u as O,y as k}from"./SkillInstallMenu-lp4nu4hK.js";import{t as A}from"./button-Cym3gapE.js";import{i as j,n as M,t as N}from"./tooltip-DttaCTqz.js";import{a as P,c as F,i as I,o as L,r as R,s as z,t as B}from"./dialog-BYTIciug.js";import{t as V}from"./alert-dialog-Btd1iU_X.js";import{t as H}from"./label-D-K3fWtj.js";import{a as U,f as W,i as G,o as K,t as q,y as J}from"./RegisteredAgentIcon-YDviE6X3.js";import{Bs as Y,Cn as X,Dc as ee,En as te,Gn as ne,Hn as re,It as ie,Ks as ae,Qn as oe,Rs as se,Un as ce,Vs as le,Wn as ue,Xn as de,Yn as fe,Zn as pe,ac as me,hn as he,ht as ge,ic as _e,mt as ve,oa as ye,oc as be,qn as xe,tc as Se,wn as Ce}from"./dist-BAMccoiQ.js";import{n as Z}from"./dist-CJhtNlOm2.js";import{a as we}from"./use-settings-route-C9scHnRY.js";import{t as Te}from"./dist-Cr4-nBVI.js";import{d as Ee,h as De,m as Oe,n as ke,p as Ae,r as je,u as Me}from"./documents-events-Bn2F4Kjs.js";import{a as Ne,r as Pe}from"./local-menu-action-bus-4I1Xm40D.js";import{i as Fe}from"./use-apply-config-theme-DpLdjUDN.js";import{t as Ie}from"./parse-api-error-BtEdpaFC.js";import{c as Le,d as Re,f as ze,h as Be,l as Ve,n as He,p as Ue,r as We,s as Ge,u as Ke}from"./terminal-cli-display-Bw4dSufC.js";import{n as qe,t as Je}from"./workspace-paths-Dczkx4vn.js";import{n as Ye}from"./use-workspace-DFnkEIDS.js";import{t as Xe}from"./createLucideIcon-B6ULg5PN.js";import{t as Ze}from"./arrow-up-right-B3B9a7te.js";import{t as Qe}from"./chevron-down-Dloks0wp.js";import{a as $e,c as et,d as tt,f as nt,i as rt,l as it,m as at,o as ot,p as st,r as ct,t as lt,u as ut}from"./dropdown-menu--ZF4igWe.js";import{n as dt,r as ft}from"./ManagedArtifactProperties-CAt7YZHq.js";import{t as pt}from"./folder-open-dlosmFj2.js";import{t as mt}from"./use-open-skill-D3KG7pdB.js";import{t as ht}from"./list-plus-BmoxCvSM.js";import{t as gt}from"./trash-2-CeAwTay6.js";import{m as _t,p as vt}from"./page-list-cache-BZ2ZBwsu.js";import{a as yt,o as bt,p as xt}from"./skill-scope-C1Qgc63z.js";import{F as St,T as Ct,a as wt,b as Tt,h as Et,n as Dt,r as Ot,t as kt,w as At}from"./skills-api-BMqLu4Hb.js";import{t as jt}from"./input-BJ0fEcsi.js";import{t as Mt}from"./badge-C8hrUpuH.js";import{t as Nt}from"./use-skills-sMW0gn5i.js";import{n as Pt}from"./platform-labels-B3xX8Yyl.js";var Q=n(),$=e(l(),1),Ft=f();function It(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 Lt(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=Ie(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:Te._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Te._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Te._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Rt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?It(e):Lt()}var zt=`ok:skill:cowork:installed`,Bt=`1`,Vt=250,Ht=`/api/skill/install-state`;function Ut(e){return`${zt}:v${e}`}var Wt=new Map;async function Gt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Wt.get(n);if(r)return r;let i=Kt(e,t);return Wt.set(n,i),i.finally(()=>{Wt.get(n)===i&&Wt.delete(n)}),i}async function Kt(e,t){let n=e.installer===void 0?Rt():e.installer,r=qt(e.storage),i=e.fetchSnapshot??Yt,a=e.serverTimeoutMs??Vt,o=null;if(!t.force){try{o=await Xt(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=Ut(o?.currentVersion??e.fallbackSkillVersion??Jt());if(!t.force&&r?.getItem(s)===Bt)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,Bt)}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 qt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Jt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Yt(){let e;try{e=await fetch(Ht,{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 Xt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Zt(e){return Gt({},e)}function Qt(){return Gt({},{force:!0})}async function $t(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 en(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return $t({target:`claude-cowork`,url:X({mode:`cowork`},e)},n);case`claude-code`:return $t({target:`claude-code`,url:X({mode:`code`},e)},n);case`codex`:return $t({target:`codex`,url:Ce(e)},n);case`cursor`:return $t({target:`cursor`,url:te(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function tn(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 nn=`open-knowledge:agent-thread-launch`;function rn(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 an(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 on(e,t=typeof window>`u`?new EventTarget:window){let n=rn(e);if(Ne(n,t)){an(e,n);return}t.dispatchEvent(new CustomEvent(nn,{detail:e}))}function sn(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(nn,n),()=>t.removeEventListener(nn,n)}function cn(e){if(!e.docName||!e.workspace)return null;let t=Je(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:qe(n,t,r)}}function ln(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function un(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 dn(e){return Be(e.installUrl).then(()=>void 0)}function fn(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function pn(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function mn(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??Je(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:qe(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 hn(e){return`Opened in ${e}.`}function gn(e,t=1){return t>=3?Te._({id:`bi2C2s`,values:{displayName:e}}):t===2?Te._({id:`1J0c0X`,values:{displayName:e}}):Te._({id:`Xs7IcT`,values:{displayName:e}})}function _n(e){return e>=3?null:e===2?Te._({id:`Xp94R1`}):Te._({id:`6gRgw8`})}function vn(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 yn(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 bn(e,t,n,r){return e.compose?he(yn(e.compose,t,n,r)):e.selection?fe({...e.selection,target:t,transport:r}):e.skill?de(e.skill.name,e.skill.scope,n):e.ask?re(e.ask.relativePath,e.ask.instruction,n,t,r):ye(e.docContext===null?e.folderRelativePath?xe(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?ue(n,e.instruction,r):ce(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):ne(e.docContext.relativePath,n,e.instruction,r))}function xn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||n?`${ve} ${bn(e,_e[t].handoffTarget,!1,`terminal`)}`:pe(e.docContext?.relativePath??null)}function Sn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||t?`${ge} ${bn(e,`claude-code`,!1,`terminal`)}`:oe(e.docContext?.relativePath??null)}function Cn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function wn(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 Tn(e,t){on({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:Sn(e),docName:Cn(e),titleHint:wn(e),attachments:e.attachments??null})}async function En(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(Te._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Te._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Te._({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:bn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=vn(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(hn(u));else{let i=_n(r),a=gn(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{En(e,t,n,r+1)}}})}return a}function Dn(e){return Se.find(t=>t.id===e)?.displayName??e}function On(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kn(){return{dispatchHandoff:en,recordHandoff:tn,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>On(),getDisplayName:Dn,ensureCoworkSkillInstalled:Zt,autoOpen:!0}}function An(){let e=(0,Ft.c)(2),{merged:t}=Fe(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>En(e,t,{...kn(),autoOpen:n}),reinstallCoworkSkill:Qt},e[0]=n,e[1]=r),r}var jn=Xe(`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`}]]),Mn=Xe(`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`}]]),Nn=Xe(`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 Pn(e){let t=(0,Ft.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(u,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Fn(e){let t=(0,Ft.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(u,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function In(e){let t=(0,Ft.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(u,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function Ln(e){return e?Te._({id:`wTcjov`}):null}function Rn(e){let t=(0,Ft.c)(48),{_:n}=d(),r=a(),i=k(),o=J(),c=W();if(r)return null;let{input:l,installStates:f,dispatch:p,onBeforeLaunch:m}=e,h=l===null,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==n||t[1]!==p||t[2]!==l||t[3]!==h||t[4]!==f||t[5]!==m||t[6]!==c||t[7]!==o||t[8]!==i){let e=Ln(h),r;t[20]!==f||t[21]!==c?(r=e=>G(c,e.id,f[e.id]?.installed),t[20]=f,t[21]=c,t[22]=r):r=t[22];let a=be.filter(r),d;t[23]===c?d=t[24]:(d=e=>U(c,e.source,e.id,!0,e.supported),t[23]=c,t[24]=d);let D=o.filter(d),O=i?me.filter(e=>K(c,e,i.installedClis)):[];v=a.length>0,y=i!==null&&O.length>0,b=D.length>0,_=tt,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(st,{children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),(0,Q.jsx)(u,{id:`O7_W_a`})]}),t[25]=E):E=t[25],g=nt,x=`max-h-80`,S=b?(0,Q.jsxs)(rt,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(ot,{children:(0,Q.jsx)(u,{id:`RXEbZy`})}),D.map(t=>{let r=t.name;return(0,Q.jsxs)($e,{onSelect:()=>{l!==null&&(m?.(),Tn(l,{agent:{source:t.source,id:t.id}}))},disabled:h,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(q,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==v||t[27]!==y||t[28]!==b?(C=b&&(y||v)?(0,Q.jsx)(ut,{}):null,t[26]=v,t[27]=y,t[28]=b,t[29]=C):C=t[29],w=y?(0,Q.jsxs)(rt,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(ot,{children:(0,Q.jsx)(u,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=_e[t];return(0,Q.jsxs)($e,{onSelect:()=>{l!==null&&(m?.(),i.launchInTerminal(l,t))},disabled:h,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(We,{id:He(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,T=v?(0,Q.jsxs)(Q.Fragment,{children:[y?(0,Q.jsx)(ut,{}):null,(0,Q.jsxs)(rt,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(ot,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(u,{id:`BwKH4d`}),(0,Q.jsx)(Ze,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let r=!h,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)($e,{disabled:!r,onSelect:()=>{if(l){if(m?.(),f[t.id]?.installed!==!0){dn(t);return}p(t.id,l)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(We,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Pn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=p,t[2]=l,t[3]=h,t[4]=f,t[5]=m,t[6]=c,t[7]=o,t[8]=i,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]=E}else g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19];let D;t[30]!==v||t[31]!==y||t[32]!==b?(D=b||y||v?(0,Q.jsx)(ut,{}):null,t[30]=v,t[31]=y,t[32]=b,t[33]=D):D=t[33];let O;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(Pe,{"aria-hidden":`true`}),t[34]=O):O=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)($e,{onSelect:we,"data-testid":`file-tree-open-in-settings`,children:[O,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(u,{id:`jRAGrQ`})})]}),t[35]=A):A=t[35];let j;t[36]!==g||t[37]!==x||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==T||t[42]!==D?(j=(0,Q.jsxs)(g,{className:x,children:[S,C,w,T,D,A]}),t[36]=g,t[37]=x,t[38]=S,t[39]=C,t[40]=w,t[41]=T,t[42]=D,t[43]=j):j=t[43];let M;return t[44]!==_||t[45]!==E||t[46]!==j?(M=(0,Q.jsxs)(_,{children:[E,j]}),t[44]=_,t[45]=E,t[46]=j,t[47]=M):M=t[47],M}function zn(e){return e?Te._({id:`wTcjov`}):null}function Bn(e){let t=(0,Ft.c)(47),{_:n}=d(),r=a(),i=k(),o=J(),c=W();if(r)return null;let{input:l,installStates:f,dispatch:p}=e,m=l===null,h,g,_,v,y,b,x,S,C,w,T;if(t[0]!==n||t[1]!==p||t[2]!==l||t[3]!==m||t[4]!==f||t[5]!==c||t[6]!==o||t[7]!==i){let e=zn(m),r;t[19]!==f||t[20]!==c?(r=e=>G(c,e.id,f[e.id]?.installed),t[19]=f,t[20]=c,t[21]=r):r=t[21];let a=be.filter(r),d;t[22]===c?d=t[23]:(d=e=>U(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=d);let E=o.filter(d),D=i?me.filter(e=>K(c,e,i.installedClis)):[];_=a.length>0,v=i!==null&&D.length>0,y=E.length>0,g=Re,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),(0,Q.jsx)(u,{id:`O7_W_a`})]}),t[24]=T):T=t[24],h=ze,b=`max-h-80`,x=y?(0,Q.jsxs)(Ge,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(Ve,{children:(0,Q.jsx)(u,{id:`RXEbZy`})}),E.map(t=>{let r=t.name;return(0,Q.jsxs)(Le,{onSelect:()=>{l!==null&&Tn(l,{agent:{source:t.source,id:t.id}})},disabled:m,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(q,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==_||t[26]!==v||t[27]!==y?(S=y&&(v||_)?(0,Q.jsx)(Ke,{}):null,t[25]=_,t[26]=v,t[27]=y,t[28]=S):S=t[28],C=v?(0,Q.jsxs)(Ge,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(Ve,{children:(0,Q.jsx)(u,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=_e[t];return(0,Q.jsxs)(Le,{onSelect:()=>{l!==null&&i.launchInTerminal(l,t)},disabled:m,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(We,{id:He(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,w=_?(0,Q.jsxs)(Q.Fragment,{children:[v?(0,Q.jsx)(Ke,{}):null,(0,Q.jsxs)(Ge,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(Ve,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(u,{id:`BwKH4d`}),(0,Q.jsx)(Ze,{"aria-hidden":`true`,className:`size-3`})]}),a.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,Q.jsxs)(Le,{disabled:!r,onSelect:()=>{if(l){if(f[t.id]?.installed!==!0){dn(t);return}p(t.id,l)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(We,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Pn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=p,t[2]=l,t[3]=m,t[4]=f,t[5]=c,t[6]=o,t[7]=i,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]=T}else h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18];let E;t[29]!==_||t[30]!==v||t[31]!==y?(E=y||v||_?(0,Q.jsx)(Ke,{}):null,t[29]=_,t[30]=v,t[31]=y,t[32]=E):E=t[32];let D;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(Pe,{"aria-hidden":`true`}),t[33]=D):D=t[33];let O;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(Le,{onSelect:we,"data-testid":`empty-space-open-in-settings`,children:[D,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(u,{id:`jRAGrQ`})})]}),t[34]=O):O=t[34];let A;t[35]!==h||t[36]!==b||t[37]!==x||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==E?(A=(0,Q.jsxs)(h,{className:b,children:[x,S,C,w,E,O]}),t[35]=h,t[36]=b,t[37]=x,t[38]=S,t[39]=C,t[40]=w,t[41]=E,t[42]=A):A=t[42];let j;return t[43]!==g||t[44]!==T||t[45]!==A?(j=(0,Q.jsxs)(g,{children:[T,A]}),t[43]=g,t[44]=T,t[45]=A,t[46]=j):j=t[46],j}var Vn=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Hn(e){let t=le(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=se(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=Y(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=Vn.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Un(e,t,n){return e.filter(e=>{let r=i(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let a=Hn(r.docName);return a?.scope===t&&a.name===n})}function Wn(e,t,n){let r=vt(t,n);return e.filter(e=>{let a=i(e);return a.kind===`skill-file`?a.scope===t.scope&&a.name===t.name&&a.path===n:a.kind===`doc`&&a.docName===r})}function Gn(e,t,n){let r=Hn(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return vt(i,a)===e?{skill:i,filePath:a}:null}function Kn(e,t,n=(e,t)=>Ae(e,t)||Oe(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=Hn(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Hn(t);if(!e||r.has(`${e.scope}\u0000${e.name}`))continue;let o=e.scope===`project`?`global`:`project`,s=r.get(`${o}\u0000${e.name}`);e.rel===null&&s!==void 0?i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)}):n(e.scope,e.name)||(s!==void 0&&!a.has(`${e.scope}\u0000${e.name}`)?(a.add(`${e.scope}\u0000${e.name}`),i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)})):i.push({kind:`close`,docName:t}))}return i}function qn(){let e=(0,Ft.c)(15),{openTabs:t,closeDocument:n}=o(),r=dt(),i;e[0]===t?i=e[1]:(i=t.some(Yn),e[0]=t,e[1]=i);let a=i,s;e[2]===a?s=e[3]:(s={enabled:a},e[2]=a,e[3]=s);let c=Nt(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Jn).sort().join(``)}\u0002${De()}`;if(l.current===i)return;l.current=i;let a=Kn(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Jn(e){return`${e.scope}\u0000${e.name}`}function Yn(e){return Hn(e)!==null}function Xn(e){let t=(0,Ft.c)(18),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:a}=d(),{closeTabs:s,openTabs:c}=o(),[l,u]=(0,$.useState)(!1),f;t[0]!==a||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==c?(f=async function(e){u(!0);let t=await Dt(e.scope,e.name,e.hostQualifier);if(u(!1),!t.ok){let{error:e}=t;Z.error(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),s(Un(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,t[1]=s,t[2]=i,t[3]=r,t[4]=c,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==l||t[7]!==r?(h=e=>{!e&&!l&&r(!1)},t[6]=l,t[7]=r,t[8]=h):h=t[8];let _;t[9]!==a||t[10]!==l||t[11]!==p||t[12]!==n?(_=n?(0,Q.jsx)(g,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=a,t[10]=l,t[11]=p,t[12]=n,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==_?(v=(0,Q.jsx)(V,{open:m,onOpenChange:h,children:_}),t[14]=m,t[15]=h,t[16]=_,t[17]=v):v=t[17],v}function Zn(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 Qn(e){if(/\s/.test(e))return Te._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?Te._({id:`Zt7Ktx`}):t.some(e=>e===``)?Te._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?Te._({id:`yJkw6t`}):Zn(e)?null:Te._({id:`oP-FQW`})}function $n(e){let t=(0,Ft.c)(70),{target:n,onOpenChange:r}=e,{_:i}=d(),{openTarget:a}=o(),s=(0,$.useId)(),[c,l]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&l(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,x,S,C,w;if(t[6]!==c||t[7]!==f){w=c.trim(),x=w===``||w.endsWith(`/`),S=x?null:Qn(w),y=!(x||S!==null)&&!f,b=w.includes(`/`)?w.split(`/`).slice(0,-1).join(`/`):null;let e=w.split(`/`).pop()??``;C=e!==``&&!e.includes(`.`)?`${w}.md`:w,t[6]=c,t[7]=f,t[8]=y,t[9]=b,t[10]=x,t[11]=S,t[12]=C,t[13]=w}else y=t[8],b=t[9],x=t[10],S=t[11],C=t[12],w=t[13];let T=C,E;t[14]!==i||t[15]!==y||t[16]!==T||t[17]!==r||t[18]!==a||t[19]!==n?(E=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(T),t=await St({scope:n.skill.scope,name:n.skill.name,path:T,content:e?`# ${T.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`DvGkXq`,values:{0:t.error,effective:T}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=vt(n.skill,T);a({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=y,t[16]=T,t[17]=r,t[18]=a,t[19]=n,t[20]=E):E=t[20];let D=E,O;t[21]!==r||t[22]!==f?(O=e=>{!e&&!f&&r(!1)},t[21]=r,t[22]=f,t[23]=O):O=t[23];let k;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`wQvvZY`})}),t[24]=k):k=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(z,{children:[k,(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`lM4c-I`})})]}),t[25]=j):j=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(u,{id:`I6gXOa`}),t[26]=M):M=t[26];let N;t[27]===s?N=t[28]:(N=(0,Q.jsx)(H,{htmlFor:s,children:M}),t[27]=s,t[28]=N);let R;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>l(e.target.value),t[29]=R):R=t[29];let V=S!==null,U;t[30]===D?U=t[31]:(U=e=>{e.key===`Enter`&&D()},t[30]=D,t[31]=U);let W;t[32]!==s||t[33]!==c||t[34]!==V||t[35]!==U?(W=(0,Q.jsx)(jt,{id:s,value:c,onChange:R,placeholder:`references/notes.md`,"aria-invalid":V,onKeyDown:U}),t[32]=s,t[33]=c,t[34]=V,t[35]=U,t[36]=W):W=t[36];let G;t[37]!==T||t[38]!==b||t[39]!==x||t[40]!==S||t[41]!==w?(G=S===null?x&&w!==``?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`Vy6XCg`})}):T===w?b?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`9lso1Y`,values:{folderPart:b},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null:(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`zC5jrM`,values:{effective:T},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:S}),t[37]=T,t[38]=b,t[39]=x,t[40]=S,t[41]=w,t[42]=G):G=t[42];let K;t[43]!==N||t[44]!==W||t[45]!==G?(K=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,W,G]}),t[43]=N,t[44]=W,t[45]=G,t[46]=K):K=t[46];let q;t[47]===r?q=t[48]:(q=()=>r(!1),t[47]=r,t[48]=q);let J;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(u,{id:`dEgA5A`}),t[49]=J):J=t[49];let Y;t[50]!==f||t[51]!==q?(Y=(0,Q.jsx)(A,{variant:`outline`,onClick:q,disabled:f,children:J}),t[50]=f,t[51]=q,t[52]=Y):Y=t[52];let X;t[53]===D?X=t[54]:(X=()=>void D(),t[53]=D,t[54]=X);let ee=!y,te;t[55]===f?te=t[56]:(te=f?(0,Q.jsx)(u,{id:`E9bKSA`}):(0,Q.jsx)(u,{id:`hYgDIe`}),t[55]=f,t[56]=te);let ne;t[57]!==X||t[58]!==ee||t[59]!==te?(ne=(0,Q.jsx)(A,{onClick:X,disabled:ee,children:te}),t[57]=X,t[58]=ee,t[59]=te,t[60]=ne):ne=t[60];let re;t[61]!==Y||t[62]!==ne?(re=(0,Q.jsxs)(L,{children:[Y,ne]}),t[61]=Y,t[62]=ne,t[63]=re):re=t[63];let ie;t[64]!==K||t[65]!==re?(ie=(0,Q.jsxs)(I,{className:`sm:max-w-md`,children:[j,K,re]}),t[64]=K,t[65]=re,t[66]=ie):ie=t[66];let ae;return t[67]!==ie||t[68]!==O?(ae=(0,Q.jsx)(B,{open:!0,onOpenChange:O,children:ie}),t[67]=ie,t[68]=O,t[69]=ae):ae=t[69],ae}function er(e){let t=(0,Ft.c)(17),{target:n,onOpenChange:r}=e,{_:i}=d(),{closeTabs:a,openTabs:s}=o(),[c,l]=(0,$.useState)(!1),u;t[0]!==i||t[1]!==a||t[2]!==r||t[3]!==s?(u=async function(e){let{skill:t,filePath:n}=e;l(!0);let o=await Ot({scope:t.scope,name:t.name,path:n});if(l(!1),!o.ok){Z.error(i({id:`CBT70t`,values:{0:o.error}}));return}if(!o.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),a(Wn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=a,t[2]=r,t[3]=s,t[4]=u):u=t[4];let f=u,p=n!==null,m;t[5]!==c||t[6]!==r?(m=e=>{!e&&!c&&r(!1)},t[5]=c,t[6]=r,t[7]=m):m=t[7];let h;t[8]!==i||t[9]!==c||t[10]!==f||t[11]!==n?(h=n?(0,Q.jsx)(g,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:c,onDelete:()=>f(n),customDescription:i({id:`ppzof_`,values:{0:bt(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[8]=i,t[9]=c,t[10]=f,t[11]=n,t[12]=h):h=t[12];let _;return t[13]!==p||t[14]!==m||t[15]!==h?(_=(0,Q.jsx)(V,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=_):_=t[16],_}function tr(e){let t=(0,Ft.c)(64),{target:n,onOpenChange:r}=e,{_:i}=d(),a=dt(),o=(0,$.useId)(),[s,c]=(0,$.useState)(``),[l,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==s||t[7]!==n.filePath?(y=s.trim(),b=y===n.filePath,v=y===``||!Zn(y),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let x=v,S=!x&&!b&&!l,C;t[11]!==i||t[12]!==S||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(C=async function(){if(!n||!S)return;f(!0);let e=await Ct({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=S,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=C):C=t[17];let w=C,T;t[18]!==r||t[19]!==l?(T=e=>{!e&&!l&&r(!1)},t[18]=r,t[19]=l,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`yckias`})}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(z,{children:[E,(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`HzVAoz`})})]}),t[22]=D):D=t[22];let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(u,{id:`I6gXOa`}),t[23]=O):O=t[23];let k;t[24]===o?k=t[25]:(k=(0,Q.jsx)(H,{htmlFor:o,children:O}),t[24]=o,t[25]=k);let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>c(e.target.value),t[26]=j):j=t[26];let M=x&&y!==``,N;t[27]===w?N=t[28]:(N=e=>{e.key===`Enter`&&w()},t[27]=w,t[28]=N);let R;t[29]!==o||t[30]!==s||t[31]!==M||t[32]!==N?(R=(0,Q.jsx)(jt,{id:o,value:s,onChange:j,"aria-invalid":M,onKeyDown:N}),t[29]=o,t[30]=s,t[31]=M,t[32]=N,t[33]=R):R=t[33];let V;t[34]!==x||t[35]!==y?(V=x&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(u,{id:`fVzizW`})}):null,t[34]=x,t[35]=y,t[36]=V):V=t[36];let U;t[37]!==k||t[38]!==R||t[39]!==V?(U=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[k,R,V]}),t[37]=k,t[38]=R,t[39]=V,t[40]=U):U=t[40];let W;t[41]===r?W=t[42]:(W=()=>r(!1),t[41]=r,t[42]=W);let G;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(u,{id:`dEgA5A`}),t[43]=G):G=t[43];let K;t[44]!==l||t[45]!==W?(K=(0,Q.jsx)(A,{variant:`outline`,onClick:W,disabled:l,children:G}),t[44]=l,t[45]=W,t[46]=K):K=t[46];let q;t[47]===w?q=t[48]:(q=()=>void w(),t[47]=w,t[48]=q);let J=!S,Y;t[49]===l?Y=t[50]:(Y=l?(0,Q.jsx)(u,{id:`tHKQ6j`}):(0,Q.jsx)(u,{id:`2wxgft`}),t[49]=l,t[50]=Y);let X;t[51]!==q||t[52]!==J||t[53]!==Y?(X=(0,Q.jsx)(A,{onClick:q,disabled:J,children:Y}),t[51]=q,t[52]=J,t[53]=Y,t[54]=X):X=t[54];let ee;t[55]!==K||t[56]!==X?(ee=(0,Q.jsxs)(L,{children:[K,X]}),t[55]=K,t[56]=X,t[57]=ee):ee=t[57];let te;t[58]!==U||t[59]!==ee?(te=(0,Q.jsxs)(I,{className:`sm:max-w-md`,children:[D,U,ee]}),t[58]=U,t[59]=ee,t[60]=te):te=t[60];let ne;return t[61]!==te||t[62]!==T?(ne=(0,Q.jsx)(B,{open:!0,onOpenChange:T,children:te}),t[61]=te,t[62]=T,t[63]=ne):ne=t[63],ne}function nr(e){let t=(0,Ft.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=ft(),s=n!==null,c=(0,$.useId)(),[l,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,x,S,C;if(t[5]!==r||t[6]!==l||t[7]!==n.name){S=l.trim(),C=S===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===l?i=t[16]:(i=e.test(l),t[15]=l,t[16]=i),v=i,x=S.length>64,y=S===``||!ie.test(S)||x,b=!y&&!C&&r.has(S),t[5]=r,t[6]=l,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13];let w=b,T=!y&&!w&&!C&&!f,E;t[17]!==T||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==S?(E=async function(){if(!n||!T)return;p(!0);let e=await o({scope:n.scope,name:n.name},S);p(!1),e.ok&&(a?.(S),i(!1))},t[17]=T,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=S,t[23]=E):E=t[23];let D=E,O;t[24]===i?O=t[25]:(O=e=>e?null:i(!1),t[24]=i,t[25]=O);let k;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`dw_3cv`})}),t[26]=k):k=t[26];let j;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(z,{children:[k,(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`R9IDFz`})})]}),t[27]=j):j=t[27];let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(u,{id:`6YtxFj`}),t[28]=M):M=t[28];let N;t[29]===c?N=t[30]:(N=(0,Q.jsx)(H,{htmlFor:c,children:M}),t[29]=c,t[30]=N);let R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>d(e.target.value),t[31]=R):R=t[31];let V;t[32]===D?V=t[33]:(V=e=>{e.key===`Enter`&&D()},t[32]=D,t[33]=V);let U=y||w,W=y&&S!==``||w?`${c}-error`:void 0,G;t[34]!==c||t[35]!==l||t[36]!==V||t[37]!==U||t[38]!==W?(G=(0,Q.jsx)(jt,{id:c,value:l,onChange:R,onKeyDown:V,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":U,"aria-describedby":W,className:`font-mono`}),t[34]=c,t[35]=l,t[36]=V,t[37]=U,t[38]=W,t[39]=G):G=t[39];let K;t[40]!==w||t[41]!==v||t[42]!==c||t[43]!==y||t[44]!==x||t[45]!==S?(K=y&&S!==``?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(u,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):x?(0,Q.jsx)(u,{id:`lK9c4T`}):(0,Q.jsx)(u,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):w?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(u,{id:`YJ1BTp`})}):null,t[40]=w,t[41]=v,t[42]=c,t[43]=y,t[44]=x,t[45]=S,t[46]=K):K=t[46];let q;t[47]!==N||t[48]!==G||t[49]!==K?(q=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,G,K]}),t[47]=N,t[48]=G,t[49]=K,t[50]=q):q=t[50];let J;t[51]===i?J=t[52]:(J=()=>i(!1),t[51]=i,t[52]=J);let Y;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(u,{id:`dEgA5A`}),t[53]=Y):Y=t[53];let X;t[54]!==f||t[55]!==J?(X=(0,Q.jsx)(A,{variant:`outline`,onClick:J,disabled:f,children:Y}),t[54]=f,t[55]=J,t[56]=X):X=t[56];let ee;t[57]===D?ee=t[58]:(ee=()=>void D(),t[57]=D,t[58]=ee);let te=!T,ne;t[59]===f?ne=t[60]:(ne=f?(0,Q.jsx)(u,{id:`tHKQ6j`}):(0,Q.jsx)(u,{id:`2wxgft`}),t[59]=f,t[60]=ne);let re;t[61]!==ee||t[62]!==te||t[63]!==ne?(re=(0,Q.jsx)(A,{onClick:ee,disabled:te,children:ne}),t[61]=ee,t[62]=te,t[63]=ne,t[64]=re):re=t[64];let ae;t[65]!==X||t[66]!==re?(ae=(0,Q.jsxs)(L,{children:[X,re]}),t[65]=X,t[66]=re,t[67]=ae):ae=t[67];let oe;t[68]!==q||t[69]!==ae?(oe=(0,Q.jsxs)(I,{children:[j,q,ae]}),t[68]=q,t[69]=ae,t[70]=oe):oe=t[70];let se;return t[71]!==s||t[72]!==oe||t[73]!==O?(se=(0,Q.jsx)(B,{open:s,onOpenChange:O,children:oe}),t[71]=s,t[72]=oe,t[73]=O,t[74]=se):se=t[74],se}function rr(){let e=(0,Ft.c)(6),{_:t}=d(),n=xt(),r=dt(),{openTabs:i}=o(),a=Nt(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==a?(s=async(e,o)=>{if(o===e.scope)return!1;je(e.scope,e.name),ke(e.scope,e.name);let s=await Tt({name:e.name,fromScope:e.scope,toScope:o});if(Me(e.scope,e.name),!s.ok)return Ee(e.scope,e.name),Z.error(t({id:`07eGJB`,values:{0:s.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[o]}}));let c=a.status===`ready`?a.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,l=i.map(ar).filter(t=>{if(t.kind!==`doc`)return!1;let n=Hn(t.docName);return n?.scope===e.scope&&n.name===e.name}),u=l.find(ir)??l[0],d=u?.kind===`doc`?u.docName:c?_t(c):e.scope===`global`?ae(e.scope,e.name):null,f=o===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:ae(o,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return Ee(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=s):s=e[5],s}function ir(e){return e.kind===`doc`&&Hn(e.docName)?.rel===null}function ar(e){return i(e)}function or(e){let t=(0,Ft.c)(38),{target:n,onOpenChange:r}=e,i=xt(),a=rr(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:c,name:l,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[c],g=i[d],_=i[d],v;t[5]!==l||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:l},t[5]=l,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let x;t[13]!==m||t[14]!==b?(x=(0,Q.jsxs)(z,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(u,{id:`dEgA5A`}),t[16]=S):S=t[16];let C;t[17]===o?C=t[18]:(C=(0,Q.jsx)(R,{asChild:!0,children:(0,Q.jsx)(A,{variant:`outline`,disabled:o,children:S})}),t[17]=o,t[18]=C);let w;t[19]!==a||t[20]!==l||t[21]!==r||t[22]!==c||t[23]!==d?(w=async()=>{s(!0),await a({scope:c,name:l},d),s(!1),r(!1)},t[19]=a,t[20]=l,t[21]=r,t[22]=c,t[23]=d,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(u,{id:`QWdKwH`}),t[25]=T):T=t[25];let E;t[26]!==o||t[27]!==w?(E=(0,Q.jsx)(A,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:w,children:T}),t[26]=o,t[27]=w,t[28]=E):E=t[28];let D;t[29]!==C||t[30]!==E?(D=(0,Q.jsxs)(L,{children:[C,E]}),t[29]=C,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==x||t[33]!==D?(O=(0,Q.jsxs)(I,{className:`sm:max-w-md`,children:[x,D]}),t[32]=x,t[33]=D,t[34]=O):O=t[34];let k;return t[35]!==f||t[36]!==O?(k=(0,Q.jsx)(B,{open:!0,onOpenChange:f,children:O}),t[35]=f,t[36]=O,t[37]=k):k=t[37],k}var sr=(0,$.lazy)(async()=>({default:(await t(()=>import(`./SkillForkDialog-dYxaj5dE.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 cr(){let e=(0,Ft.c)(52),{_:t}=d(),n=mt(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),je(e.scope,e.name);let i=await Et({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(Ee(e.scope,e.name),y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=dr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),je(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await kt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}Ee(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),je(e.scope,e.name);let n=await t();return Ee(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 wt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O;e[7]===t?O=e[8]:(O=async function(e){let n=[...e.names];if(n.length===0)return;for(let t of n)je(e.scope,t);y(n[0]??null);let r=await At({scope:e.scope,names:n});for(let t of n)Ee(e.scope,t);if(y(null),!r.ok){Z.error(t({id:`nXHOFU`,values:{0:e.sourceLabel,1:r.error}}));return}let i=r.results.filter(ur),a=e.sourceLabel,o=r.updated,s=r.upToDate;if(i.length>0){let e=i.map(lr).join(`, `),n=i.length;Z.warning(t({id:`AgoIW4`,values:{source:a,updated:o,upToDate:s,failed:n,detail:e}}));return}Z.success(t(o>0?{id:`qd7L1J`,values:{source:a,updated:o,upToDate:s}}:{id:`XF1kgP`,values:{source:a}}))},e[7]=t,e[8]=O);let k=O,A,j;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||i(null)},j=()=>i(null),e[9]=A,e[10]=j):(A=e[9],j=e[10]);let M;e[11]===r?M=e[12]:(M=(0,Q.jsx)(Xn,{skill:r,onOpenChange:A,onDeleted:j}),e[11]=r,e[12]=M);let N=a?.skill??null,P=a?.existingNames??pr,F,I;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||o(null)},I=()=>o(null),e[13]=F,e[14]=I):(F=e[13],I=e[14]);let L;e[15]!==N||e[16]!==P?(L=(0,Q.jsx)(nr,{skill:N,existingNames:P,onOpenChange:F,onRenamed:I}),e[15]=N,e[16]=P,e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||c(null)},e[18]=R):R=e[18];let z;e[19]===s?z=e[20]:(z=(0,Q.jsx)(or,{target:s,onOpenChange:R}),e[19]=s,e[20]=z);let B;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{e||u(null)},e[21]=B):B=e[21];let V;e[22]===l?V=e[23]:(V=(0,Q.jsx)(tr,{target:l,onOpenChange:B}),e[22]=l,e[23]=V);let H;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{e||p(null)},e[24]=H):H=e[24];let U;e[25]===f?U=e[26]:(U=(0,Q.jsx)(er,{target:f,onOpenChange:H}),e[25]=f,e[26]=U);let W;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>{e||h(null)},e[27]=W):W=e[27];let G;e[28]===m?G=e[29]:(G=(0,Q.jsx)($n,{target:m,onOpenChange:W}),e[28]=m,e[29]=G);let K;e[30]===g?K=e[31]:(K=g?(0,Q.jsx)($.Suspense,{fallback:null,children:(0,Q.jsx)(sr,{target:g,onOpenChange:e=>{e||_(null)}})}):null,e[30]=g,e[31]=K);let q;e[32]!==L||e[33]!==z||e[34]!==V||e[35]!==U||e[36]!==G||e[37]!==K||e[38]!==M?(q=(0,Q.jsxs)(Q.Fragment,{children:[M,L,z,V,U,G,K]}),e[32]=L,e[33]=z,e[34]=V,e[35]=U,e[36]=G,e[37]=K,e[38]=M,e[39]=q):q=e[39];let J=q,Y,X,ee,te,ne,re;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(e,t)=>o({skill:e,existingNames:t}),X=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),ee=(e,t)=>u({skill:e,filePath:t}),te=(e,t)=>p({skill:e,filePath:t}),ne=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),re=(e,t)=>_({skill:e,editor:t}),e[40]=Y,e[41]=X,e[42]=ee,e[43]=te,e[44]=ne,e[45]=re):(Y=e[40],X=e[41],ee=e[42],te=e[43],ne=e[44],re=e[45]);let ie;return e[46]!==J||e[47]!==D||e[48]!==x||e[49]!==v||e[50]!==k?(ie={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,updateAllFromSource:k,requestDelete:i,requestRename:Y,requestScopeMove:X,requestFileRename:ee,requestFileDelete:te,requestFileCreate:ne,requestForkResolve:re,dialogs:J},e[46]=J,e[47]=D,e[48]=x,e[49]=v,e[50]=k,e[51]=ie):ie=e[51],ie}function lr(e){return e.error?`${e.requested} (${e.error})`:e.requested}function ur(e){return e.status===`failed`||e.status===`not-found`}function dr(e){return e.map(fr).join(`, `)}function fr(e){return ee[e]??e}var pr=new Set;function mr(e){let t=(0,Ft.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(pt,{"aria-hidden":!0}),c=Pt(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(E,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function hr(e){let t=(0,Ft.c)(68),{skill:n,filePath:r,actions:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,{_:s}=d(),l;t[0]!==r||t[1]!==n.absolutePath?(l=n.absolutePath?`${bt(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=l):l=t[2];let f=l,p;t[3]===n.path?p=t[4]:(p=bt(n.path),t[3]=n.path,t[4]=p);let h=`${p}/${r}`,g;t[5]===s?g=t[6]:(g=async function(e){try{await m(e),Z.success(s({id:`SXCSQd`}))}catch{Z.error(s({id:`cRHuuI`}))}},t[5]=s,t[6]=g);let _=g,v;t[7]!==i||t[8]!==r||t[9]!==n?(v=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=v):v=t[10];let x,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(Nn,{"aria-hidden":!0}),C=(0,Q.jsx)(u,{id:`2wxgft`}),t[11]=x,t[12]=C):(x=t[11],C=t[12]);let T;t[13]!==o||t[14]!==v?(T=(0,Q.jsxs)(E,{menuKind:o,onSelect:v,children:[x,C]}),t[13]=o,t[14]=v,t[15]=T):T=t[15];let D;t[16]!==f||t[17]!==o?(D=(0,Q.jsx)(mr,{absolutePath:f,menuKind:o}),t[16]=f,t[17]=o,t[18]=D):D=t[18];let k,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(c,{"aria-hidden":!0}),A=(0,Q.jsx)(u,{id:`zd00pH`}),t[19]=k,t[20]=A):(k=t[19],A=t[20]);let j;t[21]===o?j=t[22]:(j=(0,Q.jsxs)(b,{menuKind:o,children:[k,A]}),t[21]=o,t[22]=j);let M;t[23]!==f||t[24]!==_||t[25]!==o?(M=f?(0,Q.jsx)(E,{menuKind:o,onSelect:()=>void _(f),children:(0,Q.jsx)(u,{id:`z2funE`})}):null,t[23]=f,t[24]=_,t[25]=o,t[26]=M):M=t[26];let N;t[27]!==_||t[28]!==h?(N=()=>void _(h),t[27]=_,t[28]=h,t[29]=N):N=t[29];let P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(u,{id:`xloBjn`}),t[30]=P):P=t[30];let F;t[31]!==o||t[32]!==N?(F=(0,Q.jsx)(E,{menuKind:o,onSelect:N,children:P}),t[31]=o,t[32]=N,t[33]=F):F=t[33];let I;t[34]!==o||t[35]!==M||t[36]!==F?(I=(0,Q.jsxs)(w,{menuKind:o,children:[M,F]}),t[34]=o,t[35]=M,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==o||t[39]!==I?(L=(0,Q.jsx)(y,{menuKind:o,children:I}),t[38]=o,t[39]=I,t[40]=L):L=t[40];let R;t[41]!==o||t[42]!==j||t[43]!==L?(R=(0,Q.jsxs)(O,{menuKind:o,children:[j,L]}),t[41]=o,t[42]=j,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==o||t[46]!==R||t[47]!==T||t[48]!==D?(z=(0,Q.jsxs)(w,{menuKind:o,children:[T,D,R]}),t[45]=o,t[46]=R,t[47]=T,t[48]=D,t[49]=z):z=t[49];let B;t[50]===o?B=t[51]:(B=(0,Q.jsx)(S,{menuKind:o}),t[50]=o,t[51]=B);let V;t[52]!==i||t[53]!==r||t[54]!==n?(V=()=>i.requestFileDelete(n,r),t[52]=i,t[53]=r,t[54]=n,t[55]=V):V=t[55];let H,U;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(gt,{"aria-hidden":!0}),U=(0,Q.jsx)(u,{id:`cnGeoo`}),t[56]=H,t[57]=U):(H=t[56],U=t[57]);let W;t[58]!==o||t[59]!==V?(W=(0,Q.jsxs)(E,{menuKind:o,variant:`destructive`,onSelect:V,children:[H,U]}),t[58]=o,t[59]=V,t[60]=W):W=t[60];let G;t[61]!==o||t[62]!==W?(G=(0,Q.jsx)(w,{menuKind:o,children:W}),t[61]=o,t[62]=W,t[63]=G):G=t[63];let K;return t[64]!==z||t[65]!==B||t[66]!==G?(K=(0,Q.jsxs)(Q.Fragment,{children:[z,B,G]}),t[64]=z,t[65]=B,t[66]=G,t[67]=K):K=t[67],K}function gr(e){let t=(0,Ft.c)(42),{skill:n,actions:r,beforeDelete:i}=e,{_:a}=d(),o=T(n,r),s=n.absolutePath,l;t[0]===a?l=t[1]:(l=async function(e){try{await m(e),Z.success(a({id:`SXCSQd`}))}catch{Z.error(a({id:`cRHuuI`}))}},t[0]=a,t[1]=l);let f=l,p;t[2]===s?p=t[3]:(p=(0,Q.jsx)(mr,{absolutePath:s}),t[2]=s,t[3]=p);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsxs)(b,{menuKind:`dropdown`,children:[(0,Q.jsx)(c,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`zd00pH`})]}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==f?(g=s?(0,Q.jsx)(E,{menuKind:`dropdown`,onSelect:()=>void f(s),children:(0,Q.jsx)(u,{id:`z2funE`})}):null,t[5]=s,t[6]=f,t[7]=g):g=t[7];let _;t[8]!==f||t[9]!==n.path?(_=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=_):_=t[10];let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(u,{id:`xloBjn`}),t[11]=v):v=t[11];let x;t[12]===_?x=t[13]:(x=(0,Q.jsx)(E,{menuKind:`dropdown`,onSelect:_,children:v}),t[12]=_,t[13]=x);let k;t[14]!==g||t[15]!==x?(k=(0,Q.jsxs)(O,{menuKind:`dropdown`,children:[h,(0,Q.jsx)(y,{menuKind:`dropdown`,children:(0,Q.jsxs)(w,{menuKind:`dropdown`,children:[g,x]})})]}),t[14]=g,t[15]=x,t[16]=k):k=t[16];let A;t[17]!==p||t[18]!==k?(A=(0,Q.jsxs)(w,{menuKind:`dropdown`,children:[p,k]}),t[17]=p,t[18]=k,t[19]=A):A=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(S,{menuKind:`dropdown`}),t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(b,{menuKind:`dropdown`,children:[(0,Q.jsx)(Mn,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`TKQ7K-`})]}),t[21]=M):M=t[21];let N;t[22]!==r||t[23]!==n?(N=e=>r.requestForkResolve(n,e),t[22]=r,t[23]=n,t[24]=N):N=t[24];let P;t[25]!==o||t[26]!==n||t[27]!==N?(P=(0,Q.jsx)(w,{menuKind:`dropdown`,children:(0,Q.jsxs)(O,{menuKind:`dropdown`,children:[M,(0,Q.jsx)(y,{menuKind:`dropdown`,className:D,children:(0,Q.jsx)(w,{menuKind:`dropdown`,children:(0,Q.jsx)(C,{toggles:o,skill:n,menuKind:`dropdown`,onResolveFork:N})})})]})}),t[25]=o,t[26]=n,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(S,{menuKind:`dropdown`}),t[29]=F):F=t[29];let I;t[30]!==r||t[31]!==n?(I=()=>r.requestDelete(n),t[30]=r,t[31]=n,t[32]=I):I=t[32];let L,R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(gt,{"aria-hidden":!0}),R=(0,Q.jsx)(u,{id:`cnGeoo`}),t[33]=L,t[34]=R):(L=t[33],R=t[34]);let z;t[35]===I?z=t[36]:(z=(0,Q.jsx)(w,{menuKind:`dropdown`,children:(0,Q.jsxs)(E,{menuKind:`dropdown`,variant:`destructive`,onSelect:I,children:[L,R]})}),t[35]=I,t[36]=z);let B;return t[37]!==i||t[38]!==P||t[39]!==z||t[40]!==A?(B=(0,Q.jsxs)(Q.Fragment,{children:[A,j,P,i,F,z]}),t[37]=i,t[38]=P,t[39]=z,t[40]=A,t[41]=B):B=t[41],B}function _r(e){let t=(0,Ft.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Ye(),c=_().states,{dispatch:l}=An(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=pn({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,p;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(p=o===`context`?(0,Q.jsx)(Bn,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(Rn,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=p):p=t[8];let m;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==p?(m=(0,Q.jsx)(vr,{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 vr(e){let t=(0,Ft.c)(65),{actions:n,existingNames:i,menuKind:a,openWithAi:o,skill:s}=e,{_:l}=d(),f=xt(),p=T(s,n),g=s.absolutePath,_=s.hostQualifier!==void 0,x;t[0]===l?x=t[1]:(x=async function(e){try{await m(e),Z.success(l({id:`SXCSQd`}))}catch{Z.error(l({id:`cRHuuI`}))}},t[0]=l,t[1]=x);let k=x,A;t[2]!==g||t[3]!==a?(A=(0,Q.jsx)(mr,{absolutePath:g,menuKind:a}),t[2]=g,t[3]=a,t[4]=A):A=t[4];let j,M;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(c,{"aria-hidden":!0}),M=(0,Q.jsx)(u,{id:`zd00pH`}),t[5]=j,t[6]=M):(j=t[5],M=t[6]);let N;t[7]===a?N=t[8]:(N=(0,Q.jsxs)(b,{menuKind:a,children:[j,M]}),t[7]=a,t[8]=N);let P;t[9]!==g||t[10]!==k||t[11]!==a?(P=g?(0,Q.jsx)(E,{menuKind:a,onSelect:()=>void k(g),children:(0,Q.jsx)(u,{id:`z2funE`})}):null,t[9]=g,t[10]=k,t[11]=a,t[12]=P):P=t[12];let F;t[13]!==k||t[14]!==s.path?(F=()=>void k(s.path),t[13]=k,t[14]=s.path,t[15]=F):F=t[15];let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(u,{id:`xloBjn`}),t[16]=I):I=t[16];let L;t[17]!==a||t[18]!==F?(L=(0,Q.jsx)(E,{menuKind:a,onSelect:F,children:I}),t[17]=a,t[18]=F,t[19]=L):L=t[19];let R;t[20]!==a||t[21]!==P||t[22]!==L?(R=(0,Q.jsxs)(w,{menuKind:a,children:[P,L]}),t[20]=a,t[21]=P,t[22]=L,t[23]=R):R=t[23];let z;t[24]!==a||t[25]!==R?(z=(0,Q.jsx)(y,{menuKind:a,children:R}),t[24]=a,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==a||t[28]!==z||t[29]!==N?(B=(0,Q.jsxs)(O,{menuKind:a,children:[N,z]}),t[27]=a,t[28]=z,t[29]=N,t[30]=B):B=t[30];let V;t[31]!==a||t[32]!==o||t[33]!==B||t[34]!==A?(V=(0,Q.jsxs)(w,{menuKind:a,children:[A,o,B]}),t[31]=a,t[32]=o,t[33]=B,t[34]=A,t[35]=V):V=t[35];let H;t[36]===a?H=t[37]:(H=(0,Q.jsx)(S,{menuKind:a}),t[36]=a,t[37]=H);let U;t[38]!==n||t[39]!==i||t[40]!==p||t[41]!==a||t[42]!==_||t[43]!==f||t[44]!==s?(U=_?(0,Q.jsx)(w,{menuKind:a,children:(0,Q.jsx)(v,{menuKind:a,className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`D0CegO`})})}):(0,Q.jsxs)(w,{menuKind:a,children:[(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>void n.duplicate(s,i),children:[(0,Q.jsx)(r,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`euc6Ns`})]}),(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>n.requestRename(s,i),children:[(0,Q.jsx)(Nn,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`2wxgft`})]}),(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>n.requestFileCreate(s),children:[(0,Q.jsx)(h,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`HdkSiO`})]}),(0,Q.jsxs)(O,{menuKind:a,children:[(0,Q.jsxs)(b,{menuKind:a,children:[(0,Q.jsx)(Mn,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`TKQ7K-`})]}),(0,Q.jsx)(y,{menuKind:a,className:D,children:(0,Q.jsx)(w,{menuKind:a,children:(0,Q.jsx)(C,{toggles:p,skill:s,menuKind:a,onResolveFork:e=>n.requestForkResolve(s,e)})})})]}),(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>n.requestScopeMove(s,s.scope===`project`?`global`:`project`),children:[(0,Q.jsx)(jn,{"aria-hidden":!0}),s.scope===`project`?(0,Q.jsx)(u,{id:`bpytj4`,values:{0:f.global}}):(0,Q.jsx)(u,{id:`bpytj4`,values:{0:f.project}})]})]}),t[38]=n,t[39]=i,t[40]=p,t[41]=a,t[42]=_,t[43]=f,t[44]=s,t[45]=U):U=t[45];let W;t[46]===a?W=t[47]:(W=(0,Q.jsx)(S,{menuKind:a}),t[46]=a,t[47]=W);let G;t[48]!==n||t[49]!==s?(G=()=>n.requestDelete(s),t[48]=n,t[49]=s,t[50]=G):G=t[50];let K,q;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(gt,{"aria-hidden":!0}),q=(0,Q.jsx)(u,{id:`cnGeoo`}),t[51]=K,t[52]=q):(K=t[51],q=t[52]);let J;t[53]!==a||t[54]!==G?(J=(0,Q.jsxs)(E,{menuKind:a,variant:`destructive`,onSelect:G,children:[K,q]}),t[53]=a,t[54]=G,t[55]=J):J=t[55];let Y;t[56]!==a||t[57]!==J?(Y=(0,Q.jsx)(w,{menuKind:a,children:J}),t[56]=a,t[57]=J,t[58]=Y):Y=t[58];let X;return t[59]!==V||t[60]!==H||t[61]!==U||t[62]!==W||t[63]!==Y?(X=(0,Q.jsxs)(Q.Fragment,{children:[V,H,U,W,Y]}),t[59]=V,t[60]=H,t[61]=U,t[62]=W,t[63]=Y,t[64]=X):X=t[64],X}function yr(e){let t=(0,Ft.c)(48),{scope:n,name:r,showNewFile:i}=e,a=i===void 0?!0:i,{_:o}=d(),s=Nt(),c=cr(),l=s.status===`ready`?s.data:void 0,f;t[0]!==l||t[1]!==r||t[2]!==n?(f=l?.find(e=>e.scope===n&&e.name===r),t[0]=l,t[1]=r,t[2]=n,t[3]=f):f=t[3];let m=f,g;t[4]!==m||t[5]!==l||t[6]!==r?(g=m===void 0?l?.filter(e=>e.name===r):void 0,t[4]=m,t[5]=l,t[6]=r,t[7]=g):g=t[7];let _=g,v=m??(_?.length===1?_[0]:void 0),y;t[8]!==v||t[9]!==r||t[10]!==n?(y=v??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=v,t[9]=r,t[10]=n,t[11]=y):y=t[11];let b=y,[S,w]=(0,$.useState)(!1),E=T(b,c),{installed:O,installing:k,hostSet:j}=E,M=v===void 0&&!O,N;t[12]!==v||t[13]!==j?(N=v?yt(v,[...j]):[],t[12]=v,t[13]=j,t[14]=N):N=t[14];let P=N,F;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==b?(F=a?(0,Q.jsx)(A,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(b),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Q.jsx)(h,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=b,t[19]=F):F=t[19];let I=M?`resolving`:`installed`,L=M?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,R;t[20]===L?R=t[21]:(R=p(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,L),t[20]=L,t[21]=R);let z;t[22]!==P||t[23]!==k||t[24]!==M?(z=k?(0,Q.jsx)(u,{id:`b4itZn`}):M?(0,Q.jsx)(u,{id:`iKvAeG`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{id:`eQkgKV`}),(0,Q.jsx)(x,{hosts:P,className:`text-muted-foreground`})]}),t[22]=P,t[23]=k,t[24]=M,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Qe,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[26]=B):B=t[26];let V;t[27]!==k||t[28]!==z||t[29]!==I||t[30]!==R?(V=(0,Q.jsx)(at,{asChild:!0,children:(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,disabled:k,"data-testid":`skill-install-menu-trigger`,"data-state":I,className:R,children:[z,B]})}),t[27]=k,t[28]=z,t[29]=I,t[30]=R,t[31]=V):V=t[31];let H;t[32]!==c||t[33]!==b?(H=e=>c.requestForkResolve(b,e),t[32]=c,t[33]=b,t[34]=H):H=t[34];let U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>w(!1),t[35]=U):U=t[35];let W;t[36]!==b||t[37]!==H||t[38]!==E?(W=(0,Q.jsx)(ct,{align:`end`,className:D,children:(0,Q.jsx)(C,{toggles:E,skill:b,onResolveFork:H,onRunStart:U})}),t[36]=b,t[37]=H,t[38]=E,t[39]=W):W=t[39];let G;t[40]!==S||t[41]!==V||t[42]!==W?(G=(0,Q.jsxs)(lt,{modal:!1,open:S,onOpenChange:w,children:[V,W]}),t[40]=S,t[41]=V,t[42]=W,t[43]=G):G=t[43];let K;return t[44]!==c.dialogs||t[45]!==G||t[46]!==F?(K=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[F,G,c.dialogs]}),t[44]=c.dialogs,t[45]=G,t[46]=F,t[47]=K):K=t[47],K}var br=`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 xr(e){let t=(0,Ft.c)(24),{value:n,onSelect:r,disabled:i}=e,a=(0,$.useId)(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(ot,{children:(0,Q.jsx)(u,{id:`YvwwqC`})}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=e=>r(e),t[1]=r,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(u,{id:`ZWyHmq`}),t[3]=c):c=t[3];let l;t[4]!==a||t[5]!==i?(l=(0,Q.jsx)(it,{value:`project`,disabled:i,onSelect:Cr,"aria-describedby":a,className:br,children:c}),t[4]=a,t[5]=i,t[6]=l):l=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(u,{id:`ImTzPZ`}),t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==i?(f=(0,Q.jsx)(it,{value:`global`,disabled:i,onSelect:Sr,"aria-describedby":a,className:br,children:d}),t[8]=a,t[9]=i,t[10]=f):f=t[10];let p;t[11]!==s||t[12]!==l||t[13]!==f||t[14]!==n?(p=(0,Q.jsxs)(et,{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:[l,f]}),t[11]=s,t[12]=l,t[13]=f,t[14]=n,t[15]=p):p=t[15];let m;t[16]===n?m=t[17]:(m=n===`project`?(0,Q.jsx)(u,{id:`9x-lMu`}):(0,Q.jsx)(u,{id:`AyKwqp`}),t[16]=n,t[17]=m);let h;t[18]!==a||t[19]!==m?(h=(0,Q.jsx)(`div`,{id:a,className:`px-2 pt-1 pb-1.5 text-xs leading-snug text-muted-foreground`,"data-testid":`skill-scope-consequence`,children:m}),t[18]=a,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[o,p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Sr(e){return e.preventDefault()}function Cr(e){return e.preventDefault()}function wr(e){let t=(0,Ft.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:s}=d(),c=o>0,l;t[0]!==s||t[1]!==c||t[2]!==o?(l=s(c?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=s,t[1]=c,t[2]=o,t[3]=l):l=t[3];let f=l,m;t[4]===r?m=t[5]:(m=p(`relative`,r),t[4]=r,t[5]=m);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ht,{}),t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==o?(g=c?(0,Q.jsx)(Mt,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=c,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(j,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==f||t[13]!==n||t[14]!==m||t[15]!==_?(v=(0,Q.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":f,onClick:n,"data-testid":`add-properties-button`,className:m,asChild:!0,children:_}),t[12]=f,t[13]=n,t[14]=m,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==c||t[18]!==a?(y=(0,Q.jsx)(M,{side:`bottom`,children:c?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(u,{id:`AwrGuz`})}),a?.map(Tr),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(u,{id:`yh5-4s`})})]}):(0,Q.jsx)(u,{id:`81H_23`})}),t[17]=c,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(N,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function Tr(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}export{An as A,cn as C,Dn as D,xn as E,sn as M,dn as O,fn as S,pn as T,Fn as _,hr as a,mn as b,cr as c,Un as d,qn as f,Pn as g,In as h,_r as i,on as j,Tn as k,or as l,Rn as m,xr as n,gr as o,Bn as p,yr as r,mr as s,wr as t,Gn as u,Mn as v,ln as w,un as x,jn 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{Sr as r,Xt as i,Z as a,i as o,nr as s,xr as c}from"./DocumentContext-CCqrdOs8.js";import{t as l}from"./react-f2sANaYj.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{t as p}from"./utils-CPqDy6Hr.js";import{n as m}from"./clipboard-adapter-815RzzoI.js";import{S as h,_ as g,b as _,c as v,d as y,f as b,h as x,l as S,n as C,o as w,r as T,s as E,t as D,u as O,y as k}from"./SkillInstallMenu-D6T8E32d.js";import{t as A}from"./button-Cym3gapE.js";import{i as j,n as M,t as N}from"./tooltip-DttaCTqz.js";import{a as P,c as F,i as I,o as L,r as R,s as z,t as B}from"./dialog-BYTIciug.js";import{t as V}from"./alert-dialog-Btd1iU_X.js";import{t as H}from"./label-D-K3fWtj.js";import{a as U,f as W,i as G,o as K,t as q,y as J}from"./RegisteredAgentIcon-YDviE6X3.js";import{Bs as Y,Cn as X,Dc as ee,En as te,Gn as ne,Hn as re,It as ie,Ks as ae,Qn as oe,Rs as se,Un as ce,Vs as le,Wn as ue,Xn as de,Yn as fe,Zn as pe,ac as me,hn as he,ht as ge,ic as _e,mt as ve,oa as ye,oc as be,qn as xe,tc as Se,wn as Ce}from"./dist-BAMccoiQ.js";import{n as Z}from"./dist-CJhtNlOm2.js";import{a as we}from"./use-settings-route-C9scHnRY.js";import{t as Te}from"./dist-Cr4-nBVI.js";import{d as Ee,h as De,m as Oe,n as ke,p as Ae,r as je,u as Me}from"./documents-events-Bn2F4Kjs.js";import{a as Ne,r as Pe}from"./local-menu-action-bus-4I1Xm40D.js";import{i as Fe}from"./use-apply-config-theme-DpLdjUDN.js";import{t as Ie}from"./parse-api-error-BtEdpaFC.js";import{c as Le,d as Re,f as ze,h as Be,l as Ve,n as He,p as Ue,r as We,s as Ge,u as Ke}from"./terminal-cli-display-Bw4dSufC.js";import{n as qe,t as Je}from"./workspace-paths-Dczkx4vn.js";import{n as Ye}from"./use-workspace-DFnkEIDS.js";import{t as Xe}from"./createLucideIcon-B6ULg5PN.js";import{t as Ze}from"./arrow-up-right-B3B9a7te.js";import{t as Qe}from"./chevron-down-Dloks0wp.js";import{a as $e,c as et,d as tt,f as nt,i as rt,l as it,m as at,o as ot,p as st,r as ct,t as lt,u as ut}from"./dropdown-menu--ZF4igWe.js";import{n as dt,r as ft}from"./ManagedArtifactProperties-D3aoeLtI.js";import{t as pt}from"./folder-open-dlosmFj2.js";import{t as mt}from"./use-open-skill-BRBShUEV.js";import{t as ht}from"./list-plus-BmoxCvSM.js";import{t as gt}from"./trash-2-CeAwTay6.js";import{m as _t,p as vt}from"./page-list-cache-BZ2ZBwsu.js";import{a as yt,o as bt,p as xt}from"./skill-scope-C1Qgc63z.js";import{F as St,T as Ct,a as wt,b as Tt,h as Et,n as Dt,r as Ot,t as kt,w as At}from"./skills-api-BMqLu4Hb.js";import{t as jt}from"./input-BJ0fEcsi.js";import{t as Mt}from"./badge-C8hrUpuH.js";import{t as Nt}from"./use-skills-sMW0gn5i.js";import{n as Pt}from"./platform-labels-B3xX8Yyl.js";var Q=n(),$=e(l(),1),Ft=f();function It(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 Lt(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=Ie(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:Te._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Te._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Te._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Rt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?It(e):Lt()}var zt=`ok:skill:cowork:installed`,Bt=`1`,Vt=250,Ht=`/api/skill/install-state`;function Ut(e){return`${zt}:v${e}`}var Wt=new Map;async function Gt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Wt.get(n);if(r)return r;let i=Kt(e,t);return Wt.set(n,i),i.finally(()=>{Wt.get(n)===i&&Wt.delete(n)}),i}async function Kt(e,t){let n=e.installer===void 0?Rt():e.installer,r=qt(e.storage),i=e.fetchSnapshot??Yt,a=e.serverTimeoutMs??Vt,o=null;if(!t.force){try{o=await Xt(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=Ut(o?.currentVersion??e.fallbackSkillVersion??Jt());if(!t.force&&r?.getItem(s)===Bt)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,Bt)}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 qt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Jt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Yt(){let e;try{e=await fetch(Ht,{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 Xt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Zt(e){return Gt({},e)}function Qt(){return Gt({},{force:!0})}async function $t(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 en(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return $t({target:`claude-cowork`,url:X({mode:`cowork`},e)},n);case`claude-code`:return $t({target:`claude-code`,url:X({mode:`code`},e)},n);case`codex`:return $t({target:`codex`,url:Ce(e)},n);case`cursor`:return $t({target:`cursor`,url:te(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function tn(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 nn=`open-knowledge:agent-thread-launch`;function rn(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 an(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 on(e,t=typeof window>`u`?new EventTarget:window){let n=rn(e);if(Ne(n,t)){an(e,n);return}t.dispatchEvent(new CustomEvent(nn,{detail:e}))}function sn(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(nn,n),()=>t.removeEventListener(nn,n)}function cn(e){if(!e.docName||!e.workspace)return null;let t=Je(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:qe(n,t,r)}}function ln(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function un(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 dn(e){return Be(e.installUrl).then(()=>void 0)}function fn(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function pn(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function mn(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??Je(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:qe(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 hn(e){return`Opened in ${e}.`}function gn(e,t=1){return t>=3?Te._({id:`bi2C2s`,values:{displayName:e}}):t===2?Te._({id:`1J0c0X`,values:{displayName:e}}):Te._({id:`Xs7IcT`,values:{displayName:e}})}function _n(e){return e>=3?null:e===2?Te._({id:`Xp94R1`}):Te._({id:`6gRgw8`})}function vn(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 yn(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 bn(e,t,n,r){return e.compose?he(yn(e.compose,t,n,r)):e.selection?fe({...e.selection,target:t,transport:r}):e.skill?de(e.skill.name,e.skill.scope,n):e.ask?re(e.ask.relativePath,e.ask.instruction,n,t,r):ye(e.docContext===null?e.folderRelativePath?xe(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?ue(n,e.instruction,r):ce(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):ne(e.docContext.relativePath,n,e.instruction,r))}function xn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||n?`${ve} ${bn(e,_e[t].handoffTarget,!1,`terminal`)}`:pe(e.docContext?.relativePath??null)}function Sn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||e.skill!==void 0||t?`${ge} ${bn(e,`claude-code`,!1,`terminal`)}`:oe(e.docContext?.relativePath??null)}function Cn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function wn(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 Tn(e,t){on({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:Sn(e),docName:Cn(e),titleHint:wn(e),attachments:e.attachments??null})}async function En(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(Te._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Te._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Te._({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:bn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=vn(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(hn(u));else{let i=_n(r),a=gn(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{En(e,t,n,r+1)}}})}return a}function Dn(e){return Se.find(t=>t.id===e)?.displayName??e}function On(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kn(){return{dispatchHandoff:en,recordHandoff:tn,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>On(),getDisplayName:Dn,ensureCoworkSkillInstalled:Zt,autoOpen:!0}}function An(){let e=(0,Ft.c)(2),{merged:t}=Fe(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>En(e,t,{...kn(),autoOpen:n}),reinstallCoworkSkill:Qt},e[0]=n,e[1]=r),r}var jn=Xe(`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`}]]),Mn=Xe(`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`}]]),Nn=Xe(`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 Pn(e){let t=(0,Ft.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(u,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Fn(e){let t=(0,Ft.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(u,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function In(e){let t=(0,Ft.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(u,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function Ln(e){return e?Te._({id:`wTcjov`}):null}function Rn(e){let t=(0,Ft.c)(48),{_:n}=d(),r=a(),i=k(),o=J(),c=W();if(r)return null;let{input:l,installStates:f,dispatch:p,onBeforeLaunch:m}=e,h=l===null,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==n||t[1]!==p||t[2]!==l||t[3]!==h||t[4]!==f||t[5]!==m||t[6]!==c||t[7]!==o||t[8]!==i){let e=Ln(h),r;t[20]!==f||t[21]!==c?(r=e=>G(c,e.id,f[e.id]?.installed),t[20]=f,t[21]=c,t[22]=r):r=t[22];let a=be.filter(r),d;t[23]===c?d=t[24]:(d=e=>U(c,e.source,e.id,!0,e.supported),t[23]=c,t[24]=d);let D=o.filter(d),O=i?me.filter(e=>K(c,e,i.installedClis)):[];v=a.length>0,y=i!==null&&O.length>0,b=D.length>0,_=tt,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(st,{children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),(0,Q.jsx)(u,{id:`O7_W_a`})]}),t[25]=E):E=t[25],g=nt,x=`max-h-80`,S=b?(0,Q.jsxs)(rt,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(ot,{children:(0,Q.jsx)(u,{id:`RXEbZy`})}),D.map(t=>{let r=t.name;return(0,Q.jsxs)($e,{onSelect:()=>{l!==null&&(m?.(),Tn(l,{agent:{source:t.source,id:t.id}}))},disabled:h,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(q,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==v||t[27]!==y||t[28]!==b?(C=b&&(y||v)?(0,Q.jsx)(ut,{}):null,t[26]=v,t[27]=y,t[28]=b,t[29]=C):C=t[29],w=y?(0,Q.jsxs)(rt,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(ot,{children:(0,Q.jsx)(u,{id:`ALhMYW`})}),O.map(t=>{let{displayName:r}=_e[t];return(0,Q.jsxs)($e,{onSelect:()=>{l!==null&&(m?.(),i.launchInTerminal(l,t))},disabled:h,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(We,{id:He(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,T=v?(0,Q.jsxs)(Q.Fragment,{children:[y?(0,Q.jsx)(ut,{}):null,(0,Q.jsxs)(rt,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(ot,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(u,{id:`BwKH4d`}),(0,Q.jsx)(Ze,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let r=!h,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)($e,{disabled:!r,onSelect:()=>{if(l){if(m?.(),f[t.id]?.installed!==!0){dn(t);return}p(t.id,l)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(We,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Pn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=p,t[2]=l,t[3]=h,t[4]=f,t[5]=m,t[6]=c,t[7]=o,t[8]=i,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]=E}else g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19];let D;t[30]!==v||t[31]!==y||t[32]!==b?(D=b||y||v?(0,Q.jsx)(ut,{}):null,t[30]=v,t[31]=y,t[32]=b,t[33]=D):D=t[33];let O;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(Pe,{"aria-hidden":`true`}),t[34]=O):O=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)($e,{onSelect:we,"data-testid":`file-tree-open-in-settings`,children:[O,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(u,{id:`jRAGrQ`})})]}),t[35]=A):A=t[35];let j;t[36]!==g||t[37]!==x||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==T||t[42]!==D?(j=(0,Q.jsxs)(g,{className:x,children:[S,C,w,T,D,A]}),t[36]=g,t[37]=x,t[38]=S,t[39]=C,t[40]=w,t[41]=T,t[42]=D,t[43]=j):j=t[43];let M;return t[44]!==_||t[45]!==E||t[46]!==j?(M=(0,Q.jsxs)(_,{children:[E,j]}),t[44]=_,t[45]=E,t[46]=j,t[47]=M):M=t[47],M}function zn(e){return e?Te._({id:`wTcjov`}):null}function Bn(e){let t=(0,Ft.c)(47),{_:n}=d(),r=a(),i=k(),o=J(),c=W();if(r)return null;let{input:l,installStates:f,dispatch:p}=e,m=l===null,h,g,_,v,y,b,x,S,C,w,T;if(t[0]!==n||t[1]!==p||t[2]!==l||t[3]!==m||t[4]!==f||t[5]!==c||t[6]!==o||t[7]!==i){let e=zn(m),r;t[19]!==f||t[20]!==c?(r=e=>G(c,e.id,f[e.id]?.installed),t[19]=f,t[20]=c,t[21]=r):r=t[21];let a=be.filter(r),d;t[22]===c?d=t[23]:(d=e=>U(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=d);let E=o.filter(d),D=i?me.filter(e=>K(c,e,i.installedClis)):[];_=a.length>0,v=i!==null&&D.length>0,y=E.length>0,g=Re,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(s,{"aria-hidden":`true`}),(0,Q.jsx)(u,{id:`O7_W_a`})]}),t[24]=T):T=t[24],h=ze,b=`max-h-80`,x=y?(0,Q.jsxs)(Ge,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(Ve,{children:(0,Q.jsx)(u,{id:`RXEbZy`})}),E.map(t=>{let r=t.name;return(0,Q.jsxs)(Le,{onSelect:()=>{l!==null&&Tn(l,{agent:{source:t.source,id:t.id}})},disabled:m,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(q,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==_||t[26]!==v||t[27]!==y?(S=y&&(v||_)?(0,Q.jsx)(Ke,{}):null,t[25]=_,t[26]=v,t[27]=y,t[28]=S):S=t[28],C=v?(0,Q.jsxs)(Ge,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(Ve,{children:(0,Q.jsx)(u,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=_e[t];return(0,Q.jsxs)(Le,{onSelect:()=>{l!==null&&i.launchInTerminal(l,t)},disabled:m,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(We,{id:He(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,w=_?(0,Q.jsxs)(Q.Fragment,{children:[v?(0,Q.jsx)(Ke,{}):null,(0,Q.jsxs)(Ge,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(Ve,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(u,{id:`BwKH4d`}),(0,Q.jsx)(Ze,{"aria-hidden":`true`,className:`size-3`})]}),a.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,Q.jsxs)(Le,{disabled:!r,onSelect:()=>{if(l){if(f[t.id]?.installed!==!0){dn(t);return}p(t.id,l)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(We,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(Pn,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=p,t[2]=l,t[3]=m,t[4]=f,t[5]=c,t[6]=o,t[7]=i,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]=T}else h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18];let E;t[29]!==_||t[30]!==v||t[31]!==y?(E=y||v||_?(0,Q.jsx)(Ke,{}):null,t[29]=_,t[30]=v,t[31]=y,t[32]=E):E=t[32];let D;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(Pe,{"aria-hidden":`true`}),t[33]=D):D=t[33];let O;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(Le,{onSelect:we,"data-testid":`empty-space-open-in-settings`,children:[D,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(u,{id:`jRAGrQ`})})]}),t[34]=O):O=t[34];let A;t[35]!==h||t[36]!==b||t[37]!==x||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==E?(A=(0,Q.jsxs)(h,{className:b,children:[x,S,C,w,E,O]}),t[35]=h,t[36]=b,t[37]=x,t[38]=S,t[39]=C,t[40]=w,t[41]=E,t[42]=A):A=t[42];let j;return t[43]!==g||t[44]!==T||t[45]!==A?(j=(0,Q.jsxs)(g,{children:[T,A]}),t[43]=g,t[44]=T,t[45]=A,t[46]=j):j=t[46],j}var Vn=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function Hn(e){let t=le(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=se(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=Y(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=Vn.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Un(e,t,n){return e.filter(e=>{let r=i(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let a=Hn(r.docName);return a?.scope===t&&a.name===n})}function Wn(e,t,n){let r=vt(t,n);return e.filter(e=>{let a=i(e);return a.kind===`skill-file`?a.scope===t.scope&&a.name===t.name&&a.path===n:a.kind===`doc`&&a.docName===r})}function Gn(e,t,n){let r=Hn(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return vt(i,a)===e?{skill:i,filePath:a}:null}function Kn(e,t,n=(e,t)=>Ae(e,t)||Oe(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=Hn(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=Hn(t);if(!e||r.has(`${e.scope}\u0000${e.name}`))continue;let o=e.scope===`project`?`global`:`project`,s=r.get(`${o}\u0000${e.name}`);e.rel===null&&s!==void 0?i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)}):n(e.scope,e.name)||(s!==void 0&&!a.has(`${e.scope}\u0000${e.name}`)?(a.add(`${e.scope}\u0000${e.name}`),i.push({kind:`retarget`,fromDocName:t,toDocName:_t(s)})):i.push({kind:`close`,docName:t}))}return i}function qn(){let e=(0,Ft.c)(15),{openTabs:t,closeDocument:n}=o(),r=dt(),i;e[0]===t?i=e[1]:(i=t.some(Yn),e[0]=t,e[1]=i);let a=i,s;e[2]===a?s=e[3]:(s={enabled:a},e[2]=a,e[3]=s);let c=Nt(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Jn).sort().join(``)}\u0002${De()}`;if(l.current===i)return;l.current=i;let a=Kn(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Jn(e){return`${e.scope}\u0000${e.name}`}function Yn(e){return Hn(e)!==null}function Xn(e){let t=(0,Ft.c)(18),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:a}=d(),{closeTabs:s,openTabs:c}=o(),[l,u]=(0,$.useState)(!1),f;t[0]!==a||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==c?(f=async function(e){u(!0);let t=await Dt(e.scope,e.name,e.hostQualifier);if(u(!1),!t.ok){let{error:e}=t;Z.error(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),s(Un(c,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,t[1]=s,t[2]=i,t[3]=r,t[4]=c,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==l||t[7]!==r?(h=e=>{!e&&!l&&r(!1)},t[6]=l,t[7]=r,t[8]=h):h=t[8];let _;t[9]!==a||t[10]!==l||t[11]!==p||t[12]!==n?(_=n?(0,Q.jsx)(g,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:l,onDelete:()=>p(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[9]=a,t[10]=l,t[11]=p,t[12]=n,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==_?(v=(0,Q.jsx)(V,{open:m,onOpenChange:h,children:_}),t[14]=m,t[15]=h,t[16]=_,t[17]=v):v=t[17],v}function Zn(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 Qn(e){if(/\s/.test(e))return Te._({id:`_fQGOp`});let t=e.split(`/`);return t.some(e=>e===`.`||e===`..`)?Te._({id:`Zt7Ktx`}):t.some(e=>e===``)?Te._({id:`ipCibE`}):t.length===1&&e.toLowerCase()===`skill.md`?Te._({id:`yJkw6t`}):Zn(e)?null:Te._({id:`oP-FQW`})}function $n(e){let t=(0,Ft.c)(70),{target:n,onOpenChange:r}=e,{_:i}=d(),{openTarget:a}=o(),s=(0,$.useId)(),[c,l]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&l(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,x,S,C,w;if(t[6]!==c||t[7]!==f){w=c.trim(),x=w===``||w.endsWith(`/`),S=x?null:Qn(w),y=!(x||S!==null)&&!f,b=w.includes(`/`)?w.split(`/`).slice(0,-1).join(`/`):null;let e=w.split(`/`).pop()??``;C=e!==``&&!e.includes(`.`)?`${w}.md`:w,t[6]=c,t[7]=f,t[8]=y,t[9]=b,t[10]=x,t[11]=S,t[12]=C,t[13]=w}else y=t[8],b=t[9],x=t[10],S=t[11],C=t[12],w=t[13];let T=C,E;t[14]!==i||t[15]!==y||t[16]!==T||t[17]!==r||t[18]!==a||t[19]!==n?(E=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(T),t=await St({scope:n.skill.scope,name:n.skill.name,path:T,content:e?`# ${T.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`DvGkXq`,values:{0:t.error,effective:T}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=vt(n.skill,T);a({kind:`doc`,target:e,docName:e})}r(!1)},t[14]=i,t[15]=y,t[16]=T,t[17]=r,t[18]=a,t[19]=n,t[20]=E):E=t[20];let D=E,O;t[21]!==r||t[22]!==f?(O=e=>{!e&&!f&&r(!1)},t[21]=r,t[22]=f,t[23]=O):O=t[23];let k;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`wQvvZY`})}),t[24]=k):k=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(z,{children:[k,(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`lM4c-I`})})]}),t[25]=j):j=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(u,{id:`I6gXOa`}),t[26]=M):M=t[26];let N;t[27]===s?N=t[28]:(N=(0,Q.jsx)(H,{htmlFor:s,children:M}),t[27]=s,t[28]=N);let R;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>l(e.target.value),t[29]=R):R=t[29];let V=S!==null,U;t[30]===D?U=t[31]:(U=e=>{e.key===`Enter`&&D()},t[30]=D,t[31]=U);let W;t[32]!==s||t[33]!==c||t[34]!==V||t[35]!==U?(W=(0,Q.jsx)(jt,{id:s,value:c,onChange:R,placeholder:`references/notes.md`,"aria-invalid":V,onKeyDown:U}),t[32]=s,t[33]=c,t[34]=V,t[35]=U,t[36]=W):W=t[36];let G;t[37]!==T||t[38]!==b||t[39]!==x||t[40]!==S||t[41]!==w?(G=S===null?x&&w!==``?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`Vy6XCg`})}):T===w?b?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`9lso1Y`,values:{folderPart:b},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null:(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`zC5jrM`,values:{effective:T},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:S}),t[37]=T,t[38]=b,t[39]=x,t[40]=S,t[41]=w,t[42]=G):G=t[42];let K;t[43]!==N||t[44]!==W||t[45]!==G?(K=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,W,G]}),t[43]=N,t[44]=W,t[45]=G,t[46]=K):K=t[46];let q;t[47]===r?q=t[48]:(q=()=>r(!1),t[47]=r,t[48]=q);let J;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(u,{id:`dEgA5A`}),t[49]=J):J=t[49];let Y;t[50]!==f||t[51]!==q?(Y=(0,Q.jsx)(A,{variant:`outline`,onClick:q,disabled:f,children:J}),t[50]=f,t[51]=q,t[52]=Y):Y=t[52];let X;t[53]===D?X=t[54]:(X=()=>void D(),t[53]=D,t[54]=X);let ee=!y,te;t[55]===f?te=t[56]:(te=f?(0,Q.jsx)(u,{id:`E9bKSA`}):(0,Q.jsx)(u,{id:`hYgDIe`}),t[55]=f,t[56]=te);let ne;t[57]!==X||t[58]!==ee||t[59]!==te?(ne=(0,Q.jsx)(A,{onClick:X,disabled:ee,children:te}),t[57]=X,t[58]=ee,t[59]=te,t[60]=ne):ne=t[60];let re;t[61]!==Y||t[62]!==ne?(re=(0,Q.jsxs)(L,{children:[Y,ne]}),t[61]=Y,t[62]=ne,t[63]=re):re=t[63];let ie;t[64]!==K||t[65]!==re?(ie=(0,Q.jsxs)(I,{className:`sm:max-w-md`,children:[j,K,re]}),t[64]=K,t[65]=re,t[66]=ie):ie=t[66];let ae;return t[67]!==ie||t[68]!==O?(ae=(0,Q.jsx)(B,{open:!0,onOpenChange:O,children:ie}),t[67]=ie,t[68]=O,t[69]=ae):ae=t[69],ae}function er(e){let t=(0,Ft.c)(17),{target:n,onOpenChange:r}=e,{_:i}=d(),{closeTabs:a,openTabs:s}=o(),[c,l]=(0,$.useState)(!1),u;t[0]!==i||t[1]!==a||t[2]!==r||t[3]!==s?(u=async function(e){let{skill:t,filePath:n}=e;l(!0);let o=await Ot({scope:t.scope,name:t.name,path:n});if(l(!1),!o.ok){Z.error(i({id:`CBT70t`,values:{0:o.error}}));return}if(!o.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),a(Wn(s,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=a,t[2]=r,t[3]=s,t[4]=u):u=t[4];let f=u,p=n!==null,m;t[5]!==c||t[6]!==r?(m=e=>{!e&&!c&&r(!1)},t[5]=c,t[6]=r,t[7]=m):m=t[7];let h;t[8]!==i||t[9]!==c||t[10]!==f||t[11]!==n?(h=n?(0,Q.jsx)(g,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:c,onDelete:()=>f(n),customDescription:i({id:`ppzof_`,values:{0:bt(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[8]=i,t[9]=c,t[10]=f,t[11]=n,t[12]=h):h=t[12];let _;return t[13]!==p||t[14]!==m||t[15]!==h?(_=(0,Q.jsx)(V,{open:p,onOpenChange:m,children:h}),t[13]=p,t[14]=m,t[15]=h,t[16]=_):_=t[16],_}function tr(e){let t=(0,Ft.c)(64),{target:n,onOpenChange:r}=e,{_:i}=d(),a=dt(),o=(0,$.useId)(),[s,c]=(0,$.useState)(``),[l,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==s||t[7]!==n.filePath?(y=s.trim(),b=y===n.filePath,v=y===``||!Zn(y),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let x=v,S=!x&&!b&&!l,C;t[11]!==i||t[12]!==S||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(C=async function(){if(!n||!S)return;f(!0);let e=await Ct({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=S,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=C):C=t[17];let w=C,T;t[18]!==r||t[19]!==l?(T=e=>{!e&&!l&&r(!1)},t[18]=r,t[19]=l,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`yckias`})}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(z,{children:[E,(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`HzVAoz`})})]}),t[22]=D):D=t[22];let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(u,{id:`I6gXOa`}),t[23]=O):O=t[23];let k;t[24]===o?k=t[25]:(k=(0,Q.jsx)(H,{htmlFor:o,children:O}),t[24]=o,t[25]=k);let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>c(e.target.value),t[26]=j):j=t[26];let M=x&&y!==``,N;t[27]===w?N=t[28]:(N=e=>{e.key===`Enter`&&w()},t[27]=w,t[28]=N);let R;t[29]!==o||t[30]!==s||t[31]!==M||t[32]!==N?(R=(0,Q.jsx)(jt,{id:o,value:s,onChange:j,"aria-invalid":M,onKeyDown:N}),t[29]=o,t[30]=s,t[31]=M,t[32]=N,t[33]=R):R=t[33];let V;t[34]!==x||t[35]!==y?(V=x&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(u,{id:`fVzizW`})}):null,t[34]=x,t[35]=y,t[36]=V):V=t[36];let U;t[37]!==k||t[38]!==R||t[39]!==V?(U=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[k,R,V]}),t[37]=k,t[38]=R,t[39]=V,t[40]=U):U=t[40];let W;t[41]===r?W=t[42]:(W=()=>r(!1),t[41]=r,t[42]=W);let G;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(u,{id:`dEgA5A`}),t[43]=G):G=t[43];let K;t[44]!==l||t[45]!==W?(K=(0,Q.jsx)(A,{variant:`outline`,onClick:W,disabled:l,children:G}),t[44]=l,t[45]=W,t[46]=K):K=t[46];let q;t[47]===w?q=t[48]:(q=()=>void w(),t[47]=w,t[48]=q);let J=!S,Y;t[49]===l?Y=t[50]:(Y=l?(0,Q.jsx)(u,{id:`tHKQ6j`}):(0,Q.jsx)(u,{id:`2wxgft`}),t[49]=l,t[50]=Y);let X;t[51]!==q||t[52]!==J||t[53]!==Y?(X=(0,Q.jsx)(A,{onClick:q,disabled:J,children:Y}),t[51]=q,t[52]=J,t[53]=Y,t[54]=X):X=t[54];let ee;t[55]!==K||t[56]!==X?(ee=(0,Q.jsxs)(L,{children:[K,X]}),t[55]=K,t[56]=X,t[57]=ee):ee=t[57];let te;t[58]!==U||t[59]!==ee?(te=(0,Q.jsxs)(I,{className:`sm:max-w-md`,children:[D,U,ee]}),t[58]=U,t[59]=ee,t[60]=te):te=t[60];let ne;return t[61]!==te||t[62]!==T?(ne=(0,Q.jsx)(B,{open:!0,onOpenChange:T,children:te}),t[61]=te,t[62]=T,t[63]=ne):ne=t[63],ne}function nr(e){let t=(0,Ft.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=ft(),s=n!==null,c=(0,$.useId)(),[l,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,x,S,C;if(t[5]!==r||t[6]!==l||t[7]!==n.name){S=l.trim(),C=S===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===l?i=t[16]:(i=e.test(l),t[15]=l,t[16]=i),v=i,x=S.length>64,y=S===``||!ie.test(S)||x,b=!y&&!C&&r.has(S),t[5]=r,t[6]=l,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13];let w=b,T=!y&&!w&&!C&&!f,E;t[17]!==T||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==S?(E=async function(){if(!n||!T)return;p(!0);let e=await o({scope:n.scope,name:n.name},S);p(!1),e.ok&&(a?.(S),i(!1))},t[17]=T,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=S,t[23]=E):E=t[23];let D=E,O;t[24]===i?O=t[25]:(O=e=>e?null:i(!1),t[24]=i,t[25]=O);let k;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`dw_3cv`})}),t[26]=k):k=t[26];let j;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(z,{children:[k,(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`R9IDFz`})})]}),t[27]=j):j=t[27];let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(u,{id:`6YtxFj`}),t[28]=M):M=t[28];let N;t[29]===c?N=t[30]:(N=(0,Q.jsx)(H,{htmlFor:c,children:M}),t[29]=c,t[30]=N);let R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>d(e.target.value),t[31]=R):R=t[31];let V;t[32]===D?V=t[33]:(V=e=>{e.key===`Enter`&&D()},t[32]=D,t[33]=V);let U=y||w,W=y&&S!==``||w?`${c}-error`:void 0,G;t[34]!==c||t[35]!==l||t[36]!==V||t[37]!==U||t[38]!==W?(G=(0,Q.jsx)(jt,{id:c,value:l,onChange:R,onKeyDown:V,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":U,"aria-describedby":W,className:`font-mono`}),t[34]=c,t[35]=l,t[36]=V,t[37]=U,t[38]=W,t[39]=G):G=t[39];let K;t[40]!==w||t[41]!==v||t[42]!==c||t[43]!==y||t[44]!==x||t[45]!==S?(K=y&&S!==``?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(u,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):x?(0,Q.jsx)(u,{id:`lK9c4T`}):(0,Q.jsx)(u,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):w?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(u,{id:`YJ1BTp`})}):null,t[40]=w,t[41]=v,t[42]=c,t[43]=y,t[44]=x,t[45]=S,t[46]=K):K=t[46];let q;t[47]!==N||t[48]!==G||t[49]!==K?(q=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[N,G,K]}),t[47]=N,t[48]=G,t[49]=K,t[50]=q):q=t[50];let J;t[51]===i?J=t[52]:(J=()=>i(!1),t[51]=i,t[52]=J);let Y;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(u,{id:`dEgA5A`}),t[53]=Y):Y=t[53];let X;t[54]!==f||t[55]!==J?(X=(0,Q.jsx)(A,{variant:`outline`,onClick:J,disabled:f,children:Y}),t[54]=f,t[55]=J,t[56]=X):X=t[56];let ee;t[57]===D?ee=t[58]:(ee=()=>void D(),t[57]=D,t[58]=ee);let te=!T,ne;t[59]===f?ne=t[60]:(ne=f?(0,Q.jsx)(u,{id:`tHKQ6j`}):(0,Q.jsx)(u,{id:`2wxgft`}),t[59]=f,t[60]=ne);let re;t[61]!==ee||t[62]!==te||t[63]!==ne?(re=(0,Q.jsx)(A,{onClick:ee,disabled:te,children:ne}),t[61]=ee,t[62]=te,t[63]=ne,t[64]=re):re=t[64];let ae;t[65]!==X||t[66]!==re?(ae=(0,Q.jsxs)(L,{children:[X,re]}),t[65]=X,t[66]=re,t[67]=ae):ae=t[67];let oe;t[68]!==q||t[69]!==ae?(oe=(0,Q.jsxs)(I,{children:[j,q,ae]}),t[68]=q,t[69]=ae,t[70]=oe):oe=t[70];let se;return t[71]!==s||t[72]!==oe||t[73]!==O?(se=(0,Q.jsx)(B,{open:s,onOpenChange:O,children:oe}),t[71]=s,t[72]=oe,t[73]=O,t[74]=se):se=t[74],se}function rr(){let e=(0,Ft.c)(6),{_:t}=d(),n=xt(),r=dt(),{openTabs:i}=o(),a=Nt(),s;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==a?(s=async(e,o)=>{if(o===e.scope)return!1;je(e.scope,e.name),ke(e.scope,e.name);let s=await Tt({name:e.name,fromScope:e.scope,toScope:o});if(Me(e.scope,e.name),!s.ok)return Ee(e.scope,e.name),Z.error(t({id:`07eGJB`,values:{0:s.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[o]}}));let c=a.status===`ready`?a.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,l=i.map(ar).filter(t=>{if(t.kind!==`doc`)return!1;let n=Hn(t.docName);return n?.scope===e.scope&&n.name===e.name}),u=l.find(ir)??l[0],d=u?.kind===`doc`?u.docName:c?_t(c):e.scope===`global`?ae(e.scope,e.name):null,f=o===`project`&&s.path!==void 0?`${s.path.replace(/\/+$/,``)}/SKILL`:ae(o,e.name);try{d!==null&&r(d,f)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return Ee(e.scope,e.name),!0},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=s):s=e[5],s}function ir(e){return e.kind===`doc`&&Hn(e.docName)?.rel===null}function ar(e){return i(e)}function or(e){let t=(0,Ft.c)(38),{target:n,onOpenChange:r}=e,i=xt(),a=rr(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:c,name:l,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(F,{children:(0,Q.jsx)(u,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[c],g=i[d],_=i[d],v;t[5]!==l||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:l},t[5]=l,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(P,{children:(0,Q.jsx)(u,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let x;t[13]!==m||t[14]!==b?(x=(0,Q.jsxs)(z,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(u,{id:`dEgA5A`}),t[16]=S):S=t[16];let C;t[17]===o?C=t[18]:(C=(0,Q.jsx)(R,{asChild:!0,children:(0,Q.jsx)(A,{variant:`outline`,disabled:o,children:S})}),t[17]=o,t[18]=C);let w;t[19]!==a||t[20]!==l||t[21]!==r||t[22]!==c||t[23]!==d?(w=async()=>{s(!0),await a({scope:c,name:l},d),s(!1),r(!1)},t[19]=a,t[20]=l,t[21]=r,t[22]=c,t[23]=d,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(u,{id:`QWdKwH`}),t[25]=T):T=t[25];let E;t[26]!==o||t[27]!==w?(E=(0,Q.jsx)(A,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:w,children:T}),t[26]=o,t[27]=w,t[28]=E):E=t[28];let D;t[29]!==C||t[30]!==E?(D=(0,Q.jsxs)(L,{children:[C,E]}),t[29]=C,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==x||t[33]!==D?(O=(0,Q.jsxs)(I,{className:`sm:max-w-md`,children:[x,D]}),t[32]=x,t[33]=D,t[34]=O):O=t[34];let k;return t[35]!==f||t[36]!==O?(k=(0,Q.jsx)(B,{open:!0,onOpenChange:f,children:O}),t[35]=f,t[36]=O,t[37]=k):k=t[37],k}var sr=(0,$.lazy)(async()=>({default:(await t(()=>import(`./SkillForkDialog-dYxaj5dE.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 cr(){let e=(0,Ft.c)(52),{_:t}=d(),n=mt(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),je(e.scope,e.name);let i=await Et({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(Ee(e.scope,e.name),y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=dr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),je(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await kt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}Ee(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),je(e.scope,e.name);let n=await t();return Ee(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 wt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O;e[7]===t?O=e[8]:(O=async function(e){let n=[...e.names];if(n.length===0)return;for(let t of n)je(e.scope,t);y(n[0]??null);let r=await At({scope:e.scope,names:n});for(let t of n)Ee(e.scope,t);if(y(null),!r.ok){Z.error(t({id:`nXHOFU`,values:{0:e.sourceLabel,1:r.error}}));return}let i=r.results.filter(ur),a=e.sourceLabel,o=r.updated,s=r.upToDate;if(i.length>0){let e=i.map(lr).join(`, `),n=i.length;Z.warning(t({id:`AgoIW4`,values:{source:a,updated:o,upToDate:s,failed:n,detail:e}}));return}Z.success(t(o>0?{id:`qd7L1J`,values:{source:a,updated:o,upToDate:s}}:{id:`XF1kgP`,values:{source:a}}))},e[7]=t,e[8]=O);let k=O,A,j;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||i(null)},j=()=>i(null),e[9]=A,e[10]=j):(A=e[9],j=e[10]);let M;e[11]===r?M=e[12]:(M=(0,Q.jsx)(Xn,{skill:r,onOpenChange:A,onDeleted:j}),e[11]=r,e[12]=M);let N=a?.skill??null,P=a?.existingNames??pr,F,I;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||o(null)},I=()=>o(null),e[13]=F,e[14]=I):(F=e[13],I=e[14]);let L;e[15]!==N||e[16]!==P?(L=(0,Q.jsx)(nr,{skill:N,existingNames:P,onOpenChange:F,onRenamed:I}),e[15]=N,e[16]=P,e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||c(null)},e[18]=R):R=e[18];let z;e[19]===s?z=e[20]:(z=(0,Q.jsx)(or,{target:s,onOpenChange:R}),e[19]=s,e[20]=z);let B;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{e||u(null)},e[21]=B):B=e[21];let V;e[22]===l?V=e[23]:(V=(0,Q.jsx)(tr,{target:l,onOpenChange:B}),e[22]=l,e[23]=V);let H;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{e||p(null)},e[24]=H):H=e[24];let U;e[25]===f?U=e[26]:(U=(0,Q.jsx)(er,{target:f,onOpenChange:H}),e[25]=f,e[26]=U);let W;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>{e||h(null)},e[27]=W):W=e[27];let G;e[28]===m?G=e[29]:(G=(0,Q.jsx)($n,{target:m,onOpenChange:W}),e[28]=m,e[29]=G);let K;e[30]===g?K=e[31]:(K=g?(0,Q.jsx)($.Suspense,{fallback:null,children:(0,Q.jsx)(sr,{target:g,onOpenChange:e=>{e||_(null)}})}):null,e[30]=g,e[31]=K);let q;e[32]!==L||e[33]!==z||e[34]!==V||e[35]!==U||e[36]!==G||e[37]!==K||e[38]!==M?(q=(0,Q.jsxs)(Q.Fragment,{children:[M,L,z,V,U,G,K]}),e[32]=L,e[33]=z,e[34]=V,e[35]=U,e[36]=G,e[37]=K,e[38]=M,e[39]=q):q=e[39];let J=q,Y,X,ee,te,ne,re;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(e,t)=>o({skill:e,existingNames:t}),X=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),ee=(e,t)=>u({skill:e,filePath:t}),te=(e,t)=>p({skill:e,filePath:t}),ne=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),re=(e,t)=>_({skill:e,editor:t}),e[40]=Y,e[41]=X,e[42]=ee,e[43]=te,e[44]=ne,e[45]=re):(Y=e[40],X=e[41],ee=e[42],te=e[43],ne=e[44],re=e[45]);let ie;return e[46]!==J||e[47]!==D||e[48]!==x||e[49]!==v||e[50]!==k?(ie={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,updateAllFromSource:k,requestDelete:i,requestRename:Y,requestScopeMove:X,requestFileRename:ee,requestFileDelete:te,requestFileCreate:ne,requestForkResolve:re,dialogs:J},e[46]=J,e[47]=D,e[48]=x,e[49]=v,e[50]=k,e[51]=ie):ie=e[51],ie}function lr(e){return e.error?`${e.requested} (${e.error})`:e.requested}function ur(e){return e.status===`failed`||e.status===`not-found`}function dr(e){return e.map(fr).join(`, `)}function fr(e){return ee[e]??e}var pr=new Set;function mr(e){let t=(0,Ft.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(pt,{"aria-hidden":!0}),c=Pt(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(E,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function hr(e){let t=(0,Ft.c)(68),{skill:n,filePath:r,actions:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,{_:s}=d(),l;t[0]!==r||t[1]!==n.absolutePath?(l=n.absolutePath?`${bt(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=l):l=t[2];let f=l,p;t[3]===n.path?p=t[4]:(p=bt(n.path),t[3]=n.path,t[4]=p);let h=`${p}/${r}`,g;t[5]===s?g=t[6]:(g=async function(e){try{await m(e),Z.success(s({id:`SXCSQd`}))}catch{Z.error(s({id:`cRHuuI`}))}},t[5]=s,t[6]=g);let _=g,v;t[7]!==i||t[8]!==r||t[9]!==n?(v=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=v):v=t[10];let x,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(Nn,{"aria-hidden":!0}),C=(0,Q.jsx)(u,{id:`2wxgft`}),t[11]=x,t[12]=C):(x=t[11],C=t[12]);let T;t[13]!==o||t[14]!==v?(T=(0,Q.jsxs)(E,{menuKind:o,onSelect:v,children:[x,C]}),t[13]=o,t[14]=v,t[15]=T):T=t[15];let D;t[16]!==f||t[17]!==o?(D=(0,Q.jsx)(mr,{absolutePath:f,menuKind:o}),t[16]=f,t[17]=o,t[18]=D):D=t[18];let k,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(c,{"aria-hidden":!0}),A=(0,Q.jsx)(u,{id:`zd00pH`}),t[19]=k,t[20]=A):(k=t[19],A=t[20]);let j;t[21]===o?j=t[22]:(j=(0,Q.jsxs)(b,{menuKind:o,children:[k,A]}),t[21]=o,t[22]=j);let M;t[23]!==f||t[24]!==_||t[25]!==o?(M=f?(0,Q.jsx)(E,{menuKind:o,onSelect:()=>void _(f),children:(0,Q.jsx)(u,{id:`z2funE`})}):null,t[23]=f,t[24]=_,t[25]=o,t[26]=M):M=t[26];let N;t[27]!==_||t[28]!==h?(N=()=>void _(h),t[27]=_,t[28]=h,t[29]=N):N=t[29];let P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(u,{id:`xloBjn`}),t[30]=P):P=t[30];let F;t[31]!==o||t[32]!==N?(F=(0,Q.jsx)(E,{menuKind:o,onSelect:N,children:P}),t[31]=o,t[32]=N,t[33]=F):F=t[33];let I;t[34]!==o||t[35]!==M||t[36]!==F?(I=(0,Q.jsxs)(w,{menuKind:o,children:[M,F]}),t[34]=o,t[35]=M,t[36]=F,t[37]=I):I=t[37];let L;t[38]!==o||t[39]!==I?(L=(0,Q.jsx)(y,{menuKind:o,children:I}),t[38]=o,t[39]=I,t[40]=L):L=t[40];let R;t[41]!==o||t[42]!==j||t[43]!==L?(R=(0,Q.jsxs)(O,{menuKind:o,children:[j,L]}),t[41]=o,t[42]=j,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==o||t[46]!==R||t[47]!==T||t[48]!==D?(z=(0,Q.jsxs)(w,{menuKind:o,children:[T,D,R]}),t[45]=o,t[46]=R,t[47]=T,t[48]=D,t[49]=z):z=t[49];let B;t[50]===o?B=t[51]:(B=(0,Q.jsx)(S,{menuKind:o}),t[50]=o,t[51]=B);let V;t[52]!==i||t[53]!==r||t[54]!==n?(V=()=>i.requestFileDelete(n,r),t[52]=i,t[53]=r,t[54]=n,t[55]=V):V=t[55];let H,U;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(gt,{"aria-hidden":!0}),U=(0,Q.jsx)(u,{id:`cnGeoo`}),t[56]=H,t[57]=U):(H=t[56],U=t[57]);let W;t[58]!==o||t[59]!==V?(W=(0,Q.jsxs)(E,{menuKind:o,variant:`destructive`,onSelect:V,children:[H,U]}),t[58]=o,t[59]=V,t[60]=W):W=t[60];let G;t[61]!==o||t[62]!==W?(G=(0,Q.jsx)(w,{menuKind:o,children:W}),t[61]=o,t[62]=W,t[63]=G):G=t[63];let K;return t[64]!==z||t[65]!==B||t[66]!==G?(K=(0,Q.jsxs)(Q.Fragment,{children:[z,B,G]}),t[64]=z,t[65]=B,t[66]=G,t[67]=K):K=t[67],K}function gr(e){let t=(0,Ft.c)(42),{skill:n,actions:r,beforeDelete:i}=e,{_:a}=d(),o=T(n,r),s=n.absolutePath,l;t[0]===a?l=t[1]:(l=async function(e){try{await m(e),Z.success(a({id:`SXCSQd`}))}catch{Z.error(a({id:`cRHuuI`}))}},t[0]=a,t[1]=l);let f=l,p;t[2]===s?p=t[3]:(p=(0,Q.jsx)(mr,{absolutePath:s}),t[2]=s,t[3]=p);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsxs)(b,{menuKind:`dropdown`,children:[(0,Q.jsx)(c,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`zd00pH`})]}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==f?(g=s?(0,Q.jsx)(E,{menuKind:`dropdown`,onSelect:()=>void f(s),children:(0,Q.jsx)(u,{id:`z2funE`})}):null,t[5]=s,t[6]=f,t[7]=g):g=t[7];let _;t[8]!==f||t[9]!==n.path?(_=()=>void f(n.path),t[8]=f,t[9]=n.path,t[10]=_):_=t[10];let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(u,{id:`xloBjn`}),t[11]=v):v=t[11];let x;t[12]===_?x=t[13]:(x=(0,Q.jsx)(E,{menuKind:`dropdown`,onSelect:_,children:v}),t[12]=_,t[13]=x);let k;t[14]!==g||t[15]!==x?(k=(0,Q.jsxs)(O,{menuKind:`dropdown`,children:[h,(0,Q.jsx)(y,{menuKind:`dropdown`,children:(0,Q.jsxs)(w,{menuKind:`dropdown`,children:[g,x]})})]}),t[14]=g,t[15]=x,t[16]=k):k=t[16];let A;t[17]!==p||t[18]!==k?(A=(0,Q.jsxs)(w,{menuKind:`dropdown`,children:[p,k]}),t[17]=p,t[18]=k,t[19]=A):A=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(S,{menuKind:`dropdown`}),t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(b,{menuKind:`dropdown`,children:[(0,Q.jsx)(Mn,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`TKQ7K-`})]}),t[21]=M):M=t[21];let N;t[22]!==r||t[23]!==n?(N=e=>r.requestForkResolve(n,e),t[22]=r,t[23]=n,t[24]=N):N=t[24];let P;t[25]!==o||t[26]!==n||t[27]!==N?(P=(0,Q.jsx)(w,{menuKind:`dropdown`,children:(0,Q.jsxs)(O,{menuKind:`dropdown`,children:[M,(0,Q.jsx)(y,{menuKind:`dropdown`,className:D,children:(0,Q.jsx)(w,{menuKind:`dropdown`,children:(0,Q.jsx)(C,{toggles:o,skill:n,menuKind:`dropdown`,onResolveFork:N})})})]})}),t[25]=o,t[26]=n,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(S,{menuKind:`dropdown`}),t[29]=F):F=t[29];let I;t[30]!==r||t[31]!==n?(I=()=>r.requestDelete(n),t[30]=r,t[31]=n,t[32]=I):I=t[32];let L,R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(gt,{"aria-hidden":!0}),R=(0,Q.jsx)(u,{id:`cnGeoo`}),t[33]=L,t[34]=R):(L=t[33],R=t[34]);let z;t[35]===I?z=t[36]:(z=(0,Q.jsx)(w,{menuKind:`dropdown`,children:(0,Q.jsxs)(E,{menuKind:`dropdown`,variant:`destructive`,onSelect:I,children:[L,R]})}),t[35]=I,t[36]=z);let B;return t[37]!==i||t[38]!==P||t[39]!==z||t[40]!==A?(B=(0,Q.jsxs)(Q.Fragment,{children:[A,j,P,i,F,z]}),t[37]=i,t[38]=P,t[39]=z,t[40]=A,t[41]=B):B=t[41],B}function _r(e){let t=(0,Ft.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Ye(),c=_().states,{dispatch:l}=An(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=pn({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,p;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(p=o===`context`?(0,Q.jsx)(Bn,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(Rn,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=p):p=t[8];let m;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==p?(m=(0,Q.jsx)(vr,{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 vr(e){let t=(0,Ft.c)(65),{actions:n,existingNames:i,menuKind:a,openWithAi:o,skill:s}=e,{_:l}=d(),f=xt(),p=T(s,n),g=s.absolutePath,_=s.hostQualifier!==void 0,x;t[0]===l?x=t[1]:(x=async function(e){try{await m(e),Z.success(l({id:`SXCSQd`}))}catch{Z.error(l({id:`cRHuuI`}))}},t[0]=l,t[1]=x);let k=x,A;t[2]!==g||t[3]!==a?(A=(0,Q.jsx)(mr,{absolutePath:g,menuKind:a}),t[2]=g,t[3]=a,t[4]=A):A=t[4];let j,M;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(c,{"aria-hidden":!0}),M=(0,Q.jsx)(u,{id:`zd00pH`}),t[5]=j,t[6]=M):(j=t[5],M=t[6]);let N;t[7]===a?N=t[8]:(N=(0,Q.jsxs)(b,{menuKind:a,children:[j,M]}),t[7]=a,t[8]=N);let P;t[9]!==g||t[10]!==k||t[11]!==a?(P=g?(0,Q.jsx)(E,{menuKind:a,onSelect:()=>void k(g),children:(0,Q.jsx)(u,{id:`z2funE`})}):null,t[9]=g,t[10]=k,t[11]=a,t[12]=P):P=t[12];let F;t[13]!==k||t[14]!==s.path?(F=()=>void k(s.path),t[13]=k,t[14]=s.path,t[15]=F):F=t[15];let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(u,{id:`xloBjn`}),t[16]=I):I=t[16];let L;t[17]!==a||t[18]!==F?(L=(0,Q.jsx)(E,{menuKind:a,onSelect:F,children:I}),t[17]=a,t[18]=F,t[19]=L):L=t[19];let R;t[20]!==a||t[21]!==P||t[22]!==L?(R=(0,Q.jsxs)(w,{menuKind:a,children:[P,L]}),t[20]=a,t[21]=P,t[22]=L,t[23]=R):R=t[23];let z;t[24]!==a||t[25]!==R?(z=(0,Q.jsx)(y,{menuKind:a,children:R}),t[24]=a,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==a||t[28]!==z||t[29]!==N?(B=(0,Q.jsxs)(O,{menuKind:a,children:[N,z]}),t[27]=a,t[28]=z,t[29]=N,t[30]=B):B=t[30];let V;t[31]!==a||t[32]!==o||t[33]!==B||t[34]!==A?(V=(0,Q.jsxs)(w,{menuKind:a,children:[A,o,B]}),t[31]=a,t[32]=o,t[33]=B,t[34]=A,t[35]=V):V=t[35];let H;t[36]===a?H=t[37]:(H=(0,Q.jsx)(S,{menuKind:a}),t[36]=a,t[37]=H);let U;t[38]!==n||t[39]!==i||t[40]!==p||t[41]!==a||t[42]!==_||t[43]!==f||t[44]!==s?(U=_?(0,Q.jsx)(w,{menuKind:a,children:(0,Q.jsx)(v,{menuKind:a,className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Q.jsx)(u,{id:`D0CegO`})})}):(0,Q.jsxs)(w,{menuKind:a,children:[(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>void n.duplicate(s,i),children:[(0,Q.jsx)(r,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`euc6Ns`})]}),(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>n.requestRename(s,i),children:[(0,Q.jsx)(Nn,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`2wxgft`})]}),(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>n.requestFileCreate(s),children:[(0,Q.jsx)(h,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`HdkSiO`})]}),(0,Q.jsxs)(O,{menuKind:a,children:[(0,Q.jsxs)(b,{menuKind:a,children:[(0,Q.jsx)(Mn,{"aria-hidden":!0}),(0,Q.jsx)(u,{id:`TKQ7K-`})]}),(0,Q.jsx)(y,{menuKind:a,className:D,children:(0,Q.jsx)(w,{menuKind:a,children:(0,Q.jsx)(C,{toggles:p,skill:s,menuKind:a,onResolveFork:e=>n.requestForkResolve(s,e)})})})]}),(0,Q.jsxs)(E,{menuKind:a,onSelect:()=>n.requestScopeMove(s,s.scope===`project`?`global`:`project`),children:[(0,Q.jsx)(jn,{"aria-hidden":!0}),s.scope===`project`?(0,Q.jsx)(u,{id:`bpytj4`,values:{0:f.global}}):(0,Q.jsx)(u,{id:`bpytj4`,values:{0:f.project}})]})]}),t[38]=n,t[39]=i,t[40]=p,t[41]=a,t[42]=_,t[43]=f,t[44]=s,t[45]=U):U=t[45];let W;t[46]===a?W=t[47]:(W=(0,Q.jsx)(S,{menuKind:a}),t[46]=a,t[47]=W);let G;t[48]!==n||t[49]!==s?(G=()=>n.requestDelete(s),t[48]=n,t[49]=s,t[50]=G):G=t[50];let K,q;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(gt,{"aria-hidden":!0}),q=(0,Q.jsx)(u,{id:`cnGeoo`}),t[51]=K,t[52]=q):(K=t[51],q=t[52]);let J;t[53]!==a||t[54]!==G?(J=(0,Q.jsxs)(E,{menuKind:a,variant:`destructive`,onSelect:G,children:[K,q]}),t[53]=a,t[54]=G,t[55]=J):J=t[55];let Y;t[56]!==a||t[57]!==J?(Y=(0,Q.jsx)(w,{menuKind:a,children:J}),t[56]=a,t[57]=J,t[58]=Y):Y=t[58];let X;return t[59]!==V||t[60]!==H||t[61]!==U||t[62]!==W||t[63]!==Y?(X=(0,Q.jsxs)(Q.Fragment,{children:[V,H,U,W,Y]}),t[59]=V,t[60]=H,t[61]=U,t[62]=W,t[63]=Y,t[64]=X):X=t[64],X}function yr(e){let t=(0,Ft.c)(48),{scope:n,name:r,showNewFile:i}=e,a=i===void 0?!0:i,{_:o}=d(),s=Nt(),c=cr(),l=s.status===`ready`?s.data:void 0,f;t[0]!==l||t[1]!==r||t[2]!==n?(f=l?.find(e=>e.scope===n&&e.name===r),t[0]=l,t[1]=r,t[2]=n,t[3]=f):f=t[3];let m=f,g;t[4]!==m||t[5]!==l||t[6]!==r?(g=m===void 0?l?.filter(e=>e.name===r):void 0,t[4]=m,t[5]=l,t[6]=r,t[7]=g):g=t[7];let _=g,v=m??(_?.length===1?_[0]:void 0),y;t[8]!==v||t[9]!==r||t[10]!==n?(y=v??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[8]=v,t[9]=r,t[10]=n,t[11]=y):y=t[11];let b=y,[S,w]=(0,$.useState)(!1),E=T(b,c),{installed:O,installing:k,hostSet:j}=E,M=v===void 0&&!O,N;t[12]!==v||t[13]!==j?(N=v?yt(v,[...j]):[],t[12]=v,t[13]=j,t[14]=N):N=t[14];let P=N,F;t[15]!==o||t[16]!==c||t[17]!==a||t[18]!==b?(F=a?(0,Q.jsx)(A,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:()=>c.requestFileCreate(b),title:o({id:`leF0i_`}),"aria-label":o({id:`leF0i_`}),"data-testid":`skill-editor-new-file`,children:(0,Q.jsx)(h,{className:`size-4`,"aria-hidden":!0})}):null,t[15]=o,t[16]=c,t[17]=a,t[18]=b,t[19]=F):F=t[19];let I=M?`resolving`:`installed`,L=M?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,R;t[20]===L?R=t[21]:(R=p(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,L),t[20]=L,t[21]=R);let z;t[22]!==P||t[23]!==k||t[24]!==M?(z=k?(0,Q.jsx)(u,{id:`b4itZn`}):M?(0,Q.jsx)(u,{id:`iKvAeG`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{id:`eQkgKV`}),(0,Q.jsx)(x,{hosts:P,className:`text-muted-foreground`})]}),t[22]=P,t[23]=k,t[24]=M,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Qe,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[26]=B):B=t[26];let V;t[27]!==k||t[28]!==z||t[29]!==I||t[30]!==R?(V=(0,Q.jsx)(at,{asChild:!0,children:(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,disabled:k,"data-testid":`skill-install-menu-trigger`,"data-state":I,className:R,children:[z,B]})}),t[27]=k,t[28]=z,t[29]=I,t[30]=R,t[31]=V):V=t[31];let H;t[32]!==c||t[33]!==b?(H=e=>c.requestForkResolve(b,e),t[32]=c,t[33]=b,t[34]=H):H=t[34];let U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>w(!1),t[35]=U):U=t[35];let W;t[36]!==b||t[37]!==H||t[38]!==E?(W=(0,Q.jsx)(ct,{align:`end`,className:D,children:(0,Q.jsx)(C,{toggles:E,skill:b,onResolveFork:H,onRunStart:U})}),t[36]=b,t[37]=H,t[38]=E,t[39]=W):W=t[39];let G;t[40]!==S||t[41]!==V||t[42]!==W?(G=(0,Q.jsxs)(lt,{modal:!1,open:S,onOpenChange:w,children:[V,W]}),t[40]=S,t[41]=V,t[42]=W,t[43]=G):G=t[43];let K;return t[44]!==c.dialogs||t[45]!==G||t[46]!==F?(K=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[F,G,c.dialogs]}),t[44]=c.dialogs,t[45]=G,t[46]=F,t[47]=K):K=t[47],K}var br=`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 xr(e){let t=(0,Ft.c)(24),{value:n,onSelect:r,disabled:i}=e,a=(0,$.useId)(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(ot,{children:(0,Q.jsx)(u,{id:`YvwwqC`})}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=e=>r(e),t[1]=r,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(u,{id:`ZWyHmq`}),t[3]=c):c=t[3];let l;t[4]!==a||t[5]!==i?(l=(0,Q.jsx)(it,{value:`project`,disabled:i,onSelect:Cr,"aria-describedby":a,className:br,children:c}),t[4]=a,t[5]=i,t[6]=l):l=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(u,{id:`ImTzPZ`}),t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==i?(f=(0,Q.jsx)(it,{value:`global`,disabled:i,onSelect:Sr,"aria-describedby":a,className:br,children:d}),t[8]=a,t[9]=i,t[10]=f):f=t[10];let p;t[11]!==s||t[12]!==l||t[13]!==f||t[14]!==n?(p=(0,Q.jsxs)(et,{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:[l,f]}),t[11]=s,t[12]=l,t[13]=f,t[14]=n,t[15]=p):p=t[15];let m;t[16]===n?m=t[17]:(m=n===`project`?(0,Q.jsx)(u,{id:`9x-lMu`}):(0,Q.jsx)(u,{id:`AyKwqp`}),t[16]=n,t[17]=m);let h;t[18]!==a||t[19]!==m?(h=(0,Q.jsx)(`div`,{id:a,className:`px-2 pt-1 pb-1.5 text-xs leading-snug text-muted-foreground`,"data-testid":`skill-scope-consequence`,children:m}),t[18]=a,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[o,p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Sr(e){return e.preventDefault()}function Cr(e){return e.preventDefault()}function wr(e){let t=(0,Ft.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:s}=d(),c=o>0,l;t[0]!==s||t[1]!==c||t[2]!==o?(l=s(c?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=s,t[1]=c,t[2]=o,t[3]=l):l=t[3];let f=l,m;t[4]===r?m=t[5]:(m=p(`relative`,r),t[4]=r,t[5]=m);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ht,{}),t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==o?(g=c?(0,Q.jsx)(Mt,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=c,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(j,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==f||t[13]!==n||t[14]!==m||t[15]!==_?(v=(0,Q.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":f,onClick:n,"data-testid":`add-properties-button`,className:m,asChild:!0,children:_}),t[12]=f,t[13]=n,t[14]=m,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==c||t[18]!==a?(y=(0,Q.jsx)(M,{side:`bottom`,children:c?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(u,{id:`AwrGuz`})}),a?.map(Tr),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(u,{id:`yh5-4s`})})]}):(0,Q.jsx)(u,{id:`81H_23`})}),t[17]=c,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(N,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function Tr(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}export{An as A,cn as C,Dn as D,xn as E,sn as M,dn as O,fn as S,pn as T,Fn as _,hr as a,mn as b,cr as c,Un as d,qn as f,Pn as g,In as h,_r as i,on as j,Tn as k,or as l,Rn as m,xr as n,gr as o,Bn as p,yr as r,mr as s,wr as t,Gn as u,Mn as v,ln as w,un as x,jn as y};