@life-exe/wiki-engine 0.1.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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/dist/analytics/index.d.ts +10 -0
  4. package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
  5. package/dist/chunks/arc-OroUeRL_.js +83 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
  7. package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
  8. package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
  9. package/dist/chunks/channel-Bdy1QZHo.js +5 -0
  10. package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
  11. package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
  12. package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
  13. package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
  14. package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
  15. package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
  16. package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
  17. package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
  18. package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
  19. package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
  20. package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
  21. package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
  22. package/dist/chunks/common-BJ4q25wy.js +12633 -0
  23. package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
  24. package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
  25. package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
  26. package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
  27. package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
  28. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  29. package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
  30. package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
  31. package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
  32. package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
  33. package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
  34. package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
  35. package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
  36. package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
  37. package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
  38. package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
  39. package/dist/chunks/index-f7Uzykhj.js +38262 -0
  40. package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
  41. package/dist/chunks/init-DjUOC4st.js +16 -0
  42. package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
  43. package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
  44. package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
  45. package/dist/chunks/katex-jHfnQmlp.js +11682 -0
  46. package/dist/chunks/layout-CgV9vOdp.js +1704 -0
  47. package/dist/chunks/linear-BzcaSMTS.js +259 -0
  48. package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
  49. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  50. package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
  51. package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
  52. package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
  53. package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
  54. package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
  55. package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
  56. package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
  57. package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
  58. package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
  59. package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
  60. package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
  61. package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
  62. package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
  63. package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
  64. package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
  65. package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
  66. package/dist/components/CodeBlock.d.ts +5 -0
  67. package/dist/components/CommunityLinks.d.ts +21 -0
  68. package/dist/components/CookieConsent.d.ts +2 -0
  69. package/dist/components/DocLinkCard.d.ts +6 -0
  70. package/dist/components/LecturePageView.d.ts +3 -0
  71. package/dist/components/MermaidDiagram.d.ts +3 -0
  72. package/dist/components/SearchPopup.d.ts +6 -0
  73. package/dist/components/WikiApp.d.ts +9 -0
  74. package/dist/components/WikiLayout.d.ts +2 -0
  75. package/dist/components/WikiPageView.d.ts +6 -0
  76. package/dist/components/ZoomableImage.d.ts +2 -0
  77. package/dist/context/LangContext.d.ts +2 -0
  78. package/dist/context/WikiContext.d.ts +18 -0
  79. package/dist/data.d.ts +8 -0
  80. package/dist/hooks/useLanguage.d.ts +4 -0
  81. package/dist/hooks/useTheme.d.ts +5 -0
  82. package/dist/hooks/useWiki.d.ts +2 -0
  83. package/dist/index.d.ts +24 -0
  84. package/dist/index.js +45 -0
  85. package/dist/languages/ue-cpp.d.ts +7 -0
  86. package/dist/languages/ue-cpp.js +21 -0
  87. package/dist/types.d.ts +119 -0
  88. package/dist/wiki-engine.css +1 -0
  89. package/package.json +76 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yuri Popov (life-exe)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # @life-exe/wiki-engine
2
+
3
+ Modern, high-performance documentation and wiki engine built with React, Vite, and Tailwind CSS.
4
+
5
+ Features:
6
+ - 📖 **Markdown & GFM Support**: Headings, tables, blockquotes, task lists, and custom callouts (`hint`, `warning`, `error`, `good`).
7
+ - 🌐 **Multilingual (RU / EN / Custom)**: Switch languages with persistent state and automatic fallback banners when a translation is missing.
8
+ - 🎨 **Dark / Light Theme**: Built-in theme switcher with system preference detection and localStorage persistence.
9
+ - 🔍 **Full-text Search (Ctrl+K)**: Instant snippet search across all sections and lectures with keyboard navigation.
10
+ - ↔️ **Resizable Sidebar**: Draggable width resizer with collapse/expand all and smooth collapse animation.
11
+ - 💻 **Syntax Highlighting & Copy**: Highlight.js integration with language badge, one-click code copying, and customizable language definitions (including Unreal Engine C++).
12
+ - 📊 **Mermaid Diagrams**: Interactive rendering of flowcharts, sequence diagrams, state machines, etc.
13
+ - 🔍 **Zoomable Images**: Click to zoom lightbox for screenshots and diagrams.
14
+ - 🔗 **Doc Link Cards**: Automatic rich preview cards for documentation links with caching.
15
+ - 🍪 **Cookie Consent & Analytics**: Built-in Google Analytics 4 integration with Google Consent Mode v2 and customizable privacy banner.
16
+
17
+ ---
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ # Using pnpm
23
+ pnpm add @life-exe/wiki-engine
24
+
25
+ # Using npm
26
+ npm install @life-exe/wiki-engine
27
+
28
+ # Directly from GitHub repository
29
+ pnpm add github:life-exe/UECppProWiki#master
30
+ ```
31
+
32
+ ### Peer Dependencies
33
+ Ensure you have the following installed in your project:
34
+ ```json
35
+ {
36
+ "dependencies": {
37
+ "react": ">=18.0.0",
38
+ "react-dom": ">=18.0.0",
39
+ "react-router-dom": ">=6.0.0"
40
+ }
41
+ }
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Quick Start (New Project)
47
+
48
+ ### 1. Structure your documentation folder
49
+
50
+ ```
51
+ my-project/
52
+ ├── docs/
53
+ │ ├── ru/
54
+ │ │ ├── README.md # Home page (RU)
55
+ │ │ ├── 01-intro.md # Section (RU)
56
+ │ │ └── 01-intro/
57
+ │ │ └── 01-getting-started.md # Sub-page/lecture (RU)
58
+ │ └── en/
59
+ │ ├── README.md # Home page (EN)
60
+ │ ├── 01-intro.md # Section (EN)
61
+ │ └── 01-intro/
62
+ │ └── 01-getting-started.md # Sub-page/lecture (EN)
63
+ ├── src/
64
+ │ ├── App.tsx
65
+ │ ├── wiki.config.tsx
66
+ │ ├── wikiData.ts
67
+ │ └── main.tsx
68
+ ```
69
+
70
+ ### 2. Prepare data loader (`src/wikiData.ts`)
71
+
72
+ ```ts
73
+ import { createWikiData } from "@life-exe/wiki-engine";
74
+
75
+ export const wikiData = createWikiData({
76
+ sectionsRu: import.meta.glob("../docs/ru/*.md", { query: "?raw", import: "default", eager: true }),
77
+ sectionsEn: import.meta.glob("../docs/en/*.md", { query: "?raw", import: "default", eager: true }),
78
+ lecturesRu: import.meta.glob("../docs/ru/*/*.md", { query: "?raw", import: "default", eager: true }),
79
+ lecturesEn: import.meta.glob("../docs/en/*/*.md", { query: "?raw", import: "default", eager: true }),
80
+ images: import.meta.glob("../docs/**/*.{png,jpg,jpeg,gif,svg}", { import: "default", eager: true }),
81
+ });
82
+ ```
83
+
84
+ ### 3. Create configuration (`src/wiki.config.tsx`)
85
+
86
+ ```tsx
87
+ import { defineWikiConfig } from "@life-exe/wiki-engine";
88
+
89
+ export const wikiConfig = defineWikiConfig({
90
+ brand: {
91
+ title: {
92
+ ru: "Моя База Знаний",
93
+ en: "My Knowledge Base",
94
+ },
95
+ homeLink: "/",
96
+ },
97
+ defaultLanguage: "ru",
98
+ supportedLanguages: ["ru", "en"],
99
+ categories: [
100
+ { id: "intro", label: { ru: "Введение", en: "Intro" }, from: "01", to: "01" },
101
+ { id: "guides", label: { ru: "Руководства", en: "Guides" }, from: "02", to: "99" },
102
+ ],
103
+ cookieConsent: {
104
+ enabled: true,
105
+ privacyPolicyUrl: "/privacy",
106
+ },
107
+ });
108
+ ```
109
+
110
+ ### 4. Render the App (`src/App.tsx`)
111
+
112
+ ```tsx
113
+ import { WikiApp } from "@life-exe/wiki-engine";
114
+ import "@life-exe/wiki-engine/style.css";
115
+ import { wikiConfig } from "./wiki.config";
116
+ import { wikiData } from "./wikiData";
117
+
118
+ export default function App() {
119
+ return <WikiApp config={wikiConfig} data={wikiData} />;
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Configuration API (`WikiConfig`)
126
+
127
+ | Option | Type | Description |
128
+ |---|---|---|
129
+ | `brand.title` | `string \| { ru?: string, en?: string } \| ReactNode` | Sidebar header title |
130
+ | `brand.logo` | `ReactNode` | Optional logo icon or image |
131
+ | `brand.homeLink` | `string` | Link on title click (default: `"/"`) |
132
+ | `defaultLanguage` | `string` | Initial language code (default: `"ru"`) |
133
+ | `supportedLanguages`| `string[]` | Array of languages (e.g. `["ru", "en"]` or `["en"]`). If length <= 1, language toggle is hidden |
134
+ | `categories` | `WikiCategoryConfig[]` | Groupings for sidebar navigation |
135
+ | `syntaxLanguages` | `Record<string, any>` | Custom highlight.js languages for lowlight / code blocks |
136
+ | `customComponents` | `Record<string, ComponentType>` | Custom React components usable in markdown (e.g. `<community-links />`) |
137
+ | `analytics` | `{ googleAnalyticsId?: string, linkerDomains?: string[] }` | Google Analytics 4 tracking |
138
+ | `cookieConsent` | `{ enabled?: boolean, privacyPolicyUrl?: string }` | Cookie consent popup |
139
+ | `enableSearch` | `boolean` | Enable or disable Ctrl+K search (default: `true`) |
140
+ | `enableThemeToggle` | `boolean` | Enable or disable Dark/Light theme button (default: `true`) |
141
+
142
+ ---
143
+
144
+ ## Category Matching
145
+
146
+ Categories can group sections in the sidebar in multiple ways:
147
+
148
+ ```ts
149
+ categories: [
150
+ // 1. By numeric prefix range (e.g. 01-about.md to 05-basics.md)
151
+ { label: "Basics", from: "01", to: "05" },
152
+
153
+ // 2. By regex pattern
154
+ { label: "Advanced", pattern: /^adv-/ },
155
+
156
+ // 3. By custom filter function
157
+ { label: "Special", filter: (page) => page.slug.includes("special") }
158
+ ]
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Unreal Engine C++ Support
164
+
165
+ To use Unreal Engine C++ keyword and type highlighting:
166
+
167
+ ```ts
168
+ import { ueLangs } from "@life-exe/wiki-engine/languages/ue-cpp";
169
+
170
+ export const wikiConfig = defineWikiConfig({
171
+ // ...
172
+ syntaxLanguages: ueLangs,
173
+ });
174
+ ```
175
+
176
+ ---
177
+
178
+ ## License
179
+
180
+ MIT
@@ -0,0 +1,10 @@
1
+ declare global {
2
+ interface Window {
3
+ dataLayer?: unknown[];
4
+ gtag?: (...args: unknown[]) => void;
5
+ }
6
+ }
7
+ export declare const initGA: (measurementId?: string, linkerDomains?: string[]) => void;
8
+ export declare const updateConsentState: (granted: boolean) => void;
9
+ export declare const trackPageView: (path: string, title?: string) => void;
10
+ export declare function AnalyticsTracker(): null;
@@ -0,0 +1,87 @@
1
+ import { g as p, r as u, d as a } from "./chunk-SVP7TREG-DN-ravNt.js";
2
+ import { p as f } from "./chunk-JWPE2WC7-BIokdAUW.js";
3
+ import { _ as n, l as o } from "./index-f7Uzykhj.js";
4
+ import { M as c, b as d } from "./cynefin-OW5HDTMX-Bzjecpt-.js";
5
+ var v = d().RailroadAbnf.parser.LangiumParser, l = /* @__PURE__ */ n((e) => {
6
+ const r = e.alternatives.map(g);
7
+ return r.length === 1 ? r[0] : {
8
+ type: "choice",
9
+ alternatives: r
10
+ };
11
+ }, "transformAlternation"), g = /* @__PURE__ */ n((e) => {
12
+ const r = e.elements.map(y);
13
+ return r.length === 1 ? r[0] : {
14
+ type: "sequence",
15
+ elements: r
16
+ };
17
+ }, "transformConcatenation"), b = /* @__PURE__ */ n((e) => {
18
+ if (e.includes("*")) {
19
+ const [t, s] = e.split("*"), i = t ? parseInt(t, 10) : 0, m = s ? parseInt(s, 10) : 1 / 0;
20
+ return { min: i, max: m };
21
+ }
22
+ const r = parseInt(e, 10);
23
+ return { min: r, max: r };
24
+ }, "parseRepeat"), y = /* @__PURE__ */ n((e) => {
25
+ const r = A(e.primary);
26
+ if (!e.repeat)
27
+ return r;
28
+ const { min: t, max: s } = b(e.repeat);
29
+ return t === 0 && s === 1 ? { type: "optional", element: r } : {
30
+ type: "repetition",
31
+ element: r,
32
+ min: t,
33
+ max: s
34
+ };
35
+ }, "transformElement"), A = /* @__PURE__ */ n((e) => {
36
+ switch (e.$type) {
37
+ case "AbnfStringLiteral":
38
+ return {
39
+ type: "terminal",
40
+ value: e.value
41
+ };
42
+ case "AbnfNumVal":
43
+ return {
44
+ type: "terminal",
45
+ value: e.value
46
+ };
47
+ case "AbnfRuleName":
48
+ return {
49
+ type: "nonterminal",
50
+ name: e.name
51
+ };
52
+ case "AbnfGroup":
53
+ return l(e.element);
54
+ case "AbnfOptionalGroup":
55
+ return {
56
+ type: "optional",
57
+ element: l(e.element)
58
+ };
59
+ default:
60
+ throw new Error(`Unsupported ABNF primary node: ${e.$type}`);
61
+ }
62
+ }, "transformPrimary"), P = /* @__PURE__ */ n((e) => ({
63
+ name: e.name,
64
+ definition: l(e.definition)
65
+ }), "transformRule"), h = /* @__PURE__ */ n((e) => {
66
+ f(e, a), e.title && a.setTitle(e.title), e.rules.map((r) => a.addRule(P(r)));
67
+ }, "populateDb"), R = {
68
+ parse: /* @__PURE__ */ n((e) => {
69
+ a.clear(), o.debug("[ABNF Parser] Starting Langium parse");
70
+ const r = v.parse(e);
71
+ if (r.lexerErrors.length > 0 || r.parserErrors.length > 0)
72
+ throw new c(r);
73
+ const t = r.value;
74
+ o.debug("[ABNF Parser] Parsed rules:", t.rules.length), h(t), o.debug("[ABNF Parser] Parse complete");
75
+ }, "parse"),
76
+ parser: {
77
+ yy: a
78
+ }
79
+ }, w = {
80
+ parser: R,
81
+ db: a,
82
+ renderer: u,
83
+ styles: p
84
+ };
85
+ export {
86
+ w as diagram
87
+ };
@@ -0,0 +1,83 @@
1
+ import { a3 as ln, a4 as an, a5 as g, a6 as tn, a7 as H, a8 as q, a9 as _, aa as un, ab as rn, ac as L, ad as o, ae as B, af as sn, ag as on, ah as fn } from "./index-f7Uzykhj.js";
2
+ function cn(l) {
3
+ return l.innerRadius;
4
+ }
5
+ function gn(l) {
6
+ return l.outerRadius;
7
+ }
8
+ function yn(l) {
9
+ return l.startAngle;
10
+ }
11
+ function dn(l) {
12
+ return l.endAngle;
13
+ }
14
+ function mn(l) {
15
+ return l && l.padAngle;
16
+ }
17
+ function pn(l, h, I, D, v, A, C, a) {
18
+ var O = I - l, i = D - h, n = C - v, d = a - A, u = d * O - n * i;
19
+ if (!(u * u < g))
20
+ return u = (n * (h - A) - d * (l - v)) / u, [l + u * O, h + u * i];
21
+ }
22
+ function W(l, h, I, D, v, A, C) {
23
+ 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, y = c - s, R = m * m + y * y, T = v - A, P = u * c - f * s, S = (y < 0 ? -1 : 1) * L(fn(0, T * T * R - P * P)), j = (P * y - m * S) / R, z = (-P * m - y * S) / R, w = (P * y + m * S) / R, p = (-P * m + y * S) / R, x = j - F, e = z - t, r = w - F, G = p - t;
24
+ return x * x + e * e > r * r + G * G && (j = w, z = p), {
25
+ cx: j,
26
+ cy: z,
27
+ x01: -n,
28
+ y01: -d,
29
+ x11: j * (v / T - 1),
30
+ y11: z * (v / T - 1)
31
+ };
32
+ }
33
+ function hn() {
34
+ var l = cn, h = gn, I = B(0), D = null, v = yn, A = dn, C = mn, a = null, O = ln(i);
35
+ function i() {
36
+ 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;
37
+ if (a || (a = n = O()), s < u && (d = s, s = u, u = d), !(s > g)) a.moveTo(0, 0);
38
+ else if (F > tn - g)
39
+ a.moveTo(s * H(f), s * q(f)), a.arc(0, 0, s, f, c, !t), u > g && (a.moveTo(u * H(c), u * q(c)), a.arc(0, 0, u, c, f, t));
40
+ else {
41
+ var m = f, y = c, R = f, T = c, P = F, S = F, j = C.apply(this, arguments) / 2, z = j > g && (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;
42
+ if (z > g) {
43
+ var G = sn(z / u * q(j)), M = sn(z / s * q(j));
44
+ (P -= G * 2) > g ? (G *= t ? 1 : -1, R += G, T -= G) : (P = 0, R = T = (f + c) / 2), (S -= M * 2) > g ? (M *= t ? 1 : -1, m += M, y -= M) : (S = 0, m = y = (f + c) / 2);
45
+ }
46
+ var J = s * H(m), K = s * q(m), N = u * H(T), Q = u * q(T);
47
+ if (w > g) {
48
+ var U = s * H(y), V = s * q(y), X = u * H(R), Y = u * q(R), E;
49
+ if (F < rn)
50
+ if (E = pn(J, K, X, Y, U, V, N, Q)) {
51
+ 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]);
52
+ p = _(w, (u - en) / (nn - 1)), x = _(w, (s - en) / (nn + 1));
53
+ } else
54
+ p = x = 0;
55
+ }
56
+ S > g ? x > g ? (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, y, !t)) : a.moveTo(J, K), !(u > g) || !(P > g) ? a.lineTo(N, Q) : p > g ? (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);
57
+ }
58
+ if (a.closePath(), n) return a = null, n + "" || null;
59
+ }
60
+ return i.centroid = function() {
61
+ var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, d = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - rn / 2;
62
+ return [H(d) * n, q(d) * n];
63
+ }, i.innerRadius = function(n) {
64
+ return arguments.length ? (l = typeof n == "function" ? n : B(+n), i) : l;
65
+ }, i.outerRadius = function(n) {
66
+ return arguments.length ? (h = typeof n == "function" ? n : B(+n), i) : h;
67
+ }, i.cornerRadius = function(n) {
68
+ return arguments.length ? (I = typeof n == "function" ? n : B(+n), i) : I;
69
+ }, i.padRadius = function(n) {
70
+ return arguments.length ? (D = n == null ? null : typeof n == "function" ? n : B(+n), i) : D;
71
+ }, i.startAngle = function(n) {
72
+ return arguments.length ? (v = typeof n == "function" ? n : B(+n), i) : v;
73
+ }, i.endAngle = function(n) {
74
+ return arguments.length ? (A = typeof n == "function" ? n : B(+n), i) : A;
75
+ }, i.padAngle = function(n) {
76
+ return arguments.length ? (C = typeof n == "function" ? n : B(+n), i) : C;
77
+ }, i.context = function(n) {
78
+ return arguments.length ? (a = n ?? null, i) : a;
79
+ }, i;
80
+ }
81
+ export {
82
+ hn as d
83
+ };