@umami/shiso 1.12.0 → 1.13.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.
- package/dist/chunks/App.js +76 -49
- package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
- package/dist/chunks/arc.js +130 -0
- package/dist/chunks/architecture-7GRP2DOG.js +4 -0
- package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
- package/dist/chunks/array.js +8 -0
- package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
- package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
- package/dist/chunks/channel.js +9 -0
- package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
- package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
- package/dist/chunks/chunk-5VM5RSS4.js +21 -0
- package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
- package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
- package/dist/chunks/chunk-F27PBJKO.js +95 -0
- package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
- package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
- package/dist/chunks/chunk-GVQU2GXP.js +58 -0
- package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
- package/dist/chunks/chunk-JWPE2WC7.js +12 -0
- package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
- package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
- package/dist/chunks/chunk-P2QGCYS3.js +95 -0
- package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
- package/dist/chunks/chunk-PWAF6VOD.js +467 -0
- package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
- package/dist/chunks/chunk-SVP7TREG.js +686 -0
- package/dist/chunks/chunk-TICWLB2K.js +3800 -0
- package/dist/chunks/chunk-XXDRQBXY.js +12 -0
- package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
- package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
- package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
- package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
- package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
- package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
- package/dist/chunks/cytoscape.esm.js +28282 -0
- package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
- package/dist/chunks/dagre.js +4235 -0
- package/dist/chunks/defaultLocale.js +246 -0
- package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
- package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
- package/dist/chunks/diagram-VSXAHHWV.js +553 -0
- package/dist/chunks/diagram-VX7I27RA.js +798 -0
- package/dist/chunks/diagram-Z3DM3KII.js +186 -0
- package/dist/chunks/dist.js +92 -0
- package/dist/chunks/docs.js +987 -91
- package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
- package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
- package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
- package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
- package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
- package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
- package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
- package/dist/chunks/graphlib.js +4194 -0
- package/dist/chunks/info-A6RAGUB7.js +4 -0
- package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
- package/dist/chunks/init.js +14 -0
- package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
- package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
- package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
- package/dist/chunks/katex.js +26463 -0
- package/dist/chunks/line.js +48 -0
- package/dist/chunks/linear.js +391 -0
- package/dist/chunks/mermaid-parser.core.js +754 -0
- package/dist/chunks/mermaid.core.js +4898 -0
- package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
- package/dist/chunks/ordinal.js +84 -0
- package/dist/chunks/packet-AYTQ26CC.js +4 -0
- package/dist/chunks/path.js +106 -0
- package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
- package/dist/chunks/pie-WAS4IAKB.js +4 -0
- package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
- package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
- package/dist/chunks/radar-RG4KPBEZ.js +4 -0
- package/dist/chunks/railroad-74A4TZTK.js +4 -0
- package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
- package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
- package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
- package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
- package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
- package/dist/chunks/rough.esm.js +1396 -0
- package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
- package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
- package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
- package/dist/chunks/src.js +2653 -0
- package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
- package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
- package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
- package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
- package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
- package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
- package/dist/chunks/treemap-WGGIJYW6.js +4 -0
- package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
- package/dist/chunks/wardley-WFR3VGLG.js +4 -0
- package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
- package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
- package/dist/components.js +2 -2
- package/dist/entry-client.js +1 -1
- package/dist/entry-server.js +1 -1
- package/docs.schema.json +1 -1
- package/package.json +2 -1
- package/scripts/expand-navigation-globs.mjs +77 -8
- package/src/components/CodeBlock.tsx +36 -0
- package/src/components/Docs.tsx +44 -21
- package/src/components/OpenApiOperation.tsx +28 -20
- package/src/components/SideNav.tsx +8 -3
- package/src/components/docs/Changelog.tsx +163 -0
- package/src/components/docs/Mermaid.tsx +164 -0
- package/src/components/docs/Panel.tsx +23 -0
- package/src/components/docs/ParamField.tsx +17 -5
- package/src/components/docs/PropertiesTable.tsx +2 -2
- package/src/components/docs/ResponseField.tsx +17 -5
- package/src/components/docs/Tiles.tsx +59 -0
- package/src/components/docs/Tree.tsx +359 -0
- package/src/components/docs/Update.tsx +72 -0
- package/src/components/docs/index.ts +7 -0
- package/src/components/docs/panel-context.tsx +25 -0
- package/src/components/docs/styles.ts +49 -0
- package/src/components/icons/index.ts +4 -0
- package/src/lib/rehype-shiki.ts +18 -1
- package/types/components.d.ts +79 -0
|
@@ -0,0 +1,1396 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/roughjs@4.6.6/node_modules/roughjs/bundled/rough.esm.js
|
|
2
|
+
function t(t, e, s) {
|
|
3
|
+
if (t && t.length) {
|
|
4
|
+
const [n, o] = e, a = Math.PI / 180 * s, h = Math.cos(a), r = Math.sin(a);
|
|
5
|
+
for (const e of t) {
|
|
6
|
+
const [t, s] = e;
|
|
7
|
+
e[0] = (t - n) * h - (s - o) * r + n, e[1] = (t - n) * r + (s - o) * h + o;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function e(t, e) {
|
|
12
|
+
return t[0] === e[0] && t[1] === e[1];
|
|
13
|
+
}
|
|
14
|
+
function s(s, n, o, a = 1) {
|
|
15
|
+
const h = o, r = Math.max(n, .1), i = s[0] && s[0][0] && "number" == typeof s[0][0] ? [s] : s, c = [0, 0];
|
|
16
|
+
if (h) for (const e of i) t(e, c, h);
|
|
17
|
+
const l = function(t, s, n) {
|
|
18
|
+
const o = [];
|
|
19
|
+
for (const s of t) {
|
|
20
|
+
const t = [...s];
|
|
21
|
+
e(t[0], t[t.length - 1]) || t.push([t[0][0], t[0][1]]), t.length > 2 && o.push(t);
|
|
22
|
+
}
|
|
23
|
+
const a = [];
|
|
24
|
+
s = Math.max(s, .1);
|
|
25
|
+
const h = [];
|
|
26
|
+
for (const t of o) for (let e = 0; e < t.length - 1; e++) {
|
|
27
|
+
const s = t[e], n = t[e + 1];
|
|
28
|
+
if (s[1] !== n[1]) {
|
|
29
|
+
const t = Math.min(s[1], n[1]);
|
|
30
|
+
h.push({
|
|
31
|
+
ymin: t,
|
|
32
|
+
ymax: Math.max(s[1], n[1]),
|
|
33
|
+
x: t === s[1] ? s[0] : n[0],
|
|
34
|
+
islope: (n[0] - s[0]) / (n[1] - s[1])
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (h.sort(((t, e) => t.ymin < e.ymin ? -1 : t.ymin > e.ymin ? 1 : t.x < e.x ? -1 : t.x > e.x ? 1 : t.ymax === e.ymax ? 0 : (t.ymax - e.ymax) / Math.abs(t.ymax - e.ymax))), !h.length) return a;
|
|
39
|
+
let r = [], i = h[0].ymin, c = 0;
|
|
40
|
+
for (; r.length || h.length;) {
|
|
41
|
+
if (h.length) {
|
|
42
|
+
let t = -1;
|
|
43
|
+
for (let e = 0; e < h.length && !(h[e].ymin > i); e++) t = e;
|
|
44
|
+
h.splice(0, t + 1).forEach(((t) => {
|
|
45
|
+
r.push({
|
|
46
|
+
s: i,
|
|
47
|
+
edge: t
|
|
48
|
+
});
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
if (r = r.filter(((t) => !(t.edge.ymax <= i))), r.sort(((t, e) => t.edge.x === e.edge.x ? 0 : (t.edge.x - e.edge.x) / Math.abs(t.edge.x - e.edge.x))), (1 !== n || c % s == 0) && r.length > 1) for (let t = 0; t < r.length; t += 2) {
|
|
52
|
+
const e = t + 1;
|
|
53
|
+
if (e >= r.length) break;
|
|
54
|
+
const s = r[t].edge, n = r[e].edge;
|
|
55
|
+
a.push([[Math.round(s.x), i], [Math.round(n.x), i]]);
|
|
56
|
+
}
|
|
57
|
+
i += n, r.forEach(((t) => {
|
|
58
|
+
t.edge.x = t.edge.x + n * t.edge.islope;
|
|
59
|
+
})), c++;
|
|
60
|
+
}
|
|
61
|
+
return a;
|
|
62
|
+
}(i, r, a);
|
|
63
|
+
if (h) {
|
|
64
|
+
for (const e of i) t(e, c, -h);
|
|
65
|
+
(function(e, s, n) {
|
|
66
|
+
const o = [];
|
|
67
|
+
e.forEach(((t) => o.push(...t))), t(o, s, n);
|
|
68
|
+
})(l, c, -h);
|
|
69
|
+
}
|
|
70
|
+
return l;
|
|
71
|
+
}
|
|
72
|
+
function n(t, e) {
|
|
73
|
+
var n;
|
|
74
|
+
const o = e.hachureAngle + 90;
|
|
75
|
+
let a = e.hachureGap;
|
|
76
|
+
a < 0 && (a = 4 * e.strokeWidth), a = Math.round(Math.max(a, .1));
|
|
77
|
+
let h = 1;
|
|
78
|
+
return e.roughness >= 1 && ((null === (n = e.randomizer) || void 0 === n ? void 0 : n.next()) || Math.random()) > .7 && (h = a), s(t, a, o, h || 1);
|
|
79
|
+
}
|
|
80
|
+
var o = class {
|
|
81
|
+
constructor(t) {
|
|
82
|
+
this.helper = t;
|
|
83
|
+
}
|
|
84
|
+
fillPolygons(t, e) {
|
|
85
|
+
return this._fillPolygons(t, e);
|
|
86
|
+
}
|
|
87
|
+
_fillPolygons(t, e) {
|
|
88
|
+
const s = n(t, e);
|
|
89
|
+
return {
|
|
90
|
+
type: "fillSketch",
|
|
91
|
+
ops: this.renderLines(s, e)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
renderLines(t, e) {
|
|
95
|
+
const s = [];
|
|
96
|
+
for (const n of t) s.push(...this.helper.doubleLineOps(n[0][0], n[0][1], n[1][0], n[1][1], e));
|
|
97
|
+
return s;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
function a(t) {
|
|
101
|
+
const e = t[0], s = t[1];
|
|
102
|
+
return Math.sqrt(Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2));
|
|
103
|
+
}
|
|
104
|
+
var h = class extends o {
|
|
105
|
+
fillPolygons(t, e) {
|
|
106
|
+
let s = e.hachureGap;
|
|
107
|
+
s < 0 && (s = 4 * e.strokeWidth), s = Math.max(s, .1);
|
|
108
|
+
const o = n(t, Object.assign({}, e, { hachureGap: s })), h = Math.PI / 180 * e.hachureAngle, r = [], i = .5 * s * Math.cos(h), c = .5 * s * Math.sin(h);
|
|
109
|
+
for (const [t, e] of o) a([t, e]) && r.push([[t[0] - i, t[1] + c], [...e]], [[t[0] + i, t[1] - c], [...e]]);
|
|
110
|
+
return {
|
|
111
|
+
type: "fillSketch",
|
|
112
|
+
ops: this.renderLines(r, e)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var r = class extends o {
|
|
117
|
+
fillPolygons(t, e) {
|
|
118
|
+
const s = this._fillPolygons(t, e), n = Object.assign({}, e, { hachureAngle: e.hachureAngle + 90 }), o = this._fillPolygons(t, n);
|
|
119
|
+
return s.ops = s.ops.concat(o.ops), s;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var i = class {
|
|
123
|
+
constructor(t) {
|
|
124
|
+
this.helper = t;
|
|
125
|
+
}
|
|
126
|
+
fillPolygons(t, e) {
|
|
127
|
+
const s = n(t, e = Object.assign({}, e, { hachureAngle: 0 }));
|
|
128
|
+
return this.dotsOnLines(s, e);
|
|
129
|
+
}
|
|
130
|
+
dotsOnLines(t, e) {
|
|
131
|
+
const s = [];
|
|
132
|
+
let n = e.hachureGap;
|
|
133
|
+
n < 0 && (n = 4 * e.strokeWidth), n = Math.max(n, .1);
|
|
134
|
+
let o = e.fillWeight;
|
|
135
|
+
o < 0 && (o = e.strokeWidth / 2);
|
|
136
|
+
const h = n / 4;
|
|
137
|
+
for (const r of t) {
|
|
138
|
+
const t = a(r), i = t / n, c = Math.ceil(i) - 1, l = t - c * n, u = (r[0][0] + r[1][0]) / 2 - n / 4, p = Math.min(r[0][1], r[1][1]);
|
|
139
|
+
for (let t = 0; t < c; t++) {
|
|
140
|
+
const a = p + l + t * n, r = u - h + 2 * Math.random() * h, i = a - h + 2 * Math.random() * h, c = this.helper.ellipse(r, i, o, o, e);
|
|
141
|
+
s.push(...c.ops);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
type: "fillSketch",
|
|
146
|
+
ops: s
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var c = class {
|
|
151
|
+
constructor(t) {
|
|
152
|
+
this.helper = t;
|
|
153
|
+
}
|
|
154
|
+
fillPolygons(t, e) {
|
|
155
|
+
const s = n(t, e);
|
|
156
|
+
return {
|
|
157
|
+
type: "fillSketch",
|
|
158
|
+
ops: this.dashedLine(s, e)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
dashedLine(t, e) {
|
|
162
|
+
const s = e.dashOffset < 0 ? e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap : e.dashOffset, n = e.dashGap < 0 ? e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap : e.dashGap, o = [];
|
|
163
|
+
return t.forEach(((t) => {
|
|
164
|
+
const h = a(t), r = Math.floor(h / (s + n)), i = (h + n - r * (s + n)) / 2;
|
|
165
|
+
let c = t[0], l = t[1];
|
|
166
|
+
c[0] > l[0] && (c = t[1], l = t[0]);
|
|
167
|
+
const u = Math.atan((l[1] - c[1]) / (l[0] - c[0]));
|
|
168
|
+
for (let t = 0; t < r; t++) {
|
|
169
|
+
const a = t * (s + n), h = a + s, r = [c[0] + a * Math.cos(u) + i * Math.cos(u), c[1] + a * Math.sin(u) + i * Math.sin(u)], l = [c[0] + h * Math.cos(u) + i * Math.cos(u), c[1] + h * Math.sin(u) + i * Math.sin(u)];
|
|
170
|
+
o.push(...this.helper.doubleLineOps(r[0], r[1], l[0], l[1], e));
|
|
171
|
+
}
|
|
172
|
+
})), o;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var l = class {
|
|
176
|
+
constructor(t) {
|
|
177
|
+
this.helper = t;
|
|
178
|
+
}
|
|
179
|
+
fillPolygons(t, e) {
|
|
180
|
+
const s = e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap, o = e.zigzagOffset < 0 ? s : e.zigzagOffset, a = n(t, e = Object.assign({}, e, { hachureGap: s + o }));
|
|
181
|
+
return {
|
|
182
|
+
type: "fillSketch",
|
|
183
|
+
ops: this.zigzagLines(a, o, e)
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
zigzagLines(t, e, s) {
|
|
187
|
+
const n = [];
|
|
188
|
+
return t.forEach(((t) => {
|
|
189
|
+
const o = a(t), h = Math.round(o / (2 * e));
|
|
190
|
+
let r = t[0], i = t[1];
|
|
191
|
+
r[0] > i[0] && (r = t[1], i = t[0]);
|
|
192
|
+
const c = Math.atan((i[1] - r[1]) / (i[0] - r[0]));
|
|
193
|
+
for (let t = 0; t < h; t++) {
|
|
194
|
+
const o = 2 * t * e, a = 2 * (t + 1) * e, h = Math.sqrt(2 * Math.pow(e, 2)), i = [r[0] + o * Math.cos(c), r[1] + o * Math.sin(c)], l = [r[0] + a * Math.cos(c), r[1] + a * Math.sin(c)], u = [i[0] + h * Math.cos(c + Math.PI / 4), i[1] + h * Math.sin(c + Math.PI / 4)];
|
|
195
|
+
n.push(...this.helper.doubleLineOps(i[0], i[1], u[0], u[1], s), ...this.helper.doubleLineOps(u[0], u[1], l[0], l[1], s));
|
|
196
|
+
}
|
|
197
|
+
})), n;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const u = {};
|
|
201
|
+
var p = class {
|
|
202
|
+
constructor(t) {
|
|
203
|
+
this.seed = t;
|
|
204
|
+
}
|
|
205
|
+
next() {
|
|
206
|
+
return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const f = 0;
|
|
210
|
+
const d = 1;
|
|
211
|
+
const g = 2;
|
|
212
|
+
const M = {
|
|
213
|
+
A: 7,
|
|
214
|
+
a: 7,
|
|
215
|
+
C: 6,
|
|
216
|
+
c: 6,
|
|
217
|
+
H: 1,
|
|
218
|
+
h: 1,
|
|
219
|
+
L: 2,
|
|
220
|
+
l: 2,
|
|
221
|
+
M: 2,
|
|
222
|
+
m: 2,
|
|
223
|
+
Q: 4,
|
|
224
|
+
q: 4,
|
|
225
|
+
S: 4,
|
|
226
|
+
s: 4,
|
|
227
|
+
T: 2,
|
|
228
|
+
t: 2,
|
|
229
|
+
V: 1,
|
|
230
|
+
v: 1,
|
|
231
|
+
Z: 0,
|
|
232
|
+
z: 0
|
|
233
|
+
};
|
|
234
|
+
function k(t, e) {
|
|
235
|
+
return t.type === e;
|
|
236
|
+
}
|
|
237
|
+
function b(t) {
|
|
238
|
+
const e = [], s = function(t) {
|
|
239
|
+
const e = new Array();
|
|
240
|
+
for (; "" !== t;) if (t.match(/^([ \t\r\n,]+)/)) t = t.substr(RegExp.$1.length);
|
|
241
|
+
else if (t.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e[e.length] = {
|
|
242
|
+
type: f,
|
|
243
|
+
text: RegExp.$1
|
|
244
|
+
}, t = t.substr(RegExp.$1.length);
|
|
245
|
+
else {
|
|
246
|
+
if (!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
|
|
247
|
+
e[e.length] = {
|
|
248
|
+
type: d,
|
|
249
|
+
text: `${parseFloat(RegExp.$1)}`
|
|
250
|
+
}, t = t.substr(RegExp.$1.length);
|
|
251
|
+
}
|
|
252
|
+
return e[e.length] = {
|
|
253
|
+
type: g,
|
|
254
|
+
text: ""
|
|
255
|
+
}, e;
|
|
256
|
+
}(t);
|
|
257
|
+
let n = "BOD", o = 0, a = s[o];
|
|
258
|
+
for (; !k(a, g);) {
|
|
259
|
+
let h = 0;
|
|
260
|
+
const r = [];
|
|
261
|
+
if ("BOD" === n) {
|
|
262
|
+
if ("M" !== a.text && "m" !== a.text) return b("M0,0" + t);
|
|
263
|
+
o++, h = M[a.text], n = a.text;
|
|
264
|
+
} else k(a, d) ? h = M[n] : (o++, h = M[a.text], n = a.text);
|
|
265
|
+
if (!(o + h < s.length)) throw new Error("Path data ended short");
|
|
266
|
+
for (let t = o; t < o + h; t++) {
|
|
267
|
+
const e = s[t];
|
|
268
|
+
if (!k(e, d)) throw new Error("Param not a number: " + n + "," + e.text);
|
|
269
|
+
r[r.length] = +e.text;
|
|
270
|
+
}
|
|
271
|
+
if ("number" != typeof M[n]) throw new Error("Bad segment: " + n);
|
|
272
|
+
{
|
|
273
|
+
const t = {
|
|
274
|
+
key: n,
|
|
275
|
+
data: r
|
|
276
|
+
};
|
|
277
|
+
e.push(t), o += h, a = s[o], "M" === n && (n = "L"), "m" === n && (n = "l");
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return e;
|
|
281
|
+
}
|
|
282
|
+
function y(t) {
|
|
283
|
+
let e = 0, s = 0, n = 0, o = 0;
|
|
284
|
+
const a = [];
|
|
285
|
+
for (const { key: h, data: r } of t) switch (h) {
|
|
286
|
+
case "M":
|
|
287
|
+
a.push({
|
|
288
|
+
key: "M",
|
|
289
|
+
data: [...r]
|
|
290
|
+
}), [e, s] = r, [n, o] = r;
|
|
291
|
+
break;
|
|
292
|
+
case "m":
|
|
293
|
+
e += r[0], s += r[1], a.push({
|
|
294
|
+
key: "M",
|
|
295
|
+
data: [e, s]
|
|
296
|
+
}), n = e, o = s;
|
|
297
|
+
break;
|
|
298
|
+
case "L":
|
|
299
|
+
a.push({
|
|
300
|
+
key: "L",
|
|
301
|
+
data: [...r]
|
|
302
|
+
}), [e, s] = r;
|
|
303
|
+
break;
|
|
304
|
+
case "l":
|
|
305
|
+
e += r[0], s += r[1], a.push({
|
|
306
|
+
key: "L",
|
|
307
|
+
data: [e, s]
|
|
308
|
+
});
|
|
309
|
+
break;
|
|
310
|
+
case "C":
|
|
311
|
+
a.push({
|
|
312
|
+
key: "C",
|
|
313
|
+
data: [...r]
|
|
314
|
+
}), e = r[4], s = r[5];
|
|
315
|
+
break;
|
|
316
|
+
case "c": {
|
|
317
|
+
const t = r.map(((t, n) => n % 2 ? t + s : t + e));
|
|
318
|
+
a.push({
|
|
319
|
+
key: "C",
|
|
320
|
+
data: t
|
|
321
|
+
}), e = t[4], s = t[5];
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
case "Q":
|
|
325
|
+
a.push({
|
|
326
|
+
key: "Q",
|
|
327
|
+
data: [...r]
|
|
328
|
+
}), e = r[2], s = r[3];
|
|
329
|
+
break;
|
|
330
|
+
case "q": {
|
|
331
|
+
const t = r.map(((t, n) => n % 2 ? t + s : t + e));
|
|
332
|
+
a.push({
|
|
333
|
+
key: "Q",
|
|
334
|
+
data: t
|
|
335
|
+
}), e = t[2], s = t[3];
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
case "A":
|
|
339
|
+
a.push({
|
|
340
|
+
key: "A",
|
|
341
|
+
data: [...r]
|
|
342
|
+
}), e = r[5], s = r[6];
|
|
343
|
+
break;
|
|
344
|
+
case "a":
|
|
345
|
+
e += r[5], s += r[6], a.push({
|
|
346
|
+
key: "A",
|
|
347
|
+
data: [
|
|
348
|
+
r[0],
|
|
349
|
+
r[1],
|
|
350
|
+
r[2],
|
|
351
|
+
r[3],
|
|
352
|
+
r[4],
|
|
353
|
+
e,
|
|
354
|
+
s
|
|
355
|
+
]
|
|
356
|
+
});
|
|
357
|
+
break;
|
|
358
|
+
case "H":
|
|
359
|
+
a.push({
|
|
360
|
+
key: "H",
|
|
361
|
+
data: [...r]
|
|
362
|
+
}), e = r[0];
|
|
363
|
+
break;
|
|
364
|
+
case "h":
|
|
365
|
+
e += r[0], a.push({
|
|
366
|
+
key: "H",
|
|
367
|
+
data: [e]
|
|
368
|
+
});
|
|
369
|
+
break;
|
|
370
|
+
case "V":
|
|
371
|
+
a.push({
|
|
372
|
+
key: "V",
|
|
373
|
+
data: [...r]
|
|
374
|
+
}), s = r[0];
|
|
375
|
+
break;
|
|
376
|
+
case "v":
|
|
377
|
+
s += r[0], a.push({
|
|
378
|
+
key: "V",
|
|
379
|
+
data: [s]
|
|
380
|
+
});
|
|
381
|
+
break;
|
|
382
|
+
case "S":
|
|
383
|
+
a.push({
|
|
384
|
+
key: "S",
|
|
385
|
+
data: [...r]
|
|
386
|
+
}), e = r[2], s = r[3];
|
|
387
|
+
break;
|
|
388
|
+
case "s": {
|
|
389
|
+
const t = r.map(((t, n) => n % 2 ? t + s : t + e));
|
|
390
|
+
a.push({
|
|
391
|
+
key: "S",
|
|
392
|
+
data: t
|
|
393
|
+
}), e = t[2], s = t[3];
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
case "T":
|
|
397
|
+
a.push({
|
|
398
|
+
key: "T",
|
|
399
|
+
data: [...r]
|
|
400
|
+
}), e = r[0], s = r[1];
|
|
401
|
+
break;
|
|
402
|
+
case "t":
|
|
403
|
+
e += r[0], s += r[1], a.push({
|
|
404
|
+
key: "T",
|
|
405
|
+
data: [e, s]
|
|
406
|
+
});
|
|
407
|
+
break;
|
|
408
|
+
case "Z":
|
|
409
|
+
case "z": a.push({
|
|
410
|
+
key: "Z",
|
|
411
|
+
data: []
|
|
412
|
+
}), e = n, s = o;
|
|
413
|
+
}
|
|
414
|
+
return a;
|
|
415
|
+
}
|
|
416
|
+
function m(t) {
|
|
417
|
+
const e = [];
|
|
418
|
+
let s = "", n = 0, o = 0, a = 0, h = 0, r = 0, i = 0;
|
|
419
|
+
for (const { key: c, data: l } of t) {
|
|
420
|
+
switch (c) {
|
|
421
|
+
case "M":
|
|
422
|
+
e.push({
|
|
423
|
+
key: "M",
|
|
424
|
+
data: [...l]
|
|
425
|
+
}), [n, o] = l, [a, h] = l;
|
|
426
|
+
break;
|
|
427
|
+
case "C":
|
|
428
|
+
e.push({
|
|
429
|
+
key: "C",
|
|
430
|
+
data: [...l]
|
|
431
|
+
}), n = l[4], o = l[5], r = l[2], i = l[3];
|
|
432
|
+
break;
|
|
433
|
+
case "L":
|
|
434
|
+
e.push({
|
|
435
|
+
key: "L",
|
|
436
|
+
data: [...l]
|
|
437
|
+
}), [n, o] = l;
|
|
438
|
+
break;
|
|
439
|
+
case "H":
|
|
440
|
+
n = l[0], e.push({
|
|
441
|
+
key: "L",
|
|
442
|
+
data: [n, o]
|
|
443
|
+
});
|
|
444
|
+
break;
|
|
445
|
+
case "V":
|
|
446
|
+
o = l[0], e.push({
|
|
447
|
+
key: "L",
|
|
448
|
+
data: [n, o]
|
|
449
|
+
});
|
|
450
|
+
break;
|
|
451
|
+
case "S": {
|
|
452
|
+
let t = 0, a = 0;
|
|
453
|
+
"C" === s || "S" === s ? (t = n + (n - r), a = o + (o - i)) : (t = n, a = o), e.push({
|
|
454
|
+
key: "C",
|
|
455
|
+
data: [
|
|
456
|
+
t,
|
|
457
|
+
a,
|
|
458
|
+
...l
|
|
459
|
+
]
|
|
460
|
+
}), r = l[0], i = l[1], n = l[2], o = l[3];
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
case "T": {
|
|
464
|
+
const [t, a] = l;
|
|
465
|
+
let h = 0, c = 0;
|
|
466
|
+
"Q" === s || "T" === s ? (h = n + (n - r), c = o + (o - i)) : (h = n, c = o);
|
|
467
|
+
const u = n + 2 * (h - n) / 3, p = o + 2 * (c - o) / 3, f = t + 2 * (h - t) / 3, d = a + 2 * (c - a) / 3;
|
|
468
|
+
e.push({
|
|
469
|
+
key: "C",
|
|
470
|
+
data: [
|
|
471
|
+
u,
|
|
472
|
+
p,
|
|
473
|
+
f,
|
|
474
|
+
d,
|
|
475
|
+
t,
|
|
476
|
+
a
|
|
477
|
+
]
|
|
478
|
+
}), r = h, i = c, n = t, o = a;
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
case "Q": {
|
|
482
|
+
const [t, s, a, h] = l, c = n + 2 * (t - n) / 3, u = o + 2 * (s - o) / 3, p = a + 2 * (t - a) / 3, f = h + 2 * (s - h) / 3;
|
|
483
|
+
e.push({
|
|
484
|
+
key: "C",
|
|
485
|
+
data: [
|
|
486
|
+
c,
|
|
487
|
+
u,
|
|
488
|
+
p,
|
|
489
|
+
f,
|
|
490
|
+
a,
|
|
491
|
+
h
|
|
492
|
+
]
|
|
493
|
+
}), r = t, i = s, n = a, o = h;
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
case "A": {
|
|
497
|
+
const t = Math.abs(l[0]), s = Math.abs(l[1]), a = l[2], h = l[3], r = l[4], i = l[5], c = l[6];
|
|
498
|
+
if (0 === t || 0 === s) e.push({
|
|
499
|
+
key: "C",
|
|
500
|
+
data: [
|
|
501
|
+
n,
|
|
502
|
+
o,
|
|
503
|
+
i,
|
|
504
|
+
c,
|
|
505
|
+
i,
|
|
506
|
+
c
|
|
507
|
+
]
|
|
508
|
+
}), n = i, o = c;
|
|
509
|
+
else if (n !== i || o !== c) x(n, o, i, c, t, s, a, h, r).forEach((function(t) {
|
|
510
|
+
e.push({
|
|
511
|
+
key: "C",
|
|
512
|
+
data: t
|
|
513
|
+
});
|
|
514
|
+
})), n = i, o = c;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
case "Z": e.push({
|
|
518
|
+
key: "Z",
|
|
519
|
+
data: []
|
|
520
|
+
}), n = a, o = h;
|
|
521
|
+
}
|
|
522
|
+
s = c;
|
|
523
|
+
}
|
|
524
|
+
return e;
|
|
525
|
+
}
|
|
526
|
+
function w(t, e, s) {
|
|
527
|
+
return [t * Math.cos(s) - e * Math.sin(s), t * Math.sin(s) + e * Math.cos(s)];
|
|
528
|
+
}
|
|
529
|
+
function x(t, e, s, n, o, a, h, r, i, c) {
|
|
530
|
+
const l = (u = h, Math.PI * u / 180);
|
|
531
|
+
var u;
|
|
532
|
+
let p = [], f = 0, d = 0, g = 0, M = 0;
|
|
533
|
+
if (c) [f, d, g, M] = c;
|
|
534
|
+
else {
|
|
535
|
+
[t, e] = w(t, e, -l), [s, n] = w(s, n, -l);
|
|
536
|
+
const h = (t - s) / 2, c = (e - n) / 2;
|
|
537
|
+
let u = h * h / (o * o) + c * c / (a * a);
|
|
538
|
+
u > 1 && (u = Math.sqrt(u), o *= u, a *= u);
|
|
539
|
+
const p = o * o, k = a * a, b = p * k - p * c * c - k * h * h, y = p * c * c + k * h * h, m = (r === i ? -1 : 1) * Math.sqrt(Math.abs(b / y));
|
|
540
|
+
g = m * o * c / a + (t + s) / 2, M = m * -a * h / o + (e + n) / 2, f = Math.asin(parseFloat(((e - M) / a).toFixed(9))), d = Math.asin(parseFloat(((n - M) / a).toFixed(9))), t < g && (f = Math.PI - f), s < g && (d = Math.PI - d), f < 0 && (f = 2 * Math.PI + f), d < 0 && (d = 2 * Math.PI + d), i && f > d && (f -= 2 * Math.PI), !i && d > f && (d -= 2 * Math.PI);
|
|
541
|
+
}
|
|
542
|
+
let k = d - f;
|
|
543
|
+
if (Math.abs(k) > 120 * Math.PI / 180) {
|
|
544
|
+
const t = d, e = s, r = n;
|
|
545
|
+
d = i && d > f ? f + 120 * Math.PI / 180 * 1 : f + 120 * Math.PI / 180 * -1, p = x(s = g + o * Math.cos(d), n = M + a * Math.sin(d), e, r, o, a, h, 0, i, [
|
|
546
|
+
d,
|
|
547
|
+
t,
|
|
548
|
+
g,
|
|
549
|
+
M
|
|
550
|
+
]);
|
|
551
|
+
}
|
|
552
|
+
k = d - f;
|
|
553
|
+
const b = Math.cos(f), y = Math.sin(f), m = Math.cos(d), P = Math.sin(d), v = Math.tan(k / 4), S = 4 / 3 * o * v, O = 4 / 3 * a * v, L = [t, e], T = [t + S * y, e - O * b], D = [s + S * P, n - O * m], A = [s, n];
|
|
554
|
+
if (T[0] = 2 * L[0] - T[0], T[1] = 2 * L[1] - T[1], c) return [
|
|
555
|
+
T,
|
|
556
|
+
D,
|
|
557
|
+
A
|
|
558
|
+
].concat(p);
|
|
559
|
+
{
|
|
560
|
+
p = [
|
|
561
|
+
T,
|
|
562
|
+
D,
|
|
563
|
+
A
|
|
564
|
+
].concat(p);
|
|
565
|
+
const t = [];
|
|
566
|
+
for (let e = 0; e < p.length; e += 3) {
|
|
567
|
+
const s = w(p[e][0], p[e][1], l), n = w(p[e + 1][0], p[e + 1][1], l), o = w(p[e + 2][0], p[e + 2][1], l);
|
|
568
|
+
t.push([
|
|
569
|
+
s[0],
|
|
570
|
+
s[1],
|
|
571
|
+
n[0],
|
|
572
|
+
n[1],
|
|
573
|
+
o[0],
|
|
574
|
+
o[1]
|
|
575
|
+
]);
|
|
576
|
+
}
|
|
577
|
+
return t;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const P = {
|
|
581
|
+
randOffset: function(t, e) {
|
|
582
|
+
return G(t, e);
|
|
583
|
+
},
|
|
584
|
+
randOffsetWithRange: function(t, e, s) {
|
|
585
|
+
return E(t, e, s);
|
|
586
|
+
},
|
|
587
|
+
ellipse: function(t, e, s, n, o) {
|
|
588
|
+
return D(t, e, o, T(s, n, o)).opset;
|
|
589
|
+
},
|
|
590
|
+
doubleLineOps: function(t, e, s, n, o) {
|
|
591
|
+
return $(t, e, s, n, o, !0);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
function v(t, e, s, n, o) {
|
|
595
|
+
return {
|
|
596
|
+
type: "path",
|
|
597
|
+
ops: $(t, e, s, n, o)
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function S(t, e, s) {
|
|
601
|
+
const n = (t || []).length;
|
|
602
|
+
if (n > 2) {
|
|
603
|
+
const o = [];
|
|
604
|
+
for (let e = 0; e < n - 1; e++) o.push(...$(t[e][0], t[e][1], t[e + 1][0], t[e + 1][1], s));
|
|
605
|
+
return e && o.push(...$(t[n - 1][0], t[n - 1][1], t[0][0], t[0][1], s)), {
|
|
606
|
+
type: "path",
|
|
607
|
+
ops: o
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
return 2 === n ? v(t[0][0], t[0][1], t[1][0], t[1][1], s) : {
|
|
611
|
+
type: "path",
|
|
612
|
+
ops: []
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
function O(t, e, s, n, o) {
|
|
616
|
+
return function(t, e) {
|
|
617
|
+
return S(t, !0, e);
|
|
618
|
+
}([
|
|
619
|
+
[t, e],
|
|
620
|
+
[t + s, e],
|
|
621
|
+
[t + s, e + n],
|
|
622
|
+
[t, e + n]
|
|
623
|
+
], o);
|
|
624
|
+
}
|
|
625
|
+
function L(t, e) {
|
|
626
|
+
if (t.length) {
|
|
627
|
+
const s = "number" == typeof t[0][0] ? [t] : t, n = j(s[0], 1 * (1 + .2 * e.roughness), e), o = e.disableMultiStroke ? [] : j(s[0], 1.5 * (1 + .22 * e.roughness), z(e));
|
|
628
|
+
for (let t = 1; t < s.length; t++) {
|
|
629
|
+
const a = s[t];
|
|
630
|
+
if (a.length) {
|
|
631
|
+
const t = j(a, 1 * (1 + .2 * e.roughness), e), s = e.disableMultiStroke ? [] : j(a, 1.5 * (1 + .22 * e.roughness), z(e));
|
|
632
|
+
for (const e of t) "move" !== e.op && n.push(e);
|
|
633
|
+
for (const t of s) "move" !== t.op && o.push(t);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
type: "path",
|
|
638
|
+
ops: n.concat(o)
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
return {
|
|
642
|
+
type: "path",
|
|
643
|
+
ops: []
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function T(t, e, s) {
|
|
647
|
+
const n = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t / 2, 2) + Math.pow(e / 2, 2)) / 2)), o = Math.ceil(Math.max(s.curveStepCount, s.curveStepCount / Math.sqrt(200) * n)), a = 2 * Math.PI / o;
|
|
648
|
+
let h = Math.abs(t / 2), r = Math.abs(e / 2);
|
|
649
|
+
const i = 1 - s.curveFitting;
|
|
650
|
+
return h += G(h * i, s), r += G(r * i, s), {
|
|
651
|
+
increment: a,
|
|
652
|
+
rx: h,
|
|
653
|
+
ry: r
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
function D(t, e, s, n) {
|
|
657
|
+
const [o, a] = F(n.increment, t, e, n.rx, n.ry, 1, n.increment * E(.1, E(.4, 1, s), s), s);
|
|
658
|
+
let h = q(o, null, s);
|
|
659
|
+
if (!s.disableMultiStroke && 0 !== s.roughness) {
|
|
660
|
+
const [o] = F(n.increment, t, e, n.rx, n.ry, 1.5, 0, s), a = q(o, null, s);
|
|
661
|
+
h = h.concat(a);
|
|
662
|
+
}
|
|
663
|
+
return {
|
|
664
|
+
estimatedPoints: a,
|
|
665
|
+
opset: {
|
|
666
|
+
type: "path",
|
|
667
|
+
ops: h
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
function A(t, e, s, n, o, a, h, r, i) {
|
|
672
|
+
const c = t, l = e;
|
|
673
|
+
let u = Math.abs(s / 2), p = Math.abs(n / 2);
|
|
674
|
+
u += G(.01 * u, i), p += G(.01 * p, i);
|
|
675
|
+
let f = o, d = a;
|
|
676
|
+
for (; f < 0;) f += 2 * Math.PI, d += 2 * Math.PI;
|
|
677
|
+
d - f > 2 * Math.PI && (f = 0, d = 2 * Math.PI);
|
|
678
|
+
const g = 2 * Math.PI / i.curveStepCount, M = Math.min(g / 2, (d - f) / 2), k = V(M, c, l, u, p, f, d, 1, i);
|
|
679
|
+
if (!i.disableMultiStroke) {
|
|
680
|
+
const t = V(M, c, l, u, p, f, d, 1.5, i);
|
|
681
|
+
k.push(...t);
|
|
682
|
+
}
|
|
683
|
+
return h && (r ? k.push(...$(c, l, c + u * Math.cos(f), l + p * Math.sin(f), i), ...$(c, l, c + u * Math.cos(d), l + p * Math.sin(d), i)) : k.push({
|
|
684
|
+
op: "lineTo",
|
|
685
|
+
data: [c, l]
|
|
686
|
+
}, {
|
|
687
|
+
op: "lineTo",
|
|
688
|
+
data: [c + u * Math.cos(f), l + p * Math.sin(f)]
|
|
689
|
+
})), {
|
|
690
|
+
type: "path",
|
|
691
|
+
ops: k
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
function _(t, e) {
|
|
695
|
+
const s = m(y(b(t))), n = [];
|
|
696
|
+
let o = [0, 0], a = [0, 0];
|
|
697
|
+
for (const { key: t, data: h } of s) switch (t) {
|
|
698
|
+
case "M":
|
|
699
|
+
a = [h[0], h[1]], o = [h[0], h[1]];
|
|
700
|
+
break;
|
|
701
|
+
case "L":
|
|
702
|
+
n.push(...$(a[0], a[1], h[0], h[1], e)), a = [h[0], h[1]];
|
|
703
|
+
break;
|
|
704
|
+
case "C": {
|
|
705
|
+
const [t, s, o, r, i, c] = h;
|
|
706
|
+
n.push(...Z(t, s, o, r, i, c, a, e)), a = [i, c];
|
|
707
|
+
break;
|
|
708
|
+
}
|
|
709
|
+
case "Z": n.push(...$(a[0], a[1], o[0], o[1], e)), a = [o[0], o[1]];
|
|
710
|
+
}
|
|
711
|
+
return {
|
|
712
|
+
type: "path",
|
|
713
|
+
ops: n
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
function I(t, e) {
|
|
717
|
+
const s = [];
|
|
718
|
+
for (const n of t) if (n.length) {
|
|
719
|
+
const t = e.maxRandomnessOffset || 0, o = n.length;
|
|
720
|
+
if (o > 2) {
|
|
721
|
+
s.push({
|
|
722
|
+
op: "move",
|
|
723
|
+
data: [n[0][0] + G(t, e), n[0][1] + G(t, e)]
|
|
724
|
+
});
|
|
725
|
+
for (let a = 1; a < o; a++) s.push({
|
|
726
|
+
op: "lineTo",
|
|
727
|
+
data: [n[a][0] + G(t, e), n[a][1] + G(t, e)]
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return {
|
|
732
|
+
type: "fillPath",
|
|
733
|
+
ops: s
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
function C(t, e) {
|
|
737
|
+
return function(t, e) {
|
|
738
|
+
let s = t.fillStyle || "hachure";
|
|
739
|
+
if (!u[s]) switch (s) {
|
|
740
|
+
case "zigzag":
|
|
741
|
+
u[s] || (u[s] = new h(e));
|
|
742
|
+
break;
|
|
743
|
+
case "cross-hatch":
|
|
744
|
+
u[s] || (u[s] = new r(e));
|
|
745
|
+
break;
|
|
746
|
+
case "dots":
|
|
747
|
+
u[s] || (u[s] = new i(e));
|
|
748
|
+
break;
|
|
749
|
+
case "dashed":
|
|
750
|
+
u[s] || (u[s] = new c(e));
|
|
751
|
+
break;
|
|
752
|
+
case "zigzag-line":
|
|
753
|
+
u[s] || (u[s] = new l(e));
|
|
754
|
+
break;
|
|
755
|
+
default: s = "hachure", u[s] || (u[s] = new o(e));
|
|
756
|
+
}
|
|
757
|
+
return u[s];
|
|
758
|
+
}(e, P).fillPolygons(t, e);
|
|
759
|
+
}
|
|
760
|
+
function z(t) {
|
|
761
|
+
const e = Object.assign({}, t);
|
|
762
|
+
return e.randomizer = void 0, t.seed && (e.seed = t.seed + 1), e;
|
|
763
|
+
}
|
|
764
|
+
function W(t) {
|
|
765
|
+
return t.randomizer || (t.randomizer = new p(t.seed || 0)), t.randomizer.next();
|
|
766
|
+
}
|
|
767
|
+
function E(t, e, s, n = 1) {
|
|
768
|
+
return s.roughness * n * (W(s) * (e - t) + t);
|
|
769
|
+
}
|
|
770
|
+
function G(t, e, s = 1) {
|
|
771
|
+
return E(-t, t, e, s);
|
|
772
|
+
}
|
|
773
|
+
function $(t, e, s, n, o, a = !1) {
|
|
774
|
+
const h = a ? o.disableMultiStrokeFill : o.disableMultiStroke, r = R(t, e, s, n, o, !0, !1);
|
|
775
|
+
if (h) return r;
|
|
776
|
+
const i = R(t, e, s, n, o, !0, !0);
|
|
777
|
+
return r.concat(i);
|
|
778
|
+
}
|
|
779
|
+
function R(t, e, s, n, o, a, h) {
|
|
780
|
+
const r = Math.pow(t - s, 2) + Math.pow(e - n, 2), i = Math.sqrt(r);
|
|
781
|
+
let c = 1;
|
|
782
|
+
c = i < 200 ? 1 : i > 500 ? .4 : -.0016668 * i + 1.233334;
|
|
783
|
+
let l = o.maxRandomnessOffset || 0;
|
|
784
|
+
l * l * 100 > r && (l = i / 10);
|
|
785
|
+
const u = l / 2, p = .2 + .2 * W(o);
|
|
786
|
+
let f = o.bowing * o.maxRandomnessOffset * (n - e) / 200, d = o.bowing * o.maxRandomnessOffset * (t - s) / 200;
|
|
787
|
+
f = G(f, o, c), d = G(d, o, c);
|
|
788
|
+
const g = [], M = () => G(u, o, c), k = () => G(l, o, c), b = o.preserveVertices;
|
|
789
|
+
return a && (h ? g.push({
|
|
790
|
+
op: "move",
|
|
791
|
+
data: [t + (b ? 0 : M()), e + (b ? 0 : M())]
|
|
792
|
+
}) : g.push({
|
|
793
|
+
op: "move",
|
|
794
|
+
data: [t + (b ? 0 : G(l, o, c)), e + (b ? 0 : G(l, o, c))]
|
|
795
|
+
})), h ? g.push({
|
|
796
|
+
op: "bcurveTo",
|
|
797
|
+
data: [
|
|
798
|
+
f + t + (s - t) * p + M(),
|
|
799
|
+
d + e + (n - e) * p + M(),
|
|
800
|
+
f + t + 2 * (s - t) * p + M(),
|
|
801
|
+
d + e + 2 * (n - e) * p + M(),
|
|
802
|
+
s + (b ? 0 : M()),
|
|
803
|
+
n + (b ? 0 : M())
|
|
804
|
+
]
|
|
805
|
+
}) : g.push({
|
|
806
|
+
op: "bcurveTo",
|
|
807
|
+
data: [
|
|
808
|
+
f + t + (s - t) * p + k(),
|
|
809
|
+
d + e + (n - e) * p + k(),
|
|
810
|
+
f + t + 2 * (s - t) * p + k(),
|
|
811
|
+
d + e + 2 * (n - e) * p + k(),
|
|
812
|
+
s + (b ? 0 : k()),
|
|
813
|
+
n + (b ? 0 : k())
|
|
814
|
+
]
|
|
815
|
+
}), g;
|
|
816
|
+
}
|
|
817
|
+
function j(t, e, s) {
|
|
818
|
+
if (!t.length) return [];
|
|
819
|
+
const n = [];
|
|
820
|
+
n.push([t[0][0] + G(e, s), t[0][1] + G(e, s)]), n.push([t[0][0] + G(e, s), t[0][1] + G(e, s)]);
|
|
821
|
+
for (let o = 1; o < t.length; o++) n.push([t[o][0] + G(e, s), t[o][1] + G(e, s)]), o === t.length - 1 && n.push([t[o][0] + G(e, s), t[o][1] + G(e, s)]);
|
|
822
|
+
return q(n, null, s);
|
|
823
|
+
}
|
|
824
|
+
function q(t, e, s) {
|
|
825
|
+
const n = t.length, o = [];
|
|
826
|
+
if (n > 3) {
|
|
827
|
+
const a = [], h = 1 - s.curveTightness;
|
|
828
|
+
o.push({
|
|
829
|
+
op: "move",
|
|
830
|
+
data: [t[1][0], t[1][1]]
|
|
831
|
+
});
|
|
832
|
+
for (let e = 1; e + 2 < n; e++) {
|
|
833
|
+
const s = t[e];
|
|
834
|
+
a[0] = [s[0], s[1]], a[1] = [s[0] + (h * t[e + 1][0] - h * t[e - 1][0]) / 6, s[1] + (h * t[e + 1][1] - h * t[e - 1][1]) / 6], a[2] = [t[e + 1][0] + (h * t[e][0] - h * t[e + 2][0]) / 6, t[e + 1][1] + (h * t[e][1] - h * t[e + 2][1]) / 6], a[3] = [t[e + 1][0], t[e + 1][1]], o.push({
|
|
835
|
+
op: "bcurveTo",
|
|
836
|
+
data: [
|
|
837
|
+
a[1][0],
|
|
838
|
+
a[1][1],
|
|
839
|
+
a[2][0],
|
|
840
|
+
a[2][1],
|
|
841
|
+
a[3][0],
|
|
842
|
+
a[3][1]
|
|
843
|
+
]
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
if (e && 2 === e.length) {
|
|
847
|
+
const t = s.maxRandomnessOffset;
|
|
848
|
+
o.push({
|
|
849
|
+
op: "lineTo",
|
|
850
|
+
data: [e[0] + G(t, s), e[1] + G(t, s)]
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
} else 3 === n ? (o.push({
|
|
854
|
+
op: "move",
|
|
855
|
+
data: [t[1][0], t[1][1]]
|
|
856
|
+
}), o.push({
|
|
857
|
+
op: "bcurveTo",
|
|
858
|
+
data: [
|
|
859
|
+
t[1][0],
|
|
860
|
+
t[1][1],
|
|
861
|
+
t[2][0],
|
|
862
|
+
t[2][1],
|
|
863
|
+
t[2][0],
|
|
864
|
+
t[2][1]
|
|
865
|
+
]
|
|
866
|
+
})) : 2 === n && o.push(...R(t[0][0], t[0][1], t[1][0], t[1][1], s, !0, !0));
|
|
867
|
+
return o;
|
|
868
|
+
}
|
|
869
|
+
function F(t, e, s, n, o, a, h, r) {
|
|
870
|
+
const i = [], c = [];
|
|
871
|
+
if (0 === r.roughness) {
|
|
872
|
+
t /= 4, c.push([e + n * Math.cos(-t), s + o * Math.sin(-t)]);
|
|
873
|
+
for (let a = 0; a <= 2 * Math.PI; a += t) {
|
|
874
|
+
const t = [e + n * Math.cos(a), s + o * Math.sin(a)];
|
|
875
|
+
i.push(t), c.push(t);
|
|
876
|
+
}
|
|
877
|
+
c.push([e + n * Math.cos(0), s + o * Math.sin(0)]), c.push([e + n * Math.cos(t), s + o * Math.sin(t)]);
|
|
878
|
+
} else {
|
|
879
|
+
const l = G(.5, r) - Math.PI / 2;
|
|
880
|
+
c.push([G(a, r) + e + .9 * n * Math.cos(l - t), G(a, r) + s + .9 * o * Math.sin(l - t)]);
|
|
881
|
+
const u = 2 * Math.PI + l - .01;
|
|
882
|
+
for (let h = l; h < u; h += t) {
|
|
883
|
+
const t = [G(a, r) + e + n * Math.cos(h), G(a, r) + s + o * Math.sin(h)];
|
|
884
|
+
i.push(t), c.push(t);
|
|
885
|
+
}
|
|
886
|
+
c.push([G(a, r) + e + n * Math.cos(l + 2 * Math.PI + .5 * h), G(a, r) + s + o * Math.sin(l + 2 * Math.PI + .5 * h)]), c.push([G(a, r) + e + .98 * n * Math.cos(l + h), G(a, r) + s + .98 * o * Math.sin(l + h)]), c.push([G(a, r) + e + .9 * n * Math.cos(l + .5 * h), G(a, r) + s + .9 * o * Math.sin(l + .5 * h)]);
|
|
887
|
+
}
|
|
888
|
+
return [c, i];
|
|
889
|
+
}
|
|
890
|
+
function V(t, e, s, n, o, a, h, r, i) {
|
|
891
|
+
const c = a + G(.1, i), l = [];
|
|
892
|
+
l.push([G(r, i) + e + .9 * n * Math.cos(c - t), G(r, i) + s + .9 * o * Math.sin(c - t)]);
|
|
893
|
+
for (let a = c; a <= h; a += t) l.push([G(r, i) + e + n * Math.cos(a), G(r, i) + s + o * Math.sin(a)]);
|
|
894
|
+
return l.push([e + n * Math.cos(h), s + o * Math.sin(h)]), l.push([e + n * Math.cos(h), s + o * Math.sin(h)]), q(l, null, i);
|
|
895
|
+
}
|
|
896
|
+
function Z(t, e, s, n, o, a, h, r) {
|
|
897
|
+
const i = [], c = [r.maxRandomnessOffset || 1, (r.maxRandomnessOffset || 1) + .3];
|
|
898
|
+
let l = [0, 0];
|
|
899
|
+
const u = r.disableMultiStroke ? 1 : 2, p = r.preserveVertices;
|
|
900
|
+
for (let f = 0; f < u; f++) 0 === f ? i.push({
|
|
901
|
+
op: "move",
|
|
902
|
+
data: [h[0], h[1]]
|
|
903
|
+
}) : i.push({
|
|
904
|
+
op: "move",
|
|
905
|
+
data: [h[0] + (p ? 0 : G(c[0], r)), h[1] + (p ? 0 : G(c[0], r))]
|
|
906
|
+
}), l = p ? [o, a] : [o + G(c[f], r), a + G(c[f], r)], i.push({
|
|
907
|
+
op: "bcurveTo",
|
|
908
|
+
data: [
|
|
909
|
+
t + G(c[f], r),
|
|
910
|
+
e + G(c[f], r),
|
|
911
|
+
s + G(c[f], r),
|
|
912
|
+
n + G(c[f], r),
|
|
913
|
+
l[0],
|
|
914
|
+
l[1]
|
|
915
|
+
]
|
|
916
|
+
});
|
|
917
|
+
return i;
|
|
918
|
+
}
|
|
919
|
+
function Q(t) {
|
|
920
|
+
return [...t];
|
|
921
|
+
}
|
|
922
|
+
function H(t, e = 0) {
|
|
923
|
+
const s = t.length;
|
|
924
|
+
if (s < 3) throw new Error("A curve must have at least three points.");
|
|
925
|
+
const n = [];
|
|
926
|
+
if (3 === s) n.push(Q(t[0]), Q(t[1]), Q(t[2]), Q(t[2]));
|
|
927
|
+
else {
|
|
928
|
+
const s = [];
|
|
929
|
+
s.push(t[0], t[0]);
|
|
930
|
+
for (let e = 1; e < t.length; e++) s.push(t[e]), e === t.length - 1 && s.push(t[e]);
|
|
931
|
+
const o = [], a = 1 - e;
|
|
932
|
+
n.push(Q(s[0]));
|
|
933
|
+
for (let t = 1; t + 2 < s.length; t++) {
|
|
934
|
+
const e = s[t];
|
|
935
|
+
o[0] = [e[0], e[1]], o[1] = [e[0] + (a * s[t + 1][0] - a * s[t - 1][0]) / 6, e[1] + (a * s[t + 1][1] - a * s[t - 1][1]) / 6], o[2] = [s[t + 1][0] + (a * s[t][0] - a * s[t + 2][0]) / 6, s[t + 1][1] + (a * s[t][1] - a * s[t + 2][1]) / 6], o[3] = [s[t + 1][0], s[t + 1][1]], n.push(o[1], o[2], o[3]);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return n;
|
|
939
|
+
}
|
|
940
|
+
function N(t, e) {
|
|
941
|
+
return Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2);
|
|
942
|
+
}
|
|
943
|
+
function B(t, e, s) {
|
|
944
|
+
const n = N(e, s);
|
|
945
|
+
if (0 === n) return N(t, e);
|
|
946
|
+
let o = ((t[0] - e[0]) * (s[0] - e[0]) + (t[1] - e[1]) * (s[1] - e[1])) / n;
|
|
947
|
+
return o = Math.max(0, Math.min(1, o)), N(t, J(e, s, o));
|
|
948
|
+
}
|
|
949
|
+
function J(t, e, s) {
|
|
950
|
+
return [t[0] + (e[0] - t[0]) * s, t[1] + (e[1] - t[1]) * s];
|
|
951
|
+
}
|
|
952
|
+
function K(t, e, s, n) {
|
|
953
|
+
const o = n || [];
|
|
954
|
+
if (function(t, e) {
|
|
955
|
+
const s = t[e + 0], n = t[e + 1], o = t[e + 2], a = t[e + 3];
|
|
956
|
+
let h = 3 * n[0] - 2 * s[0] - a[0];
|
|
957
|
+
h *= h;
|
|
958
|
+
let r = 3 * n[1] - 2 * s[1] - a[1];
|
|
959
|
+
r *= r;
|
|
960
|
+
let i = 3 * o[0] - 2 * a[0] - s[0];
|
|
961
|
+
i *= i;
|
|
962
|
+
let c = 3 * o[1] - 2 * a[1] - s[1];
|
|
963
|
+
return c *= c, h < i && (h = i), r < c && (r = c), h + r;
|
|
964
|
+
}(t, e) < s) {
|
|
965
|
+
const s = t[e + 0];
|
|
966
|
+
if (o.length) (a = o[o.length - 1], h = s, Math.sqrt(N(a, h))) > 1 && o.push(s);
|
|
967
|
+
else o.push(s);
|
|
968
|
+
o.push(t[e + 3]);
|
|
969
|
+
} else {
|
|
970
|
+
const n = .5, a = t[e + 0], h = t[e + 1], r = t[e + 2], i = t[e + 3], c = J(a, h, n), l = J(h, r, n), u = J(r, i, n), p = J(c, l, n), f = J(l, u, n), d = J(p, f, n);
|
|
971
|
+
K([
|
|
972
|
+
a,
|
|
973
|
+
c,
|
|
974
|
+
p,
|
|
975
|
+
d
|
|
976
|
+
], 0, s, o), K([
|
|
977
|
+
d,
|
|
978
|
+
f,
|
|
979
|
+
u,
|
|
980
|
+
i
|
|
981
|
+
], 0, s, o);
|
|
982
|
+
}
|
|
983
|
+
var a, h;
|
|
984
|
+
return o;
|
|
985
|
+
}
|
|
986
|
+
function U(t, e) {
|
|
987
|
+
return X(t, 0, t.length, e);
|
|
988
|
+
}
|
|
989
|
+
function X(t, e, s, n, o) {
|
|
990
|
+
const a = o || [], h = t[e], r = t[s - 1];
|
|
991
|
+
let i = 0, c = 1;
|
|
992
|
+
for (let n = e + 1; n < s - 1; ++n) {
|
|
993
|
+
const e = B(t[n], h, r);
|
|
994
|
+
e > i && (i = e, c = n);
|
|
995
|
+
}
|
|
996
|
+
return Math.sqrt(i) > n ? (X(t, e, c + 1, n, a), X(t, c, s, n, a)) : (a.length || a.push(h), a.push(r)), a;
|
|
997
|
+
}
|
|
998
|
+
function Y(t, e = .15, s) {
|
|
999
|
+
const n = [], o = (t.length - 1) / 3;
|
|
1000
|
+
for (let s = 0; s < o; s++) K(t, 3 * s, e, n);
|
|
1001
|
+
return s && s > 0 ? X(n, 0, n.length, s) : n;
|
|
1002
|
+
}
|
|
1003
|
+
const tt = "none";
|
|
1004
|
+
var et = class {
|
|
1005
|
+
constructor(t) {
|
|
1006
|
+
this.defaultOptions = {
|
|
1007
|
+
maxRandomnessOffset: 2,
|
|
1008
|
+
roughness: 1,
|
|
1009
|
+
bowing: 1,
|
|
1010
|
+
stroke: "#000",
|
|
1011
|
+
strokeWidth: 1,
|
|
1012
|
+
curveTightness: 0,
|
|
1013
|
+
curveFitting: .95,
|
|
1014
|
+
curveStepCount: 9,
|
|
1015
|
+
fillStyle: "hachure",
|
|
1016
|
+
fillWeight: -1,
|
|
1017
|
+
hachureAngle: -41,
|
|
1018
|
+
hachureGap: -1,
|
|
1019
|
+
dashOffset: -1,
|
|
1020
|
+
dashGap: -1,
|
|
1021
|
+
zigzagOffset: -1,
|
|
1022
|
+
seed: 0,
|
|
1023
|
+
disableMultiStroke: !1,
|
|
1024
|
+
disableMultiStrokeFill: !1,
|
|
1025
|
+
preserveVertices: !1,
|
|
1026
|
+
fillShapeRoughnessGain: .8
|
|
1027
|
+
}, this.config = t || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
|
|
1028
|
+
}
|
|
1029
|
+
static newSeed() {
|
|
1030
|
+
return Math.floor(Math.random() * 2 ** 31);
|
|
1031
|
+
}
|
|
1032
|
+
_o(t) {
|
|
1033
|
+
return t ? Object.assign({}, this.defaultOptions, t) : this.defaultOptions;
|
|
1034
|
+
}
|
|
1035
|
+
_d(t, e, s) {
|
|
1036
|
+
return {
|
|
1037
|
+
shape: t,
|
|
1038
|
+
sets: e || [],
|
|
1039
|
+
options: s || this.defaultOptions
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
line(t, e, s, n, o) {
|
|
1043
|
+
const a = this._o(o);
|
|
1044
|
+
return this._d("line", [v(t, e, s, n, a)], a);
|
|
1045
|
+
}
|
|
1046
|
+
rectangle(t, e, s, n, o) {
|
|
1047
|
+
const a = this._o(o), h = [], r = O(t, e, s, n, a);
|
|
1048
|
+
if (a.fill) {
|
|
1049
|
+
const o = [
|
|
1050
|
+
[t, e],
|
|
1051
|
+
[t + s, e],
|
|
1052
|
+
[t + s, e + n],
|
|
1053
|
+
[t, e + n]
|
|
1054
|
+
];
|
|
1055
|
+
"solid" === a.fillStyle ? h.push(I([o], a)) : h.push(C([o], a));
|
|
1056
|
+
}
|
|
1057
|
+
return a.stroke !== tt && h.push(r), this._d("rectangle", h, a);
|
|
1058
|
+
}
|
|
1059
|
+
ellipse(t, e, s, n, o) {
|
|
1060
|
+
const a = this._o(o), h = [], r = T(s, n, a), i = D(t, e, a, r);
|
|
1061
|
+
if (a.fill) if ("solid" === a.fillStyle) {
|
|
1062
|
+
const s = D(t, e, a, r).opset;
|
|
1063
|
+
s.type = "fillPath", h.push(s);
|
|
1064
|
+
} else h.push(C([i.estimatedPoints], a));
|
|
1065
|
+
return a.stroke !== tt && h.push(i.opset), this._d("ellipse", h, a);
|
|
1066
|
+
}
|
|
1067
|
+
circle(t, e, s, n) {
|
|
1068
|
+
const o = this.ellipse(t, e, s, s, n);
|
|
1069
|
+
return o.shape = "circle", o;
|
|
1070
|
+
}
|
|
1071
|
+
linearPath(t, e) {
|
|
1072
|
+
const s = this._o(e);
|
|
1073
|
+
return this._d("linearPath", [S(t, !1, s)], s);
|
|
1074
|
+
}
|
|
1075
|
+
arc(t, e, s, n, o, a, h = !1, r) {
|
|
1076
|
+
const i = this._o(r), c = [], l = A(t, e, s, n, o, a, h, !0, i);
|
|
1077
|
+
if (h && i.fill) if ("solid" === i.fillStyle) {
|
|
1078
|
+
const h = Object.assign({}, i);
|
|
1079
|
+
h.disableMultiStroke = !0;
|
|
1080
|
+
const r = A(t, e, s, n, o, a, !0, !1, h);
|
|
1081
|
+
r.type = "fillPath", c.push(r);
|
|
1082
|
+
} else c.push(function(t, e, s, n, o, a, h) {
|
|
1083
|
+
const r = t, i = e;
|
|
1084
|
+
let c = Math.abs(s / 2), l = Math.abs(n / 2);
|
|
1085
|
+
c += G(.01 * c, h), l += G(.01 * l, h);
|
|
1086
|
+
let u = o, p = a;
|
|
1087
|
+
for (; u < 0;) u += 2 * Math.PI, p += 2 * Math.PI;
|
|
1088
|
+
p - u > 2 * Math.PI && (u = 0, p = 2 * Math.PI);
|
|
1089
|
+
const f = (p - u) / h.curveStepCount, d = [];
|
|
1090
|
+
for (let t = u; t <= p; t += f) d.push([r + c * Math.cos(t), i + l * Math.sin(t)]);
|
|
1091
|
+
return d.push([r + c * Math.cos(p), i + l * Math.sin(p)]), d.push([r, i]), C([d], h);
|
|
1092
|
+
}(t, e, s, n, o, a, i));
|
|
1093
|
+
return i.stroke !== tt && c.push(l), this._d("arc", c, i);
|
|
1094
|
+
}
|
|
1095
|
+
curve(t, e) {
|
|
1096
|
+
const s = this._o(e), n = [], o = L(t, s);
|
|
1097
|
+
if (s.fill && s.fill !== tt) if ("solid" === s.fillStyle) {
|
|
1098
|
+
const e = L(t, Object.assign(Object.assign({}, s), {
|
|
1099
|
+
disableMultiStroke: !0,
|
|
1100
|
+
roughness: s.roughness ? s.roughness + s.fillShapeRoughnessGain : 0
|
|
1101
|
+
}));
|
|
1102
|
+
n.push({
|
|
1103
|
+
type: "fillPath",
|
|
1104
|
+
ops: this._mergedShape(e.ops)
|
|
1105
|
+
});
|
|
1106
|
+
} else {
|
|
1107
|
+
const e = [], o = t;
|
|
1108
|
+
if (o.length) {
|
|
1109
|
+
const t = "number" == typeof o[0][0] ? [o] : o;
|
|
1110
|
+
for (const n of t) n.length < 3 ? e.push(...n) : 3 === n.length ? e.push(...Y(H([
|
|
1111
|
+
n[0],
|
|
1112
|
+
n[0],
|
|
1113
|
+
n[1],
|
|
1114
|
+
n[2]
|
|
1115
|
+
]), 10, (1 + s.roughness) / 2)) : e.push(...Y(H(n), 10, (1 + s.roughness) / 2));
|
|
1116
|
+
}
|
|
1117
|
+
e.length && n.push(C([e], s));
|
|
1118
|
+
}
|
|
1119
|
+
return s.stroke !== tt && n.push(o), this._d("curve", n, s);
|
|
1120
|
+
}
|
|
1121
|
+
polygon(t, e) {
|
|
1122
|
+
const s = this._o(e), n = [], o = S(t, !0, s);
|
|
1123
|
+
return s.fill && ("solid" === s.fillStyle ? n.push(I([t], s)) : n.push(C([t], s))), s.stroke !== tt && n.push(o), this._d("polygon", n, s);
|
|
1124
|
+
}
|
|
1125
|
+
path(t, e) {
|
|
1126
|
+
const s = this._o(e), n = [];
|
|
1127
|
+
if (!t) return this._d("path", n, s);
|
|
1128
|
+
t = (t || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
|
|
1129
|
+
const o = s.fill && "transparent" !== s.fill && s.fill !== tt, a = s.stroke !== tt, h = !!(s.simplification && s.simplification < 1), r = function(t, e, s) {
|
|
1130
|
+
const n = m(y(b(t))), o = [];
|
|
1131
|
+
let a = [], h = [0, 0], r = [];
|
|
1132
|
+
const i = () => {
|
|
1133
|
+
r.length >= 4 && a.push(...Y(r, e)), r = [];
|
|
1134
|
+
}, c = () => {
|
|
1135
|
+
i(), a.length && (o.push(a), a = []);
|
|
1136
|
+
};
|
|
1137
|
+
for (const { key: t, data: e } of n) switch (t) {
|
|
1138
|
+
case "M":
|
|
1139
|
+
c(), h = [e[0], e[1]], a.push(h);
|
|
1140
|
+
break;
|
|
1141
|
+
case "L":
|
|
1142
|
+
i(), a.push([e[0], e[1]]);
|
|
1143
|
+
break;
|
|
1144
|
+
case "C":
|
|
1145
|
+
if (!r.length) {
|
|
1146
|
+
const t = a.length ? a[a.length - 1] : h;
|
|
1147
|
+
r.push([t[0], t[1]]);
|
|
1148
|
+
}
|
|
1149
|
+
r.push([e[0], e[1]]), r.push([e[2], e[3]]), r.push([e[4], e[5]]);
|
|
1150
|
+
break;
|
|
1151
|
+
case "Z": i(), a.push([h[0], h[1]]);
|
|
1152
|
+
}
|
|
1153
|
+
if (c(), !s) return o;
|
|
1154
|
+
const l = [];
|
|
1155
|
+
for (const t of o) {
|
|
1156
|
+
const e = U(t, s);
|
|
1157
|
+
e.length && l.push(e);
|
|
1158
|
+
}
|
|
1159
|
+
return l;
|
|
1160
|
+
}(t, 1, h ? 4 - 4 * (s.simplification || 1) : (1 + s.roughness) / 2), i = _(t, s);
|
|
1161
|
+
if (o) if ("solid" === s.fillStyle) if (1 === r.length) {
|
|
1162
|
+
const e = _(t, Object.assign(Object.assign({}, s), {
|
|
1163
|
+
disableMultiStroke: !0,
|
|
1164
|
+
roughness: s.roughness ? s.roughness + s.fillShapeRoughnessGain : 0
|
|
1165
|
+
}));
|
|
1166
|
+
n.push({
|
|
1167
|
+
type: "fillPath",
|
|
1168
|
+
ops: this._mergedShape(e.ops)
|
|
1169
|
+
});
|
|
1170
|
+
} else n.push(I(r, s));
|
|
1171
|
+
else n.push(C(r, s));
|
|
1172
|
+
return a && (h ? r.forEach(((t) => {
|
|
1173
|
+
n.push(S(t, !1, s));
|
|
1174
|
+
})) : n.push(i)), this._d("path", n, s);
|
|
1175
|
+
}
|
|
1176
|
+
opsToPath(t, e) {
|
|
1177
|
+
let s = "";
|
|
1178
|
+
for (const n of t.ops) {
|
|
1179
|
+
const t = "number" == typeof e && e >= 0 ? n.data.map(((t) => +t.toFixed(e))) : n.data;
|
|
1180
|
+
switch (n.op) {
|
|
1181
|
+
case "move":
|
|
1182
|
+
s += `M${t[0]} ${t[1]} `;
|
|
1183
|
+
break;
|
|
1184
|
+
case "bcurveTo":
|
|
1185
|
+
s += `C${t[0]} ${t[1]}, ${t[2]} ${t[3]}, ${t[4]} ${t[5]} `;
|
|
1186
|
+
break;
|
|
1187
|
+
case "lineTo": s += `L${t[0]} ${t[1]} `;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return s.trim();
|
|
1191
|
+
}
|
|
1192
|
+
toPaths(t) {
|
|
1193
|
+
const e = t.sets || [], s = t.options || this.defaultOptions, n = [];
|
|
1194
|
+
for (const t of e) {
|
|
1195
|
+
let e = null;
|
|
1196
|
+
switch (t.type) {
|
|
1197
|
+
case "path":
|
|
1198
|
+
e = {
|
|
1199
|
+
d: this.opsToPath(t),
|
|
1200
|
+
stroke: s.stroke,
|
|
1201
|
+
strokeWidth: s.strokeWidth,
|
|
1202
|
+
fill: tt
|
|
1203
|
+
};
|
|
1204
|
+
break;
|
|
1205
|
+
case "fillPath":
|
|
1206
|
+
e = {
|
|
1207
|
+
d: this.opsToPath(t),
|
|
1208
|
+
stroke: tt,
|
|
1209
|
+
strokeWidth: 0,
|
|
1210
|
+
fill: s.fill || tt
|
|
1211
|
+
};
|
|
1212
|
+
break;
|
|
1213
|
+
case "fillSketch": e = this.fillSketch(t, s);
|
|
1214
|
+
}
|
|
1215
|
+
e && n.push(e);
|
|
1216
|
+
}
|
|
1217
|
+
return n;
|
|
1218
|
+
}
|
|
1219
|
+
fillSketch(t, e) {
|
|
1220
|
+
let s = e.fillWeight;
|
|
1221
|
+
return s < 0 && (s = e.strokeWidth / 2), {
|
|
1222
|
+
d: this.opsToPath(t),
|
|
1223
|
+
stroke: e.fill || tt,
|
|
1224
|
+
strokeWidth: s,
|
|
1225
|
+
fill: tt
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
_mergedShape(t) {
|
|
1229
|
+
return t.filter(((t, e) => 0 === e || "move" !== t.op));
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
var st = class {
|
|
1233
|
+
constructor(t, e) {
|
|
1234
|
+
this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new et(e);
|
|
1235
|
+
}
|
|
1236
|
+
draw(t) {
|
|
1237
|
+
const e = t.sets || [], s = t.options || this.getDefaultOptions(), n = this.ctx, o = t.options.fixedDecimalPlaceDigits;
|
|
1238
|
+
for (const a of e) switch (a.type) {
|
|
1239
|
+
case "path":
|
|
1240
|
+
n.save(), n.strokeStyle = "none" === s.stroke ? "transparent" : s.stroke, n.lineWidth = s.strokeWidth, s.strokeLineDash && n.setLineDash(s.strokeLineDash), s.strokeLineDashOffset && (n.lineDashOffset = s.strokeLineDashOffset), this._drawToContext(n, a, o), n.restore();
|
|
1241
|
+
break;
|
|
1242
|
+
case "fillPath": {
|
|
1243
|
+
n.save(), n.fillStyle = s.fill || "";
|
|
1244
|
+
const e = "curve" === t.shape || "polygon" === t.shape || "path" === t.shape ? "evenodd" : "nonzero";
|
|
1245
|
+
this._drawToContext(n, a, o, e), n.restore();
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
case "fillSketch": this.fillSketch(n, a, s);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
fillSketch(t, e, s) {
|
|
1252
|
+
let n = s.fillWeight;
|
|
1253
|
+
n < 0 && (n = s.strokeWidth / 2), t.save(), s.fillLineDash && t.setLineDash(s.fillLineDash), s.fillLineDashOffset && (t.lineDashOffset = s.fillLineDashOffset), t.strokeStyle = s.fill || "", t.lineWidth = n, this._drawToContext(t, e, s.fixedDecimalPlaceDigits), t.restore();
|
|
1254
|
+
}
|
|
1255
|
+
_drawToContext(t, e, s, n = "nonzero") {
|
|
1256
|
+
t.beginPath();
|
|
1257
|
+
for (const n of e.ops) {
|
|
1258
|
+
const e = "number" == typeof s && s >= 0 ? n.data.map(((t) => +t.toFixed(s))) : n.data;
|
|
1259
|
+
switch (n.op) {
|
|
1260
|
+
case "move":
|
|
1261
|
+
t.moveTo(e[0], e[1]);
|
|
1262
|
+
break;
|
|
1263
|
+
case "bcurveTo":
|
|
1264
|
+
t.bezierCurveTo(e[0], e[1], e[2], e[3], e[4], e[5]);
|
|
1265
|
+
break;
|
|
1266
|
+
case "lineTo": t.lineTo(e[0], e[1]);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
"fillPath" === e.type ? t.fill(n) : t.stroke();
|
|
1270
|
+
}
|
|
1271
|
+
get generator() {
|
|
1272
|
+
return this.gen;
|
|
1273
|
+
}
|
|
1274
|
+
getDefaultOptions() {
|
|
1275
|
+
return this.gen.defaultOptions;
|
|
1276
|
+
}
|
|
1277
|
+
line(t, e, s, n, o) {
|
|
1278
|
+
const a = this.gen.line(t, e, s, n, o);
|
|
1279
|
+
return this.draw(a), a;
|
|
1280
|
+
}
|
|
1281
|
+
rectangle(t, e, s, n, o) {
|
|
1282
|
+
const a = this.gen.rectangle(t, e, s, n, o);
|
|
1283
|
+
return this.draw(a), a;
|
|
1284
|
+
}
|
|
1285
|
+
ellipse(t, e, s, n, o) {
|
|
1286
|
+
const a = this.gen.ellipse(t, e, s, n, o);
|
|
1287
|
+
return this.draw(a), a;
|
|
1288
|
+
}
|
|
1289
|
+
circle(t, e, s, n) {
|
|
1290
|
+
const o = this.gen.circle(t, e, s, n);
|
|
1291
|
+
return this.draw(o), o;
|
|
1292
|
+
}
|
|
1293
|
+
linearPath(t, e) {
|
|
1294
|
+
const s = this.gen.linearPath(t, e);
|
|
1295
|
+
return this.draw(s), s;
|
|
1296
|
+
}
|
|
1297
|
+
polygon(t, e) {
|
|
1298
|
+
const s = this.gen.polygon(t, e);
|
|
1299
|
+
return this.draw(s), s;
|
|
1300
|
+
}
|
|
1301
|
+
arc(t, e, s, n, o, a, h = !1, r) {
|
|
1302
|
+
const i = this.gen.arc(t, e, s, n, o, a, h, r);
|
|
1303
|
+
return this.draw(i), i;
|
|
1304
|
+
}
|
|
1305
|
+
curve(t, e) {
|
|
1306
|
+
const s = this.gen.curve(t, e);
|
|
1307
|
+
return this.draw(s), s;
|
|
1308
|
+
}
|
|
1309
|
+
path(t, e) {
|
|
1310
|
+
const s = this.gen.path(t, e);
|
|
1311
|
+
return this.draw(s), s;
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
const nt = "http://www.w3.org/2000/svg";
|
|
1315
|
+
var ot = class {
|
|
1316
|
+
constructor(t, e) {
|
|
1317
|
+
this.svg = t, this.gen = new et(e);
|
|
1318
|
+
}
|
|
1319
|
+
draw(t) {
|
|
1320
|
+
const e = t.sets || [], s = t.options || this.getDefaultOptions(), n = this.svg.ownerDocument || window.document, o = n.createElementNS(nt, "g"), a = t.options.fixedDecimalPlaceDigits;
|
|
1321
|
+
for (const h of e) {
|
|
1322
|
+
let e = null;
|
|
1323
|
+
switch (h.type) {
|
|
1324
|
+
case "path":
|
|
1325
|
+
e = n.createElementNS(nt, "path"), e.setAttribute("d", this.opsToPath(h, a)), e.setAttribute("stroke", s.stroke), e.setAttribute("stroke-width", s.strokeWidth + ""), e.setAttribute("fill", "none"), s.strokeLineDash && e.setAttribute("stroke-dasharray", s.strokeLineDash.join(" ").trim()), s.strokeLineDashOffset && e.setAttribute("stroke-dashoffset", `${s.strokeLineDashOffset}`);
|
|
1326
|
+
break;
|
|
1327
|
+
case "fillPath":
|
|
1328
|
+
e = n.createElementNS(nt, "path"), e.setAttribute("d", this.opsToPath(h, a)), e.setAttribute("stroke", "none"), e.setAttribute("stroke-width", "0"), e.setAttribute("fill", s.fill || ""), "curve" !== t.shape && "polygon" !== t.shape || e.setAttribute("fill-rule", "evenodd");
|
|
1329
|
+
break;
|
|
1330
|
+
case "fillSketch": e = this.fillSketch(n, h, s);
|
|
1331
|
+
}
|
|
1332
|
+
e && o.appendChild(e);
|
|
1333
|
+
}
|
|
1334
|
+
return o;
|
|
1335
|
+
}
|
|
1336
|
+
fillSketch(t, e, s) {
|
|
1337
|
+
let n = s.fillWeight;
|
|
1338
|
+
n < 0 && (n = s.strokeWidth / 2);
|
|
1339
|
+
const o = t.createElementNS(nt, "path");
|
|
1340
|
+
return o.setAttribute("d", this.opsToPath(e, s.fixedDecimalPlaceDigits)), o.setAttribute("stroke", s.fill || ""), o.setAttribute("stroke-width", n + ""), o.setAttribute("fill", "none"), s.fillLineDash && o.setAttribute("stroke-dasharray", s.fillLineDash.join(" ").trim()), s.fillLineDashOffset && o.setAttribute("stroke-dashoffset", `${s.fillLineDashOffset}`), o;
|
|
1341
|
+
}
|
|
1342
|
+
get generator() {
|
|
1343
|
+
return this.gen;
|
|
1344
|
+
}
|
|
1345
|
+
getDefaultOptions() {
|
|
1346
|
+
return this.gen.defaultOptions;
|
|
1347
|
+
}
|
|
1348
|
+
opsToPath(t, e) {
|
|
1349
|
+
return this.gen.opsToPath(t, e);
|
|
1350
|
+
}
|
|
1351
|
+
line(t, e, s, n, o) {
|
|
1352
|
+
const a = this.gen.line(t, e, s, n, o);
|
|
1353
|
+
return this.draw(a);
|
|
1354
|
+
}
|
|
1355
|
+
rectangle(t, e, s, n, o) {
|
|
1356
|
+
const a = this.gen.rectangle(t, e, s, n, o);
|
|
1357
|
+
return this.draw(a);
|
|
1358
|
+
}
|
|
1359
|
+
ellipse(t, e, s, n, o) {
|
|
1360
|
+
const a = this.gen.ellipse(t, e, s, n, o);
|
|
1361
|
+
return this.draw(a);
|
|
1362
|
+
}
|
|
1363
|
+
circle(t, e, s, n) {
|
|
1364
|
+
const o = this.gen.circle(t, e, s, n);
|
|
1365
|
+
return this.draw(o);
|
|
1366
|
+
}
|
|
1367
|
+
linearPath(t, e) {
|
|
1368
|
+
const s = this.gen.linearPath(t, e);
|
|
1369
|
+
return this.draw(s);
|
|
1370
|
+
}
|
|
1371
|
+
polygon(t, e) {
|
|
1372
|
+
const s = this.gen.polygon(t, e);
|
|
1373
|
+
return this.draw(s);
|
|
1374
|
+
}
|
|
1375
|
+
arc(t, e, s, n, o, a, h = !1, r) {
|
|
1376
|
+
const i = this.gen.arc(t, e, s, n, o, a, h, r);
|
|
1377
|
+
return this.draw(i);
|
|
1378
|
+
}
|
|
1379
|
+
curve(t, e) {
|
|
1380
|
+
const s = this.gen.curve(t, e);
|
|
1381
|
+
return this.draw(s);
|
|
1382
|
+
}
|
|
1383
|
+
path(t, e) {
|
|
1384
|
+
const s = this.gen.path(t, e);
|
|
1385
|
+
return this.draw(s);
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
var at = {
|
|
1389
|
+
canvas: (t, e) => new st(t, e),
|
|
1390
|
+
svg: (t, e) => new ot(t, e),
|
|
1391
|
+
generator: (t) => new et(t),
|
|
1392
|
+
newSeed: () => et.newSeed()
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
//#endregion
|
|
1396
|
+
export { at as t };
|