@webskill/sdk 0.21.0 → 0.22.0

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 (132) hide show
  1. package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +1012 -130
  4. package/dist/{approval-DwN2o2QG.js → approval-DWQlDPbY.js} +102 -16
  5. package/dist/arc-8U_6NQWm.js +130 -0
  6. package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
  7. package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
  8. package/dist/array-DQfpQNY8.js +8 -0
  9. package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
  10. package/dist/browser.d.ts +444 -48
  11. package/dist/browser.js +1771 -91
  12. package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
  13. package/dist/channel-CZxxLrG7.js +9 -0
  14. package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
  15. package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
  16. package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
  17. package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
  18. package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
  19. package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
  20. package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
  21. package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
  22. package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
  23. package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
  24. package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
  25. package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
  26. package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
  27. package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
  28. package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
  29. package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
  30. package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
  31. package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
  32. package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
  33. package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
  34. package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
  35. package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
  36. package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
  37. package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
  38. package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
  39. package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
  40. package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
  41. package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
  42. package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
  43. package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
  44. package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
  45. package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
  46. package/dist/defaultLocale-B_EoOkSF.js +249 -0
  47. package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
  48. package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
  49. package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
  50. package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
  51. package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
  52. package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
  53. package/dist/dist-UajCDt3n.js +92 -0
  54. package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
  55. package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
  56. package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
  57. package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
  58. package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
  59. package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
  60. package/dist/{toolSource-C9oNuKmr.js → geometry-wx5ZTYzi.js} +162 -12
  61. package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
  62. package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
  63. package/dist/governance.d.ts +3 -3
  64. package/dist/graphlib-tk9gQYuN.js +4194 -0
  65. package/dist/{index-B8Tgmpwh.d.ts → index-BiO9_XRk.d.ts} +2 -2
  66. package/dist/{index-CYLt5u4L.d.ts → index-CjwdZQOS.d.ts} +700 -12
  67. package/dist/{index-DHopiH_m.d.ts → index-YPd8ZSEa.d.ts} +156 -9
  68. package/dist/index.d.ts +4 -4
  69. package/dist/index.js +6 -6
  70. package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
  71. package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
  72. package/dist/init-CMOIWdg-.js +16 -0
  73. package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
  74. package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
  75. package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
  76. package/dist/katex-BcRRvyh_.js +26465 -0
  77. package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
  78. package/dist/line-LgV8iVMV.js +48 -0
  79. package/dist/linear-BWKR0Tqd.js +393 -0
  80. package/dist/linkedDocument-CIuh_Yp0.js +416 -0
  81. package/dist/mcp.d.ts +2 -2
  82. package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
  83. package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
  84. package/dist/mermaid.core-DMtwGCHy.js +1756 -0
  85. package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
  86. package/dist/node.d.ts +3 -3
  87. package/dist/node.js +2 -2
  88. package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
  89. package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
  90. package/dist/ordinal-CxA6GHQS.js +84 -0
  91. package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
  92. package/dist/path-C27Z2Bjv.js +106 -0
  93. package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
  94. package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
  95. package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
  96. package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
  97. package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
  98. package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
  99. package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
  100. package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
  101. package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
  102. package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
  103. package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
  104. package/dist/rough.cjs-AmDd_NQk.js +1395 -0
  105. package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
  106. package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
  107. package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
  108. package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
  109. package/dist/src-NkhI3UMl.js +2653 -0
  110. package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
  111. package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
  112. package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
  113. package/dist/testing.d.ts +2 -1
  114. package/dist/testing.js +1 -1
  115. package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
  116. package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
  117. package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
  118. package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +59 -8
  119. package/dist/ui-react.d.ts +3 -3
  120. package/dist/ui-react.js +3718 -77
  121. package/dist/ui-vue.d.ts +1 -1
  122. package/dist/ui.d.ts +3 -3
  123. package/dist/ui.js +2 -2
  124. package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
  125. package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
  126. package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
  127. package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
  128. package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-Dy-Zjv0y.js} +1 -1
  129. package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
  130. package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
  131. package/package.json +1 -1
  132. package/dist/linkedDocument-C0gj1sMq.js +0 -245
package/dist/node.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { At as UnsignedPolicy, Dt as TrustedKeyStore, H as FileStat, Mt as VerifyResult, N as ArchiveLimits, S as UiBridge, U as FileSystemProvider, W as FileWriteStream, _t as SkillManagerPort, b as RenderResultRequest, c as InteractionResponse, et as SKILLS_LOCKFILE, mt as SkillInstallSource, ot as SignatureAuditSink, q as JsonSchema, s as InteractionRequest, tt as SKILL_MANIFEST_FILE, vt as SkillManifest, wt as SkillsLockfile } from "./types-BvTV_05--BW8zDuEk.js";
2
- import { H as FsMemoryStore, Jt as SchemaInferer, Sn as ToolDefinition, Tn as ToolResult, V as FsArtifactStore, Xt as ScriptExecutor, Yt as ScriptExecutionContext, ar as WebSkillRuntime, ct as NetworkPolicy, hr as createScriptContext, m as ApprovalScope, or as WebSkillRuntimeDeps, y as BridgeCapabilities } from "./index-DHopiH_m.js";
3
- import { a as AuditLog, b as SkillVersionStore, d as CandidateSkill, m as CandidateStore, r as ApprovalPolicy } from "./skillVersionStore-B24Jjjry-BkOk9wI_.js";
1
+ import { G as FileStat, It as VerifyResult, K as FileSystemProvider, N as ArchiveLimits, Ot as SkillsLockfile, Pt as UnsignedPolicy, S as UiBridge, St as SkillManifest, X as JsonSchema, at as SKILL_MANIFEST_FILE, b as RenderResultRequest, c as InteractionResponse, it as SKILLS_LOCKFILE, jt as TrustedKeyStore, q as FileWriteStream, s as InteractionRequest, ut as SignatureAuditSink, vt as SkillInstallSource, xt as SkillManagerPort } from "./types-CpDRZ0rA-BM5FI9oN.js";
2
+ import { $t as SchemaInferer, H as FsArtifactStore, Pn as ToolResult, Tr as createScriptContext, U as FsMemoryStore, b as BridgeCapabilities, en as ScriptExecutionContext, gr as WebSkillRuntimeDeps, hr as WebSkillRuntime, jn as ToolDefinition, m as ApprovalScope, tn as ScriptExecutor, ut as NetworkPolicy } from "./index-YPd8ZSEa.js";
3
+ import { a as AuditLog, b as SkillVersionStore, d as CandidateSkill, m as CandidateStore, r as ApprovalPolicy } from "./skillVersionStore-B24Jjjry-BY1H7Krp.js";
4
4
  import { n as LlmEnvConfig, s as probeLlmCapabilities, t as LlmCapabilities } from "./env-AK3cSMEA-Dli6QU5E.js";
5
5
  import { Readable, Writable } from "node:stream";
6
6
  //#region ../node/dist/index.d.ts
package/dist/node.js CHANGED
@@ -2,8 +2,8 @@ import { n as messageOf, t as WebSkillError } from "./errors-BDZNpC13.js";
2
2
  import { A as SKILL_MANIFEST_FILE, D as verifySkillSignature, M as buildManifest, O as MANIFEST_EXCLUDED_FILES, P as verifyManifest, b as parseSkillMarkdown, c as unzipWithLimits, f as SKILL_PACK_FILE, k as SKILLS_LOCKFILE, m as parseSkillPackManifest, o as readResponseWithLimit, p as exportSkills, s as resolveArchiveLimits, t as validateSkills, w as readSkillSignature, y as isValidSkillName } from "./skill-CAJMsLod.js";
3
3
  import { a as atomicWriteText, o as isAtomicTempPath, r as resolveInsideRoot, t as assertSafePathSegment } from "./pathSecurity-B1owvJAF.js";
4
4
  import { t as assertRemoteUrlAllowed } from "./urlSafety-CiSuCJvX.js";
5
- import { K as createScriptContext, a as networkPolicyLibSource, c as bridgeError, d as FsMemoryStore, f as WebSkillRuntime, l as parseBridgeRequest, r as normalizeToolError, s as UPLOAD_FILES_UNAVAILABLE, t as CapabilityApproval, u as FsArtifactStore } from "./approval-DwN2o2QG.js";
6
- import { u as SPREADSHEET_MIME_TYPE } from "./linkedDocument-C0gj1sMq.js";
5
+ import { K as createScriptContext, a as networkPolicyLibSource, c as bridgeError, d as FsMemoryStore, f as WebSkillRuntime, l as parseBridgeRequest, r as normalizeToolError, s as UPLOAD_FILES_UNAVAILABLE, t as CapabilityApproval, u as FsArtifactStore } from "./approval-DWQlDPbY.js";
6
+ import { f as SPREADSHEET_MIME_TYPE } from "./linkedDocument-CIuh_Yp0.js";
7
7
  import { n as normalizeToolContent } from "./external-_ZRQe-V9.js";
8
8
  import { i as probeLlmCapabilities } from "./env-Bj1MI2Ww.js";
9
9
  import { t as AUDIT_EVENT_TYPES } from "./eventTypes-DcTQXSV1.js";
@@ -1,4 +1,4 @@
1
- import { g as uiCatalog } from "./openUiSpecLang-CLXJEeRU.js";
1
+ import { g as uiCatalog } from "./openUiSpecLang-BSYYnjay.js";
2
2
  import { t as CatalogNode } from "./ui-react.js";
3
3
  import { Renderer, createLibrary, defineComponent } from "./dist-CTsxblSD.js";
4
4
  import { z } from "zod";
@@ -1286,7 +1286,7 @@ const uiCatalog = defineUiCatalog({
1286
1286
  {
1287
1287
  name: "Image",
1288
1288
  group: "content",
1289
- description: "An image the host already serves. `src` must be same-origin or a data URL remote URLs are rejected by policy, so never link to an image you found on the web. `alt` is required: it is what a screen reader and a later model read instead of the pixels.",
1289
+ description: "An image the host already serves. `src` must be same-origin or a data URL; a reference from an image tool (`artifact:…`) is not a path. To show an image you found on the web, write markdown in your reply instead of using this component. `alt` is required: a screen reader and a later model read it instead of the pixels, so describe only what you have actually seen.",
1290
1290
  props: z.object({
1291
1291
  src: imageSrc,
1292
1292
  alt: z.string(),
@@ -0,0 +1,84 @@
1
+ import { t as initRange } from "./init-CMOIWdg-.js";
2
+
3
+ //#region ../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js
4
+ var InternMap = class extends Map {
5
+ constructor(entries, key = keyof) {
6
+ super();
7
+ Object.defineProperties(this, {
8
+ _intern: { value: /* @__PURE__ */ new Map() },
9
+ _key: { value: key }
10
+ });
11
+ if (entries != null) for (const [key, value] of entries) this.set(key, value);
12
+ }
13
+ get(key) {
14
+ return super.get(intern_get(this, key));
15
+ }
16
+ has(key) {
17
+ return super.has(intern_get(this, key));
18
+ }
19
+ set(key, value) {
20
+ return super.set(intern_set(this, key), value);
21
+ }
22
+ delete(key) {
23
+ return super.delete(intern_delete(this, key));
24
+ }
25
+ };
26
+ function intern_get({ _intern, _key }, value) {
27
+ const key = _key(value);
28
+ return _intern.has(key) ? _intern.get(key) : value;
29
+ }
30
+ function intern_set({ _intern, _key }, value) {
31
+ const key = _key(value);
32
+ if (_intern.has(key)) return _intern.get(key);
33
+ _intern.set(key, value);
34
+ return value;
35
+ }
36
+ function intern_delete({ _intern, _key }, value) {
37
+ const key = _key(value);
38
+ if (_intern.has(key)) {
39
+ value = _intern.get(key);
40
+ _intern.delete(key);
41
+ }
42
+ return value;
43
+ }
44
+ function keyof(value) {
45
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
46
+ }
47
+
48
+ //#endregion
49
+ //#region ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js
50
+ const implicit = Symbol("implicit");
51
+ function ordinal() {
52
+ var index = new InternMap(), domain = [], range = [], unknown = implicit;
53
+ function scale(d) {
54
+ let i = index.get(d);
55
+ if (i === void 0) {
56
+ if (unknown !== implicit) return unknown;
57
+ index.set(d, i = domain.push(d) - 1);
58
+ }
59
+ return range[i % range.length];
60
+ }
61
+ scale.domain = function(_) {
62
+ if (!arguments.length) return domain.slice();
63
+ domain = [], index = new InternMap();
64
+ for (const value of _) {
65
+ if (index.has(value)) continue;
66
+ index.set(value, domain.push(value) - 1);
67
+ }
68
+ return scale;
69
+ };
70
+ scale.range = function(_) {
71
+ return arguments.length ? (range = Array.from(_), scale) : range.slice();
72
+ };
73
+ scale.unknown = function(_) {
74
+ return arguments.length ? (unknown = _, scale) : unknown;
75
+ };
76
+ scale.copy = function() {
77
+ return ordinal(domain, range).unknown(unknown);
78
+ };
79
+ initRange.apply(scale, arguments);
80
+ return scale;
81
+ }
82
+
83
+ //#endregion
84
+ export { ordinal as t };
@@ -0,0 +1,4 @@
1
+ import "./chunk-FOHPRMQF-Dkbp819z.js";
2
+ import { S as createPacketServices, x as PacketModule } from "./mermaid-parser.core-pYR5siSx.js";
3
+
4
+ export { createPacketServices };
@@ -0,0 +1,106 @@
1
+ //#region ../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js
2
+ const pi = Math.PI;
3
+ const tau = 2 * pi;
4
+ const epsilon = 1e-6;
5
+ const tauEpsilon = tau - epsilon;
6
+ function append(strings) {
7
+ this._ += strings[0];
8
+ for (let i = 1, n = strings.length; i < n; ++i) this._ += arguments[i] + strings[i];
9
+ }
10
+ function appendRound(digits) {
11
+ let d = Math.floor(digits);
12
+ if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
13
+ if (d > 15) return append;
14
+ const k = 10 ** d;
15
+ return function(strings) {
16
+ this._ += strings[0];
17
+ for (let i = 1, n = strings.length; i < n; ++i) this._ += Math.round(arguments[i] * k) / k + strings[i];
18
+ };
19
+ }
20
+ var Path = class {
21
+ constructor(digits) {
22
+ this._x0 = this._y0 = this._x1 = this._y1 = null;
23
+ this._ = "";
24
+ this._append = digits == null ? append : appendRound(digits);
25
+ }
26
+ moveTo(x, y) {
27
+ this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
28
+ }
29
+ closePath() {
30
+ if (this._x1 !== null) {
31
+ this._x1 = this._x0, this._y1 = this._y0;
32
+ this._append`Z`;
33
+ }
34
+ }
35
+ lineTo(x, y) {
36
+ this._append`L${this._x1 = +x},${this._y1 = +y}`;
37
+ }
38
+ quadraticCurveTo(x1, y1, x, y) {
39
+ this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
40
+ }
41
+ bezierCurveTo(x1, y1, x2, y2, x, y) {
42
+ this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
43
+ }
44
+ arcTo(x1, y1, x2, y2, r) {
45
+ x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
46
+ if (r < 0) throw new Error(`negative radius: ${r}`);
47
+ let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
48
+ if (this._x1 === null) this._append`M${this._x1 = x1},${this._y1 = y1}`;
49
+ else if (!(l01_2 > epsilon));
50
+ else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._append`L${this._x1 = x1},${this._y1 = y1}`;
51
+ else {
52
+ let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
53
+ if (Math.abs(t01 - 1) > epsilon) this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
54
+ this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
55
+ }
56
+ }
57
+ arc(x, y, r, a0, a1, ccw) {
58
+ x = +x, y = +y, r = +r, ccw = !!ccw;
59
+ if (r < 0) throw new Error(`negative radius: ${r}`);
60
+ let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
61
+ if (this._x1 === null) this._append`M${x0},${y0}`;
62
+ else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._append`L${x0},${y0}`;
63
+ if (!r) return;
64
+ if (da < 0) da = da % tau + tau;
65
+ if (da > tauEpsilon) this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
66
+ else if (da > epsilon) this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
67
+ }
68
+ rect(x, y, w, h) {
69
+ this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
70
+ }
71
+ toString() {
72
+ return this._;
73
+ }
74
+ };
75
+ function path() {
76
+ return new Path();
77
+ }
78
+ path.prototype = Path.prototype;
79
+
80
+ //#endregion
81
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js
82
+ function constant_default(x) {
83
+ return function constant() {
84
+ return x;
85
+ };
86
+ }
87
+
88
+ //#endregion
89
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js
90
+ function withPath(shape) {
91
+ let digits = 3;
92
+ shape.digits = function(_) {
93
+ if (!arguments.length) return digits;
94
+ if (_ == null) digits = null;
95
+ else {
96
+ const d = Math.floor(_);
97
+ if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
98
+ digits = d;
99
+ }
100
+ return shape;
101
+ };
102
+ return () => new Path(digits);
103
+ }
104
+
105
+ //#endregion
106
+ export { constant_default as n, withPath as t };
@@ -0,0 +1,115 @@
1
+ import { t as MermaidParseError, u as createRailroadPegServices } from "./mermaid-parser.core-pYR5siSx.js";
2
+ import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
3
+ import { m as log } from "./src-NkhI3UMl.js";
4
+ import "./chunk-O7XYJQB3-B6K0KOSL.js";
5
+ import "./chunk-6AEJRKK7-JXK89I-O.js";
6
+ import { n as getStyles, r as renderer, t as db } from "./chunk-GTNCS2PH-CLmh4I2c.js";
7
+ import { t as populateCommonDb } from "./chunk-JWPE2WC7-D1rC79GS.js";
8
+
9
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/pegDiagram-GJSIUBJH.mjs
10
+ var langiumParser = createRailroadPegServices().RailroadPeg.parser.LangiumParser;
11
+ var transformOrderedChoice = /* @__PURE__ */ __name((choice) => {
12
+ const alternatives = choice.alternatives.map(transformSequence);
13
+ if (alternatives.length === 1) return alternatives[0];
14
+ return {
15
+ type: "choice",
16
+ alternatives
17
+ };
18
+ }, "transformOrderedChoice");
19
+ var transformSequence = /* @__PURE__ */ __name((sequence) => {
20
+ const elements = sequence.elements.map(transformPrefix);
21
+ if (elements.length === 1) return elements[0];
22
+ return {
23
+ type: "sequence",
24
+ elements
25
+ };
26
+ }, "transformSequence");
27
+ var transformPrefix = /* @__PURE__ */ __name((prefix) => {
28
+ const inner = transformSuffix(prefix.suffix);
29
+ if (!prefix.operator) return inner;
30
+ return {
31
+ type: "special",
32
+ text: prefix.operator === "&" ? `&${nodeToLabel(inner)}` : `!${nodeToLabel(inner)}`
33
+ };
34
+ }, "transformPrefix");
35
+ var nodeToLabel = /* @__PURE__ */ __name((node) => {
36
+ switch (node.type) {
37
+ case "terminal": return `"${node.value}"`;
38
+ case "nonterminal": return node.name;
39
+ case "special": return node.text;
40
+ default: return "(...)";
41
+ }
42
+ }, "nodeToLabel");
43
+ var transformSuffix = /* @__PURE__ */ __name((suffix) => {
44
+ const inner = transformPrimary(suffix.primary);
45
+ if (!suffix.operator) return inner;
46
+ switch (suffix.operator) {
47
+ case "?": return {
48
+ type: "optional",
49
+ element: inner
50
+ };
51
+ case "*": return {
52
+ type: "repetition",
53
+ element: inner,
54
+ min: 0,
55
+ max: Infinity
56
+ };
57
+ case "+": return {
58
+ type: "repetition",
59
+ element: inner,
60
+ min: 1,
61
+ max: Infinity
62
+ };
63
+ default: throw new Error(`Unsupported PEG suffix operator: ${suffix.operator}`);
64
+ }
65
+ }, "transformSuffix");
66
+ var transformPrimary = /* @__PURE__ */ __name((primary) => {
67
+ switch (primary.$type) {
68
+ case "PegLiteral": return {
69
+ type: "terminal",
70
+ value: primary.value
71
+ };
72
+ case "PegIdentifier": return {
73
+ type: "nonterminal",
74
+ name: primary.name
75
+ };
76
+ case "PegGroup": return transformOrderedChoice(primary.element);
77
+ case "PegAny": return {
78
+ type: "special",
79
+ text: primary.dot
80
+ };
81
+ default: throw new Error(`Unsupported PEG primary node: ${primary.$type}`);
82
+ }
83
+ }, "transformPrimary");
84
+ var transformRule = /* @__PURE__ */ __name((rule) => {
85
+ return {
86
+ name: rule.name,
87
+ definition: transformOrderedChoice(rule.definition)
88
+ };
89
+ }, "transformRule");
90
+ var populateDb = /* @__PURE__ */ __name((ast) => {
91
+ populateCommonDb(ast, db);
92
+ if (ast.title) db.setTitle(ast.title);
93
+ ast.rules.map((rule) => db.addRule(transformRule(rule)));
94
+ }, "populateDb");
95
+ var diagram = {
96
+ parser: {
97
+ parse: /* @__PURE__ */ __name((input) => {
98
+ db.clear();
99
+ log.debug("[PEG Parser] Starting Langium parse");
100
+ const result = langiumParser.parse(input);
101
+ if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) throw new MermaidParseError(result);
102
+ const ast = result.value;
103
+ log.debug("[PEG Parser] Parsed rules:", ast.rules.length);
104
+ populateDb(ast);
105
+ log.debug("[PEG Parser] Parse complete");
106
+ }, "parse"),
107
+ parser: { yy: db }
108
+ },
109
+ db,
110
+ renderer,
111
+ styles: getStyles
112
+ };
113
+
114
+ //#endregion
115
+ export { diagram };
@@ -0,0 +1,4 @@
1
+ import "./chunk-FOHPRMQF-Dkbp819z.js";
2
+ import { b as createPieServices, y as PieModule } from "./mermaid-parser.core-pYR5siSx.js";
3
+
4
+ export { createPieServices };
@@ -0,0 +1,298 @@
1
+ import { n as parse } from "./mermaid-parser.core-pYR5siSx.js";
2
+ import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
3
+ import { m as log } from "./src-NkhI3UMl.js";
4
+ import { H as setAccDescription, U as setAccTitle, a as clear, c as configureSvgSize, f as defaultConfig_default, q as setDiagramTitle, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
5
+ import { t as ordinal } from "./ordinal-CxA6GHQS.js";
6
+ import { n as constant_default } from "./path-C27Z2Bjv.js";
7
+ import { m as tau } from "./dist-UajCDt3n.js";
8
+ import { t as arc_default } from "./arc-8U_6NQWm.js";
9
+ import { t as array_default } from "./array-DQfpQNY8.js";
10
+ import { i as cleanAndMerge, p as parseFontSize } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
11
+ import { t as selectSvgElement } from "./chunk-6AEJRKK7-JXK89I-O.js";
12
+ import { t as populateCommonDb } from "./chunk-JWPE2WC7-D1rC79GS.js";
13
+
14
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js
15
+ function descending_default(a, b) {
16
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
17
+ }
18
+
19
+ //#endregion
20
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js
21
+ function identity_default(d) {
22
+ return d;
23
+ }
24
+
25
+ //#endregion
26
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js
27
+ function pie_default() {
28
+ var value = identity_default, sortValues = descending_default, sort = null, startAngle = constant_default(0), endAngle = constant_default(tau), padAngle = constant_default(0);
29
+ function pie(data) {
30
+ var i, n = (data = array_default(data)).length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
31
+ for (i = 0; i < n; ++i) if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) sum += v;
32
+ if (sortValues != null) index.sort(function(i, j) {
33
+ return sortValues(arcs[i], arcs[j]);
34
+ });
35
+ else if (sort != null) index.sort(function(i, j) {
36
+ return sort(data[i], data[j]);
37
+ });
38
+ for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
39
+ data: data[j],
40
+ index: i,
41
+ value: v,
42
+ startAngle: a0,
43
+ endAngle: a1,
44
+ padAngle: p
45
+ };
46
+ return arcs;
47
+ }
48
+ pie.value = function(_) {
49
+ return arguments.length ? (value = typeof _ === "function" ? _ : constant_default(+_), pie) : value;
50
+ };
51
+ pie.sortValues = function(_) {
52
+ return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
53
+ };
54
+ pie.sort = function(_) {
55
+ return arguments.length ? (sort = _, sortValues = null, pie) : sort;
56
+ };
57
+ pie.startAngle = function(_) {
58
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : startAngle;
59
+ };
60
+ pie.endAngle = function(_) {
61
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : endAngle;
62
+ };
63
+ pie.padAngle = function(_) {
64
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : padAngle;
65
+ };
66
+ return pie;
67
+ }
68
+
69
+ //#endregion
70
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-5QR66LMP.mjs
71
+ var DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
72
+ var DEFAULT_PIE_DB = {
73
+ sections: /* @__PURE__ */ new Map(),
74
+ showData: false,
75
+ config: DEFAULT_PIE_CONFIG
76
+ };
77
+ var sections = DEFAULT_PIE_DB.sections;
78
+ var showData = DEFAULT_PIE_DB.showData;
79
+ var config = structuredClone(DEFAULT_PIE_CONFIG);
80
+ var db = {
81
+ getConfig: /* @__PURE__ */ __name(() => structuredClone(config), "getConfig"),
82
+ clear: /* @__PURE__ */ __name(() => {
83
+ sections = /* @__PURE__ */ new Map();
84
+ showData = DEFAULT_PIE_DB.showData;
85
+ clear();
86
+ }, "clear"),
87
+ setDiagramTitle,
88
+ getDiagramTitle,
89
+ setAccTitle,
90
+ getAccTitle,
91
+ setAccDescription,
92
+ getAccDescription,
93
+ addSection: /* @__PURE__ */ __name(({ label, value }) => {
94
+ if (value < 0) throw new Error(`"${label}" has invalid value: ${value}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);
95
+ if (!sections.has(label)) {
96
+ sections.set(label, value);
97
+ log.debug(`added new section: ${label}, with value: ${value}`);
98
+ }
99
+ }, "addSection"),
100
+ getSections: /* @__PURE__ */ __name(() => sections, "getSections"),
101
+ setShowData: /* @__PURE__ */ __name((toggle) => {
102
+ showData = toggle;
103
+ }, "setShowData"),
104
+ getShowData: /* @__PURE__ */ __name(() => showData, "getShowData")
105
+ };
106
+ var populateDb = /* @__PURE__ */ __name((ast, db2) => {
107
+ populateCommonDb(ast, db2);
108
+ db2.setShowData(ast.showData);
109
+ ast.sections.map(db2.addSection);
110
+ }, "populateDb");
111
+ var parser = { parse: /* @__PURE__ */ __name(async (input) => {
112
+ const ast = await parse("pie", input);
113
+ log.debug(ast);
114
+ populateDb(ast, db);
115
+ }, "parse") };
116
+ var pieStyles_default = /* @__PURE__ */ __name((options) => `
117
+ .pieCircle{
118
+ stroke: ${options.pieStrokeColor};
119
+ stroke-width : ${options.pieStrokeWidth};
120
+ opacity : ${options.pieOpacity};
121
+ }
122
+ .pieCircle.highlighted{
123
+ scale: 1.05;
124
+ opacity: 1;
125
+ }
126
+ .pieCircle.highlightedOnHover:hover{
127
+ transition-duration: 250ms;
128
+ scale: 1.05;
129
+ opacity: 1;
130
+ }
131
+ .pieOuterCircle{
132
+ stroke: ${options.pieOuterStrokeColor};
133
+ stroke-width: ${options.pieOuterStrokeWidth};
134
+ fill: none;
135
+ }
136
+ .pieTitleText {
137
+ text-anchor: middle;
138
+ font-size: ${options.pieTitleTextSize};
139
+ fill: ${options.pieTitleTextColor};
140
+ font-family: ${options.fontFamily};
141
+ }
142
+ .slice {
143
+ font-family: ${options.fontFamily};
144
+ fill: ${options.pieSectionTextColor};
145
+ font-size:${options.pieSectionTextSize};
146
+ // fill: white;
147
+ }
148
+ .legend text {
149
+ fill: ${options.pieLegendTextColor};
150
+ font-family: ${options.fontFamily};
151
+ font-size: ${options.pieLegendTextSize};
152
+ }
153
+ `, "getStyles");
154
+ var createPieArcs = /* @__PURE__ */ __name((sections2) => {
155
+ const sum = [...sections2.values()].reduce((acc, val) => acc + val, 0);
156
+ const pieData = [...sections2.entries()].map(([label, value]) => ({
157
+ label,
158
+ value
159
+ })).filter((d) => d.value / sum * 100 >= 1);
160
+ return pie_default().value((d) => d.value).sort(null)(pieData);
161
+ }, "createPieArcs");
162
+ var diagram = {
163
+ parser,
164
+ db,
165
+ renderer: { draw: /* @__PURE__ */ __name((text, id, _version, diagObj) => {
166
+ log.debug("rendering pie chart\n" + text);
167
+ const db2 = diagObj.db;
168
+ const globalConfig = getConfig2();
169
+ const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
170
+ const MARGIN = 40;
171
+ const LEGEND_RECT_SIZE = 18;
172
+ const LEGEND_SPACING = 4;
173
+ const height = 450;
174
+ const pieWidth = height;
175
+ const svg = selectSvgElement(id);
176
+ const group = svg.append("g");
177
+ group.attr("transform", "translate(225,225)");
178
+ const { themeVariables } = globalConfig;
179
+ let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
180
+ outerStrokeWidth ??= 2;
181
+ const legendPosition = pieConfig.legendPosition;
182
+ const textPosition = pieConfig.textPosition;
183
+ const innerHole = pieConfig.donutHole > 0 && pieConfig.donutHole <= .9 ? pieConfig.donutHole : 0;
184
+ const radius = Math.min(pieWidth, height) / 2 - MARGIN;
185
+ const arcGenerator = arc_default().innerRadius(innerHole * radius).outerRadius(radius);
186
+ const labelArcGenerator = arc_default().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
187
+ const pie = group.append("g");
188
+ pie.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
189
+ const sections2 = db2.getSections();
190
+ const arcs = createPieArcs(sections2);
191
+ const myGeneratedColors = [
192
+ themeVariables.pie1,
193
+ themeVariables.pie2,
194
+ themeVariables.pie3,
195
+ themeVariables.pie4,
196
+ themeVariables.pie5,
197
+ themeVariables.pie6,
198
+ themeVariables.pie7,
199
+ themeVariables.pie8,
200
+ themeVariables.pie9,
201
+ themeVariables.pie10,
202
+ themeVariables.pie11,
203
+ themeVariables.pie12
204
+ ];
205
+ let sum = 0;
206
+ sections2.forEach((section) => {
207
+ sum += section;
208
+ });
209
+ const filteredArcs = arcs.filter((datum) => (datum.data.value / sum * 100).toFixed(0) !== "0");
210
+ const color = ordinal(myGeneratedColors).domain([...sections2.keys()]);
211
+ pie.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
212
+ return color(datum.data.label);
213
+ }).attr("class", (datum) => {
214
+ let className = "pieCircle";
215
+ if (pieConfig.highlightSlice === "hover") className += " highlightedOnHover";
216
+ else if (pieConfig.highlightSlice === datum.data.label) className += " highlighted";
217
+ return className;
218
+ });
219
+ pie.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum) => {
220
+ return (datum.data.value / sum * 100).toFixed(0) + "%";
221
+ }).attr("transform", (datum) => {
222
+ return "translate(" + labelArcGenerator.centroid(datum) + ")";
223
+ }).style("text-anchor", "middle").attr("class", "slice");
224
+ const titleText = group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
225
+ const allSectionData = [...sections2.entries()].map(([label, value]) => ({
226
+ label,
227
+ value
228
+ }));
229
+ const legend = group.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend");
230
+ legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d) => color(d.label)).style("stroke", (d) => color(d.label));
231
+ legend.append("text").attr("x", 22).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d) => {
232
+ if (db2.getShowData()) return `${d.label} [${d.value}]`;
233
+ return d.label;
234
+ });
235
+ const longestTextWidth = Math.max(...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0));
236
+ let chartAndLegendHeight = height;
237
+ let chartAndLegendWidth = 490;
238
+ const legendHeight = 22;
239
+ const totalLegendHeight = allSectionData.length * legendHeight;
240
+ switch (legendPosition) {
241
+ case "center":
242
+ legend.attr("transform", (_datum, index) => {
243
+ const offset = legendHeight * allSectionData.length / 2;
244
+ const horizontal = -longestTextWidth / 2 - 22;
245
+ const vertical = index * legendHeight - offset;
246
+ return "translate(" + horizontal + "," + vertical + ")";
247
+ });
248
+ break;
249
+ case "top":
250
+ chartAndLegendHeight += totalLegendHeight;
251
+ legend.attr("transform", (_datum, index) => {
252
+ const offset = radius;
253
+ return `translate(${-longestTextWidth / 2 - 22}, ${index * legendHeight - offset})`;
254
+ });
255
+ pie.attr("transform", () => {
256
+ return `translate(0, ${totalLegendHeight + legendHeight})`;
257
+ });
258
+ break;
259
+ case "bottom":
260
+ chartAndLegendHeight += totalLegendHeight;
261
+ legend.attr("transform", (_datum, index) => {
262
+ const offset = -185 - legendHeight;
263
+ const horizontal = -longestTextWidth / 2 - 22;
264
+ const vertical = index * legendHeight - offset;
265
+ return "translate(" + horizontal + "," + vertical + ")";
266
+ });
267
+ break;
268
+ case "left":
269
+ chartAndLegendWidth += 22 + longestTextWidth;
270
+ legend.attr("transform", (_datum, index) => {
271
+ const offset = legendHeight * allSectionData.length / 2;
272
+ return "translate(-207," + (index * legendHeight - offset) + ")";
273
+ });
274
+ pie.attr("transform", () => {
275
+ return `translate(${longestTextWidth + LEGEND_RECT_SIZE + LEGEND_SPACING}, 0)`;
276
+ });
277
+ break;
278
+ default:
279
+ chartAndLegendWidth += 22 + longestTextWidth;
280
+ legend.attr("transform", (_datum, index) => {
281
+ const offset = legendHeight * allSectionData.length / 2;
282
+ return "translate(216," + (index * legendHeight - offset) + ")";
283
+ });
284
+ break;
285
+ }
286
+ const titleWidth = titleText.node()?.getBoundingClientRect().width ?? 0;
287
+ const titleLeft = pieWidth / 2 - titleWidth / 2;
288
+ const titleRight = pieWidth / 2 + titleWidth / 2;
289
+ const viewBoxX = Math.min(0, titleLeft);
290
+ const totalWidth = Math.max(chartAndLegendWidth, titleRight) - viewBoxX;
291
+ svg.attr("viewBox", `${viewBoxX} 0 ${totalWidth} ${chartAndLegendHeight}`);
292
+ configureSvgSize(svg, chartAndLegendHeight, totalWidth, pieConfig.useMaxWidth);
293
+ }, "draw") },
294
+ styles: pieStyles_default
295
+ };
296
+
297
+ //#endregion
298
+ export { diagram };