schematic-symbols 0.0.14 → 0.0.15

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/index.cjs DELETED
@@ -1,3824 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
-
33
- // node_modules/svg-path-parser/parser.js
34
- var require_parser = __commonJS({
35
- "node_modules/svg-path-parser/parser.js"(exports2, module2) {
36
- "use strict";
37
- function peg$subclass2(child, parent) {
38
- function ctor() {
39
- this.constructor = child;
40
- }
41
- ctor.prototype = parent.prototype;
42
- child.prototype = new ctor();
43
- }
44
- function peg$SyntaxError2(message, expected, found, location) {
45
- this.message = message;
46
- this.expected = expected;
47
- this.found = found;
48
- this.location = location;
49
- this.name = "SyntaxError";
50
- if (typeof Error.captureStackTrace === "function") {
51
- Error.captureStackTrace(this, peg$SyntaxError2);
52
- }
53
- }
54
- peg$subclass2(peg$SyntaxError2, Error);
55
- peg$SyntaxError2.buildMessage = function(expected, found) {
56
- var DESCRIBE_EXPECTATION_FNS = {
57
- literal: function(expectation) {
58
- return '"' + literalEscape(expectation.text) + '"';
59
- },
60
- "class": function(expectation) {
61
- var escapedParts = "", i;
62
- for (i = 0; i < expectation.parts.length; i++) {
63
- escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]);
64
- }
65
- return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
66
- },
67
- any: function(expectation) {
68
- return "any character";
69
- },
70
- end: function(expectation) {
71
- return "end of input";
72
- },
73
- other: function(expectation) {
74
- return expectation.description;
75
- }
76
- };
77
- function hex(ch) {
78
- return ch.charCodeAt(0).toString(16).toUpperCase();
79
- }
80
- function literalEscape(s) {
81
- return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
82
- return "\\x0" + hex(ch);
83
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
84
- return "\\x" + hex(ch);
85
- });
86
- }
87
- function classEscape(s) {
88
- return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
89
- return "\\x0" + hex(ch);
90
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
91
- return "\\x" + hex(ch);
92
- });
93
- }
94
- function describeExpectation(expectation) {
95
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
96
- }
97
- function describeExpected(expected2) {
98
- var descriptions = new Array(expected2.length), i, j;
99
- for (i = 0; i < expected2.length; i++) {
100
- descriptions[i] = describeExpectation(expected2[i]);
101
- }
102
- descriptions.sort();
103
- if (descriptions.length > 0) {
104
- for (i = 1, j = 1; i < descriptions.length; i++) {
105
- if (descriptions[i - 1] !== descriptions[i]) {
106
- descriptions[j] = descriptions[i];
107
- j++;
108
- }
109
- }
110
- descriptions.length = j;
111
- }
112
- switch (descriptions.length) {
113
- case 1:
114
- return descriptions[0];
115
- case 2:
116
- return descriptions[0] + " or " + descriptions[1];
117
- default:
118
- return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
119
- }
120
- }
121
- function describeFound(found2) {
122
- return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
123
- }
124
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
125
- };
126
- function peg$parse2(input, options) {
127
- options = options !== void 0 ? options : {};
128
- var peg$FAILED = {}, peg$startRuleFunctions = { svg_path: peg$parsesvg_path }, peg$startRuleFunction = peg$parsesvg_path, peg$c0 = function(data) {
129
- if (!data) return [];
130
- for (var cmds2 = [], i = 0; i < data.length; i++) cmds2 = cmds2.concat.apply(cmds2, data[i]);
131
- var first = cmds2[0];
132
- if (first && first.code == "m") {
133
- delete first.relative;
134
- first.code = "M";
135
- }
136
- return cmds2;
137
- }, peg$c1 = function(first, more) {
138
- return merge(first, more);
139
- }, peg$c2 = /^[Mm]/, peg$c3 = peg$classExpectation(["M", "m"], false, false), peg$c4 = function(c, first, more) {
140
- var move = commands(c, [first]);
141
- if (more) move = move.concat(commands(c == "M" ? "L" : "l", more[1]));
142
- return move;
143
- }, peg$c5 = /^[Zz]/, peg$c6 = peg$classExpectation(["Z", "z"], false, false), peg$c7 = function() {
144
- return commands("Z");
145
- }, peg$c8 = /^[Ll]/, peg$c9 = peg$classExpectation(["L", "l"], false, false), peg$c10 = function(c, args) {
146
- return commands(c, args);
147
- }, peg$c11 = /^[Hh]/, peg$c12 = peg$classExpectation(["H", "h"], false, false), peg$c13 = function(c, args) {
148
- return commands(c, args.map(function(x) {
149
- return { x };
150
- }));
151
- }, peg$c14 = /^[Vv]/, peg$c15 = peg$classExpectation(["V", "v"], false, false), peg$c16 = function(c, args) {
152
- return commands(c, args.map(function(y) {
153
- return { y };
154
- }));
155
- }, peg$c17 = /^[Cc]/, peg$c18 = peg$classExpectation(["C", "c"], false, false), peg$c19 = function(a, b, c) {
156
- return { x1: a.x, y1: a.y, x2: b.x, y2: b.y, x: c.x, y: c.y };
157
- }, peg$c20 = /^[Ss]/, peg$c21 = peg$classExpectation(["S", "s"], false, false), peg$c22 = function(b, c) {
158
- return { x2: b.x, y2: b.y, x: c.x, y: c.y };
159
- }, peg$c23 = /^[Qq]/, peg$c24 = peg$classExpectation(["Q", "q"], false, false), peg$c25 = function(a, b) {
160
- return { x1: a.x, y1: a.y, x: b.x, y: b.y };
161
- }, peg$c26 = /^[Tt]/, peg$c27 = peg$classExpectation(["T", "t"], false, false), peg$c28 = /^[Aa]/, peg$c29 = peg$classExpectation(["A", "a"], false, false), peg$c30 = function(rx, ry, xrot, large, sweep, xy) {
162
- return { rx, ry, xAxisRotation: xrot, largeArc: large, sweep, x: xy.x, y: xy.y };
163
- }, peg$c31 = function(x, y) {
164
- return { x, y };
165
- }, peg$c32 = function(n) {
166
- return n * 1;
167
- }, peg$c33 = function(parts) {
168
- return parts.join("") * 1;
169
- }, peg$c34 = /^[01]/, peg$c35 = peg$classExpectation(["0", "1"], false, false), peg$c36 = function(bit) {
170
- return bit == "1";
171
- }, peg$c37 = function() {
172
- return "";
173
- }, peg$c38 = ",", peg$c39 = peg$literalExpectation(",", false), peg$c40 = function(parts) {
174
- return parts.join("");
175
- }, peg$c41 = ".", peg$c42 = peg$literalExpectation(".", false), peg$c43 = /^[eE]/, peg$c44 = peg$classExpectation(["e", "E"], false, false), peg$c45 = /^[+\-]/, peg$c46 = peg$classExpectation(["+", "-"], false, false), peg$c47 = /^[0-9]/, peg$c48 = peg$classExpectation([["0", "9"]], false, false), peg$c49 = function(digits) {
176
- return digits.join("");
177
- }, peg$c50 = /^[ \t\n\r]/, peg$c51 = peg$classExpectation([" ", " ", "\n", "\r"], false, false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;
178
- if ("startRule" in options) {
179
- if (!(options.startRule in peg$startRuleFunctions)) {
180
- throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
181
- }
182
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
183
- }
184
- function text2() {
185
- return input.substring(peg$savedPos, peg$currPos);
186
- }
187
- function location() {
188
- return peg$computeLocation(peg$savedPos, peg$currPos);
189
- }
190
- function expected(description, location2) {
191
- location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
192
- throw peg$buildStructuredError(
193
- [peg$otherExpectation(description)],
194
- input.substring(peg$savedPos, peg$currPos),
195
- location2
196
- );
197
- }
198
- function error(message, location2) {
199
- location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
200
- throw peg$buildSimpleError(message, location2);
201
- }
202
- function peg$literalExpectation(text3, ignoreCase) {
203
- return { type: "literal", text: text3, ignoreCase };
204
- }
205
- function peg$classExpectation(parts, inverted, ignoreCase) {
206
- return { type: "class", parts, inverted, ignoreCase };
207
- }
208
- function peg$anyExpectation() {
209
- return { type: "any" };
210
- }
211
- function peg$endExpectation() {
212
- return { type: "end" };
213
- }
214
- function peg$otherExpectation(description) {
215
- return { type: "other", description };
216
- }
217
- function peg$computePosDetails(pos) {
218
- var details = peg$posDetailsCache[pos], p;
219
- if (details) {
220
- return details;
221
- } else {
222
- p = pos - 1;
223
- while (!peg$posDetailsCache[p]) {
224
- p--;
225
- }
226
- details = peg$posDetailsCache[p];
227
- details = {
228
- line: details.line,
229
- column: details.column
230
- };
231
- while (p < pos) {
232
- if (input.charCodeAt(p) === 10) {
233
- details.line++;
234
- details.column = 1;
235
- } else {
236
- details.column++;
237
- }
238
- p++;
239
- }
240
- peg$posDetailsCache[pos] = details;
241
- return details;
242
- }
243
- }
244
- function peg$computeLocation(startPos, endPos) {
245
- var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos);
246
- return {
247
- start: {
248
- offset: startPos,
249
- line: startPosDetails.line,
250
- column: startPosDetails.column
251
- },
252
- end: {
253
- offset: endPos,
254
- line: endPosDetails.line,
255
- column: endPosDetails.column
256
- }
257
- };
258
- }
259
- function peg$fail(expected2) {
260
- if (peg$currPos < peg$maxFailPos) {
261
- return;
262
- }
263
- if (peg$currPos > peg$maxFailPos) {
264
- peg$maxFailPos = peg$currPos;
265
- peg$maxFailExpected = [];
266
- }
267
- peg$maxFailExpected.push(expected2);
268
- }
269
- function peg$buildSimpleError(message, location2) {
270
- return new peg$SyntaxError2(message, null, null, location2);
271
- }
272
- function peg$buildStructuredError(expected2, found, location2) {
273
- return new peg$SyntaxError2(
274
- peg$SyntaxError2.buildMessage(expected2, found),
275
- expected2,
276
- found,
277
- location2
278
- );
279
- }
280
- function peg$parsesvg_path() {
281
- var s0, s1, s2, s3, s4;
282
- s0 = peg$currPos;
283
- s1 = [];
284
- s2 = peg$parsewsp();
285
- while (s2 !== peg$FAILED) {
286
- s1.push(s2);
287
- s2 = peg$parsewsp();
288
- }
289
- if (s1 !== peg$FAILED) {
290
- s2 = peg$parsemoveTo_drawTo_commandGroups();
291
- if (s2 === peg$FAILED) {
292
- s2 = null;
293
- }
294
- if (s2 !== peg$FAILED) {
295
- s3 = [];
296
- s4 = peg$parsewsp();
297
- while (s4 !== peg$FAILED) {
298
- s3.push(s4);
299
- s4 = peg$parsewsp();
300
- }
301
- if (s3 !== peg$FAILED) {
302
- peg$savedPos = s0;
303
- s1 = peg$c0(s2);
304
- s0 = s1;
305
- } else {
306
- peg$currPos = s0;
307
- s0 = peg$FAILED;
308
- }
309
- } else {
310
- peg$currPos = s0;
311
- s0 = peg$FAILED;
312
- }
313
- } else {
314
- peg$currPos = s0;
315
- s0 = peg$FAILED;
316
- }
317
- return s0;
318
- }
319
- function peg$parsemoveTo_drawTo_commandGroups() {
320
- var s0, s1, s2, s3, s4, s5;
321
- s0 = peg$currPos;
322
- s1 = peg$parsemoveTo_drawTo_commandGroup();
323
- if (s1 !== peg$FAILED) {
324
- s2 = [];
325
- s3 = peg$currPos;
326
- s4 = [];
327
- s5 = peg$parsewsp();
328
- while (s5 !== peg$FAILED) {
329
- s4.push(s5);
330
- s5 = peg$parsewsp();
331
- }
332
- if (s4 !== peg$FAILED) {
333
- s5 = peg$parsemoveTo_drawTo_commandGroup();
334
- if (s5 !== peg$FAILED) {
335
- s4 = [s4, s5];
336
- s3 = s4;
337
- } else {
338
- peg$currPos = s3;
339
- s3 = peg$FAILED;
340
- }
341
- } else {
342
- peg$currPos = s3;
343
- s3 = peg$FAILED;
344
- }
345
- while (s3 !== peg$FAILED) {
346
- s2.push(s3);
347
- s3 = peg$currPos;
348
- s4 = [];
349
- s5 = peg$parsewsp();
350
- while (s5 !== peg$FAILED) {
351
- s4.push(s5);
352
- s5 = peg$parsewsp();
353
- }
354
- if (s4 !== peg$FAILED) {
355
- s5 = peg$parsemoveTo_drawTo_commandGroup();
356
- if (s5 !== peg$FAILED) {
357
- s4 = [s4, s5];
358
- s3 = s4;
359
- } else {
360
- peg$currPos = s3;
361
- s3 = peg$FAILED;
362
- }
363
- } else {
364
- peg$currPos = s3;
365
- s3 = peg$FAILED;
366
- }
367
- }
368
- if (s2 !== peg$FAILED) {
369
- peg$savedPos = s0;
370
- s1 = peg$c1(s1, s2);
371
- s0 = s1;
372
- } else {
373
- peg$currPos = s0;
374
- s0 = peg$FAILED;
375
- }
376
- } else {
377
- peg$currPos = s0;
378
- s0 = peg$FAILED;
379
- }
380
- return s0;
381
- }
382
- function peg$parsemoveTo_drawTo_commandGroup() {
383
- var s0, s1, s2, s3, s4, s5;
384
- s0 = peg$currPos;
385
- s1 = peg$parsemoveto();
386
- if (s1 !== peg$FAILED) {
387
- s2 = [];
388
- s3 = peg$currPos;
389
- s4 = [];
390
- s5 = peg$parsewsp();
391
- while (s5 !== peg$FAILED) {
392
- s4.push(s5);
393
- s5 = peg$parsewsp();
394
- }
395
- if (s4 !== peg$FAILED) {
396
- s5 = peg$parsedrawto_command();
397
- if (s5 !== peg$FAILED) {
398
- s4 = [s4, s5];
399
- s3 = s4;
400
- } else {
401
- peg$currPos = s3;
402
- s3 = peg$FAILED;
403
- }
404
- } else {
405
- peg$currPos = s3;
406
- s3 = peg$FAILED;
407
- }
408
- while (s3 !== peg$FAILED) {
409
- s2.push(s3);
410
- s3 = peg$currPos;
411
- s4 = [];
412
- s5 = peg$parsewsp();
413
- while (s5 !== peg$FAILED) {
414
- s4.push(s5);
415
- s5 = peg$parsewsp();
416
- }
417
- if (s4 !== peg$FAILED) {
418
- s5 = peg$parsedrawto_command();
419
- if (s5 !== peg$FAILED) {
420
- s4 = [s4, s5];
421
- s3 = s4;
422
- } else {
423
- peg$currPos = s3;
424
- s3 = peg$FAILED;
425
- }
426
- } else {
427
- peg$currPos = s3;
428
- s3 = peg$FAILED;
429
- }
430
- }
431
- if (s2 !== peg$FAILED) {
432
- peg$savedPos = s0;
433
- s1 = peg$c1(s1, s2);
434
- s0 = s1;
435
- } else {
436
- peg$currPos = s0;
437
- s0 = peg$FAILED;
438
- }
439
- } else {
440
- peg$currPos = s0;
441
- s0 = peg$FAILED;
442
- }
443
- return s0;
444
- }
445
- function peg$parsedrawto_command() {
446
- var s0;
447
- s0 = peg$parseclosepath();
448
- if (s0 === peg$FAILED) {
449
- s0 = peg$parselineto();
450
- if (s0 === peg$FAILED) {
451
- s0 = peg$parsehorizontal_lineto();
452
- if (s0 === peg$FAILED) {
453
- s0 = peg$parsevertical_lineto();
454
- if (s0 === peg$FAILED) {
455
- s0 = peg$parsecurveto();
456
- if (s0 === peg$FAILED) {
457
- s0 = peg$parsesmooth_curveto();
458
- if (s0 === peg$FAILED) {
459
- s0 = peg$parsequadratic_bezier_curveto();
460
- if (s0 === peg$FAILED) {
461
- s0 = peg$parsesmooth_quadratic_bezier_curveto();
462
- if (s0 === peg$FAILED) {
463
- s0 = peg$parseelliptical_arc();
464
- }
465
- }
466
- }
467
- }
468
- }
469
- }
470
- }
471
- }
472
- return s0;
473
- }
474
- function peg$parsemoveto() {
475
- var s0, s1, s2, s3, s4, s5, s6;
476
- s0 = peg$currPos;
477
- if (peg$c2.test(input.charAt(peg$currPos))) {
478
- s1 = input.charAt(peg$currPos);
479
- peg$currPos++;
480
- } else {
481
- s1 = peg$FAILED;
482
- if (peg$silentFails === 0) {
483
- peg$fail(peg$c3);
484
- }
485
- }
486
- if (s1 !== peg$FAILED) {
487
- s2 = [];
488
- s3 = peg$parsewsp();
489
- while (s3 !== peg$FAILED) {
490
- s2.push(s3);
491
- s3 = peg$parsewsp();
492
- }
493
- if (s2 !== peg$FAILED) {
494
- s3 = peg$parsecoordinate_pair();
495
- if (s3 !== peg$FAILED) {
496
- s4 = peg$currPos;
497
- s5 = peg$parsecomma_wsp();
498
- if (s5 === peg$FAILED) {
499
- s5 = null;
500
- }
501
- if (s5 !== peg$FAILED) {
502
- s6 = peg$parselineto_argument_sequence();
503
- if (s6 !== peg$FAILED) {
504
- s5 = [s5, s6];
505
- s4 = s5;
506
- } else {
507
- peg$currPos = s4;
508
- s4 = peg$FAILED;
509
- }
510
- } else {
511
- peg$currPos = s4;
512
- s4 = peg$FAILED;
513
- }
514
- if (s4 === peg$FAILED) {
515
- s4 = null;
516
- }
517
- if (s4 !== peg$FAILED) {
518
- peg$savedPos = s0;
519
- s1 = peg$c4(s1, s3, s4);
520
- s0 = s1;
521
- } else {
522
- peg$currPos = s0;
523
- s0 = peg$FAILED;
524
- }
525
- } else {
526
- peg$currPos = s0;
527
- s0 = peg$FAILED;
528
- }
529
- } else {
530
- peg$currPos = s0;
531
- s0 = peg$FAILED;
532
- }
533
- } else {
534
- peg$currPos = s0;
535
- s0 = peg$FAILED;
536
- }
537
- return s0;
538
- }
539
- function peg$parseclosepath() {
540
- var s0, s1;
541
- s0 = peg$currPos;
542
- if (peg$c5.test(input.charAt(peg$currPos))) {
543
- s1 = input.charAt(peg$currPos);
544
- peg$currPos++;
545
- } else {
546
- s1 = peg$FAILED;
547
- if (peg$silentFails === 0) {
548
- peg$fail(peg$c6);
549
- }
550
- }
551
- if (s1 !== peg$FAILED) {
552
- peg$savedPos = s0;
553
- s1 = peg$c7();
554
- }
555
- s0 = s1;
556
- return s0;
557
- }
558
- function peg$parselineto() {
559
- var s0, s1, s2, s3;
560
- s0 = peg$currPos;
561
- if (peg$c8.test(input.charAt(peg$currPos))) {
562
- s1 = input.charAt(peg$currPos);
563
- peg$currPos++;
564
- } else {
565
- s1 = peg$FAILED;
566
- if (peg$silentFails === 0) {
567
- peg$fail(peg$c9);
568
- }
569
- }
570
- if (s1 !== peg$FAILED) {
571
- s2 = [];
572
- s3 = peg$parsewsp();
573
- while (s3 !== peg$FAILED) {
574
- s2.push(s3);
575
- s3 = peg$parsewsp();
576
- }
577
- if (s2 !== peg$FAILED) {
578
- s3 = peg$parselineto_argument_sequence();
579
- if (s3 !== peg$FAILED) {
580
- peg$savedPos = s0;
581
- s1 = peg$c10(s1, s3);
582
- s0 = s1;
583
- } else {
584
- peg$currPos = s0;
585
- s0 = peg$FAILED;
586
- }
587
- } else {
588
- peg$currPos = s0;
589
- s0 = peg$FAILED;
590
- }
591
- } else {
592
- peg$currPos = s0;
593
- s0 = peg$FAILED;
594
- }
595
- return s0;
596
- }
597
- function peg$parselineto_argument_sequence() {
598
- var s0, s1, s2, s3, s4, s5;
599
- s0 = peg$currPos;
600
- s1 = peg$parsecoordinate_pair();
601
- if (s1 !== peg$FAILED) {
602
- s2 = [];
603
- s3 = peg$currPos;
604
- s4 = peg$parsecomma_wsp();
605
- if (s4 === peg$FAILED) {
606
- s4 = null;
607
- }
608
- if (s4 !== peg$FAILED) {
609
- s5 = peg$parsecoordinate_pair();
610
- if (s5 !== peg$FAILED) {
611
- s4 = [s4, s5];
612
- s3 = s4;
613
- } else {
614
- peg$currPos = s3;
615
- s3 = peg$FAILED;
616
- }
617
- } else {
618
- peg$currPos = s3;
619
- s3 = peg$FAILED;
620
- }
621
- while (s3 !== peg$FAILED) {
622
- s2.push(s3);
623
- s3 = peg$currPos;
624
- s4 = peg$parsecomma_wsp();
625
- if (s4 === peg$FAILED) {
626
- s4 = null;
627
- }
628
- if (s4 !== peg$FAILED) {
629
- s5 = peg$parsecoordinate_pair();
630
- if (s5 !== peg$FAILED) {
631
- s4 = [s4, s5];
632
- s3 = s4;
633
- } else {
634
- peg$currPos = s3;
635
- s3 = peg$FAILED;
636
- }
637
- } else {
638
- peg$currPos = s3;
639
- s3 = peg$FAILED;
640
- }
641
- }
642
- if (s2 !== peg$FAILED) {
643
- peg$savedPos = s0;
644
- s1 = peg$c1(s1, s2);
645
- s0 = s1;
646
- } else {
647
- peg$currPos = s0;
648
- s0 = peg$FAILED;
649
- }
650
- } else {
651
- peg$currPos = s0;
652
- s0 = peg$FAILED;
653
- }
654
- return s0;
655
- }
656
- function peg$parsehorizontal_lineto() {
657
- var s0, s1, s2, s3;
658
- s0 = peg$currPos;
659
- if (peg$c11.test(input.charAt(peg$currPos))) {
660
- s1 = input.charAt(peg$currPos);
661
- peg$currPos++;
662
- } else {
663
- s1 = peg$FAILED;
664
- if (peg$silentFails === 0) {
665
- peg$fail(peg$c12);
666
- }
667
- }
668
- if (s1 !== peg$FAILED) {
669
- s2 = [];
670
- s3 = peg$parsewsp();
671
- while (s3 !== peg$FAILED) {
672
- s2.push(s3);
673
- s3 = peg$parsewsp();
674
- }
675
- if (s2 !== peg$FAILED) {
676
- s3 = peg$parsecoordinate_sequence();
677
- if (s3 !== peg$FAILED) {
678
- peg$savedPos = s0;
679
- s1 = peg$c13(s1, s3);
680
- s0 = s1;
681
- } else {
682
- peg$currPos = s0;
683
- s0 = peg$FAILED;
684
- }
685
- } else {
686
- peg$currPos = s0;
687
- s0 = peg$FAILED;
688
- }
689
- } else {
690
- peg$currPos = s0;
691
- s0 = peg$FAILED;
692
- }
693
- return s0;
694
- }
695
- function peg$parsecoordinate_sequence() {
696
- var s0, s1, s2, s3, s4, s5;
697
- s0 = peg$currPos;
698
- s1 = peg$parsenumber();
699
- if (s1 !== peg$FAILED) {
700
- s2 = [];
701
- s3 = peg$currPos;
702
- s4 = peg$parsecomma_wsp();
703
- if (s4 === peg$FAILED) {
704
- s4 = null;
705
- }
706
- if (s4 !== peg$FAILED) {
707
- s5 = peg$parsenumber();
708
- if (s5 !== peg$FAILED) {
709
- s4 = [s4, s5];
710
- s3 = s4;
711
- } else {
712
- peg$currPos = s3;
713
- s3 = peg$FAILED;
714
- }
715
- } else {
716
- peg$currPos = s3;
717
- s3 = peg$FAILED;
718
- }
719
- while (s3 !== peg$FAILED) {
720
- s2.push(s3);
721
- s3 = peg$currPos;
722
- s4 = peg$parsecomma_wsp();
723
- if (s4 === peg$FAILED) {
724
- s4 = null;
725
- }
726
- if (s4 !== peg$FAILED) {
727
- s5 = peg$parsenumber();
728
- if (s5 !== peg$FAILED) {
729
- s4 = [s4, s5];
730
- s3 = s4;
731
- } else {
732
- peg$currPos = s3;
733
- s3 = peg$FAILED;
734
- }
735
- } else {
736
- peg$currPos = s3;
737
- s3 = peg$FAILED;
738
- }
739
- }
740
- if (s2 !== peg$FAILED) {
741
- peg$savedPos = s0;
742
- s1 = peg$c1(s1, s2);
743
- s0 = s1;
744
- } else {
745
- peg$currPos = s0;
746
- s0 = peg$FAILED;
747
- }
748
- } else {
749
- peg$currPos = s0;
750
- s0 = peg$FAILED;
751
- }
752
- return s0;
753
- }
754
- function peg$parsevertical_lineto() {
755
- var s0, s1, s2, s3;
756
- s0 = peg$currPos;
757
- if (peg$c14.test(input.charAt(peg$currPos))) {
758
- s1 = input.charAt(peg$currPos);
759
- peg$currPos++;
760
- } else {
761
- s1 = peg$FAILED;
762
- if (peg$silentFails === 0) {
763
- peg$fail(peg$c15);
764
- }
765
- }
766
- if (s1 !== peg$FAILED) {
767
- s2 = [];
768
- s3 = peg$parsewsp();
769
- while (s3 !== peg$FAILED) {
770
- s2.push(s3);
771
- s3 = peg$parsewsp();
772
- }
773
- if (s2 !== peg$FAILED) {
774
- s3 = peg$parsecoordinate_sequence();
775
- if (s3 !== peg$FAILED) {
776
- peg$savedPos = s0;
777
- s1 = peg$c16(s1, s3);
778
- s0 = s1;
779
- } else {
780
- peg$currPos = s0;
781
- s0 = peg$FAILED;
782
- }
783
- } else {
784
- peg$currPos = s0;
785
- s0 = peg$FAILED;
786
- }
787
- } else {
788
- peg$currPos = s0;
789
- s0 = peg$FAILED;
790
- }
791
- return s0;
792
- }
793
- function peg$parsecurveto() {
794
- var s0, s1, s2, s3;
795
- s0 = peg$currPos;
796
- if (peg$c17.test(input.charAt(peg$currPos))) {
797
- s1 = input.charAt(peg$currPos);
798
- peg$currPos++;
799
- } else {
800
- s1 = peg$FAILED;
801
- if (peg$silentFails === 0) {
802
- peg$fail(peg$c18);
803
- }
804
- }
805
- if (s1 !== peg$FAILED) {
806
- s2 = [];
807
- s3 = peg$parsewsp();
808
- while (s3 !== peg$FAILED) {
809
- s2.push(s3);
810
- s3 = peg$parsewsp();
811
- }
812
- if (s2 !== peg$FAILED) {
813
- s3 = peg$parsecurveto_argument_sequence();
814
- if (s3 !== peg$FAILED) {
815
- peg$savedPos = s0;
816
- s1 = peg$c10(s1, s3);
817
- s0 = s1;
818
- } else {
819
- peg$currPos = s0;
820
- s0 = peg$FAILED;
821
- }
822
- } else {
823
- peg$currPos = s0;
824
- s0 = peg$FAILED;
825
- }
826
- } else {
827
- peg$currPos = s0;
828
- s0 = peg$FAILED;
829
- }
830
- return s0;
831
- }
832
- function peg$parsecurveto_argument_sequence() {
833
- var s0, s1, s2, s3, s4, s5;
834
- s0 = peg$currPos;
835
- s1 = peg$parsecurveto_argument();
836
- if (s1 !== peg$FAILED) {
837
- s2 = [];
838
- s3 = peg$currPos;
839
- s4 = peg$parsecomma_wsp();
840
- if (s4 === peg$FAILED) {
841
- s4 = null;
842
- }
843
- if (s4 !== peg$FAILED) {
844
- s5 = peg$parsecurveto_argument();
845
- if (s5 !== peg$FAILED) {
846
- s4 = [s4, s5];
847
- s3 = s4;
848
- } else {
849
- peg$currPos = s3;
850
- s3 = peg$FAILED;
851
- }
852
- } else {
853
- peg$currPos = s3;
854
- s3 = peg$FAILED;
855
- }
856
- while (s3 !== peg$FAILED) {
857
- s2.push(s3);
858
- s3 = peg$currPos;
859
- s4 = peg$parsecomma_wsp();
860
- if (s4 === peg$FAILED) {
861
- s4 = null;
862
- }
863
- if (s4 !== peg$FAILED) {
864
- s5 = peg$parsecurveto_argument();
865
- if (s5 !== peg$FAILED) {
866
- s4 = [s4, s5];
867
- s3 = s4;
868
- } else {
869
- peg$currPos = s3;
870
- s3 = peg$FAILED;
871
- }
872
- } else {
873
- peg$currPos = s3;
874
- s3 = peg$FAILED;
875
- }
876
- }
877
- if (s2 !== peg$FAILED) {
878
- peg$savedPos = s0;
879
- s1 = peg$c1(s1, s2);
880
- s0 = s1;
881
- } else {
882
- peg$currPos = s0;
883
- s0 = peg$FAILED;
884
- }
885
- } else {
886
- peg$currPos = s0;
887
- s0 = peg$FAILED;
888
- }
889
- return s0;
890
- }
891
- function peg$parsecurveto_argument() {
892
- var s0, s1, s2, s3, s4, s5;
893
- s0 = peg$currPos;
894
- s1 = peg$parsecoordinate_pair();
895
- if (s1 !== peg$FAILED) {
896
- s2 = peg$parsecomma_wsp();
897
- if (s2 === peg$FAILED) {
898
- s2 = null;
899
- }
900
- if (s2 !== peg$FAILED) {
901
- s3 = peg$parsecoordinate_pair();
902
- if (s3 !== peg$FAILED) {
903
- s4 = peg$parsecomma_wsp();
904
- if (s4 === peg$FAILED) {
905
- s4 = null;
906
- }
907
- if (s4 !== peg$FAILED) {
908
- s5 = peg$parsecoordinate_pair();
909
- if (s5 !== peg$FAILED) {
910
- peg$savedPos = s0;
911
- s1 = peg$c19(s1, s3, s5);
912
- s0 = s1;
913
- } else {
914
- peg$currPos = s0;
915
- s0 = peg$FAILED;
916
- }
917
- } else {
918
- peg$currPos = s0;
919
- s0 = peg$FAILED;
920
- }
921
- } else {
922
- peg$currPos = s0;
923
- s0 = peg$FAILED;
924
- }
925
- } else {
926
- peg$currPos = s0;
927
- s0 = peg$FAILED;
928
- }
929
- } else {
930
- peg$currPos = s0;
931
- s0 = peg$FAILED;
932
- }
933
- return s0;
934
- }
935
- function peg$parsesmooth_curveto() {
936
- var s0, s1, s2, s3;
937
- s0 = peg$currPos;
938
- if (peg$c20.test(input.charAt(peg$currPos))) {
939
- s1 = input.charAt(peg$currPos);
940
- peg$currPos++;
941
- } else {
942
- s1 = peg$FAILED;
943
- if (peg$silentFails === 0) {
944
- peg$fail(peg$c21);
945
- }
946
- }
947
- if (s1 !== peg$FAILED) {
948
- s2 = [];
949
- s3 = peg$parsewsp();
950
- while (s3 !== peg$FAILED) {
951
- s2.push(s3);
952
- s3 = peg$parsewsp();
953
- }
954
- if (s2 !== peg$FAILED) {
955
- s3 = peg$parsesmooth_curveto_argument_sequence();
956
- if (s3 !== peg$FAILED) {
957
- peg$savedPos = s0;
958
- s1 = peg$c10(s1, s3);
959
- s0 = s1;
960
- } else {
961
- peg$currPos = s0;
962
- s0 = peg$FAILED;
963
- }
964
- } else {
965
- peg$currPos = s0;
966
- s0 = peg$FAILED;
967
- }
968
- } else {
969
- peg$currPos = s0;
970
- s0 = peg$FAILED;
971
- }
972
- return s0;
973
- }
974
- function peg$parsesmooth_curveto_argument_sequence() {
975
- var s0, s1, s2, s3, s4, s5;
976
- s0 = peg$currPos;
977
- s1 = peg$parsesmooth_curveto_argument();
978
- if (s1 !== peg$FAILED) {
979
- s2 = [];
980
- s3 = peg$currPos;
981
- s4 = peg$parsecomma_wsp();
982
- if (s4 === peg$FAILED) {
983
- s4 = null;
984
- }
985
- if (s4 !== peg$FAILED) {
986
- s5 = peg$parsesmooth_curveto_argument();
987
- if (s5 !== peg$FAILED) {
988
- s4 = [s4, s5];
989
- s3 = s4;
990
- } else {
991
- peg$currPos = s3;
992
- s3 = peg$FAILED;
993
- }
994
- } else {
995
- peg$currPos = s3;
996
- s3 = peg$FAILED;
997
- }
998
- while (s3 !== peg$FAILED) {
999
- s2.push(s3);
1000
- s3 = peg$currPos;
1001
- s4 = peg$parsecomma_wsp();
1002
- if (s4 === peg$FAILED) {
1003
- s4 = null;
1004
- }
1005
- if (s4 !== peg$FAILED) {
1006
- s5 = peg$parsesmooth_curveto_argument();
1007
- if (s5 !== peg$FAILED) {
1008
- s4 = [s4, s5];
1009
- s3 = s4;
1010
- } else {
1011
- peg$currPos = s3;
1012
- s3 = peg$FAILED;
1013
- }
1014
- } else {
1015
- peg$currPos = s3;
1016
- s3 = peg$FAILED;
1017
- }
1018
- }
1019
- if (s2 !== peg$FAILED) {
1020
- peg$savedPos = s0;
1021
- s1 = peg$c1(s1, s2);
1022
- s0 = s1;
1023
- } else {
1024
- peg$currPos = s0;
1025
- s0 = peg$FAILED;
1026
- }
1027
- } else {
1028
- peg$currPos = s0;
1029
- s0 = peg$FAILED;
1030
- }
1031
- return s0;
1032
- }
1033
- function peg$parsesmooth_curveto_argument() {
1034
- var s0, s1, s2, s3;
1035
- s0 = peg$currPos;
1036
- s1 = peg$parsecoordinate_pair();
1037
- if (s1 !== peg$FAILED) {
1038
- s2 = peg$parsecomma_wsp();
1039
- if (s2 === peg$FAILED) {
1040
- s2 = null;
1041
- }
1042
- if (s2 !== peg$FAILED) {
1043
- s3 = peg$parsecoordinate_pair();
1044
- if (s3 !== peg$FAILED) {
1045
- peg$savedPos = s0;
1046
- s1 = peg$c22(s1, s3);
1047
- s0 = s1;
1048
- } else {
1049
- peg$currPos = s0;
1050
- s0 = peg$FAILED;
1051
- }
1052
- } else {
1053
- peg$currPos = s0;
1054
- s0 = peg$FAILED;
1055
- }
1056
- } else {
1057
- peg$currPos = s0;
1058
- s0 = peg$FAILED;
1059
- }
1060
- return s0;
1061
- }
1062
- function peg$parsequadratic_bezier_curveto() {
1063
- var s0, s1, s2, s3;
1064
- s0 = peg$currPos;
1065
- if (peg$c23.test(input.charAt(peg$currPos))) {
1066
- s1 = input.charAt(peg$currPos);
1067
- peg$currPos++;
1068
- } else {
1069
- s1 = peg$FAILED;
1070
- if (peg$silentFails === 0) {
1071
- peg$fail(peg$c24);
1072
- }
1073
- }
1074
- if (s1 !== peg$FAILED) {
1075
- s2 = [];
1076
- s3 = peg$parsewsp();
1077
- while (s3 !== peg$FAILED) {
1078
- s2.push(s3);
1079
- s3 = peg$parsewsp();
1080
- }
1081
- if (s2 !== peg$FAILED) {
1082
- s3 = peg$parsequadratic_bezier_curveto_argument_sequence();
1083
- if (s3 !== peg$FAILED) {
1084
- peg$savedPos = s0;
1085
- s1 = peg$c10(s1, s3);
1086
- s0 = s1;
1087
- } else {
1088
- peg$currPos = s0;
1089
- s0 = peg$FAILED;
1090
- }
1091
- } else {
1092
- peg$currPos = s0;
1093
- s0 = peg$FAILED;
1094
- }
1095
- } else {
1096
- peg$currPos = s0;
1097
- s0 = peg$FAILED;
1098
- }
1099
- return s0;
1100
- }
1101
- function peg$parsequadratic_bezier_curveto_argument_sequence() {
1102
- var s0, s1, s2, s3, s4, s5;
1103
- s0 = peg$currPos;
1104
- s1 = peg$parsequadratic_bezier_curveto_argument();
1105
- if (s1 !== peg$FAILED) {
1106
- s2 = [];
1107
- s3 = peg$currPos;
1108
- s4 = peg$parsecomma_wsp();
1109
- if (s4 === peg$FAILED) {
1110
- s4 = null;
1111
- }
1112
- if (s4 !== peg$FAILED) {
1113
- s5 = peg$parsequadratic_bezier_curveto_argument();
1114
- if (s5 !== peg$FAILED) {
1115
- s4 = [s4, s5];
1116
- s3 = s4;
1117
- } else {
1118
- peg$currPos = s3;
1119
- s3 = peg$FAILED;
1120
- }
1121
- } else {
1122
- peg$currPos = s3;
1123
- s3 = peg$FAILED;
1124
- }
1125
- while (s3 !== peg$FAILED) {
1126
- s2.push(s3);
1127
- s3 = peg$currPos;
1128
- s4 = peg$parsecomma_wsp();
1129
- if (s4 === peg$FAILED) {
1130
- s4 = null;
1131
- }
1132
- if (s4 !== peg$FAILED) {
1133
- s5 = peg$parsequadratic_bezier_curveto_argument();
1134
- if (s5 !== peg$FAILED) {
1135
- s4 = [s4, s5];
1136
- s3 = s4;
1137
- } else {
1138
- peg$currPos = s3;
1139
- s3 = peg$FAILED;
1140
- }
1141
- } else {
1142
- peg$currPos = s3;
1143
- s3 = peg$FAILED;
1144
- }
1145
- }
1146
- if (s2 !== peg$FAILED) {
1147
- peg$savedPos = s0;
1148
- s1 = peg$c1(s1, s2);
1149
- s0 = s1;
1150
- } else {
1151
- peg$currPos = s0;
1152
- s0 = peg$FAILED;
1153
- }
1154
- } else {
1155
- peg$currPos = s0;
1156
- s0 = peg$FAILED;
1157
- }
1158
- return s0;
1159
- }
1160
- function peg$parsequadratic_bezier_curveto_argument() {
1161
- var s0, s1, s2, s3;
1162
- s0 = peg$currPos;
1163
- s1 = peg$parsecoordinate_pair();
1164
- if (s1 !== peg$FAILED) {
1165
- s2 = peg$parsecomma_wsp();
1166
- if (s2 === peg$FAILED) {
1167
- s2 = null;
1168
- }
1169
- if (s2 !== peg$FAILED) {
1170
- s3 = peg$parsecoordinate_pair();
1171
- if (s3 !== peg$FAILED) {
1172
- peg$savedPos = s0;
1173
- s1 = peg$c25(s1, s3);
1174
- s0 = s1;
1175
- } else {
1176
- peg$currPos = s0;
1177
- s0 = peg$FAILED;
1178
- }
1179
- } else {
1180
- peg$currPos = s0;
1181
- s0 = peg$FAILED;
1182
- }
1183
- } else {
1184
- peg$currPos = s0;
1185
- s0 = peg$FAILED;
1186
- }
1187
- return s0;
1188
- }
1189
- function peg$parsesmooth_quadratic_bezier_curveto() {
1190
- var s0, s1, s2, s3;
1191
- s0 = peg$currPos;
1192
- if (peg$c26.test(input.charAt(peg$currPos))) {
1193
- s1 = input.charAt(peg$currPos);
1194
- peg$currPos++;
1195
- } else {
1196
- s1 = peg$FAILED;
1197
- if (peg$silentFails === 0) {
1198
- peg$fail(peg$c27);
1199
- }
1200
- }
1201
- if (s1 !== peg$FAILED) {
1202
- s2 = [];
1203
- s3 = peg$parsewsp();
1204
- while (s3 !== peg$FAILED) {
1205
- s2.push(s3);
1206
- s3 = peg$parsewsp();
1207
- }
1208
- if (s2 !== peg$FAILED) {
1209
- s3 = peg$parsesmooth_quadratic_bezier_curveto_argument_sequence();
1210
- if (s3 !== peg$FAILED) {
1211
- peg$savedPos = s0;
1212
- s1 = peg$c10(s1, s3);
1213
- s0 = s1;
1214
- } else {
1215
- peg$currPos = s0;
1216
- s0 = peg$FAILED;
1217
- }
1218
- } else {
1219
- peg$currPos = s0;
1220
- s0 = peg$FAILED;
1221
- }
1222
- } else {
1223
- peg$currPos = s0;
1224
- s0 = peg$FAILED;
1225
- }
1226
- return s0;
1227
- }
1228
- function peg$parsesmooth_quadratic_bezier_curveto_argument_sequence() {
1229
- var s0, s1, s2, s3, s4, s5;
1230
- s0 = peg$currPos;
1231
- s1 = peg$parsecoordinate_pair();
1232
- if (s1 !== peg$FAILED) {
1233
- s2 = [];
1234
- s3 = peg$currPos;
1235
- s4 = peg$parsecomma_wsp();
1236
- if (s4 === peg$FAILED) {
1237
- s4 = null;
1238
- }
1239
- if (s4 !== peg$FAILED) {
1240
- s5 = peg$parsecoordinate_pair();
1241
- if (s5 !== peg$FAILED) {
1242
- s4 = [s4, s5];
1243
- s3 = s4;
1244
- } else {
1245
- peg$currPos = s3;
1246
- s3 = peg$FAILED;
1247
- }
1248
- } else {
1249
- peg$currPos = s3;
1250
- s3 = peg$FAILED;
1251
- }
1252
- while (s3 !== peg$FAILED) {
1253
- s2.push(s3);
1254
- s3 = peg$currPos;
1255
- s4 = peg$parsecomma_wsp();
1256
- if (s4 === peg$FAILED) {
1257
- s4 = null;
1258
- }
1259
- if (s4 !== peg$FAILED) {
1260
- s5 = peg$parsecoordinate_pair();
1261
- if (s5 !== peg$FAILED) {
1262
- s4 = [s4, s5];
1263
- s3 = s4;
1264
- } else {
1265
- peg$currPos = s3;
1266
- s3 = peg$FAILED;
1267
- }
1268
- } else {
1269
- peg$currPos = s3;
1270
- s3 = peg$FAILED;
1271
- }
1272
- }
1273
- if (s2 !== peg$FAILED) {
1274
- peg$savedPos = s0;
1275
- s1 = peg$c1(s1, s2);
1276
- s0 = s1;
1277
- } else {
1278
- peg$currPos = s0;
1279
- s0 = peg$FAILED;
1280
- }
1281
- } else {
1282
- peg$currPos = s0;
1283
- s0 = peg$FAILED;
1284
- }
1285
- return s0;
1286
- }
1287
- function peg$parseelliptical_arc() {
1288
- var s0, s1, s2, s3;
1289
- s0 = peg$currPos;
1290
- if (peg$c28.test(input.charAt(peg$currPos))) {
1291
- s1 = input.charAt(peg$currPos);
1292
- peg$currPos++;
1293
- } else {
1294
- s1 = peg$FAILED;
1295
- if (peg$silentFails === 0) {
1296
- peg$fail(peg$c29);
1297
- }
1298
- }
1299
- if (s1 !== peg$FAILED) {
1300
- s2 = [];
1301
- s3 = peg$parsewsp();
1302
- while (s3 !== peg$FAILED) {
1303
- s2.push(s3);
1304
- s3 = peg$parsewsp();
1305
- }
1306
- if (s2 !== peg$FAILED) {
1307
- s3 = peg$parseelliptical_arc_argument_sequence();
1308
- if (s3 !== peg$FAILED) {
1309
- peg$savedPos = s0;
1310
- s1 = peg$c10(s1, s3);
1311
- s0 = s1;
1312
- } else {
1313
- peg$currPos = s0;
1314
- s0 = peg$FAILED;
1315
- }
1316
- } else {
1317
- peg$currPos = s0;
1318
- s0 = peg$FAILED;
1319
- }
1320
- } else {
1321
- peg$currPos = s0;
1322
- s0 = peg$FAILED;
1323
- }
1324
- return s0;
1325
- }
1326
- function peg$parseelliptical_arc_argument_sequence() {
1327
- var s0, s1, s2, s3, s4, s5;
1328
- s0 = peg$currPos;
1329
- s1 = peg$parseelliptical_arc_argument();
1330
- if (s1 !== peg$FAILED) {
1331
- s2 = [];
1332
- s3 = peg$currPos;
1333
- s4 = peg$parsecomma_wsp();
1334
- if (s4 === peg$FAILED) {
1335
- s4 = null;
1336
- }
1337
- if (s4 !== peg$FAILED) {
1338
- s5 = peg$parseelliptical_arc_argument();
1339
- if (s5 !== peg$FAILED) {
1340
- s4 = [s4, s5];
1341
- s3 = s4;
1342
- } else {
1343
- peg$currPos = s3;
1344
- s3 = peg$FAILED;
1345
- }
1346
- } else {
1347
- peg$currPos = s3;
1348
- s3 = peg$FAILED;
1349
- }
1350
- while (s3 !== peg$FAILED) {
1351
- s2.push(s3);
1352
- s3 = peg$currPos;
1353
- s4 = peg$parsecomma_wsp();
1354
- if (s4 === peg$FAILED) {
1355
- s4 = null;
1356
- }
1357
- if (s4 !== peg$FAILED) {
1358
- s5 = peg$parseelliptical_arc_argument();
1359
- if (s5 !== peg$FAILED) {
1360
- s4 = [s4, s5];
1361
- s3 = s4;
1362
- } else {
1363
- peg$currPos = s3;
1364
- s3 = peg$FAILED;
1365
- }
1366
- } else {
1367
- peg$currPos = s3;
1368
- s3 = peg$FAILED;
1369
- }
1370
- }
1371
- if (s2 !== peg$FAILED) {
1372
- peg$savedPos = s0;
1373
- s1 = peg$c1(s1, s2);
1374
- s0 = s1;
1375
- } else {
1376
- peg$currPos = s0;
1377
- s0 = peg$FAILED;
1378
- }
1379
- } else {
1380
- peg$currPos = s0;
1381
- s0 = peg$FAILED;
1382
- }
1383
- return s0;
1384
- }
1385
- function peg$parseelliptical_arc_argument() {
1386
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
1387
- s0 = peg$currPos;
1388
- s1 = peg$parsenonnegative_number();
1389
- if (s1 !== peg$FAILED) {
1390
- s2 = peg$parsecomma_wsp();
1391
- if (s2 === peg$FAILED) {
1392
- s2 = null;
1393
- }
1394
- if (s2 !== peg$FAILED) {
1395
- s3 = peg$parsenonnegative_number();
1396
- if (s3 !== peg$FAILED) {
1397
- s4 = peg$parsecomma_wsp();
1398
- if (s4 === peg$FAILED) {
1399
- s4 = null;
1400
- }
1401
- if (s4 !== peg$FAILED) {
1402
- s5 = peg$parsenumber();
1403
- if (s5 !== peg$FAILED) {
1404
- s6 = peg$parsecomma_wsp();
1405
- if (s6 !== peg$FAILED) {
1406
- s7 = peg$parseflag();
1407
- if (s7 !== peg$FAILED) {
1408
- s8 = peg$parsecomma_wsp();
1409
- if (s8 === peg$FAILED) {
1410
- s8 = null;
1411
- }
1412
- if (s8 !== peg$FAILED) {
1413
- s9 = peg$parseflag();
1414
- if (s9 !== peg$FAILED) {
1415
- s10 = peg$parsecomma_wsp();
1416
- if (s10 === peg$FAILED) {
1417
- s10 = null;
1418
- }
1419
- if (s10 !== peg$FAILED) {
1420
- s11 = peg$parsecoordinate_pair();
1421
- if (s11 !== peg$FAILED) {
1422
- peg$savedPos = s0;
1423
- s1 = peg$c30(s1, s3, s5, s7, s9, s11);
1424
- s0 = s1;
1425
- } else {
1426
- peg$currPos = s0;
1427
- s0 = peg$FAILED;
1428
- }
1429
- } else {
1430
- peg$currPos = s0;
1431
- s0 = peg$FAILED;
1432
- }
1433
- } else {
1434
- peg$currPos = s0;
1435
- s0 = peg$FAILED;
1436
- }
1437
- } else {
1438
- peg$currPos = s0;
1439
- s0 = peg$FAILED;
1440
- }
1441
- } else {
1442
- peg$currPos = s0;
1443
- s0 = peg$FAILED;
1444
- }
1445
- } else {
1446
- peg$currPos = s0;
1447
- s0 = peg$FAILED;
1448
- }
1449
- } else {
1450
- peg$currPos = s0;
1451
- s0 = peg$FAILED;
1452
- }
1453
- } else {
1454
- peg$currPos = s0;
1455
- s0 = peg$FAILED;
1456
- }
1457
- } else {
1458
- peg$currPos = s0;
1459
- s0 = peg$FAILED;
1460
- }
1461
- } else {
1462
- peg$currPos = s0;
1463
- s0 = peg$FAILED;
1464
- }
1465
- } else {
1466
- peg$currPos = s0;
1467
- s0 = peg$FAILED;
1468
- }
1469
- return s0;
1470
- }
1471
- function peg$parsecoordinate_pair() {
1472
- var s0, s1, s2, s3;
1473
- s0 = peg$currPos;
1474
- s1 = peg$parsenumber();
1475
- if (s1 !== peg$FAILED) {
1476
- s2 = peg$parsecomma_wsp();
1477
- if (s2 === peg$FAILED) {
1478
- s2 = null;
1479
- }
1480
- if (s2 !== peg$FAILED) {
1481
- s3 = peg$parsenumber();
1482
- if (s3 !== peg$FAILED) {
1483
- peg$savedPos = s0;
1484
- s1 = peg$c31(s1, s3);
1485
- s0 = s1;
1486
- } else {
1487
- peg$currPos = s0;
1488
- s0 = peg$FAILED;
1489
- }
1490
- } else {
1491
- peg$currPos = s0;
1492
- s0 = peg$FAILED;
1493
- }
1494
- } else {
1495
- peg$currPos = s0;
1496
- s0 = peg$FAILED;
1497
- }
1498
- return s0;
1499
- }
1500
- function peg$parsenonnegative_number() {
1501
- var s0, s1;
1502
- s0 = peg$currPos;
1503
- s1 = peg$parsefloating_point_constant();
1504
- if (s1 === peg$FAILED) {
1505
- s1 = peg$parsedigit_sequence();
1506
- }
1507
- if (s1 !== peg$FAILED) {
1508
- peg$savedPos = s0;
1509
- s1 = peg$c32(s1);
1510
- }
1511
- s0 = s1;
1512
- return s0;
1513
- }
1514
- function peg$parsenumber() {
1515
- var s0, s1, s2, s3;
1516
- s0 = peg$currPos;
1517
- s1 = peg$currPos;
1518
- s2 = peg$parsesign();
1519
- if (s2 === peg$FAILED) {
1520
- s2 = null;
1521
- }
1522
- if (s2 !== peg$FAILED) {
1523
- s3 = peg$parsefloating_point_constant();
1524
- if (s3 !== peg$FAILED) {
1525
- s2 = [s2, s3];
1526
- s1 = s2;
1527
- } else {
1528
- peg$currPos = s1;
1529
- s1 = peg$FAILED;
1530
- }
1531
- } else {
1532
- peg$currPos = s1;
1533
- s1 = peg$FAILED;
1534
- }
1535
- if (s1 === peg$FAILED) {
1536
- s1 = peg$currPos;
1537
- s2 = peg$parsesign();
1538
- if (s2 === peg$FAILED) {
1539
- s2 = null;
1540
- }
1541
- if (s2 !== peg$FAILED) {
1542
- s3 = peg$parsedigit_sequence();
1543
- if (s3 !== peg$FAILED) {
1544
- s2 = [s2, s3];
1545
- s1 = s2;
1546
- } else {
1547
- peg$currPos = s1;
1548
- s1 = peg$FAILED;
1549
- }
1550
- } else {
1551
- peg$currPos = s1;
1552
- s1 = peg$FAILED;
1553
- }
1554
- }
1555
- if (s1 !== peg$FAILED) {
1556
- peg$savedPos = s0;
1557
- s1 = peg$c33(s1);
1558
- }
1559
- s0 = s1;
1560
- return s0;
1561
- }
1562
- function peg$parseflag() {
1563
- var s0, s1;
1564
- s0 = peg$currPos;
1565
- if (peg$c34.test(input.charAt(peg$currPos))) {
1566
- s1 = input.charAt(peg$currPos);
1567
- peg$currPos++;
1568
- } else {
1569
- s1 = peg$FAILED;
1570
- if (peg$silentFails === 0) {
1571
- peg$fail(peg$c35);
1572
- }
1573
- }
1574
- if (s1 !== peg$FAILED) {
1575
- peg$savedPos = s0;
1576
- s1 = peg$c36(s1);
1577
- }
1578
- s0 = s1;
1579
- return s0;
1580
- }
1581
- function peg$parsecomma_wsp() {
1582
- var s0, s1, s2, s3, s4;
1583
- s0 = peg$currPos;
1584
- s1 = [];
1585
- s2 = peg$parsewsp();
1586
- if (s2 !== peg$FAILED) {
1587
- while (s2 !== peg$FAILED) {
1588
- s1.push(s2);
1589
- s2 = peg$parsewsp();
1590
- }
1591
- } else {
1592
- s1 = peg$FAILED;
1593
- }
1594
- if (s1 !== peg$FAILED) {
1595
- s2 = peg$parsecomma();
1596
- if (s2 === peg$FAILED) {
1597
- s2 = null;
1598
- }
1599
- if (s2 !== peg$FAILED) {
1600
- s3 = [];
1601
- s4 = peg$parsewsp();
1602
- while (s4 !== peg$FAILED) {
1603
- s3.push(s4);
1604
- s4 = peg$parsewsp();
1605
- }
1606
- if (s3 !== peg$FAILED) {
1607
- s1 = [s1, s2, s3];
1608
- s0 = s1;
1609
- } else {
1610
- peg$currPos = s0;
1611
- s0 = peg$FAILED;
1612
- }
1613
- } else {
1614
- peg$currPos = s0;
1615
- s0 = peg$FAILED;
1616
- }
1617
- } else {
1618
- peg$currPos = s0;
1619
- s0 = peg$FAILED;
1620
- }
1621
- if (s0 === peg$FAILED) {
1622
- s0 = peg$currPos;
1623
- s1 = peg$currPos;
1624
- s2 = peg$parsecomma();
1625
- if (s2 !== peg$FAILED) {
1626
- s3 = [];
1627
- s4 = peg$parsewsp();
1628
- while (s4 !== peg$FAILED) {
1629
- s3.push(s4);
1630
- s4 = peg$parsewsp();
1631
- }
1632
- if (s3 !== peg$FAILED) {
1633
- s2 = [s2, s3];
1634
- s1 = s2;
1635
- } else {
1636
- peg$currPos = s1;
1637
- s1 = peg$FAILED;
1638
- }
1639
- } else {
1640
- peg$currPos = s1;
1641
- s1 = peg$FAILED;
1642
- }
1643
- if (s1 !== peg$FAILED) {
1644
- peg$savedPos = s0;
1645
- s1 = peg$c37();
1646
- }
1647
- s0 = s1;
1648
- }
1649
- return s0;
1650
- }
1651
- function peg$parsecomma() {
1652
- var s0;
1653
- if (input.charCodeAt(peg$currPos) === 44) {
1654
- s0 = peg$c38;
1655
- peg$currPos++;
1656
- } else {
1657
- s0 = peg$FAILED;
1658
- if (peg$silentFails === 0) {
1659
- peg$fail(peg$c39);
1660
- }
1661
- }
1662
- return s0;
1663
- }
1664
- function peg$parsefloating_point_constant() {
1665
- var s0, s1, s2, s3;
1666
- s0 = peg$currPos;
1667
- s1 = peg$currPos;
1668
- s2 = peg$parsefractional_constant();
1669
- if (s2 !== peg$FAILED) {
1670
- s3 = peg$parseexponent();
1671
- if (s3 === peg$FAILED) {
1672
- s3 = null;
1673
- }
1674
- if (s3 !== peg$FAILED) {
1675
- s2 = [s2, s3];
1676
- s1 = s2;
1677
- } else {
1678
- peg$currPos = s1;
1679
- s1 = peg$FAILED;
1680
- }
1681
- } else {
1682
- peg$currPos = s1;
1683
- s1 = peg$FAILED;
1684
- }
1685
- if (s1 === peg$FAILED) {
1686
- s1 = peg$currPos;
1687
- s2 = peg$parsedigit_sequence();
1688
- if (s2 !== peg$FAILED) {
1689
- s3 = peg$parseexponent();
1690
- if (s3 !== peg$FAILED) {
1691
- s2 = [s2, s3];
1692
- s1 = s2;
1693
- } else {
1694
- peg$currPos = s1;
1695
- s1 = peg$FAILED;
1696
- }
1697
- } else {
1698
- peg$currPos = s1;
1699
- s1 = peg$FAILED;
1700
- }
1701
- }
1702
- if (s1 !== peg$FAILED) {
1703
- peg$savedPos = s0;
1704
- s1 = peg$c40(s1);
1705
- }
1706
- s0 = s1;
1707
- return s0;
1708
- }
1709
- function peg$parsefractional_constant() {
1710
- var s0, s1, s2, s3, s4;
1711
- s0 = peg$currPos;
1712
- s1 = peg$currPos;
1713
- s2 = peg$parsedigit_sequence();
1714
- if (s2 === peg$FAILED) {
1715
- s2 = null;
1716
- }
1717
- if (s2 !== peg$FAILED) {
1718
- if (input.charCodeAt(peg$currPos) === 46) {
1719
- s3 = peg$c41;
1720
- peg$currPos++;
1721
- } else {
1722
- s3 = peg$FAILED;
1723
- if (peg$silentFails === 0) {
1724
- peg$fail(peg$c42);
1725
- }
1726
- }
1727
- if (s3 !== peg$FAILED) {
1728
- s4 = peg$parsedigit_sequence();
1729
- if (s4 !== peg$FAILED) {
1730
- s2 = [s2, s3, s4];
1731
- s1 = s2;
1732
- } else {
1733
- peg$currPos = s1;
1734
- s1 = peg$FAILED;
1735
- }
1736
- } else {
1737
- peg$currPos = s1;
1738
- s1 = peg$FAILED;
1739
- }
1740
- } else {
1741
- peg$currPos = s1;
1742
- s1 = peg$FAILED;
1743
- }
1744
- if (s1 === peg$FAILED) {
1745
- s1 = peg$currPos;
1746
- s2 = peg$parsedigit_sequence();
1747
- if (s2 !== peg$FAILED) {
1748
- if (input.charCodeAt(peg$currPos) === 46) {
1749
- s3 = peg$c41;
1750
- peg$currPos++;
1751
- } else {
1752
- s3 = peg$FAILED;
1753
- if (peg$silentFails === 0) {
1754
- peg$fail(peg$c42);
1755
- }
1756
- }
1757
- if (s3 !== peg$FAILED) {
1758
- s2 = [s2, s3];
1759
- s1 = s2;
1760
- } else {
1761
- peg$currPos = s1;
1762
- s1 = peg$FAILED;
1763
- }
1764
- } else {
1765
- peg$currPos = s1;
1766
- s1 = peg$FAILED;
1767
- }
1768
- }
1769
- if (s1 !== peg$FAILED) {
1770
- peg$savedPos = s0;
1771
- s1 = peg$c40(s1);
1772
- }
1773
- s0 = s1;
1774
- return s0;
1775
- }
1776
- function peg$parseexponent() {
1777
- var s0, s1, s2, s3, s4;
1778
- s0 = peg$currPos;
1779
- s1 = peg$currPos;
1780
- if (peg$c43.test(input.charAt(peg$currPos))) {
1781
- s2 = input.charAt(peg$currPos);
1782
- peg$currPos++;
1783
- } else {
1784
- s2 = peg$FAILED;
1785
- if (peg$silentFails === 0) {
1786
- peg$fail(peg$c44);
1787
- }
1788
- }
1789
- if (s2 !== peg$FAILED) {
1790
- s3 = peg$parsesign();
1791
- if (s3 === peg$FAILED) {
1792
- s3 = null;
1793
- }
1794
- if (s3 !== peg$FAILED) {
1795
- s4 = peg$parsedigit_sequence();
1796
- if (s4 !== peg$FAILED) {
1797
- s2 = [s2, s3, s4];
1798
- s1 = s2;
1799
- } else {
1800
- peg$currPos = s1;
1801
- s1 = peg$FAILED;
1802
- }
1803
- } else {
1804
- peg$currPos = s1;
1805
- s1 = peg$FAILED;
1806
- }
1807
- } else {
1808
- peg$currPos = s1;
1809
- s1 = peg$FAILED;
1810
- }
1811
- if (s1 !== peg$FAILED) {
1812
- peg$savedPos = s0;
1813
- s1 = peg$c40(s1);
1814
- }
1815
- s0 = s1;
1816
- return s0;
1817
- }
1818
- function peg$parsesign() {
1819
- var s0;
1820
- if (peg$c45.test(input.charAt(peg$currPos))) {
1821
- s0 = input.charAt(peg$currPos);
1822
- peg$currPos++;
1823
- } else {
1824
- s0 = peg$FAILED;
1825
- if (peg$silentFails === 0) {
1826
- peg$fail(peg$c46);
1827
- }
1828
- }
1829
- return s0;
1830
- }
1831
- function peg$parsedigit_sequence() {
1832
- var s0, s1, s2;
1833
- s0 = peg$currPos;
1834
- s1 = [];
1835
- if (peg$c47.test(input.charAt(peg$currPos))) {
1836
- s2 = input.charAt(peg$currPos);
1837
- peg$currPos++;
1838
- } else {
1839
- s2 = peg$FAILED;
1840
- if (peg$silentFails === 0) {
1841
- peg$fail(peg$c48);
1842
- }
1843
- }
1844
- if (s2 !== peg$FAILED) {
1845
- while (s2 !== peg$FAILED) {
1846
- s1.push(s2);
1847
- if (peg$c47.test(input.charAt(peg$currPos))) {
1848
- s2 = input.charAt(peg$currPos);
1849
- peg$currPos++;
1850
- } else {
1851
- s2 = peg$FAILED;
1852
- if (peg$silentFails === 0) {
1853
- peg$fail(peg$c48);
1854
- }
1855
- }
1856
- }
1857
- } else {
1858
- s1 = peg$FAILED;
1859
- }
1860
- if (s1 !== peg$FAILED) {
1861
- peg$savedPos = s0;
1862
- s1 = peg$c49(s1);
1863
- }
1864
- s0 = s1;
1865
- return s0;
1866
- }
1867
- function peg$parsewsp() {
1868
- var s0, s1;
1869
- s0 = peg$currPos;
1870
- if (peg$c50.test(input.charAt(peg$currPos))) {
1871
- s1 = input.charAt(peg$currPos);
1872
- peg$currPos++;
1873
- } else {
1874
- s1 = peg$FAILED;
1875
- if (peg$silentFails === 0) {
1876
- peg$fail(peg$c51);
1877
- }
1878
- }
1879
- if (s1 !== peg$FAILED) {
1880
- peg$savedPos = s0;
1881
- s1 = peg$c37();
1882
- }
1883
- s0 = s1;
1884
- return s0;
1885
- }
1886
- function merge(first, more) {
1887
- if (!more) return [first];
1888
- for (var a = [first], i = 0, l = more.length; i < l; i++) a[i + 1] = more[i][1];
1889
- return a;
1890
- }
1891
- var cmds = { m: "moveto", l: "lineto", h: "horizontal lineto", v: "vertical lineto", c: "curveto", s: "smooth curveto", q: "quadratic curveto", t: "smooth quadratic curveto", a: "elliptical arc", z: "closepath" };
1892
- for (var code in cmds) cmds[code.toUpperCase()] = cmds[code];
1893
- function commands(code2, args) {
1894
- if (!args) args = [{}];
1895
- for (var i = args.length; i--; ) {
1896
- var cmd = { code: code2, command: cmds[code2] };
1897
- if (code2 == code2.toLowerCase()) cmd.relative = true;
1898
- for (var k in args[i]) cmd[k] = args[i][k];
1899
- args[i] = cmd;
1900
- }
1901
- return args;
1902
- }
1903
- peg$result = peg$startRuleFunction();
1904
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1905
- return peg$result;
1906
- } else {
1907
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1908
- peg$fail(peg$endExpectation());
1909
- }
1910
- throw peg$buildStructuredError(
1911
- peg$maxFailExpected,
1912
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1913
- peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1914
- );
1915
- }
1916
- }
1917
- module2.exports = {
1918
- SyntaxError: peg$SyntaxError2,
1919
- parse: peg$parse2
1920
- };
1921
- }
1922
- });
1923
-
1924
- // node_modules/svg-path-parser/index.js
1925
- var require_svg_path_parser = __commonJS({
1926
- "node_modules/svg-path-parser/index.js"(exports2, module2) {
1927
- "use strict";
1928
- var parserFunction = require_parser().parse;
1929
- parserFunction.parseSVG = parserFunction;
1930
- parserFunction.makeAbsolute = makeSVGPathCommandsAbsolute;
1931
- module2.exports = parserFunction;
1932
- function makeSVGPathCommandsAbsolute(commands) {
1933
- var subpathStart, prevCmd = { x: 0, y: 0 };
1934
- var attr = { x: "x0", y: "y0", x1: "x0", y1: "y0", x2: "x0", y2: "y0" };
1935
- commands.forEach(function(cmd) {
1936
- if (cmd.command === "moveto") subpathStart = cmd;
1937
- cmd.x0 = prevCmd.x;
1938
- cmd.y0 = prevCmd.y;
1939
- for (var a in attr) if (a in cmd) cmd[a] += cmd.relative ? cmd[attr[a]] : 0;
1940
- if (!("x" in cmd)) cmd.x = prevCmd.x;
1941
- if (!("y" in cmd)) cmd.y = prevCmd.y;
1942
- cmd.relative = false;
1943
- cmd.code = cmd.code.toUpperCase();
1944
- if (cmd.command == "closepath") {
1945
- cmd.x = subpathStart.x;
1946
- cmd.y = subpathStart.y;
1947
- }
1948
- prevCmd = cmd;
1949
- });
1950
- return commands;
1951
- }
1952
- }
1953
- });
1954
-
1955
- // index.ts
1956
- var schematic_symbols_exports = {};
1957
- __export(schematic_symbols_exports, {
1958
- BASE_SYMBOLS: () => BASE_SYMBOLS,
1959
- getInnerSvg: () => getInnerSvg,
1960
- getSvg: () => getSvg,
1961
- resizeSymbol: () => resizeSymbol,
1962
- symbols: () => symbols_default
1963
- });
1964
- module.exports = __toCommonJS(schematic_symbols_exports);
1965
-
1966
- // drawing/path.ts
1967
- function path(options) {
1968
- return { type: "path", ...options };
1969
- }
1970
-
1971
- // drawing/text.ts
1972
- function text(text2, options) {
1973
- return { type: "text", text: text2, ...options };
1974
- }
1975
-
1976
- // drawing/defineSymbol.ts
1977
- function defineSymbol(symbol) {
1978
- return symbol;
1979
- }
1980
-
1981
- // symbols/boxresistor_horz.ts
1982
- var boxresistor_horz_default = defineSymbol({
1983
- primitives: [
1984
- path({
1985
- points: [
1986
- { x: 0, y: 0 },
1987
- { x: 0.2, y: 0 },
1988
- { x: 0.2, y: -0.12 },
1989
- { x: 0.8, y: -0.12 },
1990
- { x: 0.8, y: 0.12 },
1991
- { x: 0.2, y: 0.12 },
1992
- { x: 0.2, y: 0 }
1993
- ],
1994
- color: "primary"
1995
- }),
1996
- path({
1997
- points: [
1998
- { x: 0.8, y: 0 },
1999
- { x: 1, y: 0 }
2000
- ],
2001
- color: "primary"
2002
- }),
2003
- text("{REF}", { x: 0.5, y: -0.2, anchor: "middle_bottom" }),
2004
- text("{VAL}", { x: 0.5, y: 0.2, anchor: "middle_top" })
2005
- ],
2006
- ports: [
2007
- { x: 0, y: 0, labels: ["1", "-", "left"] },
2008
- { x: 1, y: 0, labels: ["2", "+", "right"] }
2009
- ],
2010
- center: { x: 0.5, y: 0 },
2011
- size: { width: 1, height: 0.55 }
2012
- });
2013
-
2014
- // node_modules/transformation-matrix/src/applyToPoint.js
2015
- function applyToPoint(matrix, point) {
2016
- return Array.isArray(point) ? [
2017
- matrix.a * point[0] + matrix.c * point[1] + matrix.e,
2018
- matrix.b * point[0] + matrix.d * point[1] + matrix.f
2019
- ] : {
2020
- x: matrix.a * point.x + matrix.c * point.y + matrix.e,
2021
- y: matrix.b * point.x + matrix.d * point.y + matrix.f
2022
- };
2023
- }
2024
-
2025
- // node_modules/transformation-matrix/src/utils.js
2026
- function isUndefined(val2) {
2027
- return typeof val2 === "undefined";
2028
- }
2029
-
2030
- // node_modules/transformation-matrix/src/translate.js
2031
- function translate(tx, ty = 0) {
2032
- return {
2033
- a: 1,
2034
- c: 0,
2035
- e: tx,
2036
- b: 0,
2037
- d: 1,
2038
- f: ty
2039
- };
2040
- }
2041
-
2042
- // node_modules/transformation-matrix/src/transform.js
2043
- function transform(...matrices) {
2044
- matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;
2045
- const multiply = (m1, m2) => {
2046
- return {
2047
- a: m1.a * m2.a + m1.c * m2.b,
2048
- c: m1.a * m2.c + m1.c * m2.d,
2049
- e: m1.a * m2.e + m1.c * m2.f + m1.e,
2050
- b: m1.b * m2.a + m1.d * m2.b,
2051
- d: m1.b * m2.c + m1.d * m2.d,
2052
- f: m1.b * m2.e + m1.d * m2.f + m1.f
2053
- };
2054
- };
2055
- switch (matrices.length) {
2056
- case 0:
2057
- throw new Error("no matrices provided");
2058
- case 1:
2059
- return matrices[0];
2060
- case 2:
2061
- return multiply(matrices[0], matrices[1]);
2062
- default: {
2063
- const [m1, m2, ...rest] = matrices;
2064
- const m = multiply(m1, m2);
2065
- return transform(m, ...rest);
2066
- }
2067
- }
2068
- }
2069
-
2070
- // node_modules/transformation-matrix/src/rotate.js
2071
- var { cos, sin, PI } = Math;
2072
- function rotate(angle, cx, cy) {
2073
- const cosAngle = cos(angle);
2074
- const sinAngle = sin(angle);
2075
- const rotationMatrix = {
2076
- a: cosAngle,
2077
- c: -sinAngle,
2078
- e: 0,
2079
- b: sinAngle,
2080
- d: cosAngle,
2081
- f: 0
2082
- };
2083
- if (isUndefined(cx) || isUndefined(cy)) {
2084
- return rotationMatrix;
2085
- }
2086
- return transform([
2087
- translate(cx, cy),
2088
- rotationMatrix,
2089
- translate(-cx, -cy)
2090
- ]);
2091
- }
2092
-
2093
- // node_modules/transformation-matrix/src/skew.js
2094
- var { tan } = Math;
2095
-
2096
- // node_modules/transformation-matrix/src/fromTransformAttribute.autogenerated.js
2097
- function peg$subclass(child, parent) {
2098
- function C() {
2099
- this.constructor = child;
2100
- }
2101
- C.prototype = parent.prototype;
2102
- child.prototype = new C();
2103
- }
2104
- function peg$SyntaxError(message, expected, found, location) {
2105
- var self = Error.call(this, message);
2106
- if (Object.setPrototypeOf) {
2107
- Object.setPrototypeOf(self, peg$SyntaxError.prototype);
2108
- }
2109
- self.expected = expected;
2110
- self.found = found;
2111
- self.location = location;
2112
- self.name = "SyntaxError";
2113
- return self;
2114
- }
2115
- peg$subclass(peg$SyntaxError, Error);
2116
- function peg$padEnd(str, targetLength, padString) {
2117
- padString = padString || " ";
2118
- if (str.length > targetLength) {
2119
- return str;
2120
- }
2121
- targetLength -= str.length;
2122
- padString += padString.repeat(targetLength);
2123
- return str + padString.slice(0, targetLength);
2124
- }
2125
- peg$SyntaxError.prototype.format = function(sources) {
2126
- var str = "Error: " + this.message;
2127
- if (this.location) {
2128
- var src = null;
2129
- var k;
2130
- for (k = 0; k < sources.length; k++) {
2131
- if (sources[k].source === this.location.source) {
2132
- src = sources[k].text.split(/\r\n|\n|\r/g);
2133
- break;
2134
- }
2135
- }
2136
- var s = this.location.start;
2137
- var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
2138
- var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
2139
- if (src) {
2140
- var e = this.location.end;
2141
- var filler = peg$padEnd("", offset_s.line.toString().length, " ");
2142
- var line = src[s.line - 1];
2143
- var last = s.line === e.line ? e.column : line.length + 1;
2144
- var hatLen = last - s.column || 1;
2145
- str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " + line + "\n" + filler + " | " + peg$padEnd("", s.column - 1, " ") + peg$padEnd("", hatLen, "^");
2146
- } else {
2147
- str += "\n at " + loc;
2148
- }
2149
- }
2150
- return str;
2151
- };
2152
- peg$SyntaxError.buildMessage = function(expected, found) {
2153
- var DESCRIBE_EXPECTATION_FNS = {
2154
- literal: function(expectation) {
2155
- return '"' + literalEscape(expectation.text) + '"';
2156
- },
2157
- class: function(expectation) {
2158
- var escapedParts = expectation.parts.map(function(part) {
2159
- return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
2160
- });
2161
- return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
2162
- },
2163
- any: function() {
2164
- return "any character";
2165
- },
2166
- end: function() {
2167
- return "end of input";
2168
- },
2169
- other: function(expectation) {
2170
- return expectation.description;
2171
- }
2172
- };
2173
- function hex(ch) {
2174
- return ch.charCodeAt(0).toString(16).toUpperCase();
2175
- }
2176
- function literalEscape(s) {
2177
- return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
2178
- return "\\x0" + hex(ch);
2179
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
2180
- return "\\x" + hex(ch);
2181
- });
2182
- }
2183
- function classEscape(s) {
2184
- return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
2185
- return "\\x0" + hex(ch);
2186
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
2187
- return "\\x" + hex(ch);
2188
- });
2189
- }
2190
- function describeExpectation(expectation) {
2191
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
2192
- }
2193
- function describeExpected(expected2) {
2194
- var descriptions = expected2.map(describeExpectation);
2195
- var i, j;
2196
- descriptions.sort();
2197
- if (descriptions.length > 0) {
2198
- for (i = 1, j = 1; i < descriptions.length; i++) {
2199
- if (descriptions[i - 1] !== descriptions[i]) {
2200
- descriptions[j] = descriptions[i];
2201
- j++;
2202
- }
2203
- }
2204
- descriptions.length = j;
2205
- }
2206
- switch (descriptions.length) {
2207
- case 1:
2208
- return descriptions[0];
2209
- case 2:
2210
- return descriptions[0] + " or " + descriptions[1];
2211
- default:
2212
- return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
2213
- }
2214
- }
2215
- function describeFound(found2) {
2216
- return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
2217
- }
2218
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
2219
- };
2220
-
2221
- // drawing/rotateSymbol.ts
2222
- var rotateAnchor = (anchor) => {
2223
- switch (anchor) {
2224
- case "middle_top":
2225
- return "middle_right";
2226
- case "middle_bottom":
2227
- return "middle_left";
2228
- }
2229
- return anchor;
2230
- };
2231
- var rotateSymbol = (symbol, overrides) => {
2232
- const transform2 = rotate(Math.PI / 2, symbol.center.x, symbol.center.y);
2233
- const { primitives, center, size, ports } = symbol;
2234
- const rotatedPrimitives = primitives.map((primitive) => {
2235
- primitive = { ...primitive };
2236
- switch (primitive.type) {
2237
- case "path":
2238
- return {
2239
- ...primitive,
2240
- points: primitive.points.map(
2241
- (point) => applyToPoint(transform2, point)
2242
- )
2243
- };
2244
- case "text":
2245
- const rotatedPoint = applyToPoint(transform2, {
2246
- x: primitive.x,
2247
- y: primitive.y
2248
- });
2249
- primitive.anchor = rotateAnchor(primitive.anchor);
2250
- return {
2251
- ...primitive,
2252
- x: rotatedPoint.x,
2253
- y: rotatedPoint.y
2254
- };
2255
- case "circle":
2256
- const rotatedCenter = applyToPoint(transform2, {
2257
- x: primitive.x,
2258
- y: primitive.y
2259
- });
2260
- return {
2261
- ...primitive,
2262
- x: rotatedCenter.x,
2263
- y: rotatedCenter.y
2264
- };
2265
- case "box":
2266
- const rotatedCorner = applyToPoint(transform2, {
2267
- x: primitive.x,
2268
- y: primitive.y
2269
- });
2270
- return {
2271
- ...primitive,
2272
- x: rotatedCorner.x,
2273
- y: rotatedCorner.y,
2274
- width: primitive.height,
2275
- height: primitive.width
2276
- };
2277
- }
2278
- });
2279
- const rotatedPorts = ports.map(
2280
- (port) => ({
2281
- ...port,
2282
- ...applyToPoint(transform2, port)
2283
- })
2284
- );
2285
- return {
2286
- primitives: rotatedPrimitives,
2287
- center,
2288
- ports: rotatedPorts,
2289
- // TODO recompute size using overrides
2290
- size: {
2291
- width: size.height,
2292
- height: size.width
2293
- },
2294
- ...overrides
2295
- };
2296
- };
2297
-
2298
- // symbols/boxresistor_vert.ts
2299
- var boxresistor_vert_default = rotateSymbol(boxresistor_horz_default);
2300
-
2301
- // assets/symbols-svg-json/diode.json
2302
- var diode_default = {
2303
- paths: {
2304
- path40: {
2305
- type: "path",
2306
- points: [
2307
- {
2308
- x: 0.1413337499999998,
2309
- y: 0
2310
- },
2311
- {
2312
- x: -0.12324954999999971,
2313
- y: 0.13229169999999968
2314
- }
2315
- ],
2316
- color: "primary",
2317
- fill: false
2318
- },
2319
- path41: {
2320
- type: "path",
2321
- points: [
2322
- {
2323
- x: -0.12324954999999971,
2324
- y: -0.13229170000000323
2325
- },
2326
- {
2327
- x: 0.1413337499999998,
2328
- y: 0
2329
- }
2330
- ],
2331
- color: "primary",
2332
- fill: false
2333
- },
2334
- path42: {
2335
- type: "path",
2336
- points: [
2337
- {
2338
- x: -0.12324954999999971,
2339
- y: 0.13229169999999613
2340
- },
2341
- {
2342
- x: -0.12324954999999971,
2343
- y: -0.13229170000000323
2344
- }
2345
- ],
2346
- color: "primary",
2347
- fill: false
2348
- },
2349
- path43: {
2350
- type: "path",
2351
- points: [
2352
- {
2353
- x: 0.1413337499999998,
2354
- y: -0.13229170000000323
2355
- },
2356
- {
2357
- x: 0.1413337499999998,
2358
- y: 0.13229169999999613
2359
- }
2360
- ],
2361
- color: "primary",
2362
- fill: false
2363
- },
2364
- path44: {
2365
- type: "path",
2366
- points: [
2367
- {
2368
- x: -0.12545424999999977,
2369
- y: 0
2370
- },
2371
- {
2372
- x: -0.5201245499999998,
2373
- y: 0
2374
- }
2375
- ],
2376
- color: "primary",
2377
- fill: false
2378
- },
2379
- "path44-0": {
2380
- type: "path",
2381
- points: [
2382
- {
2383
- x: 0.5201245499999998,
2384
- y: 8519999999734296e-20
2385
- },
2386
- {
2387
- x: 0.1464164499999998,
2388
- y: 8519999999734296e-20
2389
- }
2390
- ],
2391
- color: "primary",
2392
- fill: false
2393
- }
2394
- },
2395
- texts: {
2396
- top1: {
2397
- type: "text",
2398
- text: "{REF}",
2399
- x: -0.008280249999999878,
2400
- y: -0.22980899999999949
2401
- },
2402
- bottom1: {
2403
- type: "text",
2404
- text: "{VAL}",
2405
- x: -0.0033669500000002017,
2406
- y: 0.31788159999999976
2407
- }
2408
- },
2409
- refblocks: {
2410
- left1: {
2411
- x: -0.5224022500000003,
2412
- y: -8844000000003405e-19
2413
- },
2414
- right1: {
2415
- x: 0.5158919499999999,
2416
- y: 14019999999703714e-20
2417
- }
2418
- },
2419
- bounds: {
2420
- minX: -0.5201245499999998,
2421
- maxX: 0.5201245499999998,
2422
- minY: -0.13229170000000323,
2423
- maxY: 0.13229169999999968,
2424
- width: 1.0402490999999996,
2425
- height: 0.2645834000000029,
2426
- centerX: 0,
2427
- centerY: -17763568394002505e-31
2428
- }
2429
- };
2430
-
2431
- // symbols/diode_horz.ts
2432
- var { paths, texts, bounds, refblocks } = diode_default;
2433
- var diode_horz_default = defineSymbol({
2434
- primitives: [
2435
- ...Object.values(paths),
2436
- { ...texts.top1, anchor: "middle_left" },
2437
- { ...texts.bottom1, anchor: "middle_left" }
2438
- ],
2439
- ports: [
2440
- { ...refblocks.left1, labels: ["1"] },
2441
- // TODO add more "standard" labels
2442
- { ...refblocks.right1, labels: ["2"] }
2443
- // TODO add more "standard" labels
2444
- ],
2445
- size: { width: bounds.width, height: bounds.height },
2446
- center: { x: bounds.centerX, y: bounds.centerY }
2447
- });
2448
-
2449
- // symbols/diode_vert.ts
2450
- var diode_vert_default = rotateSymbol(diode_horz_default);
2451
-
2452
- // assets/symbols-svg-json/fuse.json
2453
- var fuse_default = {
2454
- paths: {
2455
- path10: {
2456
- type: "path",
2457
- points: [
2458
- {
2459
- x: -0.529167000000001,
2460
- y: 0
2461
- },
2462
- {
2463
- x: 0.5291669999999993,
2464
- y: 0
2465
- }
2466
- ],
2467
- color: "primary",
2468
- fill: false
2469
- },
2470
- path14: {
2471
- type: "path",
2472
- points: [
2473
- {
2474
- x: 1999999998503199e-21,
2475
- y: -0.13229169999999968
2476
- },
2477
- {
2478
- x: 0.2645849999999985,
2479
- y: -0.13229169999999968
2480
- },
2481
- {
2482
- x: 0.2645849999999985,
2483
- y: 0.13229169999999968
2484
- },
2485
- {
2486
- x: -0.26458200000000076,
2487
- y: 0.13229169999999968
2488
- },
2489
- {
2490
- x: -0.26458200000000076,
2491
- y: -0.13229169999999968
2492
- },
2493
- {
2494
- x: 1999999998503199e-21,
2495
- y: -0.13229169999999968
2496
- }
2497
- ],
2498
- color: "primary",
2499
- fill: false
2500
- }
2501
- },
2502
- texts: {
2503
- top1: {
2504
- type: "text",
2505
- text: "{REF}",
2506
- x: -0.00912720000000089,
2507
- y: -0.1995035999999999
2508
- },
2509
- bottom1: {
2510
- type: "text",
2511
- text: "{VAL}",
2512
- x: -0.17251720000000148,
2513
- y: 0.27233090000000004
2514
- }
2515
- },
2516
- refblocks: {
2517
- left1: {
2518
- x: -0.5354181000000011,
2519
- y: -0.0030468999999992974
2520
- },
2521
- right1: {
2522
- x: 0.5336915999999992,
2523
- y: 0.0011575000000014768
2524
- }
2525
- },
2526
- bounds: {
2527
- minX: -0.529167000000001,
2528
- maxX: 0.5291669999999993,
2529
- minY: -0.13229169999999968,
2530
- maxY: 0.13229169999999968,
2531
- width: 1.0583340000000003,
2532
- height: 0.26458339999999936,
2533
- centerX: -8881784197001252e-31,
2534
- centerY: 0
2535
- }
2536
- };
2537
-
2538
- // symbols/fuse_horz.ts
2539
- var { paths: paths2, texts: texts2, bounds: bounds2, refblocks: refblocks2 } = fuse_default;
2540
- var fuse_horz_default = defineSymbol({
2541
- primitives: [
2542
- ...Object.values(paths2),
2543
- { ...texts2.top1, anchor: "middle_bottom" },
2544
- {
2545
- type: "text",
2546
- text: "{VAL}",
2547
- x: 0,
2548
- y: 0.2,
2549
- anchor: "middle_top"
2550
- }
2551
- ],
2552
- ports: [
2553
- { ...refblocks2.left1, labels: ["1"] },
2554
- // TODO add more "standard" labels
2555
- { ...refblocks2.right1, labels: ["2"] }
2556
- // TODO add more "standard" labels
2557
- ],
2558
- size: { width: bounds2.width, height: bounds2.height },
2559
- center: { x: bounds2.centerX, y: bounds2.centerY }
2560
- });
2561
-
2562
- // symbols/fuse_vert.ts
2563
- var fuse_vert_default = rotateSymbol(fuse_horz_default);
2564
-
2565
- // assets/symbols-svg-json/led.json
2566
- var led_default = {
2567
- paths: {
2568
- path45: {
2569
- type: "path",
2570
- points: [
2571
- {
2572
- x: 0.13537969999999966,
2573
- y: 0.09743664999999524
2574
- },
2575
- {
2576
- x: -0.1292036000000003,
2577
- y: 0.22972834999999847
2578
- }
2579
- ],
2580
- color: "primary",
2581
- fill: false
2582
- },
2583
- "path1-8": {
2584
- type: "path",
2585
- points: [
2586
- {
2587
- x: 0.12715889999999996,
2588
- y: 0.09766044999999579
2589
- },
2590
- {
2591
- x: 0.5260786,
2592
- y: 0.09766044999999579
2593
- }
2594
- ],
2595
- color: "primary",
2596
- fill: false
2597
- },
2598
- path46: {
2599
- type: "path",
2600
- points: [
2601
- {
2602
- x: -0.1292036000000003,
2603
- y: -0.03485505000000444
2604
- },
2605
- {
2606
- x: 0.13537969999999966,
2607
- y: 0.09743664999999524
2608
- }
2609
- ],
2610
- color: "primary",
2611
- fill: false
2612
- },
2613
- path47: {
2614
- type: "path",
2615
- points: [
2616
- {
2617
- x: -0.1292036000000003,
2618
- y: 0.22972834999999847
2619
- },
2620
- {
2621
- x: -0.1292036000000003,
2622
- y: -0.03485505000000444
2623
- }
2624
- ],
2625
- color: "primary",
2626
- fill: false
2627
- },
2628
- path48: {
2629
- type: "path",
2630
- points: [
2631
- {
2632
- x: 0.13537969999999966,
2633
- y: -0.03485505000000444
2634
- },
2635
- {
2636
- x: 0.13537969999999966,
2637
- y: 0.22972834999999847
2638
- }
2639
- ],
2640
- color: "primary",
2641
- fill: false
2642
- },
2643
- path49: {
2644
- type: "path",
2645
- points: [
2646
- {
2647
- x: -0.13124740000000035,
2648
- y: 0.09743664999999524
2649
- },
2650
- {
2651
- x: -0.5260786000000004,
2652
- y: 0.09743664999999524
2653
- }
2654
- ],
2655
- color: "primary",
2656
- fill: false
2657
- },
2658
- path25: {
2659
- type: "path",
2660
- points: [
2661
- {
2662
- x: -0.15622170000000057,
2663
- y: -0.19171255000000187
2664
- },
2665
- {
2666
- x: -0.25356400000000034,
2667
- y: -0.20859175000000363
2668
- },
2669
- {
2670
- x: -0.2192612000000005,
2671
- y: -0.11582895000000448
2672
- },
2673
- {
2674
- x: -0.15622170000000057,
2675
- y: -0.19171255000000187
2676
- }
2677
- ],
2678
- color: "primary",
2679
- fill: true
2680
- },
2681
- path78: {
2682
- type: "path",
2683
- points: [
2684
- {
2685
- x: -0.08048230000000034,
2686
- y: -0.07216775000000197
2687
- },
2688
- {
2689
- x: -0.09250580000000008,
2690
- y: -0.0811007500000045
2691
- },
2692
- {
2693
- x: -0.21426230000000057,
2694
- y: -0.17155655000000536
2695
- },
2696
- {
2697
- x: -0.21489230000000026,
2698
- y: -0.17250655000000492
2699
- }
2700
- ],
2701
- color: "primary",
2702
- fill: false
2703
- },
2704
- "path25-0": {
2705
- type: "path",
2706
- points: [
2707
- {
2708
- x: 0.021244599999999725,
2709
- y: -0.21284915000000026
2710
- },
2711
- {
2712
- x: -0.07609770000000049,
2713
- y: -0.22972835000000202
2714
- },
2715
- {
2716
- x: -0.04179490000000019,
2717
- y: -0.13696555000000288
2718
- },
2719
- {
2720
- x: 0.021244599999999725,
2721
- y: -0.21284915000000026
2722
- }
2723
- ],
2724
- color: "primary",
2725
- fill: true
2726
- },
2727
- "path78-6": {
2728
- type: "path",
2729
- points: [
2730
- {
2731
- x: 0.09698399999999996,
2732
- y: -0.09330435000000037
2733
- },
2734
- {
2735
- x: 0.08496049999999977,
2736
- y: -0.10223735000000289
2737
- },
2738
- {
2739
- x: -0.03679600000000027,
2740
- y: -0.19269315000000375
2741
- },
2742
- {
2743
- x: -0.0374260000000004,
2744
- y: -0.19364315000000332
2745
- }
2746
- ],
2747
- color: "primary",
2748
- fill: false
2749
- }
2750
- },
2751
- texts: {
2752
- bottom1: {
2753
- type: "text",
2754
- text: "{VAL}",
2755
- x: -0.010039500000000423,
2756
- y: 0.4172088499999944
2757
- },
2758
- right1: {
2759
- type: "text",
2760
- text: "{REF}",
2761
- x: 0.31416289999999947,
2762
- y: -0.13012545000000486
2763
- }
2764
- },
2765
- refblocks: {
2766
- left1: {
2767
- x: -0.5366871000000006,
2768
- y: 0.09817314999999738
2769
- },
2770
- right1: {
2771
- x: 0.5357314999999994,
2772
- y: 0.09862664999999993
2773
- }
2774
- },
2775
- bounds: {
2776
- minX: -0.5260786000000004,
2777
- maxX: 0.5260786,
2778
- minY: -0.22972835000000202,
2779
- maxY: 0.22972834999999847,
2780
- width: 1.0521572000000003,
2781
- height: 0.4594567000000005,
2782
- centerX: -2220446049250313e-31,
2783
- centerY: -17763568394002505e-31
2784
- }
2785
- };
2786
-
2787
- // symbols/led_horz.ts
2788
- var { paths: paths3, texts: texts3, bounds: bounds3, refblocks: refblocks3 } = led_default;
2789
- var led_horz_default = defineSymbol({
2790
- primitives: [
2791
- ...Object.values(paths3),
2792
- { ...texts3.bottom1, anchor: "middle_left" },
2793
- { ...texts3.right1, anchor: "middle_left" }
2794
- ],
2795
- ports: [
2796
- { ...refblocks3.left1, labels: ["1", "anode", "pos"] },
2797
- { ...refblocks3.right1, labels: ["2", "cathode", "neg"] }
2798
- ],
2799
- size: { width: bounds3.width, height: bounds3.height },
2800
- center: { x: bounds3.centerX, y: bounds3.centerY + 0.1 }
2801
- });
2802
-
2803
- // symbols/led_vert.ts
2804
- var led_vert_default = rotateSymbol(led_horz_default);
2805
-
2806
- // assets/symbols-svg-json/mosfet_depletion_normally_on.json
2807
- var mosfet_depletion_normally_on_default = {
2808
- paths: {
2809
- path208: {
2810
- type: "path",
2811
- points: [
2812
- {
2813
- x: 0.39687494999999995,
2814
- y: -0.13228999999999935
2815
- },
2816
- {
2817
- x: 0.5291666500000005,
2818
- y: 0.13229300000000066
2819
- }
2820
- ],
2821
- color: "primary",
2822
- fill: false
2823
- },
2824
- path209: {
2825
- type: "path",
2826
- points: [
2827
- {
2828
- x: 0.26458325000000027,
2829
- y: 0.13229300000000066
2830
- },
2831
- {
2832
- x: 0.39687494999999995,
2833
- y: -0.13228999999999935
2834
- }
2835
- ],
2836
- color: "primary",
2837
- fill: false
2838
- },
2839
- path210: {
2840
- type: "path",
2841
- points: [
2842
- {
2843
- x: 0.5291666500000005,
2844
- y: 0.13229300000000066
2845
- },
2846
- {
2847
- x: 0.26458325000000027,
2848
- y: 0.13229300000000066
2849
- }
2850
- ],
2851
- color: "primary",
2852
- fill: false
2853
- },
2854
- path211: {
2855
- type: "path",
2856
- points: [
2857
- {
2858
- x: 0.26458325000000027,
2859
- y: -0.13228999999999935
2860
- },
2861
- {
2862
- x: 0.5291666500000005,
2863
- y: -0.13228999999999935
2864
- }
2865
- ],
2866
- color: "primary",
2867
- fill: false
2868
- },
2869
- path212: {
2870
- type: "path",
2871
- points: [
2872
- {
2873
- x: 0.13229165000000087,
2874
- y: 0.39687499999999964
2875
- },
2876
- {
2877
- x: 0.39687494999999995,
2878
- y: 0.39687499999999964
2879
- }
2880
- ],
2881
- color: "primary",
2882
- fill: false
2883
- },
2884
- path213: {
2885
- type: "path",
2886
- points: [
2887
- {
2888
- x: 0.39687494999999995,
2889
- y: -0.3968740000000004
2890
- },
2891
- {
2892
- x: 0.13229165000000087,
2893
- y: -0.3968740000000004
2894
- }
2895
- ],
2896
- color: "primary",
2897
- fill: false
2898
- },
2899
- path214: {
2900
- type: "path",
2901
- points: [
2902
- {
2903
- x: 0.13229165000000087,
2904
- y: -0.529166
2905
- },
2906
- {
2907
- x: 0.13229165000000087,
2908
- y: -0.1852090000000004
2909
- }
2910
- ],
2911
- color: "primary",
2912
- fill: false
2913
- },
2914
- path215: {
2915
- type: "path",
2916
- points: [
2917
- {
2918
- x: 0.13229165000000087,
2919
- y: 0.529166
2920
- },
2921
- {
2922
- x: 0.13229165000000087,
2923
- y: -9999999992515995e-22
2924
- }
2925
- ],
2926
- color: "primary",
2927
- fill: false
2928
- },
2929
- path216: {
2930
- type: "path",
2931
- points: [
2932
- {
2933
- x: 0.39687494999999995,
2934
- y: 0.39687563000000026
2935
- },
2936
- {
2937
- x: 0.39687494999999995,
2938
- y: -0.3968746999999997
2939
- }
2940
- ],
2941
- color: "primary",
2942
- fill: false
2943
- },
2944
- path217: {
2945
- type: "path",
2946
- points: [
2947
- {
2948
- x: -0.13229164999999998,
2949
- y: -0.2645850000000003
2950
- },
2951
- {
2952
- x: -0.13229164999999998,
2953
- y: 0.26458099999999973
2954
- }
2955
- ],
2956
- color: "primary",
2957
- fill: false
2958
- },
2959
- path218: {
2960
- type: "path",
2961
- points: [
2962
- {
2963
- x: -0.21166664999999885,
2964
- y: 0.264581999999999
2965
- },
2966
- {
2967
- x: -0.21166664999999885,
2968
- y: -0.26458399999999926
2969
- }
2970
- ],
2971
- color: "primary",
2972
- fill: false
2973
- },
2974
- path219: {
2975
- type: "path",
2976
- points: [
2977
- {
2978
- x: -0.5291666499999996,
2979
- y: 0.26458099999999973
2980
- },
2981
- {
2982
- x: -0.21166664999999885,
2983
- y: 0.264583
2984
- }
2985
- ],
2986
- color: "primary",
2987
- fill: false
2988
- },
2989
- path220: {
2990
- type: "path",
2991
- points: [
2992
- {
2993
- x: -0.13229164999999998,
2994
- y: 0.18520600000000087
2995
- },
2996
- {
2997
- x: 0.13229175000000026,
2998
- y: 0.18520600000000087
2999
- }
3000
- ],
3001
- color: "primary",
3002
- fill: false
3003
- },
3004
- path221: {
3005
- type: "path",
3006
- points: [
3007
- {
3008
- x: -0.13229164999999998,
3009
- y: -0.18520999999999965
3010
- },
3011
- {
3012
- x: 0.13229175000000026,
3013
- y: -0.18520999999999965
3014
- }
3015
- ],
3016
- color: "primary",
3017
- fill: false
3018
- },
3019
- path222: {
3020
- type: "path",
3021
- points: [
3022
- {
3023
- x: -0.05291665000000023,
3024
- y: -9999999992515995e-22
3025
- },
3026
- {
3027
- x: 0.13229165000000087,
3028
- y: -9999999992515995e-22
3029
- }
3030
- ],
3031
- color: "primary",
3032
- fill: false
3033
- }
3034
- },
3035
- texts: {
3036
- right1: {
3037
- type: "text",
3038
- text: "{REF}",
3039
- x: 0.5827374500000007,
3040
- y: -0.20929270999999972
3041
- },
3042
- right2: {
3043
- type: "text",
3044
- text: "{VAL}",
3045
- x: 0.58412285,
3046
- y: -0.021192649999999702
3047
- }
3048
- },
3049
- refblocks: {
3050
- top1: {
3051
- x: 0.13275345000000005,
3052
- y: -0.5440228900000008
3053
- },
3054
- bottom1: {
3055
- x: 0.13239525000000096,
3056
- y: 0.54252477
3057
- },
3058
- left1: {
3059
- x: -0.5308188500000002,
3060
- y: 0.26564980000000027
3061
- }
3062
- },
3063
- bounds: {
3064
- minX: -0.5291666499999996,
3065
- maxX: 0.5291666500000005,
3066
- minY: -0.529166,
3067
- maxY: 0.529166,
3068
- width: 1.0583333000000001,
3069
- height: 1.058332,
3070
- centerX: 4440892098500626e-31,
3071
- centerY: 0
3072
- }
3073
- };
3074
-
3075
- // symbols/mosfet_depletion_normally_on_horz.ts
3076
- var { paths: paths4, texts: texts4, bounds: bounds4, refblocks: refblocks4 } = mosfet_depletion_normally_on_default;
3077
- var mosfet_depletion_normally_on_horz_default = defineSymbol({
3078
- primitives: [
3079
- ...Object.values(paths4),
3080
- { ...texts4.right1, anchor: "middle_left" },
3081
- { ...texts4.right2, anchor: "middle_left" }
3082
- ],
3083
- ports: [
3084
- { ...refblocks4.top1, labels: ["1"] },
3085
- // TODO add more "standard" labels
3086
- { ...refblocks4.bottom1, labels: ["2"] },
3087
- // TODO add more "standard" labels
3088
- { ...refblocks4.left1, labels: ["3"] }
3089
- // TODO add more "standard" labels
3090
- ],
3091
- size: { width: bounds4.width + 0.4, height: bounds4.height },
3092
- center: { x: bounds4.centerX + 0.2, y: bounds4.centerY }
3093
- });
3094
-
3095
- // symbols/mosfet_depletion_normally_on_vert.ts
3096
- var rotated = rotateSymbol(mosfet_depletion_normally_on_horz_default);
3097
- var ref = rotated.primitives.find(
3098
- (p) => p.type === "text" && p.text === "{REF}"
3099
- );
3100
- var val = rotated.primitives.find(
3101
- (p) => p.type === "text" && p.text === "{VAL}"
3102
- );
3103
- ref.anchor = "middle_top";
3104
- val.anchor = "middle_top";
3105
- ref.x = val.x;
3106
- val.y += 0.15;
3107
- var mosfet_depletion_normally_on_vert_default = rotated;
3108
-
3109
- // assets/symbols-svg-json/potentiometer.json
3110
- var potentiometer_default = {
3111
- paths: {
3112
- path11: {
3113
- type: "path",
3114
- points: [
3115
- {
3116
- x: -0.5291669499999998,
3117
- y: 0.1434596500000005
3118
- },
3119
- {
3120
- x: -0.26458365000000006,
3121
- y: 0.1434596500000005
3122
- }
3123
- ],
3124
- color: "primary",
3125
- fill: false
3126
- },
3127
- path12: {
3128
- type: "path",
3129
- points: [
3130
- {
3131
- x: 0.26458334999999966,
3132
- y: 0.1434596500000005
3133
- },
3134
- {
3135
- x: 0.52916695,
3136
- y: 0.1434596500000005
3137
- }
3138
- ],
3139
- color: "primary",
3140
- fill: false
3141
- },
3142
- path13: {
3143
- type: "path",
3144
- points: [
3145
- {
3146
- x: 12499999999526779e-22,
3147
- y: 0.011167849999999646
3148
- },
3149
- {
3150
- x: 0.26458424999999997,
3151
- y: 0.011167849999999646
3152
- },
3153
- {
3154
- x: 0.26458424999999997,
3155
- y: 0.2757512500000008
3156
- },
3157
- {
3158
- x: -0.26458274999999976,
3159
- y: 0.2757512500000008
3160
- },
3161
- {
3162
- x: -0.26458274999999976,
3163
- y: 0.011167849999999646
3164
- },
3165
- {
3166
- x: 12500000012849455e-22,
3167
- y: 0.011167849999999646
3168
- }
3169
- ],
3170
- color: "primary",
3171
- fill: false
3172
- },
3173
- path15: {
3174
- type: "path",
3175
- points: [
3176
- {
3177
- x: 0.06517084999999989,
3178
- y: -0.10588935
3179
- },
3180
- {
3181
- x: -0.06529785000000032,
3182
- y: -0.10588935
3183
- },
3184
- {
3185
- x: -6345000000029799e-20,
3186
- y: 0.00700125000000007
3187
- },
3188
- {
3189
- x: 0.06517084999999989,
3190
- y: -0.10588935
3191
- }
3192
- ],
3193
- color: "primary",
3194
- fill: true
3195
- },
3196
- path17: {
3197
- type: "path",
3198
- points: [
3199
- {
3200
- x: 25875000000041837e-20,
3201
- y: -0.2757512500000008
3202
- },
3203
- {
3204
- x: 25875000000041837e-20,
3205
- y: -0.060545249999998774
3206
- }
3207
- ],
3208
- color: "primary",
3209
- fill: false
3210
- }
3211
- },
3212
- texts: {
3213
- bottom1: {
3214
- type: "text",
3215
- text: "{VAL}",
3216
- x: -0.007583050000000924,
3217
- y: 0.4315381500000015
3218
- },
3219
- right1: {
3220
- type: "text",
3221
- text: "{REF}",
3222
- x: 0.12478014999999942,
3223
- y: -0.09260654999999929
3224
- }
3225
- },
3226
- refblocks: {
3227
- left1: {
3228
- x: -0.5449899500000002,
3229
- y: 0.14431244999999926
3230
- },
3231
- right1: {
3232
- x: 0.5378069499999998,
3233
- y: 0.14331605000000103
3234
- }
3235
- },
3236
- bounds: {
3237
- minX: -0.5291669499999998,
3238
- maxX: 0.52916695,
3239
- minY: -0.2757512500000008,
3240
- maxY: 0.2757512500000008,
3241
- width: 1.0583338999999998,
3242
- height: 0.5515025000000016,
3243
- centerX: 11102230246251565e-32,
3244
- centerY: 0
3245
- }
3246
- };
3247
-
3248
- // symbols/potentiometer_horz.ts
3249
- var { paths: paths5, texts: texts5, bounds: bounds5, refblocks: refblocks5 } = potentiometer_default;
3250
- var potentiometer_horz_default = defineSymbol({
3251
- primitives: [
3252
- ...Object.values(paths5),
3253
- { ...texts5.bottom1, y: 0.35, anchor: "middle_top" },
3254
- { ...texts5.right1, anchor: "middle_left" }
3255
- ],
3256
- ports: [
3257
- { ...refblocks5.left1, labels: ["1"] },
3258
- // TODO add more "standard" labels
3259
- { ...refblocks5.right1, labels: ["2"] }
3260
- // TODO add more "standard" labels
3261
- ],
3262
- size: { width: bounds5.width + 0.05, height: bounds5.height },
3263
- center: { x: bounds5.centerX, y: bounds5.centerY }
3264
- });
3265
-
3266
- // symbols/potentiometer_vert.ts
3267
- var rotated2 = rotateSymbol(potentiometer_horz_default);
3268
- var potentiometer_vert_default = rotated2;
3269
-
3270
- // assets/symbols-svg-json/potentiometer2.json
3271
- var potentiometer2_default = {
3272
- paths: {
3273
- path18: {
3274
- type: "path",
3275
- points: [
3276
- {
3277
- x: -0.5291669499999998,
3278
- y: 8545000000008685e-19
3279
- },
3280
- {
3281
- x: -0.26458365000000006,
3282
- y: 8545000000008685e-19
3283
- }
3284
- ],
3285
- color: "primary",
3286
- fill: false
3287
- },
3288
- path19: {
3289
- type: "path",
3290
- points: [
3291
- {
3292
- x: 0.26458334999999966,
3293
- y: 8545000000008685e-19
3294
- },
3295
- {
3296
- x: 0.5291669499999996,
3297
- y: 8545000000008685e-19
3298
- }
3299
- ],
3300
- color: "primary",
3301
- fill: false
3302
- },
3303
- path20: {
3304
- type: "path",
3305
- points: [
3306
- {
3307
- x: 12499999995085886e-22,
3308
- y: -0.1314371999999988
3309
- },
3310
- {
3311
- x: 0.26458424999999997,
3312
- y: -0.1314371999999988
3313
- },
3314
- {
3315
- x: 0.26458424999999997,
3316
- y: 0.13314619999999877
3317
- },
3318
- {
3319
- x: -0.26458274999999976,
3320
- y: 0.13314619999999877
3321
- },
3322
- {
3323
- x: -0.26458274999999976,
3324
- y: -0.1314371999999988
3325
- },
3326
- {
3327
- x: 12500000012849455e-22,
3328
- y: -0.1314371999999988
3329
- }
3330
- ],
3331
- color: "primary",
3332
- fill: false
3333
- },
3334
- path23: {
3335
- type: "path",
3336
- points: [
3337
- {
3338
- x: 0.28137284999999945,
3339
- y: 0.2822274
3340
- },
3341
- {
3342
- x: 0.17906194999999903,
3343
- y: 0.25486950000000164
3344
- },
3345
- {
3346
- x: 0.2540149499999984,
3347
- y: 0.1799165000000027
3348
- },
3349
- {
3350
- x: 0.28137284999999945,
3351
- y: 0.2822274
3352
- }
3353
- ],
3354
- color: "primary",
3355
- fill: true
3356
- },
3357
- path24: {
3358
- type: "path",
3359
- points: [
3360
- {
3361
- x: 0.29134274999999965,
3362
- y: 0.2921307000000013
3363
- },
3364
- {
3365
- x: 0.2577490499999997,
3366
- y: 0.16634940000000142
3367
- },
3368
- {
3369
- x: 0.16536614999999966,
3370
- y: 0.25853690000000284
3371
- },
3372
- {
3373
- x: 0.29134274999999965,
3374
- y: 0.2921307000000013
3375
- }
3376
- ],
3377
- color: "primary",
3378
- fill: true
3379
- },
3380
- path26: {
3381
- type: "path",
3382
- points: [
3383
- {
3384
- x: -0.29551765000000074,
3385
- y: -0.2921307000000013
3386
- },
3387
- {
3388
- x: 0.23295514999999956,
3389
- y: 0.2328032000000011
3390
- }
3391
- ],
3392
- color: "primary",
3393
- fill: false
3394
- }
3395
- },
3396
- texts: {
3397
- top1: {
3398
- type: "text",
3399
- text: "{REF}",
3400
- x: 0.05811516999999933,
3401
- y: -0.2009376800000009
3402
- },
3403
- bottom1: {
3404
- type: "text",
3405
- text: "{VAL}",
3406
- x: -0.09712293000000072,
3407
- y: 0.27857531999999985
3408
- }
3409
- },
3410
- refblocks: {
3411
- left1: {
3412
- x: -0.5316179500000004,
3413
- y: 0.0013439000000019519
3414
- },
3415
- right1: {
3416
- x: 0.5377649500000006,
3417
- y: 0.001956599999999753
3418
- }
3419
- },
3420
- bounds: {
3421
- minX: -0.5291669499999998,
3422
- maxX: 0.5291669499999996,
3423
- minY: -0.2921307000000013,
3424
- maxY: 0.2921307000000013,
3425
- width: 1.0583338999999994,
3426
- height: 0.5842614000000026,
3427
- centerX: -11102230246251565e-32,
3428
- centerY: 0
3429
- }
3430
- };
3431
-
3432
- // symbols/potentiometer2_horz.ts
3433
- var { paths: paths6, texts: texts6, bounds: bounds6, refblocks: refblocks6 } = potentiometer2_default;
3434
- var potentiometer2_horz_default = defineSymbol({
3435
- primitives: [...Object.values(paths6), ...Object.values(texts6)],
3436
- ports: [
3437
- { ...refblocks6.left1, labels: ["1"] },
3438
- // TODO add more "standard" labels
3439
- { ...refblocks6.right1, labels: ["2"] }
3440
- // TODO add more "standard" labels
3441
- ],
3442
- size: { width: bounds6.width, height: bounds6.height },
3443
- center: { x: bounds6.centerX, y: bounds6.centerY }
3444
- });
3445
-
3446
- // symbols/potentiometer2_vert.ts
3447
- var potentiometer2_vert_default = rotateSymbol(potentiometer2_horz_default);
3448
-
3449
- // assets/symbols-svg-json/varistor.json
3450
- var varistor_default = {
3451
- paths: {
3452
- path5: {
3453
- type: "path",
3454
- points: [
3455
- {
3456
- x: -0.5291668,
3457
- y: 0
3458
- },
3459
- {
3460
- x: -0.2645835000000005,
3461
- y: 0
3462
- }
3463
- ],
3464
- color: "primary",
3465
- fill: false
3466
- },
3467
- path6: {
3468
- type: "path",
3469
- points: [
3470
- {
3471
- x: 0.2645835000000005,
3472
- y: 0
3473
- },
3474
- {
3475
- x: 0.5291668,
3476
- y: 0
3477
- }
3478
- ],
3479
- color: "primary",
3480
- fill: false
3481
- },
3482
- path7: {
3483
- type: "path",
3484
- points: [
3485
- {
3486
- x: 0.2645835000000005,
3487
- y: 0.23812500000000192
3488
- },
3489
- {
3490
- x: -0.2645834999999992,
3491
- y: -0.23812500000000014
3492
- }
3493
- ],
3494
- color: "primary",
3495
- fill: false
3496
- },
3497
- path8: {
3498
- type: "path",
3499
- points: [
3500
- {
3501
- x: 0.3704165000000006,
3502
- y: 0.23812500000000192
3503
- },
3504
- {
3505
- x: 0.2645835000000005,
3506
- y: 0.23812500000000192
3507
- }
3508
- ],
3509
- color: "primary",
3510
- fill: false
3511
- },
3512
- path9: {
3513
- type: "path",
3514
- points: [
3515
- {
3516
- x: 1400000000817414e-21,
3517
- y: -0.13229179999999907
3518
- },
3519
- {
3520
- x: 0.2645844000000013,
3521
- y: -0.13229179999999907
3522
- },
3523
- {
3524
- x: 0.2645844000000013,
3525
- y: 0.13229160000000206
3526
- },
3527
- {
3528
- x: -0.26458259999999845,
3529
- y: 0.13229160000000206
3530
- },
3531
- {
3532
- x: -0.26458259999999845,
3533
- y: -0.13229179999999907
3534
- },
3535
- {
3536
- x: 14000000021496817e-22,
3537
- y: -0.13229179999999907
3538
- }
3539
- ],
3540
- color: "primary",
3541
- fill: false
3542
- }
3543
- },
3544
- texts: {
3545
- top1: {
3546
- type: "text",
3547
- text: "{REF}",
3548
- x: -0.06307419999999953,
3549
- y: -0.2470063999999983
3550
- },
3551
- bottom1: {
3552
- type: "text",
3553
- text: "{VAL}",
3554
- x: 0.0039234000000010205,
3555
- y: 0.256324600000001
3556
- }
3557
- },
3558
- refblocks: {
3559
- left1: {
3560
- x: -0.5438152999999999,
3561
- y: 0.0016897000000017925
3562
- },
3563
- right1: {
3564
- x: 0.5346478000000006,
3565
- y: -6806999999984242e-19
3566
- }
3567
- },
3568
- bounds: {
3569
- minX: -0.5291668,
3570
- maxX: 0.5291668,
3571
- minY: -0.23812500000000014,
3572
- maxY: 0.23812500000000192,
3573
- width: 1.0583336,
3574
- height: 0.47625000000000206,
3575
- centerX: 0,
3576
- centerY: 8881784197001252e-31
3577
- }
3578
- };
3579
-
3580
- // symbols/varistor_horz.ts
3581
- var { paths: paths7, texts: texts7, bounds: bounds7, refblocks: refblocks7 } = varistor_default;
3582
- var varistor_horz_default = defineSymbol({
3583
- primitives: [
3584
- ...Object.values(paths7),
3585
- { ...texts7.top1, anchor: "middle_left" },
3586
- { ...texts7.bottom1, anchor: "middle_right" }
3587
- ],
3588
- ports: [
3589
- {
3590
- ...refblocks7.left1,
3591
- labels: ["1", "-"]
3592
- },
3593
- {
3594
- ...refblocks7.right1,
3595
- labels: ["2", "+"]
3596
- }
3597
- ],
3598
- size: { width: bounds7.width, height: bounds7.height },
3599
- //{ width: 1, height: 0.24 },
3600
- center: { x: bounds7.centerX, y: bounds7.centerY }
3601
- });
3602
-
3603
- // symbols/varistor_vert.ts
3604
- var varistor_vert_default = rotateSymbol(varistor_horz_default, {});
3605
-
3606
- // symbols/index.ts
3607
- var symbols_default = {
3608
- "boxresistor_horz": boxresistor_horz_default,
3609
- "boxresistor_vert": boxresistor_vert_default,
3610
- "diode_horz": diode_horz_default,
3611
- "diode_vert": diode_vert_default,
3612
- "fuse_horz": fuse_horz_default,
3613
- "fuse_vert": fuse_vert_default,
3614
- "led_horz": led_horz_default,
3615
- "led_vert": led_vert_default,
3616
- "mosfet_depletion_normally_on_horz": mosfet_depletion_normally_on_horz_default,
3617
- "mosfet_depletion_normally_on_vert": mosfet_depletion_normally_on_vert_default,
3618
- "potentiometer_horz": potentiometer_horz_default,
3619
- "potentiometer_vert": potentiometer_vert_default,
3620
- "potentiometer2_horz": potentiometer2_horz_default,
3621
- "potentiometer2_vert": potentiometer2_vert_default,
3622
- "varistor_horz": varistor_horz_default,
3623
- "varistor_vert": varistor_vert_default
3624
- };
3625
-
3626
- // drawing/svgPathToPoints.ts
3627
- var import_svg_path_parser = __toESM(require_svg_path_parser(), 1);
3628
-
3629
- // drawing/pathToSvgD.ts
3630
- function pathToSvgD(points, closed = false) {
3631
- const pathCommands = points.map((point, index) => `${index === 0 ? "M" : "L"}${point.x},${point.y}`).join(" ");
3632
- return closed ? `${pathCommands} Z` : pathCommands;
3633
- }
3634
-
3635
- // drawing/mapColor.ts
3636
- var mapColor = (color) => {
3637
- switch (color) {
3638
- case "primary":
3639
- return "black";
3640
- case "secondary":
3641
- return "gray";
3642
- default:
3643
- return color;
3644
- }
3645
- };
3646
-
3647
- // drawing/getSvg.ts
3648
- function createDiamondElement(center, size = 0.05) {
3649
- const { x, y } = center;
3650
- const halfSize = size / 2;
3651
- return `<path d="M ${x} ${y - halfSize} L ${x + halfSize} ${y} L ${x} ${y + halfSize} L ${x - halfSize} ${y} Z" fill="green" />`;
3652
- }
3653
- function createTextElement(primitive) {
3654
- const { x, y, text: text2, fontSize = 0.1, anchor } = primitive;
3655
- let textAnchor;
3656
- let dx = 0;
3657
- let dy = 0;
3658
- const capHeight = fontSize * 0.75;
3659
- switch (anchor) {
3660
- case "top_left":
3661
- textAnchor = "start";
3662
- dy = fontSize;
3663
- break;
3664
- case "top_right":
3665
- textAnchor = "end";
3666
- dy = fontSize;
3667
- break;
3668
- case "bottom_left":
3669
- textAnchor = "start";
3670
- break;
3671
- case "bottom_right":
3672
- textAnchor = "end";
3673
- break;
3674
- case "center":
3675
- textAnchor = "middle";
3676
- dy = fontSize / 2;
3677
- break;
3678
- case "middle_top":
3679
- textAnchor = "middle";
3680
- dy = capHeight;
3681
- break;
3682
- case "middle_bottom":
3683
- textAnchor = "middle";
3684
- break;
3685
- case "middle_left":
3686
- textAnchor = "start";
3687
- dy = capHeight / 2;
3688
- break;
3689
- case "middle_right":
3690
- textAnchor = "end";
3691
- dy = capHeight / 2;
3692
- break;
3693
- }
3694
- return {
3695
- text: `<text x="${x}" y="${y}" dx="${dx}" dy="${dy}" text-anchor="${textAnchor}" style="font: ${fontSize ?? 0.1}px monospace; fill: ${mapColor("primary")}">${text2}</text>`,
3696
- anchor: `<rect x="${x - 0.025 / 2}" y="${y - 0.025 / 2}" width="0.025" height="0.025" fill="blue" />`
3697
- };
3698
- }
3699
- function createPortElement(port) {
3700
- const { x, y, labels } = port;
3701
- const rectSize = 0.05;
3702
- const labelFontSize = 0.08;
3703
- const label = labels[0] || "";
3704
- return `
3705
- <rect x="${x - rectSize / 2}" y="${y - rectSize / 2}" width="${rectSize}" height="${rectSize}" fill="red" />
3706
- <text x="${x - labelFontSize / 2}" y="${y + rectSize + labelFontSize / 2}" text-anchor="middle" style="font: ${labelFontSize}px monospace; fill: #833;">${label}</text>
3707
- `;
3708
- }
3709
- function getInnerSvg(symbol, options = {}) {
3710
- const { debug = false } = options;
3711
- const { primitives, size, ports } = symbol;
3712
- const svgElements = primitives.map((primitive) => {
3713
- switch (primitive.type) {
3714
- case "path":
3715
- return `<path d="${pathToSvgD(primitive.points, primitive.closed)}" fill="${primitive.fill ? mapColor(primitive.color) : "none"}" stroke="${mapColor(primitive.color)}" stroke-width="0.02" stroke-linecap="round" stroke-linejoin="round" />`;
3716
- case "text":
3717
- const textElements = createTextElement(primitive);
3718
- return textElements.text + (debug ? textElements.anchor : "");
3719
- case "circle":
3720
- return `<circle cx="${primitive.x}" cy="${primitive.y}" r="${primitive.radius}" fill="${mapColor("primary")}" />`;
3721
- case "box":
3722
- return `<rect x="${primitive.x}" y="${primitive.y}" width="${primitive.width}" height="${primitive.height}" fill="${mapColor("primary")}" />`;
3723
- default:
3724
- return "";
3725
- }
3726
- });
3727
- const portElements = ports.map(createPortElement).join("\n ");
3728
- const centerDiamond = createDiamondElement(symbol.center);
3729
- return [svgElements.join("\n "), portElements, centerDiamond].join("\n");
3730
- }
3731
- function getSvg(symbol, options = {}) {
3732
- const { size } = symbol;
3733
- const innerSvg = getInnerSvg(symbol, options);
3734
- const bufferMultiple = 1.1;
3735
- const w = size.width * bufferMultiple;
3736
- const h = size.height * bufferMultiple;
3737
- const viewBox = {
3738
- x: symbol.center.x - w / 2,
3739
- y: symbol.center.y - h / 2,
3740
- width: w,
3741
- height: h
3742
- };
3743
- if (options.width && !options.height) {
3744
- options.height = options.width * (viewBox.height / viewBox.width);
3745
- } else if (!options.width && options.height) {
3746
- options.width = options.height * (viewBox.width / viewBox.height);
3747
- } else if (!options.width && !options.height) {
3748
- options.width = viewBox.width;
3749
- options.height = viewBox.height;
3750
- }
3751
- return `<svg width="${options.width}" height="${options.height}" viewBox="${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}" xmlns="http://www.w3.org/2000/svg">${innerSvg}</svg>`;
3752
- }
3753
-
3754
- // drawing/resizeSymbol.ts
3755
- function resizeSymbol(symbol, newSize) {
3756
- const { width: oldWidth, height: oldHeight } = symbol.size;
3757
- let scaleX = 1, scaleY = 1;
3758
- if (newSize.width && newSize.height) {
3759
- scaleX = newSize.width / oldWidth;
3760
- scaleY = newSize.height / oldHeight;
3761
- } else if (newSize.width) {
3762
- scaleX = scaleY = newSize.width / oldWidth;
3763
- } else if (newSize.height) {
3764
- scaleX = scaleY = newSize.height / oldHeight;
3765
- }
3766
- const resizedPrimitives = symbol.primitives.map((primitive) => {
3767
- switch (primitive.type) {
3768
- case "path":
3769
- return {
3770
- ...primitive,
3771
- points: primitive.points.map((p) => ({
3772
- x: p.x * scaleX,
3773
- y: p.y * scaleY
3774
- }))
3775
- };
3776
- case "text":
3777
- case "circle":
3778
- return {
3779
- ...primitive,
3780
- x: primitive.x * scaleX,
3781
- y: primitive.y * scaleY
3782
- };
3783
- case "box":
3784
- return {
3785
- ...primitive,
3786
- x: primitive.x * scaleX,
3787
- y: primitive.y * scaleY,
3788
- width: primitive.width * scaleX,
3789
- height: primitive.height * scaleY
3790
- };
3791
- default:
3792
- return primitive;
3793
- }
3794
- });
3795
- return {
3796
- ...symbol,
3797
- primitives: resizedPrimitives,
3798
- center: {
3799
- x: symbol.center.x * scaleX,
3800
- y: symbol.center.y * scaleY
3801
- },
3802
- ports: symbol.ports.map((port) => ({
3803
- ...port,
3804
- x: port.x * scaleX,
3805
- y: port.y * scaleY
3806
- })),
3807
- size: {
3808
- width: oldWidth * scaleX,
3809
- height: oldHeight * scaleY
3810
- }
3811
- };
3812
- }
3813
-
3814
- // index.ts
3815
- var BASE_SYMBOLS = Object.fromEntries(Object.keys(symbols_default).map((k) => [k, k]));
3816
- // Annotate the CommonJS export names for ESM import in node:
3817
- 0 && (module.exports = {
3818
- BASE_SYMBOLS,
3819
- getInnerSvg,
3820
- getSvg,
3821
- resizeSymbol,
3822
- symbols
3823
- });
3824
- //# sourceMappingURL=index.cjs.map