@imenam/mcp-documentor 1.0.66 → 1.0.68
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/README.md +34 -11
- package/dist/shared/schemas/doc.schema.d.ts +15 -3
- package/dist/shared/schemas/doc.schema.js +35 -6
- package/dist/src/cli/setup-mcp.d.ts +5 -0
- package/dist/src/cli/setup-mcp.js +94 -0
- package/dist/src/core/log-dir.d.ts +6 -0
- package/dist/src/core/log-dir.js +12 -0
- package/dist/src/core/project-scope.d.ts +24 -0
- package/dist/src/core/project-scope.js +28 -0
- package/dist/src/core/storage-engine.d.ts +0 -4
- package/dist/src/core/storage-engine.js +4 -9
- package/dist/src/gui-worker.js +48 -8
- package/dist/src/index.js +135 -43
- package/dist/src/tools/check-freshness.d.ts +2 -2
- package/dist/src/tools/check-freshness.js +8 -7
- package/dist/src/tools/create-doc.js +4 -6
- package/dist/src/tools/delete-doc.js +14 -7
- package/dist/src/tools/get-doc-metadata.d.ts +2 -2
- package/dist/src/tools/get-doc-metadata.js +6 -5
- package/dist/src/tools/get-doc-version.js +5 -2
- package/dist/src/tools/get-doc.d.ts +2 -2
- package/dist/src/tools/get-doc.js +6 -5
- package/dist/src/tools/git-diff-doc.js +8 -4
- package/dist/src/tools/list-doc-versions.js +5 -2
- package/dist/src/tools/move-doc.js +5 -8
- package/dist/src/tools/patch-doc.js +6 -5
- package/dist/src/tools/refresh-file-snapshot.js +8 -4
- package/dist/src/tools/restore-doc-version.js +5 -2
- package/dist/src/tools/update-doc.d.ts +2 -2
- package/dist/src/tools/update-doc.js +6 -5
- package/dist/src/tools/upload-image.js +12 -3
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/gui/dist/assets/{arc-sHJlsIyi.js → arc-Carsq0k3.js} +1 -1
- package/gui/dist/assets/{architectureDiagram-3BPJPVTR-BiF2hxSq.js → architectureDiagram-3BPJPVTR-caqcwdTw.js} +1 -1
- package/gui/dist/assets/{blockDiagram-GPEHLZMM-BCnnBvty.js → blockDiagram-GPEHLZMM-0wUO8k2I.js} +1 -1
- package/gui/dist/assets/{c4Diagram-AAUBKEIU-Bu3KJ-ij.js → c4Diagram-AAUBKEIU-DS6q7fMy.js} +1 -1
- package/gui/dist/assets/channel-D51HexOc.js +1 -0
- package/gui/dist/assets/{chunk-2J33WTMH-C_ekvnEC.js → chunk-2J33WTMH-CrJc-G6D.js} +1 -1
- package/gui/dist/assets/{chunk-4BX2VUAB-Dmp27nYT.js → chunk-4BX2VUAB-C5vtPFbB.js} +1 -1
- package/gui/dist/assets/{chunk-55IACEB6-Jrgqw_BR.js → chunk-55IACEB6-BchyQUFM.js} +1 -1
- package/gui/dist/assets/{chunk-727SXJPM-BYwz54rU.js → chunk-727SXJPM-BCIaWtKq.js} +1 -1
- package/gui/dist/assets/{chunk-AQP2D5EJ-CuvuX4qY.js → chunk-AQP2D5EJ-BEQJDJt5.js} +1 -1
- package/gui/dist/assets/{chunk-FMBD7UC4-CNL_nFEL.js → chunk-FMBD7UC4-IfQ3QtrC.js} +1 -1
- package/gui/dist/assets/{chunk-ND2GUHAM-DECudjWh.js → chunk-ND2GUHAM-4Du33w7t.js} +1 -1
- package/gui/dist/assets/{chunk-QZHKN3VN-BAtGKt_6.js → chunk-QZHKN3VN-HR0CP6fa.js} +1 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-CU0dQ3zy.js +1 -0
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-CU0dQ3zy.js +1 -0
- package/gui/dist/assets/{cose-bilkent-S5V4N54A-DQ2M_2Lo.js → cose-bilkent-S5V4N54A-C9Re3ENx.js} +1 -1
- package/gui/dist/assets/{dagre-BM42HDAG-D6vlHW8t.js → dagre-BM42HDAG-DZmcvMMp.js} +1 -1
- package/gui/dist/assets/{diagram-2AECGRRQ-s2G4QZQa.js → diagram-2AECGRRQ-EyJrAGht.js} +1 -1
- package/gui/dist/assets/{diagram-5GNKFQAL-YyU3AqQI.js → diagram-5GNKFQAL-CHd3T9_b.js} +1 -1
- package/gui/dist/assets/{diagram-KO2AKTUF-BuFjXIUa.js → diagram-KO2AKTUF-CIyFrZSR.js} +1 -1
- package/gui/dist/assets/{diagram-LMA3HP47-CjO5OS2W.js → diagram-LMA3HP47-BlkJALyz.js} +1 -1
- package/gui/dist/assets/{diagram-OG6HWLK6-DVYIxc4z.js → diagram-OG6HWLK6-P8LA7IZE.js} +1 -1
- package/gui/dist/assets/{erDiagram-TEJ5UH35-BsxhnVVZ.js → erDiagram-TEJ5UH35-BPywgWN1.js} +1 -1
- package/gui/dist/assets/{flowDiagram-I6XJVG4X-D2BV25QW.js → flowDiagram-I6XJVG4X-ByL0kGiV.js} +1 -1
- package/gui/dist/assets/{ganttDiagram-6RSMTGT7-BR95C5C6.js → ganttDiagram-6RSMTGT7-_pnaYCU4.js} +1 -1
- package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-bHC_XC7V.js → gitGraphDiagram-PVQCEYII-DN67CDGs.js} +1 -1
- package/gui/dist/assets/{index-DhwbMWam.js → index-Bjc5MOe1.js} +88 -88
- package/gui/dist/assets/{index-Cbo0HWer.css → index-hjkEDRmc.css} +1 -1
- package/gui/dist/assets/{infoDiagram-5YYISTIA-DE0rWygZ.js → infoDiagram-5YYISTIA-Bm5LEpzH.js} +1 -1
- package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-C03LZBFa.js → ishikawaDiagram-YF4QCWOH-DUYSULkT.js} +1 -1
- package/gui/dist/assets/{journeyDiagram-JHISSGLW-tRPsZRYs.js → journeyDiagram-JHISSGLW-BvJ1_f0L.js} +1 -1
- package/gui/dist/assets/{kanban-definition-UN3LZRKU-BYePPZ0q.js → kanban-definition-UN3LZRKU-DDYKg6RY.js} +1 -1
- package/gui/dist/assets/{linear-Bgo5v91h.js → linear-HlpG9u6P.js} +1 -1
- package/gui/dist/assets/{mindmap-definition-RKZ34NQL-C87iCyRq.js → mindmap-definition-RKZ34NQL-CPa_wo_s.js} +1 -1
- package/gui/dist/assets/{pieDiagram-4H26LBE5-BINdJQBG.js → pieDiagram-4H26LBE5-BWo0c4DP.js} +1 -1
- package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-BNcy-pgy.js → quadrantDiagram-W4KKPZXB-CLahU-6B.js} +1 -1
- package/gui/dist/assets/{requirementDiagram-4Y6WPE33-D_DCIFsd.js → requirementDiagram-4Y6WPE33-BoYbgzQ7.js} +1 -1
- package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-nCf_iEpj.js → sankeyDiagram-5OEKKPKP-CGm79aMo.js} +1 -1
- package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-3rvwaBlu.js → sequenceDiagram-3UESZ5HK-BkknTD52.js} +1 -1
- package/gui/dist/assets/{stateDiagram-AJRCARHV-BRPOJHIL.js → stateDiagram-AJRCARHV-DSBurgwC.js} +1 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-DfKn22XF.js +1 -0
- package/gui/dist/assets/{timeline-definition-PNZ67QCA-C75DjOcj.js → timeline-definition-PNZ67QCA-CBHyrGuz.js} +1 -1
- package/gui/dist/assets/{vennDiagram-CIIHVFJN-CLZG8u4c.js → vennDiagram-CIIHVFJN-Dn9fr_bR.js} +1 -1
- package/gui/dist/assets/{wardley-L42UT6IY-BJnZFkDe.js → wardley-L42UT6IY-nMuySeAb.js} +1 -1
- package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-CBvWRjIO.js → wardleyDiagram-YWT4CUSO-Byn2STLI.js} +1 -1
- package/gui/dist/assets/{xychartDiagram-2RQKCTM6-BGMFJ2t3.js → xychartDiagram-2RQKCTM6-Bi-Y9wp5.js} +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/gui/dist/assets/channel-fkOAmVLo.js +0 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-D_v2HS-t.js +0 -1
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-D_v2HS-t.js +0 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-BUd1OQnG.js +0 -1
|
@@ -3,6 +3,7 @@ import path from "path";
|
|
|
3
3
|
import { GitDiffDocArgsSchema } from "../../shared/schemas/doc.schema.js";
|
|
4
4
|
import { computeFreshness } from "./check-freshness.js";
|
|
5
5
|
import { toAbsolutePath, toStoredPath } from "../core/path-resolver.js";
|
|
6
|
+
import { assertProject, scopeErrorResult } from "../core/project-scope.js";
|
|
6
7
|
function getGitDiffForFile(tracked, project) {
|
|
7
8
|
const filePath = toAbsolutePath(tracked.path, project);
|
|
8
9
|
if (!filePath) {
|
|
@@ -42,15 +43,18 @@ function getGitDiffForFile(tracked, project) {
|
|
|
42
43
|
export async function gitDiffDoc(storageEngine, args) {
|
|
43
44
|
try {
|
|
44
45
|
const validated = GitDiffDocArgsSchema.parse(args);
|
|
46
|
+
const project = validated.project;
|
|
47
|
+
const projectError = assertProject(storageEngine, project);
|
|
48
|
+
if (projectError)
|
|
49
|
+
return scopeErrorResult(projectError);
|
|
45
50
|
const docSections = [];
|
|
46
51
|
const seenFilePaths = new Set();
|
|
47
52
|
for (const docPath of validated.paths) {
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
50
|
-
docSections.push(`## ${docPath}\n\n[ERROR] Documentation entry not found in
|
|
53
|
+
const doc = await storageEngine.getDoc(docPath, project);
|
|
54
|
+
if (!doc) {
|
|
55
|
+
docSections.push(`## ${docPath}\n\n[ERROR] Documentation entry not found in project "${project}".`);
|
|
51
56
|
continue;
|
|
52
57
|
}
|
|
53
|
-
const { doc, project } = resolved;
|
|
54
58
|
if (!doc.tracked_files || doc.tracked_files.length === 0) {
|
|
55
59
|
docSections.push(`## ${doc.title}\n\n[INFO] No tracked files.`);
|
|
56
60
|
continue;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ListDocVersionsArgsSchema } from "../../shared/schemas/doc.schema.js";
|
|
2
|
+
import { assertProject, scopeErrorResult } from "../core/project-scope.js";
|
|
2
3
|
export async function listDocVersions(historyStore, storageEngine, args) {
|
|
3
4
|
try {
|
|
4
5
|
const validated = ListDocVersionsArgsSchema.parse(args);
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const project = validated.project;
|
|
7
|
+
const projectError = assertProject(storageEngine, project);
|
|
8
|
+
if (projectError)
|
|
9
|
+
return scopeErrorResult(projectError);
|
|
7
10
|
const versions = historyStore.listVersions(project, validated.path);
|
|
8
11
|
if (versions.length === 0) {
|
|
9
12
|
return {
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { MoveDocArgsSchema } from "../../shared/schemas/doc.schema.js";
|
|
2
|
+
import { resolveDocInProject, isScopeError, scopeErrorResult } from "../core/project-scope.js";
|
|
2
3
|
export async function moveDoc(storageEngine, embeddingEngine, args) {
|
|
3
4
|
try {
|
|
4
5
|
const validated = MoveDocArgsSchema.parse(args);
|
|
5
|
-
const resolved = await storageEngine.
|
|
6
|
-
if (
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
content: [{ type: "text", text: `Documentation entry "${validated.path}" not found in any project.` }],
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const { project: resolvedProject } = resolved;
|
|
6
|
+
const resolved = await resolveDocInProject(storageEngine, validated.path, validated.project, "move");
|
|
7
|
+
if (isScopeError(resolved))
|
|
8
|
+
return scopeErrorResult(resolved);
|
|
9
|
+
const resolvedProject = validated.project;
|
|
13
10
|
const moved = await storageEngine.moveDoc(validated.path, validated.new_path, resolvedProject);
|
|
14
11
|
if (!moved) {
|
|
15
12
|
return {
|
|
@@ -2,14 +2,15 @@ import fs from "fs";
|
|
|
2
2
|
import { PatchDocArgsSchema } from "../../shared/schemas/doc.schema.js";
|
|
3
3
|
import { persistDraft } from "../core/draft-store.js";
|
|
4
4
|
import { resolveCodeRefs, mergeTrackedFiles } from "../core/code-ref-resolver.js";
|
|
5
|
+
import { resolveDocInProject, isScopeError, scopeErrorResult } from "../core/project-scope.js";
|
|
5
6
|
export async function patchDoc(storageEngine, embeddingEngine, args) {
|
|
6
7
|
try {
|
|
7
8
|
const validated = PatchDocArgsSchema.parse(args);
|
|
8
|
-
const resolved = await storageEngine.
|
|
9
|
-
if (
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
const
|
|
9
|
+
const resolved = await resolveDocInProject(storageEngine, validated.path, validated.project, "patch");
|
|
10
|
+
if (isScopeError(resolved))
|
|
11
|
+
return scopeErrorResult(resolved);
|
|
12
|
+
const { doc } = resolved;
|
|
13
|
+
const resolvedProject = validated.project;
|
|
13
14
|
const search = validated.search_file
|
|
14
15
|
? fs.readFileSync(validated.search_file, "utf-8")
|
|
15
16
|
: validated.search;
|
|
@@ -3,17 +3,21 @@ import { RefreshFileSnapshotArgsSchema } from "../../shared/schemas/doc.schema.j
|
|
|
3
3
|
import { computeFileHash } from "./check-freshness.js";
|
|
4
4
|
import { relocateAndRefreshSection } from "../core/section-tracker.js";
|
|
5
5
|
import { toAbsolutePath, toStoredPath } from "../core/path-resolver.js";
|
|
6
|
+
import { assertProject, scopeErrorResult } from "../core/project-scope.js";
|
|
6
7
|
export async function refreshFileSnapshot(storageEngine, historyStore, args) {
|
|
7
8
|
try {
|
|
8
9
|
const validated = RefreshFileSnapshotArgsSchema.parse(args);
|
|
10
|
+
const resolvedProject = validated.project;
|
|
11
|
+
const projectError = assertProject(storageEngine, resolvedProject);
|
|
12
|
+
if (projectError)
|
|
13
|
+
return scopeErrorResult(projectError);
|
|
9
14
|
const docSections = [];
|
|
10
15
|
for (const docPath of validated.paths) {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
docSections.push(`**${docPath}**: not found in
|
|
16
|
+
const doc = await storageEngine.getDoc(docPath, resolvedProject);
|
|
17
|
+
if (!doc) {
|
|
18
|
+
docSections.push(`**${docPath}**: not found in project "${resolvedProject}" — nothing refreshed.`);
|
|
14
19
|
continue;
|
|
15
20
|
}
|
|
16
|
-
const { doc, project: resolvedProject } = resolved;
|
|
17
21
|
const refreshed = [];
|
|
18
22
|
const missing = [];
|
|
19
23
|
const skipped = [];
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { RestoreDocVersionArgsSchema } from "../../shared/schemas/doc.schema.js";
|
|
2
|
+
import { assertProject, scopeErrorResult } from "../core/project-scope.js";
|
|
2
3
|
export async function restoreDocVersion(historyStore, storageEngine, embeddingEngine, args) {
|
|
3
4
|
try {
|
|
4
5
|
const validated = RestoreDocVersionArgsSchema.parse(args);
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const project = validated.project;
|
|
7
|
+
const projectError = assertProject(storageEngine, project);
|
|
8
|
+
if (projectError)
|
|
9
|
+
return scopeErrorResult(projectError);
|
|
7
10
|
const entry = historyStore.getVersion(project, validated.path, validated.version);
|
|
8
11
|
if (!entry || entry.content === undefined) {
|
|
9
12
|
return {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { StorageEngine } from "../core/storage-engine.js";
|
|
2
2
|
import type { EmbeddingEngine } from "../core/embedding-engine.js";
|
|
3
3
|
export declare function updateDoc(storageEngine: StorageEngine, embeddingEngine: EmbeddingEngine, args: unknown): Promise<{
|
|
4
|
-
isError: boolean;
|
|
5
4
|
content: {
|
|
6
5
|
type: string;
|
|
7
6
|
text: string;
|
|
8
7
|
}[];
|
|
8
|
+
isError?: undefined;
|
|
9
9
|
} | {
|
|
10
|
+
isError: boolean;
|
|
10
11
|
content: {
|
|
11
12
|
type: string;
|
|
12
13
|
text: string;
|
|
13
14
|
}[];
|
|
14
|
-
isError?: undefined;
|
|
15
15
|
}>;
|
|
@@ -2,14 +2,15 @@ import fs from "fs";
|
|
|
2
2
|
import { UpdateDocArgsSchema } from "../../shared/schemas/doc.schema.js";
|
|
3
3
|
import { persistDraft } from "../core/draft-store.js";
|
|
4
4
|
import { resolveCodeRefs, resnapshotPreserving, mergeTrackedFiles } from "../core/code-ref-resolver.js";
|
|
5
|
+
import { resolveDocInProject, isScopeError, scopeErrorResult } from "../core/project-scope.js";
|
|
5
6
|
export async function updateDoc(storageEngine, embeddingEngine, args) {
|
|
6
7
|
try {
|
|
7
8
|
const validated = UpdateDocArgsSchema.parse(args);
|
|
8
|
-
const resolved = await storageEngine.
|
|
9
|
-
if (
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
const
|
|
9
|
+
const resolved = await resolveDocInProject(storageEngine, validated.path, validated.project, "update");
|
|
10
|
+
if (isScopeError(resolved))
|
|
11
|
+
return scopeErrorResult(resolved);
|
|
12
|
+
const { doc } = resolved;
|
|
13
|
+
const resolvedProject = validated.project;
|
|
13
14
|
if (validated.title !== undefined) {
|
|
14
15
|
doc.title = validated.title;
|
|
15
16
|
}
|
|
@@ -4,7 +4,10 @@ import { z } from "zod";
|
|
|
4
4
|
const UploadImageArgsSchema = z.object({
|
|
5
5
|
filename: z.string().min(1),
|
|
6
6
|
filePath: z.string(),
|
|
7
|
-
project: z
|
|
7
|
+
project: z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.describe("Project whose assets receive the image. Mandatory — never defaulted to the current project."),
|
|
8
11
|
alt: z.string().optional(),
|
|
9
12
|
});
|
|
10
13
|
function sanitizeFilename(name) {
|
|
@@ -24,8 +27,14 @@ function resolveFilename(assetsDir, baseName) {
|
|
|
24
27
|
export async function uploadImage(storageEngine, args) {
|
|
25
28
|
try {
|
|
26
29
|
const validated = UploadImageArgsSchema.parse(args);
|
|
27
|
-
const
|
|
28
|
-
const
|
|
30
|
+
const project = validated.project;
|
|
31
|
+
const knownProjects = storageEngine.getConfig().projects;
|
|
32
|
+
if (!knownProjects.includes(project)) {
|
|
33
|
+
return {
|
|
34
|
+
isError: true,
|
|
35
|
+
content: [{ type: "text", text: `Project "${project}" does not exist. Known projects: ${knownProjects.join(", ")}.` }],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
29
38
|
if (!fs.existsSync(validated.filePath)) {
|
|
30
39
|
return {
|
|
31
40
|
isError: true,
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const APP_VERSION = "1.0.
|
|
1
|
+
export declare const APP_VERSION = "1.0.68";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated version file - do not edit manually
|
|
2
|
-
export const APP_VERSION = '1.0.
|
|
2
|
+
export const APP_VERSION = '1.0.68';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-
|
|
1
|
+
import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-Bjc5MOe1.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|