cubing 0.41.0 → 0.41.1

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 (67) hide show
  1. package/dist/esm/bluetooth/index.js +40 -40
  2. package/dist/esm/bluetooth/index.js.map +3 -3
  3. package/dist/esm/{chunk-2MAPPPWG.js → chunk-3B5ND2Z3.js} +24 -22
  4. package/dist/esm/chunk-3B5ND2Z3.js.map +7 -0
  5. package/dist/esm/{chunk-UOO5TXR6.js → chunk-3RHBVKV2.js} +88 -79
  6. package/dist/esm/chunk-3RHBVKV2.js.map +7 -0
  7. package/dist/esm/{chunk-VRFVPBCT.js → chunk-6FC7BO5U.js} +2 -2
  8. package/dist/esm/{chunk-LWPMAFQX.js → chunk-GXXHRHE5.js} +31 -31
  9. package/dist/esm/chunk-GXXHRHE5.js.map +7 -0
  10. package/dist/esm/{chunk-SNYTAYI2.js → chunk-H66X47MG.js} +23 -23
  11. package/dist/esm/{chunk-SNYTAYI2.js.map → chunk-H66X47MG.js.map} +2 -2
  12. package/dist/esm/{chunk-DNOZJX34.js → chunk-LRYMCZVI.js} +3 -3
  13. package/dist/esm/{chunk-BTVDGT5H.js → chunk-Q7UVEISQ.js} +3 -3
  14. package/dist/esm/{chunk-F72PPD54.js → chunk-V4YTFIKT.js} +38 -36
  15. package/dist/esm/chunk-V4YTFIKT.js.map +7 -0
  16. package/dist/esm/{chunk-QFJEREMI.js → chunk-XODLDV3Q.js} +24 -22
  17. package/dist/esm/chunk-XODLDV3Q.js.map +7 -0
  18. package/dist/esm/inside-GPSEWHK7.js +17 -0
  19. package/dist/esm/kpuzzle/index.js +1 -1
  20. package/dist/esm/notation/index.js +3 -3
  21. package/dist/esm/protocol/index.js +3 -3
  22. package/dist/esm/puzzles/index.js +3 -3
  23. package/dist/esm/scramble/index.js +7 -7
  24. package/dist/esm/search/index.js +9 -9
  25. package/dist/esm/{search-dynamic-sgs-side-events-7RLPMUUQ.js → search-dynamic-sgs-side-events-4ZHROANX.js} +4 -4
  26. package/dist/esm/{search-dynamic-sgs-unofficial-IXO75L3Y.js → search-dynamic-sgs-unofficial-VKBYULK5.js} +4 -4
  27. package/dist/esm/{search-dynamic-solve-3x3x3-7EEK52SV.js → search-dynamic-solve-3x3x3-NULYS7OL.js} +3 -3
  28. package/dist/esm/{search-dynamic-solve-3x3x3-7EEK52SV.js.map → search-dynamic-solve-3x3x3-NULYS7OL.js.map} +2 -2
  29. package/dist/esm/{search-dynamic-solve-4x4x4-IP6UC7HF.js → search-dynamic-solve-4x4x4-KASG5V7K.js} +5 -5
  30. package/dist/esm/{search-dynamic-solve-sq1-CWJPRQVZ.js → search-dynamic-solve-sq1-TO7UHE6Y.js} +6 -6
  31. package/dist/esm/{search-dynamic-solve-sq1-CWJPRQVZ.js.map → search-dynamic-solve-sq1-TO7UHE6Y.js.map} +2 -2
  32. package/dist/esm/search-worker-entry.js.js +1 -1
  33. package/dist/esm/twisty/index.js +54 -52
  34. package/dist/esm/twisty/index.js.map +3 -3
  35. package/dist/esm/{twisty-dynamic-3d-6SRUMP27.js → twisty-dynamic-3d-5VC2L2WS.js} +11 -11
  36. package/dist/esm/{twisty-dynamic-3d-6SRUMP27.js.map → twisty-dynamic-3d-5VC2L2WS.js.map} +2 -2
  37. package/dist/esm/{twsearch-D6TM63UU.js → twsearch-OMTTOVJO.js} +8 -8
  38. package/dist/esm/twsearch-OMTTOVJO.js.map +7 -0
  39. package/dist/types/{KPattern-85fd8579.d.ts → KPattern-12e23b1f.d.ts} +8 -8
  40. package/dist/types/{TwizzleLink-7d147be8.d.ts → TwizzleLink-8eaf164c.d.ts} +9 -9
  41. package/dist/types/bluetooth/index.d.ts +8 -8
  42. package/dist/types/{bluetooth-puzzle-da601f13.d.ts → bluetooth-puzzle-91e73b7f.d.ts} +3 -3
  43. package/dist/types/kpuzzle/index.d.ts +1 -1
  44. package/dist/types/notation/index.d.ts +2 -2
  45. package/dist/types/{outside-51ce651a.d.ts → outside-deaac55d.d.ts} +8 -8
  46. package/dist/types/protocol/index.d.ts +3 -3
  47. package/dist/types/puzzle-geometry/index.d.ts +2 -2
  48. package/dist/types/puzzles/index.d.ts +3 -3
  49. package/dist/types/scramble/index.d.ts +2 -2
  50. package/dist/types/search/index.d.ts +4 -4
  51. package/dist/types/stream/index.d.ts +2 -2
  52. package/dist/types/twisty/index.d.ts +7 -7
  53. package/package.json +1 -1
  54. package/dist/esm/chunk-2MAPPPWG.js.map +0 -7
  55. package/dist/esm/chunk-F72PPD54.js.map +0 -7
  56. package/dist/esm/chunk-LWPMAFQX.js.map +0 -7
  57. package/dist/esm/chunk-QFJEREMI.js.map +0 -7
  58. package/dist/esm/chunk-UOO5TXR6.js.map +0 -7
  59. package/dist/esm/inside-DLVM67HZ.js +0 -17
  60. package/dist/esm/twsearch-D6TM63UU.js.map +0 -7
  61. /package/dist/esm/{chunk-VRFVPBCT.js.map → chunk-6FC7BO5U.js.map} +0 -0
  62. /package/dist/esm/{chunk-DNOZJX34.js.map → chunk-LRYMCZVI.js.map} +0 -0
  63. /package/dist/esm/{chunk-BTVDGT5H.js.map → chunk-Q7UVEISQ.js.map} +0 -0
  64. /package/dist/esm/{inside-DLVM67HZ.js.map → inside-GPSEWHK7.js.map} +0 -0
  65. /package/dist/esm/{search-dynamic-sgs-side-events-7RLPMUUQ.js.map → search-dynamic-sgs-side-events-4ZHROANX.js.map} +0 -0
  66. /package/dist/esm/{search-dynamic-sgs-unofficial-IXO75L3Y.js.map → search-dynamic-sgs-unofficial-VKBYULK5.js.map} +0 -0
  67. /package/dist/esm/{search-dynamic-solve-4x4x4-IP6UC7HF.js.map → search-dynamic-solve-4x4x4-KASG5V7K.js.map} +0 -0
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  binaryComponentsToReid3x3x3,
3
3
  twizzleBinaryToBinaryComponents
4
- } from "../chunk-2MAPPPWG.js";
4
+ } from "../chunk-3B5ND2Z3.js";
5
5
  import {
6
6
  cube3x3x3,
7
7
  puzzles
8
- } from "../chunk-BTVDGT5H.js";
8
+ } from "../chunk-Q7UVEISQ.js";
9
9
  import {
10
10
  experimental3x3x3KPuzzle
11
- } from "../chunk-SNYTAYI2.js";
11
+ } from "../chunk-H66X47MG.js";
12
12
  import {
13
13
  KPattern
14
- } from "../chunk-F72PPD54.js";
14
+ } from "../chunk-V4YTFIKT.js";
15
15
  import {
16
16
  Alg,
17
17
  Move,
@@ -95,8 +95,8 @@ var BluetoothPuzzle = class extends EventTarget {
95
95
  }
96
96
  // TODO: Can we make this reutrn (async) on success?
97
97
  // TODO: require subclasses to implement this?
98
- async getState() {
99
- throw new Error("cannot get state");
98
+ async getPattern() {
99
+ throw new Error("cannot get pattern");
100
100
  }
101
101
  addAlgLeafListener(listener) {
102
102
  this.listeners.push(listener);
@@ -139,7 +139,7 @@ var KeyboardPuzzle = class extends BluetoothPuzzle {
139
139
  super();
140
140
  this.target = target;
141
141
  this.puzzle = puzzles["3x3x3"].kpuzzle();
142
- this.state = (async () => (await this.puzzle).startState())();
142
+ this.pattern = (async () => (await this.puzzle).defaultPattern())();
143
143
  this.listener = this.onKeyDown.bind(this);
144
144
  target.addEventListener("keydown", this.listener);
145
145
  }
@@ -149,8 +149,8 @@ var KeyboardPuzzle = class extends BluetoothPuzzle {
149
149
  disconnect() {
150
150
  this.target.removeEventListener("keydown", this.listener);
151
151
  }
152
- async getState() {
153
- return this.state;
152
+ async getPattern() {
153
+ return this.pattern;
154
154
  }
155
155
  async onKeyDown(e) {
156
156
  if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
@@ -158,12 +158,12 @@ var KeyboardPuzzle = class extends BluetoothPuzzle {
158
158
  }
159
159
  const algLeaf = keyToMove(e);
160
160
  if (algLeaf) {
161
- const newState = (await this.state).applyAlg(new Alg([algLeaf]));
162
- this.state = Promise.resolve(newState);
161
+ const newPattern = (await this.pattern).applyAlg(new Alg([algLeaf]));
162
+ this.pattern = Promise.resolve(newPattern);
163
163
  this.dispatchAlgLeaf({
164
164
  latestAlgLeaf: algLeaf,
165
165
  timeStamp: e.timeStamp,
166
- state: newState
166
+ pattern: newPattern
167
167
  });
168
168
  e.preventDefault();
169
169
  }
@@ -335,7 +335,7 @@ var key11 = new Uint8Array([
335
335
  1,
336
336
  241
337
337
  ]);
338
- async function decryptState(data, aesKey) {
338
+ async function decryptPattern(data, aesKey) {
339
339
  if (aesKey === null) {
340
340
  return data;
341
341
  }
@@ -348,7 +348,7 @@ async function decryptState(data, aesKey) {
348
348
  if (probablyDecodedCorrectly(copy)) {
349
349
  return copy;
350
350
  }
351
- throw new Error("Invalid Gan cube state");
351
+ throw new Error("Invalid Gan cube pattern");
352
352
  }
353
353
  var PhysicalState = class _PhysicalState {
354
354
  constructor(dataView, timeStamp) {
@@ -361,7 +361,7 @@ var PhysicalState = class _PhysicalState {
361
361
  }
362
362
  }
363
363
  static async read(characteristic, aesKey) {
364
- const value = await decryptState(
364
+ const value = await decryptPattern(
365
365
  new Uint8Array((await characteristic.readValue()).buffer),
366
366
  aesKey
367
367
  );
@@ -520,7 +520,7 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
520
520
  this.aesKey = aesKey;
521
521
  this.INTERVAL_MS = DEFAULT_INTERVAL_MS;
522
522
  this.intervalHandle = null;
523
- this.state = kpuzzle.startState();
523
+ this.pattern = kpuzzle.defaultPattern();
524
524
  this.startTrackingMoves();
525
525
  }
526
526
  // We have to perform async operations before we call the constructor.
@@ -577,12 +577,12 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
577
577
  numInterveningMoves = MAX_LATEST_MOVES;
578
578
  }
579
579
  for (const move of physicalState.latestMoves(numInterveningMoves)) {
580
- this.state = this.state.applyMove(move);
580
+ this.pattern = this.pattern.applyMove(move);
581
581
  this.dispatchAlgLeaf({
582
582
  latestAlgLeaf: move,
583
583
  timeStamp: physicalState.timeStamp,
584
584
  debug: physicalState.debugInfo(),
585
- state: this.state
585
+ pattern: this.pattern
586
586
  // quaternion: physicalState.rotQuat(),
587
587
  });
588
588
  }
@@ -597,8 +597,8 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
597
597
  await this.readActualAngleAndBatteryCharacteristic()
598
598
  )[7];
599
599
  }
600
- async getState() {
601
- const arr = await decryptState(
600
+ async getPattern() {
601
+ const arr = await decryptPattern(
602
602
  new Uint8Array(await this.readFaceletStatus1Characteristic()),
603
603
  this.aesKey
604
604
  );
@@ -610,7 +610,7 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
610
610
  v >>= 3;
611
611
  }
612
612
  }
613
- const stateData = {
613
+ const patternData = {
614
614
  CORNERS: {
615
615
  pieces: [],
616
616
  orientation: []
@@ -628,15 +628,15 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
628
628
  };
629
629
  for (const cornerMapping of gan356iCornerMappings) {
630
630
  const pieceInfo = pieceMap[cornerMapping.map((i) => faceOrder[stickers[i]]).join("")];
631
- stateData.CORNERS.pieces.push(pieceInfo.piece);
632
- stateData.CORNERS.orientation.push(pieceInfo.orientation);
631
+ patternData.CORNERS.pieces.push(pieceInfo.piece);
632
+ patternData.CORNERS.orientation.push(pieceInfo.orientation);
633
633
  }
634
634
  for (const edgeMapping of gan356iEdgeMappings) {
635
635
  const pieceInfo = pieceMap[edgeMapping.map((i) => faceOrder[stickers[i]]).join("")];
636
- stateData.EDGES.pieces.push(pieceInfo.piece);
637
- stateData.EDGES.orientation.push(pieceInfo.orientation);
636
+ patternData.EDGES.pieces.push(pieceInfo.piece);
637
+ patternData.EDGES.orientation.push(pieceInfo.orientation);
638
638
  }
639
- return new KPattern(this.kpuzzle, stateData);
639
+ return new KPattern(this.kpuzzle, patternData);
640
640
  }
641
641
  async faceletStatus1Characteristic() {
642
642
  this.cachedFaceletStatus1Characteristic = this.cachedFaceletStatus1Characteristic || this.service.getCharacteristic(UUIDs.faceletStatus1Characteristic);
@@ -775,7 +775,7 @@ var lookup = [
775
775
  171,
776
776
  41
777
777
  ];
778
- function decryptState2(data) {
778
+ function decryptState(data) {
779
779
  const offset1 = getNibble(data, 38);
780
780
  const offset2 = getNibble(data, 39);
781
781
  const output = new Uint8Array(MESSAGE_LENGTH);
@@ -788,7 +788,7 @@ async function decodeState(data) {
788
788
  if (!probablyEncrypted(data)) {
789
789
  return data;
790
790
  }
791
- return decryptState2(data);
791
+ return decryptState(data);
792
792
  }
793
793
  var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
794
794
  constructor(server, cubeCharacteristic, originalValue) {
@@ -822,7 +822,7 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
822
822
  disconnect() {
823
823
  this.server.disconnect();
824
824
  }
825
- async getState() {
825
+ async getPattern() {
826
826
  return this.toReid333(
827
827
  new Uint8Array((await this.cubeCharacteristic.readValue()).buffer)
828
828
  );
@@ -833,7 +833,7 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
833
833
  return val[n] >> shift & 1;
834
834
  }
835
835
  toReid333(val) {
836
- const state = {
836
+ const patternData = {
837
837
  EDGES: {
838
838
  pieces: new Array(12),
839
839
  orientation: new Array(12)
@@ -846,15 +846,15 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
846
846
  };
847
847
  for (let i = 0; i < 12; i++) {
848
848
  const gi = epReid333toGiiKER[i];
849
- state.EDGES.pieces[i] = epGiiKERtoReid333[getNibble(val, gi + 16) - 1];
850
- state.EDGES.orientation[i] = this.getBit(val, gi + 112) ^ preEO[state.EDGES.pieces[i]] ^ postEO[i];
849
+ patternData.EDGES.pieces[i] = epGiiKERtoReid333[getNibble(val, gi + 16) - 1];
850
+ patternData.EDGES.orientation[i] = this.getBit(val, gi + 112) ^ preEO[patternData.EDGES.pieces[i]] ^ postEO[i];
851
851
  }
852
852
  for (let i = 0; i < 8; i++) {
853
853
  const gi = cpReid333toGiiKER[i];
854
- state.CORNERS.pieces[i] = cpGiiKERtoReid333[getNibble(val, gi) - 1];
855
- state.CORNERS.orientation[i] = (getNibble(val, gi + 8) * coFlip[gi] + preCO[state.CORNERS.pieces[i]] + postCO[i]) % 3;
854
+ patternData.CORNERS.pieces[i] = cpGiiKERtoReid333[getNibble(val, gi) - 1];
855
+ patternData.CORNERS.orientation[i] = (getNibble(val, gi + 8) * coFlip[gi] + preCO[patternData.CORNERS.pieces[i]] + postCO[i]) % 3;
856
856
  }
857
- return new KPattern(experimental3x3x3KPuzzle, state);
857
+ return new KPattern(experimental3x3x3KPuzzle, patternData);
858
858
  }
859
859
  async onCubeCharacteristicChanged(event) {
860
860
  const val = await decodeState(new Uint8Array(event.target.value.buffer));
@@ -878,7 +878,7 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
878
878
  debug: {
879
879
  stateStr: str
880
880
  },
881
- state: this.toReid333(val)
881
+ pattern: this.toReid333(val)
882
882
  });
883
883
  }
884
884
  isRepeatedInitialValue(val) {
@@ -1124,7 +1124,7 @@ var HeykubeCube = class _HeykubeCube extends BluetoothPuzzle {
1124
1124
  this.dispatchAlgLeaf({
1125
1125
  latestAlgLeaf: state.latestMove,
1126
1126
  timeStamp: event.timeStamp,
1127
- state: state.state
1127
+ pattern: state.pattern
1128
1128
  });
1129
1129
  }
1130
1130
  decodeState(dv) {
@@ -1165,13 +1165,13 @@ var HeykubeCube = class _HeykubeCube extends BluetoothPuzzle {
1165
1165
  moMask: 0
1166
1166
  };
1167
1167
  return {
1168
- state: binaryComponentsToReid3x3x3(components2),
1168
+ pattern: binaryComponentsToReid3x3x3(components2),
1169
1169
  latestMove: moves[b2[20] & 15]
1170
1170
  };
1171
1171
  }
1172
- async getState() {
1172
+ async getPattern() {
1173
1173
  const b1 = await this.stateCharacteristic.readValue();
1174
- return this.decodeState(b1).state;
1174
+ return this.decodeState(b1).pattern;
1175
1175
  }
1176
1176
  };
1177
1177
  var heykubeConfig = {