@inkeep/open-knowledge 0.6.0-beta.0 → 0.6.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +90 -0
- package/dist/assets/skills/{open-knowledge → project}/SKILL.md +128 -211
- package/dist/cli.mjs +25 -25
- package/dist/constants-Dg34Tv0a.mjs +2 -0
- package/dist/dist-7_PKsuCz.mjs +1 -0
- package/dist/{dist-B_Nlx5d6.mjs → dist-soQLoIV1.mjs} +91 -110
- package/dist/index.d.mts +15 -9
- package/dist/index.mjs +1 -1
- package/dist/init-BDgKRRe5.mjs +1 -0
- package/dist/{init-pu_7zCAy.mjs → init-CNnZmq0z.mjs} +10 -10
- package/dist/loader-BhwWH_ja.mjs +1 -0
- package/dist/{loader-DwgxIIbN.mjs → loader-TXH7WI7l.mjs} +3 -3
- package/dist/preview-BeJHolBZ.mjs +1 -0
- package/dist/{preview-Bep4xj-R.mjs → preview-BkWWpoVx.mjs} +2 -2
- package/dist/public/assets/ActivityModeContent-CkiL2cwS.js +2 -0
- package/dist/public/assets/ActivityPanelDiffView-LNHry3BJ.js +13 -0
- package/dist/public/assets/ConsentDialogBody-DkNr2OnV.js +2 -0
- package/dist/public/assets/DocumentContext-BK7c8nfO.js +52 -0
- package/dist/public/assets/GraphPanel-BG0uuCJI.js +46 -0
- package/dist/public/assets/{McpConsentDialogBody-Dw8kQ_BH.js → McpConsentDialogBody-BzCqdeeh.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-BN4xM_LZ.js +7 -0
- package/dist/public/assets/SourceEditor-CxLbpv43.js +2 -0
- package/dist/public/assets/{agent-presence-DUe_PdKt.js → agent-presence-DxGcS3q2.js} +1 -1
- package/dist/public/assets/{architectureDiagram-Q4EWVU46-C4pUyyy6.js → architectureDiagram-Q4EWVU46-CIVh0TLx.js} +1 -1
- package/dist/public/assets/{blockDiagram-DXYQGD6D-VkwkYpUF.js → blockDiagram-DXYQGD6D-Cg-UHasz.js} +1 -1
- package/dist/public/assets/button-DenIdY-r.js +1 -0
- package/dist/public/assets/{c4Diagram-AHTNJAMY-uR85wHTj.js → c4Diagram-AHTNJAMY-KFeHAAOO.js} +1 -1
- package/dist/public/assets/channel-BqqURnVG.js +1 -0
- package/dist/public/assets/checkbox-sqsyVLp7.js +1 -0
- package/dist/public/assets/{chunk-336JU56O-CcUNcCyG.js → chunk-336JU56O-DHqaXNrn.js} +2 -2
- package/dist/public/assets/{chunk-426QAEUC-D-Drhg6m.js → chunk-426QAEUC-CuPmuy8t.js} +1 -1
- package/dist/public/assets/{chunk-4TB4RGXK-DylOpICA.js → chunk-4TB4RGXK-QLafKs7A.js} +1 -1
- package/dist/public/assets/{chunk-5FUZZQ4R-COpN1802.js → chunk-5FUZZQ4R-DoG5zk7O.js} +1 -1
- package/dist/public/assets/{chunk-5PVQY5BW-SLEOUaCC.js → chunk-5PVQY5BW--zDnbXdQ.js} +1 -1
- package/dist/public/assets/{chunk-EDXVE4YY-Cr4fB83o.js → chunk-EDXVE4YY-BfT15Ufb.js} +1 -1
- package/dist/public/assets/{chunk-ENJZ2VHE-jO5Yn0Ti.js → chunk-ENJZ2VHE-DEtEhITq.js} +1 -1
- package/dist/public/assets/{chunk-ICPOFSXX-DO-wz1LJ.js → chunk-ICPOFSXX-C8AElYY_.js} +1 -1
- package/dist/public/assets/{chunk-OYMX7WX6-DlOfgU2U.js → chunk-OYMX7WX6-CX3nrwxJ.js} +1 -1
- package/dist/public/assets/{chunk-U2HBQHQK-fFQ_IUwS.js → chunk-U2HBQHQK-CfAyyLJz.js} +1 -1
- package/dist/public/assets/{chunk-X2U36JSP-JbIA9pf5.js → chunk-X2U36JSP-CmACymAN.js} +1 -1
- package/dist/public/assets/{chunk-YZCP3GAM-Cx9wuApW.js → chunk-YZCP3GAM-CiWxV9XS.js} +1 -1
- package/dist/public/assets/{chunk-ZZ45TVLE-CdiDiZYV.js → chunk-ZZ45TVLE-B7t5_MqN.js} +1 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-DrN_pUa5.js +1 -0
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-C1MJ1Ukt.js +1 -0
- package/dist/public/assets/clone-CecJCxEU.js +1 -0
- package/dist/public/assets/{collapsible-DfUFsfqv.js → collapsible-BhpeB6tu.js} +1 -1
- package/dist/public/assets/compiler-runtime-Cs91PcD2.js +1 -0
- package/dist/public/assets/config-validation-events-RWCM3tpA.js +10 -0
- package/dist/public/assets/{dagre-D0NgAcgy.js → dagre-BuFRtOcC.js} +1 -1
- package/dist/public/assets/{dagre-KV5264BT-D00jhTEj.js → dagre-KV5264BT-BpBW6R71.js} +1 -1
- package/dist/public/assets/{diagram-5BDNPKRD-53lAVvrc.js → diagram-5BDNPKRD-B5phtkJp.js} +1 -1
- package/dist/public/assets/{diagram-G4DWMVQ6-DvnMPxCL.js → diagram-G4DWMVQ6-tjReW6yx.js} +1 -1
- package/dist/public/assets/{diagram-MMDJMWI5-bSOxNuvv.js → diagram-MMDJMWI5-b4CgKryF.js} +1 -1
- package/dist/public/assets/{diagram-TYMM5635-ftQ9f3sM.js → diagram-TYMM5635-D5B0g2lj.js} +1 -1
- package/dist/public/assets/{dialog-bA5Nvc2p.js → dialog-DUff25Wx.js} +1 -1
- package/dist/public/assets/{dist-SeK3HGs7.js → dist-By89CQBy.js} +1 -1
- package/dist/public/assets/{dist-semR8ZB_.js → dist-D-oqC0-R.js} +1 -1
- package/dist/public/assets/{dist-DNQ2xKmK.js → dist-D3YXABda.js} +1 -1
- package/dist/public/assets/{dist-BUk_vKk2.js → dist-DQ1oWohr.js} +1 -1
- package/dist/public/assets/{dist-C8kKU7Ya.js → dist-DXgyWuz5.js} +1 -1
- package/dist/public/assets/{dist-DiQSHtaM.js → dist-DllAuqQQ.js} +1 -1
- package/dist/public/assets/{dist-CruwjFAC.js → dist-DpEGxZ9h.js} +1 -1
- package/dist/public/assets/{doc-hash-BrKkCdCz.js → doc-hash-Biw40x7n.js} +157 -147
- package/dist/public/assets/{erDiagram-SMLLAGMA-B1J-oh72.js → erDiagram-SMLLAGMA-CRJz10Jv.js} +1 -1
- package/dist/public/assets/{flowDiagram-DWJPFMVM-lLrSyhC0.js → flowDiagram-DWJPFMVM-BDCJTgJ7.js} +1 -1
- package/dist/public/assets/{ganttDiagram-T4ZO3ILL-CUjectuq.js → ganttDiagram-T4ZO3ILL-cPQKlGYc.js} +1 -1
- package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-vFBdpaIg.js → gitGraphDiagram-UUTBAWPF-BMyjc352.js} +1 -1
- package/dist/public/assets/{graphlib-C3wGX8GR.js → graphlib-BU8FnRz1.js} +1 -1
- package/dist/public/assets/index-BBSdGAfb.js +1916 -0
- package/dist/public/assets/index-CXzfIokG.css +1 -0
- package/dist/public/assets/{infoDiagram-42DDH7IO-p5UnX5VQ.js → infoDiagram-42DDH7IO-BZ6v5y-j.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-Dc_uLtDG.js → ishikawaDiagram-UXIWVN3A-DA7_P2Up.js} +1 -1
- package/dist/public/assets/{journeyDiagram-VCZTEJTY-D-OWzt5X.js → journeyDiagram-VCZTEJTY-CzZoB161.js} +1 -1
- package/dist/public/assets/{kanban-definition-6JOO6SKY-Dg3mF5uv.js → kanban-definition-6JOO6SKY-DKg7pXv1.js} +1 -1
- package/dist/public/assets/{label-Bdsqm1CY.js → label-BGXy6Okv.js} +1 -1
- package/dist/public/assets/{line-Blj6fR0j.js → line-DGc-MCyQ.js} +1 -1
- package/dist/public/assets/{mermaid.core-DKgSmEOt.js → mermaid.core-DRx0wZe0.js} +3 -3
- package/dist/public/assets/{mindmap-definition-QFDTVHPH-CzdOizWD.js → mindmap-definition-QFDTVHPH-C9GRZxO6.js} +1 -1
- package/dist/public/assets/{panel-CxlToFCs.js → panel-BNBODYwB.js} +1 -1
- package/dist/public/assets/{pieDiagram-DEJITSTG-CCKPY52f.js → pieDiagram-DEJITSTG-L6I3ft9Z.js} +1 -1
- package/dist/public/assets/{propagation-api-CobBjsTC.js → propagation-api-3kmMXRwS.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-34T5L4WZ-7k7hUHeX.js → quadrantDiagram-34T5L4WZ-Dp2IeEPC.js} +1 -1
- package/dist/public/assets/{requirementDiagram-MS252O5E-DtBI2UGc.js → requirementDiagram-MS252O5E-BxNWyIZg.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-XADWPNL6-CsyAV-jZ.js → sankeyDiagram-XADWPNL6-CRn0_xkw.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-FGHM5R23-BVVas0PB.js → sequenceDiagram-FGHM5R23-Drkjb1j4.js} +1 -1
- package/dist/public/assets/{stateDiagram-FHFEXIEX-DSU8iqSJ.js → stateDiagram-FHFEXIEX-BBUFKS0u.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-BtYsWsIg.js +1 -0
- package/dist/public/assets/{target-navigation-intent-B5Xuyiwx.js → target-navigation-intent-HRo6WpEX.js} +1 -1
- package/dist/public/assets/{telemetry-impl-BiWd9bHi.js → telemetry-impl-DPRMO_b_.js} +1 -1
- package/dist/public/assets/{textarea-CQGiqhkV.js → textarea-C_bHQrXh.js} +1 -1
- package/dist/public/assets/{timeline-definition-GMOUNBTQ-Cz06Vse0.js → timeline-definition-GMOUNBTQ-CLoe9y-z.js} +1 -1
- package/dist/public/assets/{toggle-group-Cimrwku9.js → toggle-group-pPF0BJ9M.js} +1 -1
- package/dist/public/assets/typing-burst-detector-S1xj6fRY.js +2 -0
- package/dist/public/assets/{vennDiagram-DHZGUBPP-Cf-DwVPO.js → vennDiagram-DHZGUBPP-q2zdiy4F.js} +1 -1
- package/dist/public/assets/{wardleyDiagram-NUSXRM2D-CYXaSU9R.js → wardleyDiagram-NUSXRM2D-Njg6YHso.js} +1 -1
- package/dist/public/assets/{xychartDiagram-5P7HB3ND-Czjmctj-.js → xychartDiagram-5P7HB3ND-Ct8Wgp45.js} +1 -1
- package/dist/public/index.html +25 -25
- package/dist/{repair-launch-json-ByfyoscN.mjs → repair-launch-json-BhjUucaZ.mjs} +2 -2
- package/dist/{repair-mcp-configs-D6LjdRhL.mjs → repair-mcp-configs-BcIhDXbC.mjs} +2 -2
- package/dist/src-BwG6spwT.mjs +2 -0
- package/dist/start-BX81DKP-.mjs +1 -0
- package/dist/{start-CojePtz9.mjs → start-CBl5qsCR.mjs} +2 -2
- package/package.json +2 -2
- package/dist/constants-JUZqR_Yu.mjs +0 -2
- package/dist/dist-Bq1Nm7Hl.mjs +0 -1
- package/dist/init-DD_r2nwd.mjs +0 -1
- package/dist/loader-CTWe5z9-.mjs +0 -1
- package/dist/preview-DtrIs0gZ.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-nwB2ciii.js +0 -2
- package/dist/public/assets/ActivityPanelDiffView-d4ec9M69.js +0 -13
- package/dist/public/assets/ConsentDialogBody-BncX7dD1.js +0 -2
- package/dist/public/assets/DocumentContext-Bc83ypCd.js +0 -52
- package/dist/public/assets/GraphPanel-DwHnIo6r.js +0 -46
- package/dist/public/assets/SettingsDialogBody-o-ExGcAl.js +0 -11
- package/dist/public/assets/SourceEditor-DF322IKX.js +0 -2
- package/dist/public/assets/button-JrGyO3-P.js +0 -1
- package/dist/public/assets/channel-DtU-CCDV.js +0 -1
- package/dist/public/assets/checkbox-CTrUepCv.js +0 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-BZpd1T4J.js +0 -1
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-C6GyLa0q.js +0 -1
- package/dist/public/assets/clone-CvvNDZ2x.js +0 -1
- package/dist/public/assets/compiler-runtime-CVnuRdak.js +0 -1
- package/dist/public/assets/config-validation-events-BCNaZEDf.js +0 -10
- package/dist/public/assets/index-Bzs40SFf.css +0 -1
- package/dist/public/assets/index-Izdfgq4i.js +0 -1928
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-B8ew63Gv.js +0 -1
- package/dist/public/assets/typing-burst-detector-ByUXt_f8.js +0 -2
- package/dist/src-DOCgFp9P.mjs +0 -2
- package/dist/start-PJUtb0rl.mjs +0 -1
- /package/dist/public/assets/{katex-qwlL5fSd.js → katex-DX-tM4Fr.js} +0 -0
- /package/dist/public/assets/{trace-api-3dczfLSc.js → trace-api-CiCjX4Sz.js} +0 -0
- /package/dist/public/assets/{w3c-keyname-BSTW6KzM.js → w3c-keyname-B5t0fahT.js} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -139,6 +139,16 @@ interface ParsedGitHubBlobUrl {
|
|
|
139
139
|
declare function parseGitUrl(input: string): ParsedGitUrl | null;
|
|
140
140
|
declare function parseGitHubBlobUrl(input: string): ParsedGitHubBlobUrl | null;
|
|
141
141
|
//#endregion
|
|
142
|
+
//#region src/integrations/project-integration-writers.d.ts
|
|
143
|
+
type IntegrationId = 'mcp-config' | 'project-skill';
|
|
144
|
+
interface IntegrationWriteOutcome {
|
|
145
|
+
readonly integration: IntegrationId;
|
|
146
|
+
readonly editorId: EditorId;
|
|
147
|
+
readonly action: 'written' | 'overwritten' | 'skipped-unsupported' | 'failed';
|
|
148
|
+
readonly path?: string;
|
|
149
|
+
readonly error?: string;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
142
152
|
//#region src/integrations/resolve-project-root.d.ts
|
|
143
153
|
interface ResolveProjectRootResult {
|
|
144
154
|
/** Where `.ok/` lives or will live. Equals `realpath(cwd)` when no
|
|
@@ -168,19 +178,15 @@ interface ResolveProjectRootOptions {
|
|
|
168
178
|
declare function resolveProjectRoot(cwd: string, opts?: ResolveProjectRootOptions): ResolveProjectRootResult;
|
|
169
179
|
//#endregion
|
|
170
180
|
//#region src/integrations/write-project-ai-integrations.d.ts
|
|
171
|
-
type ProjectAiIntegrationOutcome = 'written' | 'overwritten' | 'failed' | 'skipped-no-project-surface';
|
|
172
|
-
interface ProjectAiEditorOutcome {
|
|
173
|
-
readonly editorId: EditorId;
|
|
174
|
-
readonly outcome: ProjectAiIntegrationOutcome;
|
|
175
|
-
readonly error?: string;
|
|
176
|
-
}
|
|
177
181
|
interface ProjectAiIntegrationsResult {
|
|
178
|
-
|
|
182
|
+
/** Per-(editor × integration) outcomes — MCP config and the project-local
|
|
183
|
+
* runtime skill for every selected editor. */
|
|
184
|
+
readonly integrations: IntegrationWriteOutcome[];
|
|
179
185
|
/** Result of `<projectDir>/.claude/launch.json` scaffolding; present iff
|
|
180
|
-
*
|
|
186
|
+
* `'claude'` was in `selectedEditorIds`. */
|
|
181
187
|
readonly claudeLaunchJson?: LaunchJsonResult;
|
|
182
188
|
}
|
|
183
189
|
declare function writeProjectAiIntegrations(projectDir: string, selectedEditorIds: readonly EditorId[], installOptions?: McpInstallOptions): ProjectAiIntegrationsResult;
|
|
184
190
|
//#endregion
|
|
185
|
-
export { ALL_EDITOR_IDS, EDITOR_LABELS, EDITOR_TARGETS, type EditorId, type EditorMcpResult, type EditorMcpTarget, type ExpectedShareRepo, LAUNCH_CONFIG_NAME, type LaunchJsonResult, type LoadConfigResult, type McpEntryClassification, type McpInstallOptions, type ParsedGitHubBlobUrl, type PreviewResult, type
|
|
191
|
+
export { ALL_EDITOR_IDS, EDITOR_LABELS, EDITOR_TARGETS, type EditorId, type EditorMcpResult, type EditorMcpTarget, type ExpectedShareRepo, type IntegrationWriteOutcome, LAUNCH_CONFIG_NAME, type LaunchJsonResult, type LoadConfigResult, type McpEntryClassification, type McpInstallOptions, type ParsedGitHubBlobUrl, type PreviewResult, type ProjectAiIntegrationsResult, type ResolveProjectRootOptions, type ResolveProjectRootResult, type ShareFolderValidationResult, type UserMcpConfigsOptions, classifyExistingMcpEntry, detectInstalledEditors, initContent, loadConfig, parseGitHubBlobUrl, parseGitUrl, previewContent, readExistingMcpEntry, resolveProjectRoot, scaffoldLaunchJson, validateLocalFolderForShare, writeEditorMcpConfig, writeProjectAiIntegrations, writeUserMcpConfigs };
|
|
186
192
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as e,d as t,f as n,g as r,h as i,i as a,m as o,r as s,s as c,t as l,u,y as d}from"./init-CNnZmq0z.mjs";import{i as f,n as p,r as m,t as h}from"./src-BwG6spwT.mjs";import{n as g}from"./loader-TXH7WI7l.mjs";import{n as _}from"./preview-BkWWpoVx.mjs";export{o as ALL_EDITOR_IDS,i as EDITOR_LABELS,r as EDITOR_TARGETS,l as LAUNCH_CONFIG_NAME,s as classifyExistingMcpEntry,a as detectInstalledEditors,e as initContent,g as loadConfig,m as parseGitHubBlobUrl,f as parseGitUrl,_ as previewContent,c as readExistingMcpEntry,d as resolveProjectRoot,u as scaffoldLaunchJson,p as validateLocalFolderForShare,t as writeEditorMcpConfig,h as writeProjectAiIntegrations,n as writeUserMcpConfigs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./init-CNnZmq0z.mjs";export{e as runInit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,Mt as s,N as c,Pt as l,Wn as u,_i as d,ai as f,an as p,ci as m,ei as h,fi as g,gi as _,ii as v,in as y,oi as b,on as x,pn as S,un as C}from"./dist-B_Nlx5d6.mjs";import{n as ee,t as te}from"./constants-JUZqR_Yu.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-Bep4xj-R.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},xe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Se={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ee=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===je?Ee(e.slice(p,n.lastIndex)):n===Ne?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,N as s,Nt as c,Qr as l,Un as u,ai as d,an as f,di as p,fn as m,gi as h,hi as g,ii as _,in as v,jt as y,ln as b,ri as x,rn as S,si as C}from"./dist-soQLoIV1.mjs";import{n as ee,t as te}from"./constants-Dg34Tv0a.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-BkWWpoVx.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},xe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Se={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ee=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===je?Ee(e.slice(p,n.lastIndex)):n===Ne?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
|
|
2
2
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){Be.lastIndex=e+1;let t=Be.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
3
3
|
`){a&&(r+=Ue(``));let e=i?Ve(i):void 0;i&&e&&(r+=He(e))}else t===`
|
|
4
4
|
`&&(i&&Ve(i)&&(r+=He(i)),a&&(r+=Ue(a)))}return r},qe=/\r?\n/;function Je(e,t,n){return String(e).normalize().split(qe).map(e=>Ke(e,t,n)).join(`
|
|
@@ -262,7 +262,7 @@ let In=/^[a-z0-9-_]+$/i;function Ln(e){let t=typeof e;if(t===`object`){if(Array.
|
|
|
262
262
|
`)+Wn(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=Bn(t[c],e,r,i),a+=`
|
|
263
263
|
`}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function Gn(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(Ln(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=Wn(0,e,``,t,n);return r[r.length-1]===`
|
|
264
264
|
`?r:r+`
|
|
265
|
-
`}function Kn(e,t){let n;try{n=ce(e)}catch(e){if(e.code===`ENOENT`)return;throw e}if(n.isSymbolicLink())throw Error(`Refusing to follow symlink at ${t} (${e}). An untrusted upstream may have committed this symlink to redirect writes outside the project. Remove the symlink and re-run.`)}function qn(e){return/^[A-Za-z0-9._\-/]+$/.test(e)?e:JSON.stringify(e)}function Jn(e,t){let n=`# yaml-language-server: $schema=https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${
|
|
265
|
+
`}function Kn(e,t){let n;try{n=ce(e)}catch(e){if(e.code===`ENOENT`)return;throw e}if(n.isSymbolicLink())throw Error(`Refusing to follow symlink at ${t} (${e}). An untrusted upstream may have committed this symlink to redirect writes outside the project. Remove the symlink and re-run.`)}function qn(e){return/^[A-Za-z0-9._\-/]+$/.test(e)?e:JSON.stringify(e)}function Jn(e,t){let n=`# yaml-language-server: $schema=https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${g}/config.project.schema.json
|
|
266
266
|
# Open Knowledge — project configuration
|
|
267
267
|
#
|
|
268
268
|
# This file overrides built-in defaults for this project. Every key below
|
|
@@ -376,7 +376,7 @@ let In=/^[a-z0-9-_]+$/i;function Ln(e){let t=typeof e;if(t===`object`){if(Array.
|
|
|
376
376
|
`)}\n`,`utf-8`),`updated`)}const Zn=`# .ok/local/ holds per-machine runtime state. Anything inside is
|
|
377
377
|
# machine-local and never committed. New runtime files (caches, locks,
|
|
378
378
|
# manifests, telemetry, error logs) are auto-ignored — no edit needed here.
|
|
379
|
-
${
|
|
379
|
+
${h}/
|
|
380
380
|
|
|
381
381
|
# Per-machine runtime state at the .ok/ root. Contains PII (principal email,
|
|
382
382
|
# UUID), hostnames, and absolute filesystem paths — never commit. The only
|
|
@@ -400,10 +400,10 @@ last-spawn-error.log
|
|
|
400
400
|
# drafts/ # exclude a directory
|
|
401
401
|
# *.draft.md # exclude files matching a pattern
|
|
402
402
|
# !keep.md # re-include a file .gitignore excluded
|
|
403
|
-
`,`.okignore`)?r.push(`.okignore`):a.push(`.okignore`),{created:r,updated:i,skipped:a}}function $n(e,t){let n=N(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const er=e=>{try{let t=ie(`git`,[`rev-parse`,`--show-toplevel`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return t.length>0?t:null}catch{return null}};function tr(e,t={}){let n=t.homeDir??H(),r=t.gitTopLevel??er,i=P(e),a;try{a=le(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(
|
|
404
|
-
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const
|
|
405
|
-
`)?n:`${n}\n`,`utf-8`)}
|
|
406
|
-
`,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 Wr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Ur)():`both`}const Gr=`0.0.1`,Kr=`open-knowledge-ui`,qr=[`-y`,`@inkeep/open-knowledge@latest`,`ui`];function Jr(e,t={}){let n=j(e,`.claude`,`launch.json`),r=t.cliPath===void 0?t.mode===`dev`?{name:Kr,runtimeExecutable:`node`,runtimeArgs:[or(),`ui`],port:kr,autoPort:!0}:{name:Kr,runtimeExecutable:`npx`,runtimeArgs:[...qr],port:kr,autoPort:!0}:{name:Kr,runtimeExecutable:t.cliPath,runtimeArgs:[`ui`],port:kr,autoPort:!0};try{if(Br(n,e),!L(n))return R(k(n),{recursive:!0}),B(n,`${JSON.stringify({version:Gr,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=z(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!w(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>w(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??Gr,configurations:a};return B(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Yr(e,t,n){try{return L(e.detectPath?.(t,n)??k(e.configPath(t,n)))}catch{return!1}}function Xr(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)}}if(!i&&!n.skipAvailabilityCheck&&!Yr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{Br(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`}}let s;try{s=e.format===`toml`?Lr(o):Ir(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=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)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?zr(o,d):Rr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function Zr(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=u(),i=k(n);Br(i,t);let a=L(n)?`overwritten`:`written`;return ue(i,{recursive:!0,force:!0}),R(k(i),{recursive:!0}),se(r,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Qr(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function $r(e){let t=vr(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>Xr(t,``,n,e.home))}function ei(e,t,n,r){let i=ti(e,t,n,r);return i.kind===`present`?i.entry:null}function ti(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}if(a.trim()===``)return{kind:`corrupt`,error:`file is empty`};let o;try{o=e.format===`toml`?Lr(i):Ir(i)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}let s=o[e.topLevelKey];if(!w(s))return{kind:`no-entry`};let c=s[e.serverName(t)];return w(c)?{kind:`present`,entry:c}:{kind:`no-entry`}}async function ni(e={}){let t=P(e.cwd??process.cwd()),n=tr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(j(r,`.ok`));n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&console.log(`[ok] Initialized OK at ${r} — opened parent of ${N(r,t)} because it contains a .git folder`);let a={mode:e.devMcp?`dev`:`published`},o=await l(r),c;try{c=Qn(r,{contentDir:n.defaultContentDir})}catch(t){let n=Q.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:o.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:n,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`}}let u=await Wr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),d=e.editors??ii(r,e.home),f=e.editors??nr.filter(e=>Q[e].projectConfigPath!==void 0),p=vr(d),m=vr(f),h=e.mcp===!1||u===null,g=Array.from(new Map([...p,...h?[]:m].map(e=>[e.id,e])).values()),_=p.filter(t=>Yr(t,r,e.home)),v=[],b=[],x=new Set;for(let t of g){if(h){let n=``;try{n=t.configPath(r,e.home)}catch{}v.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Vr(u)&&p.includes(t)&&v.push(Xr(t,r,a,e.home)),Hr(u)&&m.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Xr(t,r,a,e.home,n);v.push(i),(i.action===`written`||i.action===`overwritten`)&&(x.add(n),b.push(Zr(t,r)))}}let S=!h&&u!==null&&Hr(u)?m.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,C=h?[]:_.map(e=>Qr(e,r)).filter(e=>e!==void 0).filter(e=>!x.has(e.path)),ee=_.some(e=>e.id===`claude`)&&!h?Jr(r,a):void 0,te=await(e.installUserSkill??y)({home:e.home}),w=s({home:e.home}),T=h?`skipped-flag`:`skipped-missing`,E=v.find(e=>e.editorId===`claude`)??v[0]??{action:T,configPath:Q.claude.configPath(r,e.home)};return{projectRoot:r,contentCreated:c.created,contentUpdated:c.updated,contentSkipped:c.skipped,editors:v,projectSkills:b,legacyProjectConfigs:C,launchJson:ee,skillInstall:te,didGitInit:o.didInit,claudeDesktopDetected:w,mcpAction:E.action,mcpPath:E.configPath,mcpError:`error`in E?E.error:void 0,projectScopeUnsupportedLabels:S}}function ri(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`),s=e=>{let n=e.configPath.startsWith(t)?N(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${c}/`)),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(O(`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(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${E(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${E(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${ne(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}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(O(`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} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${ne(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${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(O(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${E(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${D(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${O(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(re(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),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(`${E(`✓`)} ${O(`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`)} — empty repo, Karpathy 3-layer`),n.push(` - ${T(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${T(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${T(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${T(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
|
|
407
|
-
`)}function
|
|
408
|
-
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-
|
|
409
|
-
//# sourceMappingURL=init-
|
|
403
|
+
`,`.okignore`)?r.push(`.okignore`):a.push(`.okignore`),{created:r,updated:i,skipped:a}}function $n(e,t){let n=N(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const er=e=>{try{let t=ie(`git`,[`rev-parse`,`--show-toplevel`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return t.length>0?t:null}catch{return null}};function tr(e,t={}){let n=t.homeDir??H(),r=t.gitTopLevel??er,i=P(e),a;try{a=le(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(m(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=k(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&$n(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function nr(e,t){let n;try{n=le(t)}catch{n=P(t)}let r;try{r=ce(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(r?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);let i=k(e);for(;i.length>1&&i!==F;){let t;try{t=le(i)}catch(e){if(e.code===`ENOENT`){i=k(i);continue}throw e}let r=N(n,t);if(r===``||!r.startsWith(`..`)&&!A(r))return;throw Error(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function rr(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=u(`project`,{checkDesktop:!0}),i=k(n);nr(i,t);let a=L(n)?`overwritten`:`written`;return ue(i,{recursive:!0,force:!0}),R(k(i),{recursive:!0}),se(r,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}const ir=l,ar=x,or=[`-y`,`@inkeep/open-knowledge@latest`,`mcp`],sr={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`};function cr(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=P(e);if(oe(t)===`cli.mjs`&&oe(k(t))===`dist`)return t;let n=t.split(F),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return j(i.length===0?F:i.join(F),`packages`,`cli`,`dist`,`cli.mjs`)}function lr(e={}){return e.cliPath?{command:e.cliPath,args:[`mcp`]}:e.mode===`dev`?{command:`node`,args:[cr(),`mcp`],env:{...sr}}:{command:`npx`,args:[...or]}}function ur(e){return e===`win32`?I:M}function dr(e={}){let t=e.platformName??process.platform,n=e.home??H();return ur(t).join(n,`.claude.json`)}function fr(e={}){let t=e.platformName??process.platform,n=e.home??H(),r=e.env??process.env;if(t===`darwin`)return M.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??I.join(n,`AppData`,`Roaming`);return I.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function pr(e={}){let t=e.platformName??process.platform,n=e.home??H();return ur(t).join(n,`.cursor`,`mcp.json`)}function mr(e={}){let t=e.platformName??process.platform,n=e.home??H();return(e.env??process.env).CODEX_HOME??ur(t).join(n,`.codex`)}function hr(e={}){return ur(e.platformName??process.platform).join(mr(e),`config.toml`)}function gr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>gr(e,t[n]));if(w(e)&&w(t)){let n=Object.keys(e).sort(),r=Object.keys(t).sort();return n.length===r.length&&n.every((e,t)=>e===r[t])&&n.every(n=>gr(e[n],t[n]))}return!1}function _r(e,t){return Object.entries(t).every(([t,n])=>gr(e[t],n))}function vr(e,t){return{...e,...t}}function yr(e){return{...e,isCompatible(t,n,r){return _r(t,e.buildEntry(n,r))},mergeManagedFields(t,n,r){return vr(t,e.buildEntry(n,r))}}}const Q={claude:yr({id:`claude`,label:ar.claude,configPath:(e,t)=>dr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>j(t??H(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)}),"claude-desktop":yr({id:`claude-desktop`,label:ar[`claude-desktop`],configPath:(e,t)=>fr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(fr({home:t}))}),cursor:yr({id:`cursor`,label:ar.cursor,configPath:(e,t)=>pr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(pr({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)}),codex:yr({id:`codex`,label:ar.codex,configPath:(e,t)=>hr({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(hr({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.agents`,`skills`,`open-knowledge`,`SKILL.md`)})};function br(e){let t=e.filter(e=>!Object.hasOwn(Q,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${ir.join(`, `)}`);return e.map(e=>Q[e])}function $(e,t,n,r,i){let a=`urn:uuid:${he()}`;if(e.headersSent||e.writableEnded||e.destroyed){console.error(`[ok ui] emitProblem called after headers sent — suppressed`,{type:n,status:t,instance:a});return}let o={type:n,title:r,status:t,instance:a,...i===void 0?{}:{detail:i}},s=C.safeParse(o);if(!s.success){console.error(`[ok ui] emitProblem produced an invalid ProblemDetails body:`,{issues:s.error.issues,originalStatus:t,body:o}),e.writeHead(500,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify({type:`urn:ok:error:internal-server-error`,title:`Internal server error.`,status:500,instance:a}));return}e.writeHead(t,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify(o))}const xr=1e4;function Sr(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!b(n))return $(t,403,`urn:ok:error:loopback-required`,`Request must originate from a loopback address.`),!0;if(!f(e.headers.host))return $(t,403,`urn:ok:error:host-not-allowed`,`Host header is not in the loopback allowlist.`),!0;let r=e.headers.origin;return r!==void 0&&!v(r)?($(t,403,`urn:ok:error:invalid-origin`,`Origin header is not in the loopback allowlist.`),!0):!1}const Cr=3e4;function wr(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!b(n)||!f(e.headers.host))return t.destroy(),!0;let r=e.headers.origin;return typeof r==`string`&&!v(r)?(t.destroy(),!0):!1}function Tr(e,t,n,r,i,a){a.add(t),t.once(`close`,()=>a.delete(t));let o=ve({host:r,port:i,timeout:xr});a.add(o),o.once(`close`,()=>a.delete(o));let s=!1,c=n=>{if(!s){if(s=!0,n!==void 0){let t=n.err;console.warn(JSON.stringify({event:n.event,upstreamHost:r,upstreamPort:i,url:e.url,code:t instanceof Error?t.code:void 0,message:t instanceof Error?t.message:void 0}))}try{o.destroy()}catch{}try{t.destroy()}catch{}}};o.once(`connect`,()=>{o.setTimeout(0);let a=[`${e.method??`GET`} ${e.url??`/`} HTTP/1.1`,`host: ${r}:${i}`];for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()!==`host`&&n!==void 0)if(Array.isArray(n))for(let e of n)a.push(`${t}: ${e}`);else a.push(`${t}: ${n}`);try{o.write(`${a.join(`\r
|
|
404
|
+
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const Er=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function Dr(e){let t=e.upstreamTimeoutMs??xr,n=new Set,r=ge((n,r)=>{Sr(n,r)||kr(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{wr(t,r)||Tr(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function Or(e,t,n){kr(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??xr)}function kr(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of Er)delete a[e];e.setTimeout(Cr,()=>{if(t.headersSent)try{t.end()}catch{}else try{$(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${Cr/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=_e({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of Er)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)$(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)$(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}const Ar=39847,jr=39848;async function Mr(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}async function Nr(e){let{existsSync:t}=await import(`node:fs`),{createServer:n}=await import(`node:http`),{resolve:r}=await import(`node:path`),{acquireUiLock:i,createAssetServeMiddleware:o,createContentFilter:s,readServerLock:c,releaseUiLock:l,updateUiLockPort:u}=await import(`./dist-7_PKsuCz.mjs`),{default:f}=await import(`./build-B4ZT2GMK.mjs`),{resolveContentDir:m,resolveLockDir:h}=await import(`./dist-7_PKsuCz.mjs`),g=m(e.config,e.cwd),v=h(e.cwd);i(v,{port:0,worktreeRoot:e.cwd});let y=import.meta.dirname??new URL(`.`,import.meta.url).pathname,b=[r(y,`public`),r(y,`../../app/dist`),r(y,`../../../app/dist`)].find(e=>t(e)),x=b?f(b,{single:!0,gzip:!0,immutable:!0,extensions:[]}):null,S=t(g)?o({contentFilter:s({projectDir:e.cwd,contentDir:g}),contentSirv:f(g,{dotfiles:!1,dev:!0,extensions:[]}),inlineExtensions:d,assetExtensions:a,blocklistExtensions:_}):null,C=e.port,ee=null,te=(e,t)=>{let n=e.url?.split(`?`)[0];if((n===`/`||n===``)&&(e.url=`/index.html`),!(n?.startsWith(`/api/`)&&Sr(e,t))){if(n===`/api/config`&&(e.method===`GET`||e.method===`HEAD`)){ee?.();let n=c(v),r=e.headers.host??`localhost:${C}`,i=n&&n.port>0?`ws://${r}/collab`:null,a=JSON.stringify({collabUrl:i,previewUrl:null,port:C});t.setHeader(`Content-Type`,`application/json`),t.setHeader(`Cache-Control`,`no-store`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.statusCode=200,e.method===`HEAD`?t.end():t.end(a);return}if(n?.startsWith(`/api/`)){ee?.();let r=c(v);if(!r||r.port<=0){$(t,503,`urn:ok:error:collab-server-not-running`,"Collab server not running. Start `ok start` or run `ok status`.",`Path: ${n}`);return}Or(e,t,{upstreamHost:`localhost`,upstreamPort:r.port});return}if(x&&n?.startsWith(`/assets/`)){x(e,t,()=>{S?S(e,t,()=>Pr(t,n)):Pr(t,n)});return}if(S){S(e,t,()=>{x?x(e,t):Pr(t,n)});return}if(x){x(e,t);return}Pr(t,n)}},w=new Set,T=(e,t,n)=>{if(wr(e,t))return;let r=e.url?.split(`?`)[0]??``;if(r!==`/collab`&&!r.startsWith(`/collab/`)){t.destroy();return}let i=c(v);if(!i||i.port<=0){console.warn(JSON.stringify({event:`ok-ui-upgrade-no-collab-lock`,url:r,reason:"server.lock missing or port unbound — is `ok start` running?"})),t.destroy();return}Tr(e,t,n,`localhost`,i.port,w)},E=()=>{for(let e of w)try{e.destroy()}catch{}w.clear()},ne=e.host===void 0?[`::1`,`127.0.0.1`]:[e.host],D=[],O=e.port,re=e=>e instanceof Error&&e.code===`EADDRINUSE`,ie=async()=>{await Promise.all(D.splice(0).map(e=>new Promise(t=>{try{e.close(()=>t())}catch{t()}})))},ae=async e=>{O=e;for(let e of ne){let t=n(te);t.on(`upgrade`,T),D.push(t),await new Promise((n,r)=>{let i=e=>r(e);t.once(`error`,i),t.listen(O,e,()=>{t.off(`error`,i);let e=t.address();typeof e==`object`&&e&&(O=e.port),n()})})}};try{try{await ae(e.port)}catch(t){if(e.fallbackToKernel===!0&&re(t))await ie(),await ae(0);else throw t}}catch(e){await ie();try{l(v)}catch{}throw e}let oe=O;C=oe,u(v,oe);let k=e.scheduler??p,A=e.safetyNetMs??432e5,j=null,M=!1,N=!1,P=()=>{M||(M=!0,j!==null&&(k.clearTimeout(j),j=null))},F=()=>{if(P(),!N){N=!0;try{l(v)}catch{}}},I=()=>{M||A<=0||(j!==null&&(k.clearTimeout(j),j=null),j=k.setTimeout(()=>{j=null,console.warn(`[ui] safety-net (${A}ms) reached — shutting down (D-025 backstop)`);try{e.onSafetyNet?.()}catch{}E();for(let e of D)try{e.close()}catch{}F()},A))},se=()=>{M||A<=0||I()};return ee=se,I(),{httpServers:D,port:oe,release:F,detachSafetyNet:P,nudgeSafetyNet:se,drainUpgradeSockets:E}}function Pr(e,t){$(e,404,`urn:ok:error:not-found`,`Resource not found.`,t===void 0?void 0:`Path: ${t}`)}function Fr(e,t){if(e!==void 0){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<0||t>65535)throw Error(`Invalid --port value '${e}'`);return{port:t,fallbackToKernel:!1}}if(t!==void 0&&t!==``){let e=Number.parseInt(t,10);if(Number.isNaN(e)||e<0||e>65535)throw Error(`Invalid PORT env value '${t}'`);return{port:e,fallbackToKernel:!1}}return{port:Ar,fallbackToKernel:!0}}async function Ir(e){let t=e.readLock??(async()=>{let{readUiLock:t}=await import(`./dist-7_PKsuCz.mjs`);return t(e.lockDir)}),n=await t();if(!n)throw Error(`UI lock collision reported but the lock disappeared before handling — retry acquiring.`);if(n.port===e.requestedPort&&n.port>0)return{mode:`already-running`,port:n.port};let r=n.port;if(r===0){let n=Date.now()+(e.pollDeadlineMs??2e3),i=e.pollIntervalMs??100;for(;Date.now()<n;){await new Promise(e=>{setTimeout(e,i)});let e=await t();if(e&&e.port>0){r=e.port;break}}if(r===0)throw Error("UI did not bind within 2s; run `ok clean`");if(r===e.requestedPort)return{mode:`already-running`,port:r}}return{mode:`proxy`,handle:await Dr({listenPort:e.requestedPort,host:e.host,upstreamHost:`localhost`,upstreamPort:r}),upstreamPort:r}}function Lr(e){return new i(`ui`).description(`Serve the Open Knowledge React editor UI`).option(`-p, --port <port>`,`UI port (default: $PORT env or ${Ar}, kernel-allocated fallback if busy)`).option(`-H, --host <host>`,"UI host. Default: two-socket loopback bind (`[::1]` + `127.0.0.1`) so cross-family collisions fail loud. Pass an explicit host (e.g. `127.0.0.1`, `0.0.0.0`) to bind a single socket on that host.").action(async t=>{let{dim:n}=await import(`./colors-BCE2jNgl.mjs`),{UiLockCollisionError:r}=await import(`./dist-7_PKsuCz.mjs`),{resolveLockDir:i}=await import(`./dist-7_PKsuCz.mjs`),a=e(),o=t.host,s;try{s=Fr(t.port,process.env.PORT)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1;return}let c=s.port;try{let e=await Nr({config:a,cwd:process.cwd(),port:c,fallbackToKernel:s.fallbackToKernel,host:o}),t=o===void 0||o===`::`||o===`0.0.0.0`?`localhost`:o;console.log(`${n(`[ui]`)} listening on http://${t}:${e.port}`);let r=!1,i=t=>{if(r)return;r=!0,console.log(n(`\n[ui] Shutting down (${t})`)),e.detachSafetyNet();let i=()=>{try{e.release()}finally{process.exit(process.exitCode??0)}};e.drainUpgradeSockets(),Mr(e.httpServers).then(i,i),setTimeout(i,2e3).unref()};process.once(`SIGINT`,()=>i(`SIGINT`)),process.once(`SIGTERM`,()=>i(`SIGTERM`));return}catch(e){if(!(e instanceof r))throw e;let t=i(process.cwd()),a=o??`localhost`,s;try{s=await Ir({requestedPort:c,host:a,lockDir:t})}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}if(s.mode===`already-running`){if(console.log(`UI already running at http://${a}:${s.port}`),Rr(process)){await new Promise(e=>{let t=t=>{console.log(n(`\n[ui-keepalive] Shutting down (${t})`)),e()};process.once(`SIGINT`,()=>t(`SIGINT`)),process.once(`SIGTERM`,()=>t(`SIGTERM`))});return}process.exit(0)}console.log(`UI running at http://${a}:${s.upstreamPort}; acting as HTTP proxy on port ${s.handle.port}`);let l=!1,u=e=>{l||(l=!0,console.log(n(`\n[ui-proxy] Shutting down (${e})`)),s.handle.close().finally(()=>process.exit(process.exitCode??0)),setTimeout(()=>process.exit(process.exitCode??0),2e3).unref())};process.once(`SIGINT`,()=>u(`SIGINT`)),process.once(`SIGTERM`,()=>u(`SIGTERM`))}})}function Rr(e){let t=e.stdout.isTTY===!0,n=typeof e.env.PORT==`string`&&e.env.PORT!==``;return!t||n}function zr(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=JSON.parse(t);if(w(n))return n;throw Error(`${e} root must be a JSON object`)}catch(t){throw t instanceof SyntaxError?Error(`${e} contains invalid JSON: ${t.message}`):t}}function Br(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=Fn(t);if(w(n))return n;throw Error(`${e} root must be a TOML table`)}catch(t){throw Error(`${e} contains invalid TOML: ${t instanceof Error?t.message:String(t)}`)}}function Vr(e,t){R(k(e),{recursive:!0}),B(e,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function Hr(e,t){R(k(e),{recursive:!0});let n=Gn(t);B(e,n.endsWith(`
|
|
405
|
+
`)?n:`${n}\n`,`utf-8`)}const Ur=e=>e!==`project`,Wr=e=>e!==`user`;async function Gr(){let e=await dn({message:`Where should the MCP server be configured?
|
|
406
|
+
`,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 Kr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Gr)():`both`}const qr=`0.0.1`,Jr=`open-knowledge-ui`,Yr=[`-y`,`@inkeep/open-knowledge@latest`,`ui`];function Xr(e,t={}){let n=j(e,`.claude`,`launch.json`),r=t.cliPath===void 0?t.mode===`dev`?{name:Jr,runtimeExecutable:`node`,runtimeArgs:[cr(),`ui`],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:`npx`,runtimeArgs:[...Yr],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:t.cliPath,runtimeArgs:[`ui`],port:jr,autoPort:!0};try{if(nr(n,e),!L(n))return R(k(n),{recursive:!0}),B(n,`${JSON.stringify({version:qr,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=z(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!w(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>w(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??qr,configurations:a};return B(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Zr(e,t,n){try{return L(e.detectPath?.(t,n)??k(e.configPath(t,n)))}catch{return!1}}function Qr(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)}}if(!i&&!n.skipAvailabilityCheck&&!Zr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{nr(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`}}let s;try{s=e.format===`toml`?Br(o):zr(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=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)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?Hr(o,d):Vr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function $r(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function ei(e){let t=br(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>Qr(t,``,n,e.home))}function ti(e,t,n,r){let i=ni(e,t,n,r);return i.kind===`present`?i.entry:null}function ni(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}if(a.trim()===``)return{kind:`corrupt`,error:`file is empty`};let o;try{o=e.format===`toml`?Br(i):zr(i)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}let s=o[e.topLevelKey];if(!w(s))return{kind:`no-entry`};let c=s[e.serverName(t)];return w(c)?{kind:`present`,entry:c}:{kind:`no-entry`}}async function ri(e={}){let t=P(e.cwd??process.cwd()),n=tr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(j(r,`.ok`));n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&console.log(`[ok] Initialized OK at ${r} — opened parent of ${N(r,t)} because it contains a .git folder`);let a={mode:e.devMcp?`dev`:`published`},o=await c(r),s;try{s=Qn(r,{contentDir:n.defaultContentDir})}catch(t){let n=Q.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:o.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:n,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`}}let l=await Kr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),u=e.editors??ai(r,e.home),d=e.editors??ir.filter(e=>Q[e].projectConfigPath!==void 0),f=br(u),p=br(d),m=e.mcp===!1||l===null,h=Array.from(new Map([...f,...m?[]:p].map(e=>[e.id,e])).values()),g=f.filter(t=>Zr(t,r,e.home)),_=[],v=[],b=new Set;for(let t of h){if(m){let n=``;try{n=t.configPath(r,e.home)}catch{}_.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Ur(l)&&f.includes(t)&&_.push(Qr(t,r,a,e.home)),Wr(l)&&p.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Qr(t,r,a,e.home,n);_.push(i),(i.action===`written`||i.action===`overwritten`)&&b.add(n)}}for(let e of p)e.projectSkillPath&&v.push(rr(e,r));let x=!m&&l!==null&&Wr(l)?p.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,C=m?[]:g.map(e=>$r(e,r)).filter(e=>e!==void 0).filter(e=>!b.has(e.path)),ee=g.some(e=>e.id===`claude`)&&!m?Xr(r,a):void 0,te=await(e.installUserSkill??S)({home:e.home}),w=y({home:e.home}),T=m?`skipped-flag`:`skipped-missing`,E=_.find(e=>e.editorId===`claude`)??_[0]??{action:T,configPath:Q.claude.configPath(r,e.home)};return{projectRoot:r,contentCreated:s.created,contentUpdated:s.updated,contentSkipped:s.skipped,editors:_,projectSkills:v,legacyProjectConfigs:C,launchJson:ee,skillInstall:te,didGitInit:o.didInit,claudeDesktopDetected:w,mcpAction:E.action,mcpPath:E.configPath,mcpError:`error`in E?E.error:void 0,projectScopeUnsupportedLabels:x}}function ii(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`),s=e=>{let n=e.configPath.startsWith(t)?N(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${c}/`)),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(O(`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(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${E(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${E(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${ne(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}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(O(`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} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${ne(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${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(O(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${E(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${D(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${O(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(re(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),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(`${E(`✓`)} ${O(`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`)} — empty repo, Karpathy 3-layer`),n.push(` - ${T(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${T(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${T(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${T(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
|
|
407
|
+
`)}function ai(e,t){let n=[];for(let r of ir)Zr(Q[r],e,t)&&n.push(r);return n}function oi(){return new i(`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`).addOption(new r(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).action(async e=>{let t=process.cwd(),n;try{n=await ri({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope})}catch(e){if(e instanceof s){process.stderr.write(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.
|
|
408
|
+
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-BeJHolBZ.mjs`),{loadConfig:t}=await import(`./loader-BhwWH_ja.mjs`),{resolveContentDir:r}=await import(`./dist-7_PKsuCz.mjs`),{config:i}=t(n.projectRoot),a=r(i,n.projectRoot);n.preview=e({projectDir:n.projectRoot,contentDir:a})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${ii(n,n.projectRoot)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{Te as A,ut as C,ot as D,ht as E,Ye as O,lt as S,dt as T,or as _,ii as a,Qn as b,Kr as c,Qr as d,ei as f,Q as g,ar as h,ai as i,W as j,Je as k,ri as l,ir as m,Yr as n,oi as o,Lr as p,ni as r,ti as s,Jr as t,Xr as u,rr as v,pt as w,ft as x,tr as y};
|
|
409
|
+
//# sourceMappingURL=init-CNnZmq0z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-TXH7WI7l.mjs";export{e as loadConfig};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Jr as e,
|
|
1
|
+
import{Jr as e,f as t,fi as n,ji as r,qr as i,vi as a}from"./dist-soQLoIV1.mjs";import{t as o}from"./constants-Dg34Tv0a.mjs";import{t as s}from"./is-object-C-4FJ0rP.mjs";import{resolve as c}from"node:path";import{existsSync as l,readFileSync as u}from"node:fs";import{realpath as d}from"node:fs/promises";async function f(e){let t=c(e);try{return await d(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}}var p=r();function m(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];s(a)&&s(i)?n[r]=m(i,a):a!==void 0&&(n[r]=a)}return n}function h(e){if(!l(e))return{value:null,path:e,source:null,doc:null};let t;try{t=u(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,p.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return s(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const g=[`include`,`exclude`];function _(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function v(e){let t=e.value;if(!s(t))return[];let n=t.content;if(!s(n))return[];let r=[];for(let t of g)if(t in n){let n=[`content`,t],i;e.doc!==null&&e.source!==null&&(i=a({file:e.path,source:e.source,doc:e.doc,path:n})),r.push({code:`REMOVED_KEY`,path:n,redirect:_(t),...i===void 0?{}:{source:i}})}return r}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=a({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function b(r){let a=r??process.cwd(),s=[],l=e(`user`,a),u=i({absPath:l}),d={};u.valid&&u.source!==void 0?(d=m(d,u.value),s.push(l)):u.valid;let f=c(a,`.ok`,o),p=h(f);if(p.value!==null){let e=v(p);if(e.length>0)throw Error(e.map(n).join(`
|
|
2
2
|
|
|
3
|
-
`));d=m(d,p.value),s.push(f)}x(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),x(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),x(d,[`server`,`host`],`use the --host flag or HOST env var instead`),x(d,[`server`,`openOnAgentEdit`]),x(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),x(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),x(d,[`mcp`,`tools`,`grep`,`maxResults`]),x(d,[`mcp`,`tools`,`search`,`maxResults`]),x(d,[`preview`,`baseUrl`],"preview URLs now resolve only to the running UI process — start one with `ok ui`");let g=
|
|
4
|
-
//# sourceMappingURL=loader-
|
|
3
|
+
`));d=m(d,p.value),s.push(f)}x(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),x(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),x(d,[`server`,`host`],`use the --host flag or HOST env var instead`),x(d,[`server`,`openOnAgentEdit`]),x(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),x(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),x(d,[`mcp`,`tools`,`grep`,`maxResults`]),x(d,[`mcp`,`tools`,`search`,`maxResults`]),x(d,[`preview`,`baseUrl`],"preview URLs now resolve only to the running UI process — start one with `ok ui`");let g=t.safeParse(d);if(!g.success){let e={code:`SCHEMA_INVALID`,issues:y(g.error.issues,p)};throw Error(n(e))}return{config:g.data,sources:s}}function x(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){if(!s(r))return;r=r[t[e]]}if(!s(r))return;let i=t[t.length-1];if(r[i]===void 0)return;let a=t.join(`.`);console.warn(`[config] ${a} is no longer user-configurable; ${n??`the value is hardcoded in @inkeep/open-knowledge-core`}. Remove the key to silence this warning.`)}function S(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=f(e.startupCwd);return async o=>{let s=await f(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,S as t};
|
|
4
|
+
//# sourceMappingURL=loader-TXH7WI7l.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-BkWWpoVx.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bt as e}from"./dist-soQLoIV1.mjs";import"./constants-Dg34Tv0a.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
|
|
2
2
|
`)}export{c as n,l as t};
|
|
3
|
-
//# sourceMappingURL=preview-
|
|
3
|
+
//# sourceMappingURL=preview-BkWWpoVx.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-LNHry3BJ.js","./chunk-CFjPhJqf.js","./compiler-runtime-Cs91PcD2.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{a as n,i as r,o as i,r as a,t as o}from"./compiler-runtime-Cs91PcD2.js";import{$n as s,Mn as c,n as l,nt as u,r as d,tr as f}from"./DocumentContext-BK7c8nfO.js";import{D as p,Ht as m,O as h,_ as g,et as _,j as v,k as y,tt as b}from"./doc-hash-Biw40x7n.js";import{C as x,t as S}from"./button-DenIdY-r.js";import{f as C,i as w,m as T,r as E,t as D}from"./agent-presence-DxGcS3q2.js";import{a as O,c as k,i as A,o as j,s as M,t as ee,x as N}from"./dialog-DUff25Wx.js";import{a as te}from"./collapsible-BhpeB6tu.js";var ne=x(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),P=o(),F=e(n(),1),I=500,re=64;async function ie(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new u(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=m.safeParse(r);throw e.success?Error(e.data.title):new u(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=_.safeParse(r);if(!i.success)throw new u(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function L(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new u(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=m.safeParse(a);throw e.success?Error(e.data.title):new u(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=b.safeParse(a);if(!o.success)throw new u(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function ae(e){let t=(0,P.c)(23),{systemProvider:n}=l(),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(`idle`),[s,c]=(0,F.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new w(re),t[0]=u):u=t[0];let d=(0,F.useRef)(u),f=(0,F.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),c(null),ie(e).then(r=>{if(f.current!==t)return;let a=R(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(c(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),c(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=g(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},I))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let _;t[6]===e?_=t[7]:(_=[e],t[6]=e,t[7]=_),(0,F.useEffect)(h,_);let v,y;t[8]!==e||t[9]!==n?(v=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=R(n,e);i(e=>!e||oe(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},y=[e,n],t[8]=e,t[9]=n,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,F.useEffect)(v,y);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await L(e,t,n);return d.current.set(r,a),a},t[12]=e,t[13]=b);let x=b,S;t[14]!==e||t[15]!==m?(S=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=S):S=t[16];let C=S,T;return t[17]!==r||t[18]!==s||t[19]!==x||t[20]!==C||t[21]!==a?(T={data:r,status:a,error:s,reload:C,fetchBurstDiff:x},t[17]=r,t[18]=s,t[19]=x,t[20]=C,t[21]=a,t[22]=T):T=t[22],T}function oe(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function R(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!D(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var z=i(),se=(0,F.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function ce(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function le(e){let t=(0,P.c)(42),{burst:n,docName:i,fetchBurstDiff:o}=e,{_:s}=r(),[c,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)(null),[p,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(ue),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(e)},b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,F.useEffect)(y,b);let x;t[2]!==n.stackIndex||t[3]!==u||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==h?(x=()=>{let e=!c;l(e),e&&u===null&&!h&&(g(!0),m(null),o(i,n.stackIndex).then(e=>{d(e),g(!1)}).catch(e=>{m(e instanceof Error?e.message:String(e)),g(!1)}))},t[2]=n.stackIndex,t[3]=u,t[4]=i,t[5]=c,t[6]=o,t[7]=h,t[8]=x):x=t[8];let S=x,C=n.stackIndex+1,w;t[9]!==s||t[10]!==C||t[11]!==c?(w=s(c?{id:`-i7ik4`,values:{burstNumber:C}}:{id:`EeRZnZ`,values:{burstNumber:C}}),t[9]=s,t[10]=C,t[11]=c,t[12]=w):w=t[12];let T;t[13]===c?T=t[14]:(T=c?(0,z.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,z.jsx)(te,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=c,t[14]=T);let E;t[15]!==n.ts||t[16]!==_?(E=ce(n.ts,_),t[15]=n.ts,t[16]=_,t[17]=E):E=t[17];let D;t[18]===E?D=t[19]:(D=(0,z.jsx)(`span`,{className:`font-mono`,children:E}),t[18]=E,t[19]=D);let O;t[20]===n.additions?O=t[21]:(O=(0,z.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=O);let k;t[22]===n.deletions?k=t[23]:(k=(0,z.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=k);let A;t[24]!==O||t[25]!==k?(A=(0,z.jsxs)(`span`,{className:`ml-auto font-mono`,children:[O,` `,k]}),t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==c||t[28]!==A||t[29]!==w||t[30]!==T||t[31]!==D||t[32]!==S?(j=(0,z.jsxs)(`button`,{type:`button`,onClick:S,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":c,"aria-label":w,children:[T,D,A]}),t[27]=c,t[28]=A,t[29]=w,t[30]=T,t[31]=D,t[32]=S,t[33]=j):j=t[33];let M;t[34]!==u||t[35]!==c||t[36]!==p||t[37]!==h?(M=c?(0,z.jsx)(`div`,{className:`bg-muted/20`,children:h?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(a,{id:`38foVZ`})}):p?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,z.jsx)(a,{id:`pmKdif`,values:{loadError:p}})}):u===null?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(a,{id:`iNFKkm`})}):(0,z.jsx)(F.Suspense,{fallback:(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(a,{id:`38foVZ`})}),children:(0,z.jsx)(se,{diff:u})})}):null,t[34]=u,t[35]=c,t[36]=p,t[37]=h,t[38]=M):M=t[38];let ee;return t[39]!==j||t[40]!==M?(ee=(0,z.jsxs)(`div`,{className:`border-t border-border/50`,children:[j,M]}),t[39]=j,t[40]=M,t[41]=ee):ee=t[41],ee}function ue(){return Date.now()}function de(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return p._({id:`nYeBmY`,values:{hours:r}})}function fe(e){let t=(0,P.c)(118),{file:n,sessionAlive:i,isWriting:o,onNavigate:s,onUndoLast:c,onUndoAll:l,fetchBurstDiff:u}=e,{_:d}=r(),{docName:p}=n,[m,g]=(0,F.useState)(!1),[_,b]=(0,F.useState)(!1),[x,w]=(0,F.useState)(!1),[T,E]=(0,F.useState)(me),D,N;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>E(Date.now()),3e4);return()=>clearInterval(e)},N=[],t[0]=D,t[1]=N):(D=t[0],N=t[1]),(0,F.useEffect)(D,N),n.bursts.length===0)return null;let I=!i||n.bursts.length===0||x,re=n.bursts.length,ie;t[2]!==d||t[3]!==n.bursts.length||t[4]!==i?(ie=i?n.bursts.length===0?d({id:`2fkdnR`}):null:d({id:`NzFvyK`}),t[2]=d,t[3]=n.bursts.length,t[4]=i,t[5]=ie):ie=t[5];let L=ie,ae;t[6]!==I||t[7]!==n.docName||t[8]!==c?(ae=e=>{e.stopPropagation(),!I&&(w(!0),Promise.resolve(c(n.docName)).finally(()=>w(!1)))},t[6]=I,t[7]=n.docName,t[8]=c,t[9]=ae):ae=t[9];let oe=ae,R;t[10]===I?R=t[11]:(R=e=>{e.stopPropagation(),!I&&b(!0)},t[10]=I,t[11]=R);let se=R,ce;t[12]!==I||t[13]!==n.docName||t[14]!==l?(ce=()=>{b(!1),!I&&(w(!0),Promise.resolve(l(n.docName)).finally(()=>w(!1)))},t[12]=I,t[13]=n.docName,t[14]=l,t[15]=ce):ce=t[15];let ue=ce,fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>g(pe),t[16]=fe):fe=t[16];let B;t[17]!==d||t[18]!==p||t[19]!==m?(B=d(m?{id:`rVgSRB`,values:{docName:p}}:{id:`tW_yvQ`,values:{docName:p}}),t[17]=d,t[18]=p,t[19]=m,t[20]=B):B=t[20];let V;t[21]===m?V=t[22]:(V=m?(0,z.jsx)(f,{className:`size-4`,"aria-hidden":`true`}):(0,z.jsx)(te,{className:`size-4`,"aria-hidden":`true`}),t[21]=m,t[22]=V);let H;t[23]!==m||t[24]!==B||t[25]!==V?(H=(0,z.jsx)(`button`,{type:`button`,onClick:fe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":m,"aria-label":B,"data-testid":`activity-panel-file-row-carrot`,children:V}),t[23]=m,t[24]=B,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==n.docName||t[28]!==s?(U=()=>s(n.docName),t[27]=n.docName,t[28]=s,t[29]=U):U=t[29];let W;t[30]!==d||t[31]!==p?(W=d({id:`QcpeeE`,values:{docName:p}}),t[30]=d,t[31]=p,t[32]=W):W=t[32];let G;t[33]!==n.docName||t[34]!==U||t[35]!==W?(G=(0,z.jsx)(`button`,{type:`button`,onClick:U,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":W,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=U,t[35]=W,t[36]=G):G=t[36];let K;t[37]!==d||t[38]!==p?(K=d({id:`m4v3XT`,values:{docName:p}}),t[37]=d,t[38]=p,t[39]=K):K=t[39];let he;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,z.jsx)(C,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=he):he=t[40];let q;t[41]!==I||t[42]!==oe||t[43]!==K?(q=(0,z.jsx)(v,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:oe,disabled:I,"aria-label":K,"data-testid":`activity-panel-undo-last`,children:he})}),t[41]=I,t[42]=oe,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==d||t[46]!==L?(J=L??d({id:`ArBWJf`}),t[45]=d,t[46]=L,t[47]=J):J=t[47];let Y;t[48]===J?Y=t[49]:(Y=(0,z.jsx)(y,{side:`bottom`,children:J}),t[48]=J,t[49]=Y);let X;t[50]!==q||t[51]!==Y?(X=(0,z.jsxs)(h,{children:[q,Y]}),t[50]=q,t[51]=Y,t[52]=X):X=t[52];let Z;t[53]!==d||t[54]!==p?(Z=d({id:`J2MgzQ`,values:{docName:p}}),t[53]=d,t[54]=p,t[55]=Z):Z=t[55];let ge;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,z.jsx)(ne,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ge):ge=t[56];let _e;t[57]!==I||t[58]!==se||t[59]!==Z?(_e=(0,z.jsx)(v,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:se,disabled:I,"aria-label":Z,"data-testid":`activity-panel-undo-all`,children:ge})}),t[57]=I,t[58]=se,t[59]=Z,t[60]=_e):_e=t[60];let ve;t[61]!==d||t[62]!==L?(ve=L??d({id:`mNY1G6`}),t[61]=d,t[62]=L,t[63]=ve):ve=t[63];let ye;t[64]===ve?ye=t[65]:(ye=(0,z.jsx)(y,{side:`bottom`,children:ve}),t[64]=ve,t[65]=ye);let be;t[66]!==_e||t[67]!==ye?(be=(0,z.jsxs)(h,{children:[_e,ye]}),t[66]=_e,t[67]=ye,t[68]=be):be=t[68];let xe;t[69]===n.additionsTotal?xe=t[70]:(xe=(0,z.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[69]=n.additionsTotal,t[70]=xe);let Se;t[71]===n.deletionsTotal?Se=t[72]:(Se=(0,z.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[71]=n.deletionsTotal,t[72]=Se);let Ce;t[73]!==xe||t[74]!==Se?(Ce=(0,z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[xe,` `,Se]}),t[73]=xe,t[74]=Se,t[75]=Ce):Ce=t[75];let we;t[76]!==n.lastTs||t[77]!==T?(we=de(n.lastTs,T),t[76]=n.lastTs,t[77]=T,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,z.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===o?Te=t[82]:(Te=o?(0,z.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,z.jsx)(a,{id:`6q0rnH`})}):null,t[81]=o,t[82]=Te);let Ee;t[83]!==H||t[84]!==G||t[85]!==X||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[H,G,X,be,Ce,Q,Te]}),t[83]=H,t[84]=G,t[85]=X,t[86]=be,t[87]=Ce,t[88]=Q,t[89]=Te,t[90]=Ee):Ee=t[90];let De;t[91]!==m||t[92]!==u||t[93]!==n.bursts||t[94]!==n.docName?(De=m?(0,z.jsx)(`div`,{children:n.bursts.map(e=>(0,z.jsx)(le,{burst:e,docName:n.docName,fetchBurstDiff:u},`${n.docName}:${e.stackIndex}`))}):null,t[91]=m,t[92]=u,t[93]=n.bursts,t[94]=n.docName,t[95]=De):De=t[95];let Oe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,z.jsx)(k,{children:(0,z.jsx)(a,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==re||t[98]!==p?(ke={docName:p,burstCount:re},t[97]=re,t[98]=p,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,z.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,z.jsxs)(M,{children:[Oe,(0,z.jsx)(O,{children:(0,z.jsx)(a,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>b(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,z.jsx)(S,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,z.jsx)(a,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,z.jsx)(a,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===ue?Fe=t[107]:(Fe=(0,z.jsxs)(j,{children:[Ne,(0,z.jsx)(S,{type:`button`,variant:`destructive`,onClick:ue,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=ue,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,z.jsxs)(A,{className:`sm:max-w-md`,children:[je,Fe]}),t[108]=je,t[109]=Fe,t[110]=Ie):Ie=t[110];let $;t[111]!==_||t[112]!==Ie?($=(0,z.jsx)(ee,{open:_,onOpenChange:b,children:Ie}),t[111]=_,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,z.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Ee,De,$]}),t[114]=Ee,t[115]=De,t[116]=$,t[117]=Le):Le=t[117],Le}function pe(e){return!e}function me(){return Date.now()}async function B(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 V(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function H(e){typeof window>`u`||(window.location.hash=V(e))}function U(){let e=(0,P.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(c,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,z.jsx)(`span`,{className:`text-sm`,children:(0,z.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function W(e){let t=(0,P.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,z.jsx)(s,{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,z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,z.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let c;t[2]===n?c=t[3]:(c=(0,z.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,z.jsx)(S,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==c||t[8]!==u?(d=(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,c,u]}),t[7]=c,t[8]=u,t[9]=d):d=t[9],d}function G(){let e=(0,P.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,z.jsx)(`p`,{className:`text-sm italic`,children:(0,z.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function K(e){let t=(0,P.c)(12),{onExit:n,showBackButton:i}=e,{_:o}=r(),s;t[0]===o?s=t[1]:(s=o({id:`kYL1lH`}),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==i?(c=i?(0,z.jsx)(he,{onClick:n}):null,t[2]=n,t[3]=i,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,z.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,z.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,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,z.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,z.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,z.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 he(e){let t=(0,P.c)(9),{onClick:n}=e,{_:i}=r(),o;t[0]===i?o=t[1]:(o=i({id:`ogAuyr`}),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,z.jsx)(T,{}),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==o?(c=(0,z.jsx)(v,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":o,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(y,{side:`bottom`,children:(0,z.jsx)(a,{id:`ogAuyr`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,z.jsxs)(h,{children:[c,l]}),t[7]=c,t[8]=u),u}function q(e){let t=(0,P.c)(9),{lastTs:n}=e,[r]=(0,F.useState)(J),i;t[0]!==n||t[1]!==r?(i=n?Y(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,z.jsx)(`span`,{className:`font-medium`,children:(0,z.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,z.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,z.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,z.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 J(){return Date.now()}function Y(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return p._({id:`nYeBmY`,values:{hours:n}})}function X(e){let t=(0,P.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,z.jsx)(E,{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,z.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 Z(e){let t=(0,P.c)(26),{data:n,status:i,error:o,reload:s,fetchBurstDiff:c,onExit:l,onNavigate:u,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=r(),h=n?.files?.[0]?.lastTs??null,g=n?.files?.length??0,_;t[0]===m?_=t[1]:(_=m({id:`kYL1lH`}),t[0]=m,t[1]=_);let v;t[2]!==l||t[3]!==p?(v=p?(0,z.jsx)(he,{onClick:l}):null,t[2]=l,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(X,{agent:n.agent}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,z.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,z.jsx)(a,{id:`F6pfE9`}):h===null?(0,z.jsx)(a,{id:`PMyJ9C`}):(0,z.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,z.jsxs)(z.Fragment,{children:[` · `,(0,z.jsx)(a,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,z.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=g,t[7]=h,t[8]=y):y=t[8];let b;t[9]!==v||t[10]!==y?(b=(0,z.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[v,y]}),t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==n||t[13]!==o||t[14]!==c||t[15]!==h||t[16]!==u||t[17]!==f||t[18]!==d||t[19]!==s||t[20]!==i?(x=(0,z.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:i===`loading`&&n===null?(0,z.jsx)(U,{}):i===`error`&&o?(0,z.jsx)(W,{error:o,onRetry:s}):n===null?(0,z.jsx)(G,{}):(0,z.jsxs)(z.Fragment,{children:[!n.sessionAlive&&h!==null?(0,z.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,z.jsx)(G,{}):n.files.map(e=>(0,z.jsx)(fe,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:u,onUndoLast:d,onUndoAll:f,fetchBurstDiff:c},e.docName))]})}),t[12]=n,t[13]=o,t[14]=c,t[15]=h,t[16]=u,t[17]=f,t[18]=d,t[19]=s,t[20]=i,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":_,children:[b,x]}),t[22]=_,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function ge(e){let t=(0,P.c)(28),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:i}=n,a=i===void 0?!0:i,{_:o}=r(),{docPanelAgentId:s,closeActivityPanel:c}=l(),{openDocumentTransition:u}=d(),{data:f,status:p,error:m,reload:h,fetchBurstDiff:g}=ae(s);if(s===null){let e;return t[2]!==c||t[3]!==a?(e=(0,z.jsx)(K,{onExit:c,showBackButton:a}),t[2]=c,t[3]=a,t[4]=e):e=t[4],e}let _;t[5]===u?_=t[6]:(_=e=>{u(e),H(e)},t[5]=u,t[6]=_);let v=_,y;t[7]!==o||t[8]!==f||t[9]!==s||t[10]!==h?(y=async e=>{try{await B({connectionId:s,docName:e,scope:`last`,agentName:f?.agent?.displayName}),h()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`EqrC_R`,values:{message:n}})),h()}},t[7]=o,t[8]=f,t[9]=s,t[10]=h,t[11]=y):y=t[11];let b=y,x;t[12]!==o||t[13]!==f||t[14]!==s||t[15]!==h?(x=async e=>{try{await B({connectionId:s,docName:e,scope:`file`,agentName:f?.agent?.displayName}),N.success(o({id:`pRc-Im`,values:{docName:e}})),h()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`7KeV5F`,values:{message:n}})),h()}},t[12]=o,t[13]=f,t[14]=s,t[15]=h,t[16]=x):x=t[16];let S=x,C;return t[17]!==c||t[18]!==f||t[19]!==m||t[20]!==g||t[21]!==v||t[22]!==S||t[23]!==b||t[24]!==h||t[25]!==a||t[26]!==p?(C=(0,z.jsx)(Z,{data:f,status:p,error:m,reload:h,fetchBurstDiff:g,onExit:c,onNavigate:v,onUndoLast:b,onUndoAll:S,showBackButton:a}),t[17]=c,t[18]=f,t[19]=m,t[20]=g,t[21]=v,t[22]=S,t[23]=b,t[24]=h,t[25]=a,t[26]=p,t[27]=C):C=t[27],C}export{ge as ActivityModeContent};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,r,t as i}from"./compiler-runtime-Cs91PcD2.js";var a=i(),o=n(),s=e(t());function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return(t=function(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}(e,`string`);return typeof t==`symbol`?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function f(e,t){return m(e)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||g(e,t)||v()}function p(e){return function(e){if(Array.isArray(e))return _(e)}(e)||h(e)||g(e)||function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function m(e){if(Array.isArray(e))return e}function h(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function g(e,t){if(e){if(typeof e==`string`)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0}}function _(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=g(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}var b=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function x(e,t){return e(t={exports:{}},t.exports),t.exports}var S=x((function(e){(function(){var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var a=typeof i;if(a===`string`||a===`number`)e.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&e.push(o)}}else if(a===`object`){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes(`[native code]`)){e.push(i.toString());continue}for(var s in i)t.call(i,s)&&i[s]&&e.push(s)}}}return e.join(` `)}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})),C={hunkClassName:``,lineClassName:``,gutterClassName:``,codeClassName:``,monotonous:!1,gutterType:`default`,viewType:`split`,widgets:{},hideGutter:!1,selectedChanges:[],generateAnchorID:function(){},generateLineClassName:function(){},renderGutter:function(e){var t=e.renderDefault;return(0,e.wrapInAnchor)(t())},codeEvents:{},gutterEvents:{}},w=(0,s.createContext)(C),T=w.Provider,E=function(){return(0,s.useContext)(w)},D=x((function(e,t){(function(t){function n(e){var t=e.slice(11),n=null,r=null;switch(t.indexOf(`"`)){case-1:n=(o=t.split(` `))[0].slice(2),r=o[1].slice(2);break;case 0:var i=t.indexOf(`"`,2);n=t.slice(3,i);var a=t.indexOf(`"`,i+1);r=a<0?t.slice(i+4):t.slice(a+3,-1);break;default:var o;n=(o=t.split(` `))[0].slice(2),r=o[1].slice(3,-1)}return{oldPath:n,newPath:r}}e.exports={parse:function(e){for(var t,r,i,a,o,s=[],c=2,l=e.split(`
|
|
5
|
+
`),u=l.length,d=0;d<u;){var f=l[d];if(f.indexOf(`diff --git`)===0){t={hunks:[],oldEndingNewLine:!0,newEndingNewLine:!0,oldPath:(o=n(f)).oldPath,newPath:o.newPath},s.push(t);var p,m=null;simiLoop:for(;p=l[++d];){var h=p.indexOf(` `),g=h>-1?p.slice(0,h):g;switch(g){case`diff`:d--;break simiLoop;case`deleted`:case`new`:var _=p.slice(h+1);_.indexOf(`file mode`)===0&&(t[g===`new`?`newMode`:`oldMode`]=_.slice(10));break;case`similarity`:t.similarity=parseInt(p.split(` `)[2],10);break;case`index`:var v=p.slice(h+1).split(` `),y=v[0].split(`..`);t.oldRevision=y[0],t.newRevision=y[1],v[1]&&(t.oldMode=t.newMode=v[1]);break;case`copy`:case`rename`:var b=p.slice(h+1);b.indexOf(`from`)===0?t.oldPath=b.slice(5):t.newPath=b.slice(3),m=g;break;case`---`:var x=p.slice(h+1),S=l[++d].slice(4);x===`/dev/null`?(S=S.slice(2),m=`add`):S===`/dev/null`?(x=x.slice(2),m=`delete`):(m=`modify`,x=x.slice(2),S=S.slice(2)),x&&(t.oldPath=x),S&&(t.newPath=S),c=5;break simiLoop}}t.type=m||`modify`}else if(f.indexOf(`Binary`)===0)t.isBinary=!0,t.type=f.indexOf(`/dev/null and`)>=0?`add`:f.indexOf(`and /dev/null`)>=0?`delete`:`modify`,c=2,t=null;else if(c===5)if(f.indexOf(`@@`)===0){var C=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(f);r={content:f,oldStart:C[1]-0,newStart:C[4]-0,oldLines:C[3]-0||1,newLines:C[6]-0||1,changes:[]},t.hunks.push(r),i=r.oldStart,a=r.newStart}else{var w=f.slice(0,1),T={content:f.slice(1)};switch(w){case`+`:T.type=`insert`,T.isInsert=!0,T.lineNumber=a,a++;break;case`-`:T.type=`delete`,T.isDelete=!0,T.lineNumber=i,i++;break;case` `:T.type=`normal`,T.isNormal=!0,T.oldLineNumber=i,T.newLineNumber=a,i++,a++;break;case`\\`:var E=r.changes[r.changes.length-1];E.isDelete||(t.newEndingNewLine=!1),E.isInsert||(t.oldEndingNewLine=!1)}T.type&&r.changes.push(T)}d++}return s}}})()}));function O(e){return e.type===`insert`}function k(e){return e.type===`delete`}function A(e){return e.type===`normal`}function j(e,t){var n=t.nearbySequences===`zip`?function(e){return f(e.reduce((function(e,t,n){var r=f(e,3),i=r[0],a=r[1],o=r[2];return a?O(t)&&o>=0?(i.splice(o+1,0,t),[i,t,o+2]):(i.push(t),[i,t,k(t)&&k(a)?o:n]):(i.push(t),[i,t,k(t)?n:-1])}),[[],null,-1]),1)[0]}(e.changes):e.changes;return l(l({},e),{},{isPlain:!1,changes:n})}function M(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=function(e){if(e.startsWith(`diff --git`))return e;var t=e.indexOf(`
|
|
6
|
+
`),n=e.indexOf(`
|
|
7
|
+
`,t+1),r=e.slice(0,t),i=e.slice(t+1,n),a=r.split(` `).slice(1,-3).join(` `),o=i.split(` `).slice(1,-3).join(` `);return[`diff --git a/${a} b/${o}`,`index 1111111..2222222 100644`,`--- a/${a}`,`+++ b/${o}`,e.slice(n+1)].join(`
|
|
8
|
+
`)}(e.trimStart());return D.parse(n).map((function(e){return function(e,t){var n=e.hunks.map((function(e){return j(e,t)}));return l(l({},e),{},{hunks:n})}(e,t)}))}function N(e){return e[0]}function P(e){return e[e.length-1]}function F(e){return[`${e}Start`,`${e}Lines`]}function I(e){return e===`old`?function(e){return O(e)?-1:A(e)?e.oldLineNumber:e.lineNumber}:function(e){return k(e)?-1:A(e)?e.newLineNumber:e.lineNumber}}function ee(e,t){return function(n,r){var i=n[e],a=i+n[t];return r>=i&&r<a}}function te(e,t){return function(n,r,i){var a=n[e]+n[t],o=r[e];return i>=a&&i<o}}function ne(e){var t=I(e),n=function(e){var t=f(F(e),2),n=ee(t[0],t[1]);return function(e,t){return e.find((function(e){return n(e,t)}))}}(e);return function(e,r){var i=n(e,r);if(i)return i.changes.find((function(e){return t(e)===r}))}}function re(e){var t=e===`old`?`new`:`old`,n=f(F(e),2),r=n[0],i=n[1],a=f(F(t),2),o=a[0],s=a[1],c=I(e),l=I(t),u=ee(r,i),d=te(r,i);return function(e,t){var n=N(e);if(t<n[r]){var a=n[r]-t;return n[o]-a}var f=P(e);if(f[r]+f[i]<=t){var p=t-f[r]-f[i];return f[o]+f[s]+p}for(var m=0;m<e.length;m++){var h=e[m],g=e[m+1];if(u(h,t)){var _=h.changes.findIndex((function(e){return c(e)===t})),v=h.changes[_];if(A(v))return l(v);var y=k(v)?_+1:_-1,b=h.changes[y];if(!b)return-1;var x=O(v)?`delete`:`insert`;return b.type===x?l(b):-1}if(d(h,g,t)){var S=t-h[r]-h[i];return h[o]+h[s]+S}}throw Error(`Unexpected line position ${t}`)}}var ie=function(){this.__data__=[],this.size=0},ae=function(e,t){return e===t||e!=e&&t!=t},oe=function(e,t){for(var n=e.length;n--;)if(ae(e[n][0],t))return n;return-1},L=Array.prototype.splice,R=function(e){var t=this.__data__,n=oe(t,e);return!(n<0)&&(n==t.length-1?t.pop():L.call(t,n,1),--this.size,!0)},se=function(e){var t=this.__data__,n=oe(t,e);return n<0?void 0:t[n][1]},ce=function(e){return oe(this.__data__,e)>-1},le=function(e,t){var n=this.__data__,r=oe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function z(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}z.prototype.clear=ie,z.prototype.delete=R,z.prototype.get=se,z.prototype.has=ce,z.prototype.set=le;var ue=z,de=function(){this.__data__=new ue,this.size=0},fe=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},pe=function(e){return this.__data__.get(e)},me=function(e){return this.__data__.has(e)},he=typeof b==`object`&&b&&b.Object===Object&&b,ge=typeof self==`object`&&self&&self.Object===Object&&self,B=he||ge||Function(`return this`)(),V=B.Symbol,_e=Object.prototype,ve=_e.hasOwnProperty,ye=_e.toString,H=V?V.toStringTag:void 0,be=function(e){var t=ve.call(e,H),n=e[H];try{e[H]=void 0;var r=!0}catch{}var i=ye.call(e);return r&&(t?e[H]=n:delete e[H]),i},xe=Object.prototype.toString,Se=function(e){return xe.call(e)},Ce=V?V.toStringTag:void 0,U=function(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Ce&&Ce in Object(e)?be(e):Se(e)},we=function(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)},Te=function(e){if(!we(e))return!1;var t=U(e);return t==`[object Function]`||t==`[object GeneratorFunction]`||t==`[object AsyncFunction]`||t==`[object Proxy]`},Ee=B[`__core-js_shared__`],De=function(){var e=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),Oe=function(e){return!!De&&De in e},ke=Function.prototype.toString,W=function(e){if(e!=null){try{return ke.call(e)}catch{}try{return e+``}catch{}}return``},Ae=/^\[object .+?Constructor\]$/,je=Function.prototype,Me=Object.prototype,Ne=je.toString,Pe=Me.hasOwnProperty,Fe=RegExp(`^`+Ne.call(Pe).replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Ie=function(e){return!(!we(e)||Oe(e))&&(Te(e)?Fe:Ae).test(W(e))},Le=function(e,t){return e?.[t]},G=function(e,t){var n=Le(e,t);return Ie(n)?n:void 0},Re=G(B,`Map`),ze=G(Object,`create`),Be=function(){this.__data__=ze?ze(null):{},this.size=0},Ve=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},He=Object.prototype.hasOwnProperty,Ue=function(e){var t=this.__data__;if(ze){var n=t[e];return n===`__lodash_hash_undefined__`?void 0:n}return He.call(t,e)?t[e]:void 0},We=Object.prototype.hasOwnProperty,Ge=function(e){var t=this.__data__;return ze?t[e]!==void 0:We.call(t,e)},Ke=function(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=ze&&t===void 0?`__lodash_hash_undefined__`:t,this};function K(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}K.prototype.clear=Be,K.prototype.delete=Ve,K.prototype.get=Ue,K.prototype.has=Ge,K.prototype.set=Ke;var qe=K,Je=function(){this.size=0,this.__data__={hash:new qe,map:new(Re||ue),string:new qe}},Ye=function(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null},Xe=function(e,t){var n=e.__data__;return Ye(t)?n[typeof t==`string`?`string`:`hash`]:n.map},Ze=function(e){var t=Xe(this,e).delete(e);return this.size-=+!!t,t},Qe=function(e){return Xe(this,e).get(e)},$e=function(e){return Xe(this,e).has(e)},et=function(e,t){var n=Xe(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function q(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}q.prototype.clear=Je,q.prototype.delete=Ze,q.prototype.get=Qe,q.prototype.has=$e,q.prototype.set=et;var tt=q,nt=function(e,t){var n=this.__data__;if(n instanceof ue){var r=n.__data__;if(!Re||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new tt(r)}return n.set(e,t),this.size=n.size,this};function J(e){this.size=(this.__data__=new ue(e)).size}J.prototype.clear=de,J.prototype.delete=fe,J.prototype.get=pe,J.prototype.has=me,J.prototype.set=nt;var rt=J,it=function(e){return this.__data__.set(e,`__lodash_hash_undefined__`),this},at=function(e){return this.__data__.has(e)};function ot(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new tt;++t<n;)this.add(e[t])}ot.prototype.add=ot.prototype.push=it,ot.prototype.has=at;var st=ot,ct=function(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},lt=function(e,t){return e.has(t)},ut=function(e,t,n,r,i,a){var o=1&n,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=2&n?new st:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!ct(t,(function(e,t){if(!lt(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)}))){f=!1;break}}else if(m!==h&&!i(m,h,n,r,a)){f=!1;break}}return a.delete(e),a.delete(t),f},dt=B.Uint8Array,ft=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n},pt=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},mt=V?V.prototype:void 0,ht=mt?mt.valueOf:void 0,gt=function(e,t,n,r,i,a,o){switch(n){case`[object DataView]`:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case`[object ArrayBuffer]`:return!(e.byteLength!=t.byteLength||!a(new dt(e),new dt(t)));case`[object Boolean]`:case`[object Date]`:case`[object Number]`:return ae(+e,+t);case`[object Error]`:return e.name==t.name&&e.message==t.message;case`[object RegExp]`:case`[object String]`:return e==t+``;case`[object Map]`:var s=ft;case`[object Set]`:var c=1&r;if(s||=pt,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var u=ut(s(e),s(t),r,i,a,o);return o.delete(e),u;case`[object Symbol]`:if(ht)return ht.call(e)==ht.call(t)}return!1},_t=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},Y=Array.isArray,vt=function(e,t,n){var r=t(e);return Y(e)?r:_t(r,n(e))},yt=function(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a},bt=function(){return[]},xt=Object.prototype.propertyIsEnumerable,St=Object.getOwnPropertySymbols,Ct=St?function(e){return e==null?[]:(e=Object(e),yt(St(e),(function(t){return xt.call(e,t)})))}:bt,wt=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},X=function(e){return typeof e==`object`&&!!e},Tt=function(e){return X(e)&&U(e)==`[object Arguments]`},Et=Object.prototype,Dt=Et.hasOwnProperty,Ot=Et.propertyIsEnumerable,kt=Tt(function(){return arguments}())?Tt:function(e){return X(e)&&Dt.call(e,`callee`)&&!Ot.call(e,`callee`)},At=function(){return!1},jt=x((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,i=r&&r.exports===n?B.Buffer:void 0;e.exports=(i?i.isBuffer:void 0)||At})),Mt=/^(?:0|[1-9]\d*)$/,Nt=function(e,t){var n=typeof e;return!!(t??=9007199254740991)&&(n==`number`||n!=`symbol`&&Mt.test(e))&&e>-1&&e%1==0&&e<t},Pt=function(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991},Z={};Z[`[object Float32Array]`]=Z[`[object Float64Array]`]=Z[`[object Int8Array]`]=Z[`[object Int16Array]`]=Z[`[object Int32Array]`]=Z[`[object Uint8Array]`]=Z[`[object Uint8ClampedArray]`]=Z[`[object Uint16Array]`]=Z[`[object Uint32Array]`]=!0,Z[`[object Arguments]`]=Z[`[object Array]`]=Z[`[object ArrayBuffer]`]=Z[`[object Boolean]`]=Z[`[object DataView]`]=Z[`[object Date]`]=Z[`[object Error]`]=Z[`[object Function]`]=Z[`[object Map]`]=Z[`[object Number]`]=Z[`[object Object]`]=Z[`[object RegExp]`]=Z[`[object Set]`]=Z[`[object String]`]=Z[`[object WeakMap]`]=!1;var Ft=function(e){return X(e)&&Pt(e.length)&&!!Z[U(e)]},It=function(e){return function(t){return e(t)}},Lt=x((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,i=r&&r.exports===n&&he.process;e.exports=function(){try{return r&&r.require&&r.require(`util`).types||i&&i.binding&&i.binding(`util`)}catch{}}()})),Rt=Lt&&Lt.isTypedArray,zt=Rt?It(Rt):Ft,Bt=Object.prototype.hasOwnProperty,Vt=function(e,t){var n=Y(e),r=!n&&kt(e),i=!n&&!r&&jt(e),a=!n&&!r&&!i&&zt(e),o=n||r||i||a,s=o?wt(e.length,String):[],c=s.length;for(var l in e)!t&&!Bt.call(e,l)||o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||Nt(l,c))||s.push(l);return s},Ht=Object.prototype,Ut=function(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Ht)},Wt=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),Gt=Object.prototype.hasOwnProperty,Kt=function(e){if(!Ut(e))return Wt(e);var t=[];for(var n in Object(e))Gt.call(e,n)&&n!=`constructor`&&t.push(n);return t},qt=function(e){return e!=null&&Pt(e.length)&&!Te(e)},Jt=function(e){return qt(e)?Vt(e):Kt(e)},Yt=function(e){return vt(e,Jt,Ct)},Xt=Object.prototype.hasOwnProperty,Zt=function(e,t,n,r,i,a){var o=1&n,s=Yt(e),c=s.length;if(c!=Yt(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Xt.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){var h=e[u=s[l]],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v==y||!(`constructor`in e)||!(`constructor`in t)||typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y||(p=!1)}return a.delete(e),a.delete(t),p},Qt=G(B,`DataView`),$t=G(B,`Promise`),en=G(B,`Set`),tn=G(B,`WeakMap`),nn=W(Qt),rn=W(Re),an=W($t),on=W(en),sn=W(tn),Q=U;(Qt&&Q(new Qt(new ArrayBuffer(1)))!=`[object DataView]`||Re&&Q(new Re)!=`[object Map]`||$t&&Q($t.resolve())!=`[object Promise]`||en&&Q(new en)!=`[object Set]`||tn&&Q(new tn)!=`[object WeakMap]`)&&(Q=function(e){var t=U(e),n=t==`[object Object]`?e.constructor:void 0,r=n?W(n):``;if(r)switch(r){case nn:return`[object DataView]`;case rn:return`[object Map]`;case an:return`[object Promise]`;case on:return`[object Set]`;case sn:return`[object WeakMap]`}return t});var cn=Q,ln=`[object Object]`,un=Object.prototype.hasOwnProperty,dn=function(e,t,n,r,i,a){var o=Y(e),s=Y(t),c=o?`[object Array]`:cn(e),l=s?`[object Array]`:cn(t),u=(c=c==`[object Arguments]`?ln:c)==ln,d=(l=l==`[object Arguments]`?ln:l)==ln,f=c==l;if(f&&jt(e)){if(!jt(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new rt,o||zt(e)?ut(e,t,n,r,i,a):gt(e,t,c,n,r,i,a);if(!(1&n)){var p=u&&un.call(e,`__wrapped__`),m=d&&un.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new rt,i(h,g,n,r,a)}}return!!f&&(a||=new rt,Zt(e,t,n,r,i,a))},fn=function e(t,n,r,i,a){return t===n||(t==null||n==null||!X(t)&&!X(n)?t!=t&&n!=n:dn(t,n,r,i,e,a))},pn=function(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){var c=(s=n[i])[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new rt;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?fn(u,l,3,r,d):f))return!1}}return!0},mn=function(e){return e==e&&!we(e)},hn=function(e){for(var t=Jt(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,mn(i)]}return t},gn=function(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}},_n=function(e){var t=hn(e);return t.length==1&&t[0][2]?gn(t[0][0],t[0][1]):function(n){return n===e||pn(n,e,t)}},vn=function(e){return typeof e==`symbol`||X(e)&&U(e)==`[object Symbol]`},yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bn=/^\w*$/,xn=function(e,t){if(Y(e))return!1;var n=typeof e;return!(n!=`number`&&n!=`symbol`&&n!=`boolean`&&e!=null&&!vn(e))||bn.test(e)||!yn.test(e)||t!=null&&e in Object(t)};function Sn(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(`Expected a function`);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Sn.Cache||tt),n}Sn.Cache=tt;var Cn=Sn,wn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tn=/\\(\\)?/g,En=function(e){var t=Cn(e,(function(e){return n.size===500&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(wn,(function(e,n,r,i){t.push(r?i.replace(Tn,`$1`):n||e)})),t})),Dn=function(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},On=V?V.prototype:void 0,kn=On?On.toString:void 0,An=function e(t){if(typeof t==`string`)return t;if(Y(t))return Dn(t,e)+``;if(vn(t))return kn?kn.call(t):``;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n},jn=function(e){return e==null?``:An(e)},Mn=function(e,t){return Y(e)?e:xn(e,t)?[e]:En(jn(e))},Nn=function(e){if(typeof e==`string`||vn(e))return e;var t=e+``;return t==`0`&&1/e==-1/0?`-0`:t},Pn=function(e,t){for(var n=0,r=(t=Mn(t,e)).length;e!=null&&n<r;)e=e[Nn(t[n++])];return n&&n==r?e:void 0},Fn=function(e,t,n){var r=e==null?void 0:Pn(e,t);return r===void 0?n:r},In=function(e,t){return e!=null&&t in Object(e)},Ln=function(e,t,n){for(var r=-1,i=(t=Mn(t,e)).length,a=!1;++r<i;){var o=Nn(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:!!(i=e==null?0:e.length)&&Pt(i)&&Nt(o,i)&&(Y(e)||kt(e))},Rn=function(e,t){return e!=null&&Ln(e,t,In)},zn=function(e,t){return xn(e)&&mn(t)?gn(Nn(e),t):function(n){var r=Fn(n,e);return r===void 0&&r===t?Rn(n,e):fn(t,r,3)}},Bn=function(e){return e},Vn=function(e){return function(t){return t?.[e]}},Hn=function(e){return function(t){return Pn(t,e)}},Un=function(e){return xn(e)?Vn(Nn(e)):Hn(e)},Wn=function(e){return typeof e==`function`?e:e==null?Bn:typeof e==`object`?Y(e)?zn(e[0],e[1]):_n(e):Un(e)};function $(e){if(!e)throw Error(`change is not provided`);return A(e)?`N${e.oldLineNumber}`:`${O(e)?`I`:`D`}${e.lineNumber}`}re(`old`);var Gn=I(`old`),Kn=I(`new`);ne(`old`),ne(`new`),re(`new`),re(`old`);var qn=function(){try{var e=G(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Jn=function(e,t,n){t==`__proto__`&&qn?qn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Yn=function(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}(),Xn=function(e,t){return e&&Yn(e,t,Jt)},Zn=function(e,t){var n={};return t=Wn(t),Xn(e,(function(e,r,i){Jn(n,r,t(e,r,i))})),n},Qn=[`changeKey`,`text`,`tokens`,`renderToken`],$n=function e(t,n){var r=t.type,i=t.value,a=t.markType,s=t.properties,c=t.className,l=t.children,u=function(t){return(0,o.jsx)(`span`,{className:t,children:i||l&&l.map(e)},n)};switch(r){case`text`:return i;case`mark`:return u(`diff-code-mark diff-code-mark-${a}`);case`edit`:return u(`diff-code-edit`);default:var d=s&&s.className;return u(S(c||d))}};function er(e){if(!Array.isArray(e))return!0;if(e.length>1)return!1;if(e.length===1){var t=f(e,1)[0];return t.type===`text`&&!t.value}return!0}function tr(e){var t=e.changeKey,n=e.text,r=e.tokens,i=e.renderToken,a=d(e,Qn),s=i?function(e,t){return i(e,$n,t)}:$n;return(0,o.jsx)(`td`,l(l({},a),{},{"data-change-key":t,children:r?er(r)?` `:r.map(s):n||` `}))}var nr=(0,s.memo)(tr);function rr(e,t){return function(){var n=t===`old`?Gn(e):Kn(e);return n===-1?void 0:n}}function ir(e,t){return function(n){return e&&n?(0,o.jsx)(`a`,{href:t?`#`+t:void 0,children:n}):n}}function ar(e,t){return t?function(n){e(),t(n)}:e}function or(e,t,n,r){return(0,s.useMemo)((function(){var i=Zn(e,(function(e){return function(n){return e&&e(t,n)}}));return i.onMouseEnter=ar(n,i.onMouseEnter),i.onMouseLeave=ar(r,i.onMouseLeave),i}),[e,n,r,t])}function sr(e,t,n,r,i,a,s,c,u){var d={change:t,side:r,inHoverState:c,renderDefault:rr(t,r),wrapInAnchor:ir(i,a)};return(0,o.jsx)(`td`,l(l({className:e},s),{},{"data-change-key":n,children:u(d)}))}function cr(e){var t,n,r,i=e.change,a=e.selected,c=e.tokens,u=e.className,d=e.generateLineClassName,p=e.gutterClassName,m=e.codeClassName,h=e.gutterEvents,g=e.codeEvents,_=e.hideGutter,v=e.gutterAnchor,y=e.generateAnchorID,b=e.renderToken,x=e.renderGutter,C=i.type,w=i.content,T=$(i),E=f((t=f((0,s.useState)(!1),2),n=t[0],r=t[1],[n,(0,s.useCallback)((function(){return r(!0)}),[]),(0,s.useCallback)((function(){return r(!1)}),[])]),3),D=E[0],O=E[1],k=E[2],A=(0,s.useMemo)((function(){return{change:i}}),[i]),j=or(h,A,O,k),M=or(g,A,O,k),N=y(i),P=d({changes:[i],defaultGenerate:function(){return u}}),F=S(`diff-gutter`,`diff-gutter-${C}`,p,{"diff-gutter-selected":a}),I=S(`diff-code`,`diff-code-${C}`,m,{"diff-code-selected":a});return(0,o.jsxs)(`tr`,{id:N,className:S(`diff-line`,P),children:[!_&&sr(F,i,T,`old`,v,N,j,D,x),!_&&sr(F,i,T,`new`,v,N,j,D,x),(0,o.jsx)(nr,l({className:I,changeKey:T,text:w,tokens:c,renderToken:b},M))]})}var lr=(0,s.memo)(cr);function ur(e){var t=e.hideGutter,n=e.element;return(0,o.jsx)(`tr`,{className:`diff-widget`,children:(0,o.jsx)(`td`,{colSpan:t?1:3,className:`diff-widget-content`,children:n})})}var dr=[`hideGutter`,`selectedChanges`,`tokens`,`lineClassName`],fr=[`hunk`,`widgets`,`className`];function pr(e){var t=e.hunk,n=e.widgets,r=e.className,i=d(e,fr),a=function(e,t){return e.reduce((function(e,n){var r=$(n);e.push([`change`,r,n]);var i=t[r];return i&&e.push([`widget`,r,i]),e}),[])}(t.changes,n);return(0,o.jsx)(`tbody`,{className:S(`diff-hunk`,r),children:a.map((function(e){return function(e,t){var n=f(e,3),r=n[0],i=n[1],a=n[2],s=t.hideGutter,c=t.selectedChanges,u=t.tokens,p=t.lineClassName,m=d(t,dr);if(r===`change`){var h=k(a)?`old`:`new`,g=k(a)?Gn(a):Kn(a),_=u?u[h][g-1]:null;return(0,o.jsx)(lr,l({className:p,change:a,hideGutter:s,selected:c.includes(i),tokens:_},m),`change${i}`)}return r===`widget`?(0,o.jsx)(ur,{hideGutter:s,element:a},`widget${i}`):null}(e,i)}))})}var mr=0;function hr(e,t,n,r){var i=(0,s.useCallback)((function(){return t(e)}),[e,t]),a=(0,s.useCallback)((function(){return t(``)}),[t]);return(0,s.useMemo)((function(){var t=Zn(r,(function(t){return function(r){return t&&t({side:e,change:n},r)}}));return t.onMouseEnter=ar(i,t.onMouseEnter),t.onMouseLeave=ar(a,t.onMouseLeave),t}),[n,r,i,e,a])}function gr(e){var t=e.change,n=e.side,r=e.selected,i=e.tokens,a=e.gutterClassName,s=e.codeClassName,c=e.gutterEvents,d=e.codeEvents,f=e.anchorID,p=e.gutterAnchor,m=e.gutterAnchorTarget,h=e.hideGutter,g=e.hover,_=e.renderToken,v=e.renderGutter;if(!t){var y=S(`diff-gutter`,`diff-gutter-omit`,a),b=S(`diff-code`,`diff-code-omit`,s);return[!h&&(0,o.jsx)(`td`,{className:y},`gutter`),(0,o.jsx)(`td`,{className:b},`code`)]}var x=t.type,C=t.content,w=$(t),T=n===mr?`old`:`new`,E=l({id:f||void 0,className:S(`diff-gutter`,`diff-gutter-${x}`,u({"diff-gutter-selected":r},`diff-line-hover-`+T,g),a),children:v({change:t,side:T,inHoverState:g,renderDefault:rr(t,T),wrapInAnchor:ir(p,m)})},c),D=S(`diff-code`,`diff-code-${x}`,u({"diff-code-selected":r},`diff-line-hover-`+T,g),s);return[!h&&(0,o.jsx)(`td`,l(l({},E),{},{"data-change-key":w}),`gutter`),(0,o.jsx)(nr,l({className:D,changeKey:w,text:C,tokens:i,renderToken:_},d),`code`)]}function _r(e){var t=e.className,n=e.oldChange,r=e.newChange,i=e.oldSelected,a=e.newSelected,c=e.oldTokens,u=e.newTokens,d=e.monotonous,p=e.gutterClassName,m=e.codeClassName,h=e.gutterEvents,g=e.codeEvents,_=e.hideGutter,v=e.generateAnchorID,y=e.generateLineClassName,b=e.gutterAnchor,x=e.renderToken,C=e.renderGutter,w=f((0,s.useState)(``),2),T=w[0],E=w[1],D=hr(`old`,E,n,h),O=hr(`new`,E,r,h),k=hr(`old`,E,n,g),A=hr(`new`,E,r,g),j=n&&v(n),M=r&&v(r),N=y({changes:[n,r],defaultGenerate:function(){return t}}),P={monotonous:d,hideGutter:_,gutterClassName:p,codeClassName:m,gutterEvents:h,codeEvents:g,renderToken:x,renderGutter:C},F=l(l({},P),{},{change:n,side:mr,selected:i,tokens:c,gutterEvents:D,codeEvents:k,anchorID:j,gutterAnchor:b,gutterAnchorTarget:j,hover:T===`old`}),I=l(l({},P),{},{change:r,side:1,selected:a,tokens:u,gutterEvents:O,codeEvents:A,anchorID:n===r?null:M,gutterAnchor:b,gutterAnchorTarget:n===r?j:M,hover:T===`new`});return d?(0,o.jsx)(`tr`,{className:S(`diff-line`,N),children:gr(n?F:I)}):(0,o.jsxs)(`tr`,{className:S(`diff-line`,function(e,t){return e&&!t?`diff-line-old-only`:!e&&t?`diff-line-new-only`:e===t?`diff-line-normal`:`diff-line-compare`}(n,r),N),children:[gr(F),gr(I)]})}var vr=(0,s.memo)(_r);function yr(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?(0,o.jsx)(`tr`,{className:`diff-widget`,children:(0,o.jsx)(`td`,{colSpan:t?1:2,className:`diff-widget-content`,children:n||r})}):n===r?(0,o.jsx)(`tr`,{className:`diff-widget`,children:(0,o.jsx)(`td`,{colSpan:t?2:4,className:`diff-widget-content`,children:n})}):(0,o.jsxs)(`tr`,{className:`diff-widget`,children:[(0,o.jsx)(`td`,{colSpan:t?1:2,className:`diff-widget-content`,children:n}),(0,o.jsx)(`td`,{colSpan:t?1:2,className:`diff-widget-content`,children:r})]})}var br=[`selectedChanges`,`monotonous`,`hideGutter`,`tokens`,`lineClassName`],xr=[`hunk`,`widgets`,`className`];function Sr(e,t){return(e?$(e):`00`)+(t?$(t):`00`)}function Cr(e){var t=e.hunk,n=e.widgets,r=e.className,i=d(e,xr),a=function(e,t){for(var n=function(e){return e&&t[$(e)]||null},r=[],i=0;i<e.length;i++){var a=e[i];if(A(a))r.push([`change`,Sr(a,a),a,a]);else if(k(a)){var o=e[i+1];o&&O(o)?(i+=1,r.push([`change`,Sr(a,o),a,o])):r.push([`change`,Sr(a,null),a,null])}else r.push([`change`,Sr(null,a),null,a]);var s=r[r.length-1],c=n(s[2]),l=n(s[3]);if(c||l){var u=s[1];r.push([`widget`,u,c,l])}}return r}(t.changes,n);return(0,o.jsx)(`tbody`,{className:S(`diff-hunk`,r),children:a.map((function(e){return function(e,t){var n=f(e,4),r=n[0],i=n[1],a=n[2],s=n[3],c=t.selectedChanges,u=t.monotonous,p=t.hideGutter,m=t.tokens,h=t.lineClassName,g=d(t,br);return r===`change`?(0,o.jsx)(vr,l({className:h,oldChange:a,newChange:s,monotonous:u,hideGutter:p,oldSelected:!!a&&c.includes($(a)),newSelected:!!s&&c.includes($(s)),oldTokens:a&&m?m.old[Gn(a)-1]:null,newTokens:s&&m?m.new[Kn(s)-1]:null},g),`change${i}`):r===`widget`?(0,o.jsx)(yr,{monotonous:u,hideGutter:p,oldElement:a,newElement:s},`widget${i}`):null}(e,i)}))})}var wr=[`gutterType`,`hunkClassName`];function Tr(e){var t=e.hunk,n=E(),r=n.gutterType,i=n.hunkClassName,a=d(n,wr),s=r===`none`,c=r===`anchor`;return(0,o.jsx)(a.viewType===`unified`?pr:Cr,l(l({},a),{},{hunk:t,hideGutter:s,gutterAnchor:c,className:i}))}function Er(){}function Dr(e,t){var n=t?`auto`:`none`;e instanceof HTMLElement&&e.style.userSelect!==n&&(e.style.userSelect=n)}function Or(e){return e.map((function(e){return(0,o.jsx)(Tr,{hunk:e},function(e){return`-${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines}`}(e))}))}function kr(e){var t=e.diffType,n=e.hunks,r=e.optimizeSelection,i=e.className,a=e.hunkClassName,c=a===void 0?C.hunkClassName:a,l=e.lineClassName,u=l===void 0?C.lineClassName:l,d=e.generateLineClassName,f=d===void 0?C.generateLineClassName:d,m=e.gutterClassName,h=m===void 0?C.gutterClassName:m,g=e.codeClassName,_=g===void 0?C.codeClassName:g,v=e.gutterType,b=v===void 0?C.gutterType:v,x=e.viewType,w=x===void 0?C.viewType:x,E=e.gutterEvents,D=E===void 0?C.gutterEvents:E,O=e.codeEvents,k=O===void 0?C.codeEvents:O,A=e.generateAnchorID,j=A===void 0?C.generateAnchorID:A,M=e.selectedChanges,N=M===void 0?C.selectedChanges:M,P=e.widgets,F=P===void 0?C.widgets:P,I=e.renderGutter,ee=I===void 0?C.renderGutter:I,te=e.tokens,ne=e.renderToken,re=e.children,ie=re===void 0?Or:re,ae=(0,s.useRef)(null),oe=(0,s.useCallback)((function(e){var t=e.target;if(e.button===0){var n=function(e,t){for(var n=e;n&&n!==document.documentElement&&!n.classList.contains(t);)n=n.parentElement;return n===document.documentElement?null:n}(t,`diff-code`);if(n&&n.parentElement){var r=window.getSelection();r&&r.removeAllRanges();var i=p(n.parentElement.children).indexOf(n);if(i===1||i===3){var a,o=y(ae.current?ae.current.querySelectorAll(`.diff-line`):[]);try{for(o.s();!(a=o.n()).done;){var s=a.value.children;Dr(s[1],i===1),Dr(s[3],i===3)}}catch(e){o.e(e)}finally{o.f()}}}}}),[]),L=b===`none`,R=t===`add`||t===`delete`,se=w===`split`&&!R&&r?oe:Er,ce=(0,s.useMemo)((function(){return(0,o.jsxs)(`colgroup`,w===`unified`?{children:[!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{})]}:R?{children:[!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{})]}:{children:[!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{}),!L&&(0,o.jsx)(`col`,{className:`diff-gutter-col`}),(0,o.jsx)(`col`,{})]})}),[w,R,L]);return(0,o.jsx)(T,{value:(0,s.useMemo)((function(){return{hunkClassName:c,lineClassName:u,generateLineClassName:f,gutterClassName:h,codeClassName:_,monotonous:R,hideGutter:L,viewType:w,gutterType:b,codeEvents:k,gutterEvents:D,generateAnchorID:j,selectedChanges:N,widgets:F,renderGutter:ee,tokens:te,renderToken:ne}}),[_,k,j,h,D,b,L,c,u,f,R,ee,ne,N,te,w,F]),children:(0,o.jsxs)(`table`,{ref:ae,className:S(`diff`,`diff-${w}`,i),onMouseDown:se,children:[ce,ie(n)]})})}var Ar=(0,s.memo)(kr);(function(e,t){return function(n,r){if(n==null)return n;if(!qt(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&!1!==r(o[a],a,o););return n}})(Xn),V&&V.isConcatSpreadable;var jr=x((function(e){var t=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32};t.Diff=function(e,t){return[e,t]},t.prototype.diff_main=function(e,n,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+1e3*this.Diff_Timeout);var a=i;if(e==null||n==null)throw Error(`Null input. (diff_main)`);if(e==n)return e?[new t.Diff(0,e)]:[];r===void 0&&(r=!0);var o=r,s=this.diff_commonPrefix(e,n),c=e.substring(0,s);e=e.substring(s),n=n.substring(s),s=this.diff_commonSuffix(e,n);var l=e.substring(e.length-s);e=e.substring(0,e.length-s),n=n.substring(0,n.length-s);var u=this.diff_compute_(e,n,o,a);return c&&u.unshift(new t.Diff(0,c)),l&&u.push(new t.Diff(0,l)),this.diff_cleanupMerge(u),u},t.prototype.diff_compute_=function(e,n,r,i){var a;if(!e)return[new t.Diff(1,n)];if(!n)return[new t.Diff(-1,e)];var o=e.length>n.length?e:n,s=e.length>n.length?n:e,c=o.indexOf(s);if(c!=-1)return a=[new t.Diff(1,o.substring(0,c)),new t.Diff(0,s),new t.Diff(1,o.substring(c+s.length))],e.length>n.length&&(a[0][0]=a[2][0]=-1),a;if(s.length==1)return[new t.Diff(-1,e),new t.Diff(1,n)];var l=this.diff_halfMatch_(e,n);if(l){var u=l[0],d=l[1],f=l[2],p=l[3],m=l[4],h=this.diff_main(u,f,r,i),g=this.diff_main(d,p,r,i);return h.concat([new t.Diff(0,m)],g)}return r&&e.length>100&&n.length>100?this.diff_lineMode_(e,n,i):this.diff_bisect_(e,n,i)},t.prototype.diff_lineMode_=function(e,n,r){var i=this.diff_linesToChars_(e,n);e=i.chars1,n=i.chars2;var a=i.lineArray,o=this.diff_main(e,n,!1,r);this.diff_charsToLines_(o,a),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,``));for(var s=0,c=0,l=0,u=``,d=``;s<o.length;){switch(o[s][0]){case 1:l++,d+=o[s][1];break;case-1:c++,u+=o[s][1];break;case 0:if(c>=1&&l>=1){o.splice(s-c-l,c+l),s=s-c-l;for(var f=this.diff_main(u,d,!1,r),p=f.length-1;p>=0;p--)o.splice(s,0,f[p]);s+=f.length}l=0,c=0,u=``,d=``}s++}return o.pop(),o},t.prototype.diff_bisect_=function(e,n,r){for(var i=e.length,a=n.length,o=Math.ceil((i+a)/2),s=o,c=2*o,l=Array(c),u=Array(c),d=0;d<c;d++)l[d]=-1,u[d]=-1;l[s+1]=0,u[s+1]=0;for(var f=i-a,p=f%2!=0,m=0,h=0,g=0,_=0,v=0;v<o&&!(new Date().getTime()>r);v++){for(var y=-v+m;y<=v-h;y+=2){for(var b=s+y,x=(E=y==-v||y!=v&&l[b-1]<l[b+1]?l[b+1]:l[b-1]+1)-y;E<i&&x<a&&e.charAt(E)==n.charAt(x);)E++,x++;if(l[b]=E,E>i)h+=2;else if(x>a)m+=2;else if(p&&(w=s+f-y)>=0&&w<c&&u[w]!=-1&&E>=(C=i-u[w]))return this.diff_bisectSplit_(e,n,E,x,r)}for(var S=-v+g;S<=v-_;S+=2){for(var C,w=s+S,T=(C=S==-v||S!=v&&u[w-1]<u[w+1]?u[w+1]:u[w-1]+1)-S;C<i&&T<a&&e.charAt(i-C-1)==n.charAt(a-T-1);)C++,T++;if(u[w]=C,C>i)_+=2;else if(T>a)g+=2;else if(!p&&(b=s+f-S)>=0&&b<c&&l[b]!=-1){var E;if(x=s+(E=l[b])-b,E>=(C=i-C))return this.diff_bisectSplit_(e,n,E,x,r)}}}return[new t.Diff(-1,e),new t.Diff(1,n)]},t.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},t.prototype.diff_linesToChars_=function(e,t){var n=[],r={};function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){(o=e.indexOf(`
|
|
9
|
+
`,i))==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}n[0]=``;var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},t.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},t.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i},t.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i},t.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,c!=0&&e.substring(i-o)!=t.substring(0,o)||(a=o,o++)}},t.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||2*r.length<n.length)return null;var i=this;function a(e,t,n){for(var r,a,o,s,c=e.substring(n,n+Math.floor(e.length/4)),l=-1,u=``;(l=t.indexOf(c,l+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(l)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,l));u.length<f+d&&(u=t.substring(l-f,l)+t.substring(l,l+d),r=e.substring(0,n-f),a=e.substring(n+d),o=t.substring(0,l-f),s=t.substring(l+d))}return 2*u.length>=e.length?[r,a,o,s,u]:null}var o,s,c,l,u,d=a(n,r,Math.ceil(n.length/4)),f=a(n,r,Math.ceil(n.length/2));return d||f?(o=f?d&&d[4].length>f[4].length?d:f:d,e.length>t.length?(s=o[0],c=o[1],l=o[2],u=o[3]):(l=o[0],u=o[1],s=o[2],c=o[3]),[s,c,l,u,o[4]]):null},t.prototype.diff_cleanupSemantic=function(e){for(var n=!1,r=[],i=0,a=null,o=0,s=0,c=0,l=0,u=0;o<e.length;)e[o][0]==0?(r[i++]=o,s=l,c=u,l=0,u=0,a=e[o][1]):(e[o][0]==1?l+=e[o][1].length:u+=e[o][1].length,a&&a.length<=Math.max(s,c)&&a.length<=Math.max(l,u)&&(e.splice(r[i-1],0,new t.Diff(-1,a)),e[r[i-1]+1][0]=1,i--,o=--i>0?r[i-1]:-1,s=0,c=0,l=0,u=0,a=null,n=!0)),o++;for(n&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),o=1;o<e.length;){if(e[o-1][0]==-1&&e[o][0]==1){var d=e[o-1][1],f=e[o][1],p=this.diff_commonOverlap_(d,f),m=this.diff_commonOverlap_(f,d);p>=m?(p>=d.length/2||p>=f.length/2)&&(e.splice(o,0,new t.Diff(0,f.substring(0,p))),e[o-1][1]=d.substring(0,d.length-p),e[o+1][1]=f.substring(p),o++):(m>=d.length/2||m>=f.length/2)&&(e.splice(o,0,new t.Diff(0,d.substring(0,m))),e[o-1][0]=1,e[o-1][1]=f.substring(0,f.length-m),e[o+1][0]=-1,e[o+1][1]=d.substring(m),o++),o++}o++}},t.prototype.diff_cleanupSemanticLossless=function(e){function n(e,n){if(!e||!n)return 6;var r=e.charAt(e.length-1),i=n.charAt(0),a=r.match(t.nonAlphaNumericRegex_),o=i.match(t.nonAlphaNumericRegex_),s=a&&r.match(t.whitespaceRegex_),c=o&&i.match(t.whitespaceRegex_),l=s&&r.match(t.linebreakRegex_),u=c&&i.match(t.linebreakRegex_),d=l&&e.match(t.blanklineEndRegex_),f=u&&n.match(t.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==0&&e[r+1][0]==0){var i=e[r-1][1],a=e[r][1],o=e[r+1][1],s=this.diff_commonSuffix(i,a);if(s){var c=a.substring(a.length-s);i=i.substring(0,i.length-s),a=c+a.substring(0,a.length-s),o=c+o}for(var l=i,u=a,d=o,f=n(i,a)+n(a,o);a.charAt(0)===o.charAt(0);){i+=a.charAt(0),a=a.substring(1)+o.charAt(0),o=o.substring(1);var p=n(i,a)+n(a,o);p>=f&&(f=p,l=i,u=a,d=o)}e[r-1][1]!=l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=u,d?e[r+1][1]=d:(e.splice(r+1,1),r--))}r++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(e){for(var n=!1,r=[],i=0,a=null,o=0,s=!1,c=!1,l=!1,u=!1;o<e.length;)e[o][0]==0?(e[o][1].length<this.Diff_EditCost&&(l||u)?(r[i++]=o,s=l,c=u,a=e[o][1]):(i=0,a=null),l=u=!1):(e[o][0]==-1?u=!0:l=!0,a&&(s&&c&&l&&u||a.length<this.Diff_EditCost/2&&s+c+l+u==3)&&(e.splice(r[i-1],0,new t.Diff(-1,a)),e[r[i-1]+1][0]=1,i--,a=null,s&&c?(l=u=!0,i=0):(o=--i>0?r[i-1]:-1,l=u=!1),n=!0)),o++;n&&this.diff_cleanupMerge(e)},t.prototype.diff_cleanupMerge=function(e){e.push(new t.Diff(0,``));for(var n,r=0,i=0,a=0,o=``,s=``;r<e.length;)switch(e[r][0]){case 1:a++,s+=e[r][1],r++;break;case-1:i++,o+=e[r][1],r++;break;case 0:i+a>1?(i!==0&&a!==0&&((n=this.diff_commonPrefix(s,o))!==0&&(r-i-a>0&&e[r-i-a-1][0]==0?e[r-i-a-1][1]+=s.substring(0,n):(e.splice(0,0,new t.Diff(0,s.substring(0,n))),r++),s=s.substring(n),o=o.substring(n)),(n=this.diff_commonSuffix(s,o))!==0&&(e[r][1]=s.substring(s.length-n)+e[r][1],s=s.substring(0,s.length-n),o=o.substring(0,o.length-n))),r-=i+a,e.splice(r,i+a),o.length&&(e.splice(r,0,new t.Diff(-1,o)),r++),s.length&&(e.splice(r,0,new t.Diff(1,s)),r++),r++):r!==0&&e[r-1][0]==0?(e[r-1][1]+=e[r][1],e.splice(r,1)):r++,a=0,i=0,o=``,s=``}e[e.length-1][1]===``&&e.pop();var c=!1;for(r=1;r<e.length-1;)e[r-1][0]==0&&e[r+1][0]==0&&(e[r][1].substring(e[r][1].length-e[r-1][1].length)==e[r-1][1]?(e[r][1]=e[r-1][1]+e[r][1].substring(0,e[r][1].length-e[r-1][1].length),e[r+1][1]=e[r-1][1]+e[r+1][1],e.splice(r-1,1),c=!0):e[r][1].substring(0,e[r+1][1].length)==e[r+1][1]&&(e[r-1][1]+=e[r+1][1],e[r][1]=e[r][1].substring(e[r+1][1].length)+e[r+1][1],e.splice(r+1,1),c=!0)),r++;c&&this.diff_cleanupMerge(e)},t.prototype.diff_xIndex=function(e,t){var n,r=0,i=0,a=0,o=0;for(n=0;n<e.length&&(e[n][0]!==1&&(r+=e[n][1].length),e[n][0]!==-1&&(i+=e[n][1].length),!(r>t));n++)a=r,o=i;return e.length!=n&&e[n][0]===-1?o:o+(t-a)},t.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,r=/</g,i=/>/g,a=/\n/g,o=0;o<e.length;o++){var s=e[o][0],c=e[o][1].replace(n,`&`).replace(r,`<`).replace(i,`>`).replace(a,`¶<br>`);switch(s){case 1:t[o]=`<ins style="background:#e6ffe6;">`+c+`</ins>`;break;case-1:t[o]=`<del style="background:#ffe6e6;">`+c+`</del>`;break;case 0:t[o]=`<span>`+c+`</span>`}}return t.join(``)},t.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==1&&(t[n]=e[n][1]);return t.join(``)},t.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==-1&&(t[n]=e[n][1]);return t.join(``)},t.prototype.diff_levenshtein=function(e){for(var t=0,n=0,r=0,i=0;i<e.length;i++){var a=e[i][0],o=e[i][1];switch(a){case 1:n+=o.length;break;case-1:r+=o.length;break;case 0:t+=Math.max(n,r),n=0,r=0}}return t+=Math.max(n,r)},t.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case 1:t[n]=`+`+encodeURI(e[n][1]);break;case-1:t[n]=`-`+e[n][1].length;break;case 0:t[n]=`=`+e[n][1].length}return t.join(` `).replace(/%20/g,` `)},t.prototype.diff_fromDelta=function(e,n){for(var r=[],i=0,a=0,o=n.split(/\t/g),s=0;s<o.length;s++){var c=o[s].substring(1);switch(o[s].charAt(0)){case`+`:try{r[i++]=new t.Diff(1,decodeURI(c))}catch{throw Error(`Illegal escape in diff_fromDelta: `+c)}break;case`-`:case`=`:var l=parseInt(c,10);if(isNaN(l)||l<0)throw Error(`Invalid number in diff_fromDelta: `+c);var u=e.substring(a,a+=l);o[s].charAt(0)==`=`?r[i++]=new t.Diff(0,u):r[i++]=new t.Diff(-1,u);break;default:if(o[s])throw Error(`Invalid diff operation in diff_fromDelta: `+o[s])}}if(a!=e.length)throw Error(`Delta length (`+a+`) does not equal source text length (`+e.length+`).`);return r},t.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},t.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),(s=e.lastIndexOf(t,n+t.length))!=-1&&(o=Math.min(a(0,s),o)));var c,l,u=1<<t.length-1;s=-1;for(var d,f=t.length+e.length,p=0;p<t.length;p++){for(c=0,l=f;c<l;)a(p,n+l)<=o?c=l:f=l,l=Math.floor((f-c)/2+c);f=l;var m=Math.max(1,n-l+1),h=Math.min(n+l,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(g[_]=p===0?(g[_+1]<<1|1)&v:(g[_+1]<<1|1)&v|(d[_+1]|d[_])<<1|1|d[_+1],g[_]&u){var y=a(p,_-1);if(y<=o){if(o=y,!((s=_-1)>n))break;m=Math.max(1,2*n-s)}}}if(a(p+1,n)>o)break;d=g}return s},t.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},t.prototype.patch_addContext_=function(e,n){if(n.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=n.substring(e.start2,e.start2+e.length1),i=0;n.indexOf(r)!=n.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=n.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var a=n.substring(e.start2-i,e.start2);a&&e.diffs.unshift(new t.Diff(0,a));var o=n.substring(e.start2+e.length1,e.start2+e.length1+i);o&&e.diffs.push(new t.Diff(0,o)),e.start1-=a.length,e.start2-=a.length,e.length1+=a.length+o.length,e.length2+=a.length+o.length}},t.prototype.patch_make=function(e,n,r){var i,a;if(typeof e==`string`&&typeof n==`string`&&r===void 0)i=e,(a=this.diff_main(i,n,!0)).length>2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(e&&typeof e==`object`&&n===void 0&&r===void 0)a=e,i=this.diff_text1(a);else if(typeof e==`string`&&n&&typeof n==`object`&&r===void 0)i=e,a=n;else{if(typeof e!=`string`||typeof n!=`string`||!r||typeof r!=`object`)throw Error(`Unknown call format to patch_make.`);i=e,a=r}if(a.length===0)return[];for(var o=[],s=new t.patch_obj,c=0,l=0,u=0,d=i,f=i,p=0;p<a.length;p++){var m=a[p][0],h=a[p][1];switch(c||m===0||(s.start1=l,s.start2=u),m){case 1:s.diffs[c++]=a[p],s.length2+=h.length,f=f.substring(0,u)+h+f.substring(u);break;case-1:s.length1+=h.length,s.diffs[c++]=a[p],f=f.substring(0,u)+f.substring(u+h.length);break;case 0:h.length<=2*this.Patch_Margin&&c&&a.length!=p+1?(s.diffs[c++]=a[p],s.length1+=h.length,s.length2+=h.length):h.length>=2*this.Patch_Margin&&c&&(this.patch_addContext_(s,d),o.push(s),s=new t.patch_obj,c=0,d=f,l=u)}m!==1&&(l+=h.length),m!==-1&&(u+=h.length)}return c&&(this.patch_addContext_(s,d),o.push(s)),o},t.prototype.patch_deepCopy=function(e){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=new t.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new t.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,n[r]=a}return n},t.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var r=0,i=[],a=0;a<e.length;a++){var o,s,c=e[a].start2+r,l=this.diff_text1(e[a].diffs),u=-1;if(l.length>this.Match_MaxBits?(o=this.match_main(t,l.substring(0,this.Match_MaxBits),c))!=-1&&((u=this.match_main(t,l.substring(l.length-this.Match_MaxBits),c+l.length-this.Match_MaxBits))==-1||o>=u)&&(o=-1):o=this.match_main(t,l,c),o==-1)i[a]=!1,r-=e[a].length2-e[a].length1;else if(i[a]=!0,r=o-c,l==(s=u==-1?t.substring(o,o+l.length):t.substring(o,u+this.Match_MaxBits)))t=t.substring(0,o)+this.diff_text2(e[a].diffs)+t.substring(o+l.length);else{var d=this.diff_main(l,s,!1);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(d)/l.length>this.Patch_DeleteThreshold)i[a]=!1;else{this.diff_cleanupSemanticLossless(d);for(var f,p=0,m=0;m<e[a].diffs.length;m++){var h=e[a].diffs[m];h[0]!==0&&(f=this.diff_xIndex(d,p)),h[0]===1?t=t.substring(0,o+f)+h[1]+t.substring(o+f):h[0]===-1&&(t=t.substring(0,o+f)+t.substring(o+this.diff_xIndex(d,p+h[1].length))),h[0]!==-1&&(p+=h[1].length)}}}}return[t=t.substring(n.length,t.length-n.length),i]},t.prototype.patch_addPadding=function(e){for(var n=this.Patch_Margin,r=``,i=1;i<=n;i++)r+=String.fromCharCode(i);for(i=0;i<e.length;i++)e[i].start1+=n,e[i].start2+=n;var a=e[0],o=a.diffs;if(o.length==0||o[0][0]!=0)o.unshift(new t.Diff(0,r)),a.start1-=n,a.start2-=n,a.length1+=n,a.length2+=n;else if(n>o[0][1].length){var s=n-o[0][1].length;o[0][1]=r.substring(o[0][1].length)+o[0][1],a.start1-=s,a.start2-=s,a.length1+=s,a.length2+=s}return(o=(a=e[e.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new t.Diff(0,r)),a.length1+=n,a.length2+=n):n>o[o.length-1][1].length&&(s=n-o[o.length-1][1].length,o[o.length-1][1]+=r.substring(0,s),a.length1+=s,a.length2+=s),r},t.prototype.patch_splitMax=function(e){for(var n=this.Match_MaxBits,r=0;r<e.length;r++)if(!(e[r].length1<=n)){var i=e[r];e.splice(r--,1);for(var a=i.start1,o=i.start2,s=``;i.diffs.length!==0;){var c=new t.patch_obj,l=!0;for(c.start1=a-s.length,c.start2=o-s.length,s!==``&&(c.length1=c.length2=s.length,c.diffs.push(new t.Diff(0,s)));i.diffs.length!==0&&c.length1<n-this.Patch_Margin;){var u=i.diffs[0][0],d=i.diffs[0][1];u===1?(c.length2+=d.length,o+=d.length,c.diffs.push(i.diffs.shift()),l=!1):u===-1&&c.diffs.length==1&&c.diffs[0][0]==0&&d.length>2*n?(c.length1+=d.length,a+=d.length,l=!1,c.diffs.push(new t.Diff(u,d)),i.diffs.shift()):(d=d.substring(0,n-c.length1-this.Patch_Margin),c.length1+=d.length,a+=d.length,u===0?(c.length2+=d.length,o+=d.length):l=!1,c.diffs.push(new t.Diff(u,d)),d==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(d.length))}s=(s=this.diff_text2(c.diffs)).substring(s.length-this.Patch_Margin);var f=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);f!==``&&(c.length1+=f.length,c.length2+=f.length,c.diffs.length!==0&&c.diffs[c.diffs.length-1][0]===0?c.diffs[c.diffs.length-1][1]+=f:c.diffs.push(new t.Diff(0,f))),l||e.splice(++r,0,c)}}},t.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},t.prototype.patch_fromText=function(e){var n=[];if(!e)return n;for(var r=e.split(`
|
|
10
|
+
`),i=0,a=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;i<r.length;){var o=r[i].match(a);if(!o)throw Error(`Invalid patch string: `+r[i]);var s=new t.patch_obj;for(n.push(s),s.start1=parseInt(o[1],10),o[2]===``?(s.start1--,s.length1=1):o[2]==`0`?s.length1=0:(s.start1--,s.length1=parseInt(o[2],10)),s.start2=parseInt(o[3],10),o[4]===``?(s.start2--,s.length2=1):o[4]==`0`?s.length2=0:(s.start2--,s.length2=parseInt(o[4],10)),i++;i<r.length;){var c=r[i].charAt(0);try{var l=decodeURI(r[i].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+l)}if(c==`-`)s.diffs.push(new t.Diff(-1,l));else if(c==`+`)s.diffs.push(new t.Diff(1,l));else if(c==` `)s.diffs.push(new t.Diff(0,l));else{if(c==`@`)break;if(c!==``)throw Error(`Invalid patch mode "`+c+`" in: `+l)}i++}}return n},(t.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0}).prototype.toString=function(){for(var e,t=[`@@ -`+(this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1)+` +`+(this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2)+` @@
|
|
11
|
+
`],n=0;n<this.diffs.length;n++){switch(this.diffs[n][0]){case 1:e=`+`;break;case-1:e=`-`;break;case 0:e=` `}t[n+1]=e+encodeURI(this.diffs[n][1])+`
|
|
12
|
+
`}return t.join(``).replace(/%20/g,` `)},e.exports=t,e.exports.diff_match_patch=t,e.exports.DIFF_DELETE=-1,e.exports.DIFF_INSERT=1,e.exports.DIFF_EQUAL=0}));jr.DIFF_EQUAL,jr.DIFF_DELETE,jr.DIFF_INSERT;function Mr(e){let t=e.indexOf(`
|
|
13
|
+
--- `);return t>=0?e.slice(t+1):e}function Nr(e){let t=(0,a.c)(15),{diff:n,viewType:i}=e,s=i===void 0?`unified`:i;if(!n.trim()){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,o.jsx)(`div`,{className:`activity-panel-diff px-3 py-2 text-xs text-muted-foreground italic`,children:(0,o.jsx)(r,{id:`kknhfj`})}),t[0]=e):e=t[0],e}let c,l,u,d;if(t[1]!==n||t[2]!==s){d=Symbol.for(`react.early_return_sentinel`);bb0:{try{c=M(Mr(n))}catch{let e;t[7]===n?e=t[8]:(e=(0,o.jsx)(`pre`,{className:`activity-panel-diff font-mono text-xs whitespace-pre-wrap px-3 py-2`,children:n}),t[7]=n,t[8]=e),d=e;break bb0}if(c.every(Ir)){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,o.jsx)(`div`,{className:`activity-panel-diff px-3 py-2 text-xs text-muted-foreground italic`,children:(0,o.jsx)(r,{id:`kknhfj`})}),t[9]=e):e=t[9],d=e;break bb0}l=`activity-panel-diff`;let e;t[10]===s?e=t[11]:(e=e=>(0,o.jsx)(Ar,{viewType:s,diffType:e.type,hunks:e.hunks,children:Pr},`${e.oldPath??`a`}→${e.newPath??`b`}`),t[10]=s,t[11]=e),u=c.map(e)}t[1]=n,t[2]=s,t[3]=l,t[4]=u,t[5]=d,t[6]=c}else l=t[3],u=t[4],d=t[5],c=t[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;return t[12]!==l||t[13]!==u?(f=(0,o.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=f):f=t[14],f}function Pr(e){return e.map(Fr)}function Fr(e){return(0,o.jsx)(Tr,{hunk:e},e.content)}function Ir(e){return e.hunks.length===0}export{Nr as ActivityPanelDiffView};
|