@rnacanvas/draw.bonds.curved 2.2.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -6
- package/dist/CurvedBond.d.ts +27 -0
- package/dist/CurvedBond.d.ts.map +1 -1
- package/dist/Drawing.d.ts +9 -0
- package/dist/Drawing.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,8 +25,13 @@ A bond that can have one or more curves in it
|
|
|
25
25
|
Creates and returns a new curved bond between two bases.
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
|
-
var
|
|
29
|
-
|
|
28
|
+
var drawing = new Drawing();
|
|
29
|
+
|
|
30
|
+
// necessary for bounding box calculations to work correctly
|
|
31
|
+
document.body.append(drawing.domNode);
|
|
32
|
+
|
|
33
|
+
var base1 = drawing.addBase('G');
|
|
34
|
+
var base2 = drawing.addBase('C');
|
|
30
35
|
|
|
31
36
|
var bond = CurvedBond.betweeen(base1, base2);
|
|
32
37
|
|
|
@@ -43,18 +48,116 @@ The ID of a curved bond.
|
|
|
43
48
|
|
|
44
49
|
(Corresponds to the ID attribute of the underlying SVG path element.)
|
|
45
50
|
|
|
46
|
-
As with DOM elements in general,
|
|
47
|
-
the ID of a curved bond shouldn't be changed after it's been set
|
|
51
|
+
<b>As with DOM elements in general,
|
|
52
|
+
the ID of a curved bond shouldn't be changed after it's been set.</b>
|
|
48
53
|
|
|
49
54
|
```javascript
|
|
55
|
+
var drawing = new Drawing();
|
|
56
|
+
|
|
57
|
+
document.body.append(drawing.domNode);
|
|
58
|
+
|
|
50
59
|
var domNode = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
51
60
|
|
|
52
61
|
domNode.id = 'id-12345';
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
drawing.domNode.append(domNode);
|
|
64
|
+
|
|
65
|
+
var base1 = drawing.addBase('G');
|
|
66
|
+
var base2 = drawing.addBase('C');
|
|
56
67
|
|
|
57
68
|
var bond = new CurvedBond(domNode, base1, base2);
|
|
58
69
|
|
|
59
70
|
bond.id; // "id-12345"
|
|
60
71
|
```
|
|
72
|
+
|
|
73
|
+
### `readonly base1`
|
|
74
|
+
|
|
75
|
+
Base 1 that the curved bond is attached to.
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
var drawing = new Drawing();
|
|
79
|
+
|
|
80
|
+
document.body.append(drawing.domNode);
|
|
81
|
+
|
|
82
|
+
var base1 = drawing.addBase('G');
|
|
83
|
+
var base2 = drawing.addBase('C');
|
|
84
|
+
|
|
85
|
+
var bond = CurvedBond.between(base1, base2);
|
|
86
|
+
|
|
87
|
+
bond.base1 === base1; // true
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `readonly base2`
|
|
91
|
+
|
|
92
|
+
Base 2 that the curved bond is attached to.
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
var drawing = new Drawing();
|
|
96
|
+
|
|
97
|
+
document.body.append(drawing.domNode);
|
|
98
|
+
|
|
99
|
+
var base1 = drawing.addBase('G');
|
|
100
|
+
var base2 = drawing.addBase('C');
|
|
101
|
+
|
|
102
|
+
var bond = CurvedBond.between(base1, base2);
|
|
103
|
+
|
|
104
|
+
bond.base2 === base2; // true
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### `drag()`
|
|
108
|
+
|
|
109
|
+
Drags the curved bond by a vector (e.g., the movement of the mouse).
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
var drawing = new Drawing();
|
|
113
|
+
|
|
114
|
+
document.body.append(drawing.domNode);
|
|
115
|
+
|
|
116
|
+
var base1 = drawing.addBase('G');
|
|
117
|
+
var base2 = drawing.addBase('C');
|
|
118
|
+
|
|
119
|
+
base1.centerPoint.x = 0;
|
|
120
|
+
base1.centerPoint.y = 0;
|
|
121
|
+
|
|
122
|
+
base2.centerPoint.x = 10;
|
|
123
|
+
base2.centerPoiny.y = 20;
|
|
124
|
+
|
|
125
|
+
var bond = CurvedBond.between(base1, base2);
|
|
126
|
+
|
|
127
|
+
// drag by the vector (3, 4)
|
|
128
|
+
bond.drag(3, 4);
|
|
129
|
+
```
|
|
130
|
+
Specifying the `dragPoint` gives control over which point of a curved bond gets dragged.
|
|
131
|
+
|
|
132
|
+
(The `dragPoint` represents the point at which the mouse made contact with the curved bond
|
|
133
|
+
when initiating the drag action, for instance.)
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
// drag the starting point of the curved bond
|
|
137
|
+
bond.drag(3, 4, { dragPoint: bond.atLength(0) });
|
|
138
|
+
|
|
139
|
+
// drag the end point of the curved bond
|
|
140
|
+
bond.drag(3, 4, { dragPoint: bond.atLength(bond.length) });
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Specifying the `dragGroup` can prevent dragging from taking place
|
|
144
|
+
if bases 1 or 2 are already being dragged.
|
|
145
|
+
|
|
146
|
+
(The `dragGroup` represents the other selected elements that are also being dragged with a curved bond.)
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
// no dragging (base 1 is already being dragged)
|
|
150
|
+
bond.drag(3, 4, { dragGroup: new Set([bond.base1.domNode]) });
|
|
151
|
+
|
|
152
|
+
// no dragging (base 2 is already being dragged)
|
|
153
|
+
bond.drag(3, 4, { dragGroup: new Set([bond.base2.domNode]) });
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The `dragGroup` should fulfill the following `Collection` interface
|
|
157
|
+
(for SVG graphics elements).
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
interface Collection {
|
|
161
|
+
has(ele: SVGGraphicsElement): boolean;
|
|
162
|
+
}
|
|
163
|
+
```
|
package/dist/CurvedBond.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Drawing } from './Drawing';
|
|
1
2
|
import type { Nucleobase } from './Nucleobase';
|
|
2
3
|
export declare class CurvedBond {
|
|
3
4
|
#private;
|
|
@@ -24,5 +25,31 @@ export declare class CurvedBond {
|
|
|
24
25
|
magnitude: number;
|
|
25
26
|
direction: number;
|
|
26
27
|
};
|
|
28
|
+
drag(x: number, y: number, options?: {
|
|
29
|
+
dragPoint?: PointLike;
|
|
30
|
+
dragGroup?: Collection<SVGGraphicsElement>;
|
|
31
|
+
}): void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the saved form of the curved bond.
|
|
34
|
+
*/
|
|
35
|
+
save(): {
|
|
36
|
+
id: string;
|
|
37
|
+
baseID1: string;
|
|
38
|
+
baseID2: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Attempts to recreate a saved curved bond (given the parent drawing that its DOM node is in).
|
|
42
|
+
*
|
|
43
|
+
* Throws if unable to.
|
|
44
|
+
*/
|
|
45
|
+
static recreate(savedBond: unknown, parentDrawing: Drawing): CurvedBond | never;
|
|
46
|
+
}
|
|
47
|
+
type PointLike = {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
interface Collection<T> {
|
|
52
|
+
has(item: T): boolean;
|
|
27
53
|
}
|
|
54
|
+
export {};
|
|
28
55
|
//# sourceMappingURL=CurvedBond.d.ts.map
|
package/dist/CurvedBond.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurvedBond.d.ts","sourceRoot":"","sources":["../src/CurvedBond.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CurvedBond.d.ts","sourceRoot":"","sources":["../src/CurvedBond.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB/C,qBAAa,UAAU;;IAiCT,QAAQ,CAAC,OAAO,EAAE,cAAc;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU;IAhCpG;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU;gBA6B3C,OAAO,EAAE,cAAc,EAAW,KAAK,EAAE,UAAU,EAAW,KAAK,EAAE,UAAU;IAWpG,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,YAAY;;;MA8Bf;IAED;;OAEG;IACH,IAAI,YAAY;;;MA8Bf;IAED,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAA;KAAE,GAAG,IAAI;IAoBjH;;OAEG;IACH,IAAI;;;;;IASJ;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,UAAU,GAAG,KAAK;CAiJhF;AAID,KAAK,SAAS,GAAG;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,UAAU,UAAU,CAAC,CAAC;IACpB,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawing.d.ts","sourceRoot":"","sources":["../src/Drawing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CACtC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["draw.bonds.curved"]=e():t["draw.bonds.curved"]=e()}(this,()=>(()=>{var t={456(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){var e=0;return t.forEach(function(t){return e+=t}),e}function n(t){return r(t)/t.length}function i(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>d,average:()=>n,clamp:()=>m,degrees:()=>g,flipAway:()=>N,isBetween:()=>h,isBetweenExclusive:()=>l,isBetweenInclusive:()=>h,max:()=>c,mean:()=>n,median:()=>a,min:()=>u,normalizeAngle:()=>b,radians:()=>v,round:()=>p,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>y,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>f,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return i(e),e}function a(t){if(0==t.length)return NaN;var e=s(t);if(e.length%2!=0)return e[Math.floor(e.length/2)];var r=e.length/2,i=r-1;return n([e[r],e[i]])}function u(t){if(0==t.length)return 1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.min(e,t)}),e}function c(t){if(0==t.length)return-1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.max(e,t)}),e}function h(t,e,r){return t>=e&&t<=r}function l(t,e,r){return t>e&&t<r}function m(t,e,r){return t<e?e:t>r?r:t}function d(t,e,r){return Math.abs(t-e)<=r}function y(t){i(t),t.reverse()}function f(t){var e=s(t);return e.reverse(),e}function p(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function g(t){return t*(180/Math.PI)}function v(t){return t*(Math.PI/180)}function b(t,e){void 0===e&&(e=-Math.PI);var r=t-e;return e+((r%=2*Math.PI)>=0?r:r+2*Math.PI)}function N(t,e){var r=(e=b(e,t))-t;return(r<Math.PI/2||r>3*Math.PI/2)&&(t+=Math.PI),t}return e})()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return""===t}function c(t){return a(t)&&!u(t)}function h(t){return!!a(t)&&0==t.trim().length}function l(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function m(t){try{return JSON.stringify(t),!0}catch{return!1}}function d(t){return!!t}function y(t){return!t}function f(t){return null==t}function p(t){return"object"==typeof t&&null!==t}function g(t){return Array.isArray(t)}function v(t){return g(t)&&0==t.length}function b(t){return g(t)&&t.length>0}function N(t){return g(t)&&t.every(r)}function O(t){return N(t)&&t.length>0}function x(t){return g(t)&&t.every(n)}function T(t){return g(t)&&t.every(i)}function E(t){return g(t)&&t.every(a)}function w(t){return E(t)&&t.length>0}function S(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>g,isEmptyArray:()=>v,isEmptyString:()=>u,isFalsy:()=>y,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>x,isJSON:()=>l,isJSONSerializable:()=>m,isNonEmptyArray:()=>b,isNonEmptyNumbersArray:()=>O,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>w,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>T,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>p,isNullish:()=>f,isNumber:()=>r,isNumbersArray:()=>N,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>S,isString:()=>a,isStringsArray:()=>E,isTruthy:()=>d,isWhitespace:()=>h}),e})()},277(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Vector:()=>r});class r{static matching(t){let e="x"in t?t.x:t.magnitude*Math.cos(t.direction),n="y"in t?t.y:t.magnitude*Math.sin(t.direction);return new r(e,n)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}get magnitude(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}set magnitude(t){let e=this.direction;this.x=t*Math.cos(e),this.y=t*Math.sin(e)}get direction(){return Math.atan2(this.y,this.x)}set direction(t){let e=this.magnitude;this.x=e*Math.cos(t),this.y=e*Math.sin(t)}}return e})(),t.exports=e()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{FinitePoint:()=>o,Point:()=>i,RelativePoint:()=>m,midpoint:()=>y});var t=r(277),e=r(854);class i{static matching(t){return new i(t.x,t.y)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}set(t){(0,e.isNumber)(null==t?void 0:t.x)&&(this.x=t.x),(0,e.isNumber)(null==t?void 0:t.y)&&(this.y=t.y)}displace(e){let r=t.Vector.matching(e);this.x+=r.x,this.y+=r.y}displaced(t){let e=i.matching(this);return e.displace(t),e}displacementTo(e){return new t.Vector(e.x-this.x,e.y-this.y)}displacementFrom(e){return new t.Vector(this.x-e.x,this.y-e.y)}distanceTo(t){return this.displacementTo(t).magnitude}distanceFrom(t){return this.distanceTo(t)}directionTo(t){return this.displacementTo(t).direction}directionFrom(t){return this.displacementFrom(t).direction}}class o extends i{static matching(t){let e=i.matching(t);return new o(e.x,e.y)}constructor(t,r){if(super(t,r),!(0,e.isFiniteNumber)(t)||!(0,e.isFiniteNumber)(r))throw new Error(`Finite points must have finite number coordinates: (${t}, ${r}).`)}set(...t){let e=new i(0,0);e.set(...t),o.matching(e),super.set(...t)}}var s,a,u,c,h,l=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class m{constructor(e){s.add(this),a.set(this,void 0),u.set(this,new t.Vector(0,0)),c.set(this,{move:[]}),function(t,e,r){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,r)}(this,a,e),e.addEventListener("move",()=>l(this,s,"m",h).call(this,"move"))}get x(){return l(this,a,"f").x+l(this,u,"f").x}set x(t){l(this,u,"f").x=t-l(this,a,"f").x,l(this,s,"m",h).call(this,"move")}get y(){return l(this,a,"f").y+l(this,u,"f").y}set y(t){l(this,u,"f").y=t-l(this,a,"f").y,l(this,s,"m",h).call(this,"move")}addEventListener(t,e){l(this,c,"f")[t].push(e)}removeEventListener(t,e){l(this,c,"f")[t]=l(this,c,"f")[t].filter(t=>t!==e)}}a=new WeakMap,u=new WeakMap,c=new WeakMap,s=new WeakSet,h=function(t){l(this,c,"f")[t].forEach(t=>t())};var d=r(986);function y(t,e){return new i((0,d.average)([t.x,e.x]),(0,d.average)([t.y,e.y]))}})(),n})(),t.exports=e()},725(t){t.exports=(()=>{var t={986:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){var e=0;return t.forEach(function(t){return e+=t}),e}function n(t){return r(t)/t.length}function i(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>m,average:()=>n,degrees:()=>f,isBetweenExclusive:()=>l,isBetweenInclusive:()=>h,max:()=>c,mean:()=>n,median:()=>a,min:()=>u,radians:()=>p,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>d,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>y,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return i(e),e}function a(t){if(0==t.length)return NaN;var e=s(t);if(e.length%2!=0)return e[Math.floor(e.length/2)];var r=e.length/2,i=r-1;return n([e[r],e[i]])}function u(t){if(0==t.length)return 1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.min(e,t)}),e}function c(t){if(0==t.length)return-1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.max(e,t)}),e}function h(t,e,r){return t>=e&&t<=r}function l(t,e,r){return t>e&&t<r}function m(t,e,r){return Math.abs(t-e)<=r}function d(t){i(t),t.reverse()}function y(t){var e=s(t);return e.reverse(),e}function f(t){return t*(180/Math.PI)}function p(t){return t*(Math.PI/180)}return e})()},854:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return null==t}function c(t){return"object"==typeof t&&null!==t}function h(t){return Array.isArray(t)}return t.r(e),t.d(e,{isArray:()=>h,isFiniteNumber:()=>n,isNonFiniteNumber:()=>i,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isPositiveFiniteNumber:()=>o,isString:()=>a}),e})()},30:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return Math.pow(Math.pow(t.x,2)+Math.pow(t.y,2),.5)}function n(t){return Math.atan2(t.y,t.x)}return t.r(e),t.d(e,{direction:()=>n,magnitude:()=>r}),e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{areWithin:()=>a,centroid:()=>d,deepCopy:()=>o,direction:()=>l,displaced:()=>c,displacement:()=>u,distance:()=>s,isFinitePoint:()=>i,isPoint:()=>e,midpoint:()=>y});var t=r(854);function e(e){return(0,t.isNonNullObject)(e)&&(0,t.isNumber)(e.x)&&(0,t.isNumber)(e.y)}function i(r){return e(r)&&(0,t.isFiniteNumber)(r.x)&&(0,t.isFiniteNumber)(r.y)}function o(t){return{x:t.x,y:t.y}}function s(t,e){var r=e.x-t.x,n=e.y-t.y;return Math.pow(Math.pow(r,2)+Math.pow(n,2),.5)}function a(t,e,r){return s(t,e)<=r}function u(t,e){return{x:e.x-t.x,y:e.y-t.y}}function c(t,e){return{x:t.x+e.x,y:t.y+e.y}}var h=r(30);function l(t,e){return(0,h.direction)(u(t,e))}var m=r(986);function d(t){return{x:(0,m.mean)(t.map(function(t){return t.x})),y:(0,m.mean)(t.map(function(t){return t.y}))}}function y(t,e){return d([t,e])}})(),n})()},106(t){var e;e=()=>(()=>{var t={992(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{KeyBinding:()=>y});var r,n,i,o,s,a,u,c,h,l,m=function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},d=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class y{constructor(t,e,a){r.add(this),this.key=t,n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),s.set(this,void 0),m(this,n,e,"f"),m(this,i,t=>d(this,r,"m",l).call(this,t),"f"),m(this,o,a,"f")}get owner(){return d(this,s,"f")}set owner(t){var e;null===(e=d(this,s,"f"))||void 0===e||e.removeEventListener("keydown",d(this,i,"f")),null==t||t.addEventListener("keydown",d(this,i,"f"),{passive:!1}),m(this,s,t,"f")}}return n=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,r=new WeakSet,a=function(){var t,e;return null!==(e=null===(t=d(this,o,"f"))||void 0===t?void 0:t.altKey)&&void 0!==e&&e},u=function(){var t,e;return null!==(e=null===(t=d(this,o,"f"))||void 0===t?void 0:t.ctrlKey)&&void 0!==e&&e},c=function(){var t,e;return null!==(e=null===(t=d(this,o,"f"))||void 0===t?void 0:t.metaKey)&&void 0!==e&&e},h=function(){var t,e;return null!==(e=null===(t=d(this,o,"f"))||void 0===t?void 0:t.shiftKey)&&void 0!==e&&e},l=function(t){this.owner&&this.owner===document.activeElement&&t.key.toUpperCase()===this.key.toUpperCase()&&t.altKey===d(this,r,"a",a)&&t.ctrlKey===d(this,r,"a",u)&&t.metaKey===d(this,r,"a",c)&&t.shiftKey===d(this,r,"a",h)&&(t.preventDefault(),d(this,n,"f").call(this))},e})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return""===t}function c(t){return a(t)&&!u(t)}function h(t){return!!a(t)&&0==t.trim().length}function l(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function m(t){try{return JSON.stringify(t),!0}catch{return!1}}function d(t){return!!t}function y(t){return!t}function f(t){return null==t}function p(t){return"object"==typeof t&&null!==t}function g(t){return Array.isArray(t)}function v(t){return g(t)&&0==t.length}function b(t){return g(t)&&t.length>0}function N(t){return g(t)&&t.every(r)}function O(t){return N(t)&&t.length>0}function x(t){return g(t)&&t.every(n)}function T(t){return g(t)&&t.every(i)}function E(t){return g(t)&&t.every(a)}function w(t){return E(t)&&t.length>0}function S(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>g,isEmptyArray:()=>v,isEmptyString:()=>u,isFalsy:()=>y,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>x,isJSON:()=>l,isJSONSerializable:()=>m,isNonEmptyArray:()=>b,isNonEmptyNumbersArray:()=>O,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>w,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>T,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>p,isNullish:()=>f,isNumber:()=>r,isNumbersArray:()=>N,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>S,isString:()=>a,isStringsArray:()=>E,isTruthy:()=>d,isWhitespace:()=>h}),e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function t(t){if(t.length>0)return t[0];throw new Error("Array is empty.")}function e(t){if(t.length>0)return t[t.length-1];throw new Error("Array is empty.")}function i(t){if(t.length<3)throw new Error("Array has less than 3 items.");if(t.length%2==0)throw new Error("Array has an even number of items.");let e=Math.floor(t.length/2);return[t[e-1],t[e],t[e+1]]}function o(t){if(t.length<4)throw new Error("Array has less than 4 items.");if(t.length%2!=0)throw new Error("Array has an odd number of items.");let e=Math.floor(t.length/2);return[t[e-2],t[e-1],t[e],t[e+1]]}r.r(n),r.d(n,{DownloadableFile:()=>v,EventfulSet:()=>b,FiniteStack:()=>w,KeyBinding:()=>m.KeyBinding,containsFocus:()=>l,detectMac:()=>y,detectWindows:()=>d,first:()=>t,hasFocus:()=>h,isJSON:()=>s.isJSON,isJSONSerializable:()=>s.isJSONSerializable,isURL:()=>S,last:()=>e,middleFour:()=>o,middleThree:()=>i,removeWhitespace:()=>a,shuffled:()=>c,splitLines:()=>u});var s=r(854);function a(t){return[...t].filter(t=>!(0,s.isWhitespace)(t)).join("")}function u(t){return t.split(/\r\n|\r|\n/)}function c(t){return t.map(t=>({v:t,priority:Math.random()})).sort((t,e)=>t.priority-e.priority).map(({v:t})=>t)}function h(t){return t===document.activeElement}function l(t){return!!document.activeElement&&t.contains(document.activeElement)}var m=r(992);function d(){return-1!==navigator.userAgent.indexOf("Windows")}function y(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(t){return!1}}var f,p=function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},g=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class v{constructor(t,e,r){f.set(this,void 0),this.name=null!=t?t:"Unnamed.txt",this.content=null!=e?e:"",p(this,f,null==r?void 0:r.type,"f")}get type(){return null!=g(this,f,"f")?g(this,f,"f"):this.content instanceof Blob?this.content.type:"text/plain"}set type(t){p(this,f,t,"f")}download(){let t=new File([this.content],this.name,{type:this.type}),e=URL.createObjectURL(t),r=document.createElement("a");r.href=e,r.download=t.name,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(e)}}f=new WeakMap;class b{constructor(){this.eventListeners={change:[]},this.underlyingSet=new Set}[Symbol.iterator](){return this.underlyingSet.values()}includes(t){return this.underlyingSet.has(t)}include(t){return this.includes(t)}addAll(t){let e=[...t];0!=e.length&&(e.every(t=>this.includes(t))||(e.forEach(t=>this.underlyingSet.add(t)),this.callEventListeners("change")))}removeAll(t){let e=[...t];0!=e.length&&(e.every(t=>!this.includes(t))||(e.forEach(t=>this.underlyingSet.delete(t)),this.callEventListeners("change")))}clear(){0!=this.underlyingSet.size&&(this.underlyingSet.clear(),this.callEventListeners("change"))}addEventListener(t,e){this.eventListeners[t].push(e)}callEventListeners(t){this.eventListeners[t].forEach(t=>t())}removeEventListener(t,e){this.eventListeners[t]=this.eventListeners[t].filter(t=>t!==e)}}var N,O,x,T,E=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class w{constructor(t){N.add(this),this.maxSize=t,O.set(this,[]),x.set(this,{change:[]})}get size(){return E(this,O,"f").length}isEmpty(){return 0==this.size}empty(){0!=this.size&&(function(t,e){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,[])}(this,O),E(this,N,"m",T).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return E(this,O,"f")[E(this,O,"f").length-1]}push(t){E(this,O,"f").push(t),this.size>this.maxSize&&E(this,O,"f").shift(),E(this,N,"m",T).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let t=E(this,O,"f").pop();return E(this,N,"m",T).call(this,"change"),t}addEventListener(t,e){E(this,x,"f")[t].push(e)}removeEventListener(t,e){E(this,x,"f")[t]=E(this,x,"f")[t].filter(t=>t!==e)}}function S(t){try{return new URL(t),!0}catch(t){return!1}}O=new WeakMap,x=new WeakMap,N=new WeakSet,T=function(t){E(this,x,"f")[t].forEach(t=>t())}})(),n})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return null==t}function c(t){return"object"==typeof t&&null!==t}function h(t){return Array.isArray(t)}function l(t){return h(t)&&0==t.length}function m(t){return h(t)&&t.length>0}function d(t){return h(t)&&t.every(r)}function y(t){return d(t)&&t.length>0}function f(t){return h(t)&&t.every(n)}function p(t){return h(t)&&t.every(i)}function g(t){return h(t)&&t.every(a)}function v(t){return g(t)&&t.length>0}return t.r(e),t.d(e,{isArray:()=>h,isEmptyArray:()=>l,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>f,isNonEmptyArray:()=>m,isNonEmptyNumbersArray:()=>y,isNonEmptyStringsArray:()=>v,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>p,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isNumbersArray:()=>d,isPositiveFiniteNumber:()=>o,isString:()=>a,isStringsArray:()=>g}),e})()},277(t){var e;e=()=>(()=>{var t={854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return""===t}function c(t){return a(t)&&!u(t)}function h(t){return!!a(t)&&0==t.trim().length}function l(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function m(t){try{return JSON.stringify(t),!0}catch{return!1}}function d(t){return!!t}function y(t){return!t}function f(t){return null==t}function p(t){return"object"==typeof t&&null!==t}function g(t){return Array.isArray(t)}function v(t){return g(t)&&0==t.length}function b(t){return g(t)&&t.length>0}function N(t){return g(t)&&t.every(r)}function O(t){return N(t)&&t.length>0}function x(t){return g(t)&&t.every(n)}function T(t){return g(t)&&t.every(i)}function E(t){return g(t)&&t.every(a)}function w(t){return E(t)&&t.length>0}function S(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>g,isEmptyArray:()=>v,isEmptyString:()=>u,isFalsy:()=>y,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>x,isJSON:()=>l,isJSONSerializable:()=>m,isNonEmptyArray:()=>b,isNonEmptyNumbersArray:()=>O,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>w,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>T,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>p,isNullish:()=>f,isNumber:()=>r,isNumbersArray:()=>N,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>S,isString:()=>a,isStringsArray:()=>E,isTruthy:()=>d,isWhitespace:()=>h}),e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Vector:()=>e,isFiniteVectorLike:()=>o,isVectorLike:()=>i});var t=r(854);class e{static matching(t){let r="x"in t?t.x:t.magnitude*Math.cos(t.direction),n="y"in t?t.y:t.magnitude*Math.sin(t.direction);return new e(r,n)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}get magnitude(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}set magnitude(t){let e=this.direction;this.x=t*Math.cos(e),this.y=t*Math.sin(e)}get direction(){return Math.atan2(this.y,this.x)}set direction(t){let e=this.magnitude;this.x=e*Math.cos(t),this.y=e*Math.sin(t)}isFinite(){return(0,t.isFiniteNumber)(this.x)&&(0,t.isFiniteNumber)(this.y)}}function i(e){return!(!(0,t.isNonNullObject)(e)||!((0,t.isNumber)(e.x)&&(0,t.isNumber)(e.y)||(0,t.isNumber)(e.magnitude)&&(0,t.isNumber)(e.direction)))}function o(t){return!!i(t)&&e.matching(t).isFinite()}})(),n})(),t.exports=e()}};const e={};function r(n){const i=e[n];if(void 0!==i)return i.exports;const o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{if(Array.isArray(e))for(var n=0;n<e.length;){var i=e[n++],o=e[n++];r.o(t,i)?0===o&&n++:0===o?Object.defineProperty(t,i,{enumerable:!0,value:e[n++]}):Object.defineProperty(t,i,{enumerable:!0,get:o})}else for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let n={};return(()=>{"use strict";r.r(n),r.d(n,{CurvedBond:()=>K});const t={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let e;const i=new Uint8Array(16),o=[];for(let t=0;t<256;++t)o.push((t+256).toString(16).slice(1));function s(t,r,n){const s=(t=t||{}).random??t.rng?.()??function(){if(!e){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");e=crypto.getRandomValues.bind(crypto)}return e(i)}();if(s.length<16)throw new Error("Random bytes length must be >= 16");if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,r){if((n=n||0)<0||n+16>r.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)r[n+t]=s[t];return r}return function(t,e=0){return(o[t[e+0]]+o[t[e+1]]+o[t[e+2]]+o[t[e+3]]+"-"+o[t[e+4]]+o[t[e+5]]+"-"+o[t[e+6]]+o[t[e+7]]+"-"+o[t[e+8]]+o[t[e+9]]+"-"+o[t[e+10]]+o[t[e+11]]+o[t[e+12]]+o[t[e+13]]+o[t[e+14]]+o[t[e+15]]).toLowerCase()}(s)}const a=" ";function u([t,e],r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function c(...t){for(let e=0;e<t.length;e++)if("number"!=typeof t[e])throw new Error(`assertNumbers arguments[${e}] is not a number. ${typeof t[e]} == typeof ${t[e]}`);return!0}const h=Math.PI;function l(t,e,r){t.lArcFlag=0===t.lArcFlag?0:1,t.sweepFlag=0===t.sweepFlag?0:1;let{rX:n,rY:i}=t;const{x:o,y:s}=t;if(Math.abs(n)<1e-10||Math.abs(i)<1e-10)return t.rX=0,t.rY=0,t.cX=(e+o)/2,t.cY=(r+s)/2,t.phi1=0,void(t.phi2=0);n=Math.abs(t.rX),i=Math.abs(t.rY);const a=t.xRot/180*h,[c,l]=u([(e-o)/2,(r-s)/2],-a),m=Math.pow(c,2)/Math.pow(n,2)+Math.pow(l,2)/Math.pow(i,2);1<m&&(n*=Math.sqrt(m),i*=Math.sqrt(m)),t.rX=n,t.rY=i;const d=Math.pow(n,2)*Math.pow(l,2)+Math.pow(i,2)*Math.pow(c,2),y=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(n,2)*Math.pow(i,2)-d)/d)),f=n*l/i*y,p=-i*c/n*y,g=u([f,p],a);t.cX=g[0]+(e+o)/2,t.cY=g[1]+(r+s)/2,t.phi1=Math.atan2((l-p)/i,(c-f)/n),t.phi2=Math.atan2((-l-p)/i,(-c-f)/n),0===t.sweepFlag&&t.phi2>t.phi1&&(t.phi2-=2*h),1===t.sweepFlag&&t.phi2<t.phi1&&(t.phi2+=2*h),t.phi1*=180/h,t.phi2*=180/h}function m(t,e,r){c(t,e,r);const n=t*t+e*e-r*r;if(0>n)return[];if(0===n)return[[t*r/(t*t+e*e),e*r/(t*t+e*e)]];const i=Math.sqrt(n);return[[(t*r+e*i)/(t*t+e*e),(e*r-t*i)/(t*t+e*e)],[(t*r-e*i)/(t*t+e*e),(e*r+t*i)/(t*t+e*e)]]}const d=Math.PI/180;function y(t,e,r){return(1-r)*t+r*e}function f(t,e,r,n){return t+Math.cos(n/180*h)*e+Math.sin(n/180*h)*r}function p(t,e,r,n){const i=1e-6,o=e-t,s=r-e,a=3*o+3*(n-r)-6*s,u=6*(s-o),c=3*o;return Math.abs(a)<i?Math.abs(u)<i?[]:[-c/u]:function(t,e,r=1e-6){const n=t*t/4-e;if(n<-r)return[];if(n<=r)return[-t/2];const i=Math.sqrt(n);return[-t/2-i,-t/2+i]}(u/a,c/a,i)}function g(t,e,r,n,i){const o=1-i;return t*(o*o*o)+e*(3*o*o*i)+r*(3*o*i*i)+n*(i*i*i)}function v(t,e,r){const n=e[0]-t[0],i=e[1]-t[1],o=r[0]-t[0],s=r[1]-t[1],a=n*s-i*o;if(!(Math.abs(a)<1e-10))return!1;const u=n*o+i*s,c=o*o+s*s;return 0<=u&&u<=c&&n*n+i*i<=c}function b(t){const e=t[t.length-1]?.type===P.CLOSE_PATH,r=e?t.length-2:t.length-1,n=[{type:P.MOVE_TO,relative:!1,x:t[r].x,y:t[r].y}];for(let e=r;e>0;e--){const r=t[e],i=t[e-1];if(r.relative)throw new Error("Relative command are not supported convert first with `toAbs()`");switch(r.type){case P.HORIZ_LINE_TO:n.push({type:P.HORIZ_LINE_TO,relative:!1,x:i.x});break;case P.VERT_LINE_TO:n.push({type:P.VERT_LINE_TO,relative:!1,y:i.y});break;case P.LINE_TO:case P.MOVE_TO:n.push({type:P.LINE_TO,relative:!1,x:i.x,y:i.y});break;case P.CURVE_TO:n.push({type:P.CURVE_TO,relative:!1,x:i.x,y:i.y,x1:r.x2,y1:r.y2,x2:r.x1,y2:r.y1});break;case P.SMOOTH_CURVE_TO:throw new Error("Unsupported command: S (smooth cubic bezier)");case P.SMOOTH_QUAD_TO:throw new Error("Unsupported command: T (smooth quadratic bezier)");case P.ARC:throw new Error("Unsupported command: A (arc)");case P.QUAD_TO:throw new Error("Unsupported command: Q (quadratic bezier)")}}return e&&n.push({type:P.CLOSE_PATH}),n}function N(){return T((t,e,r)=>(t.relative&&(void 0!==t.x1&&(t.x1+=e),void 0!==t.y1&&(t.y1+=r),void 0!==t.x2&&(t.x2+=e),void 0!==t.y2&&(t.y2+=r),void 0!==t.x&&(t.x+=e),void 0!==t.y&&(t.y+=r),t.relative=!1),t))}function O(){let t=NaN,e=NaN,r=NaN,n=NaN;return T((i,o,s)=>(i.type&P.SMOOTH_CURVE_TO&&(i.type=P.CURVE_TO,t=isNaN(t)?o:t,e=isNaN(e)?s:e,i.x1=i.relative?o-t:2*o-t,i.y1=i.relative?s-e:2*s-e),i.type&P.CURVE_TO?(t=i.relative?o+i.x2:i.x2,e=i.relative?s+i.y2:i.y2):(t=NaN,e=NaN),i.type&P.SMOOTH_QUAD_TO&&(i.type=P.QUAD_TO,r=isNaN(r)?o:r,n=isNaN(n)?s:n,i.x1=i.relative?o-r:2*o-r,i.y1=i.relative?s-n:2*s-n),i.type&P.QUAD_TO?(r=i.relative?o+i.x1:i.x1,n=i.relative?s+i.y1:i.y1):(r=NaN,n=NaN),i))}function x(){let t=NaN,e=NaN;return T((r,n,i)=>{if(r.type&P.SMOOTH_QUAD_TO&&(r.type=P.QUAD_TO,t=isNaN(t)?n:t,e=isNaN(e)?i:e,r.x1=r.relative?n-t:2*n-t,r.y1=r.relative?i-e:2*i-e),r.type&P.QUAD_TO){t=r.relative?n+r.x1:r.x1,e=r.relative?i+r.y1:r.y1;const o=r.x1,s=r.y1;r.type=P.CURVE_TO,r.x1=((r.relative?0:n)+2*o)/3,r.y1=((r.relative?0:i)+2*s)/3,r.x2=(r.x+2*o)/3,r.y2=(r.y+2*s)/3}else t=NaN,e=NaN;return r})}function T(t){let e=0,r=0,n=NaN,i=NaN;return function(o){if(isNaN(n)&&!(o.type&P.MOVE_TO))throw new Error("path must start with moveto");const s=t(o,e,r,n,i);return o.type&P.CLOSE_PATH&&(e=n,r=i),"x"in o&&void 0!==o.x&&(e=o.relative?e+o.x:o.x),"y"in o&&void 0!==o.y&&(r=o.relative?r+o.y:o.y),o.type&P.MOVE_TO&&(n=e,i=r),s}}function E(t,e,r,n,i,o){return c(t,e,r,n,i,o),T((s,a,u,c)=>{const h=s.x1,l=s.x2,m=s.relative&&!isNaN(c),d=void 0!==s.x?s.x:m?0:a,y=void 0!==s.y?s.y:m?0:u;function f(t){return t*t}s.type&P.HORIZ_LINE_TO&&0!==e&&(s.type=P.LINE_TO,s.y=s.relative?0:u),s.type&P.VERT_LINE_TO&&0!==r&&(s.type=P.LINE_TO,s.x=s.relative?0:a),void 0!==s.x&&(s.x=s.x*t+y*r+(m?0:i)),void 0!==s.y&&(s.y=d*e+s.y*n+(m?0:o)),void 0!==s.x1&&(s.x1=s.x1*t+s.y1*r+(m?0:i)),void 0!==s.y1&&(s.y1=h*e+s.y1*n+(m?0:o)),void 0!==s.x2&&(s.x2=s.x2*t+s.y2*r+(m?0:i)),void 0!==s.y2&&(s.y2=l*e+s.y2*n+(m?0:o));const p=t*n-e*r;if(void 0!==s.xRot&&(1!==t||0!==e||0!==r||1!==n))if(0===p)delete s.rX,delete s.rY,delete s.xRot,delete s.lArcFlag,delete s.sweepFlag,s.type=P.LINE_TO;else{const i=s.xRot*Math.PI/180,o=Math.sin(i),a=Math.cos(i),u=1/f(s.rX),c=1/f(s.rY),h=f(a)*u+f(o)*c,l=2*o*a*(u-c),m=f(o)*u+f(a)*c,d=h*n*n-l*e*n+m*e*e,y=l*(t*n+e*r)-2*(h*r*n+m*t*e),g=h*r*r-l*t*r+m*t*t,v=(Math.atan2(y,d-g)+Math.PI)%Math.PI/2,b=Math.sin(v),N=Math.cos(v);s.rX=Math.abs(p)/Math.sqrt(d*f(N)+y*b*N+g*f(b)),s.rY=Math.abs(p)/Math.sqrt(d*f(b)-y*b*N+g*f(N)),s.xRot=180*v/Math.PI}return void 0!==s.sweepFlag&&0>p&&(s.sweepFlag=+!s.sweepFlag),s})}const w={ROUND:function(t=1e13){function e(e){return Math.round(e*t)/t}return c(t),function(t){return"x1"in t&&void 0!==t.x1&&(t.x1=e(t.x1)),"y1"in t&&void 0!==t.y1&&(t.y1=e(t.y1)),"x2"in t&&void 0!==t.x2&&(t.x2=e(t.x2)),"y2"in t&&void 0!==t.y2&&(t.y2=e(t.y2)),"x"in t&&void 0!==t.x&&(t.x=e(t.x)),"y"in t&&void 0!==t.y&&(t.y=e(t.y)),"rX"in t&&void 0!==t.rX&&(t.rX=e(t.rX)),"rY"in t&&void 0!==t.rY&&(t.rY=e(t.rY)),t}},TO_ABS:N,TO_REL:function(){return T((t,e,r)=>(t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=r),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=r),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=r),t.relative=!0),t))},NORMALIZE_HVZ:function(t=!0,e=!0,r=!0,n=!0){return T((i,o,s,a,u)=>{if(isNaN(a)&&!(i.type&P.MOVE_TO))throw new Error("path must start with moveto");if(e&&i.type&P.HORIZ_LINE_TO&&(i.type=P.LINE_TO,i.y=i.relative?0:s),r&&i.type&P.VERT_LINE_TO&&(i.type=P.LINE_TO,i.x=i.relative?0:o),t&&i.type&P.CLOSE_PATH&&(i.type=P.LINE_TO,i.x=i.relative?a-o:a,i.y=i.relative?u-s:u),i.type&P.ARC&&(0===i.rX||0===i.rY)&&(i.type=P.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),n&&i.type&P.QUAD_TO&&v([o,s],i.relative?[o+i.x1,s+i.y1]:[i.x1,i.y1],i.relative?[o+i.x,s+i.y]:[i.x,i.y])&&(i.type=P.LINE_TO,delete i.x1,delete i.y1),n&&i.type&P.CURVE_TO){const t=[o,s],e=i.relative?[o+i.x1,s+i.y1]:[i.x1,i.y1],r=i.relative?[o+i.x2,s+i.y2]:[i.x2,i.y2],n=i.relative?[o+i.x,s+i.y]:[i.x,i.y];v(t,e,n)&&v(t,r,n)&&(i.type=P.LINE_TO,delete i.x1,delete i.y1,delete i.x2,delete i.y2)}return i})},NORMALIZE_ST:O,QT_TO_C:x,INFO:T,SANITIZE:function(t=0){c(t);let e=NaN,r=NaN,n=NaN,i=NaN;return T((o,s,a,u,c)=>{const h=Math.abs;let l=!1,m=0,d=0;if(o.type&P.SMOOTH_CURVE_TO&&(m=isNaN(e)?0:s-e,d=isNaN(r)?0:a-r),o.type&(P.CURVE_TO|P.SMOOTH_CURVE_TO)?(e=o.relative?s+o.x2:o.x2,r=o.relative?a+o.y2:o.y2):(e=NaN,r=NaN),o.type&P.SMOOTH_QUAD_TO?(n=isNaN(n)?s:2*s-n,i=isNaN(i)?a:2*a-i):o.type&P.QUAD_TO?(n=o.relative?s+o.x1:o.x1,i=o.relative?a+o.y1:o.y2):(n=NaN,i=NaN),o.type&P.LINE_COMMANDS||o.type&P.ARC&&(0===o.rX||0===o.rY||!o.lArcFlag)||o.type&P.CURVE_TO||o.type&P.SMOOTH_CURVE_TO||o.type&P.QUAD_TO||o.type&P.SMOOTH_QUAD_TO){const e=void 0===o.x?0:o.relative?o.x:o.x-s,r=void 0===o.y?0:o.relative?o.y:o.y-a;m=isNaN(n)?void 0===o.x1?m:o.relative?o.x:o.x1-s:n-s,d=isNaN(i)?void 0===o.y1?d:o.relative?o.y:o.y1-a:i-a;const u=void 0===o.x2?0:o.relative?o.x:o.x2-s,c=void 0===o.y2?0:o.relative?o.y:o.y2-a;h(e)<=t&&h(r)<=t&&h(m)<=t&&h(d)<=t&&h(u)<=t&&h(c)<=t&&(l=!0)}return o.type&P.CLOSE_PATH&&h(s-u)<=t&&h(a-c)<=t&&(l=!0),l?[]:o})},MATRIX:E,ROTATE:function(t,e=0,r=0){c(t,e,r);const n=Math.sin(t),i=Math.cos(t);return E(i,n,-n,i,e-e*i+r*n,r-e*n-r*i)},TRANSLATE:function(t,e=0){return c(t,e),E(1,0,0,1,t,e)},SCALE:function(t,e=t){return c(t,e),E(t,0,0,e,0,0)},SKEW_X:function(t){return c(t),E(1,0,Math.tan(t),1,0,0)},SKEW_Y:function(t){return c(t),E(1,Math.tan(t),0,1,0,0)},X_AXIS_SYMMETRY:function(t=0){return c(t),E(-1,0,0,1,t,0)},Y_AXIS_SYMMETRY:function(t=0){return c(t),E(1,0,0,-1,0,t)},A_TO_C:function(){return T((t,e,r)=>P.ARC===t.type?function(t,e,r){t.cX||l(t,e,r);const n=t.xRot/180*h;if(Math.abs(t.rX)<1e-10||Math.abs(t.rY)<1e-10)return[{relative:t.relative,type:P.CURVE_TO,x1:e+(t.x-e)/3,y1:r+(t.y-r)/3,x2:e+2*(t.x-e)/3,y2:r+2*(t.y-r)/3,x:t.x,y:t.y}];const i=Math.min(t.phi1,t.phi2),o=Math.max(t.phi1,t.phi2)-i,s=Math.ceil(o/90),a=new Array(s);let c=e,m=r;const f=(e,r)=>{const[i,o]=u([e*t.rX,r*t.rY],n);return[t.cX+i,t.cY+o]};for(let e=0;e<s;e++){const r=y(t.phi1,t.phi2,e/s),n=y(t.phi1,t.phi2,(e+1)/s),i=n-r,o=4/3*Math.tan(i*d/4),u=Math.cos(r*d)-o*Math.sin(r*d),h=Math.sin(r*d)+o*Math.cos(r*d),l=Math.cos(n*d),p=Math.sin(n*d),g=l+o*p,v=p-o*l,b=f(u,h),N=f(g,v),O=f(l,p),x={relative:t.relative,type:P.CURVE_TO,x:O[0],y:O[1],x1:b[0],y1:b[1],x2:N[0],y2:N[1]};t.relative&&(x.x1-=c,x.y1-=m,x.x2-=c,x.y2-=m,x.x-=c,x.y-=m),c=O[0],m=O[1],a[e]=x}return a}(t,t.relative?0:e,t.relative?0:r):t)},ANNOTATE_ARCS:function(){return T((t,e,r)=>(t.relative&&(e=0,r=0),P.ARC===t.type&&l(t,e,r),t))},CLONE:function(){return t=>({...t})},CALCULATE_BOUNDS:function(){const t=N(),e=x(),r=O(),n=T((i,o,s)=>{const a=r(e(t((t=>({...t}))(i))));function u(t){t>n.maxX&&(n.maxX=t),t<n.minX&&(n.minX=t)}function c(t){t>n.maxY&&(n.maxY=t),t<n.minY&&(n.minY=t)}if(a.type&P.DRAWING_COMMANDS&&(u(o),c(s)),a.type&P.HORIZ_LINE_TO&&u(a.x),a.type&P.VERT_LINE_TO&&c(a.y),a.type&P.LINE_TO&&(u(a.x),c(a.y)),a.type&P.CURVE_TO){u(a.x),c(a.y);const t=p(o,a.x1,a.x2,a.x);for(const e of t)0<e&&1>e&&u(g(o,a.x1,a.x2,a.x,e));const e=p(s,a.y1,a.y2,a.y);for(const t of e)0<t&&1>t&&c(g(s,a.y1,a.y2,a.y,t))}if(a.type&P.ARC){u(a.x),c(a.y),l(a,o,s);const t=a.xRot/180*Math.PI,e=Math.cos(t)*a.rX,r=Math.sin(t)*a.rX,n=-Math.sin(t)*a.rY,i=Math.cos(t)*a.rY,[h,d]=a.phi1<a.phi2?[a.phi1,a.phi2]:-180>a.phi2?[a.phi2+360,a.phi1+360]:[a.phi2,a.phi1],y=([t,e])=>{const r=180*Math.atan2(e,t)/Math.PI;return r<h?r+360:r},p=m(n,-e,0).map(y);for(const t of p)t>h&&t<d&&u(f(a.cX,e,n,t));const g=m(i,-r,0).map(y);for(const t of g)t>h&&t<d&&c(f(a.cY,r,i,t))}return i});return n.minX=1/0,n.maxX=-1/0,n.minY=1/0,n.maxY=-1/0,n},REVERSE_PATH:function(t,e=!0){if(t.length<2)return t;const r=w.INFO((t,e,r)=>({...t,x:t.x??e,y:t.y??r,relative:t.relative??!1})),n=[];let i=[];for(const o of t){const t=r(o);t.type===P.MOVE_TO&&i.length>0&&(e?n.push(...b(i)):n.unshift(...b(i)),i=[]),i.push(t)}return i.length>0&&(e?n.push(...b(i)):n.unshift(...b(i))),n},REMOVE_COLLINEAR:function(t){if(t.length<=2)return t;const e=[],r=t.map(w.INFO((t,e,r)=>{const n="relative"in t&&t.relative;return["x"in t?t.x+(n?e:0):e,"y"in t?t.y+(n?r:0):r]}));let n=r[0];e.push(t[0]);for(let i=1;i<t.length;i++){const o=t[i],s=t[i+1];if(i<t.length-1&&s&&o.type&P.LINE_COMMANDS&&s.type&P.LINE_COMMANDS){const t=r[i+1];if(v(n,r[i],t)){"relative"in s&&s.relative&&("x"in s&&(s.x=t[0]-n[0]),"y"in s&&(s.y=t[1]-n[1]));continue}}e.push(o),n=r[i]}return e}};class S{round(t){return this.transform(w.ROUND(t))}toAbs(){return this.transform(w.TO_ABS())}toRel(){return this.transform(w.TO_REL())}normalizeHVZ(t,e,r){return this.transform(w.NORMALIZE_HVZ(t,e,r))}normalizeST(){return this.transform(w.NORMALIZE_ST())}qtToC(){return this.transform(w.QT_TO_C())}aToC(){return this.transform(w.A_TO_C())}sanitize(t){return this.transform(w.SANITIZE(t))}translate(t,e){return this.transform(w.TRANSLATE(t,e))}scale(t,e){return this.transform(w.SCALE(t,e))}rotate(t,e,r){return this.transform(w.ROTATE(t,e,r))}matrix(t,e,r,n,i,o){return this.transform(w.MATRIX(t,e,r,n,i,o))}skewX(t){return this.transform(w.SKEW_X(t))}skewY(t){return this.transform(w.SKEW_Y(t))}xSymmetry(t){return this.transform(w.X_AXIS_SYMMETRY(t))}ySymmetry(t){return this.transform(w.Y_AXIS_SYMMETRY(t))}annotateArcs(){return this.transform(w.ANNOTATE_ARCS())}}const _=t=>" "===t||"\t"===t||"\r"===t||"\n"===t,A=t=>"0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0);class M extends S{curNumber="";curCommandType=-1;curCommandRelative=!1;canParseCommandOrComma=!0;curNumberHasExp=!1;curNumberHasExpDigits=!1;curNumberHasDecimal=!1;curArgs=[];finish(t=[]){if(this.parse(" ",t),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t}parse(t,e=[]){const r=t=>{e.push(t),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let n=0;n<t.length;n++){const i=t[n],o=!(this.curCommandType!==P.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),s=A(i)&&("0"===this.curNumber&&"0"===i||o);if(!A(i)||s)if("e"!==i&&"E"!==i)if("-"!==i&&"+"!==i||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==i||this.curNumberHasExp||this.curNumberHasDecimal||o){if(this.curNumber&&-1!==this.curCommandType){const t=Number(this.curNumber);if(isNaN(t))throw new SyntaxError(`Invalid number ending at ${n}`);if(this.curCommandType===P.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>t)throw new SyntaxError(`Expected positive number, got "${t}" at index "${n}"`)}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError(`Expected a flag, got "${this.curNumber}" at index "${n}"`);this.curArgs.push(t),this.curArgs.length===C[this.curCommandType]&&(P.HORIZ_LINE_TO===this.curCommandType?r({type:P.HORIZ_LINE_TO,relative:this.curCommandRelative,x:t}):P.VERT_LINE_TO===this.curCommandType?r({type:P.VERT_LINE_TO,relative:this.curCommandRelative,y:t}):this.curCommandType===P.MOVE_TO||this.curCommandType===P.LINE_TO||this.curCommandType===P.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),P.MOVE_TO===this.curCommandType&&(this.curCommandType=P.LINE_TO)):this.curCommandType===P.CURVE_TO?r({type:P.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===P.SMOOTH_CURVE_TO?r({type:P.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===P.QUAD_TO?r({type:P.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===P.ARC&&r({type:P.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!_(i))if(","===i&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==i&&"-"!==i&&"."!==i)if(s)this.curNumber=i,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError(`Unterminated command at index ${n}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${i}" at index ${n}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,"z"!==i&&"Z"!==i)if("h"===i||"H"===i)this.curCommandType=P.HORIZ_LINE_TO,this.curCommandRelative="h"===i;else if("v"===i||"V"===i)this.curCommandType=P.VERT_LINE_TO,this.curCommandRelative="v"===i;else if("m"===i||"M"===i)this.curCommandType=P.MOVE_TO,this.curCommandRelative="m"===i;else if("l"===i||"L"===i)this.curCommandType=P.LINE_TO,this.curCommandRelative="l"===i;else if("c"===i||"C"===i)this.curCommandType=P.CURVE_TO,this.curCommandRelative="c"===i;else if("s"===i||"S"===i)this.curCommandType=P.SMOOTH_CURVE_TO,this.curCommandRelative="s"===i;else if("q"===i||"Q"===i)this.curCommandType=P.QUAD_TO,this.curCommandRelative="q"===i;else if("t"===i||"T"===i)this.curCommandType=P.SMOOTH_QUAD_TO,this.curCommandRelative="t"===i;else{if("a"!==i&&"A"!==i)throw new SyntaxError(`Unexpected character "${i}" at index ${n}.`);this.curCommandType=P.ARC,this.curCommandRelative="a"===i}else e.push({type:P.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=i,this.curNumberHasDecimal="."===i}else this.curNumber+=i,this.curNumberHasDecimal=!0;else this.curNumber+=i;else this.curNumber+=i,this.curNumberHasExp=!0;else this.curNumber+=i,this.curNumberHasExpDigits=this.curNumberHasExp}return e}transform(t){return Object.create(this,{parse:{value(e,r=[]){const n=Object.getPrototypeOf(this).parse.call(this,e);for(const e of n){const n=t(e);Array.isArray(n)?r.push(...n):r.push(n)}return r}}})}}class P extends S{commands;constructor(t){super(),this.commands="string"==typeof t?P.parse(t):t}encode(){return P.encode(this.commands)}getBounds(){const t=w.CALCULATE_BOUNDS();return this.transform(t),t}transform(t){const e=[];for(const r of this.commands){const n=t(r);Array.isArray(n)?e.push(...n):e.push(n)}return this.commands=e,this}reverse(t=!0){return this.commands=w.REVERSE_PATH(this.commands,t),this}removeCollinear(){return this.commands=w.REMOVE_COLLINEAR(this.commands),this}static encode(t){return function(t){let e="";Array.isArray(t)||(t=[t]);for(let r=0;r<t.length;r++){const n=t[r];if(n.type===P.CLOSE_PATH)e+="z";else if(n.type===P.HORIZ_LINE_TO)e+=(n.relative?"h":"H")+n.x;else if(n.type===P.VERT_LINE_TO)e+=(n.relative?"v":"V")+n.y;else if(n.type===P.MOVE_TO)e+=(n.relative?"m":"M")+n.x+a+n.y;else if(n.type===P.LINE_TO)e+=(n.relative?"l":"L")+n.x+a+n.y;else if(n.type===P.CURVE_TO)e+=(n.relative?"c":"C")+n.x1+a+n.y1+a+n.x2+a+n.y2+a+n.x+a+n.y;else if(n.type===P.SMOOTH_CURVE_TO)e+=(n.relative?"s":"S")+n.x2+a+n.y2+a+n.x+a+n.y;else if(n.type===P.QUAD_TO)e+=(n.relative?"q":"Q")+n.x1+a+n.y1+a+n.x+a+n.y;else if(n.type===P.SMOOTH_QUAD_TO)e+=(n.relative?"t":"T")+n.x+a+n.y;else{if(n.type!==P.ARC)throw new Error(`Unexpected command type "${n?.type}" at index ${r}.`);e+=(n.relative?"a":"A")+n.rX+a+n.rY+a+n.xRot+a+ +n.lArcFlag+a+ +n.sweepFlag+a+n.x+a+n.y}}return e}(t)}static parse(t){const e=new M,r=[];return e.parse(t,r),e.finish(r),r}static CLOSE_PATH=1;static MOVE_TO=2;static HORIZ_LINE_TO=4;static VERT_LINE_TO=8;static LINE_TO=16;static CURVE_TO=32;static SMOOTH_CURVE_TO=64;static QUAD_TO=128;static SMOOTH_QUAD_TO=256;static ARC=512;static LINE_COMMANDS=P.LINE_TO|P.HORIZ_LINE_TO|P.VERT_LINE_TO;static DRAWING_COMMANDS=P.HORIZ_LINE_TO|P.VERT_LINE_TO|P.LINE_TO|P.CURVE_TO|P.SMOOTH_CURVE_TO|P.QUAD_TO|P.SMOOTH_QUAD_TO|P.ARC}const C={[P.MOVE_TO]:2,[P.LINE_TO]:2,[P.HORIZ_LINE_TO]:1,[P.VERT_LINE_TO]:1,[P.CLOSE_PATH]:0,[P.QUAD_TO]:4,[P.SMOOTH_QUAD_TO]:2,[P.CURVE_TO]:6,[P.SMOOTH_CURVE_TO]:4,[P.ARC]:7};var R=r(456);class L{static matching(t){if(t.type!==P.MOVE_TO)throw new Error('SVG path definition command is not of type "M".');if(t.relative)throw new Error("The input SVG path definition command is a relative command.");let e=new R.FinitePoint(t.x,t.y);return new L(e)}constructor(t){this.startPoint=t}get endPoint(){return this.startPoint}toString(){return`M ${this.startPoint.x} ${this.startPoint.y}`}}class I{static matching(t){if(t.type!==P.LINE_TO&&t.type!==P.QUAD_TO&&t.type!==P.CURVE_TO)throw new Error('Trailing segments can only be created for "L", "Q" and "C" SVG path definition commands.');if(t.relative)throw new Error("The input SVG path definition command is a relative command.");var e=[];t.type!==P.QUAD_TO&&t.type!==P.CURVE_TO||e.push(new R.FinitePoint(t.x1,t.y1)),t.type===P.CURVE_TO&&e.push(new R.FinitePoint(t.x2,t.y2));var r=new R.FinitePoint(t.x,t.y);return new I(e,r)}constructor(t,e){this.controlPoints=t,this.endPoint=e}toString(){if(this.controlPoints.length>2)throw new Error(`There can only be at most 2 control points: ${this.controlPoints.length} control points.`);return(0==this.controlPoints.length?"L":1==this.controlPoints.length?"Q":"C")+" "+this.controlPoints.map(t=>`${t.x} ${t.y}`).join(" ")+" "+`${this.endPoint.x} ${this.endPoint.y}`}}var U,j=r(725),V=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class F{constructor(t){U.set(this,void 0),function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(t,r):i?i.value=r:e.set(t,r)}(this,U,t,"f")}closest(t){if(0==V(this,U,"f").length)throw new Error("This points collection is empty.");let e=[...V(this,U,"f")];return e.sort((e,r)=>(0,j.distance)(e,t)-(0,j.distance)(r,t)),e[0]}}U=new WeakMap;var H=r(106),D=r(854);class Y{static matching(t){let e=k.create();if(!(0,D.isString)(t))return e;try{let e=new P(t);e=e.toAbs();let r=L.matching(e.commands[0]),n=[I.matching(e.commands[1]),...e.commands.slice(2).map(t=>I.matching(t))];return new Y(r,n)}catch{return e}}constructor(t,e){this.moveToSegment=t,this.trailingSegments=e}get segments(){return[this.moveToSegment,this.trailingSegments[0],...this.trailingSegments.slice(1)]}get definingPoints(){return[this.startPoint,...this.trailingSegments.flatMap(t=>[...t.controlPoints,t.endPoint])]}get startPoint(){return this.moveToSegment.startPoint}get interveningPoints(){return[...this.trailingSegments.slice(0,-1).flatMap(t=>[...t.controlPoints,t.endPoint]),...(0,H.last)(this.trailingSegments).controlPoints]}get controlPoints(){return this.trailingSegments.flatMap(t=>t.controlPoints)}get endPoint(){if(0==this.trailingSegments.length)throw new Error("This SVG path definition has no trailing segments.");return(0,H.last)(this.trailingSegments).endPoint}toString(){return this.segments.map(t=>t.toString()).join(" ")}drag(t,e,r){let n=new F(this.definingPoints).closest(r.dragPoint);this.controlPoints.includes(n)&&(t*=2,e*=2),n.displace({x:t,y:e})}}const k={create:()=>{let t=new P("M 0 0 Q 0 0 0 0");if(t.commands.length<2)throw new Error("Unable to create default SVG path definition.");let e=L.matching(t.commands[0]),r=[I.matching(t.commands[1])];return new Y(e,r)}};var X=r(277);class Q{static from(t){let e,r=new Q(0,0);if(!(0,D.isString)(t))return r;try{e=JSON.parse(t)}catch{return r}return(0,X.isVectorLike)(e)?Q.matching(e):r}static matching(t){let e=X.Vector.matching(t);return new Q(e.magnitude,e.direction)}constructor(t,e){this.magnitude=t,this.direction=e}toJSON(){return JSON.stringify({magnitude:this.magnitude,direction:this.direction})}}var W,$,z,J,Z,G,q,B=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class K{static between(e,r){let n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.id="id-"+(!t.randomUUID||o||i?s(i,o,a):t.randomUUID()),n.setAttribute("stroke","black"),n.setAttribute("stroke-width","1.5"),n.setAttribute("stroke-opacity","1"),n.setAttribute("stroke-dasharray",""),n.setAttribute("stroke-linecap",""),n.setAttribute("stroke-linejoin",""),n.setAttribute("fill","none"),new K(n,e,r);var i,o,a}constructor(t,e,r){W.add(this),this.domNode=t,this.base1=e,this.base2=r,t.dataset.basePadding1||t.dataset.basePadding2||B(this,W,"m",z).call(this),e.addEventListener("change",()=>B(this,W,"m",$).call(this)),r.addEventListener("change",()=>B(this,W,"m",$).call(this))}get id(){return this.domNode.id}get basePadding1(){let t=()=>Q.from(this.domNode.dataset.basePadding1),e=(t,e)=>{let r=new Q(t,e);this.domNode.dataset.basePadding1=r.toJSON(),B(this,W,"m",$).call(this)},r=()=>t().magnitude,n=()=>t().direction;return{get magnitude(){return r()},set magnitude(t){(t=>{e(t,n())})(t)},get direction(){return n()},set direction(t){(t=>{e(r(),t)})(t)}}}get basePadding2(){let t=()=>Q.from(this.domNode.dataset.basePadding2),e=(t,e)=>{let r=new Q(t,e);this.domNode.dataset.basePadding2=r.toJSON(),B(this,W,"m",$).call(this)},r=()=>t().magnitude,n=()=>t().direction;return{get magnitude(){return r()},set magnitude(t){(t=>{e(t,n())})(t)},get direction(){return n()},set direction(t){(t=>{e(r(),t)})(t)}}}}W=new WeakSet,$=function(){let t=Q.from(this.domNode.dataset.basePadding1),e=Q.from(this.domNode.dataset.basePadding2);t=B(this,W,"m",J).call(this,t),e=B(this,W,"m",Z).call(this,e);let r=Y.matching(this.domNode.getAttribute("d")),n=(0,R.midpoint)(r.startPoint,r.endPoint),i=r.interveningPoints.map(t=>[R.Point.matching(t),n.displacementTo(t)]);i.forEach(([t,e])=>e.direction-=(0,j.direction)(r.startPoint,r.endPoint)),r.startPoint.set(R.Point.matching(this.base1.centerPoint).displaced(t)),r.endPoint.set(R.Point.matching(this.base2.centerPoint).displaced(e)),n=(0,R.midpoint)(r.startPoint,r.endPoint),i.forEach(([t,e])=>e.direction+=(0,j.direction)(r.startPoint,r.endPoint)),i.forEach(([t,e])=>t.set(n.displaced(e))),this.domNode.setAttribute("d",r.toString())},z=function(){let t=Y.matching(this.domNode.getAttribute("d")),e=Q.matching(R.Point.matching(this.base1.centerPoint).displacementTo(t.startPoint)),r=Q.matching(R.Point.matching(this.base2.centerPoint).displacementTo(t.endPoint));e=B(this,W,"m",G).call(this,e),r=B(this,W,"m",q).call(this,r),this.domNode.dataset.basePadding1=e.toJSON(),this.domNode.dataset.basePadding2=r.toJSON()},J=function(t){let e=Q.matching(t);return e.direction+=(0,j.direction)(this.base1.centerPoint,this.base2.centerPoint),e},Z=function(t){let e=Q.matching(t);return e.direction+=(0,j.direction)(this.base2.centerPoint,this.base1.centerPoint),e},G=function(t){let e=Q.matching(t);return e.direction-=(0,j.direction)(this.base1.centerPoint,this.base2.centerPoint),e},q=function(t){let e=Q.matching(t);return e.direction-=(0,j.direction)(this.base2.centerPoint,this.base1.centerPoint),e}})(),n})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["draw.bonds.curved"]=e():t["draw.bonds.curved"]=e()}(this,()=>(()=>{var t={456(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){var e=0;return t.forEach(function(t){return e+=t}),e}function n(t){return r(t)/t.length}function i(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>m,average:()=>n,clamp:()=>d,degrees:()=>g,flipAway:()=>N,isBetween:()=>h,isBetweenExclusive:()=>l,isBetweenInclusive:()=>h,max:()=>c,mean:()=>n,median:()=>a,min:()=>u,normalizeAngle:()=>b,radians:()=>v,round:()=>p,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>y,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>f,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return i(e),e}function a(t){if(0==t.length)return NaN;var e=s(t);if(e.length%2!=0)return e[Math.floor(e.length/2)];var r=e.length/2,i=r-1;return n([e[r],e[i]])}function u(t){if(0==t.length)return 1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.min(e,t)}),e}function c(t){if(0==t.length)return-1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.max(e,t)}),e}function h(t,e,r){return t>=e&&t<=r}function l(t,e,r){return t>e&&t<r}function d(t,e,r){return t<e?e:t>r?r:t}function m(t,e,r){return Math.abs(t-e)<=r}function y(t){i(t),t.reverse()}function f(t){var e=s(t);return e.reverse(),e}function p(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function g(t){return t*(180/Math.PI)}function v(t){return t*(Math.PI/180)}function b(t,e){void 0===e&&(e=-Math.PI);var r=t-e;return e+((r%=2*Math.PI)>=0?r:r+2*Math.PI)}function N(t,e){var r=(e=b(e,t))-t;return(r<Math.PI/2||r>3*Math.PI/2)&&(t+=Math.PI),t}return e})()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return""===t}function c(t){return a(t)&&!u(t)}function h(t){return!!a(t)&&0==t.trim().length}function l(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function d(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function y(t){return!t}function f(t){return null==t}function p(t){return"object"==typeof t&&null!==t}function g(t){return Array.isArray(t)}function v(t){return g(t)&&0==t.length}function b(t){return g(t)&&t.length>0}function N(t){return g(t)&&t.every(r)}function O(t){return N(t)&&t.length>0}function x(t){return g(t)&&t.every(n)}function T(t){return g(t)&&t.every(i)}function E(t){return g(t)&&t.every(a)}function w(t){return E(t)&&t.length>0}function S(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>g,isEmptyArray:()=>v,isEmptyString:()=>u,isFalsy:()=>y,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>x,isJSON:()=>l,isJSONSerializable:()=>d,isNonEmptyArray:()=>b,isNonEmptyNumbersArray:()=>O,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>w,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>T,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>p,isNullish:()=>f,isNumber:()=>r,isNumbersArray:()=>N,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>S,isString:()=>a,isStringsArray:()=>E,isTruthy:()=>m,isWhitespace:()=>h}),e})()},277(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Vector:()=>r});class r{static matching(t){let e="x"in t?t.x:t.magnitude*Math.cos(t.direction),n="y"in t?t.y:t.magnitude*Math.sin(t.direction);return new r(e,n)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}get magnitude(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}set magnitude(t){let e=this.direction;this.x=t*Math.cos(e),this.y=t*Math.sin(e)}get direction(){return Math.atan2(this.y,this.x)}set direction(t){let e=this.magnitude;this.x=e*Math.cos(t),this.y=e*Math.sin(t)}}return e})(),t.exports=e()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{FinitePoint:()=>o,Point:()=>i,RelativePoint:()=>d,midpoint:()=>y});var t=r(277),e=r(854);class i{static matching(t){return new i(t.x,t.y)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}set(t){(0,e.isNumber)(null==t?void 0:t.x)&&(this.x=t.x),(0,e.isNumber)(null==t?void 0:t.y)&&(this.y=t.y)}displace(e){let r=t.Vector.matching(e);this.x+=r.x,this.y+=r.y}displaced(t){let e=i.matching(this);return e.displace(t),e}displacementTo(e){return new t.Vector(e.x-this.x,e.y-this.y)}displacementFrom(e){return new t.Vector(this.x-e.x,this.y-e.y)}distanceTo(t){return this.displacementTo(t).magnitude}distanceFrom(t){return this.distanceTo(t)}directionTo(t){return this.displacementTo(t).direction}directionFrom(t){return this.displacementFrom(t).direction}}class o extends i{static matching(t){let e=i.matching(t);return new o(e.x,e.y)}constructor(t,r){if(super(t,r),!(0,e.isFiniteNumber)(t)||!(0,e.isFiniteNumber)(r))throw new Error(`Finite points must have finite number coordinates: (${t}, ${r}).`)}set(...t){let e=new i(0,0);e.set(...t),o.matching(e),super.set(...t)}}var s,a,u,c,h,l=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class d{constructor(e){s.add(this),a.set(this,void 0),u.set(this,new t.Vector(0,0)),c.set(this,{move:[]}),function(t,e,r){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,r)}(this,a,e),e.addEventListener("move",()=>l(this,s,"m",h).call(this,"move"))}get x(){return l(this,a,"f").x+l(this,u,"f").x}set x(t){l(this,u,"f").x=t-l(this,a,"f").x,l(this,s,"m",h).call(this,"move")}get y(){return l(this,a,"f").y+l(this,u,"f").y}set y(t){l(this,u,"f").y=t-l(this,a,"f").y,l(this,s,"m",h).call(this,"move")}addEventListener(t,e){l(this,c,"f")[t].push(e)}removeEventListener(t,e){l(this,c,"f")[t]=l(this,c,"f")[t].filter(t=>t!==e)}}a=new WeakMap,u=new WeakMap,c=new WeakMap,s=new WeakSet,h=function(t){l(this,c,"f")[t].forEach(t=>t())};var m=r(986);function y(t,e){return new i((0,m.average)([t.x,e.x]),(0,m.average)([t.y,e.y]))}})(),n})(),t.exports=e()},725(t){t.exports=(()=>{var t={986:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){var e=0;return t.forEach(function(t){return e+=t}),e}function n(t){return r(t)/t.length}function i(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>d,average:()=>n,degrees:()=>f,isBetweenExclusive:()=>l,isBetweenInclusive:()=>h,max:()=>c,mean:()=>n,median:()=>a,min:()=>u,radians:()=>p,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>m,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>y,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return i(e),e}function a(t){if(0==t.length)return NaN;var e=s(t);if(e.length%2!=0)return e[Math.floor(e.length/2)];var r=e.length/2,i=r-1;return n([e[r],e[i]])}function u(t){if(0==t.length)return 1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.min(e,t)}),e}function c(t){if(0==t.length)return-1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.max(e,t)}),e}function h(t,e,r){return t>=e&&t<=r}function l(t,e,r){return t>e&&t<r}function d(t,e,r){return Math.abs(t-e)<=r}function m(t){i(t),t.reverse()}function y(t){var e=s(t);return e.reverse(),e}function f(t){return t*(180/Math.PI)}function p(t){return t*(Math.PI/180)}return e})()},854:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return null==t}function c(t){return"object"==typeof t&&null!==t}function h(t){return Array.isArray(t)}return t.r(e),t.d(e,{isArray:()=>h,isFiniteNumber:()=>n,isNonFiniteNumber:()=>i,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isPositiveFiniteNumber:()=>o,isString:()=>a}),e})()},30:function(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return Math.pow(Math.pow(t.x,2)+Math.pow(t.y,2),.5)}function n(t){return Math.atan2(t.y,t.x)}return t.r(e),t.d(e,{direction:()=>n,magnitude:()=>r}),e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{areWithin:()=>a,centroid:()=>m,deepCopy:()=>o,direction:()=>l,displaced:()=>c,displacement:()=>u,distance:()=>s,isFinitePoint:()=>i,isPoint:()=>e,midpoint:()=>y});var t=r(854);function e(e){return(0,t.isNonNullObject)(e)&&(0,t.isNumber)(e.x)&&(0,t.isNumber)(e.y)}function i(r){return e(r)&&(0,t.isFiniteNumber)(r.x)&&(0,t.isFiniteNumber)(r.y)}function o(t){return{x:t.x,y:t.y}}function s(t,e){var r=e.x-t.x,n=e.y-t.y;return Math.pow(Math.pow(r,2)+Math.pow(n,2),.5)}function a(t,e,r){return s(t,e)<=r}function u(t,e){return{x:e.x-t.x,y:e.y-t.y}}function c(t,e){return{x:t.x+e.x,y:t.y+e.y}}var h=r(30);function l(t,e){return(0,h.direction)(u(t,e))}var d=r(986);function m(t){return{x:(0,d.mean)(t.map(function(t){return t.x})),y:(0,d.mean)(t.map(function(t){return t.y}))}}function y(t,e){return m([t,e])}})(),n})()},106(t){var e;e=()=>(()=>{var t={992(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{KeyBinding:()=>y});var r,n,i,o,s,a,u,c,h,l,d=function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},m=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class y{constructor(t,e,a){r.add(this),this.key=t,n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),s.set(this,void 0),d(this,n,e,"f"),d(this,i,t=>m(this,r,"m",l).call(this,t),"f"),d(this,o,a,"f")}get owner(){return m(this,s,"f")}set owner(t){var e;null===(e=m(this,s,"f"))||void 0===e||e.removeEventListener("keydown",m(this,i,"f")),null==t||t.addEventListener("keydown",m(this,i,"f"),{passive:!1}),d(this,s,t,"f")}}return n=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,r=new WeakSet,a=function(){var t,e;return null!==(e=null===(t=m(this,o,"f"))||void 0===t?void 0:t.altKey)&&void 0!==e&&e},u=function(){var t,e;return null!==(e=null===(t=m(this,o,"f"))||void 0===t?void 0:t.ctrlKey)&&void 0!==e&&e},c=function(){var t,e;return null!==(e=null===(t=m(this,o,"f"))||void 0===t?void 0:t.metaKey)&&void 0!==e&&e},h=function(){var t,e;return null!==(e=null===(t=m(this,o,"f"))||void 0===t?void 0:t.shiftKey)&&void 0!==e&&e},l=function(t){this.owner&&this.owner===document.activeElement&&t.key.toUpperCase()===this.key.toUpperCase()&&t.altKey===m(this,r,"a",a)&&t.ctrlKey===m(this,r,"a",u)&&t.metaKey===m(this,r,"a",c)&&t.shiftKey===m(this,r,"a",h)&&(t.preventDefault(),m(this,n,"f").call(this))},e})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return""===t}function c(t){return a(t)&&!u(t)}function h(t){return!!a(t)&&0==t.trim().length}function l(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function d(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function y(t){return!t}function f(t){return null==t}function p(t){return"object"==typeof t&&null!==t}function g(t){return Array.isArray(t)}function v(t){return g(t)&&0==t.length}function b(t){return g(t)&&t.length>0}function N(t){return g(t)&&t.every(r)}function O(t){return N(t)&&t.length>0}function x(t){return g(t)&&t.every(n)}function T(t){return g(t)&&t.every(i)}function E(t){return g(t)&&t.every(a)}function w(t){return E(t)&&t.length>0}function S(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>g,isEmptyArray:()=>v,isEmptyString:()=>u,isFalsy:()=>y,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>x,isJSON:()=>l,isJSONSerializable:()=>d,isNonEmptyArray:()=>b,isNonEmptyNumbersArray:()=>O,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>w,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>T,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>p,isNullish:()=>f,isNumber:()=>r,isNumbersArray:()=>N,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>S,isString:()=>a,isStringsArray:()=>E,isTruthy:()=>m,isWhitespace:()=>h}),e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function t(t){if(t.length>0)return t[0];throw new Error("Array is empty.")}function e(t){if(t.length>0)return t[t.length-1];throw new Error("Array is empty.")}function i(t){if(t.length<3)throw new Error("Array has less than 3 items.");if(t.length%2==0)throw new Error("Array has an even number of items.");let e=Math.floor(t.length/2);return[t[e-1],t[e],t[e+1]]}function o(t){if(t.length<4)throw new Error("Array has less than 4 items.");if(t.length%2!=0)throw new Error("Array has an odd number of items.");let e=Math.floor(t.length/2);return[t[e-2],t[e-1],t[e],t[e+1]]}r.r(n),r.d(n,{DownloadableFile:()=>v,EventfulSet:()=>b,FiniteStack:()=>w,KeyBinding:()=>d.KeyBinding,containsFocus:()=>l,detectMac:()=>y,detectWindows:()=>m,first:()=>t,hasFocus:()=>h,isJSON:()=>s.isJSON,isJSONSerializable:()=>s.isJSONSerializable,isURL:()=>S,last:()=>e,middleFour:()=>o,middleThree:()=>i,removeWhitespace:()=>a,shuffled:()=>c,splitLines:()=>u});var s=r(854);function a(t){return[...t].filter(t=>!(0,s.isWhitespace)(t)).join("")}function u(t){return t.split(/\r\n|\r|\n/)}function c(t){return t.map(t=>({v:t,priority:Math.random()})).sort((t,e)=>t.priority-e.priority).map(({v:t})=>t)}function h(t){return t===document.activeElement}function l(t){return!!document.activeElement&&t.contains(document.activeElement)}var d=r(992);function m(){return-1!==navigator.userAgent.indexOf("Windows")}function y(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(t){return!1}}var f,p=function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},g=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class v{constructor(t,e,r){f.set(this,void 0),this.name=null!=t?t:"Unnamed.txt",this.content=null!=e?e:"",p(this,f,null==r?void 0:r.type,"f")}get type(){return null!=g(this,f,"f")?g(this,f,"f"):this.content instanceof Blob?this.content.type:"text/plain"}set type(t){p(this,f,t,"f")}download(){let t=new File([this.content],this.name,{type:this.type}),e=URL.createObjectURL(t),r=document.createElement("a");r.href=e,r.download=t.name,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(e)}}f=new WeakMap;class b{constructor(){this.eventListeners={change:[]},this.underlyingSet=new Set}[Symbol.iterator](){return this.underlyingSet.values()}includes(t){return this.underlyingSet.has(t)}include(t){return this.includes(t)}addAll(t){let e=[...t];0!=e.length&&(e.every(t=>this.includes(t))||(e.forEach(t=>this.underlyingSet.add(t)),this.callEventListeners("change")))}removeAll(t){let e=[...t];0!=e.length&&(e.every(t=>!this.includes(t))||(e.forEach(t=>this.underlyingSet.delete(t)),this.callEventListeners("change")))}clear(){0!=this.underlyingSet.size&&(this.underlyingSet.clear(),this.callEventListeners("change"))}addEventListener(t,e){this.eventListeners[t].push(e)}callEventListeners(t){this.eventListeners[t].forEach(t=>t())}removeEventListener(t,e){this.eventListeners[t]=this.eventListeners[t].filter(t=>t!==e)}}var N,O,x,T,E=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class w{constructor(t){N.add(this),this.maxSize=t,O.set(this,[]),x.set(this,{change:[]})}get size(){return E(this,O,"f").length}isEmpty(){return 0==this.size}empty(){0!=this.size&&(function(t,e){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,[])}(this,O),E(this,N,"m",T).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return E(this,O,"f")[E(this,O,"f").length-1]}push(t){E(this,O,"f").push(t),this.size>this.maxSize&&E(this,O,"f").shift(),E(this,N,"m",T).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let t=E(this,O,"f").pop();return E(this,N,"m",T).call(this,"change"),t}addEventListener(t,e){E(this,x,"f")[t].push(e)}removeEventListener(t,e){E(this,x,"f")[t]=E(this,x,"f")[t].filter(t=>t!==e)}}function S(t){try{return new URL(t),!0}catch(t){return!1}}O=new WeakMap,x=new WeakMap,N=new WeakSet,T=function(t){E(this,x,"f")[t].forEach(t=>t())}})(),n})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return null==t}function c(t){return"object"==typeof t&&null!==t}function h(t){return Array.isArray(t)}function l(t){return h(t)&&0==t.length}function d(t){return h(t)&&t.length>0}function m(t){return h(t)&&t.every(r)}function y(t){return m(t)&&t.length>0}function f(t){return h(t)&&t.every(n)}function p(t){return h(t)&&t.every(i)}function g(t){return h(t)&&t.every(a)}function v(t){return g(t)&&t.length>0}return t.r(e),t.d(e,{isArray:()=>h,isEmptyArray:()=>l,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>f,isNonEmptyArray:()=>d,isNonEmptyNumbersArray:()=>y,isNonEmptyStringsArray:()=>v,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>p,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isNumbersArray:()=>m,isPositiveFiniteNumber:()=>o,isString:()=>a,isStringsArray:()=>g}),e})()},277(t){var e;e=()=>(()=>{var t={854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return""===t}function c(t){return a(t)&&!u(t)}function h(t){return!!a(t)&&0==t.trim().length}function l(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function d(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function y(t){return!t}function f(t){return null==t}function p(t){return"object"==typeof t&&null!==t}function g(t){return Array.isArray(t)}function v(t){return g(t)&&0==t.length}function b(t){return g(t)&&t.length>0}function N(t){return g(t)&&t.every(r)}function O(t){return N(t)&&t.length>0}function x(t){return g(t)&&t.every(n)}function T(t){return g(t)&&t.every(i)}function E(t){return g(t)&&t.every(a)}function w(t){return E(t)&&t.length>0}function S(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>g,isEmptyArray:()=>v,isEmptyString:()=>u,isFalsy:()=>y,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>x,isJSON:()=>l,isJSONSerializable:()=>d,isNonEmptyArray:()=>b,isNonEmptyNumbersArray:()=>O,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>w,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>T,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>p,isNullish:()=>f,isNumber:()=>r,isNumbersArray:()=>N,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>S,isString:()=>a,isStringsArray:()=>E,isTruthy:()=>m,isWhitespace:()=>h}),e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Vector:()=>e,isFiniteVectorLike:()=>o,isVectorLike:()=>i});var t=r(854);class e{static matching(t){let r="x"in t?t.x:t.magnitude*Math.cos(t.direction),n="y"in t?t.y:t.magnitude*Math.sin(t.direction);return new e(r,n)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}get magnitude(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}set magnitude(t){let e=this.direction;this.x=t*Math.cos(e),this.y=t*Math.sin(e)}get direction(){return Math.atan2(this.y,this.x)}set direction(t){let e=this.magnitude;this.x=e*Math.cos(t),this.y=e*Math.sin(t)}isFinite(){return(0,t.isFiniteNumber)(this.x)&&(0,t.isFiniteNumber)(this.y)}}function i(e){return!(!(0,t.isNonNullObject)(e)||!((0,t.isNumber)(e.x)&&(0,t.isNumber)(e.y)||(0,t.isNumber)(e.magnitude)&&(0,t.isNumber)(e.direction)))}function o(t){return!!i(t)&&e.matching(t).isFinite()}})(),n})(),t.exports=e()}};const e={};function r(n){const i=e[n];if(void 0!==i)return i.exports;const o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{if(Array.isArray(e))for(var n=0;n<e.length;){var i=e[n++],o=e[n++];r.o(t,i)?0===o&&n++:0===o?Object.defineProperty(t,i,{enumerable:!0,value:e[n++]}):Object.defineProperty(t,i,{enumerable:!0,get:o})}else for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let n={};return(()=>{"use strict";r.r(n),r.d(n,{CurvedBond:()=>K});const t={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let e;const i=new Uint8Array(16),o=[];for(let t=0;t<256;++t)o.push((t+256).toString(16).slice(1));function s(t,r,n){const s=(t=t||{}).random??t.rng?.()??function(){if(!e){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");e=crypto.getRandomValues.bind(crypto)}return e(i)}();if(s.length<16)throw new Error("Random bytes length must be >= 16");if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,r){if((n=n||0)<0||n+16>r.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)r[n+t]=s[t];return r}return function(t,e=0){return(o[t[e+0]]+o[t[e+1]]+o[t[e+2]]+o[t[e+3]]+"-"+o[t[e+4]]+o[t[e+5]]+"-"+o[t[e+6]]+o[t[e+7]]+"-"+o[t[e+8]]+o[t[e+9]]+"-"+o[t[e+10]]+o[t[e+11]]+o[t[e+12]]+o[t[e+13]]+o[t[e+14]]+o[t[e+15]]).toLowerCase()}(s)}const a=" ";function u([t,e],r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function c(...t){for(let e=0;e<t.length;e++)if("number"!=typeof t[e])throw new Error(`assertNumbers arguments[${e}] is not a number. ${typeof t[e]} == typeof ${t[e]}`);return!0}const h=Math.PI;function l(t,e,r){t.lArcFlag=0===t.lArcFlag?0:1,t.sweepFlag=0===t.sweepFlag?0:1;let{rX:n,rY:i}=t;const{x:o,y:s}=t;if(Math.abs(n)<1e-10||Math.abs(i)<1e-10)return t.rX=0,t.rY=0,t.cX=(e+o)/2,t.cY=(r+s)/2,t.phi1=0,void(t.phi2=0);n=Math.abs(t.rX),i=Math.abs(t.rY);const a=t.xRot/180*h,[c,l]=u([(e-o)/2,(r-s)/2],-a),d=Math.pow(c,2)/Math.pow(n,2)+Math.pow(l,2)/Math.pow(i,2);1<d&&(n*=Math.sqrt(d),i*=Math.sqrt(d)),t.rX=n,t.rY=i;const m=Math.pow(n,2)*Math.pow(l,2)+Math.pow(i,2)*Math.pow(c,2),y=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(n,2)*Math.pow(i,2)-m)/m)),f=n*l/i*y,p=-i*c/n*y,g=u([f,p],a);t.cX=g[0]+(e+o)/2,t.cY=g[1]+(r+s)/2,t.phi1=Math.atan2((l-p)/i,(c-f)/n),t.phi2=Math.atan2((-l-p)/i,(-c-f)/n),0===t.sweepFlag&&t.phi2>t.phi1&&(t.phi2-=2*h),1===t.sweepFlag&&t.phi2<t.phi1&&(t.phi2+=2*h),t.phi1*=180/h,t.phi2*=180/h}function d(t,e,r){c(t,e,r);const n=t*t+e*e-r*r;if(0>n)return[];if(0===n)return[[t*r/(t*t+e*e),e*r/(t*t+e*e)]];const i=Math.sqrt(n);return[[(t*r+e*i)/(t*t+e*e),(e*r-t*i)/(t*t+e*e)],[(t*r-e*i)/(t*t+e*e),(e*r+t*i)/(t*t+e*e)]]}const m=Math.PI/180;function y(t,e,r){return(1-r)*t+r*e}function f(t,e,r,n){return t+Math.cos(n/180*h)*e+Math.sin(n/180*h)*r}function p(t,e,r,n){const i=1e-6,o=e-t,s=r-e,a=3*o+3*(n-r)-6*s,u=6*(s-o),c=3*o;return Math.abs(a)<i?Math.abs(u)<i?[]:[-c/u]:function(t,e,r=1e-6){const n=t*t/4-e;if(n<-r)return[];if(n<=r)return[-t/2];const i=Math.sqrt(n);return[-t/2-i,-t/2+i]}(u/a,c/a,i)}function g(t,e,r,n,i){const o=1-i;return t*(o*o*o)+e*(3*o*o*i)+r*(3*o*i*i)+n*(i*i*i)}function v(t,e,r){const n=e[0]-t[0],i=e[1]-t[1],o=r[0]-t[0],s=r[1]-t[1],a=n*s-i*o;if(!(Math.abs(a)<1e-10))return!1;const u=n*o+i*s,c=o*o+s*s;return 0<=u&&u<=c&&n*n+i*i<=c}function b(t){const e=t[t.length-1]?.type===P.CLOSE_PATH,r=e?t.length-2:t.length-1,n=[{type:P.MOVE_TO,relative:!1,x:t[r].x,y:t[r].y}];for(let e=r;e>0;e--){const r=t[e],i=t[e-1];if(r.relative)throw new Error("Relative command are not supported convert first with `toAbs()`");switch(r.type){case P.HORIZ_LINE_TO:n.push({type:P.HORIZ_LINE_TO,relative:!1,x:i.x});break;case P.VERT_LINE_TO:n.push({type:P.VERT_LINE_TO,relative:!1,y:i.y});break;case P.LINE_TO:case P.MOVE_TO:n.push({type:P.LINE_TO,relative:!1,x:i.x,y:i.y});break;case P.CURVE_TO:n.push({type:P.CURVE_TO,relative:!1,x:i.x,y:i.y,x1:r.x2,y1:r.y2,x2:r.x1,y2:r.y1});break;case P.SMOOTH_CURVE_TO:throw new Error("Unsupported command: S (smooth cubic bezier)");case P.SMOOTH_QUAD_TO:throw new Error("Unsupported command: T (smooth quadratic bezier)");case P.ARC:throw new Error("Unsupported command: A (arc)");case P.QUAD_TO:throw new Error("Unsupported command: Q (quadratic bezier)")}}return e&&n.push({type:P.CLOSE_PATH}),n}function N(){return T((t,e,r)=>(t.relative&&(void 0!==t.x1&&(t.x1+=e),void 0!==t.y1&&(t.y1+=r),void 0!==t.x2&&(t.x2+=e),void 0!==t.y2&&(t.y2+=r),void 0!==t.x&&(t.x+=e),void 0!==t.y&&(t.y+=r),t.relative=!1),t))}function O(){let t=NaN,e=NaN,r=NaN,n=NaN;return T((i,o,s)=>(i.type&P.SMOOTH_CURVE_TO&&(i.type=P.CURVE_TO,t=isNaN(t)?o:t,e=isNaN(e)?s:e,i.x1=i.relative?o-t:2*o-t,i.y1=i.relative?s-e:2*s-e),i.type&P.CURVE_TO?(t=i.relative?o+i.x2:i.x2,e=i.relative?s+i.y2:i.y2):(t=NaN,e=NaN),i.type&P.SMOOTH_QUAD_TO&&(i.type=P.QUAD_TO,r=isNaN(r)?o:r,n=isNaN(n)?s:n,i.x1=i.relative?o-r:2*o-r,i.y1=i.relative?s-n:2*s-n),i.type&P.QUAD_TO?(r=i.relative?o+i.x1:i.x1,n=i.relative?s+i.y1:i.y1):(r=NaN,n=NaN),i))}function x(){let t=NaN,e=NaN;return T((r,n,i)=>{if(r.type&P.SMOOTH_QUAD_TO&&(r.type=P.QUAD_TO,t=isNaN(t)?n:t,e=isNaN(e)?i:e,r.x1=r.relative?n-t:2*n-t,r.y1=r.relative?i-e:2*i-e),r.type&P.QUAD_TO){t=r.relative?n+r.x1:r.x1,e=r.relative?i+r.y1:r.y1;const o=r.x1,s=r.y1;r.type=P.CURVE_TO,r.x1=((r.relative?0:n)+2*o)/3,r.y1=((r.relative?0:i)+2*s)/3,r.x2=(r.x+2*o)/3,r.y2=(r.y+2*s)/3}else t=NaN,e=NaN;return r})}function T(t){let e=0,r=0,n=NaN,i=NaN;return function(o){if(isNaN(n)&&!(o.type&P.MOVE_TO))throw new Error("path must start with moveto");const s=t(o,e,r,n,i);return o.type&P.CLOSE_PATH&&(e=n,r=i),"x"in o&&void 0!==o.x&&(e=o.relative?e+o.x:o.x),"y"in o&&void 0!==o.y&&(r=o.relative?r+o.y:o.y),o.type&P.MOVE_TO&&(n=e,i=r),s}}function E(t,e,r,n,i,o){return c(t,e,r,n,i,o),T((s,a,u,c)=>{const h=s.x1,l=s.x2,d=s.relative&&!isNaN(c),m=void 0!==s.x?s.x:d?0:a,y=void 0!==s.y?s.y:d?0:u;function f(t){return t*t}s.type&P.HORIZ_LINE_TO&&0!==e&&(s.type=P.LINE_TO,s.y=s.relative?0:u),s.type&P.VERT_LINE_TO&&0!==r&&(s.type=P.LINE_TO,s.x=s.relative?0:a),void 0!==s.x&&(s.x=s.x*t+y*r+(d?0:i)),void 0!==s.y&&(s.y=m*e+s.y*n+(d?0:o)),void 0!==s.x1&&(s.x1=s.x1*t+s.y1*r+(d?0:i)),void 0!==s.y1&&(s.y1=h*e+s.y1*n+(d?0:o)),void 0!==s.x2&&(s.x2=s.x2*t+s.y2*r+(d?0:i)),void 0!==s.y2&&(s.y2=l*e+s.y2*n+(d?0:o));const p=t*n-e*r;if(void 0!==s.xRot&&(1!==t||0!==e||0!==r||1!==n))if(0===p)delete s.rX,delete s.rY,delete s.xRot,delete s.lArcFlag,delete s.sweepFlag,s.type=P.LINE_TO;else{const i=s.xRot*Math.PI/180,o=Math.sin(i),a=Math.cos(i),u=1/f(s.rX),c=1/f(s.rY),h=f(a)*u+f(o)*c,l=2*o*a*(u-c),d=f(o)*u+f(a)*c,m=h*n*n-l*e*n+d*e*e,y=l*(t*n+e*r)-2*(h*r*n+d*t*e),g=h*r*r-l*t*r+d*t*t,v=(Math.atan2(y,m-g)+Math.PI)%Math.PI/2,b=Math.sin(v),N=Math.cos(v);s.rX=Math.abs(p)/Math.sqrt(m*f(N)+y*b*N+g*f(b)),s.rY=Math.abs(p)/Math.sqrt(m*f(b)-y*b*N+g*f(N)),s.xRot=180*v/Math.PI}return void 0!==s.sweepFlag&&0>p&&(s.sweepFlag=+!s.sweepFlag),s})}const w={ROUND:function(t=1e13){function e(e){return Math.round(e*t)/t}return c(t),function(t){return"x1"in t&&void 0!==t.x1&&(t.x1=e(t.x1)),"y1"in t&&void 0!==t.y1&&(t.y1=e(t.y1)),"x2"in t&&void 0!==t.x2&&(t.x2=e(t.x2)),"y2"in t&&void 0!==t.y2&&(t.y2=e(t.y2)),"x"in t&&void 0!==t.x&&(t.x=e(t.x)),"y"in t&&void 0!==t.y&&(t.y=e(t.y)),"rX"in t&&void 0!==t.rX&&(t.rX=e(t.rX)),"rY"in t&&void 0!==t.rY&&(t.rY=e(t.rY)),t}},TO_ABS:N,TO_REL:function(){return T((t,e,r)=>(t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=r),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=r),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=r),t.relative=!0),t))},NORMALIZE_HVZ:function(t=!0,e=!0,r=!0,n=!0){return T((i,o,s,a,u)=>{if(isNaN(a)&&!(i.type&P.MOVE_TO))throw new Error("path must start with moveto");if(e&&i.type&P.HORIZ_LINE_TO&&(i.type=P.LINE_TO,i.y=i.relative?0:s),r&&i.type&P.VERT_LINE_TO&&(i.type=P.LINE_TO,i.x=i.relative?0:o),t&&i.type&P.CLOSE_PATH&&(i.type=P.LINE_TO,i.x=i.relative?a-o:a,i.y=i.relative?u-s:u),i.type&P.ARC&&(0===i.rX||0===i.rY)&&(i.type=P.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),n&&i.type&P.QUAD_TO&&v([o,s],i.relative?[o+i.x1,s+i.y1]:[i.x1,i.y1],i.relative?[o+i.x,s+i.y]:[i.x,i.y])&&(i.type=P.LINE_TO,delete i.x1,delete i.y1),n&&i.type&P.CURVE_TO){const t=[o,s],e=i.relative?[o+i.x1,s+i.y1]:[i.x1,i.y1],r=i.relative?[o+i.x2,s+i.y2]:[i.x2,i.y2],n=i.relative?[o+i.x,s+i.y]:[i.x,i.y];v(t,e,n)&&v(t,r,n)&&(i.type=P.LINE_TO,delete i.x1,delete i.y1,delete i.x2,delete i.y2)}return i})},NORMALIZE_ST:O,QT_TO_C:x,INFO:T,SANITIZE:function(t=0){c(t);let e=NaN,r=NaN,n=NaN,i=NaN;return T((o,s,a,u,c)=>{const h=Math.abs;let l=!1,d=0,m=0;if(o.type&P.SMOOTH_CURVE_TO&&(d=isNaN(e)?0:s-e,m=isNaN(r)?0:a-r),o.type&(P.CURVE_TO|P.SMOOTH_CURVE_TO)?(e=o.relative?s+o.x2:o.x2,r=o.relative?a+o.y2:o.y2):(e=NaN,r=NaN),o.type&P.SMOOTH_QUAD_TO?(n=isNaN(n)?s:2*s-n,i=isNaN(i)?a:2*a-i):o.type&P.QUAD_TO?(n=o.relative?s+o.x1:o.x1,i=o.relative?a+o.y1:o.y2):(n=NaN,i=NaN),o.type&P.LINE_COMMANDS||o.type&P.ARC&&(0===o.rX||0===o.rY||!o.lArcFlag)||o.type&P.CURVE_TO||o.type&P.SMOOTH_CURVE_TO||o.type&P.QUAD_TO||o.type&P.SMOOTH_QUAD_TO){const e=void 0===o.x?0:o.relative?o.x:o.x-s,r=void 0===o.y?0:o.relative?o.y:o.y-a;d=isNaN(n)?void 0===o.x1?d:o.relative?o.x:o.x1-s:n-s,m=isNaN(i)?void 0===o.y1?m:o.relative?o.y:o.y1-a:i-a;const u=void 0===o.x2?0:o.relative?o.x:o.x2-s,c=void 0===o.y2?0:o.relative?o.y:o.y2-a;h(e)<=t&&h(r)<=t&&h(d)<=t&&h(m)<=t&&h(u)<=t&&h(c)<=t&&(l=!0)}return o.type&P.CLOSE_PATH&&h(s-u)<=t&&h(a-c)<=t&&(l=!0),l?[]:o})},MATRIX:E,ROTATE:function(t,e=0,r=0){c(t,e,r);const n=Math.sin(t),i=Math.cos(t);return E(i,n,-n,i,e-e*i+r*n,r-e*n-r*i)},TRANSLATE:function(t,e=0){return c(t,e),E(1,0,0,1,t,e)},SCALE:function(t,e=t){return c(t,e),E(t,0,0,e,0,0)},SKEW_X:function(t){return c(t),E(1,0,Math.tan(t),1,0,0)},SKEW_Y:function(t){return c(t),E(1,Math.tan(t),0,1,0,0)},X_AXIS_SYMMETRY:function(t=0){return c(t),E(-1,0,0,1,t,0)},Y_AXIS_SYMMETRY:function(t=0){return c(t),E(1,0,0,-1,0,t)},A_TO_C:function(){return T((t,e,r)=>P.ARC===t.type?function(t,e,r){t.cX||l(t,e,r);const n=t.xRot/180*h;if(Math.abs(t.rX)<1e-10||Math.abs(t.rY)<1e-10)return[{relative:t.relative,type:P.CURVE_TO,x1:e+(t.x-e)/3,y1:r+(t.y-r)/3,x2:e+2*(t.x-e)/3,y2:r+2*(t.y-r)/3,x:t.x,y:t.y}];const i=Math.min(t.phi1,t.phi2),o=Math.max(t.phi1,t.phi2)-i,s=Math.ceil(o/90),a=new Array(s);let c=e,d=r;const f=(e,r)=>{const[i,o]=u([e*t.rX,r*t.rY],n);return[t.cX+i,t.cY+o]};for(let e=0;e<s;e++){const r=y(t.phi1,t.phi2,e/s),n=y(t.phi1,t.phi2,(e+1)/s),i=n-r,o=4/3*Math.tan(i*m/4),u=Math.cos(r*m)-o*Math.sin(r*m),h=Math.sin(r*m)+o*Math.cos(r*m),l=Math.cos(n*m),p=Math.sin(n*m),g=l+o*p,v=p-o*l,b=f(u,h),N=f(g,v),O=f(l,p),x={relative:t.relative,type:P.CURVE_TO,x:O[0],y:O[1],x1:b[0],y1:b[1],x2:N[0],y2:N[1]};t.relative&&(x.x1-=c,x.y1-=d,x.x2-=c,x.y2-=d,x.x-=c,x.y-=d),c=O[0],d=O[1],a[e]=x}return a}(t,t.relative?0:e,t.relative?0:r):t)},ANNOTATE_ARCS:function(){return T((t,e,r)=>(t.relative&&(e=0,r=0),P.ARC===t.type&&l(t,e,r),t))},CLONE:function(){return t=>({...t})},CALCULATE_BOUNDS:function(){const t=N(),e=x(),r=O(),n=T((i,o,s)=>{const a=r(e(t((t=>({...t}))(i))));function u(t){t>n.maxX&&(n.maxX=t),t<n.minX&&(n.minX=t)}function c(t){t>n.maxY&&(n.maxY=t),t<n.minY&&(n.minY=t)}if(a.type&P.DRAWING_COMMANDS&&(u(o),c(s)),a.type&P.HORIZ_LINE_TO&&u(a.x),a.type&P.VERT_LINE_TO&&c(a.y),a.type&P.LINE_TO&&(u(a.x),c(a.y)),a.type&P.CURVE_TO){u(a.x),c(a.y);const t=p(o,a.x1,a.x2,a.x);for(const e of t)0<e&&1>e&&u(g(o,a.x1,a.x2,a.x,e));const e=p(s,a.y1,a.y2,a.y);for(const t of e)0<t&&1>t&&c(g(s,a.y1,a.y2,a.y,t))}if(a.type&P.ARC){u(a.x),c(a.y),l(a,o,s);const t=a.xRot/180*Math.PI,e=Math.cos(t)*a.rX,r=Math.sin(t)*a.rX,n=-Math.sin(t)*a.rY,i=Math.cos(t)*a.rY,[h,m]=a.phi1<a.phi2?[a.phi1,a.phi2]:-180>a.phi2?[a.phi2+360,a.phi1+360]:[a.phi2,a.phi1],y=([t,e])=>{const r=180*Math.atan2(e,t)/Math.PI;return r<h?r+360:r},p=d(n,-e,0).map(y);for(const t of p)t>h&&t<m&&u(f(a.cX,e,n,t));const g=d(i,-r,0).map(y);for(const t of g)t>h&&t<m&&c(f(a.cY,r,i,t))}return i});return n.minX=1/0,n.maxX=-1/0,n.minY=1/0,n.maxY=-1/0,n},REVERSE_PATH:function(t,e=!0){if(t.length<2)return t;const r=w.INFO((t,e,r)=>({...t,x:t.x??e,y:t.y??r,relative:t.relative??!1})),n=[];let i=[];for(const o of t){const t=r(o);t.type===P.MOVE_TO&&i.length>0&&(e?n.push(...b(i)):n.unshift(...b(i)),i=[]),i.push(t)}return i.length>0&&(e?n.push(...b(i)):n.unshift(...b(i))),n},REMOVE_COLLINEAR:function(t){if(t.length<=2)return t;const e=[],r=t.map(w.INFO((t,e,r)=>{const n="relative"in t&&t.relative;return["x"in t?t.x+(n?e:0):e,"y"in t?t.y+(n?r:0):r]}));let n=r[0];e.push(t[0]);for(let i=1;i<t.length;i++){const o=t[i],s=t[i+1];if(i<t.length-1&&s&&o.type&P.LINE_COMMANDS&&s.type&P.LINE_COMMANDS){const t=r[i+1];if(v(n,r[i],t)){"relative"in s&&s.relative&&("x"in s&&(s.x=t[0]-n[0]),"y"in s&&(s.y=t[1]-n[1]));continue}}e.push(o),n=r[i]}return e}};class S{round(t){return this.transform(w.ROUND(t))}toAbs(){return this.transform(w.TO_ABS())}toRel(){return this.transform(w.TO_REL())}normalizeHVZ(t,e,r){return this.transform(w.NORMALIZE_HVZ(t,e,r))}normalizeST(){return this.transform(w.NORMALIZE_ST())}qtToC(){return this.transform(w.QT_TO_C())}aToC(){return this.transform(w.A_TO_C())}sanitize(t){return this.transform(w.SANITIZE(t))}translate(t,e){return this.transform(w.TRANSLATE(t,e))}scale(t,e){return this.transform(w.SCALE(t,e))}rotate(t,e,r){return this.transform(w.ROTATE(t,e,r))}matrix(t,e,r,n,i,o){return this.transform(w.MATRIX(t,e,r,n,i,o))}skewX(t){return this.transform(w.SKEW_X(t))}skewY(t){return this.transform(w.SKEW_Y(t))}xSymmetry(t){return this.transform(w.X_AXIS_SYMMETRY(t))}ySymmetry(t){return this.transform(w.Y_AXIS_SYMMETRY(t))}annotateArcs(){return this.transform(w.ANNOTATE_ARCS())}}const _=t=>" "===t||"\t"===t||"\r"===t||"\n"===t,A=t=>"0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0);class M extends S{curNumber="";curCommandType=-1;curCommandRelative=!1;canParseCommandOrComma=!0;curNumberHasExp=!1;curNumberHasExpDigits=!1;curNumberHasDecimal=!1;curArgs=[];finish(t=[]){if(this.parse(" ",t),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t}parse(t,e=[]){const r=t=>{e.push(t),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let n=0;n<t.length;n++){const i=t[n],o=!(this.curCommandType!==P.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),s=A(i)&&("0"===this.curNumber&&"0"===i||o);if(!A(i)||s)if("e"!==i&&"E"!==i)if("-"!==i&&"+"!==i||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==i||this.curNumberHasExp||this.curNumberHasDecimal||o){if(this.curNumber&&-1!==this.curCommandType){const t=Number(this.curNumber);if(isNaN(t))throw new SyntaxError(`Invalid number ending at ${n}`);if(this.curCommandType===P.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>t)throw new SyntaxError(`Expected positive number, got "${t}" at index "${n}"`)}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError(`Expected a flag, got "${this.curNumber}" at index "${n}"`);this.curArgs.push(t),this.curArgs.length===C[this.curCommandType]&&(P.HORIZ_LINE_TO===this.curCommandType?r({type:P.HORIZ_LINE_TO,relative:this.curCommandRelative,x:t}):P.VERT_LINE_TO===this.curCommandType?r({type:P.VERT_LINE_TO,relative:this.curCommandRelative,y:t}):this.curCommandType===P.MOVE_TO||this.curCommandType===P.LINE_TO||this.curCommandType===P.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),P.MOVE_TO===this.curCommandType&&(this.curCommandType=P.LINE_TO)):this.curCommandType===P.CURVE_TO?r({type:P.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===P.SMOOTH_CURVE_TO?r({type:P.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===P.QUAD_TO?r({type:P.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===P.ARC&&r({type:P.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!_(i))if(","===i&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==i&&"-"!==i&&"."!==i)if(s)this.curNumber=i,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError(`Unterminated command at index ${n}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${i}" at index ${n}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,"z"!==i&&"Z"!==i)if("h"===i||"H"===i)this.curCommandType=P.HORIZ_LINE_TO,this.curCommandRelative="h"===i;else if("v"===i||"V"===i)this.curCommandType=P.VERT_LINE_TO,this.curCommandRelative="v"===i;else if("m"===i||"M"===i)this.curCommandType=P.MOVE_TO,this.curCommandRelative="m"===i;else if("l"===i||"L"===i)this.curCommandType=P.LINE_TO,this.curCommandRelative="l"===i;else if("c"===i||"C"===i)this.curCommandType=P.CURVE_TO,this.curCommandRelative="c"===i;else if("s"===i||"S"===i)this.curCommandType=P.SMOOTH_CURVE_TO,this.curCommandRelative="s"===i;else if("q"===i||"Q"===i)this.curCommandType=P.QUAD_TO,this.curCommandRelative="q"===i;else if("t"===i||"T"===i)this.curCommandType=P.SMOOTH_QUAD_TO,this.curCommandRelative="t"===i;else{if("a"!==i&&"A"!==i)throw new SyntaxError(`Unexpected character "${i}" at index ${n}.`);this.curCommandType=P.ARC,this.curCommandRelative="a"===i}else e.push({type:P.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=i,this.curNumberHasDecimal="."===i}else this.curNumber+=i,this.curNumberHasDecimal=!0;else this.curNumber+=i;else this.curNumber+=i,this.curNumberHasExp=!0;else this.curNumber+=i,this.curNumberHasExpDigits=this.curNumberHasExp}return e}transform(t){return Object.create(this,{parse:{value(e,r=[]){const n=Object.getPrototypeOf(this).parse.call(this,e);for(const e of n){const n=t(e);Array.isArray(n)?r.push(...n):r.push(n)}return r}}})}}class P extends S{commands;constructor(t){super(),this.commands="string"==typeof t?P.parse(t):t}encode(){return P.encode(this.commands)}getBounds(){const t=w.CALCULATE_BOUNDS();return this.transform(t),t}transform(t){const e=[];for(const r of this.commands){const n=t(r);Array.isArray(n)?e.push(...n):e.push(n)}return this.commands=e,this}reverse(t=!0){return this.commands=w.REVERSE_PATH(this.commands,t),this}removeCollinear(){return this.commands=w.REMOVE_COLLINEAR(this.commands),this}static encode(t){return function(t){let e="";Array.isArray(t)||(t=[t]);for(let r=0;r<t.length;r++){const n=t[r];if(n.type===P.CLOSE_PATH)e+="z";else if(n.type===P.HORIZ_LINE_TO)e+=(n.relative?"h":"H")+n.x;else if(n.type===P.VERT_LINE_TO)e+=(n.relative?"v":"V")+n.y;else if(n.type===P.MOVE_TO)e+=(n.relative?"m":"M")+n.x+a+n.y;else if(n.type===P.LINE_TO)e+=(n.relative?"l":"L")+n.x+a+n.y;else if(n.type===P.CURVE_TO)e+=(n.relative?"c":"C")+n.x1+a+n.y1+a+n.x2+a+n.y2+a+n.x+a+n.y;else if(n.type===P.SMOOTH_CURVE_TO)e+=(n.relative?"s":"S")+n.x2+a+n.y2+a+n.x+a+n.y;else if(n.type===P.QUAD_TO)e+=(n.relative?"q":"Q")+n.x1+a+n.y1+a+n.x+a+n.y;else if(n.type===P.SMOOTH_QUAD_TO)e+=(n.relative?"t":"T")+n.x+a+n.y;else{if(n.type!==P.ARC)throw new Error(`Unexpected command type "${n?.type}" at index ${r}.`);e+=(n.relative?"a":"A")+n.rX+a+n.rY+a+n.xRot+a+ +n.lArcFlag+a+ +n.sweepFlag+a+n.x+a+n.y}}return e}(t)}static parse(t){const e=new M,r=[];return e.parse(t,r),e.finish(r),r}static CLOSE_PATH=1;static MOVE_TO=2;static HORIZ_LINE_TO=4;static VERT_LINE_TO=8;static LINE_TO=16;static CURVE_TO=32;static SMOOTH_CURVE_TO=64;static QUAD_TO=128;static SMOOTH_QUAD_TO=256;static ARC=512;static LINE_COMMANDS=P.LINE_TO|P.HORIZ_LINE_TO|P.VERT_LINE_TO;static DRAWING_COMMANDS=P.HORIZ_LINE_TO|P.VERT_LINE_TO|P.LINE_TO|P.CURVE_TO|P.SMOOTH_CURVE_TO|P.QUAD_TO|P.SMOOTH_QUAD_TO|P.ARC}const C={[P.MOVE_TO]:2,[P.LINE_TO]:2,[P.HORIZ_LINE_TO]:1,[P.VERT_LINE_TO]:1,[P.CLOSE_PATH]:0,[P.QUAD_TO]:4,[P.SMOOTH_QUAD_TO]:2,[P.CURVE_TO]:6,[P.SMOOTH_CURVE_TO]:4,[P.ARC]:7};var R=r(456);class I{static matching(t){if(t.type!==P.MOVE_TO)throw new Error('SVG path definition command is not of type "M".');if(t.relative)throw new Error("The input SVG path definition command is a relative command.");let e=new R.FinitePoint(t.x,t.y);return new I(e)}constructor(t){this.startPoint=t}get endPoint(){return this.startPoint}toString(){return`M ${this.startPoint.x} ${this.startPoint.y}`}}class L{static matching(t){if(t.type!==P.LINE_TO&&t.type!==P.QUAD_TO&&t.type!==P.CURVE_TO)throw new Error('Trailing segments can only be created for "L", "Q" and "C" SVG path definition commands.');if(t.relative)throw new Error("The input SVG path definition command is a relative command.");var e=[];t.type!==P.QUAD_TO&&t.type!==P.CURVE_TO||e.push(new R.FinitePoint(t.x1,t.y1)),t.type===P.CURVE_TO&&e.push(new R.FinitePoint(t.x2,t.y2));var r=new R.FinitePoint(t.x,t.y);return new L(e,r)}constructor(t,e){this.controlPoints=t,this.endPoint=e}toString(){if(this.controlPoints.length>2)throw new Error(`There can only be at most 2 control points: ${this.controlPoints.length} control points.`);return(0==this.controlPoints.length?"L":1==this.controlPoints.length?"Q":"C")+" "+this.controlPoints.map(t=>`${t.x} ${t.y}`).join(" ")+" "+`${this.endPoint.x} ${this.endPoint.y}`}}var U,j=r(725),V=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class F{constructor(t){U.set(this,void 0),function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(t,r):i?i.value=r:e.set(t,r)}(this,U,t,"f")}closest(t){if(0==V(this,U,"f").length)throw new Error("This points collection is empty.");let e=[...V(this,U,"f")];return e.sort((e,r)=>(0,j.distance)(e,t)-(0,j.distance)(r,t)),e[0]}}U=new WeakMap;var D=r(106),H=r(854);class Y{static matching(t){let e=k.create();if(!(0,H.isString)(t))return e;try{let e=new P(t);e=e.toAbs();let r=I.matching(e.commands[0]),n=[L.matching(e.commands[1]),...e.commands.slice(2).map(t=>L.matching(t))];return new Y(r,n)}catch{return e}}constructor(t,e){this.moveToSegment=t,this.trailingSegments=e}get segments(){return[this.moveToSegment,this.trailingSegments[0],...this.trailingSegments.slice(1)]}get definingPoints(){return[this.startPoint,...this.trailingSegments.flatMap(t=>[...t.controlPoints,t.endPoint])]}get startPoint(){return this.moveToSegment.startPoint}get interveningPoints(){return[...this.trailingSegments.slice(0,-1).flatMap(t=>[...t.controlPoints,t.endPoint]),...(0,D.last)(this.trailingSegments).controlPoints]}get controlPoints(){return this.trailingSegments.flatMap(t=>t.controlPoints)}get endPoint(){if(0==this.trailingSegments.length)throw new Error("This SVG path definition has no trailing segments.");return(0,D.last)(this.trailingSegments).endPoint}toString(){return this.segments.map(t=>t.toString()).join(" ")}drag(t,e,r){let n=new F(this.definingPoints).closest(r.dragPoint);this.controlPoints.includes(n)&&(t*=2,e*=2),n.displace({x:t,y:e})}}const k={create:()=>{let t=new P("M 0 0 Q 0 0 0 0");if(t.commands.length<2)throw new Error("Unable to create default SVG path definition.");let e=I.matching(t.commands[0]),r=[L.matching(t.commands[1])];return new Y(e,r)}};var X=r(277);class Q{static from(t){let e,r=new Q(0,0);if(!(0,H.isString)(t))return r;try{e=JSON.parse(t)}catch{return r}return(0,X.isVectorLike)(e)?Q.matching(e):r}static matching(t){let e=X.Vector.matching(t);return new Q(e.magnitude,e.direction)}constructor(t,e){this.magnitude=t,this.direction=e}toJSON(){return JSON.stringify({magnitude:this.magnitude,direction:this.direction})}}var $,W,z,G,J,Z,q,B=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class K{static between(e,r){let n=document.createElementNS("http://www.w3.org/2000/svg","path");var i,o,a;n.id="id-"+(!t.randomUUID||o||i?s(i,o,a):t.randomUUID()),n.setAttribute("stroke","black"),n.setAttribute("stroke-width","1.5"),n.setAttribute("stroke-opacity","1"),n.setAttribute("stroke-dasharray",""),n.setAttribute("stroke-linecap",""),n.setAttribute("stroke-linejoin",""),n.setAttribute("fill","none");let u=(0,R.midpoint)(e.centerPoint,r.centerPoint);return n.setAttribute("d",`M ${e.centerPoint.x} ${e.centerPoint.y} Q ${u.x} ${u.y} ${r.centerPoint.x} ${r.centerPoint.y}`),new K(n,e,r)}constructor(t,e,r){$.add(this),this.domNode=t,this.base1=e,this.base2=r,t.dataset.basePadding1||t.dataset.basePadding2||B(this,$,"m",z).call(this),e.addEventListener("change",()=>B(this,$,"m",W).call(this)),r.addEventListener("change",()=>B(this,$,"m",W).call(this))}get id(){return this.domNode.id}get basePadding1(){let t=()=>Q.from(this.domNode.dataset.basePadding1),e=(t,e)=>{let r=new Q(t,e);this.domNode.dataset.basePadding1=r.toJSON(),B(this,$,"m",W).call(this)},r=()=>t().magnitude,n=()=>t().direction;return{get magnitude(){return r()},set magnitude(t){(t=>{e(t,n())})(t)},get direction(){return n()},set direction(t){(t=>{e(r(),t)})(t)}}}get basePadding2(){let t=()=>Q.from(this.domNode.dataset.basePadding2),e=(t,e)=>{let r=new Q(t,e);this.domNode.dataset.basePadding2=r.toJSON(),B(this,$,"m",W).call(this)},r=()=>t().magnitude,n=()=>t().direction;return{get magnitude(){return r()},set magnitude(t){(t=>{e(t,n())})(t)},get direction(){return n()},set direction(t){(t=>{e(r(),t)})(t)}}}drag(t,e,r){var n;let i=null==r?void 0:r.dragGroup;if((null==i?void 0:i.has(this.base1.domNode))||(null==i?void 0:i.has(this.base2.domNode)))return;let o=null!==(n=null==r?void 0:r.dragPoint)&&void 0!==n?n:this.domNode.getPointAtLength(this.domNode.getTotalLength()/2),s=Y.matching(this.domNode.getAttribute("d"));s.drag(t,e,{dragPoint:o}),this.domNode.setAttribute("d",s.toString()),B(this,$,"m",z).call(this)}save(){return{id:this.id,baseID1:this.base1.id,baseID2:this.base2.id}}static recreate(t,e){if(!(0,H.isNonNullObject)(t))throw new Error(`Saved curved bond isn't an object: ${t}.`);let r=t.id;if(!(0,H.isString)(r))throw new Error(`Saved curved bond ID isn't a string: ${r}.`);let n=t.baseID1,i=t.baseID2;if(!(0,H.isString)(n))throw new Error(`Saved curved bond base 1 ID isn't a string: ${n}.`);if(!(0,H.isString)(i))throw new Error(`Saved curved bond base 2 ID isn't a string: ${i}.`);let o=e.domNode.querySelector("#"+r);if(!o)throw new Error("Unable to find saved curved bond DOM node in parent drawing by ID.");if(!(o instanceof SVGPathElement))throw new Error(`Saved curved bond DOM node isn't an SVG path element: ${o}.`);let s=[...e.bases],a=s.find(t=>t.id===n),u=s.find(t=>t.id===i);if(!a)throw new Error("Unable to find base 1 in parent drawing.");if(!u)throw new Error("Unable to find base 2 in parent drawing.");return new K(o,a,u)}}$=new WeakSet,W=function(){let t=Q.from(this.domNode.dataset.basePadding1),e=Q.from(this.domNode.dataset.basePadding2);t=B(this,$,"m",G).call(this,t),e=B(this,$,"m",J).call(this,e);let r=Y.matching(this.domNode.getAttribute("d")),n=(0,R.midpoint)(r.startPoint,r.endPoint),i=r.interveningPoints.map(t=>[R.Point.matching(t),n.displacementTo(t)]);i.forEach(([t,e])=>e.direction-=(0,j.direction)(r.startPoint,r.endPoint)),r.startPoint.set(R.Point.matching(this.base1.centerPoint).displaced(t)),r.endPoint.set(R.Point.matching(this.base2.centerPoint).displaced(e)),n=(0,R.midpoint)(r.startPoint,r.endPoint),i.forEach(([t,e])=>e.direction+=(0,j.direction)(r.startPoint,r.endPoint)),i.forEach(([t,e])=>t.set(n.displaced(e))),this.domNode.setAttribute("d",r.toString())},z=function(){let t=Y.matching(this.domNode.getAttribute("d")),e=Q.matching(R.Point.matching(this.base1.centerPoint).displacementTo(t.startPoint)),r=Q.matching(R.Point.matching(this.base2.centerPoint).displacementTo(t.endPoint));e=B(this,$,"m",Z).call(this,e),r=B(this,$,"m",q).call(this,r),this.domNode.dataset.basePadding1=e.toJSON(),this.domNode.dataset.basePadding2=r.toJSON()},G=function(t){let e=Q.matching(t);return e.direction+=(0,j.direction)(this.base1.centerPoint,this.base2.centerPoint),e},J=function(t){let e=Q.matching(t);return e.direction+=(0,j.direction)(this.base2.centerPoint,this.base1.centerPoint),e},Z=function(t){let e=Q.matching(t);return e.direction-=(0,j.direction)(this.base1.centerPoint,this.base2.centerPoint),e},q=function(t){let e=Q.matching(t);return e.direction-=(0,j.direction)(this.base2.centerPoint,this.base1.centerPoint),e}})(),n})());
|