cubing 0.63.7 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/bin/chunks/{chunk-6YZ4AUWL.js → chunk-DQNBCFR3.js} +2 -2
  2. package/dist/bin/chunks/{chunk-6YZ4AUWL.js.map → chunk-DQNBCFR3.js.map} +1 -1
  3. package/dist/bin/order.js +1 -1
  4. package/dist/bin/order.js.map +1 -1
  5. package/dist/bin/puzzle-geometry-bin.js +1 -1
  6. package/dist/bin/puzzle-geometry-bin.js.map +1 -1
  7. package/dist/bin/scramble.js +1 -1
  8. package/dist/bin/scramble.js.map +1 -1
  9. package/dist/bin/svg.js +1 -1
  10. package/dist/bin/svg.js.map +1 -1
  11. package/dist/lib/cubing/alg/index.d.ts +1 -1
  12. package/dist/lib/cubing/alg/index.js +1 -1
  13. package/dist/lib/cubing/bluetooth/index.d.ts +17 -17
  14. package/dist/lib/cubing/bluetooth/index.js +96 -96
  15. package/dist/lib/cubing/bluetooth/index.js.map +2 -2
  16. package/dist/lib/cubing/chunks/{big-puzzle-orientation-ADWIOX6S.js → big-puzzle-orientation-G75BXW2W.js} +2 -2
  17. package/dist/lib/cubing/chunks/big-puzzle-orientation-G75BXW2W.js.map +7 -0
  18. package/dist/lib/cubing/chunks/{chunk-A7FK4XKU.js → chunk-5LBACZOM.js} +173 -144
  19. package/dist/lib/cubing/chunks/chunk-5LBACZOM.js.map +7 -0
  20. package/dist/lib/cubing/chunks/{chunk-5KMTA6PX.js → chunk-7MYDNYZ3.js} +3 -3
  21. package/dist/lib/cubing/chunks/chunk-7MYDNYZ3.js.map +7 -0
  22. package/dist/lib/cubing/chunks/{chunk-7LXHWXCO.js → chunk-ALR6ZQFC.js} +2 -2
  23. package/dist/lib/cubing/chunks/chunk-ALR6ZQFC.js.map +7 -0
  24. package/dist/lib/cubing/chunks/{chunk-H5KMIDAF.js → chunk-DTYBGCI3.js} +5 -5
  25. package/dist/lib/cubing/chunks/chunk-DTYBGCI3.js.map +7 -0
  26. package/dist/lib/cubing/chunks/{chunk-YR72E7KZ.js → chunk-GO2SL6SC.js} +38 -38
  27. package/dist/lib/cubing/chunks/chunk-GO2SL6SC.js.map +7 -0
  28. package/dist/lib/cubing/chunks/{chunk-FUAADKXE.js → chunk-KHUP3BPA.js} +35 -34
  29. package/dist/lib/cubing/chunks/chunk-KHUP3BPA.js.map +7 -0
  30. package/dist/lib/cubing/chunks/{chunk-MQSQDKWH.js → chunk-O2QJENHE.js} +3 -3
  31. package/dist/lib/cubing/chunks/chunk-O2QJENHE.js.map +7 -0
  32. package/dist/lib/cubing/chunks/{chunk-5ONX3JVC.js → chunk-THRYJMRP.js} +8 -8
  33. package/dist/lib/cubing/chunks/chunk-THRYJMRP.js.map +7 -0
  34. package/dist/lib/cubing/chunks/{chunk-UEUJSZTX.js → chunk-UWJ575HH.js} +58 -46
  35. package/dist/lib/cubing/chunks/chunk-UWJ575HH.js.map +7 -0
  36. package/dist/lib/cubing/chunks/{chunk-N5FJ5YIA.js → chunk-YFNXHRNE.js} +37 -31
  37. package/dist/lib/cubing/chunks/chunk-YFNXHRNE.js.map +7 -0
  38. package/dist/lib/cubing/chunks/{inside-JAJOK2MI.js → inside-A7LIP56H.js} +14 -14
  39. package/dist/lib/cubing/chunks/inside-A7LIP56H.js.map +7 -0
  40. package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-IMYJ533P.js → puzzles-dynamic-side-events-653A7JCM.js} +1 -1
  41. package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-653A7JCM.js.map +7 -0
  42. package/dist/lib/cubing/chunks/{puzzles-dynamic-unofficial-P3TW433I.js → puzzles-dynamic-unofficial-2CY6GVZ4.js} +1 -1
  43. package/dist/lib/cubing/chunks/{puzzles-dynamic-unofficial-P3TW433I.js.map → puzzles-dynamic-unofficial-2CY6GVZ4.js.map} +1 -1
  44. package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-WORUZVF5.js → search-dynamic-sgs-side-events-YSB3MWLK.js} +6 -6
  45. package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-YSB3MWLK.js.map +7 -0
  46. package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-5JQKPNG2.js → search-dynamic-sgs-unofficial-OLK64DE6.js} +6 -6
  47. package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-5JQKPNG2.js.map → search-dynamic-sgs-unofficial-OLK64DE6.js.map} +1 -1
  48. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-BGV4AJVT.js → search-dynamic-solve-4x4x4-WWFUMIDG.js} +7 -7
  49. package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-I5ID5LXD.js → search-dynamic-solve-fto-ZZKLTONP.js} +2 -2
  50. package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-Y2D3C74Y.js → search-dynamic-solve-kilominx-PUF4PRHS.js} +2 -2
  51. package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
  52. package/dist/lib/cubing/chunks/search-worker-entry.js.map +2 -2
  53. package/dist/lib/cubing/chunks/{twips-ZNMKGC5U.js → twips-LHO3IYJC.js} +2 -2
  54. package/dist/lib/cubing/chunks/{twisty-dynamic-3d-4BEQ76PB.js → twisty-dynamic-3d-A2G22YLA.js} +6 -6
  55. package/dist/lib/cubing/chunks/twisty-dynamic-3d-A2G22YLA.js.map +7 -0
  56. package/dist/lib/cubing/{index-B2leUGbW.d.ts → index-C2x6Sc62.d.ts} +52 -47
  57. package/dist/lib/cubing/{index-BLw2OxXo.d.ts → index-Doa1gNE4.d.ts} +1 -1
  58. package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
  59. package/dist/lib/cubing/kpuzzle/index.js +2 -2
  60. package/dist/lib/cubing/notation/index.d.ts +17 -15
  61. package/dist/lib/cubing/notation/index.js +4 -4
  62. package/dist/lib/cubing/{outside-V6_PW1ZK.d.ts → outside-nf-4k7Tp.d.ts} +1 -1
  63. package/dist/lib/cubing/protocol/index.d.ts +1 -1
  64. package/dist/lib/cubing/protocol/index.js +4 -4
  65. package/dist/lib/cubing/puzzle-geometry/index.d.ts +1 -1
  66. package/dist/lib/cubing/puzzle-geometry/index.js +284 -184
  67. package/dist/lib/cubing/puzzle-geometry/index.js.map +2 -2
  68. package/dist/lib/cubing/puzzles/index.d.ts +1 -1
  69. package/dist/lib/cubing/puzzles/index.js +4 -4
  70. package/dist/lib/cubing/scramble/index.d.ts +1 -1
  71. package/dist/lib/cubing/scramble/index.js +6 -6
  72. package/dist/lib/cubing/search/index.d.ts +1 -1
  73. package/dist/lib/cubing/search/index.js +6 -6
  74. package/dist/lib/cubing/search/index.js.map +1 -1
  75. package/dist/lib/cubing/stream/index.d.ts +1 -1
  76. package/dist/lib/cubing/stream/index.js +1 -1
  77. package/dist/lib/cubing/stream/index.js.map +1 -1
  78. package/dist/lib/cubing/twisty/index.d.ts +1 -1
  79. package/dist/lib/cubing/twisty/index.js +190 -180
  80. package/dist/lib/cubing/twisty/index.js.map +2 -2
  81. package/package.json +2 -2
  82. package/dist/lib/cubing/chunks/big-puzzle-orientation-ADWIOX6S.js.map +0 -7
  83. package/dist/lib/cubing/chunks/chunk-5KMTA6PX.js.map +0 -7
  84. package/dist/lib/cubing/chunks/chunk-5ONX3JVC.js.map +0 -7
  85. package/dist/lib/cubing/chunks/chunk-7LXHWXCO.js.map +0 -7
  86. package/dist/lib/cubing/chunks/chunk-A7FK4XKU.js.map +0 -7
  87. package/dist/lib/cubing/chunks/chunk-FUAADKXE.js.map +0 -7
  88. package/dist/lib/cubing/chunks/chunk-H5KMIDAF.js.map +0 -7
  89. package/dist/lib/cubing/chunks/chunk-MQSQDKWH.js.map +0 -7
  90. package/dist/lib/cubing/chunks/chunk-N5FJ5YIA.js.map +0 -7
  91. package/dist/lib/cubing/chunks/chunk-UEUJSZTX.js.map +0 -7
  92. package/dist/lib/cubing/chunks/chunk-YR72E7KZ.js.map +0 -7
  93. package/dist/lib/cubing/chunks/inside-JAJOK2MI.js.map +0 -7
  94. package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-IMYJ533P.js.map +0 -7
  95. package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-WORUZVF5.js.map +0 -7
  96. package/dist/lib/cubing/chunks/twisty-dynamic-3d-4BEQ76PB.js.map +0 -7
  97. /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-BGV4AJVT.js.map → search-dynamic-solve-4x4x4-WWFUMIDG.js.map} +0 -0
  98. /package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-I5ID5LXD.js.map → search-dynamic-solve-fto-ZZKLTONP.js.map} +0 -0
  99. /package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-Y2D3C74Y.js.map → search-dynamic-solve-kilominx-PUF4PRHS.js.map} +0 -0
  100. /package/dist/lib/cubing/chunks/{twips-ZNMKGC5U.js.map → twips-LHO3IYJC.js.map} +0 -0
@@ -1,77 +1,105 @@
1
1
  import {
2
2
  Move,
3
3
  QuantumMove
4
- } from "../chunks/chunk-N5FJ5YIA.js";
4
+ } from "../chunks/chunk-YFNXHRNE.js";
5
5
 
6
6
  // src/cubing/puzzle-geometry/colors.ts
7
+ var PGColors = {
8
+ White: "#ffffff",
9
+ Orange: "#ff8000",
10
+ Green: "#44ee00",
11
+ Red: "#ff0000",
12
+ Blue: "#2266ff",
13
+ Yellow: "#f4f400",
14
+ LightGray: "#aaaaaa",
15
+ MediumGray: "#888888",
16
+ DarkGray: "#5c5c5c",
17
+ Purple: "#8800dd",
18
+ Cream: "#e8d0a0",
19
+ Pink: "#ff66cc",
20
+ BoldBlue: "#0000ff",
21
+ Aqua: "#3399ff",
22
+ DarkGreen: "#008800",
23
+ Lime: "#99ff00",
24
+ Teal: "#007a89",
25
+ Brown: "#7d3b11",
26
+ Lavender: "#b9a1ff",
27
+ SeaGreen: "#5ec4b6",
28
+ harcoal: "#292929",
29
+ Burgundy: "#980000",
30
+ Cerise: "#d41f69"
31
+ };
7
32
  function defaultPlatonicColorSchemes() {
8
33
  return {
9
34
  // the colors should use the same naming convention as the nets, above.
10
35
  4: {
11
- F: "#44ee00" /* Green */,
12
- D: "#f4f400" /* Yellow */,
13
- L: "#ff0000" /* Red */,
14
- R: "#2266ff" /* Blue */
36
+ F: PGColors.Green,
37
+ D: PGColors.Yellow,
38
+ L: PGColors.Red,
39
+ R: PGColors.Blue
15
40
  },
16
41
  6: {
17
- U: "#ffffff" /* White */,
18
- F: "#44ee00" /* Green */,
19
- R: "#ff0000" /* Red */,
20
- D: "#f4f400" /* Yellow */,
21
- B: "#2266ff" /* Blue */,
22
- L: "#ff8000" /* Orange */
42
+ U: PGColors.White,
43
+ F: PGColors.Green,
44
+ R: PGColors.Red,
45
+ D: PGColors.Yellow,
46
+ B: PGColors.Blue,
47
+ L: PGColors.Orange
23
48
  },
24
49
  8: {
25
- U: "#ffffff" /* White */,
26
- F: "#44ee00" /* Green */,
27
- R: "#ff0000" /* Red */,
28
- D: "#f4f400" /* Yellow */,
29
- BB: "#2266ff" /* Blue */,
30
- L: "#8800dd" /* Purple */,
31
- BL: "#ff8000" /* Orange */,
32
- BR: "#888888" /* MediumGray */
50
+ U: PGColors.White,
51
+ F: PGColors.Green,
52
+ R: PGColors.Red,
53
+ D: PGColors.Yellow,
54
+ BB: PGColors.Blue,
55
+ L: PGColors.Purple,
56
+ BL: PGColors.Orange,
57
+ BR: PGColors.MediumGray
33
58
  },
34
59
  12: {
35
- U: "#ffffff" /* White */,
36
- F: "#008800" /* DarkGreen */,
37
- R: "#ff0000" /* Red */,
38
- C: "#e8d0a0" /* Cream */,
39
- A: "#3399ff" /* Aqua */,
40
- L: "#8800dd" /* Purple */,
41
- E: "#ff66cc" /* Pink */,
42
- BF: "#99ff00" /* Lime */,
43
- BR: "#0000ff" /* BoldBlue */,
44
- BL: "#f4f400" /* Yellow */,
45
- I: "#ff8000" /* Orange */,
46
- D: "#888888" /* MediumGray */
60
+ U: PGColors.White,
61
+ F: PGColors.DarkGreen,
62
+ R: PGColors.Red,
63
+ C: PGColors.Cream,
64
+ A: PGColors.Aqua,
65
+ L: PGColors.Purple,
66
+ E: PGColors.Pink,
67
+ BF: PGColors.Lime,
68
+ BR: PGColors.BoldBlue,
69
+ BL: PGColors.Yellow,
70
+ I: PGColors.Orange,
71
+ D: PGColors.MediumGray
47
72
  },
48
73
  20: {
49
- R: "#f4f400" /* Yellow */,
50
- C: "#d41f69" /* Cerise */,
51
- F: "#008800" /* DarkGreen */,
52
- E: "#5c5c5c" /* DarkGray */,
53
- L: "#8800dd" /* Purple */,
54
- U: "#ffffff" /* White */,
55
- A: "#007a89" /* Teal */,
56
- G: "#ff0000" /* Red */,
57
- I: "#7d3b11" /* Brown */,
58
- S: "#b9a1ff" /* Lavender */,
59
- H: "#3399ff" /* Aqua */,
60
- J: "#5ec4b6" /* SeaGreen */,
61
- B: "#44ee00" /* Green */,
62
- K: "#e8d0a0" /* Cream */,
63
- D: "#aaaaaa" /* LightGray */,
64
- M: "#ff66cc" /* Pink */,
65
- O: "#292929" /* harcoal */,
66
- P: "#ff8000" /* Orange */,
67
- N: "#980000" /* Burgundy */,
68
- Q: "#0000ff" /* BoldBlue */
74
+ R: PGColors.Yellow,
75
+ C: PGColors.Cerise,
76
+ F: PGColors.DarkGreen,
77
+ E: PGColors.DarkGray,
78
+ L: PGColors.Purple,
79
+ U: PGColors.White,
80
+ A: PGColors.Teal,
81
+ G: PGColors.Red,
82
+ I: PGColors.Brown,
83
+ S: PGColors.Lavender,
84
+ H: PGColors.Aqua,
85
+ J: PGColors.SeaGreen,
86
+ B: PGColors.Green,
87
+ K: PGColors.Cream,
88
+ D: PGColors.LightGray,
89
+ M: PGColors.Pink,
90
+ O: PGColors.harcoal,
91
+ P: PGColors.Orange,
92
+ N: PGColors.Burgundy,
93
+ Q: PGColors.BoldBlue
69
94
  }
70
95
  };
71
96
  }
72
97
 
73
98
  // src/cubing/puzzle-geometry/FaceNameSwizzler.ts
74
99
  var FaceNameSwizzler = class {
100
+ prefixFree = true;
101
+ gripnames = [];
102
+ facenames;
75
103
  constructor(facenames, gripnames_arg) {
76
104
  this.facenames = facenames;
77
105
  if (gripnames_arg) {
@@ -85,9 +113,6 @@ var FaceNameSwizzler = class {
85
113
  }
86
114
  }
87
115
  }
88
- facenames;
89
- prefixFree = true;
90
- gripnames = [];
91
116
  setGripNames(names) {
92
117
  this.gripnames = names;
93
118
  }
@@ -216,12 +241,12 @@ var FaceNameSwizzler = class {
216
241
 
217
242
  // src/cubing/puzzle-geometry/notation-mapping/FaceRenamingMapper.ts
218
243
  var FaceRenamingMapper = class {
244
+ internalNames;
245
+ externalNames;
219
246
  constructor(internalNames, externalNames) {
220
247
  this.internalNames = internalNames;
221
248
  this.externalNames = externalNames;
222
249
  }
223
- internalNames;
224
- externalNames;
225
250
  // TODO: consider putting a cache in front of this
226
251
  convertString(grip, a, b) {
227
252
  let suffix = "";
@@ -264,12 +289,12 @@ var FaceRenamingMapper = class {
264
289
 
265
290
  // src/cubing/puzzle-geometry/notation-mapping/FTONotationMapper.ts
266
291
  var FTONotationMapper = class {
292
+ child;
293
+ sw;
267
294
  constructor(child, sw) {
268
295
  this.child = child;
269
296
  this.sw = sw;
270
297
  }
271
- child;
272
- sw;
273
298
  notationToInternal(move) {
274
299
  if (move.family === "T" && move.innerLayer === void 0 && move.outerLayer === void 0) {
275
300
  return new Move(
@@ -299,10 +324,10 @@ var FTONotationMapper = class {
299
324
 
300
325
  // src/cubing/puzzle-geometry/notation-mapping/MegaminxScramblingNotationMapper.ts
301
326
  var MegaminxScramblingNotationMapper = class {
327
+ child;
302
328
  constructor(child) {
303
329
  this.child = child;
304
330
  }
305
- child;
306
331
  notationToInternal(move) {
307
332
  if (move.innerLayer === void 0 && move.outerLayer === void 0) {
308
333
  if (Math.abs(move.amount) === 1) {
@@ -369,10 +394,10 @@ var NullMapper = class {
369
394
 
370
395
  // src/cubing/puzzle-geometry/notation-mapping/NxNxNCubeMapper.ts
371
396
  var NxNxNCubeMapper = class {
397
+ slices;
372
398
  constructor(slices) {
373
399
  this.slices = slices;
374
400
  }
375
- slices;
376
401
  notationToInternal(move) {
377
402
  const grip = move.family;
378
403
  if (!(move.innerLayer || move.outerLayer)) {
@@ -494,12 +519,12 @@ var pyraminxFamilyMapWCA = {
494
519
  var pyraminxExternalQuantumY = new QuantumMove("y");
495
520
  var pyraminxInternalQuantumY = new QuantumMove("Dv");
496
521
  var PyraminxNotationMapper = class {
522
+ wcaHack = false;
523
+ map = pyraminxFamilyMap;
524
+ child;
497
525
  constructor(child) {
498
526
  this.child = child;
499
527
  }
500
- child;
501
- wcaHack = false;
502
- map = pyraminxFamilyMap;
503
528
  notationToInternal(move) {
504
529
  if (this.wcaHack && move.innerLayer === 2 && move.outerLayer === null) {
505
530
  const newFamilyWCA = pyraminxFamilyMapWCA[move.family];
@@ -586,10 +611,10 @@ var skewbExternalQuantumZ = new QuantumMove("z");
586
611
  var skewbInternalQuantumZ = new QuantumMove("Fv");
587
612
  var skewbInternalQuantumZPrime = new QuantumMove("Bv");
588
613
  var SkewbNotationMapper = class {
614
+ child;
589
615
  constructor(child) {
590
616
  this.child = child;
591
617
  }
592
- child;
593
618
  notationToInternal(move) {
594
619
  if (move.innerLayer || move.outerLayer) {
595
620
  return null;
@@ -873,12 +898,12 @@ var Perm = class _Perm {
873
898
 
874
899
  // src/cubing/puzzle-geometry/PermOriSet.ts
875
900
  var PGOrbitDef = class {
901
+ size;
902
+ mod;
876
903
  constructor(size, mod) {
877
904
  this.size = size;
878
905
  this.mod = mod;
879
906
  }
880
- size;
881
- mod;
882
907
  reassemblySize() {
883
908
  return factorial(this.size) * BigInt(this.mod) ** BigInt(this.size);
884
909
  }
@@ -893,6 +918,13 @@ function externalName(mapper, moveString) {
893
918
  return mv2.toString();
894
919
  }
895
920
  var PGOrbitsDef = class _PGOrbitsDef {
921
+ orbitnames;
922
+ orbitdefs;
923
+ solved;
924
+ movenames;
925
+ moveops;
926
+ isRotation;
927
+ forcenames;
896
928
  constructor(orbitnames, orbitdefs, solved, movenames, moveops, isRotation, forcenames) {
897
929
  this.orbitnames = orbitnames;
898
930
  this.orbitdefs = orbitdefs;
@@ -902,13 +934,6 @@ var PGOrbitsDef = class _PGOrbitsDef {
902
934
  this.isRotation = isRotation;
903
935
  this.forcenames = forcenames;
904
936
  }
905
- orbitnames;
906
- orbitdefs;
907
- solved;
908
- movenames;
909
- moveops;
910
- isRotation;
911
- forcenames;
912
937
  toKTransformationData(t) {
913
938
  const ktransformationData = {};
914
939
  for (let i = 0; i < this.orbitnames.length; i++) {
@@ -972,12 +997,7 @@ var PGOrbitsDef = class _PGOrbitsDef {
972
997
  result.push("");
973
998
  result.push("Solved");
974
999
  for (let i = 0; i < this.orbitnames.length; i++) {
975
- this.solved.orbits[i].appendDefinition(
976
- result,
977
- this.orbitnames[i],
978
- false,
979
- false
980
- );
1000
+ this.solved.orbits[i].renumberPieces().appendDefinition(result, this.orbitnames[i], false, false);
981
1001
  }
982
1002
  result.push("End");
983
1003
  for (let i = 0; i < this.movenames.length; i++) {
@@ -1203,17 +1223,17 @@ var PGOrbitsDef = class _PGOrbitsDef {
1203
1223
  }
1204
1224
  };
1205
1225
  var PGOrbit = class _PGOrbit {
1206
- constructor(perm, ori, orimod) {
1207
- this.perm = perm;
1208
- this.ori = ori;
1209
- this.orimod = orimod;
1226
+ static ktransformationCache = [];
1227
+ static e(n, mod) {
1228
+ return new _PGOrbit(iota(n), zeros(n), mod);
1210
1229
  }
1211
1230
  perm;
1212
1231
  ori;
1213
1232
  orimod;
1214
- static ktransformationCache = [];
1215
- static e(n, mod) {
1216
- return new _PGOrbit(iota(n), zeros(n), mod);
1233
+ constructor(perm, ori, orimod) {
1234
+ this.perm = perm;
1235
+ this.ori = ori;
1236
+ this.orimod = orimod;
1217
1237
  }
1218
1238
  mul(b) {
1219
1239
  const n = this.perm.length;
@@ -1274,6 +1294,20 @@ var PGOrbit = class _PGOrbit {
1274
1294
  }
1275
1295
  return new Perm(newPerm);
1276
1296
  }
1297
+ // number the pieces in order.
1298
+ renumberPieces() {
1299
+ const seen = new Array(this.perm.length);
1300
+ const newPerm = new Array(this.perm.length);
1301
+ let id = 0;
1302
+ for (let i = 0; i < this.perm.length; i++) {
1303
+ const v = this.perm[i];
1304
+ if (seen[v] === void 0) {
1305
+ seen[v] = id++;
1306
+ }
1307
+ newPerm[i] = seen[v];
1308
+ }
1309
+ return new _PGOrbit(newPerm, this.ori, this.orimod);
1310
+ }
1277
1311
  // returns tuple of sets of identical pieces in this orbit
1278
1312
  identicalPieces() {
1279
1313
  const done = [];
@@ -1387,10 +1421,10 @@ var PGOrbit = class _PGOrbit {
1387
1421
  }
1388
1422
  };
1389
1423
  var PGTransformBase = class {
1424
+ orbits;
1390
1425
  constructor(orbits) {
1391
1426
  this.orbits = orbits;
1392
1427
  }
1393
- orbits;
1394
1428
  internalMul(b) {
1395
1429
  const newOrbits = [];
1396
1430
  for (let i = 0; i < this.orbits.length; i++) {
@@ -1506,6 +1540,8 @@ var VisibleState = class _VisibleState extends PGTransformBase {
1506
1540
  }
1507
1541
  };
1508
1542
  var DisjointUnion = class {
1543
+ heads;
1544
+ n;
1509
1545
  constructor(n) {
1510
1546
  this.n = n;
1511
1547
  this.heads = new Array(n);
@@ -1513,8 +1549,6 @@ var DisjointUnion = class {
1513
1549
  this.heads[i] = i;
1514
1550
  }
1515
1551
  }
1516
- n;
1517
- heads;
1518
1552
  find(v) {
1519
1553
  let h = this.heads[v];
1520
1554
  if (this.heads[h] === h) {
@@ -1607,16 +1641,16 @@ function solvethreeplanes(p1, p2, p3, planes) {
1607
1641
  return p;
1608
1642
  }
1609
1643
  var Quat = class _Quat {
1644
+ a;
1645
+ b;
1646
+ c;
1647
+ d;
1610
1648
  constructor(a, b, c, d) {
1611
1649
  this.a = a;
1612
1650
  this.b = b;
1613
1651
  this.c = c;
1614
1652
  this.d = d;
1615
1653
  }
1616
- a;
1617
- b;
1618
- c;
1619
- d;
1620
1654
  mul(q) {
1621
1655
  return new _Quat(
1622
1656
  this.a * q.a - this.b * q.b - this.c * q.c - this.d * q.d,
@@ -2208,14 +2242,14 @@ var Face = class _Face {
2208
2242
  }
2209
2243
  };
2210
2244
  var FaceTree = class _FaceTree {
2245
+ face;
2246
+ left;
2247
+ right;
2211
2248
  constructor(face, left, right) {
2212
2249
  this.face = face;
2213
2250
  this.left = left;
2214
2251
  this.right = right;
2215
2252
  }
2216
- face;
2217
- left;
2218
- right;
2219
2253
  split(q) {
2220
2254
  const t = q.cutface(this.face);
2221
2255
  if (t !== null) {
@@ -2293,6 +2327,12 @@ function defaultnets() {
2293
2327
  ]
2294
2328
  };
2295
2329
  }
2330
+ var userFriendly2DProjections = {
2331
+ 8: [
2332
+ ["U", "F", "L", "R"],
2333
+ ["BB", "BR", "D", "BL"]
2334
+ ]
2335
+ };
2296
2336
  var orientationDefaults = {
2297
2337
  4: {
2298
2338
  v: ["DFR", "DLF", "DRL", "FLR"],
@@ -2609,6 +2649,91 @@ function toFaceCoords(q, maxdist) {
2609
2649
  return r;
2610
2650
  }
2611
2651
  var PuzzleGeometry = class {
2652
+ rotations;
2653
+ // all members of the rotation group
2654
+ basePlaneRotations;
2655
+ // unique rotations of the baseplane
2656
+ basePlanes;
2657
+ // planes, corresponding to faces
2658
+ faceNames;
2659
+ // face names
2660
+ facePlanes;
2661
+ // face planes
2662
+ edgeNames;
2663
+ // edge names
2664
+ vertexNames;
2665
+ // vertexnames
2666
+ geometryNormals;
2667
+ // all geometric directions, with names and types
2668
+ movePlanes;
2669
+ // the planes that split moves
2670
+ movePlanesFiltered;
2671
+ // the planes that split moves, filtered
2672
+ movePlaneSets;
2673
+ // the move planes, in parallel sets
2674
+ movePlaneNormals;
2675
+ // one move plane
2676
+ movesetorders;
2677
+ // the order of rotations for each move set
2678
+ movesetgeos;
2679
+ // geometric feature information for move sets
2680
+ baseFaces;
2681
+ // polytope faces before cuts
2682
+ faces;
2683
+ // all the stickers
2684
+ faceCenterMass;
2685
+ // center of mass of all faces
2686
+ baseFaceCount;
2687
+ // number of base faces
2688
+ stickersPerFace;
2689
+ // number of stickers per face
2690
+ shortestEdge;
2691
+ markedFaceLookup;
2692
+ // given a bitmap of faces, identify the marked one
2693
+ cubies;
2694
+ // the cubies
2695
+ vertexDistance;
2696
+ // vertex distance
2697
+ edgeDistance;
2698
+ // edge distance
2699
+ faceToCubie;
2700
+ // map a face to a cubie index
2701
+ faceToCubieOrd;
2702
+ // map a face to a cubie ord
2703
+ moveRotations;
2704
+ // move rotations
2705
+ faceListHash;
2706
+ // face list by key
2707
+ cubieSetNames;
2708
+ // cubie set names
2709
+ cubieOrbitSizes;
2710
+ // the size of each orbit
2711
+ cubieSetNums;
2712
+ cubieOrdNums;
2713
+ orbitOrientations;
2714
+ // the orientation size of each orbit
2715
+ cubieValueMap;
2716
+ // the map for identical cubies
2717
+ cubieSetCubies;
2718
+ // cubies in each cubie set
2719
+ cmovesBySlice = [];
2720
+ // cmoves as perms by slice
2721
+ parsedMoveList;
2722
+ // parsed move list
2723
+ duplicatedFaces = [];
2724
+ // which faces are duplicated
2725
+ duplicatedCubies = [];
2726
+ // which cubies are duplicated
2727
+ fixedCubie = -1;
2728
+ // fixed cubie, if any
2729
+ net = [];
2730
+ colors = [];
2731
+ swizzler;
2732
+ notationMapper = new NullMapper();
2733
+ addNotationMapper = "";
2734
+ setReidOrSpeffzOrder = false;
2735
+ options;
2736
+ puzzleDescription;
2612
2737
  constructor(puzzleDescription, options) {
2613
2738
  this.puzzleDescription = puzzleDescription;
2614
2739
  const t1 = tstart("genperms");
@@ -3065,91 +3190,6 @@ var PuzzleGeometry = class {
3065
3190
  }
3066
3191
  tend(t1);
3067
3192
  }
3068
- puzzleDescription;
3069
- rotations;
3070
- // all members of the rotation group
3071
- basePlaneRotations;
3072
- // unique rotations of the baseplane
3073
- basePlanes;
3074
- // planes, corresponding to faces
3075
- faceNames;
3076
- // face names
3077
- facePlanes;
3078
- // face planes
3079
- edgeNames;
3080
- // edge names
3081
- vertexNames;
3082
- // vertexnames
3083
- geometryNormals;
3084
- // all geometric directions, with names and types
3085
- movePlanes;
3086
- // the planes that split moves
3087
- movePlanesFiltered;
3088
- // the planes that split moves, filtered
3089
- movePlaneSets;
3090
- // the move planes, in parallel sets
3091
- movePlaneNormals;
3092
- // one move plane
3093
- movesetorders;
3094
- // the order of rotations for each move set
3095
- movesetgeos;
3096
- // geometric feature information for move sets
3097
- baseFaces;
3098
- // polytope faces before cuts
3099
- faces;
3100
- // all the stickers
3101
- faceCenterMass;
3102
- // center of mass of all faces
3103
- baseFaceCount;
3104
- // number of base faces
3105
- stickersPerFace;
3106
- // number of stickers per face
3107
- shortestEdge;
3108
- markedFaceLookup;
3109
- // given a bitmap of faces, identify the marked one
3110
- cubies;
3111
- // the cubies
3112
- vertexDistance;
3113
- // vertex distance
3114
- edgeDistance;
3115
- // edge distance
3116
- faceToCubie;
3117
- // map a face to a cubie index
3118
- faceToCubieOrd;
3119
- // map a face to a cubie ord
3120
- moveRotations;
3121
- // move rotations
3122
- faceListHash;
3123
- // face list by key
3124
- cubieSetNames;
3125
- // cubie set names
3126
- cubieOrbitSizes;
3127
- // the size of each orbit
3128
- cubieSetNums;
3129
- cubieOrdNums;
3130
- orbitOrientations;
3131
- // the orientation size of each orbit
3132
- cubieValueMap;
3133
- // the map for identical cubies
3134
- cubieSetCubies;
3135
- // cubies in each cubie set
3136
- cmovesBySlice = [];
3137
- // cmoves as perms by slice
3138
- parsedMoveList;
3139
- // parsed move list
3140
- duplicatedFaces = [];
3141
- // which faces are duplicated
3142
- duplicatedCubies = [];
3143
- // which cubies are duplicated
3144
- fixedCubie = -1;
3145
- // fixed cubie, if any
3146
- net = [];
3147
- colors = [];
3148
- swizzler;
3149
- notationMapper = new NullMapper();
3150
- addNotationMapper = "";
3151
- setReidOrSpeffzOrder = false;
3152
- options;
3153
3193
  keyface(face) {
3154
3194
  return this.keyface2(face.centermass());
3155
3195
  }
@@ -4776,8 +4816,68 @@ ${comment}
4776
4816
  };
4777
4817
  return mappt2d;
4778
4818
  }
4819
+ // If a user-friendly mapping is provided, we prefer to use that for
4820
+ // any 2D representations. This involves some geometrical remapping.
4821
+ generateUserFriendly2D(w, h, trim) {
4822
+ const views = userFriendly2DProjections[this.baseFaceCount];
4823
+ if (!views) {
4824
+ return null;
4825
+ }
4826
+ this.genperms();
4827
+ const faceView = [];
4828
+ const frames = views.map((names, vi) => {
4829
+ const fns = [];
4830
+ for (let fi = 0; fi < names.length; fi++) {
4831
+ for (let i = 0; i < this.faceNames.length; i++) {
4832
+ if (this.faceNames[i][1] === names[fi]) {
4833
+ fns[fi] = i;
4834
+ }
4835
+ }
4836
+ }
4837
+ let s = new Quat(0, 0, 0, 0);
4838
+ for (const fn of fns) {
4839
+ s = s.sum(this.basePlanes[fn].makenormal());
4840
+ faceView[fn] = vi;
4841
+ }
4842
+ s = s.normalize();
4843
+ const top = this.basePlanes[fns[0]].makenormal();
4844
+ const up = top.sub(s.smul(top.dot(s))).normalize();
4845
+ return { up, right: s.cross(up), lo: [1e9, 1e9], hi: [-1e9, -1e9] };
4846
+ });
4847
+ for (let fn = 0; fn < this.baseFaceCount; fn++) {
4848
+ const fr = frames[faceView[fn]];
4849
+ for (const v of this.faceNames[fn][0]) {
4850
+ const p = [v.dot(fr.right), v.dot(fr.up)];
4851
+ fr.lo = [Math.min(fr.lo[0], p[0]), Math.min(fr.lo[1], p[1])];
4852
+ fr.hi = [Math.max(fr.hi[0], p[0]), Math.max(fr.hi[1], p[1])];
4853
+ }
4854
+ }
4855
+ const gap = 0.2 * (frames[0].hi[0] - frames[0].lo[0]);
4856
+ let totw = -gap;
4857
+ let toth = 0;
4858
+ for (const fr of frames) {
4859
+ totw += fr.hi[0] - fr.lo[0] + gap;
4860
+ toth = Math.max(toth, fr.hi[1] - fr.lo[1]);
4861
+ }
4862
+ const sc = Math.min((w - 2 * trim) / totw, (h - 2 * trim) / toth);
4863
+ const left = [];
4864
+ let x = (w - sc * totw) / 2;
4865
+ for (const fr of frames) {
4866
+ left.push(x - sc * fr.lo[0]);
4867
+ x += sc * (fr.hi[0] - fr.lo[0] + gap);
4868
+ }
4869
+ return (fn, q) => {
4870
+ const vi = faceView[fn];
4871
+ const fr = frames[vi];
4872
+ const mid = (fr.lo[1] + fr.hi[1]) / 2;
4873
+ return [
4874
+ left[vi] + sc * q.dot(fr.right),
4875
+ h / 2 - sc * (q.dot(fr.up) - mid)
4876
+ ];
4877
+ };
4878
+ }
4779
4879
  generatesvg(w = 800, h = 500, trim = 10, threed = false) {
4780
- const mappt2d = this.generate2dmapping(w, h, trim, threed);
4880
+ const mappt2d = !threed && this.generateUserFriendly2D(w, h, trim) || this.generate2dmapping(w, h, trim, threed);
4781
4881
  function drawedges(id, pts, color) {
4782
4882
  return `<polygon id="${id}" class="sticker" style="fill: ${color}" points="${pts.map((p) => `${p[0]} ${p[1]}`).join(" ")}"/>
4783
4883
  `;
@@ -4968,12 +5068,12 @@ Vertex distance ${this.vertexDistance}`;
4968
5068
  }
4969
5069
  };
4970
5070
  var PGNotation = class {
5071
+ orbitNames;
5072
+ pg;
4971
5073
  constructor(pg, od) {
4972
5074
  this.pg = pg;
4973
5075
  this.orbitNames = od.orbitnames;
4974
5076
  }
4975
- pg;
4976
- orbitNames;
4977
5077
  lookupMove(move) {
4978
5078
  const mv = this.pg.parseMove(move);
4979
5079
  if (this.pg.parsedMoveList) {