@justyork/repo-mind 0.4.0 → 0.7.1
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 +5 -2
- package/dist/ab-demo/compute-pass.d.ts +24 -0
- package/dist/ab-demo/compute-pass.js +80 -0
- package/dist/ab-demo/live-answer.d.ts +6 -0
- package/dist/ab-demo/live-answer.js +89 -0
- package/dist/ab-demo/live-eval.d.ts +19 -0
- package/dist/ab-demo/live-eval.js +192 -0
- package/dist/ab-demo/paths.d.ts +1 -0
- package/dist/ab-demo/paths.js +3 -0
- package/dist/ab-demo/record-transcript.d.ts +9 -0
- package/dist/ab-demo/record-transcript.js +97 -0
- package/dist/ab-demo/types.d.ts +57 -0
- package/dist/ab-demo/validate-questions.d.ts +5 -0
- package/dist/ab-demo/validate-questions.js +32 -0
- package/dist/agent-write-gate.d.ts +7 -0
- package/dist/agent-write-gate.js +33 -0
- package/dist/cli.js +102 -0
- package/dist/commands/ab-eval.d.ts +11 -0
- package/dist/commands/ab-eval.js +103 -0
- package/dist/commands/publish.d.ts +11 -0
- package/dist/commands/publish.js +91 -0
- package/dist/git/git-exec.d.ts +19 -0
- package/dist/git/git-exec.js +89 -0
- package/dist/git/publish-pr.d.ts +33 -0
- package/dist/git/publish-pr.js +121 -0
- package/dist/index/slug.d.ts +2 -0
- package/dist/index/slug.js +15 -0
- package/dist/mcp/server.js +40 -0
- package/dist/publish/batch-publish.d.ts +29 -0
- package/dist/publish/batch-publish.js +106 -0
- package/dist/tools/create-draft.d.ts +32 -0
- package/dist/tools/create-draft.js +163 -0
- package/dist/ui/draft-api.js +33 -1
- package/dist/ui/fs-operations.d.ts +13 -0
- package/dist/ui/fs-operations.js +139 -0
- package/dist/ui/fs-tree.d.ts +6 -1
- package/dist/ui/fs-tree.js +62 -36
- package/package.json +9 -1
- package/ui/dist/assets/{arc-C6B0IXf5.js → arc-B9D1Pvqi.js} +1 -1
- package/ui/dist/assets/{architectureDiagram-3BPJPVTR-BwcC0zwn.js → architectureDiagram-3BPJPVTR-Bvug0Ca5.js} +1 -1
- package/ui/dist/assets/{blockDiagram-GPEHLZMM-DIhdWMA6.js → blockDiagram-GPEHLZMM-Ckmilsu4.js} +1 -1
- package/ui/dist/assets/{c4Diagram-AAUBKEIU-DAe6bsUB.js → c4Diagram-AAUBKEIU-BT9pbmn0.js} +1 -1
- package/ui/dist/assets/channel-TAOLyHdK.js +1 -0
- package/ui/dist/assets/{chunk-2J33WTMH-Cy3md3pb.js → chunk-2J33WTMH-dgxq-Xfu.js} +1 -1
- package/ui/dist/assets/{chunk-4BX2VUAB-CzL8eUDD.js → chunk-4BX2VUAB-DmM9cIh_.js} +1 -1
- package/ui/dist/assets/{chunk-55IACEB6-CbthXzDA.js → chunk-55IACEB6-DsB88bPS.js} +1 -1
- package/ui/dist/assets/{chunk-727SXJPM-B7ZW-l9j.js → chunk-727SXJPM-BYuDClxC.js} +1 -1
- package/ui/dist/assets/{chunk-AQP2D5EJ-Vaux-7Ld.js → chunk-AQP2D5EJ-RO0Jvaof.js} +1 -1
- package/ui/dist/assets/{chunk-FMBD7UC4-C6P2YSWU.js → chunk-FMBD7UC4-DqY1unJF.js} +1 -1
- package/ui/dist/assets/{chunk-ND2GUHAM-gSNqdDAn.js → chunk-ND2GUHAM-BAURH6-3.js} +1 -1
- package/ui/dist/assets/{chunk-QZHKN3VN-DPPMoZqF.js → chunk-QZHKN3VN-BiCWufLo.js} +1 -1
- package/ui/dist/assets/classDiagram-4FO5ZUOK-0RJZpoIN.js +1 -0
- package/ui/dist/assets/classDiagram-v2-Q7XG4LA2-0RJZpoIN.js +1 -0
- package/ui/dist/assets/{cose-bilkent-S5V4N54A-Ca4nXCOA.js → cose-bilkent-S5V4N54A-Bol8tJZ0.js} +1 -1
- package/ui/dist/assets/{dagre-BM42HDAG-C-4Y4Jyn.js → dagre-BM42HDAG-ziNCIqra.js} +1 -1
- package/ui/dist/assets/{diagram-2AECGRRQ-CNv_WVZk.js → diagram-2AECGRRQ-Dh2G8IOg.js} +1 -1
- package/ui/dist/assets/{diagram-5GNKFQAL-CNwYGvCw.js → diagram-5GNKFQAL-C_26Fq9O.js} +1 -1
- package/ui/dist/assets/{diagram-KO2AKTUF-CEULTL49.js → diagram-KO2AKTUF-CPS1B4bk.js} +1 -1
- package/ui/dist/assets/{diagram-LMA3HP47-sGQpPW5i.js → diagram-LMA3HP47-DoL5Nx28.js} +1 -1
- package/ui/dist/assets/{diagram-OG6HWLK6-BBEtEBkh.js → diagram-OG6HWLK6-DOy-TY5D.js} +1 -1
- package/ui/dist/assets/editor-CTtDusro.js +211 -0
- package/ui/dist/assets/{erDiagram-TEJ5UH35-B4mEdVPJ.js → erDiagram-TEJ5UH35-C2whsoWw.js} +1 -1
- package/ui/dist/assets/{flowDiagram-I6XJVG4X-7-OngwLn.js → flowDiagram-I6XJVG4X-D7-1XdVh.js} +1 -1
- package/ui/dist/assets/{ganttDiagram-6RSMTGT7-Bq3z_Nvr.js → ganttDiagram-6RSMTGT7-Dduumk4v.js} +1 -1
- package/ui/dist/assets/{gitGraphDiagram-PVQCEYII-BjMdjnGR.js → gitGraphDiagram-PVQCEYII-CJfZihUe.js} +1 -1
- package/ui/dist/assets/{graph-CwHQTpjf.js → graph-CFkZObJQ.js} +1 -1
- package/ui/dist/assets/{infoDiagram-5YYISTIA-ByORmROU.js → infoDiagram-5YYISTIA-B8IsGW31.js} +1 -1
- package/ui/dist/assets/{ishikawaDiagram-YF4QCWOH-B7yRHlcY.js → ishikawaDiagram-YF4QCWOH-CwaI1VjO.js} +1 -1
- package/ui/dist/assets/{journeyDiagram-JHISSGLW-J5mLr9YH.js → journeyDiagram-JHISSGLW-jo8e3Vri.js} +1 -1
- package/ui/dist/assets/{kanban-definition-UN3LZRKU-B3GyGD8X.js → kanban-definition-UN3LZRKU-DsFcvv5g.js} +1 -1
- package/ui/dist/assets/main-DEdNYNxf.js +274 -0
- package/ui/dist/assets/{mermaid.core-C57NVZG0.js → mermaid.core-CIyMeT5H.js} +4 -4
- package/ui/dist/assets/{mindmap-definition-RKZ34NQL-CkcXt9tU.js → mindmap-definition-RKZ34NQL-Bl3ML0fg.js} +1 -1
- package/ui/dist/assets/{pieDiagram-4H26LBE5-Y7B3kCyQ.js → pieDiagram-4H26LBE5-rCj5-rCc.js} +1 -1
- package/ui/dist/assets/{quadrantDiagram-W4KKPZXB-CXKUOw1G.js → quadrantDiagram-W4KKPZXB-tF5l8Pj1.js} +1 -1
- package/ui/dist/assets/{requirementDiagram-4Y6WPE33-DBmmmiXs.js → requirementDiagram-4Y6WPE33-CtAsbYzh.js} +1 -1
- package/ui/dist/assets/{sankeyDiagram-5OEKKPKP-BNADiaE4.js → sankeyDiagram-5OEKKPKP-CYgylTyv.js} +1 -1
- package/ui/dist/assets/{sequenceDiagram-3UESZ5HK-CctElOC5.js → sequenceDiagram-3UESZ5HK-D2FeAk8O.js} +1 -1
- package/ui/dist/assets/{stateDiagram-AJRCARHV-D40_7g7Y.js → stateDiagram-AJRCARHV-BhNt372S.js} +1 -1
- package/ui/dist/assets/stateDiagram-v2-BHNVJYJU-hesflu-P.js +1 -0
- package/ui/dist/assets/theme-CgUWrIXo.css +1 -0
- package/ui/dist/assets/theme-DBoBdw62.js +1 -0
- package/ui/dist/assets/{timeline-definition-PNZ67QCA-DMVhUcek.js → timeline-definition-PNZ67QCA-DYrj-JqE.js} +1 -1
- package/ui/dist/assets/{vennDiagram-CIIHVFJN-Ci0RqPuV.js → vennDiagram-CIIHVFJN-DAdImqHv.js} +1 -1
- package/ui/dist/assets/visual-editor-BHZk1CI4.js +220 -0
- package/ui/dist/assets/{wardley-L42UT6IY-Chn0BKir.js → wardley-L42UT6IY-BfiflBRy.js} +1 -1
- package/ui/dist/assets/{wardleyDiagram-YWT4CUSO-BLdXlrC5.js → wardleyDiagram-YWT4CUSO-5HZM-go9.js} +1 -1
- package/ui/dist/assets/{xychartDiagram-2RQKCTM6-C4gOVVe1.js → xychartDiagram-2RQKCTM6-ozNCw5n2.js} +1 -1
- package/ui/dist/graph.html +3 -3
- package/ui/dist/index.html +4 -4
- package/ui/dist/assets/channel-C8Q7-wTd.js +0 -1
- package/ui/dist/assets/classDiagram-4FO5ZUOK-pYCdSDhT.js +0 -1
- package/ui/dist/assets/classDiagram-v2-Q7XG4LA2-pYCdSDhT.js +0 -1
- package/ui/dist/assets/editor-BcAuZsp8.js +0 -211
- package/ui/dist/assets/main-Du7fLv5Y.js +0 -244
- package/ui/dist/assets/stateDiagram-v2-BHNVJYJU-DSc6L6rE.js +0 -1
- package/ui/dist/assets/theme-BJgORXba.css +0 -1
- package/ui/dist/assets/theme-DxqwV6dp.js +0 -1
- package/ui/dist/assets/visual-editor-UWcMGp6p.js +0 -39
package/dist/ui/fs-tree.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export interface TreePageNode {
|
|
|
9
9
|
status: string;
|
|
10
10
|
type: string;
|
|
11
11
|
contentKind: 'markdown' | 'yaml' | 'json';
|
|
12
|
+
/** Sibling folder `{parent}/{name}/` when Confluence-style page+folder pair exists. */
|
|
13
|
+
childFolderPath?: string;
|
|
14
|
+
children?: TreeNode[];
|
|
12
15
|
}
|
|
13
16
|
export interface TreeFolderNode {
|
|
14
17
|
kind: 'folder';
|
|
@@ -17,6 +20,8 @@ export interface TreeFolderNode {
|
|
|
17
20
|
emoji: string | null;
|
|
18
21
|
/** Slug of README.md index page for this folder. */
|
|
19
22
|
indexPageSlug: string | null;
|
|
23
|
+
indexPageType: string | null;
|
|
24
|
+
indexPageContentKind: 'markdown' | 'yaml' | 'json' | null;
|
|
20
25
|
children: TreeNode[];
|
|
21
26
|
}
|
|
22
27
|
export type TreeNode = TreePageNode | TreeFolderNode;
|
|
@@ -25,4 +30,4 @@ export declare function readmeIndexRelativePath(folderRelativePath: string): str
|
|
|
25
30
|
export declare function folderDisplayName(relativePath: string): string;
|
|
26
31
|
export declare function buildDocsTree(index: DocIndex): TreeFolderNode | null;
|
|
27
32
|
export declare function findTreePageSlug(node: TreeFolderNode, relativePath: string): string | null;
|
|
28
|
-
export declare function collectParentOfEdges(
|
|
33
|
+
export declare function collectParentOfEdges(_tree: TreeFolderNode | null): LinkEdge[];
|
package/dist/ui/fs-tree.js
CHANGED
|
@@ -8,6 +8,20 @@ const IGNORED_DIRS = new Set(['.repo-mind', '.worktrees']);
|
|
|
8
8
|
function knowledgeFileDisplayName(fileName) {
|
|
9
9
|
return fileName.replace(/\.(md|ya?ml|json)$/i, '');
|
|
10
10
|
}
|
|
11
|
+
function findSiblingDirName(dirNames, fileName) {
|
|
12
|
+
const base = knowledgeFileDisplayName(fileName);
|
|
13
|
+
const exact = dirNames.find((name) => name === base);
|
|
14
|
+
if (exact) {
|
|
15
|
+
return exact;
|
|
16
|
+
}
|
|
17
|
+
const lower = base.toLowerCase();
|
|
18
|
+
return dirNames.find((name) => name.toLowerCase() === lower) ?? null;
|
|
19
|
+
}
|
|
20
|
+
function hasSiblingKnowledgePage(entries, dirName) {
|
|
21
|
+
return entries.some((entry) => !entry.isDirectory &&
|
|
22
|
+
isKnowledgeFileName(entry.name) &&
|
|
23
|
+
knowledgeFileDisplayName(entry.name).toLowerCase() === dirName.toLowerCase());
|
|
24
|
+
}
|
|
11
25
|
function listDirEntries(dirPath) {
|
|
12
26
|
if (!fs.existsSync(dirPath)) {
|
|
13
27
|
return [];
|
|
@@ -38,17 +52,25 @@ export function folderDisplayName(relativePath) {
|
|
|
38
52
|
function buildFolder(relativePath, absPath, ctx) {
|
|
39
53
|
const entries = listDirEntries(absPath);
|
|
40
54
|
const children = [];
|
|
55
|
+
const dirNames = entries.filter((entry) => entry.isDirectory).map((entry) => entry.name);
|
|
41
56
|
const readmeRel = readmeIndexRelativePath(relativePath);
|
|
42
57
|
let indexPageSlug = null;
|
|
58
|
+
let indexPageType = null;
|
|
59
|
+
let indexPageContentKind = null;
|
|
43
60
|
const readmeDoc = ctx.docsByRelative.get(readmeRel);
|
|
44
61
|
if (readmeDoc) {
|
|
45
62
|
indexPageSlug = readmeDoc.slug;
|
|
63
|
+
indexPageType = readmeDoc.type;
|
|
64
|
+
indexPageContentKind = readmeDoc.contentKind;
|
|
46
65
|
}
|
|
47
66
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
48
67
|
if (entry.isDirectory) {
|
|
49
68
|
if (IGNORED_DIRS.has(entry.name)) {
|
|
50
69
|
continue;
|
|
51
70
|
}
|
|
71
|
+
if (hasSiblingKnowledgePage(entries, entry.name)) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
52
74
|
const childRel = joinRelativePath(relativePath, entry.name);
|
|
53
75
|
children.push(buildFolder(childRel, path.join(absPath, entry.name), ctx));
|
|
54
76
|
continue;
|
|
@@ -57,13 +79,28 @@ function buildFolder(relativePath, absPath, ctx) {
|
|
|
57
79
|
continue;
|
|
58
80
|
}
|
|
59
81
|
const fileRel = joinRelativePath(relativePath, entry.name);
|
|
60
|
-
if (fileRel === readmeRel && indexPageSlug) {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
82
|
const doc = ctx.docsByRelative.get(fileRel);
|
|
64
83
|
if (!doc) {
|
|
65
84
|
continue;
|
|
66
85
|
}
|
|
86
|
+
const siblingDir = findSiblingDirName(dirNames, entry.name);
|
|
87
|
+
if (siblingDir) {
|
|
88
|
+
const childFolderRel = joinRelativePath(relativePath, siblingDir);
|
|
89
|
+
const nested = buildFolder(childFolderRel, path.join(absPath, siblingDir), ctx);
|
|
90
|
+
children.push({
|
|
91
|
+
kind: 'page',
|
|
92
|
+
name: knowledgeFileDisplayName(entry.name),
|
|
93
|
+
relativePath: fileRel,
|
|
94
|
+
slug: doc.slug,
|
|
95
|
+
title: doc.title,
|
|
96
|
+
status: doc.status,
|
|
97
|
+
type: doc.type,
|
|
98
|
+
contentKind: doc.contentKind,
|
|
99
|
+
childFolderPath: childFolderRel,
|
|
100
|
+
children: nested.children,
|
|
101
|
+
});
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
67
104
|
children.push({
|
|
68
105
|
kind: 'page',
|
|
69
106
|
name: knowledgeFileDisplayName(entry.name),
|
|
@@ -81,6 +118,8 @@ function buildFolder(relativePath, absPath, ctx) {
|
|
|
81
118
|
relativePath,
|
|
82
119
|
emoji: catalogEmoji(ctx.meta, relativePath),
|
|
83
120
|
indexPageSlug,
|
|
121
|
+
indexPageType,
|
|
122
|
+
indexPageContentKind,
|
|
84
123
|
children,
|
|
85
124
|
};
|
|
86
125
|
}
|
|
@@ -107,42 +146,29 @@ export function buildDocsTree(index) {
|
|
|
107
146
|
}
|
|
108
147
|
export function findTreePageSlug(node, relativePath) {
|
|
109
148
|
const normalized = normalizeRelativePath(relativePath);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const found = findTreePageSlug(child, normalized);
|
|
116
|
-
if (found) {
|
|
117
|
-
return found;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
export function collectParentOfEdges(tree) {
|
|
124
|
-
if (!tree) {
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
|
-
const edges = [];
|
|
128
|
-
function walk(folder) {
|
|
129
|
-
if (folder.indexPageSlug) {
|
|
130
|
-
for (const child of folder.children ?? []) {
|
|
131
|
-
if (child.kind === 'page' && child.slug !== folder.indexPageSlug) {
|
|
132
|
-
edges.push({
|
|
133
|
-
from: folder.indexPageSlug,
|
|
134
|
-
to: child.slug,
|
|
135
|
-
kind: 'parent_of',
|
|
136
|
-
});
|
|
149
|
+
function search(nodes) {
|
|
150
|
+
for (const child of nodes) {
|
|
151
|
+
if (child.kind === 'page') {
|
|
152
|
+
if (child.relativePath === normalized) {
|
|
153
|
+
return child.slug;
|
|
137
154
|
}
|
|
155
|
+
if (child.children) {
|
|
156
|
+
const nested = search(child.children);
|
|
157
|
+
if (nested) {
|
|
158
|
+
return nested;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
continue;
|
|
138
162
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
walk(child);
|
|
163
|
+
const nested = findTreePageSlug(child, normalized);
|
|
164
|
+
if (nested) {
|
|
165
|
+
return nested;
|
|
143
166
|
}
|
|
144
167
|
}
|
|
168
|
+
return null;
|
|
145
169
|
}
|
|
146
|
-
|
|
147
|
-
|
|
170
|
+
return search(node.children);
|
|
171
|
+
}
|
|
172
|
+
export function collectParentOfEdges(_tree) {
|
|
173
|
+
return [];
|
|
148
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justyork/repo-mind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Unified docs/ workspace for humans (UI) and AI agents (MCP) — Confluence in your repo",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"test:watch": "vitest",
|
|
19
19
|
"ab-demo": "npm run build --silent && node dist/ab-demo/run-ab.js --dry-run",
|
|
20
20
|
"ab-demo:run": "npm run build --silent && node dist/ab-demo/run-ab.js",
|
|
21
|
+
"ab-eval:live": "npm run build --silent && node dist/cli.js ab-eval",
|
|
21
22
|
"prepublishOnly": "npm run build"
|
|
22
23
|
},
|
|
23
24
|
"engines": {
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
40
|
+
"@tiptap/extension-bubble-menu": "^2.27.2",
|
|
39
41
|
"better-sqlite3": "^12.11.1",
|
|
40
42
|
"chokidar": "^4.0.3",
|
|
41
43
|
"fast-glob": "^3.3.3",
|
|
@@ -45,9 +47,14 @@
|
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@tiptap/core": "^2.27.2",
|
|
50
|
+
"@tiptap/extension-code-block": "^2.27.2",
|
|
48
51
|
"@tiptap/extension-image": "^2.27.2",
|
|
49
52
|
"@tiptap/extension-link": "^2.27.2",
|
|
50
53
|
"@tiptap/extension-placeholder": "^2.27.2",
|
|
54
|
+
"@tiptap/extension-table": "^2.27.2",
|
|
55
|
+
"@tiptap/extension-table-cell": "^2.27.2",
|
|
56
|
+
"@tiptap/extension-table-header": "^2.27.2",
|
|
57
|
+
"@tiptap/extension-table-row": "^2.27.2",
|
|
51
58
|
"@tiptap/extension-task-item": "^2.27.2",
|
|
52
59
|
"@tiptap/extension-task-list": "^2.27.2",
|
|
53
60
|
"@tiptap/pm": "^2.27.2",
|
|
@@ -55,6 +62,7 @@
|
|
|
55
62
|
"@types/better-sqlite3": "^7.6.13",
|
|
56
63
|
"@types/node": "^22.15.21",
|
|
57
64
|
"d3": "^7.9.0",
|
|
65
|
+
"lucide": "^1.21.0",
|
|
58
66
|
"marked": "^15.0.12",
|
|
59
67
|
"typescript": "^5.8.3",
|
|
60
68
|
"vite": "^6.3.5",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-
|
|
1
|
+
import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-CIyMeT5H.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,B,a){var O=I-l,i=D-h,n=B-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 V(l,h,I,D,v,A,B){var a=l-I,O=h-D,i=(B?A:-A)/K(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,C=(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)*K(on(0,T*T*R-P*P)),$=(P*g-m*S)/R,j=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=$-C,e=j-t,r=w-C,F=p-t;return x*x+e*e>r*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=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)-un,c=A.apply(this,arguments)-un,C=rn(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(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(C<an)if(E=pn(H,J,W,X,Q,U,M,N)){var Y=H-E[0],Z=J-E[1],b=Q-E[0],k=U-E[1],nn=1/q(fn((Y*b+Z*k)/(K(Y*Y+Z*Z)*K(b*b+k*k)))/2),en=K(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=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,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(H,J),a.arc(0,0,s,m,g,!t)):a.moveTo(H,J),!(u>y)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,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-an/2;return[G(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:z(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:z(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:z(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:z(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:z(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:z(+n),i):A},i.padAngle=function(n){return arguments.length?(B=typeof n=="function"?n:z(+n),i):B},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|