@imenam/mcp-documentor 1.0.43 → 1.0.48

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 (81) hide show
  1. package/dist/src/gui-worker.js +119 -1
  2. package/dist/src/index.js +42 -0
  3. package/dist/src/tools/search-docs.js +1 -1
  4. package/dist/src/version.d.ts +1 -1
  5. package/dist/src/version.js +1 -1
  6. package/gui/dist/assets/{arc-d6vCj415.js → arc-CTYsyt8O.js} +1 -1
  7. package/gui/dist/assets/architectureDiagram-3BPJPVTR-DZlN4H96.js +36 -0
  8. package/gui/dist/assets/blockDiagram-GPEHLZMM-CpaJkibY.js +132 -0
  9. package/gui/dist/assets/{c4Diagram-AHTNJAMY-1msrJILA.js → c4Diagram-AAUBKEIU-CDGS1weE.js} +1 -1
  10. package/gui/dist/assets/channel-uV7SHt-q.js +1 -0
  11. package/gui/dist/assets/{chunk-EDXVE4YY-C23agwGR.js → chunk-2J33WTMH-CuMgV1D6.js} +1 -1
  12. package/gui/dist/assets/{chunk-4BX2VUAB-CkLF885e.js → chunk-4BX2VUAB-CEHgRUq7.js} +1 -1
  13. package/gui/dist/assets/{chunk-55IACEB6-C7FEdpkb.js → chunk-55IACEB6-6tr8Q1W0.js} +1 -1
  14. package/gui/dist/assets/chunk-727SXJPM-DSSfV6KL.js +206 -0
  15. package/gui/dist/assets/chunk-AQP2D5EJ-R8f7y7yv.js +231 -0
  16. package/gui/dist/assets/{chunk-FMBD7UC4-CEhsfI5h.js → chunk-FMBD7UC4-BCE20wtM.js} +1 -1
  17. package/gui/dist/assets/{chunk-YZCP3GAM-CgmspmqH.js → chunk-ND2GUHAM-DgupqMMf.js} +1 -1
  18. package/gui/dist/assets/{chunk-QZHKN3VN-DdQZG0vY.js → chunk-QZHKN3VN-BMFZ3LyJ.js} +1 -1
  19. package/gui/dist/assets/classDiagram-4FO5ZUOK-Ce9gIib_.js +1 -0
  20. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-Ce9gIib_.js +1 -0
  21. package/gui/dist/assets/{cose-bilkent-S5V4N54A-56jCXyJj.js → cose-bilkent-S5V4N54A-D9Ycqw-t.js} +1 -1
  22. package/gui/dist/assets/dagre-BM42HDAG-B7A8KGto.js +4 -0
  23. package/gui/dist/assets/diagram-2AECGRRQ-G_5ac9_r.js +43 -0
  24. package/gui/dist/assets/diagram-5GNKFQAL-Bwz_BFLw.js +10 -0
  25. package/gui/dist/assets/diagram-KO2AKTUF-AmfFaYwM.js +3 -0
  26. package/gui/dist/assets/diagram-LMA3HP47-DsKD5uSD.js +24 -0
  27. package/gui/dist/assets/{diagram-G4DWMVQ6-DyZFSdHs.js → diagram-OG6HWLK6-oJG62u_l.js} +2 -2
  28. package/gui/dist/assets/{erDiagram-SMLLAGMA-AhWYISUY.js → erDiagram-TEJ5UH35-SfeP-wTX.js} +1 -1
  29. package/gui/dist/assets/{flowDiagram-DWJPFMVM-Br8z3zk6.js → flowDiagram-I6XJVG4X-jyfZovtS.js} +1 -1
  30. package/gui/dist/assets/{ganttDiagram-T4ZO3ILL-CBCeivaB.js → ganttDiagram-6RSMTGT7-C8zYiIoI.js} +4 -4
  31. package/gui/dist/assets/gitGraphDiagram-PVQCEYII-Dv3448yn.js +106 -0
  32. package/gui/dist/assets/graph--OzhPTMs.js +1 -0
  33. package/gui/dist/assets/{index-r9vO4oVD.js → index-BMSuP895.js} +119 -120
  34. package/gui/dist/assets/{index-S_CEg9ug.css → index-BMeEsApC.css} +1 -1
  35. package/gui/dist/assets/infoDiagram-5YYISTIA-Pi421CIs.js +2 -0
  36. package/gui/dist/assets/{ishikawaDiagram-UXIWVN3A-8hzonEtF.js → ishikawaDiagram-YF4QCWOH-CvzRIrdD.js} +1 -1
  37. package/gui/dist/assets/{journeyDiagram-VCZTEJTY-KRgQGKFH.js → journeyDiagram-JHISSGLW-DsswFnL1.js} +1 -1
  38. package/gui/dist/assets/{kanban-definition-6JOO6SKY-B8BnXjy5.js → kanban-definition-UN3LZRKU-Nj06vg5t.js} +1 -1
  39. package/gui/dist/assets/layout-SsrduOYp.js +1 -0
  40. package/gui/dist/assets/{linear-GvfAFEU8.js → linear-CZb3dpZ9.js} +1 -1
  41. package/gui/dist/assets/{mindmap-definition-QFDTVHPH-DLavNUck.js → mindmap-definition-RKZ34NQL-Dln5EwRu.js} +9 -9
  42. package/gui/dist/assets/pieDiagram-4H26LBE5-gKM4HPvh.js +30 -0
  43. package/gui/dist/assets/quadrantDiagram-W4KKPZXB-Cvjz68Gd.js +7 -0
  44. package/gui/dist/assets/{requirementDiagram-MS252O5E-_HRD8DRs.js → requirementDiagram-4Y6WPE33-BD3oHWqe.js} +1 -1
  45. package/gui/dist/assets/sankeyDiagram-5OEKKPKP-cMevYFsY.js +40 -0
  46. package/gui/dist/assets/sequenceDiagram-3UESZ5HK-hb2Eg0-m.js +162 -0
  47. package/gui/dist/assets/stateDiagram-AJRCARHV-BbEkAEkF.js +1 -0
  48. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-DJsGfWlC.js +1 -0
  49. package/gui/dist/assets/{timeline-definition-GMOUNBTQ-843gDlOd.js → timeline-definition-PNZ67QCA-BRBWFoLB.js} +1 -1
  50. package/gui/dist/assets/{vennDiagram-DHZGUBPP-36_WQJ2W.js → vennDiagram-CIIHVFJN-DyPCqRB8.js} +5 -5
  51. package/gui/dist/assets/wardley-L42UT6IY-BdxkclIc.js +161 -0
  52. package/gui/dist/assets/wardleyDiagram-YWT4CUSO-2JEXUlHl.js +78 -0
  53. package/gui/dist/assets/{xychartDiagram-5P7HB3ND-W-o516TZ.js → xychartDiagram-2RQKCTM6-Bnvoiv2S.js} +1 -1
  54. package/gui/dist/index.html +2 -2
  55. package/package.json +2 -1
  56. package/gui/dist/assets/_baseUniq-DZMSH6LY.js +0 -1
  57. package/gui/dist/assets/architectureDiagram-Q4EWVU46-DpjCbxl8.js +0 -36
  58. package/gui/dist/assets/blockDiagram-DXYQGD6D-CZIaNHcg.js +0 -132
  59. package/gui/dist/assets/channel-BFrTrLvs.js +0 -1
  60. package/gui/dist/assets/chunk-4TB4RGXK-D8CC2YNW.js +0 -206
  61. package/gui/dist/assets/chunk-OYMX7WX6-ilR6wRCK.js +0 -231
  62. package/gui/dist/assets/classDiagram-6PBFFD2Q-BZfAjuci.js +0 -1
  63. package/gui/dist/assets/classDiagram-v2-HSJHXN6E-BZfAjuci.js +0 -1
  64. package/gui/dist/assets/clone-yCXJEjsc.js +0 -1
  65. package/gui/dist/assets/dagre-KV5264BT-DGnxBfaO.js +0 -4
  66. package/gui/dist/assets/diagram-5BDNPKRD-DogE9xah.js +0 -10
  67. package/gui/dist/assets/diagram-MMDJMWI5-sWXZ6wCa.js +0 -43
  68. package/gui/dist/assets/diagram-TYMM5635-C7qkJ6-2.js +0 -24
  69. package/gui/dist/assets/gitGraphDiagram-UUTBAWPF-Cnlj4QP0.js +0 -106
  70. package/gui/dist/assets/graph-Cjti22ih.js +0 -1
  71. package/gui/dist/assets/infoDiagram-42DDH7IO-5N3Oyg5b.js +0 -2
  72. package/gui/dist/assets/layout-CeSYiiC6.js +0 -1
  73. package/gui/dist/assets/min-CkKufs6A.js +0 -1
  74. package/gui/dist/assets/pieDiagram-DEJITSTG-DHcucViZ.js +0 -30
  75. package/gui/dist/assets/quadrantDiagram-34T5L4WZ-DKJ9xm03.js +0 -7
  76. package/gui/dist/assets/sankeyDiagram-XADWPNL6-BheI7uAI.js +0 -10
  77. package/gui/dist/assets/sequenceDiagram-FGHM5R23-DWW_pOkZ.js +0 -157
  78. package/gui/dist/assets/stateDiagram-FHFEXIEX-CMInyUmC.js +0 -1
  79. package/gui/dist/assets/stateDiagram-v2-QKLJ7IA2-Dueg5g0Q.js +0 -1
  80. package/gui/dist/assets/wardley-RL74JXVD-DAuMNidq.js +0 -162
  81. package/gui/dist/assets/wardleyDiagram-NUSXRM2D-DPec4Dij.js +0 -20
@@ -6,10 +6,14 @@ import { ProxyClient } from "@imenam/mcp-gui-interface";
6
6
  import { IPCMessageSchema } from "../shared/schemas/doc.schema.js";
7
7
  import path from "path";
8
8
  import fs from "fs";
9
+ import { execFile } from "child_process";
10
+ import { promisify } from "util";
11
+ const execFileAsync = promisify(execFile);
9
12
  import { fileURLToPath } from "url";
10
13
  import { createLogger, setupLogging } from "@imenam/mcp-gui-interface";
11
14
  import matter from "gray-matter";
12
15
  import JSZip from "jszip";
16
+ import puppeteer from "puppeteer-core";
13
17
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
18
  function findProjectRoot(startDir) {
15
19
  let current = startDir;
@@ -48,6 +52,53 @@ const parentCheckInterval = setInterval(() => {
48
52
  process.exit(0);
49
53
  }
50
54
  }, 2000);
55
+ // undefined = not yet resolved ; null = not found ; string = path found
56
+ let cachedBrowserPath = undefined;
57
+ async function findSystemBrowser() {
58
+ if (cachedBrowserPath !== undefined)
59
+ return cachedBrowserPath;
60
+ const envPath = process.env.CHROMIUM_PATH?.trim();
61
+ if (envPath) {
62
+ if (fs.existsSync(envPath)) {
63
+ cachedBrowserPath = envPath;
64
+ return envPath;
65
+ }
66
+ logger.warn(`CHROMIUM_PATH is set but the file does not exist: ${envPath}`);
67
+ }
68
+ const candidates = [];
69
+ if (process.platform === 'win32') {
70
+ candidates.push('C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', 'C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe', 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe');
71
+ }
72
+ else if (process.platform === 'darwin') {
73
+ candidates.push('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome');
74
+ }
75
+ else {
76
+ candidates.push('/usr/bin/google-chrome', '/usr/bin/google-chrome-stable', '/usr/bin/chromium', '/usr/bin/chromium-browser', '/snap/bin/chromium');
77
+ }
78
+ for (const p of candidates) {
79
+ if (fs.existsSync(p)) {
80
+ cachedBrowserPath = p;
81
+ return p;
82
+ }
83
+ }
84
+ if (process.platform !== 'win32') {
85
+ for (const bin of ['google-chrome', 'google-chrome-stable', 'chromium', 'chromium-browser']) {
86
+ try {
87
+ const { stdout } = await execFileAsync('which', [bin]);
88
+ const result = stdout.trim();
89
+ if (result) {
90
+ cachedBrowserPath = result;
91
+ return result;
92
+ }
93
+ }
94
+ catch { /* not found */ }
95
+ }
96
+ }
97
+ cachedBrowserPath = null;
98
+ return null;
99
+ }
100
+ let localPort = 0;
101
+ let guiPublicUrl = '';
51
102
  const app = new Hono();
52
103
  let proxyClient = null;
53
104
  const sseControllers = new Set();
@@ -356,6 +407,16 @@ app.post("/api/search", async (c) => {
356
407
  return c.json({ error: result.error }, 500);
357
408
  return c.json(result.data);
358
409
  });
410
+ app.get("/api/file-section/*", async (c) => {
411
+ const docId = c.req.query("docId");
412
+ if (!docId)
413
+ return c.json({ error: "docId query param required" }, 400);
414
+ const filePath = decodeURIComponent(c.req.path.slice("/api/file-section/".length));
415
+ const result = await ipcRequest("GET_FILE_SECTION", { docId, filePath }, 8000);
416
+ if (result.error)
417
+ return c.json({ error: result.error }, 400);
418
+ return c.json(result.data);
419
+ });
359
420
  // Export bundles
360
421
  app.get("/api/export-bundles", (c) => {
361
422
  const bundlesPath = path.join(dataDir, "export-bundles.json");
@@ -429,6 +490,59 @@ app.get("/api/export-zip/:id", async (c) => {
429
490
  },
430
491
  });
431
492
  });
493
+ // PDF generation
494
+ app.get("/api/pdf", async (c) => {
495
+ const project = c.req.query('project');
496
+ const docId = c.req.query('docId');
497
+ const scale = Math.min(2, Math.max(0.1, Number(c.req.query('scale') ?? '1')));
498
+ if (!project || !docId) {
499
+ return c.json({ error: 'project and docId are required' }, 400);
500
+ }
501
+ const executablePath = await findSystemBrowser();
502
+ if (!executablePath) {
503
+ return c.json({
504
+ error: 'no_browser',
505
+ message: 'Aucun navigateur (Chrome, Edge ou Chromium) n\'a été trouvé sur ce système. Installez Google Chrome ou Chromium pour activer la génération PDF.',
506
+ }, 503);
507
+ }
508
+ const encodedPath = docId.split('/').map(encodeURIComponent).join('/');
509
+ // ?__pdf=1 force <base href="/"> côté serveur pour que les assets JS chargent correctement
510
+ // sans passer par le proxy (qui requiert une auth)
511
+ const url = `http://localhost:${localPort}/?__pdf=1#/${encodeURIComponent(project)}/${encodedPath}`;
512
+ let browser;
513
+ try {
514
+ browser = await puppeteer.launch({
515
+ executablePath,
516
+ headless: true,
517
+ args: ['--no-sandbox', '--disable-setuid-sandbox'],
518
+ });
519
+ const page = await browser.newPage();
520
+ await page.emulateMediaType('print');
521
+ await page.goto(url, { waitUntil: 'load', timeout: 15000 });
522
+ await page.waitForFunction(() => !!window.__pdfReady && (window.__mermaidPending ?? 0) === 0, { timeout: 15000 });
523
+ const pdfBuffer = await page.pdf({
524
+ format: 'A4',
525
+ scale,
526
+ printBackground: false,
527
+ margin: { top: '20mm', bottom: '20mm', left: '15mm', right: '15mm' },
528
+ });
529
+ return new Response(Buffer.from(pdfBuffer), {
530
+ status: 200,
531
+ headers: {
532
+ 'Content-Type': 'application/pdf',
533
+ 'Content-Disposition': `attachment; filename="${encodeURIComponent(docId.split('/').pop() ?? 'document')}.pdf"`,
534
+ },
535
+ });
536
+ }
537
+ catch (err) {
538
+ logger.error(`PDF generation failed: ${err.message}`);
539
+ return c.json({ error: 'pdf_generation_failed', message: err.message }, 500);
540
+ }
541
+ finally {
542
+ if (browser)
543
+ await browser.close();
544
+ }
545
+ });
432
546
  // Static files
433
547
  app.use("/assets/*", serveStatic({ root: path.relative(process.cwd(), absoluteStaticRoot) }));
434
548
  function getHtmlBaseHref(appPath) {
@@ -444,7 +558,9 @@ app.get("/*", (c, next) => {
444
558
  try {
445
559
  const indexPath = path.join(absoluteStaticRoot, "index.html");
446
560
  if (fs.existsSync(indexPath)) {
447
- const baseHref = getHtmlBaseHref(configuredAppPath);
561
+ // ?__pdf=1 : accès direct depuis Puppeteer — pas de préfixe proxy dans <base href>
562
+ const isPdfRender = c.req.query('__pdf') === '1';
563
+ const baseHref = isPdfRender ? '/' : getHtmlBaseHref(configuredAppPath);
448
564
  const html = fs
449
565
  .readFileSync(indexPath, "utf8")
450
566
  .replace("<head>", `<head>\n <base href="${baseHref}" />`);
@@ -494,7 +610,9 @@ async function startServer() {
494
610
  return;
495
611
  }
496
612
  const finalPort = result.port;
613
+ localPort = finalPort;
497
614
  const publicUrl = result.url || `${proxyUrl}${appPath}`;
615
+ guiPublicUrl = publicUrl;
498
616
  logger.info(`Registered with proxy. Public URL: ${publicUrl}, Local Port: ${finalPort}`);
499
617
  const cleanupProxy = async () => {
500
618
  if (proxyClient)
package/dist/src/index.js CHANGED
@@ -17,6 +17,7 @@ import { listDocs } from "./tools/list-docs.js";
17
17
  import { updateDoc } from "./tools/update-doc.js";
18
18
  import { searchDocs } from "./tools/search-docs.js";
19
19
  import { checkFreshness, computeFreshness } from "./tools/check-freshness.js";
20
+ import { findAndHashSection } from "./core/section-tracker.js";
20
21
  import { setProject } from "./tools/set-project.js";
21
22
  import { listProjects } from "./tools/list-projects.js";
22
23
  import { refreshFileSnapshot } from "./tools/refresh-file-snapshot.js";
@@ -137,6 +138,9 @@ function handleIPCMessage(msg) {
137
138
  else if (msg.type === "UPDATE_DOC") {
138
139
  handleUpdateDocIPC(msg);
139
140
  }
141
+ else if (msg.type === "GET_FILE_SECTION") {
142
+ handleGetFileSection(msg);
143
+ }
140
144
  else {
141
145
  logger.debug(`Unhandled message from GUI: ${msg.type}`);
142
146
  }
@@ -383,6 +387,44 @@ async function handleUpdateDocIPC(msg) {
383
387
  });
384
388
  }
385
389
  }
390
+ async function handleGetFileSection(msg) {
391
+ try {
392
+ const { docId, filePath } = msg.data;
393
+ const resolved = await storageEngine.resolveDoc(docId);
394
+ if (!resolved)
395
+ throw new Error("Doc not found");
396
+ const trackedFile = resolved.doc.tracked_files.find((f) => f.path === filePath);
397
+ if (!trackedFile || !trackedFile.sections?.length)
398
+ throw new Error("No sections for this file");
399
+ const absolutePath = path.resolve(process.cwd(), filePath);
400
+ const fileLines = fs.readFileSync(absolutePath, "utf-8").split("\n");
401
+ const sections = trackedFile.sections.map((section) => {
402
+ const result = findAndHashSection(absolutePath, section);
403
+ if (!result.found)
404
+ return null;
405
+ const { start, end } = result.lines;
406
+ return {
407
+ start,
408
+ end,
409
+ code: fileLines.slice(start - 1, end).join("\n"),
410
+ };
411
+ }).filter(Boolean);
412
+ broadcastToGUI({
413
+ type: "GET_FILE_SECTION_RESPONSE",
414
+ correlationId: msg.correlationId,
415
+ data: { sections, filePath },
416
+ timestamp: new Date().toISOString(),
417
+ });
418
+ }
419
+ catch (err) {
420
+ broadcastToGUI({
421
+ type: "GET_FILE_SECTION_RESPONSE",
422
+ correlationId: msg.correlationId,
423
+ error: err.message,
424
+ timestamp: new Date().toISOString(),
425
+ });
426
+ }
427
+ }
386
428
  async function handleCheckFreshness(msg) {
387
429
  try {
388
430
  const resolved = await storageEngine.resolveDoc(msg.data.id ?? msg.data.path);
@@ -13,7 +13,7 @@ export async function searchDocs(storageEngine, embeddingEngine, args) {
13
13
  return { content: [{ type: "text", text: "No matching documentation entries found." }] };
14
14
  }
15
15
  const lines = results.map((r, i) => {
16
- const projectTag = r.project && r.project !== config.currentProject ? ` _(project: ${r.project})_` : "";
16
+ const projectTag = r.project ? ` _(project: ${r.project})_` : "";
17
17
  return `${i + 1}. **${r.title}** [${r.id}]${projectTag} — score: ${(r.score * 100).toFixed(1)}%\n ${r.excerpt}...`;
18
18
  });
19
19
  return {
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.43";
1
+ export declare const APP_VERSION = "1.0.48";
@@ -1,2 +1,2 @@
1
1
  // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.43';
2
+ export const APP_VERSION = '1.0.48';
@@ -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-r9vO4oVD.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-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};