@rnacanvas/draw.floating 4.0.0 → 4.0.2

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 CHANGED
@@ -12,7 +12,16 @@ All exports of this package can be accessed as named imports.
12
12
 
13
13
  ```javascript
14
14
  // some example imports
15
- import { Text, Circle, Rectangle, Triangle } from '@rnacanvas/draw.floating';
15
+ import {
16
+ Text,
17
+ Circle,
18
+ Rectangle,
19
+ Triangle,
20
+ StrungText,
21
+ StrungCircle,
22
+ StrungRectangle,
23
+ StrungTriangle,
24
+ } from '@rnacanvas/draw.floating';
16
25
  ```
17
26
 
18
27
  ## `class Text`
@@ -974,3 +983,541 @@ triangle2.domNode === triangle1.domNode; // true
974
983
 
975
984
  triangle2 === triangle1; // false
976
985
  ```
986
+
987
+ ## `class StrungText`
988
+
989
+ A strung text element.
990
+
991
+ ```javascript
992
+ var owner = someBond;
993
+
994
+ var strungText = StrungText.on(owner);
995
+
996
+ strungText.owner === owner; // true
997
+
998
+ strungText.domNode instanceof SVGTextElement; // true
999
+ ```
1000
+
1001
+ ### `static on()`
1002
+
1003
+ Creates a new strung text element for the specified owner.
1004
+
1005
+ ```javascript
1006
+ var owner = someBond;
1007
+
1008
+ var strungText = StrungText.on(owner);
1009
+
1010
+ strungText.owner === owner; // true
1011
+ ```
1012
+
1013
+ This method creates a new text element under the hood and wraps it in a strung text element.
1014
+
1015
+ ### `constructor()`
1016
+
1017
+ Constructs a strung text element wrapping the specified text element and owner.
1018
+
1019
+ ```javascript
1020
+ var text = Text.create('A');
1021
+
1022
+ var owner = someBond;
1023
+
1024
+ var strungText = new StrungText(text, owner);
1025
+
1026
+ strungText.domNode === text.domNode; // true
1027
+
1028
+ strungText.owner === owner; // true
1029
+ ```
1030
+
1031
+ The wrapped text element is not modified in any way during construction.
1032
+
1033
+ ### `readonly domNode`
1034
+
1035
+ The underlying SVG text element corresponding to the strung text element.
1036
+
1037
+ ```javascript
1038
+ var text = Text.create('A');
1039
+
1040
+ var owner = someBond;
1041
+
1042
+ var strungText = new StrungText(text, owner);
1043
+
1044
+ strungText.domNode === text.domNode; // true
1045
+ ```
1046
+
1047
+ ### `owner`
1048
+
1049
+ The owner of the strung text element.
1050
+
1051
+ ```javascript
1052
+ var owner = someBond;
1053
+
1054
+ var strungText = StrungText.on(owner);
1055
+
1056
+ strungText.owner === owner; // true
1057
+ ```
1058
+
1059
+ This is typically the bond or other element that the strung item is attached to.
1060
+
1061
+ ### `textContent`
1062
+
1063
+ The text content of the wrapped text element.
1064
+
1065
+ ```javascript
1066
+ var text = Text.create('A');
1067
+
1068
+ var owner = someBond;
1069
+
1070
+ var strungText = new StrungText(text, owner);
1071
+
1072
+ strungText.textContent; // "A"
1073
+
1074
+ strungText.domNode.textContent = 'B';
1075
+
1076
+ strungText.textContent; // "B"
1077
+ ```
1078
+
1079
+ ### `save()`
1080
+
1081
+ Returns the serialized form of the strung text element,
1082
+ which is a JSON-serializable object.
1083
+
1084
+ ```javascript
1085
+ var owner = someBond;
1086
+
1087
+ var strungText = StrungText.on(owner);
1088
+
1089
+ var savedStrungText = strungText.save();
1090
+
1091
+ savedStrungText.text.id; // has a UUID
1092
+ savedStrungText.ownerID; // the owner bond ID
1093
+ ```
1094
+
1095
+ ### `static recreate()`
1096
+
1097
+ Recreates a saved strung text element given the parent drawing that its DOM node is in.
1098
+
1099
+ ```javascript
1100
+ var owner = someBond;
1101
+
1102
+ var strungText1 = StrungText.on(owner);
1103
+
1104
+ parentDrawing.domNode.append(strungText1.domNode);
1105
+
1106
+ var savedStrungText = strungText1.save();
1107
+
1108
+ var strungText2 = StrungText.recreate(savedStrungText, parentDrawing);
1109
+
1110
+ strungText2.domNode === strungText1.domNode; // true
1111
+
1112
+ strungText2.owner === owner; // true
1113
+
1114
+ strungText2 === strungText1; // false
1115
+ ```
1116
+
1117
+ ## `class StrungCircle`
1118
+
1119
+ A strung circle element.
1120
+
1121
+ ```javascript
1122
+ var owner = someBond;
1123
+
1124
+ var strungCircle = StrungCircle.on(owner);
1125
+
1126
+ strungCircle.owner === owner; // true
1127
+
1128
+ strungCircle.domNode instanceof SVGCircleElement; // true
1129
+ ```
1130
+
1131
+ ### `static on()`
1132
+
1133
+ Creates a new strung circle element for the specified owner.
1134
+
1135
+ ```javascript
1136
+ var owner = someBond;
1137
+
1138
+ var strungCircle = StrungCircle.on(owner);
1139
+
1140
+ strungCircle.owner === owner; // true
1141
+ ```
1142
+
1143
+ This method creates a new circle element under the hood and wraps it in a strung circle element.
1144
+
1145
+ ### `constructor()`
1146
+
1147
+ Constructs a strung circle element wrapping the specified circle element and owner.
1148
+
1149
+ ```javascript
1150
+ var circle = Circle.create();
1151
+
1152
+ var owner = someBond;
1153
+
1154
+ var strungCircle = new StrungCircle(circle, owner);
1155
+
1156
+ strungCircle.domNode === circle.domNode; // true
1157
+
1158
+ strungCircle.owner === owner; // true
1159
+ ```
1160
+
1161
+ ### `readonly domNode`
1162
+
1163
+ The underlying SVG circle element corresponding to the strung circle element.
1164
+
1165
+ ```javascript
1166
+ var circle = Circle.create();
1167
+
1168
+ var owner = someBond;
1169
+
1170
+ var strungCircle = new StrungCircle(circle, owner);
1171
+
1172
+ strungCircle.domNode === circle.domNode; // true
1173
+ ```
1174
+
1175
+ ### `owner`
1176
+
1177
+ The owner of the strung circle element.
1178
+
1179
+ ```javascript
1180
+ var owner = someBond;
1181
+
1182
+ var strungCircle = StrungCircle.on(owner);
1183
+
1184
+ strungCircle.owner === owner; // true
1185
+ ```
1186
+
1187
+ ### `save()`
1188
+
1189
+ Returns the serialized form of the strung circle element,
1190
+ which is a JSON-serializable object.
1191
+
1192
+ ```javascript
1193
+ var owner = someBond;
1194
+
1195
+ var strungCircle = StrungCircle.on(owner);
1196
+
1197
+ var savedStrungCircle = strungCircle.save();
1198
+
1199
+ savedStrungCircle.circle.id; // has a UUID
1200
+ savedStrungCircle.ownerID; // the owner bond ID
1201
+ ```
1202
+
1203
+ ### `static recreate()`
1204
+
1205
+ Recreates a saved strung circle element given the parent drawing that its DOM node is in.
1206
+
1207
+ ```javascript
1208
+ var owner = someBond;
1209
+
1210
+ var strungCircle1 = StrungCircle.on(owner);
1211
+
1212
+ parentDrawing.domNode.append(strungCircle1.domNode);
1213
+
1214
+ var savedStrungCircle = strungCircle1.save();
1215
+
1216
+ var strungCircle2 = StrungCircle.recreate(savedStrungCircle, parentDrawing);
1217
+
1218
+ strungCircle2.domNode === strungCircle1.domNode; // true
1219
+
1220
+ strungCircle2.owner === owner; // true
1221
+
1222
+ strungCircle2 === strungCircle1; // false
1223
+ ```
1224
+
1225
+ ## `class StrungRectangle`
1226
+
1227
+ A strung rectangle element.
1228
+
1229
+ ```javascript
1230
+ var owner = someBond;
1231
+
1232
+ var strungRectangle = StrungRectangle.on(owner);
1233
+
1234
+ strungRectangle.owner === owner; // true
1235
+
1236
+ strungRectangle.domNode instanceof SVGPathElement; // true
1237
+ ```
1238
+
1239
+ ### `static on()`
1240
+
1241
+ Creates a new strung rectangle element for the specified owner.
1242
+
1243
+ ```javascript
1244
+ var owner = someBond;
1245
+
1246
+ var strungRectangle = StrungRectangle.on(owner);
1247
+
1248
+ strungRectangle.owner === owner; // true
1249
+ ```
1250
+
1251
+ This method creates a new rectangle element under the hood and wraps it in a strung rectangle element.
1252
+
1253
+ ### `constructor()`
1254
+
1255
+ Constructs a strung rectangle element wrapping the specified rectangle element and owner.
1256
+
1257
+ ```javascript
1258
+ var rectangle = Rectangle.create();
1259
+
1260
+ var owner = someBond;
1261
+
1262
+ var strungRectangle = new StrungRectangle(rectangle, owner);
1263
+
1264
+ strungRectangle.domNode === rectangle.domNode; // true
1265
+
1266
+ strungRectangle.owner === owner; // true
1267
+ ```
1268
+
1269
+ ### `readonly domNode`
1270
+
1271
+ The underlying SVG path element corresponding to the strung rectangle element.
1272
+
1273
+ ```javascript
1274
+ var rectangle = Rectangle.create();
1275
+
1276
+ var owner = someBond;
1277
+
1278
+ var strungRectangle = new StrungRectangle(rectangle, owner);
1279
+
1280
+ strungRectangle.domNode === rectangle.domNode; // true
1281
+ ```
1282
+
1283
+ ### `owner`
1284
+
1285
+ The owner of the strung rectangle element.
1286
+
1287
+ ```javascript
1288
+ var owner = someBond;
1289
+
1290
+ var strungRectangle = StrungRectangle.on(owner);
1291
+
1292
+ strungRectangle.owner === owner; // true
1293
+ ```
1294
+
1295
+ ### `width`
1296
+
1297
+ The width of the wrapped rectangle element.
1298
+
1299
+ ```javascript
1300
+ var owner = someBond;
1301
+
1302
+ var strungRectangle = StrungRectangle.on(owner);
1303
+
1304
+ strungRectangle.width = 12.4;
1305
+
1306
+ strungRectangle.width; // 12.4
1307
+ ```
1308
+
1309
+ ### `height`
1310
+
1311
+ The height of the wrapped rectangle element.
1312
+
1313
+ ```javascript
1314
+ var owner = someBond;
1315
+
1316
+ var strungRectangle = StrungRectangle.on(owner);
1317
+
1318
+ strungRectangle.height = 18.7;
1319
+
1320
+ strungRectangle.height; // 18.7
1321
+ ```
1322
+
1323
+ ### `cornerRadius`
1324
+
1325
+ Controls how rounded the corners of the wrapped rectangle are.
1326
+
1327
+ ```javascript
1328
+ var owner = someBond;
1329
+
1330
+ var strungRectangle = StrungRectangle.on(owner);
1331
+
1332
+ strungRectangle.cornerRadius = 8.21;
1333
+
1334
+ strungRectangle.cornerRadius; // 8.21
1335
+ ```
1336
+
1337
+ ### `save()`
1338
+
1339
+ Returns the serialized form of the strung rectangle element,
1340
+ which is a JSON-serializable object.
1341
+
1342
+ ```javascript
1343
+ var owner = someBond;
1344
+
1345
+ var strungRectangle = StrungRectangle.on(owner);
1346
+
1347
+ var savedStrungRectangle = strungRectangle.save();
1348
+
1349
+ savedStrungRectangle.rectangle.id; // has a UUID
1350
+ savedStrungRectangle.ownerID; // the owner bond ID
1351
+ ```
1352
+
1353
+ ### `static recreate()`
1354
+
1355
+ Recreates a saved strung rectangle element given the parent drawing that its DOM node is in.
1356
+
1357
+ ```javascript
1358
+ var owner = someBond;
1359
+
1360
+ var strungRectangle1 = StrungRectangle.on(owner);
1361
+
1362
+ parentDrawing.domNode.append(strungRectangle1.domNode);
1363
+
1364
+ var savedStrungRectangle = strungRectangle1.save();
1365
+
1366
+ var strungRectangle2 = StrungRectangle.recreate(savedStrungRectangle, parentDrawing);
1367
+
1368
+ strungRectangle2.domNode === strungRectangle1.domNode; // true
1369
+
1370
+ strungRectangle2.owner === owner; // true
1371
+
1372
+ strungRectangle2 === strungRectangle1; // false
1373
+ ```
1374
+
1375
+ ## `class StrungTriangle`
1376
+
1377
+ A strung triangle element.
1378
+
1379
+ ```javascript
1380
+ var owner = someBond;
1381
+
1382
+ var strungTriangle = StrungTriangle.on(owner);
1383
+
1384
+ strungTriangle.owner === owner; // true
1385
+
1386
+ strungTriangle.domNode instanceof SVGPathElement; // true
1387
+ ```
1388
+
1389
+ ### `static on()`
1390
+
1391
+ Creates a new strung triangle element for the specified owner.
1392
+
1393
+ ```javascript
1394
+ var owner = someBond;
1395
+
1396
+ var strungTriangle = StrungTriangle.on(owner);
1397
+
1398
+ strungTriangle.owner === owner; // true
1399
+ ```
1400
+
1401
+ This method creates a new triangle element under the hood and wraps it in a strung triangle element.
1402
+
1403
+ ### `constructor()`
1404
+
1405
+ Constructs a strung triangle element wrapping the specified triangle element and owner.
1406
+
1407
+ ```javascript
1408
+ var triangle = Triangle.create();
1409
+
1410
+ var owner = someBond;
1411
+
1412
+ var strungTriangle = new StrungTriangle(triangle, owner);
1413
+
1414
+ strungTriangle.domNode === triangle.domNode; // true
1415
+
1416
+ strungTriangle.owner === owner; // true
1417
+ ```
1418
+
1419
+ ### `readonly domNode`
1420
+
1421
+ The underlying SVG path element corresponding to the strung triangle element.
1422
+
1423
+ ```javascript
1424
+ var triangle = Triangle.create();
1425
+
1426
+ var owner = someBond;
1427
+
1428
+ var strungTriangle = new StrungTriangle(triangle, owner);
1429
+
1430
+ strungTriangle.domNode === triangle.domNode; // true
1431
+ ```
1432
+
1433
+ ### `owner`
1434
+
1435
+ The owner of the strung triangle element.
1436
+
1437
+ ```javascript
1438
+ var owner = someBond;
1439
+
1440
+ var strungTriangle = StrungTriangle.on(owner);
1441
+
1442
+ strungTriangle.owner === owner; // true
1443
+ ```
1444
+
1445
+ ### `width`
1446
+
1447
+ The width of the wrapped triangle element.
1448
+
1449
+ ```javascript
1450
+ var owner = someBond;
1451
+
1452
+ var strungTriangle = StrungTriangle.on(owner);
1453
+
1454
+ strungTriangle.width = 12.4;
1455
+
1456
+ strungTriangle.width; // 12.4
1457
+ ```
1458
+
1459
+ ### `height`
1460
+
1461
+ The height of the wrapped triangle element.
1462
+
1463
+ ```javascript
1464
+ var owner = someBond;
1465
+
1466
+ var strungTriangle = StrungTriangle.on(owner);
1467
+
1468
+ strungTriangle.height = 18.7;
1469
+
1470
+ strungTriangle.height; // 18.7
1471
+ ```
1472
+
1473
+ ### `tailsHeight`
1474
+
1475
+ Controls the tails height of the wrapped triangle element.
1476
+
1477
+ ```javascript
1478
+ var owner = someBond;
1479
+
1480
+ var strungTriangle = StrungTriangle.on(owner);
1481
+
1482
+ strungTriangle.tailsHeight = 7.5;
1483
+
1484
+ strungTriangle.tailsHeight; // 7.5
1485
+ ```
1486
+
1487
+ ### `save()`
1488
+
1489
+ Returns the serialized form of the strung triangle element,
1490
+ which is a JSON-serializable object.
1491
+
1492
+ ```javascript
1493
+ var owner = someBond;
1494
+
1495
+ var strungTriangle = StrungTriangle.on(owner);
1496
+
1497
+ var savedStrungTriangle = strungTriangle.save();
1498
+
1499
+ savedStrungTriangle.triangle.id; // has a UUID
1500
+ savedStrungTriangle.ownerID; // the owner bond ID
1501
+ ```
1502
+
1503
+ ### `static recreate()`
1504
+
1505
+ Recreates a saved strung triangle element given the parent drawing that its DOM node is in.
1506
+
1507
+ ```javascript
1508
+ var owner = someBond;
1509
+
1510
+ var strungTriangle1 = StrungTriangle.on(owner);
1511
+
1512
+ parentDrawing.domNode.append(strungTriangle1.domNode);
1513
+
1514
+ var savedStrungTriangle = strungTriangle1.save();
1515
+
1516
+ var strungTriangle2 = StrungTriangle.recreate(savedStrungTriangle, parentDrawing);
1517
+
1518
+ strungTriangle2.domNode === strungTriangle1.domNode; // true
1519
+
1520
+ strungTriangle2.owner === owner; // true
1521
+
1522
+ strungTriangle2 === strungTriangle1; // false
1523
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../src/Rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAQvC;;GAEG;AACH,qBAAa,SAAS;;IAwCR,QAAQ,CAAC,OAAO,EAAE,cAAc;IAvC5C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,IAAI,SAAS;gBAiCL,OAAO,EAAE,cAAc;IAsB5C,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAKhC,IAAI,SAAS,IAAI,MAAM,CAItB;IAED,IAAI,SAAS,CAAC,SAAS,EANN,MAMM,EAStB;IAED,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED,IAAI,KAAK,CAAC,KAAK,EANF,MAME,EASd;IAED,IAAI,MAAM,IAAI,MAAM,CAInB;IAED,IAAI,MAAM,CAAC,MAAM,EANH,MAMG,EAShB;IAED,IAAI,YAAY,IAAI,MAAM,CAIzB;IAED,IAAI,YAAY,CAAC,YAAY,EANT,MAMS,EAS5B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,GAAG,CAEd;IAkBD;;;;;OAKG;IACH,UAAU;;;IAUV;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK;CA0CpF"}
1
+ {"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../src/Rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAQvC;;GAEG;AACH,qBAAa,SAAS;;IAwCR,QAAQ,CAAC,OAAO,EAAE,cAAc;IAvC5C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,IAAI,SAAS;gBAiCL,OAAO,EAAE,cAAc;IAsB5C,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAKhC,IAAI,SAAS,IAAI,MAAM,CAItB;IAED,IAAI,SAAS,CAAC,SAAS,EANN,MAMM,EAStB;IAED,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED,IAAI,KAAK,CAAC,KAAK,EANF,MAME,EASd;IAED,IAAI,MAAM,IAAI,MAAM,CAInB;IAED,IAAI,MAAM,CAAC,MAAM,EANH,MAMG,EAShB;IAED,IAAI,YAAY,IAAI,MAAM,CAIzB;IAED,IAAI,YAAY,CAAC,YAAY,EANT,MAMS,EAS5B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,GAAG,CAEd;IAkBD;;;;;OAKG;IACH,UAAU;;;IAUV;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK;CAqCpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Triangle.d.ts","sourceRoot":"","sources":["../src/Triangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAQvC;;GAEG;AACH,qBAAa,QAAQ;;IAwCP,QAAQ,CAAC,OAAO,EAAE,cAAc;IAvC5C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,IAAI,QAAQ;gBAiCJ,OAAO,EAAE,cAAc;IAsB5C,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAKhC,IAAI,SAAS,IAAI,MAAM,CAItB;IAED,IAAI,SAAS,CAAC,SAAS,EANN,MAMM,EAStB;IAED,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED,IAAI,KAAK,CAAC,KAAK,EANF,MAME,EASd;IAED,IAAI,MAAM,IAAI,MAAM,CAInB;IAED,IAAI,MAAM,CAAC,MAAM,EANH,MAMG,EAShB;IAED,IAAI,WAAW,IAAI,MAAM,CAIxB;IAED,IAAI,WAAW,CAAC,WAAW,EANR,MAMQ,EAS1B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,GAAG,CAEd;IAkBD;;;;;OAKG;IACH,UAAU;;;IAUV;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK;CAyClF"}
1
+ {"version":3,"file":"Triangle.d.ts","sourceRoot":"","sources":["../src/Triangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAQvC;;GAEG;AACH,qBAAa,QAAQ;;IAwCP,QAAQ,CAAC,OAAO,EAAE,cAAc;IAvC5C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,IAAI,QAAQ;gBAiCJ,OAAO,EAAE,cAAc;IAsB5C,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAKhC,IAAI,SAAS,IAAI,MAAM,CAItB;IAED,IAAI,SAAS,CAAC,SAAS,EANN,MAMM,EAStB;IAED,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED,IAAI,KAAK,CAAC,KAAK,EANF,MAME,EASd;IAED,IAAI,MAAM,IAAI,MAAM,CAInB;IAED,IAAI,MAAM,CAAC,MAAM,EANH,MAMG,EAShB;IAED,IAAI,WAAW,IAAI,MAAM,CAIxB;IAED,IAAI,WAAW,CAAC,WAAW,EANR,MAMQ,EAS1B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,GAAG,CAEd;IAkBD;;;;;OAKG;IACH,UAAU;;;IAUV;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK;CAoClF"}
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.floating"]=e():t["draw.floating"]=e()}(this,()=>(()=>{var t={645(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)/t.length}function n(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>m,average:()=>i,clamp:()=>l,degrees:()=>y,flipAway:()=>w,isBetween:()=>h,isBetweenExclusive:()=>d,isBetweenInclusive:()=>h,max:()=>c,mean:()=>i,median:()=>a,min:()=>u,normalizeAngle:()=>N,radians:()=>p,round:()=>b,sortNumbers:()=>n,sortNumbersAscending:()=>n,sortNumbersDescending:()=>f,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>g,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return n(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,n=r-1;return i([e[r],e[n]])}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 d(t,e,r){return t>e&&t<r}function l(t,e,r){return t<e?e:t>r?r:t}function m(t,e,r){return Math.abs(t-e)<=r}function f(t){n(t),t.reverse()}function g(t){var e=s(t);return e.reverse(),e}function b(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function y(t){return t*(180/Math.PI)}function p(t){return t*(Math.PI/180)}function N(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 w(t,e){var r=(e=N(e,t))-t;return(r<Math.PI/2||r>3*Math.PI/2)&&(t+=Math.PI),t}return e})()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{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=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{Box:()=>e});var t=r(986);class e{static matching(t){let{x:r,y:i,width:n,height:o}=t;return new e(r,i,n,o)}static bounding(r){let i=[...r];if(0==i.length)throw new Error("An empty collection of boxes doesn't have a bounding box.");let n=i.map(t=>e.matching(t)),o=(0,t.min)(n.map(t=>t.left)),s=(0,t.min)(n.map(t=>t.top)),a=(0,t.max)(n.map(t=>t.right))-o,u=(0,t.max)(n.map(t=>t.bottom))-s;return new e(o,s,a,u)}constructor(t,e,r,i){this.x=t,this.y=e,this.width=r,this.height=i}get centerX(){return this.minX+this.width/2}get centerY(){return this.minY+this.height/2}get minX(){return this.x}get minY(){return this.y}get maxX(){return this.minX+this.width}get maxY(){return this.minY+this.height}get top(){return this.minY}get right(){return this.maxX}get bottom(){return this.maxY}get left(){return this.minX}bounds(t){let r=e.matching(t);return this.minX<=r.minX&&this.minY<=r.minY&&this.maxX>=r.maxX&&this.maxY>=r.maxY}padded(...t){let r="number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.width:t[0].percentage/100*this.width,i="number"==typeof t[0]&&"number"==typeof t[1]?t[1]:"number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.height:t[0].percentage/100*this.height;return new e(this.x-r,this.y-i,this.width+2*r,this.height+2*i)}get periphery(){return{atAngle:t=>{let e=this.width/2,r=this.height/2,i=Math.pow(Math.pow(e,2)+Math.pow(r,2),.5),n=this.centerX+i*Math.cos(t),o=this.centerY+i*Math.sin(t),s=i;return Math.abs(this.centerX-n)>e&&(s=Math.abs(e/Math.cos(t)),s=Number.isFinite(s)?s:r),Math.abs(this.centerY-o)>r&&(s=Math.abs(r/Math.sin(t)),s=Number.isFinite(s)?s:e),{x:this.centerX+s*Math.cos(t),y:this.centerY+s*Math.sin(t)}}}}}})(),i})(),t.exports=e()},731(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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,{CenterPoint:()=>c});var r,i,n,o,s,a=function(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r},u=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class c{constructor(t){r.add(this),i.set(this,void 0),n.set(this,{move:[]}),o.set(this,void 0),a(this,i,t,"f"),a(this,o,new MutationObserver(()=>u(this,r,"m",s).call(this,"move")),"f"),u(this,o,"f").observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}get x(){let t=u(this,i,"f").getBBox();return t.x+t.width/2}set x(t){let e=this.x,r=[...u(this,i,"f").x.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),u(this,i,"f").setAttribute("x",r.join(", "))}get y(){let t=u(this,i,"f").getBBox();return t.y+t.height/2}set y(t){let e=this.y,r=[...u(this,i,"f").y.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),u(this,i,"f").setAttribute("y",r.join(", "))}addEventListener(t,e){u(this,n,"f")[t].push(e)}removeEventListener(t,e){u(this,n,"f")[t]=u(this,n,"f")[t].filter(t=>t!==e)}}return i=new WeakMap,n=new WeakMap,o=new WeakMap,r=new WeakSet,s=function(t){u(this,n,"f")[t].forEach(t=>t())},e})(),t.exports=e()},456(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)/t.length}function n(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>m,average:()=>i,clamp:()=>l,degrees:()=>y,flipAway:()=>w,isBetween:()=>h,isBetweenExclusive:()=>d,isBetweenInclusive:()=>h,max:()=>c,mean:()=>i,median:()=>a,min:()=>u,normalizeAngle:()=>N,radians:()=>p,round:()=>b,sortNumbers:()=>n,sortNumbersAscending:()=>n,sortNumbersDescending:()=>f,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>g,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return n(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,n=r-1;return i([e[r],e[n]])}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 d(t,e,r){return t>e&&t<r}function l(t,e,r){return t<e?e:t>r?r:t}function m(t,e,r){return Math.abs(t-e)<=r}function f(t){n(t),t.reverse()}function g(t){var e=s(t);return e.reverse(),e}function b(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function y(t){return t*(180/Math.PI)}function p(t){return t*(Math.PI/180)}function N(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 w(t,e){var r=(e=N(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 i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)&&Number.isFinite(t)}function n(t){return r(t)&&!Number.isFinite(t)}function o(t){return i(t)&&t>0}function s(t){return i(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 d(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function l(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function f(t){return!t}function g(t){return null==t}function b(t){return"object"==typeof t&&null!==t}function y(t){return Array.isArray(t)}function p(t){return y(t)&&0==t.length}function N(t){return y(t)&&t.length>0}function w(t){return y(t)&&t.every(r)}function v(t){return w(t)&&t.length>0}function x(t){return y(t)&&t.every(i)}function S(t){return y(t)&&t.every(n)}function M(t){return y(t)&&t.every(a)}function P(t){return M(t)&&t.length>0}function A(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>y,isEmptyArray:()=>p,isEmptyString:()=>u,isFalsy:()=>f,isFiniteNumber:()=>i,isFiniteNumbersArray:()=>x,isJSON:()=>d,isJSONSerializable:()=>l,isNonEmptyArray:()=>N,isNonEmptyNumbersArray:()=>v,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>P,isNonFiniteNumber:()=>n,isNonFiniteNumbersArray:()=>S,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>b,isNullish:()=>g,isNumber:()=>r,isNumbersArray:()=>w,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>A,isString:()=>a,isStringsArray:()=>M,isTruthy:()=>m,isWhitespace:()=>h}),e})()},277(t){var e;e=()=>(()=>{var t={854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)&&Number.isFinite(t)}function n(t){return r(t)&&!Number.isFinite(t)}function o(t){return i(t)&&t>0}function s(t){return i(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 d(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function l(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function f(t){return!t}function g(t){return null==t}function b(t){return"object"==typeof t&&null!==t}function y(t){return Array.isArray(t)}function p(t){return y(t)&&0==t.length}function N(t){return y(t)&&t.length>0}function w(t){return y(t)&&t.every(r)}function v(t){return w(t)&&t.length>0}function x(t){return y(t)&&t.every(i)}function S(t){return y(t)&&t.every(n)}function M(t){return y(t)&&t.every(a)}function P(t){return M(t)&&t.length>0}function A(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>y,isEmptyArray:()=>p,isEmptyString:()=>u,isFalsy:()=>f,isFiniteNumber:()=>i,isFiniteNumbersArray:()=>x,isJSON:()=>d,isJSONSerializable:()=>l,isNonEmptyArray:()=>N,isNonEmptyNumbersArray:()=>v,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>P,isNonFiniteNumber:()=>n,isNonFiniteNumbersArray:()=>S,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>b,isNullish:()=>g,isNumber:()=>r,isNumbersArray:()=>w,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>A,isString:()=>a,isStringsArray:()=>M,isTruthy:()=>m,isWhitespace:()=>h}),e})()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{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=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{Vector:()=>e,isFiniteVectorLike:()=>o,isVectorLike:()=>n});var t=r(854);class e{static matching(t){let r="x"in t?t.x:t.magnitude*Math.cos(t.direction),i="y"in t?t.y:t.magnitude*Math.sin(t.direction);return new e(r,i)}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 n(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!!n(t)&&e.matching(t).isFinite()}})(),i})(),t.exports=e()}};const e={};function r(i){const n=e[i];if(void 0!==n)return n.exports;const o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{if(Array.isArray(e))for(var i=0;i<e.length;){var n=e[i++],o=e[i++];r.o(t,n)?0===o&&i++:0===o?Object.defineProperty(t,n,{enumerable:!0,value:e[i++]}):Object.defineProperty(t,n,{enumerable:!0,get:o})}else 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=>{Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let i={};return(()=>{"use strict";r.r(i),r.d(i,{FinitePoint:()=>o,Point:()=>n,RelativePoint:()=>l,midpoint:()=>f});var t=r(277),e=r(854);class n{static matching(t){return new n(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)}drag(t,e){this.displace({x:t,y:e})}displace(e){let r=t.Vector.matching(e);this.x+=r.x,this.y+=r.y}displaced(t){let e=n.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}deepCopy(){return new n(this.x,this.y)}}class o extends n{static matching(t){let e=n.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 n(0,0);e.set(...t),o.matching(e),super.set(...t)}}var s,a,u,c,h,d=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class l{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",()=>d(this,s,"m",h).call(this,"move"))}get x(){return d(this,a,"f").x+d(this,u,"f").x}set x(t){d(this,u,"f").x=t-d(this,a,"f").x,d(this,s,"m",h).call(this,"move")}get y(){return d(this,a,"f").y+d(this,u,"f").y}set y(t){d(this,u,"f").y=t-d(this,a,"f").y,d(this,s,"m",h).call(this,"move")}addEventListener(t,e){d(this,c,"f")[t].push(e)}removeEventListener(t,e){d(this,c,"f")[t]=d(this,c,"f")[t].filter(t=>t!==e)}}a=new WeakMap,u=new WeakMap,c=new WeakMap,s=new WeakSet,h=function(t){d(this,c,"f")[t].forEach(t=>t())};var m=r(986);function f(t,e){return new n((0,m.average)([t.x,e.x]),(0,m.average)([t.y,e.y]))}})(),i})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)&&Number.isFinite(t)}function n(t){return r(t)&&!Number.isFinite(t)}function o(t){return i(t)&&t>0}function s(t){return i(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 d(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function l(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function f(t){return!t}function g(t){return null==t}function b(t){return"object"==typeof t&&null!==t}function y(t){return Array.isArray(t)}function p(t){return y(t)&&0==t.length}function N(t){return y(t)&&t.length>0}function w(t){return y(t)&&t.every(r)}function v(t){return w(t)&&t.length>0}function x(t){return y(t)&&t.every(i)}function S(t){return y(t)&&t.every(n)}function M(t){return y(t)&&t.every(a)}function P(t){return M(t)&&t.length>0}function A(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>y,isEmptyArray:()=>p,isEmptyString:()=>u,isFalsy:()=>f,isFiniteNumber:()=>i,isFiniteNumbersArray:()=>x,isJSON:()=>d,isJSONSerializable:()=>l,isNonEmptyArray:()=>N,isNonEmptyNumbersArray:()=>v,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>P,isNonFiniteNumber:()=>n,isNonFiniteNumbersArray:()=>S,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>b,isNullish:()=>g,isNumber:()=>r,isNumbersArray:()=>w,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>A,isString:()=>a,isStringsArray:()=>M,isTruthy:()=>m,isWhitespace:()=>h}),e})()}};const e={};function r(i){const n=e[i];if(void 0!==n)return n.exports;const o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{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=>{Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let i={};return(()=>{"use strict";r.r(i),r.d(i,{Circle:()=>l,Rectangle:()=>w,Text:()=>d,Triangle:()=>F});const t={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let e;const n=new Uint8Array(16),o=[];for(let t=0;t<256;++t)o.push((t+256).toString(16).slice(1));function s(t,r,i){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(n)}();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((i=i||0)<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let t=0;t<16;++t)r[i+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(e,r,i){return!t.randomUUID||r||e?s(e,r,i):t.randomUUID()};var u=r(645),c=r(731),h=r(854);class d{static create(t){let e=document.createElementNS("http://www.w3.org/2000/svg","text");return e.id="id-"+a(),e.textContent=null!=t?t:"",e.setAttribute("font-family","Arial"),e.setAttribute("font-size","9"),e.setAttribute("font-weight","700"),e.setAttribute("font-style","normal"),e.setAttribute("fill","black"),e.setAttribute("fill-opacity","1"),new d(e)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get bbox(){return u.Box.matching(this.domNode.getBBox())}get centerX(){return this.bbox.centerX}set centerX(t){new c.CenterPoint(this.domNode).x=t}get centerY(){return this.bbox.centerY}set centerY(t){new c.CenterPoint(this.domNode).y=t}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Text element ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved text element is not an object: ${t}.`);if(!t.id)throw new Error("Saved text element ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved text element ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find text element DOM node in parent drawing by ID.");if(!(r instanceof SVGTextElement))throw new Error(`Text element DOM node is not an SVG text element: ${r}.`);return new d(r)}}class l{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","circle");return t.id="id-"+a(),t.setAttribute("r","6"),t.setAttribute("stroke","black"),t.setAttribute("stroke-width","1"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-dasharray",""),t.setAttribute("stroke-linecap",""),t.setAttribute("fill","white"),t.setAttribute("fill-opacity","1"),new l(t)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get centerX(){return this.domNode.cx.baseVal.value}set centerX(t){this.domNode.setAttribute("cx",`${t}`)}get centerY(){return this.domNode.cy.baseVal.value}set centerY(t){this.domNode.setAttribute("cy",`${t}`)}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Circle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved circle must be an object: ${t}.`);if(!t.id)throw new Error("Saved circle ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved circle ID must be a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find circle element DOM node by ID.");if(!(r instanceof SVGCircleElement))throw new Error(`Circle element DOM node is not an SVG circle element: ${r}.`);return new l(r)}}var m=r(456);class f{constructor(){this.centerX=0,this.centerY=0,this.direction=-Math.PI/2,this.width=0,this.height=0,this.cornerRadius=0}static matching(t){let e=new f;return e.centerX=t.centerX,e.centerY=t.centerY,e.direction=t.direction,e.width=t.width,e.height=t.height,e.cornerRadius=t.cornerRadius,e}toString(){let t=new m.Point(this.centerX,this.centerY);t.displace({magnitude:this.height/2,direction:this.direction}),t.displace({magnitude:this.width/2-this.cornerRadius,direction:this.direction+Math.PI/2});let e=`M ${t.x} ${t.y}`;return t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+3*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.height-2*this.cornerRadius,direction:this.direction+Math.PI}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+5*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.width-2*this.cornerRadius,direction:this.direction+3*Math.PI/2}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+7*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.height-2*this.cornerRadius,direction:this.direction}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+9*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,e+=" Z",e}}var g,b,y,p,N=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class w{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","path");t.id="id-"+a();let e=new w(t);return e.centerX=0,e.centerY=0,e.direction=-Math.PI/2,e.width=5.5,e.height=5.5,e.cornerRadius=0,e.domNode.setAttribute("stroke","black"),e.domNode.setAttribute("stroke-width","1"),e.domNode.setAttribute("stroke-opacity","1"),e.domNode.setAttribute("stroke-linejoin",""),e.domNode.setAttribute("stroke-dasharray",""),e.domNode.setAttribute("stroke-linecap",""),e.domNode.setAttribute("fill","white"),e.domNode.setAttribute("fill-opacity","1"),e}constructor(t){g.add(this),this.domNode=t,t.dataset.centerX||N(this,g,"m",b).call(this),t.dataset.centerY||N(this,g,"m",y).call(this)}get id(){return this.domNode.id}get centerX(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerX)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerX(t){Number.isFinite(t)?(this.domNode.dataset.centerX=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified center X coordinate is nonfinite: ${t}.`)}get centerY(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerY)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerY(t){Number.isFinite(t)?(this.domNode.dataset.centerY=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified center Y coordinate is nonfinite: ${t}.`)}drag(t,e){this.centerX+=t,this.centerY+=e}get direction(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.direction)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set direction(t){Number.isFinite(t)?(this.domNode.dataset.direction=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified direction angle is nonfinite: ${t}.`)}get width(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.width)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set width(t){Number.isFinite(t)?(this.domNode.dataset.width=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified width is nonfinite: ${t}.`)}get height(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.height)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set height(t){Number.isFinite(t)?(this.domNode.dataset.height=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified height is nonfinite: ${t}.`)}get cornerRadius(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.cornerRadius)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set cornerRadius(t){Number.isFinite(t)?(this.domNode.dataset.cornerRadius=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified corner radius is nonfinite: ${t}.`)}get bbox(){return u.Box.matching(this.domNode.getBBox())}serialized(){if(!this.id)throw new Error("Rectangle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved rectangle is not an object: ${t}.`);if(!t.id)throw new Error("Saved rectangle ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved rectangle ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find saved rectangle DOM node in parent drawing by ID.");if(!(r instanceof SVGPathElement))throw new Error(`DOM node found for saved rectangle is not an SVG path element: ${r}.`);let i=new w(r);return(0,h.isFiniteNumber)(t.width)&&(i.width=t.width),(0,h.isFiniteNumber)(t.height)&&(i.height=t.height),(0,h.isFiniteNumber)(t.borderRadius)&&(i.cornerRadius=t.borderRadius),(0,h.isFiniteNumber)(t.rotation)&&(i.direction=t.rotation-Math.PI/2),i}}g=new WeakSet,b=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerX=`${t.centerX}`},y=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerY=`${t.centerY}`},p=function(){let t=new f;t.centerX=this.centerX,t.centerY=this.centerY,t.direction=this.direction,t.width=this.width,t.height=this.height,t.cornerRadius=this.cornerRadius,this.domNode.setAttribute("d",t.toString())};class v{constructor(){this.centerX=0,this.centerY=0,this.direction=-Math.PI/2,this.width=0,this.height=0,this.tailsHeight=0}static matching(t){let e=new v;return e.centerX=t.centerX,e.centerY=t.centerY,e.direction=t.direction,e.width=t.width,e.height=t.height,e.tailsHeight=t.tailsHeight,e}toString(){let t=new m.Point(this.centerX,this.centerY),e=t.displaced({magnitude:this.height/2,direction:this.direction}),r=t.displaced({magnitude:this.width/2,direction:this.direction-Math.PI/2}).displaced({magnitude:this.height/2,direction:this.direction+Math.PI}),i=t.displaced({magnitude:this.width/2,direction:this.direction+Math.PI/2}).displaced({magnitude:this.height/2,direction:this.direction+Math.PI}),n=t.displaced({magnitude:this.height/2-this.tailsHeight,direction:this.direction+Math.PI});return`M ${e.x} ${e.y} L ${i.x} ${i.y} L ${n.x} ${n.y} L ${r.x} ${r.y} Z`}}var x,S,M,P,A=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class F{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","path");t.id="id-"+a();let e=new F(t);return e.centerX=0,e.centerY=0,e.direction=-Math.PI/2,e.width=6.5,e.height=6.5,e.tailsHeight=0,e.domNode.setAttribute("stroke","black"),e.domNode.setAttribute("stroke-width","1"),e.domNode.setAttribute("stroke-opacity","1"),e.domNode.setAttribute("stroke-linejoin",""),e.domNode.setAttribute("stroke-dasharray",""),e.domNode.setAttribute("stroke-linecap",""),e.domNode.setAttribute("fill","white"),e.domNode.setAttribute("fill-opacity","1"),e}constructor(t){x.add(this),this.domNode=t,t.dataset.centerX||A(this,x,"m",S).call(this),t.dataset.centerY||A(this,x,"m",M).call(this)}get id(){return this.domNode.id}get centerX(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerX)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerX(t){Number.isFinite(t)?(this.domNode.dataset.centerX=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified center X coordinate is nonfinite: ${t}.`)}get centerY(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerY)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerY(t){Number.isFinite(t)?(this.domNode.dataset.centerY=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified center Y coordinate is nonfinite: ${t}.`)}drag(t,e){this.centerX+=t,this.centerY+=e}get direction(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.direction)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set direction(t){Number.isFinite(t)?(this.domNode.dataset.direction=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified direction angle is nonfinite: ${t}.`)}get width(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.width)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set width(t){Number.isFinite(t)?(this.domNode.dataset.width=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified width is nonfinite: ${t}.`)}get height(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.height)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set height(t){Number.isFinite(t)?(this.domNode.dataset.height=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified height is nonfinite: ${t}.`)}get tailsHeight(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.tailsHeight)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set tailsHeight(t){Number.isFinite(t)?(this.domNode.dataset.tailsHeight=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified tails height is nonfinite: ${t}.`)}get bbox(){return u.Box.matching(this.domNode.getBBox())}serialized(){if(!this.id)throw new Error("Triangle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved triangle is not an object: ${t}.`);if(!t.id)throw new Error("Saved triangle ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved triangle ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find saved triangle DOM node in parent drawing by ID.");if(!(r instanceof SVGPathElement))throw new Error(`DOM node found for saved triangle is not an SVG path element: ${r}.`);let i=new F(r);return(0,h.isFiniteNumber)(t.width)&&(i.width=t.width),(0,h.isFiniteNumber)(t.height)&&(i.height=t.height),(0,h.isFiniteNumber)(t.tailsHeight)&&(i.tailsHeight=t.tailsHeight),(0,h.isFiniteNumber)(t.rotation)&&(i.direction=t.rotation-Math.PI/2),i}}x=new WeakSet,S=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerX=`${t.centerX}`},M=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerY=`${t.centerY}`},P=function(){let t=new v;t.centerX=this.centerX,t.centerY=this.centerY,t.direction=this.direction,t.width=this.width,t.height=this.height,t.tailsHeight=this.tailsHeight,this.domNode.setAttribute("d",t.toString())}})(),i})());
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.floating"]=e():t["draw.floating"]=e()}(this,()=>(()=>{var t={645(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)/t.length}function n(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>m,average:()=>i,clamp:()=>l,degrees:()=>b,flipAway:()=>w,isBetween:()=>h,isBetweenExclusive:()=>d,isBetweenInclusive:()=>h,max:()=>c,mean:()=>i,median:()=>a,min:()=>u,normalizeAngle:()=>N,radians:()=>p,round:()=>y,sortNumbers:()=>n,sortNumbersAscending:()=>n,sortNumbersDescending:()=>f,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>g,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return n(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,n=r-1;return i([e[r],e[n]])}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 d(t,e,r){return t>e&&t<r}function l(t,e,r){return t<e?e:t>r?r:t}function m(t,e,r){return Math.abs(t-e)<=r}function f(t){n(t),t.reverse()}function g(t){var e=s(t);return e.reverse(),e}function y(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function b(t){return t*(180/Math.PI)}function p(t){return t*(Math.PI/180)}function N(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 w(t,e){var r=(e=N(e,t))-t;return(r<Math.PI/2||r>3*Math.PI/2)&&(t+=Math.PI),t}return e})()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{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=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{Box:()=>e});var t=r(986);class e{static matching(t){let{x:r,y:i,width:n,height:o}=t;return new e(r,i,n,o)}static bounding(r){let i=[...r];if(0==i.length)throw new Error("An empty collection of boxes doesn't have a bounding box.");let n=i.map(t=>e.matching(t)),o=(0,t.min)(n.map(t=>t.left)),s=(0,t.min)(n.map(t=>t.top)),a=(0,t.max)(n.map(t=>t.right))-o,u=(0,t.max)(n.map(t=>t.bottom))-s;return new e(o,s,a,u)}constructor(t,e,r,i){this.x=t,this.y=e,this.width=r,this.height=i}get centerX(){return this.minX+this.width/2}get centerY(){return this.minY+this.height/2}get minX(){return this.x}get minY(){return this.y}get maxX(){return this.minX+this.width}get maxY(){return this.minY+this.height}get top(){return this.minY}get right(){return this.maxX}get bottom(){return this.maxY}get left(){return this.minX}bounds(t){let r=e.matching(t);return this.minX<=r.minX&&this.minY<=r.minY&&this.maxX>=r.maxX&&this.maxY>=r.maxY}padded(...t){let r="number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.width:t[0].percentage/100*this.width,i="number"==typeof t[0]&&"number"==typeof t[1]?t[1]:"number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.height:t[0].percentage/100*this.height;return new e(this.x-r,this.y-i,this.width+2*r,this.height+2*i)}get periphery(){return{atAngle:t=>{let e=this.width/2,r=this.height/2,i=Math.pow(Math.pow(e,2)+Math.pow(r,2),.5),n=this.centerX+i*Math.cos(t),o=this.centerY+i*Math.sin(t),s=i;return Math.abs(this.centerX-n)>e&&(s=Math.abs(e/Math.cos(t)),s=Number.isFinite(s)?s:r),Math.abs(this.centerY-o)>r&&(s=Math.abs(r/Math.sin(t)),s=Number.isFinite(s)?s:e),{x:this.centerX+s*Math.cos(t),y:this.centerY+s*Math.sin(t)}}}}}})(),i})(),t.exports=e()},731(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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,{CenterPoint:()=>c});var r,i,n,o,s,a=function(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r},u=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class c{constructor(t){r.add(this),i.set(this,void 0),n.set(this,{move:[]}),o.set(this,void 0),a(this,i,t,"f"),a(this,o,new MutationObserver(()=>u(this,r,"m",s).call(this,"move")),"f"),u(this,o,"f").observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}get x(){let t=u(this,i,"f").getBBox();return t.x+t.width/2}set x(t){let e=this.x,r=[...u(this,i,"f").x.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),u(this,i,"f").setAttribute("x",r.join(", "))}get y(){let t=u(this,i,"f").getBBox();return t.y+t.height/2}set y(t){let e=this.y,r=[...u(this,i,"f").y.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),u(this,i,"f").setAttribute("y",r.join(", "))}addEventListener(t,e){u(this,n,"f")[t].push(e)}removeEventListener(t,e){u(this,n,"f")[t]=u(this,n,"f")[t].filter(t=>t!==e)}}return i=new WeakMap,n=new WeakMap,o=new WeakMap,r=new WeakSet,s=function(t){u(this,n,"f")[t].forEach(t=>t())},e})(),t.exports=e()},456(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)/t.length}function n(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>m,average:()=>i,clamp:()=>l,degrees:()=>b,flipAway:()=>w,isBetween:()=>h,isBetweenExclusive:()=>d,isBetweenInclusive:()=>h,max:()=>c,mean:()=>i,median:()=>a,min:()=>u,normalizeAngle:()=>N,radians:()=>p,round:()=>y,sortNumbers:()=>n,sortNumbersAscending:()=>n,sortNumbersDescending:()=>f,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>g,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return n(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,n=r-1;return i([e[r],e[n]])}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 d(t,e,r){return t>e&&t<r}function l(t,e,r){return t<e?e:t>r?r:t}function m(t,e,r){return Math.abs(t-e)<=r}function f(t){n(t),t.reverse()}function g(t){var e=s(t);return e.reverse(),e}function y(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function b(t){return t*(180/Math.PI)}function p(t){return t*(Math.PI/180)}function N(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 w(t,e){var r=(e=N(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 i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)&&Number.isFinite(t)}function n(t){return r(t)&&!Number.isFinite(t)}function o(t){return i(t)&&t>0}function s(t){return i(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 d(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function l(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function f(t){return!t}function g(t){return null==t}function y(t){return"object"==typeof t&&null!==t}function b(t){return Array.isArray(t)}function p(t){return b(t)&&0==t.length}function N(t){return b(t)&&t.length>0}function w(t){return b(t)&&t.every(r)}function v(t){return w(t)&&t.length>0}function x(t){return b(t)&&t.every(i)}function S(t){return b(t)&&t.every(n)}function M(t){return b(t)&&t.every(a)}function P(t){return M(t)&&t.length>0}function A(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>b,isEmptyArray:()=>p,isEmptyString:()=>u,isFalsy:()=>f,isFiniteNumber:()=>i,isFiniteNumbersArray:()=>x,isJSON:()=>d,isJSONSerializable:()=>l,isNonEmptyArray:()=>N,isNonEmptyNumbersArray:()=>v,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>P,isNonFiniteNumber:()=>n,isNonFiniteNumbersArray:()=>S,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>y,isNullish:()=>g,isNumber:()=>r,isNumbersArray:()=>w,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>A,isString:()=>a,isStringsArray:()=>M,isTruthy:()=>m,isWhitespace:()=>h}),e})()},277(t){var e;e=()=>(()=>{var t={854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)&&Number.isFinite(t)}function n(t){return r(t)&&!Number.isFinite(t)}function o(t){return i(t)&&t>0}function s(t){return i(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 d(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function l(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function f(t){return!t}function g(t){return null==t}function y(t){return"object"==typeof t&&null!==t}function b(t){return Array.isArray(t)}function p(t){return b(t)&&0==t.length}function N(t){return b(t)&&t.length>0}function w(t){return b(t)&&t.every(r)}function v(t){return w(t)&&t.length>0}function x(t){return b(t)&&t.every(i)}function S(t){return b(t)&&t.every(n)}function M(t){return b(t)&&t.every(a)}function P(t){return M(t)&&t.length>0}function A(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>b,isEmptyArray:()=>p,isEmptyString:()=>u,isFalsy:()=>f,isFiniteNumber:()=>i,isFiniteNumbersArray:()=>x,isJSON:()=>d,isJSONSerializable:()=>l,isNonEmptyArray:()=>N,isNonEmptyNumbersArray:()=>v,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>P,isNonFiniteNumber:()=>n,isNonFiniteNumbersArray:()=>S,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>y,isNullish:()=>g,isNumber:()=>r,isNumbersArray:()=>w,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>A,isString:()=>a,isStringsArray:()=>M,isTruthy:()=>m,isWhitespace:()=>h}),e})()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{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=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{Vector:()=>e,isFiniteVectorLike:()=>o,isVectorLike:()=>n});var t=r(854);class e{static matching(t){let r="x"in t?t.x:t.magnitude*Math.cos(t.direction),i="y"in t?t.y:t.magnitude*Math.sin(t.direction);return new e(r,i)}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 n(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!!n(t)&&e.matching(t).isFinite()}})(),i})(),t.exports=e()}};const e={};function r(i){const n=e[i];if(void 0!==n)return n.exports;const o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{if(Array.isArray(e))for(var i=0;i<e.length;){var n=e[i++],o=e[i++];r.o(t,n)?0===o&&i++:0===o?Object.defineProperty(t,n,{enumerable:!0,value:e[i++]}):Object.defineProperty(t,n,{enumerable:!0,get:o})}else 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=>{Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let i={};return(()=>{"use strict";r.r(i),r.d(i,{FinitePoint:()=>o,Point:()=>n,RelativePoint:()=>l,midpoint:()=>f});var t=r(277),e=r(854);class n{static matching(t){return new n(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)}drag(t,e){this.displace({x:t,y:e})}displace(e){let r=t.Vector.matching(e);this.x+=r.x,this.y+=r.y}displaced(t){let e=n.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}deepCopy(){return new n(this.x,this.y)}}class o extends n{static matching(t){let e=n.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 n(0,0);e.set(...t),o.matching(e),super.set(...t)}}var s,a,u,c,h,d=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class l{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",()=>d(this,s,"m",h).call(this,"move"))}get x(){return d(this,a,"f").x+d(this,u,"f").x}set x(t){d(this,u,"f").x=t-d(this,a,"f").x,d(this,s,"m",h).call(this,"move")}get y(){return d(this,a,"f").y+d(this,u,"f").y}set y(t){d(this,u,"f").y=t-d(this,a,"f").y,d(this,s,"m",h).call(this,"move")}addEventListener(t,e){d(this,c,"f")[t].push(e)}removeEventListener(t,e){d(this,c,"f")[t]=d(this,c,"f")[t].filter(t=>t!==e)}}a=new WeakMap,u=new WeakMap,c=new WeakMap,s=new WeakSet,h=function(t){d(this,c,"f")[t].forEach(t=>t())};var m=r(986);function f(t,e){return new n((0,m.average)([t.x,e.x]),(0,m.average)([t.y,e.y]))}})(),i})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},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 i(t){return r(t)&&Number.isFinite(t)}function n(t){return r(t)&&!Number.isFinite(t)}function o(t){return i(t)&&t>0}function s(t){return i(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 d(t){if(!a(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function l(t){try{return JSON.stringify(t),!0}catch{return!1}}function m(t){return!!t}function f(t){return!t}function g(t){return null==t}function y(t){return"object"==typeof t&&null!==t}function b(t){return Array.isArray(t)}function p(t){return b(t)&&0==t.length}function N(t){return b(t)&&t.length>0}function w(t){return b(t)&&t.every(r)}function v(t){return w(t)&&t.length>0}function x(t){return b(t)&&t.every(i)}function S(t){return b(t)&&t.every(n)}function M(t){return b(t)&&t.every(a)}function P(t){return M(t)&&t.length>0}function A(t){return t instanceof SVGGraphicsElement}return t.r(e),t.d(e,{isArray:()=>b,isEmptyArray:()=>p,isEmptyString:()=>u,isFalsy:()=>f,isFiniteNumber:()=>i,isFiniteNumbersArray:()=>x,isJSON:()=>d,isJSONSerializable:()=>l,isNonEmptyArray:()=>N,isNonEmptyNumbersArray:()=>v,isNonEmptyString:()=>c,isNonEmptyStringsArray:()=>P,isNonFiniteNumber:()=>n,isNonFiniteNumbersArray:()=>S,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>y,isNullish:()=>g,isNumber:()=>r,isNumbersArray:()=>w,isPositiveFiniteNumber:()=>o,isSVGGraphicsElement:()=>A,isString:()=>a,isStringsArray:()=>M,isTruthy:()=>m,isWhitespace:()=>h}),e})()}};const e={};function r(i){const n=e[i];if(void 0!==n)return n.exports;const o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{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=>{Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let i={};return(()=>{"use strict";r.r(i),r.d(i,{Circle:()=>l,Rectangle:()=>w,Text:()=>d,Triangle:()=>E});const t={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let e;const n=new Uint8Array(16),o=[];for(let t=0;t<256;++t)o.push((t+256).toString(16).slice(1));function s(t,r,i){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(n)}();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((i=i||0)<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let t=0;t<16;++t)r[i+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(e,r,i){return!t.randomUUID||r||e?s(e,r,i):t.randomUUID()};var u=r(645),c=r(731),h=r(854);class d{static create(t){let e=document.createElementNS("http://www.w3.org/2000/svg","text");return e.id="id-"+a(),e.textContent=null!=t?t:"",e.setAttribute("font-family","Arial"),e.setAttribute("font-size","9"),e.setAttribute("font-weight","700"),e.setAttribute("font-style","normal"),e.setAttribute("fill","black"),e.setAttribute("fill-opacity","1"),new d(e)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get bbox(){return u.Box.matching(this.domNode.getBBox())}get centerX(){return this.bbox.centerX}set centerX(t){new c.CenterPoint(this.domNode).x=t}get centerY(){return this.bbox.centerY}set centerY(t){new c.CenterPoint(this.domNode).y=t}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Text element ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved text element is not an object: ${t}.`);if(!t.id)throw new Error("Saved text element ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved text element ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find text element DOM node in parent drawing by ID.");if(!(r instanceof SVGTextElement))throw new Error(`Text element DOM node is not an SVG text element: ${r}.`);return new d(r)}}class l{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","circle");return t.id="id-"+a(),t.setAttribute("r","6"),t.setAttribute("stroke","black"),t.setAttribute("stroke-width","1"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-dasharray",""),t.setAttribute("stroke-linecap",""),t.setAttribute("fill","white"),t.setAttribute("fill-opacity","1"),new l(t)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get centerX(){return this.domNode.cx.baseVal.value}set centerX(t){this.domNode.setAttribute("cx",`${t}`)}get centerY(){return this.domNode.cy.baseVal.value}set centerY(t){this.domNode.setAttribute("cy",`${t}`)}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Circle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved circle must be an object: ${t}.`);if(!t.id)throw new Error("Saved circle ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved circle ID must be a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find circle element DOM node by ID.");if(!(r instanceof SVGCircleElement))throw new Error(`Circle element DOM node is not an SVG circle element: ${r}.`);return new l(r)}}var m=r(456);class f{constructor(){this.centerX=0,this.centerY=0,this.direction=-Math.PI/2,this.width=0,this.height=0,this.cornerRadius=0}static matching(t){let e=new f;return e.centerX=t.centerX,e.centerY=t.centerY,e.direction=t.direction,e.width=t.width,e.height=t.height,e.cornerRadius=t.cornerRadius,e}toString(){let t=new m.Point(this.centerX,this.centerY);t.displace({magnitude:this.height/2,direction:this.direction}),t.displace({magnitude:this.width/2-this.cornerRadius,direction:this.direction+Math.PI/2});let e=`M ${t.x} ${t.y}`;return t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+3*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.height-2*this.cornerRadius,direction:this.direction+Math.PI}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+5*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.width-2*this.cornerRadius,direction:this.direction+3*Math.PI/2}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+7*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.height-2*this.cornerRadius,direction:this.direction}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+9*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,e+=" Z",e}}var g,y,b,p,N=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class w{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","path");t.id="id-"+a();let e=new w(t);return e.centerX=0,e.centerY=0,e.direction=-Math.PI/2,e.width=5.5,e.height=5.5,e.cornerRadius=0,e.domNode.setAttribute("stroke","black"),e.domNode.setAttribute("stroke-width","1"),e.domNode.setAttribute("stroke-opacity","1"),e.domNode.setAttribute("stroke-linejoin",""),e.domNode.setAttribute("stroke-dasharray",""),e.domNode.setAttribute("stroke-linecap",""),e.domNode.setAttribute("fill","white"),e.domNode.setAttribute("fill-opacity","1"),e}constructor(t){g.add(this),this.domNode=t,t.dataset.centerX||N(this,g,"m",y).call(this),t.dataset.centerY||N(this,g,"m",b).call(this)}get id(){return this.domNode.id}get centerX(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerX)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerX(t){Number.isFinite(t)?(this.domNode.dataset.centerX=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified center X coordinate is nonfinite: ${t}.`)}get centerY(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerY)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerY(t){Number.isFinite(t)?(this.domNode.dataset.centerY=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified center Y coordinate is nonfinite: ${t}.`)}drag(t,e){this.centerX+=t,this.centerY+=e}get direction(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.direction)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set direction(t){Number.isFinite(t)?(this.domNode.dataset.direction=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified direction angle is nonfinite: ${t}.`)}get width(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.width)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set width(t){Number.isFinite(t)?(this.domNode.dataset.width=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified width is nonfinite: ${t}.`)}get height(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.height)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set height(t){Number.isFinite(t)?(this.domNode.dataset.height=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified height is nonfinite: ${t}.`)}get cornerRadius(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.cornerRadius)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set cornerRadius(t){Number.isFinite(t)?(this.domNode.dataset.cornerRadius=`${t}`,N(this,g,"m",p).call(this)):console.error(`The specified corner radius is nonfinite: ${t}.`)}get bbox(){return u.Box.matching(this.domNode.getBBox())}serialized(){if(!this.id)throw new Error("Rectangle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved rectangle is not an object: ${t}.`);if(!t.id)throw new Error("Saved rectangle ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved rectangle ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find saved rectangle DOM node in parent drawing by ID.");if(!(r instanceof SVGPathElement))throw new Error(`DOM node found for saved rectangle is not an SVG path element: ${r}.`);let i=new w(r);return(0,h.isFiniteNumber)(t.width)&&(i.width=t.width),(0,h.isFiniteNumber)(t.height)&&(i.height=t.height),(0,h.isFiniteNumber)(t.borderRadius)&&(i.cornerRadius=t.borderRadius),i}}g=new WeakSet,y=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerX=`${t.centerX}`},b=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerY=`${t.centerY}`},p=function(){let t=new f;t.centerX=this.centerX,t.centerY=this.centerY,t.direction=this.direction,t.width=this.width,t.height=this.height,t.cornerRadius=this.cornerRadius,this.domNode.setAttribute("d",t.toString())};class v{constructor(){this.centerX=0,this.centerY=0,this.direction=-Math.PI/2,this.width=0,this.height=0,this.tailsHeight=0}static matching(t){let e=new v;return e.centerX=t.centerX,e.centerY=t.centerY,e.direction=t.direction,e.width=t.width,e.height=t.height,e.tailsHeight=t.tailsHeight,e}toString(){let t=new m.Point(this.centerX,this.centerY),e=t.displaced({magnitude:this.height/2,direction:this.direction}),r=t.displaced({magnitude:this.width/2,direction:this.direction-Math.PI/2}).displaced({magnitude:this.height/2,direction:this.direction+Math.PI}),i=t.displaced({magnitude:this.width/2,direction:this.direction+Math.PI/2}).displaced({magnitude:this.height/2,direction:this.direction+Math.PI}),n=t.displaced({magnitude:this.height/2-this.tailsHeight,direction:this.direction+Math.PI});return`M ${e.x} ${e.y} L ${i.x} ${i.y} L ${n.x} ${n.y} L ${r.x} ${r.y} Z`}}var x,S,M,P,A=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class E{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","path");t.id="id-"+a();let e=new E(t);return e.centerX=0,e.centerY=0,e.direction=-Math.PI/2,e.width=6.5,e.height=6.5,e.tailsHeight=0,e.domNode.setAttribute("stroke","black"),e.domNode.setAttribute("stroke-width","1"),e.domNode.setAttribute("stroke-opacity","1"),e.domNode.setAttribute("stroke-linejoin",""),e.domNode.setAttribute("stroke-dasharray",""),e.domNode.setAttribute("stroke-linecap",""),e.domNode.setAttribute("fill","white"),e.domNode.setAttribute("fill-opacity","1"),e}constructor(t){x.add(this),this.domNode=t,t.dataset.centerX||A(this,x,"m",S).call(this),t.dataset.centerY||A(this,x,"m",M).call(this)}get id(){return this.domNode.id}get centerX(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerX)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerX(t){Number.isFinite(t)?(this.domNode.dataset.centerX=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified center X coordinate is nonfinite: ${t}.`)}get centerY(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerY)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerY(t){Number.isFinite(t)?(this.domNode.dataset.centerY=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified center Y coordinate is nonfinite: ${t}.`)}drag(t,e){this.centerX+=t,this.centerY+=e}get direction(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.direction)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set direction(t){Number.isFinite(t)?(this.domNode.dataset.direction=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified direction angle is nonfinite: ${t}.`)}get width(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.width)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set width(t){Number.isFinite(t)?(this.domNode.dataset.width=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified width is nonfinite: ${t}.`)}get height(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.height)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set height(t){Number.isFinite(t)?(this.domNode.dataset.height=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified height is nonfinite: ${t}.`)}get tailsHeight(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.tailsHeight)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set tailsHeight(t){Number.isFinite(t)?(this.domNode.dataset.tailsHeight=`${t}`,A(this,x,"m",P).call(this)):console.error(`The specified tails height is nonfinite: ${t}.`)}get bbox(){return u.Box.matching(this.domNode.getBBox())}serialized(){if(!this.id)throw new Error("Triangle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,h.isNonNullObject)(t))throw new Error(`Saved triangle is not an object: ${t}.`);if(!t.id)throw new Error("Saved triangle ID is falsy.");if(!(0,h.isString)(t.id))throw new Error(`Saved triangle ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find saved triangle DOM node in parent drawing by ID.");if(!(r instanceof SVGPathElement))throw new Error(`DOM node found for saved triangle is not an SVG path element: ${r}.`);let i=new E(r);return(0,h.isFiniteNumber)(t.width)&&(i.width=t.width),(0,h.isFiniteNumber)(t.height)&&(i.height=t.height),(0,h.isFiniteNumber)(t.tailsHeight)&&(i.tailsHeight=t.tailsHeight),i}}x=new WeakSet,S=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerX=`${t.centerX}`},M=function(){let t=u.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerY=`${t.centerY}`},P=function(){let t=new v;t.centerX=this.centerX,t.centerY=this.centerY,t.direction=this.direction,t.width=this.width,t.height=this.height,t.tailsHeight=this.tailsHeight,this.domNode.setAttribute("d",t.toString())}})(),i})());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/draw.floating",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Draw floating elements",
5
5
  "repository": {
6
6
  "type": "git",