@imenam/mcp-documentor 1.0.48 → 1.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +28 -0
  2. package/dist/src/gui-worker.js +64 -0
  3. package/dist/src/index.js +17 -0
  4. package/dist/src/tools/upload-image.d.ts +14 -0
  5. package/dist/src/tools/upload-image.js +55 -0
  6. package/dist/src/version.d.ts +1 -1
  7. package/dist/src/version.js +1 -1
  8. package/gui/dist/assets/{arc-CTYsyt8O.js → arc-CCHCB-wD.js} +1 -1
  9. package/gui/dist/assets/{architectureDiagram-3BPJPVTR-DZlN4H96.js → architectureDiagram-3BPJPVTR-CY9HTuIq.js} +1 -1
  10. package/gui/dist/assets/{blockDiagram-GPEHLZMM-CpaJkibY.js → blockDiagram-GPEHLZMM-BOVxufIP.js} +1 -1
  11. package/gui/dist/assets/{c4Diagram-AAUBKEIU-CDGS1weE.js → c4Diagram-AAUBKEIU-D4gw0Vvh.js} +1 -1
  12. package/gui/dist/assets/channel-V0oafPxe.js +1 -0
  13. package/gui/dist/assets/{chunk-2J33WTMH-CuMgV1D6.js → chunk-2J33WTMH-D9MZap0G.js} +1 -1
  14. package/gui/dist/assets/{chunk-4BX2VUAB-CEHgRUq7.js → chunk-4BX2VUAB-DZp7afnZ.js} +1 -1
  15. package/gui/dist/assets/{chunk-55IACEB6-6tr8Q1W0.js → chunk-55IACEB6--z45PUIk.js} +1 -1
  16. package/gui/dist/assets/{chunk-727SXJPM-DSSfV6KL.js → chunk-727SXJPM-BpzsGHwS.js} +1 -1
  17. package/gui/dist/assets/{chunk-AQP2D5EJ-R8f7y7yv.js → chunk-AQP2D5EJ-BHrif5nf.js} +1 -1
  18. package/gui/dist/assets/{chunk-FMBD7UC4-BCE20wtM.js → chunk-FMBD7UC4-BJnvL7mL.js} +1 -1
  19. package/gui/dist/assets/{chunk-ND2GUHAM-DgupqMMf.js → chunk-ND2GUHAM-B30rNlK9.js} +1 -1
  20. package/gui/dist/assets/{chunk-QZHKN3VN-BMFZ3LyJ.js → chunk-QZHKN3VN-C30k0U0w.js} +1 -1
  21. package/gui/dist/assets/classDiagram-4FO5ZUOK-BZlXnsXv.js +1 -0
  22. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-BZlXnsXv.js +1 -0
  23. package/gui/dist/assets/{cose-bilkent-S5V4N54A-D9Ycqw-t.js → cose-bilkent-S5V4N54A-D_ZPLp5P.js} +1 -1
  24. package/gui/dist/assets/{dagre-BM42HDAG-B7A8KGto.js → dagre-BM42HDAG-2XyC0YBj.js} +1 -1
  25. package/gui/dist/assets/{diagram-2AECGRRQ-G_5ac9_r.js → diagram-2AECGRRQ-fNv6yQF_.js} +1 -1
  26. package/gui/dist/assets/{diagram-5GNKFQAL-Bwz_BFLw.js → diagram-5GNKFQAL-BUlxr0NW.js} +1 -1
  27. package/gui/dist/assets/{diagram-KO2AKTUF-AmfFaYwM.js → diagram-KO2AKTUF-CtusNGfh.js} +1 -1
  28. package/gui/dist/assets/{diagram-LMA3HP47-DsKD5uSD.js → diagram-LMA3HP47-Dkq3FOEe.js} +1 -1
  29. package/gui/dist/assets/{diagram-OG6HWLK6-oJG62u_l.js → diagram-OG6HWLK6-rjhcMJNr.js} +1 -1
  30. package/gui/dist/assets/{erDiagram-TEJ5UH35-SfeP-wTX.js → erDiagram-TEJ5UH35-Bqmogkqv.js} +1 -1
  31. package/gui/dist/assets/{flowDiagram-I6XJVG4X-jyfZovtS.js → flowDiagram-I6XJVG4X-BcYYq0Bh.js} +1 -1
  32. package/gui/dist/assets/{ganttDiagram-6RSMTGT7-C8zYiIoI.js → ganttDiagram-6RSMTGT7-BGmJltMK.js} +1 -1
  33. package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-Dv3448yn.js → gitGraphDiagram-PVQCEYII-JIYjcd0T.js} +1 -1
  34. package/gui/dist/assets/{index-BMSuP895.js → index-BwW5YDD1.js} +97 -97
  35. package/gui/dist/assets/{index-BMeEsApC.css → index-Cbo0HWer.css} +1 -1
  36. package/gui/dist/assets/{infoDiagram-5YYISTIA-Pi421CIs.js → infoDiagram-5YYISTIA-CJKrfqe4.js} +1 -1
  37. package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-CvzRIrdD.js → ishikawaDiagram-YF4QCWOH-Bu4wBvlL.js} +1 -1
  38. package/gui/dist/assets/{journeyDiagram-JHISSGLW-DsswFnL1.js → journeyDiagram-JHISSGLW-B2CtojGV.js} +1 -1
  39. package/gui/dist/assets/{kanban-definition-UN3LZRKU-Nj06vg5t.js → kanban-definition-UN3LZRKU-CKbuCL_h.js} +1 -1
  40. package/gui/dist/assets/{linear-CZb3dpZ9.js → linear-BdHWi7h7.js} +1 -1
  41. package/gui/dist/assets/{mindmap-definition-RKZ34NQL-Dln5EwRu.js → mindmap-definition-RKZ34NQL-Dbf71zzi.js} +1 -1
  42. package/gui/dist/assets/{pieDiagram-4H26LBE5-gKM4HPvh.js → pieDiagram-4H26LBE5-P8RSqdBA.js} +1 -1
  43. package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-Cvjz68Gd.js → quadrantDiagram-W4KKPZXB-mVsJmQan.js} +1 -1
  44. package/gui/dist/assets/{requirementDiagram-4Y6WPE33-BD3oHWqe.js → requirementDiagram-4Y6WPE33-BfHNLWFb.js} +1 -1
  45. package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-cMevYFsY.js → sankeyDiagram-5OEKKPKP-CF28kVcG.js} +1 -1
  46. package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-hb2Eg0-m.js → sequenceDiagram-3UESZ5HK-Bvs2r29Y.js} +1 -1
  47. package/gui/dist/assets/{stateDiagram-AJRCARHV-BbEkAEkF.js → stateDiagram-AJRCARHV-Cbg-3kIx.js} +1 -1
  48. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-Cg1sS-MT.js +1 -0
  49. package/gui/dist/assets/{timeline-definition-PNZ67QCA-BRBWFoLB.js → timeline-definition-PNZ67QCA-ChYm8r8v.js} +1 -1
  50. package/gui/dist/assets/{vennDiagram-CIIHVFJN-DyPCqRB8.js → vennDiagram-CIIHVFJN-CPcYOWG6.js} +1 -1
  51. package/gui/dist/assets/{wardley-L42UT6IY-BdxkclIc.js → wardley-L42UT6IY-KWdiWaFE.js} +1 -1
  52. package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-2JEXUlHl.js → wardleyDiagram-YWT4CUSO-DAgBnDcZ.js} +1 -1
  53. package/gui/dist/assets/{xychartDiagram-2RQKCTM6-Bnvoiv2S.js → xychartDiagram-2RQKCTM6-DwOk_srp.js} +1 -1
  54. package/gui/dist/index.html +2 -2
  55. package/package.json +1 -1
  56. package/gui/dist/assets/channel-uV7SHt-q.js +0 -1
  57. package/gui/dist/assets/classDiagram-4FO5ZUOK-Ce9gIib_.js +0 -1
  58. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-Ce9gIib_.js +0 -1
  59. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-DJsGfWlC.js +0 -1
package/README.md CHANGED
@@ -13,6 +13,7 @@ Connect it to Cursor, Claude Desktop, or any MCP-compatible agent to let your AI
13
13
  - **GUI** — built-in web interface when a proxy is configured (`PROXY_URL`); without it, the GUI worker is not started
14
14
  - **Proxy-aware** — integrates with the [proxy-setup](https://github.com/Imena/proxy-setup) for GUI exposure
15
15
  - **Links & structure** — `check_links`, `get_doc_tree`, `move_doc`, and `git_diff_doc` for maintenance workflows
16
+ - **Image support** — upload images to a project's assets via `upload_image` (local file path) or directly from the GUI editor; images are stored per-project and rendered inline in the viewer and in PDF exports
16
17
 
17
18
  ## Installation
18
19
 
@@ -80,6 +81,33 @@ Optional `.env` at the package root (directory containing `package.json` discove
80
81
  | `check_links` | Validate `related_docs`, `doc://` links, and `#heading` anchors |
81
82
  | `list_projects` | List all documentation projects |
82
83
  | `set_project` | Switch the active project **for the GUI only** (not for MCP tools) |
84
+ | `upload_image` | Upload an image from a local file path to a project's assets; returns the markdown link to insert |
85
+
86
+ ## Images in documents
87
+
88
+ Images can be embedded in any documentation entry using standard markdown syntax:
89
+
90
+ ```markdown
91
+ ![alt text](/api/images/my-project/screenshot.png) <!-- local upload -->
92
+ ![alt text](https://example.com/diagram.png) <!-- external URL -->
93
+ ```
94
+
95
+ **Via the MCP tool** — use `upload_image` with the absolute path of the file on the server:
96
+
97
+ ```json
98
+ {
99
+ "filename": "screenshot.png",
100
+ "filePath": "/absolute/path/to/screenshot.png",
101
+ "alt": "Architecture diagram"
102
+ }
103
+ ```
104
+
105
+ The tool copies the file into `.docs-data/projects/{project}/assets/` and returns the ready-to-use markdown snippet.
106
+
107
+ **Via the GUI editor** — click the **🖼 Image** button in the editor toolbar to open the image panel:
108
+ - **Upload tab** — pick a local file; it is uploaded automatically and the markdown link is inserted at the cursor position
109
+ - **URL tab** — paste any external image URL; the markdown link is inserted at the cursor position
110
+ - **Project images gallery** — click any previously uploaded image to re-insert it
83
111
 
84
112
  ## Data Storage
85
113
 
@@ -543,6 +543,70 @@ app.get("/api/pdf", async (c) => {
543
543
  await browser.close();
544
544
  }
545
545
  });
546
+ // --- Images ---
547
+ const IMAGE_MIME = {
548
+ png: "image/png",
549
+ jpg: "image/jpeg",
550
+ jpeg: "image/jpeg",
551
+ gif: "image/gif",
552
+ webp: "image/webp",
553
+ svg: "image/svg+xml",
554
+ };
555
+ function sanitizeImageFilename(name) {
556
+ return name.replace(/[^a-zA-Z0-9._-]/g, "_");
557
+ }
558
+ function resolveImageFilename(assetsDir, baseName) {
559
+ const safe = sanitizeImageFilename(baseName);
560
+ if (!fs.existsSync(path.join(assetsDir, safe)))
561
+ return safe;
562
+ const ext = path.extname(safe);
563
+ const base = path.basename(safe, ext);
564
+ let i = 1;
565
+ while (fs.existsSync(path.join(assetsDir, `${base}-${i}${ext}`)))
566
+ i++;
567
+ return `${base}-${i}${ext}`;
568
+ }
569
+ app.post("/api/images", async (c) => {
570
+ const project = c.req.query("project");
571
+ if (!project)
572
+ return c.json({ error: "project is required" }, 400);
573
+ let body;
574
+ try {
575
+ body = await c.req.parseBody();
576
+ }
577
+ catch {
578
+ return c.json({ error: "Failed to parse multipart body" }, 400);
579
+ }
580
+ const file = body["file"];
581
+ if (!file || typeof file === "string")
582
+ return c.json({ error: "file field is required" }, 400);
583
+ const assetsDir = path.join(dataDir, "projects", project, "assets");
584
+ fs.mkdirSync(assetsDir, { recursive: true });
585
+ const finalName = resolveImageFilename(assetsDir, file.name ?? "image");
586
+ const buffer = Buffer.from(await file.arrayBuffer());
587
+ fs.writeFileSync(path.join(assetsDir, finalName), buffer);
588
+ return c.json({ url: `/api/images/${project}/${finalName}`, filename: finalName });
589
+ });
590
+ app.get("/api/images/:project", (c) => {
591
+ const project = c.req.param("project");
592
+ const assetsDir = path.join(dataDir, "projects", project, "assets");
593
+ if (!fs.existsSync(assetsDir))
594
+ return c.json([]);
595
+ const files = fs.readdirSync(assetsDir).filter((f) => /\.(png|jpe?g|gif|webp|svg)$/i.test(f));
596
+ return c.json(files.map((f) => ({ filename: f, url: `/api/images/${project}/${f}` })));
597
+ });
598
+ app.get("/api/images/:project/:filename", (c) => {
599
+ const project = c.req.param("project");
600
+ const filename = c.req.param("filename");
601
+ const filePath = path.join(dataDir, "projects", project, "assets", filename);
602
+ if (!fs.existsSync(filePath))
603
+ return c.notFound();
604
+ const ext = path.extname(filename).toLowerCase().slice(1);
605
+ const mime = IMAGE_MIME[ext] ?? "application/octet-stream";
606
+ return new Response(fs.readFileSync(filePath), {
607
+ headers: { "Content-Type": mime },
608
+ });
609
+ });
546
610
  // Static files
547
611
  app.use("/assets/*", serveStatic({ root: path.relative(process.cwd(), absoluteStaticRoot) }));
548
612
  function getHtmlBaseHref(appPath) {
package/dist/src/index.js CHANGED
@@ -37,6 +37,7 @@ import { restoreDocVersion } from "./tools/restore-doc-version.js";
37
37
  import { reindexEmbeddings } from "./tools/reindex-embeddings.js";
38
38
  import { prepareExportBundle } from "./tools/prepare-export-bundle.js";
39
39
  import { deleteExportBundle } from "./tools/delete-export-bundle.js";
40
+ import { uploadImage } from "./tools/upload-image.js";
40
41
  const __filename = fileURLToPath(import.meta.url);
41
42
  const __dirname = path.dirname(__filename);
42
43
  function findProjectRoot(startDir) {
@@ -972,6 +973,20 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
972
973
  required: ["id"],
973
974
  },
974
975
  },
976
+ {
977
+ name: "upload_image",
978
+ description: "Upload an image to a project's assets from a local file path and get back the markdown link to insert in a document. Returns the URL and a ready-to-use markdown snippet: ![alt](/api/images/{project}/{filename}).",
979
+ inputSchema: {
980
+ type: "object",
981
+ properties: {
982
+ filename: { type: "string", description: "Filename with extension, e.g. 'screenshot.png'" },
983
+ filePath: { type: "string", description: "Absolute path to the image file on the server" },
984
+ project: { type: "string", description: "Target project (defaults to current project)" },
985
+ alt: { type: "string", description: "Alt text for the markdown image link (optional)" },
986
+ },
987
+ required: ["filename", "filePath"],
988
+ },
989
+ },
975
990
  ],
976
991
  };
977
992
  });
@@ -1041,6 +1056,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1041
1056
  }
1042
1057
  return result;
1043
1058
  }
1059
+ case "upload_image":
1060
+ return await uploadImage(storageEngine, args);
1044
1061
  default:
1045
1062
  throw new Error(`Tool not found: ${name}`);
1046
1063
  }
@@ -0,0 +1,14 @@
1
+ import type { StorageEngine } from "../core/storage-engine.js";
2
+ export declare function uploadImage(storageEngine: StorageEngine, args: unknown): Promise<{
3
+ isError: boolean;
4
+ content: {
5
+ type: string;
6
+ text: string;
7
+ }[];
8
+ } | {
9
+ content: {
10
+ type: string;
11
+ text: string;
12
+ }[];
13
+ isError?: undefined;
14
+ }>;
@@ -0,0 +1,55 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { z } from "zod";
4
+ const UploadImageArgsSchema = z.object({
5
+ filename: z.string().min(1),
6
+ filePath: z.string(),
7
+ project: z.string().optional(),
8
+ alt: z.string().optional(),
9
+ });
10
+ function sanitizeFilename(name) {
11
+ return name.replace(/[^a-zA-Z0-9._-]/g, "_");
12
+ }
13
+ function resolveFilename(assetsDir, baseName) {
14
+ const safe = sanitizeFilename(baseName);
15
+ if (!fs.existsSync(path.join(assetsDir, safe)))
16
+ return safe;
17
+ const ext = path.extname(safe);
18
+ const base = path.basename(safe, ext);
19
+ let i = 1;
20
+ while (fs.existsSync(path.join(assetsDir, `${base}-${i}${ext}`)))
21
+ i++;
22
+ return `${base}-${i}${ext}`;
23
+ }
24
+ export async function uploadImage(storageEngine, args) {
25
+ try {
26
+ const validated = UploadImageArgsSchema.parse(args);
27
+ const config = storageEngine.getConfig();
28
+ const project = validated.project ?? config.currentProject;
29
+ if (!fs.existsSync(validated.filePath)) {
30
+ return {
31
+ isError: true,
32
+ content: [{ type: "text", text: `File not found: ${validated.filePath}` }],
33
+ };
34
+ }
35
+ const assetsDir = path.join(storageEngine.getDataDir(), "projects", project, "assets");
36
+ fs.mkdirSync(assetsDir, { recursive: true });
37
+ const finalName = resolveFilename(assetsDir, validated.filename);
38
+ fs.copyFileSync(validated.filePath, path.join(assetsDir, finalName));
39
+ const url = `/api/images/${project}/${finalName}`;
40
+ const alt = validated.alt ?? "";
41
+ const markdownLink = `![${alt}](${url})`;
42
+ return {
43
+ content: [
44
+ {
45
+ type: "text",
46
+ text: `Image uploaded successfully.\nFilename: ${finalName}\nURL: ${url}\nMarkdown: ${markdownLink}`,
47
+ },
48
+ ],
49
+ };
50
+ }
51
+ catch (err) {
52
+ const message = err instanceof Error ? err.message : String(err);
53
+ return { isError: true, content: [{ type: "text", text: `Error uploading image: ${message}` }] };
54
+ }
55
+ }
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.48";
1
+ export declare const APP_VERSION = "1.0.51";
@@ -1,2 +1,2 @@
1
1
  // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.48';
2
+ export const APP_VERSION = '1.0.51';
@@ -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-BMSuP895.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};
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-BwW5YDD1.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};