cubing 0.51.0 → 0.51.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 (81) hide show
  1. package/dist/lib/cubing/{KPattern.d-Iv89gNss.d.ts → KPattern.d-N-dYG3S_.d.ts} +1 -1
  2. package/dist/lib/cubing/PuzzleLoader-DUS1aLQG.d.ts +2588 -0
  3. package/dist/lib/cubing/{TwizzleLink.d-DAfRlszz.d.ts → TwizzleLink.d-Cf4H-1Jc.d.ts} +7 -3
  4. package/dist/lib/cubing/alg/index.d.ts +5 -4
  5. package/dist/lib/cubing/alg/index.js +1 -1
  6. package/dist/lib/cubing/bluetooth/index.d.ts +11 -7
  7. package/dist/lib/cubing/bluetooth/index.js +19 -11
  8. package/dist/lib/cubing/bluetooth/index.js.map +2 -2
  9. package/dist/lib/cubing/{bluetooth-puzzle.d-BfcciXFF.d.ts → bluetooth-puzzle.d-ClBIGffk.d.ts} +2 -2
  10. package/dist/lib/cubing/chunks/{chunk-VVXSTWUD.js → chunk-2P6TNNY3.js} +3 -3
  11. package/dist/lib/cubing/chunks/{chunk-VVXSTWUD.js.map → chunk-2P6TNNY3.js.map} +2 -2
  12. package/dist/lib/cubing/chunks/{chunk-Y3BVWVFU.js → chunk-6APJHPXM.js} +2 -2
  13. package/dist/lib/cubing/chunks/{chunk-P5TX6QDI.js → chunk-74JQNDKL.js} +3 -3
  14. package/dist/lib/cubing/chunks/{chunk-I4MRKD4Z.js → chunk-7NWFAGQJ.js} +5 -5
  15. package/dist/lib/cubing/chunks/{chunk-BKDLKVHA.js → chunk-ASZ33MAN.js} +8 -18
  16. package/dist/lib/cubing/chunks/chunk-ASZ33MAN.js.map +7 -0
  17. package/dist/lib/cubing/chunks/{chunk-EF6G34T7.js → chunk-BKDL54KM.js} +4 -36
  18. package/dist/lib/cubing/chunks/{chunk-EF6G34T7.js.map → chunk-BKDL54KM.js.map} +2 -2
  19. package/dist/lib/cubing/chunks/{chunk-RAOTPMYY.js → chunk-DSMNO2NL.js} +3 -3
  20. package/dist/lib/cubing/chunks/{chunk-YOMULQ2R.js → chunk-SJG4RSQ7.js} +76 -5
  21. package/dist/lib/cubing/chunks/chunk-SJG4RSQ7.js.map +7 -0
  22. package/dist/lib/cubing/chunks/chunk-TMHVFEOJ.js +13 -0
  23. package/dist/lib/cubing/chunks/chunk-TMHVFEOJ.js.map +7 -0
  24. package/dist/lib/cubing/chunks/{chunk-PP44P6WK.js → chunk-WTZHSZ77.js} +8 -8
  25. package/dist/lib/cubing/chunks/chunk-WTZHSZ77.js.map +7 -0
  26. package/dist/lib/cubing/chunks/{chunk-6XDDJ33I.js → chunk-YUOBAYIL.js} +3 -3
  27. package/dist/lib/cubing/chunks/{chunk-H57WKFBE.js → chunk-ZJQ7HF54.js} +2 -2
  28. package/dist/lib/cubing/chunks/{inside-Y2UVJZNJ.js → inside-BUUDXGLI.js} +16 -15
  29. package/dist/lib/cubing/chunks/{inside-Y2UVJZNJ.js.map → inside-BUUDXGLI.js.map} +1 -1
  30. package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-RPVZU2YB.js → search-dynamic-sgs-side-events-3RHFK7AV.js} +6 -6
  31. package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-2TYKOUM4.js → search-dynamic-sgs-unofficial-NZE5FKFE.js} +6 -6
  32. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-V5D7RQND.js → search-dynamic-solve-4x4x4-OLMKLMOG.js} +8 -7
  33. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-V5D7RQND.js.map → search-dynamic-solve-4x4x4-OLMKLMOG.js.map} +1 -1
  34. package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-UOKDYVD5.js → search-dynamic-solve-fto-ONSGYKTM.js} +2 -2
  35. package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-RAZM75GA.js → search-dynamic-solve-kilominx-ZX2CLDKY.js} +2 -2
  36. package/dist/lib/cubing/chunks/search-worker-entry.js +3 -2
  37. package/dist/lib/cubing/chunks/search-worker-entry.js.map +1 -1
  38. package/dist/lib/cubing/chunks/{twisty-dynamic-3d-HF7KVBOE.js → twisty-dynamic-3d-NVEO366S.js} +6 -6
  39. package/dist/lib/cubing/chunks/{twisty-dynamic-3d-HF7KVBOE.js.map → twisty-dynamic-3d-NVEO366S.js.map} +1 -1
  40. package/dist/lib/cubing/chunks/{twsearch-MRZGOB6T.js → twsearch-MZJMZQT2.js} +7 -6
  41. package/dist/lib/cubing/chunks/twsearch-MZJMZQT2.js.map +7 -0
  42. package/dist/lib/cubing/chunks/twsearch_wasm_bg-AVUYD5YC-GHUKMMEN.js +15 -0
  43. package/dist/lib/cubing/chunks/twsearch_wasm_bg-AVUYD5YC-GHUKMMEN.js.map +7 -0
  44. package/dist/lib/cubing/{index-BhH6DKdK.d.ts → index-BW1Xj98G.d.ts} +2 -2
  45. package/dist/lib/cubing/kpuzzle/index.d.ts +3 -2
  46. package/dist/lib/cubing/kpuzzle/index.js +2 -2
  47. package/dist/lib/cubing/notation/index.d.ts +4 -4
  48. package/dist/lib/cubing/notation/index.js +4 -4
  49. package/dist/lib/cubing/{parseAlg.d-HDV9mtha.d.ts → parseAlg.d-DhFLCVac.d.ts} +1 -1
  50. package/dist/lib/cubing/protocol/index.d.ts +3 -2
  51. package/dist/lib/cubing/protocol/index.js +4 -4
  52. package/dist/lib/cubing/puzzle-geometry/index.d.ts +4 -3
  53. package/dist/lib/cubing/puzzle-geometry/index.js +1 -1
  54. package/dist/lib/cubing/puzzles/index.d.ts +8 -4
  55. package/dist/lib/cubing/puzzles/index.js +4 -4
  56. package/dist/lib/cubing/scramble/index.d.ts +4 -3
  57. package/dist/lib/cubing/scramble/index.js +7 -6
  58. package/dist/lib/cubing/search/index.d.ts +4 -3
  59. package/dist/lib/cubing/search/index.js +7 -6
  60. package/dist/lib/cubing/stream/index.d.ts +6 -3
  61. package/dist/lib/cubing/stream/index.js +1 -1
  62. package/dist/lib/cubing/twisty/index.d.ts +5 -5
  63. package/dist/lib/cubing/twisty/index.js +6 -6
  64. package/package.json +5 -4
  65. package/dist/lib/cubing/Alg.d-B5bAxd5U.d.ts +0 -342
  66. package/dist/lib/cubing/chunks/chunk-BKDLKVHA.js.map +0 -7
  67. package/dist/lib/cubing/chunks/chunk-PP44P6WK.js.map +0 -7
  68. package/dist/lib/cubing/chunks/chunk-YOMULQ2R.js.map +0 -7
  69. package/dist/lib/cubing/chunks/twsearch-MRZGOB6T.js.map +0 -7
  70. package/dist/lib/cubing/chunks/twsearch_wasm_bg-V4F3SIUO-QGKWKUFY.js +0 -15
  71. package/dist/lib/cubing/chunks/twsearch_wasm_bg-V4F3SIUO-QGKWKUFY.js.map +0 -7
  72. /package/dist/lib/cubing/chunks/{chunk-Y3BVWVFU.js.map → chunk-6APJHPXM.js.map} +0 -0
  73. /package/dist/lib/cubing/chunks/{chunk-P5TX6QDI.js.map → chunk-74JQNDKL.js.map} +0 -0
  74. /package/dist/lib/cubing/chunks/{chunk-I4MRKD4Z.js.map → chunk-7NWFAGQJ.js.map} +0 -0
  75. /package/dist/lib/cubing/chunks/{chunk-RAOTPMYY.js.map → chunk-DSMNO2NL.js.map} +0 -0
  76. /package/dist/lib/cubing/chunks/{chunk-6XDDJ33I.js.map → chunk-YUOBAYIL.js.map} +0 -0
  77. /package/dist/lib/cubing/chunks/{chunk-H57WKFBE.js.map → chunk-ZJQ7HF54.js.map} +0 -0
  78. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-RPVZU2YB.js.map → search-dynamic-sgs-side-events-3RHFK7AV.js.map} +0 -0
  79. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-2TYKOUM4.js.map → search-dynamic-sgs-unofficial-NZE5FKFE.js.map} +0 -0
  80. /package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-UOKDYVD5.js.map → search-dynamic-solve-fto-ONSGYKTM.js.map} +0 -0
  81. /package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-RAZM75GA.js.map → search-dynamic-solve-kilominx-ZX2CLDKY.js.map} +0 -0
@@ -0,0 +1,2588 @@
1
+ import { Texture, Object3D, Raycaster, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
2
+
3
+ declare enum IterationDirection$1 {
4
+ Forwards = 1,
5
+ Backwards = -1
6
+ }
7
+
8
+ declare abstract class Comparable$1 {
9
+ is(c: any): boolean;
10
+ as<T>(c: new (...args: any) => T): T | null;
11
+ abstract isIdentical(other: Comparable$1): boolean;
12
+ }
13
+ interface Repeatable$1 extends Comparable$1 {
14
+ experimentalExpand(iterDir?: IterationDirection$1, depth?: number): Generator<AlgLeaf$1>;
15
+ }
16
+ declare abstract class AlgCommon$1<T extends Alg$1 | AlgNode$1> extends Comparable$1 implements Repeatable$1 {
17
+ constructor();
18
+ get log(): (message?: any) => void;
19
+ abstract toString(): string;
20
+ abstract invert(): T;
21
+ abstract experimentalExpand(iterDir: IterationDirection$1): Generator<AlgLeaf$1>;
22
+ }
23
+
24
+ interface QuantumMoveModifications$1 {
25
+ outerLayer?: number;
26
+ innerLayer?: number;
27
+ family?: string;
28
+ }
29
+ declare class QuantumMove$1 extends Comparable$1 {
30
+ #private;
31
+ constructor(family: string, innerLayer?: number | null, outerLayer?: number | null);
32
+ static fromString(s: string): QuantumMove$1;
33
+ modified(modifications: QuantumMoveModifications$1): QuantumMove$1;
34
+ isIdentical(other: QuantumMove$1): boolean;
35
+ /** @deprecated */
36
+ get family(): string;
37
+ /** @deprecated */
38
+ get outerLayer(): number | null;
39
+ /** @deprecated */
40
+ get innerLayer(): number | null;
41
+ experimentalExpand(): Generator<AlgLeaf$1>;
42
+ toString(): string;
43
+ }
44
+ interface MoveModifications$1 {
45
+ outerLayer?: number;
46
+ innerLayer?: number;
47
+ family?: string;
48
+ amount?: number;
49
+ }
50
+ /** @category Alg Nodes */
51
+ declare class Move$1 extends AlgCommon$1<Move$1> {
52
+ #private;
53
+ constructor(...args: [QuantumMove$1] | [QuantumMove$1, number] | [string] | [string, number]);
54
+ isIdentical(other: Comparable$1): boolean;
55
+ invert(): Move$1;
56
+ experimentalExpand(iterDir?: IterationDirection$1): Generator<AlgLeaf$1>;
57
+ get quantum(): QuantumMove$1;
58
+ modified(modifications: MoveModifications$1): Move$1;
59
+ static fromString(s: string): Move$1;
60
+ get amount(): number;
61
+ /** @deprecated */
62
+ get type(): string;
63
+ /** @deprecated */
64
+ get family(): string;
65
+ /** @deprecated */
66
+ get outerLayer(): number | undefined;
67
+ /** @deprecated */
68
+ get innerLayer(): number | undefined;
69
+ toString(): string;
70
+ }
71
+
72
+ /** @category Alg Nodes */
73
+ declare class Pause$1 extends AlgCommon$1<Pause$1> {
74
+ experimentalNISSGrouping?: Grouping$1;
75
+ toString(): string;
76
+ isIdentical(other: Comparable$1): boolean;
77
+ invert(): Pause$1;
78
+ experimentalExpand(_iterDir?: IterationDirection$1, _depth?: number): Generator<AlgLeaf$1>;
79
+ }
80
+
81
+ /** @category Alg Nodes */
82
+ declare class Grouping$1 extends AlgCommon$1<Grouping$1> {
83
+ #private;
84
+ experimentalNISSPlaceholder?: Pause$1;
85
+ constructor(algSource: FlexibleAlgSource$1, amount?: number);
86
+ isIdentical(other: Comparable$1): boolean;
87
+ get alg(): Alg$1;
88
+ get amount(): number;
89
+ /** @deprecated */
90
+ get experimentalRepetitionSuffix(): string;
91
+ invert(): Grouping$1;
92
+ experimentalExpand(iterDir?: IterationDirection$1, depth?: number): Generator<AlgLeaf$1>;
93
+ static fromString(): Grouping$1;
94
+ toString(): string;
95
+ experimentalAsSquare1Tuple(): [moveU: Move$1, moveD: Move$1] | null;
96
+ }
97
+
98
+ /** @category Alg Nodes */
99
+ declare class LineComment$1 extends AlgCommon$1<LineComment$1> {
100
+ #private;
101
+ constructor(commentText: string);
102
+ get text(): string;
103
+ isIdentical(other: Comparable$1): boolean;
104
+ invert(): LineComment$1;
105
+ experimentalExpand(_iterDir?: IterationDirection$1, _depth?: number): Generator<AlgLeaf$1>;
106
+ toString(): string;
107
+ }
108
+
109
+ /** @category Alg Nodes */
110
+ declare class Commutator$1 extends AlgCommon$1<Commutator$1> {
111
+ #private;
112
+ constructor(aSource: FlexibleAlgSource$1, bSource: FlexibleAlgSource$1);
113
+ get A(): Alg$1;
114
+ get B(): Alg$1;
115
+ isIdentical(other: Comparable$1): boolean;
116
+ invert(): Commutator$1;
117
+ experimentalExpand(iterDir?: IterationDirection$1, depth?: number): Generator<AlgLeaf$1>;
118
+ toString(): string;
119
+ }
120
+
121
+ /** @category Alg Nodes */
122
+ declare class Conjugate$1 extends AlgCommon$1<Conjugate$1> {
123
+ #private;
124
+ constructor(aSource: FlexibleAlgSource$1, bSource: FlexibleAlgSource$1);
125
+ get A(): Alg$1;
126
+ get B(): Alg$1;
127
+ isIdentical(other: Comparable$1): boolean;
128
+ invert(): Conjugate$1;
129
+ experimentalExpand(iterDir: IterationDirection$1, depth?: number): Generator<AlgLeaf$1>;
130
+ toString(): string;
131
+ }
132
+
133
+ /** @category Alg Nodes */
134
+ declare class Newline$1 extends AlgCommon$1<Newline$1> {
135
+ toString(): string;
136
+ isIdentical(other: Comparable$1): boolean;
137
+ invert(): Newline$1;
138
+ experimentalExpand(_iterDir?: IterationDirection$1, _depth?: number): Generator<AlgLeaf$1>;
139
+ }
140
+
141
+ /** @category Alg Nodes */
142
+ type AlgLeaf$1 = Move$1 | LineComment$1 | Newline$1 | Pause$1;
143
+ /** @category Alg Nodes */
144
+ type AlgBranch$1 = Grouping$1 | Conjugate$1 | Commutator$1;
145
+ /** @category Alg Nodes */
146
+ type AlgNode$1 = AlgLeaf$1 | AlgBranch$1;
147
+
148
+ declare const DEFAULT_DIRECTIONAL$1 = "any-direction";
149
+ type QuantumDirectionalCancellation$1 = typeof DEFAULT_DIRECTIONAL$1 | "same-direction" | "none";
150
+ type ModWrap$1 = "none" | "gravity" | "canonical-centered" | "canonical-positive" | "preserve-sign";
151
+ interface AppendCancelOptions$1 {
152
+ directional?: QuantumDirectionalCancellation$1;
153
+ puzzleSpecificModWrap?: ModWrap$1;
154
+ }
155
+ interface AppendOptions$1 {
156
+ cancel?: boolean | AppendCancelOptions$1;
157
+ puzzleLoader?: {
158
+ puzzleSpecificSimplifyOptions?: PuzzleSpecificSimplifyOptions$1;
159
+ };
160
+ puzzleSpecificSimplifyOptions?: PuzzleSpecificSimplifyOptions$1;
161
+ }
162
+ interface SimplifyOptions$1 extends AppendOptions$1 {
163
+ depth?: number | null;
164
+ }
165
+ interface PuzzleSpecificAxisSimplifyInfo$1 {
166
+ areQuantumMovesSameAxis: (quantumMove1: QuantumMove$1, quantumMove2: QuantumMove$1) => boolean;
167
+ simplifySameAxisMoves: (moves: Move$1[], quantumMod: boolean) => Move$1[];
168
+ }
169
+ interface PuzzleSpecificSimplifyOptions$1 {
170
+ quantumMoveOrder?: (quantumMove: QuantumMove$1) => number;
171
+ axis?: PuzzleSpecificAxisSimplifyInfo$1;
172
+ }
173
+
174
+ type FlexibleAlgSource$1 = string | Iterable<AlgNode$1> | Alg$1;
175
+ /**
176
+ * `Alg` is a class that encapsulates a structured alg. To create an `Alg` from a string, use:
177
+ *
178
+ * new Alg("R U R'"); // Convenient
179
+ * Alg.fromString(dynamicString); // Recommended when the string input is user-provided.
180
+ *
181
+ * Once you have an `Alg`, you can call methods to transform it:
182
+ *
183
+ * new Alg("[[R: U], R U R2']").expand().experimentalSimplify({cancel: true}).invert().log()
184
+ *
185
+ * To convert an `Alg` to a string, use .toString():
186
+ *
187
+ * new Alg("R U F").invert().toString();
188
+ *
189
+ * If you need to debug, you may also find it convenient to use .log():
190
+ *
191
+ * if (alg.isIdentical(alg.invert())) {
192
+ * alg.log("A self-inverse!")
193
+ * }
194
+ *
195
+ * For more information, see: {@link https://js.cubing.net/cubing/alg/}
196
+ *
197
+ * @category Alg
198
+ */
199
+ declare class Alg$1 extends AlgCommon$1<Alg$1> {
200
+ #private;
201
+ constructor(alg?: FlexibleAlgSource$1);
202
+ /**
203
+ * Checks whether this Alg is structurally identical to another Alg. This
204
+ * essentially means that they are written identically apart from whitespace.
205
+ *
206
+ * const alg1 = new Alg("R U L'");
207
+ * const alg2 = new Alg("L U' R'").invert();
208
+ * // true
209
+ * alg1.isIdentical(alg2);
210
+ *
211
+ * // false
212
+ * new Alg("[R, U]").isIdentical(new Alg("R U R' U'"));
213
+ * // true
214
+ * new Alg("[R, U]").expand().isIdentical(new Alg("R U R' U'"));
215
+ *
216
+ * Note that .isIdentical() efficiently compares algorithms, but mainly exists
217
+ * to help optimize code when the structure of an algorithm hasn't changed.
218
+ * There are many ways to write the "same" alg on most puzzles, but is
219
+ * *highly* recommended to avoid expanding two Alg instances to compare them,
220
+ * since that can easily slow your program to a crawl if someone inputs an alg
221
+ * containing a large repetition. In general, you should use `cubing/kpuzzle`
222
+ * to compare if two algs have the same effect on a puzzle.
223
+ *
224
+ * Also note that parser annotations are not taken into account while comparing
225
+ * algs:
226
+ *
227
+ * const alg = new Alg([new Move("R"), new Move("U2")]);
228
+ * // true, even though one of the algs has parser annotations
229
+ * alg.isIdentical(new Alg("R U2"))
230
+ *
231
+ */
232
+ isIdentical(other: Comparable$1): boolean;
233
+ /**
234
+ * Returns the inverse of the given alg.
235
+ *
236
+ * Note that that this does not make any assumptions about what puzzle the alg
237
+ * is for. For example, U2 is its own inverse on a cube, but U2' has the same
238
+ * effect U3 (and not U2) on Megaminx:
239
+ *
240
+ * // Outputs: R U2' L'
241
+ * new Alg("L U2 R'").invert().log();
242
+ */
243
+ invert(): Alg$1;
244
+ /** @deprecated Use {@link Alg.expand} instead. */
245
+ experimentalExpand(iterDir?: IterationDirection$1, depth?: number): Generator<AlgLeaf$1>;
246
+ /**
247
+ * Expands all Grouping, Commutator, and Conjugate parts nested inside the
248
+ * alg.
249
+ *
250
+ * // F R U R' U' F'
251
+ * new Alg("[F: [R, U]]").expand().log();
252
+ *
253
+ * // F [R, U] F'
254
+ * new Alg("[F: [R, U]]").expand(({ depth: 1 }).log();
255
+ *
256
+ * Avoid calling this on a user-provided alg unless the user explicitly asks
257
+ * to see the expanded alg. Otherwise, it's easy to make your program freeze
258
+ * when someone passes in an alg like: (R U)10000000
259
+ *
260
+ * Generally, if you want to perform an operation on an entire alg, you'll
261
+ * want to use something based on the `Traversal` mechanism, like countMoves()
262
+ * from `cubing/notation`.
263
+ */
264
+ expand(options?: {
265
+ depth?: number;
266
+ }): Alg$1;
267
+ /** @deprecated */
268
+ experimentalLeafMoves(): Generator<Move$1>;
269
+ concat(input: FlexibleAlgSource$1): Alg$1;
270
+ /** @deprecated */
271
+ experimentalIsEmpty(): boolean;
272
+ static fromString(s: string): Alg$1;
273
+ /** @deprecated */
274
+ units(): Generator<AlgNode$1>;
275
+ childAlgNodes(): Generator<AlgNode$1>;
276
+ /** @deprecated */
277
+ experimentalNumUnits(): number;
278
+ experimentalNumChildAlgNodes(): number;
279
+ /** @deprecated */
280
+ get type(): string;
281
+ /**
282
+ * Converts the Alg to a string:
283
+ *
284
+ * const alg = new Alg([new Move("R"), new Move("U2"), new Move("L")])
285
+ * // R U2 L
286
+ * console.log(alg.toString())
287
+ */
288
+ toString(): string;
289
+ /**
290
+ * `experimentalSimplify` can perform several mostly-syntactic simplifications on an alg:
291
+ *
292
+ * // Logs: R' U3
293
+ * import { Alg } from "cubing/alg";
294
+ * new Alg("R R2' U U2").experimentalSimplify({ cancel: true }).log()
295
+ *
296
+ * You can pass in a `PuzzleLoader` (currently only for 3x3x3) for puzzle-specific simplifications:
297
+ *
298
+ * // Logs: R' U'
299
+ * import { Alg } from "cubing/alg";
300
+ * import { cube3x3x3 } from "cubing/puzzles";
301
+ * new Alg("R R2' U U2").experimentalSimplify({ cancel: true, puzzleLoader: cube3x3x3 }).log()
302
+ *
303
+ * You can also cancel only moves that are in the same direction:
304
+ *
305
+ * // Logs: R R2' U'
306
+ * import { Alg } from "cubing/alg";
307
+ * import { cube3x3x3 } from "cubing/puzzles";
308
+ * new Alg("R R2' U U2").experimentalSimplify({
309
+ * cancel: { directional: "same-direction" },
310
+ * puzzleLoader: cube3x3x3
311
+ * }).log()
312
+ *
313
+ * Additionally, you can specify how moves are "wrapped":
314
+ *
315
+ * import { Alg } from "cubing/alg";
316
+ * import { cube3x3x3 } from "cubing/puzzles";
317
+ *
318
+ * function example(puzzleSpecificModWrap) {
319
+ * alg.experimentalSimplify({
320
+ * cancel: { puzzleSpecificModWrap },
321
+ * puzzleLoader: cube3x3x3
322
+ * }).log()
323
+ * }
324
+ *
325
+ * const alg = new Alg("R7' . R6' . R5' . R6")
326
+ * example("none") // R7' . R6' . R5' . R6
327
+ * example("gravity") // R . R2' . R' . R2
328
+ * example("canonical-centered") // R . R2 . R' . R2
329
+ * example("canonical-positive") // R . R2 . R3 . R2
330
+ * example("preserve-sign") // R3' . R2' . R' . R2
331
+ *
332
+ * Same-axis and simultaneous move canonicalization is not implemented yet:
333
+ *
334
+ * // Logs: R L R
335
+ * import { Alg } from "cubing/alg";
336
+ * import { cube3x3x3 } from "cubing/puzzles";
337
+ * new Alg("R L R").experimentalSimplify({ cancel: true, puzzleLoader: cube3x3x3 }).log()
338
+ */
339
+ experimentalSimplify(options?: SimplifyOptions$1): Alg$1;
340
+ /** @deprecated See {@link experimentalSimplify} */
341
+ simplify(options?: SimplifyOptions$1): Alg$1;
342
+ }
343
+
344
+ declare enum IterationDirection {
345
+ Forwards = 1,
346
+ Backwards = -1
347
+ }
348
+
349
+ declare abstract class Comparable {
350
+ is(c: any): boolean;
351
+ as<T>(c: new (...args: any) => T): T | null;
352
+ abstract isIdentical(other: Comparable): boolean;
353
+ }
354
+ interface Repeatable extends Comparable {
355
+ experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
356
+ }
357
+ declare abstract class AlgCommon<T extends Alg | AlgNode> extends Comparable implements Repeatable {
358
+ constructor();
359
+ get log(): (message?: any) => void;
360
+ abstract toString(): string;
361
+ abstract invert(): T;
362
+ abstract experimentalExpand(iterDir: IterationDirection): Generator<AlgLeaf>;
363
+ }
364
+
365
+ interface QuantumMoveModifications {
366
+ outerLayer?: number;
367
+ innerLayer?: number;
368
+ family?: string;
369
+ }
370
+ declare class QuantumMove extends Comparable {
371
+ #private;
372
+ constructor(family: string, innerLayer?: number | null, outerLayer?: number | null);
373
+ static fromString(s: string): QuantumMove;
374
+ modified(modifications: QuantumMoveModifications): QuantumMove;
375
+ isIdentical(other: QuantumMove): boolean;
376
+ /** @deprecated */
377
+ get family(): string;
378
+ /** @deprecated */
379
+ get outerLayer(): number | null;
380
+ /** @deprecated */
381
+ get innerLayer(): number | null;
382
+ experimentalExpand(): Generator<AlgLeaf>;
383
+ toString(): string;
384
+ }
385
+ interface MoveModifications {
386
+ outerLayer?: number;
387
+ innerLayer?: number;
388
+ family?: string;
389
+ amount?: number;
390
+ }
391
+ /** @category Alg Nodes */
392
+ declare class Move extends AlgCommon<Move> {
393
+ #private;
394
+ constructor(...args: [QuantumMove] | [QuantumMove, number] | [string] | [string, number]);
395
+ isIdentical(other: Comparable): boolean;
396
+ invert(): Move;
397
+ experimentalExpand(iterDir?: IterationDirection): Generator<AlgLeaf>;
398
+ get quantum(): QuantumMove;
399
+ modified(modifications: MoveModifications): Move;
400
+ static fromString(s: string): Move;
401
+ get amount(): number;
402
+ /** @deprecated */
403
+ get type(): string;
404
+ /** @deprecated */
405
+ get family(): string;
406
+ /** @deprecated */
407
+ get outerLayer(): number | undefined;
408
+ /** @deprecated */
409
+ get innerLayer(): number | undefined;
410
+ toString(): string;
411
+ }
412
+
413
+ /** @category Alg Nodes */
414
+ declare class Pause extends AlgCommon<Pause> {
415
+ experimentalNISSGrouping?: Grouping;
416
+ toString(): string;
417
+ isIdentical(other: Comparable): boolean;
418
+ invert(): Pause;
419
+ experimentalExpand(_iterDir?: IterationDirection, _depth?: number): Generator<AlgLeaf>;
420
+ }
421
+
422
+ /** @category Alg Nodes */
423
+ declare class Grouping extends AlgCommon<Grouping> {
424
+ #private;
425
+ experimentalNISSPlaceholder?: Pause;
426
+ constructor(algSource: FlexibleAlgSource, amount?: number);
427
+ isIdentical(other: Comparable): boolean;
428
+ get alg(): Alg;
429
+ get amount(): number;
430
+ /** @deprecated */
431
+ get experimentalRepetitionSuffix(): string;
432
+ invert(): Grouping;
433
+ experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
434
+ static fromString(): Grouping;
435
+ toString(): string;
436
+ experimentalAsSquare1Tuple(): [moveU: Move, moveD: Move] | null;
437
+ }
438
+
439
+ /** @category Alg Nodes */
440
+ declare class LineComment extends AlgCommon<LineComment> {
441
+ #private;
442
+ constructor(commentText: string);
443
+ get text(): string;
444
+ isIdentical(other: Comparable): boolean;
445
+ invert(): LineComment;
446
+ experimentalExpand(_iterDir?: IterationDirection, _depth?: number): Generator<AlgLeaf>;
447
+ toString(): string;
448
+ }
449
+
450
+ /** @category Alg Nodes */
451
+ declare class Commutator extends AlgCommon<Commutator> {
452
+ #private;
453
+ constructor(aSource: FlexibleAlgSource, bSource: FlexibleAlgSource);
454
+ get A(): Alg;
455
+ get B(): Alg;
456
+ isIdentical(other: Comparable): boolean;
457
+ invert(): Commutator;
458
+ experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
459
+ toString(): string;
460
+ }
461
+
462
+ /** @category Alg Nodes */
463
+ declare class Conjugate extends AlgCommon<Conjugate> {
464
+ #private;
465
+ constructor(aSource: FlexibleAlgSource, bSource: FlexibleAlgSource);
466
+ get A(): Alg;
467
+ get B(): Alg;
468
+ isIdentical(other: Comparable): boolean;
469
+ invert(): Conjugate;
470
+ experimentalExpand(iterDir: IterationDirection, depth?: number): Generator<AlgLeaf>;
471
+ toString(): string;
472
+ }
473
+
474
+ /** @category Alg Nodes */
475
+ declare class Newline extends AlgCommon<Newline> {
476
+ toString(): string;
477
+ isIdentical(other: Comparable): boolean;
478
+ invert(): Newline;
479
+ experimentalExpand(_iterDir?: IterationDirection, _depth?: number): Generator<AlgLeaf>;
480
+ }
481
+
482
+ /** @category Alg Nodes */
483
+ type AlgLeaf = Move | LineComment | Newline | Pause;
484
+ /** @category Alg Nodes */
485
+ type AlgBranch = Grouping | Conjugate | Commutator;
486
+ /** @category Alg Nodes */
487
+ type AlgNode = AlgLeaf | AlgBranch;
488
+
489
+ declare const DEFAULT_DIRECTIONAL = "any-direction";
490
+ type QuantumDirectionalCancellation = typeof DEFAULT_DIRECTIONAL | "same-direction" | "none";
491
+ type ModWrap = "none" | "gravity" | "canonical-centered" | "canonical-positive" | "preserve-sign";
492
+ interface AppendCancelOptions {
493
+ directional?: QuantumDirectionalCancellation;
494
+ puzzleSpecificModWrap?: ModWrap;
495
+ }
496
+ interface AppendOptions {
497
+ cancel?: boolean | AppendCancelOptions;
498
+ puzzleLoader?: {
499
+ puzzleSpecificSimplifyOptions?: PuzzleSpecificSimplifyOptions;
500
+ };
501
+ puzzleSpecificSimplifyOptions?: PuzzleSpecificSimplifyOptions;
502
+ }
503
+ interface SimplifyOptions extends AppendOptions {
504
+ depth?: number | null;
505
+ }
506
+ interface PuzzleSpecificAxisSimplifyInfo {
507
+ areQuantumMovesSameAxis: (quantumMove1: QuantumMove, quantumMove2: QuantumMove) => boolean;
508
+ simplifySameAxisMoves: (moves: Move[], quantumMod: boolean) => Move[];
509
+ }
510
+ interface PuzzleSpecificSimplifyOptions {
511
+ quantumMoveOrder?: (quantumMove: QuantumMove) => number;
512
+ axis?: PuzzleSpecificAxisSimplifyInfo;
513
+ }
514
+
515
+ type FlexibleAlgSource = string | Iterable<AlgNode> | Alg;
516
+ /**
517
+ * `Alg` is a class that encapsulates a structured alg. To create an `Alg` from a string, use:
518
+ *
519
+ * new Alg("R U R'"); // Convenient
520
+ * Alg.fromString(dynamicString); // Recommended when the string input is user-provided.
521
+ *
522
+ * Once you have an `Alg`, you can call methods to transform it:
523
+ *
524
+ * new Alg("[[R: U], R U R2']").expand().experimentalSimplify({cancel: true}).invert().log()
525
+ *
526
+ * To convert an `Alg` to a string, use .toString():
527
+ *
528
+ * new Alg("R U F").invert().toString();
529
+ *
530
+ * If you need to debug, you may also find it convenient to use .log():
531
+ *
532
+ * if (alg.isIdentical(alg.invert())) {
533
+ * alg.log("A self-inverse!")
534
+ * }
535
+ *
536
+ * For more information, see: {@link https://js.cubing.net/cubing/alg/}
537
+ *
538
+ * @category Alg
539
+ */
540
+ declare class Alg extends AlgCommon<Alg> {
541
+ #private;
542
+ constructor(alg?: FlexibleAlgSource);
543
+ /**
544
+ * Checks whether this Alg is structurally identical to another Alg. This
545
+ * essentially means that they are written identically apart from whitespace.
546
+ *
547
+ * const alg1 = new Alg("R U L'");
548
+ * const alg2 = new Alg("L U' R'").invert();
549
+ * // true
550
+ * alg1.isIdentical(alg2);
551
+ *
552
+ * // false
553
+ * new Alg("[R, U]").isIdentical(new Alg("R U R' U'"));
554
+ * // true
555
+ * new Alg("[R, U]").expand().isIdentical(new Alg("R U R' U'"));
556
+ *
557
+ * Note that .isIdentical() efficiently compares algorithms, but mainly exists
558
+ * to help optimize code when the structure of an algorithm hasn't changed.
559
+ * There are many ways to write the "same" alg on most puzzles, but is
560
+ * *highly* recommended to avoid expanding two Alg instances to compare them,
561
+ * since that can easily slow your program to a crawl if someone inputs an alg
562
+ * containing a large repetition. In general, you should use `cubing/kpuzzle`
563
+ * to compare if two algs have the same effect on a puzzle.
564
+ *
565
+ * Also note that parser annotations are not taken into account while comparing
566
+ * algs:
567
+ *
568
+ * const alg = new Alg([new Move("R"), new Move("U2")]);
569
+ * // true, even though one of the algs has parser annotations
570
+ * alg.isIdentical(new Alg("R U2"))
571
+ *
572
+ */
573
+ isIdentical(other: Comparable): boolean;
574
+ /**
575
+ * Returns the inverse of the given alg.
576
+ *
577
+ * Note that that this does not make any assumptions about what puzzle the alg
578
+ * is for. For example, U2 is its own inverse on a cube, but U2' has the same
579
+ * effect U3 (and not U2) on Megaminx:
580
+ *
581
+ * // Outputs: R U2' L'
582
+ * new Alg("L U2 R'").invert().log();
583
+ */
584
+ invert(): Alg;
585
+ /** @deprecated Use {@link Alg.expand} instead. */
586
+ experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
587
+ /**
588
+ * Expands all Grouping, Commutator, and Conjugate parts nested inside the
589
+ * alg.
590
+ *
591
+ * // F R U R' U' F'
592
+ * new Alg("[F: [R, U]]").expand().log();
593
+ *
594
+ * // F [R, U] F'
595
+ * new Alg("[F: [R, U]]").expand(({ depth: 1 }).log();
596
+ *
597
+ * Avoid calling this on a user-provided alg unless the user explicitly asks
598
+ * to see the expanded alg. Otherwise, it's easy to make your program freeze
599
+ * when someone passes in an alg like: (R U)10000000
600
+ *
601
+ * Generally, if you want to perform an operation on an entire alg, you'll
602
+ * want to use something based on the `Traversal` mechanism, like countMoves()
603
+ * from `cubing/notation`.
604
+ */
605
+ expand(options?: {
606
+ depth?: number;
607
+ }): Alg;
608
+ /** @deprecated */
609
+ experimentalLeafMoves(): Generator<Move>;
610
+ concat(input: FlexibleAlgSource): Alg;
611
+ /** @deprecated */
612
+ experimentalIsEmpty(): boolean;
613
+ static fromString(s: string): Alg;
614
+ /** @deprecated */
615
+ units(): Generator<AlgNode>;
616
+ childAlgNodes(): Generator<AlgNode>;
617
+ /** @deprecated */
618
+ experimentalNumUnits(): number;
619
+ experimentalNumChildAlgNodes(): number;
620
+ /** @deprecated */
621
+ get type(): string;
622
+ /**
623
+ * Converts the Alg to a string:
624
+ *
625
+ * const alg = new Alg([new Move("R"), new Move("U2"), new Move("L")])
626
+ * // R U2 L
627
+ * console.log(alg.toString())
628
+ */
629
+ toString(): string;
630
+ /**
631
+ * `experimentalSimplify` can perform several mostly-syntactic simplifications on an alg:
632
+ *
633
+ * // Logs: R' U3
634
+ * import { Alg } from "cubing/alg";
635
+ * new Alg("R R2' U U2").experimentalSimplify({ cancel: true }).log()
636
+ *
637
+ * You can pass in a `PuzzleLoader` (currently only for 3x3x3) for puzzle-specific simplifications:
638
+ *
639
+ * // Logs: R' U'
640
+ * import { Alg } from "cubing/alg";
641
+ * import { cube3x3x3 } from "cubing/puzzles";
642
+ * new Alg("R R2' U U2").experimentalSimplify({ cancel: true, puzzleLoader: cube3x3x3 }).log()
643
+ *
644
+ * You can also cancel only moves that are in the same direction:
645
+ *
646
+ * // Logs: R R2' U'
647
+ * import { Alg } from "cubing/alg";
648
+ * import { cube3x3x3 } from "cubing/puzzles";
649
+ * new Alg("R R2' U U2").experimentalSimplify({
650
+ * cancel: { directional: "same-direction" },
651
+ * puzzleLoader: cube3x3x3
652
+ * }).log()
653
+ *
654
+ * Additionally, you can specify how moves are "wrapped":
655
+ *
656
+ * import { Alg } from "cubing/alg";
657
+ * import { cube3x3x3 } from "cubing/puzzles";
658
+ *
659
+ * function example(puzzleSpecificModWrap) {
660
+ * alg.experimentalSimplify({
661
+ * cancel: { puzzleSpecificModWrap },
662
+ * puzzleLoader: cube3x3x3
663
+ * }).log()
664
+ * }
665
+ *
666
+ * const alg = new Alg("R7' . R6' . R5' . R6")
667
+ * example("none") // R7' . R6' . R5' . R6
668
+ * example("gravity") // R . R2' . R' . R2
669
+ * example("canonical-centered") // R . R2 . R' . R2
670
+ * example("canonical-positive") // R . R2 . R3 . R2
671
+ * example("preserve-sign") // R3' . R2' . R' . R2
672
+ *
673
+ * Same-axis and simultaneous move canonicalization is not implemented yet:
674
+ *
675
+ * // Logs: R L R
676
+ * import { Alg } from "cubing/alg";
677
+ * import { cube3x3x3 } from "cubing/puzzles";
678
+ * new Alg("R L R").experimentalSimplify({ cancel: true, puzzleLoader: cube3x3x3 }).log()
679
+ */
680
+ experimentalSimplify(options?: SimplifyOptions): Alg;
681
+ /** @deprecated See {@link experimentalSimplify} */
682
+ simplify(options?: SimplifyOptions): Alg;
683
+ }
684
+
685
+ interface ParserIndexed {
686
+ startCharIndex: number;
687
+ endCharIndex: number;
688
+ }
689
+ type Parsed<T extends Alg | AlgNode> = T & ParserIndexed;
690
+
691
+ interface NotationMapper {
692
+ notationToInternal(move: Move): Move | null;
693
+ notationToExternal(move: Move): Move | null;
694
+ }
695
+
696
+ type FaceName = string;
697
+ type OrientationDirection = [number, number, number];
698
+ type FaceBasedOrientationDescription = [
699
+ [
700
+ FaceName,
701
+ OrientationDirection
702
+ ],
703
+ [
704
+ FaceName,
705
+ OrientationDirection
706
+ ]
707
+ ];
708
+ type BaseFaceCount = 4 | 6 | 8 | 12 | 20;
709
+ type FaceBasedOrientationDescriptionLookup = Record<BaseFaceCount, FaceBasedOrientationDescription>;
710
+ declare class PuzzleGeometryFullOptions {
711
+ verbosity: number;
712
+ allMoves: boolean;
713
+ outerBlockMoves: boolean;
714
+ vertexMoves: boolean;
715
+ addRotations: boolean;
716
+ moveList: string[] | null;
717
+ fixedOrientation: boolean;
718
+ fixedPieceType: null | "e" | "v" | "f";
719
+ orientCenters: boolean;
720
+ includeCornerOrbits: boolean;
721
+ includeCenterOrbits: boolean;
722
+ includeEdgeOrbits: boolean;
723
+ excludeOrbits: string[];
724
+ optimizeOrbits: boolean;
725
+ grayCorners: boolean;
726
+ grayCenters: boolean;
727
+ grayEdges: boolean;
728
+ puzzleOrientation: FaceBasedOrientationDescription | null;
729
+ puzzleOrientations: FaceBasedOrientationDescriptionLookup | null;
730
+ scrambleAmount: number;
731
+ constructor(options?: PuzzleGeometryOptions);
732
+ }
733
+ type PuzzleGeometryOptions = Partial<PuzzleGeometryFullOptions>;
734
+
735
+ declare class Perm {
736
+ n: number;
737
+ p: number[];
738
+ constructor(a: number[]);
739
+ toString(): string;
740
+ mul(p2: Perm): Perm;
741
+ rmul(p2: Perm): Perm;
742
+ inv(): Perm;
743
+ compareTo(p2: Perm): number;
744
+ toGap(): string;
745
+ toMathematica(): string;
746
+ order(): number;
747
+ }
748
+
749
+ declare class KTransformation {
750
+ #private;
751
+ readonly kpuzzle: KPuzzle;
752
+ readonly transformationData: KTransformationData;
753
+ constructor(kpuzzle: KPuzzle, transformationData: KTransformationData);
754
+ toJSON(): any;
755
+ invert(): KTransformation;
756
+ isIdentityTransformation(): boolean;
757
+ /** @deprecated */
758
+ static experimentalConstructIdentity(kpuzzle: KPuzzle): KTransformation;
759
+ isIdentical(t2: KTransformation): boolean;
760
+ /** @deprecated */
761
+ apply(source: KTransformationSource): KTransformation;
762
+ applyTransformation(t2: KTransformation): KTransformation;
763
+ applyMove(move: Move | string): KTransformation;
764
+ applyAlg(alg: Alg | string): KTransformation;
765
+ toKPattern(): KPattern;
766
+ repetitionOrder(): number;
767
+ selfMultiply(amount: number): KTransformation;
768
+ }
769
+
770
+ declare class KPattern {
771
+ readonly kpuzzle: KPuzzle;
772
+ readonly patternData: KPatternData;
773
+ constructor(kpuzzle: KPuzzle, patternData: KPatternData);
774
+ toJSON(): any;
775
+ static fromTransformation(transformation: KTransformation): KPattern;
776
+ /** @deprecated */
777
+ apply(source: KTransformationSource): KPattern;
778
+ applyTransformation(transformation: KTransformation): KPattern;
779
+ applyMove(move: Move | string): KPattern;
780
+ applyAlg(alg: Alg | string): KPattern;
781
+ isIdentical(other: KPattern): boolean;
782
+ /** @deprecated */
783
+ experimentalToTransformation(): KTransformation | null;
784
+ experimentalIsSolved(options: {
785
+ ignorePuzzleOrientation: boolean;
786
+ ignoreCenterOrientation: boolean;
787
+ }): boolean;
788
+ }
789
+
790
+ type KPatternData = Record<string, KPatternOrbitData>;
791
+ interface KPatternOrbitData {
792
+ pieces: number[];
793
+ orientation: number[];
794
+ /** Each piece may have an "orientation mod" that means "the orientation of
795
+ * this piece is known mod [value]".
796
+ *
797
+ * Suppose `.numOrientations` for this orbit has a value of N. This is
798
+ * considered the default value for the orientation mod of each piece in the
799
+ * orbit.
800
+ *
801
+ * - Each entry must be one of the following:
802
+ * - A proper divisor of N.
803
+ * - For example: if N is 12, then one of: 1, 2, 3, 6
804
+ * - The special value 0, indicating the default value (N).
805
+ * - This indicates that the orientation of a piece is fully known, i.e.
806
+ * that its "orientation mod" is the default value (N). However, such a
807
+ * value is recorded as 0 instead of N, in order to make it simpler to
808
+ * implement and debug pattern logic involving the default value.
809
+ * - If `.orientationMod[i]` is a proper divisor of N (i.e. not 0), then
810
+ * `.orientation[i]` must be less than `.orientationMod[i]`. That is, the
811
+ * orientation values must be individually "normalized" for each piece.
812
+ * - If the `orientationMod` field is not present, then every piece is
813
+ * considered to have the default value for its "orientation mod".
814
+ *
815
+ * For a "real-world" example of this concept, consider a traditional analog
816
+ * 12-hour clock dial, like one that might hang on the wall in a school room.
817
+ * Although there are 24 hours in a day, A.M. and P.M. times are not
818
+ * distinguishable on such a clock. Since 3:00 (AM) and 15:00 are not
819
+ * distinguishable, we would read either of those times as 3:00 with an
820
+ * implicit "orientation mod" of 12.
821
+ *
822
+ * For most puzzles, however, we care about "visual" indistinguishability
823
+ * rather than "temporal" indistinguishability. To adapt the previous example,
824
+ * imagine a 24-hour clock with 24 hour marks around the dial, but where the
825
+ * hour hand is symmetric and points equally at the current hour as well as
826
+ * its diametic opposite (like a compass needle but painted all in one color).
827
+ * This has the same set of "valid patterns" as a normal 12-hour clock. Such a
828
+ * clock also has an "orientation mod" of 12, but where the multiples of the
829
+ * modulus have been "unfolded" to show their full symmetry instead of being
830
+ * implicit.
831
+ *
832
+ * For a non-trivial puzzle example, consider Eitan's FisherTwist, a shape mod
833
+ * of the 3x3x3 cube:
834
+ * https://www.hknowstore.com/locale/en-US/item.aspx?corpname=nowstore&itemid=97eb4e89-367e-4d02-b7f0-34e5e7f3cd12
835
+ *
836
+ * - The 4 equatorial centers have C₂ symmetry — it is possible to rotate any
837
+ * of these centers 180° without a visible change to the state. This means
838
+ * that the possible orientations "loop" after incrementing the orientation
839
+ * by 2 (two turns clockwise), and therefore the "orientation mod" of a
840
+ * given piece is only 2.
841
+ * - If we apply a counter-clockwise rotation to one of these centers, the
842
+ * transformation applies an orientation of 3. But the net orientation is
843
+ * recorded as a normalized value of 1 instead, because 3 (mod 2) ≡ 1 (mod
844
+ * 2).
845
+ * - The 2 polar centers (U and D) have no distinguishable rotations. This
846
+ * means that their orientation is "known mod 1" — any transformation of one
847
+ * of these centers is indistinguishable from another transformation of the
848
+ * same center, and all of them are mapped to a value of 0 (the only
849
+ * possible value that exists mod 1).
850
+ *
851
+ * For 3x3x3:
852
+ *
853
+ * - When solving a normal 3x3x3, center orientations are conventionally
854
+ * ignored. This is similar to the polar center case for Eitan's
855
+ * FisherTwist, and the "orientation mod" of each piece is 1. This is also
856
+ * the core motivating use case.
857
+ * - For a supercube
858
+ * (https://experiments.cubing.net/cubing.js/twisty/supercube.html) or the
859
+ * general case of a "picture cube", all four center orientations are
860
+ * distinguishable for every center. This means all centers have the default
861
+ * orientation mod of 4. As documented above, this can be recorded with a
862
+ * `.orientationMod` of `[0, 0, 0, 0, 0, 0]`, or equivalently by omitting
863
+ * the `.orientationMod` field.
864
+ * - When modeling a real 3x3x3 speedcube, it is common to have a logo on a
865
+ * single sticker. If you want to model the exact visually distinguishable
866
+ * states of such a puzzles, it is possible to use an `.orientationMod` such
867
+ * as `[0, 1, 1, 1, 1, 1]`. For example, this can make it easy to find an
868
+ * alg for a given case "while keeping the logo the same", without placing
869
+ * more restrictions on other centers (which could make the search slower or
870
+ * produce longer solutions).
871
+ *
872
+ * For those with a mathematical background, you may notice a relationship to
873
+ * the concept of a coset (https://en.wikipedia.org/wiki/Coset). For example,
874
+ * consider the group of patterns of a `KPuzzle` (without indistinguishable
875
+ * pieces) generated by a set of transformations. We can assign each set of
876
+ * piece orbits an orientation mod value (which must be identical for all
877
+ * constituent pieces of the same orbit). Each such choice generates a set of
878
+ * valid `KPattern`s that forms a subgroup, and each set of valid `.orientation`
879
+ * values defines one coset of this set. However, note that the set of valid
880
+ * `KPattern`s does *not* form a group when there are any pieces with different
881
+ * `.orientationMod` values that share an orbit.
882
+ *
883
+ * --------
884
+ *
885
+ * Note that the concept of "orientation mod" exclusively applies to `KPattern`,
886
+ * not `KTransformation`. If we tried to apply the orientation mod
887
+ * calculations to the *transformations* of Eitan's FisherTwist, then `SWAP =
888
+ * [U, M' E2 M]` would be indistinguishable from the identity. This would mean
889
+ * that if we calculated `SWAP` and then used this calculation for `S SWAP
890
+ * S'`, then we would conclude that it has no net effect. However, `S SWAP S'`
891
+ * does *not* have the same effect as doing nothing — it visibly rotates the L
892
+ * and R centers! (In mathematical terms: the set of `KTransformation`s would
893
+ * not form a valid set of semigroup actions, due to broken associativity.)
894
+ *
895
+ * Although there are times that we could theoretically save some time/space
896
+ * by ignoring some information when it's not needed for working with certain
897
+ * `KTransformation`s (e.g. ignoring all center orientations for 3x3x3), it is
898
+ * more practical for each `KTransformation` to always track the full range
899
+ * for each piece's `.orientation`. For example:
900
+ *
901
+ * - This is simpler, both conceptually and in code.
902
+ * - This allows changing the set of moves for a puzzle, without recalculating
903
+ * cached transformations or certain lookup tables (useful for alg
904
+ * searches).
905
+ * - This allows swapping out a normal 3x3x3 in a `<twisty-player>` for a
906
+ * picture cube, without re-calculating the center orientations of the
907
+ * current alg.
908
+ *
909
+ * These use cases may not be strictly "necessary", but the opposite behaviour
910
+ * might be surprising or frustrating if someone does not expect it. So we
911
+ * implement it this way.
912
+ *
913
+ * Informally, the `KTransformation` has the full responsibility for tracking
914
+ * "what really happens" — even if the effect is invisible in some cases,
915
+ * while the `KPattern` tracks both what "is" and what "isn't" known.
916
+ **/
917
+ orientationMod?: number[];
918
+ }
919
+ type KTransformationData = Record<string, KTransformationOrbitData>;
920
+ interface KTransformationOrbitData {
921
+ permutation: number[];
922
+ orientationDelta: number[];
923
+ }
924
+ interface KPuzzleOrbitDefinition {
925
+ orbitName: string;
926
+ numPieces: number;
927
+ numOrientations: number;
928
+ }
929
+ interface KPuzzleDefinition {
930
+ name: string;
931
+ orbits: KPuzzleOrbitDefinition[];
932
+ defaultPattern: KPatternData;
933
+ moves: Record<string, KTransformationData>;
934
+ derivedMoves?: Record<string, string>;
935
+ experimentalIsPatternSolved?: (kpattern: KPattern, options: {
936
+ ignorePuzzleOrientation: boolean;
937
+ ignoreCenterOrientation: boolean;
938
+ }) => boolean;
939
+ }
940
+
941
+ declare class PGOrbitDef {
942
+ size: number;
943
+ mod: number;
944
+ constructor(size: number, mod: number);
945
+ reassemblySize(): bigint;
946
+ }
947
+ declare class PGOrbitsDef {
948
+ orbitnames: string[];
949
+ private orbitdefs;
950
+ solved: VisibleState;
951
+ movenames: string[];
952
+ moveops: PGTransform[];
953
+ isRotation: boolean[];
954
+ forcenames: boolean[];
955
+ constructor(orbitnames: string[], orbitdefs: PGOrbitDef[], solved: VisibleState, movenames: string[], moveops: PGTransform[], isRotation: boolean[], forcenames: boolean[]);
956
+ toKTransformationData(t: PGTransform): KTransformationData;
957
+ toKPatternData(t: PGTransform): KPatternData;
958
+ static transformToKTransformationData(orbitnames: string[], t: PGTransform): KTransformationData;
959
+ private describeSet;
960
+ toKsolve(name: string, mapper?: NotationMapper): string[];
961
+ toKPuzzleDefinition(includemoves: boolean): KPuzzleDefinition;
962
+ optimize(): PGOrbitsDef;
963
+ scramble(n: number): void;
964
+ getScrambleTransformation(n: number): PGTransform;
965
+ reassemblySize(): bigint;
966
+ }
967
+ declare class PGOrbit {
968
+ perm: number[];
969
+ ori: number[];
970
+ orimod: number;
971
+ private static ktransformationCache;
972
+ static e(n: number, mod: number): PGOrbit;
973
+ constructor(perm: number[], ori: number[], orimod: number);
974
+ mul(b: PGOrbit): PGOrbit;
975
+ inv(): PGOrbit;
976
+ equal(b: PGOrbit): boolean;
977
+ killOri(): this;
978
+ toPerm(): Perm;
979
+ identicalPieces(): number[][];
980
+ order(): number;
981
+ isIdentity(): boolean;
982
+ private zeroOris;
983
+ remap(no: number[], on: number[], nv: number): PGOrbit;
984
+ remapVS(no: number[], nv: number): PGOrbit;
985
+ appendDefinition(result: string[], name: string, useVS: boolean, concise?: boolean): void;
986
+ toKTransformationOrbitData(): KTransformationOrbitData;
987
+ toKPatternOrbitData(): KPatternOrbitData;
988
+ }
989
+ declare class PGTransformBase {
990
+ orbits: PGOrbit[];
991
+ constructor(orbits: PGOrbit[]);
992
+ internalMul(b: PGTransformBase): PGOrbit[];
993
+ protected internalInv(): PGOrbit[];
994
+ equal(b: PGTransformBase): boolean;
995
+ protected killOri(): this;
996
+ toPerm(): Perm;
997
+ identicalPieces(): number[][];
998
+ order(): number;
999
+ }
1000
+ declare class PGTransform extends PGTransformBase {
1001
+ mul(b: PGTransform): PGTransform;
1002
+ mulScalar(n: number): PGTransform;
1003
+ inv(): PGTransform;
1004
+ e(): PGTransform;
1005
+ }
1006
+ declare class VisibleState extends PGTransformBase {
1007
+ mul(b: PGTransform): VisibleState;
1008
+ }
1009
+
1010
+ type PuzzleDescriptionString = string;
1011
+
1012
+ declare class Quat {
1013
+ a: number;
1014
+ b: number;
1015
+ c: number;
1016
+ d: number;
1017
+ constructor(a: number, b: number, c: number, d: number);
1018
+ mul(q: Quat): Quat;
1019
+ toString(): string;
1020
+ dist(q: Quat): number;
1021
+ len(): number;
1022
+ cross(q: Quat): Quat;
1023
+ dot(q: Quat): number;
1024
+ normalize(): Quat;
1025
+ makenormal(): Quat;
1026
+ normalizeplane(): Quat;
1027
+ smul(m: number): Quat;
1028
+ sum(q: Quat): Quat;
1029
+ sub(q: Quat): Quat;
1030
+ angle(): number;
1031
+ invrot(): Quat;
1032
+ det3x3(a00: number, a01: number, a02: number, a10: number, a11: number, a12: number, a20: number, a21: number, a22: number): number;
1033
+ rotateplane(q: Quat): Quat;
1034
+ orthogonal(): Quat;
1035
+ pointrotation(b: Quat): Quat;
1036
+ unproject(b: Quat): Quat;
1037
+ rotatepoint(q: Quat): Quat;
1038
+ rotateface(face: Quat[]): Quat[];
1039
+ intersect3(p2: Quat, p3: Quat): Quat | false;
1040
+ side(x: number): number;
1041
+ /**
1042
+ * Cuts a face by this plane, or returns null if there
1043
+ * is no intersection.
1044
+ * @param face The face to cut.
1045
+ */
1046
+ cutface(face: Quat[]): Quat[][] | null;
1047
+ cutfaces(faces: Quat[][]): Quat[][];
1048
+ faceside(face: Quat[]): number;
1049
+ sameplane(p: Quat): boolean;
1050
+ makecut(r: number): Quat;
1051
+ }
1052
+
1053
+ interface TextureMapper {
1054
+ getuv(fn: number, threed: number[]): number[];
1055
+ }
1056
+ interface StickerDatSticker {
1057
+ coords: number[];
1058
+ color: string;
1059
+ orbit: string;
1060
+ ord: number;
1061
+ ori: number;
1062
+ face: number;
1063
+ isDup?: boolean;
1064
+ }
1065
+ interface StickerDatFace {
1066
+ coords: number[];
1067
+ name: string;
1068
+ }
1069
+ type StickerDatAxis = {
1070
+ coordinates: number[];
1071
+ quantumMove: Move;
1072
+ order: number;
1073
+ };
1074
+ interface StickerDat {
1075
+ stickers: StickerDatSticker[];
1076
+ faces: StickerDatFace[];
1077
+ axis: StickerDatAxis[];
1078
+ unswizzle(mv: Move): Move | null;
1079
+ notationMapper: NotationMapper;
1080
+ textureMapper: TextureMapper;
1081
+ }
1082
+ declare const PUZZLE_BASE_SHAPES: readonly ["c", "t", "o", "d", "i"];
1083
+ type PuzzleBaseShape = (typeof PUZZLE_BASE_SHAPES)[number];
1084
+ declare const PUZZLE_CUT_TYPES: readonly ["f", "v", "e"];
1085
+ type PuzzleCutType = (typeof PUZZLE_CUT_TYPES)[number];
1086
+ type PuzzleCutDescription = {
1087
+ cutType: PuzzleCutType;
1088
+ distance: number;
1089
+ };
1090
+ type PuzzleDescription = {
1091
+ shape: PuzzleBaseShape;
1092
+ cuts: PuzzleCutDescription[];
1093
+ };
1094
+ type MoveSetGeo = [string, string, string, string, number];
1095
+ /** @category PuzzleGeometry */
1096
+ declare class PuzzleGeometry {
1097
+ puzzleDescription: PuzzleDescription;
1098
+ private rotations;
1099
+ baseplanerot: Quat[];
1100
+ private baseplanes;
1101
+ private facenames;
1102
+ private faceplanes;
1103
+ private edgenames;
1104
+ private vertexnames;
1105
+ private geonormals;
1106
+ private moveplanes;
1107
+ private moveplanes2;
1108
+ moveplanesets: Quat[][];
1109
+ private moveplanenormals;
1110
+ movesetorders: number[];
1111
+ movesetgeos: MoveSetGeo[];
1112
+ private basefaces;
1113
+ private faces;
1114
+ private facecentermass;
1115
+ private baseFaceCount;
1116
+ stickersperface: number;
1117
+ shortedge: number;
1118
+ private markedface;
1119
+ cubies: number[][];
1120
+ private vertexdistance;
1121
+ private edgedistance;
1122
+ private facetocubie;
1123
+ private facetoord;
1124
+ private moverotations;
1125
+ private facelisthash;
1126
+ private cubiesetnames;
1127
+ private cubieords;
1128
+ private cubiesetnums;
1129
+ private cubieordnums;
1130
+ private orbitoris;
1131
+ private cubievaluemap;
1132
+ private cubiesetcubies;
1133
+ cmovesbyslice: number[][][];
1134
+ parsedmovelist: [
1135
+ string | undefined,
1136
+ number,
1137
+ number,
1138
+ number,
1139
+ boolean,
1140
+ number
1141
+ ][];
1142
+ private duplicatedFaces;
1143
+ private duplicatedCubies;
1144
+ private fixedCubie;
1145
+ private net;
1146
+ private colors;
1147
+ private swizzler;
1148
+ notationMapper: NotationMapper;
1149
+ private addNotationMapper;
1150
+ private setReidOrder;
1151
+ private options;
1152
+ constructor(puzzleDescription: PuzzleDescription, options: PuzzleGeometryOptions);
1153
+ create(puzzleDescription: PuzzleDescription): void;
1154
+ private keyface;
1155
+ private keyface2;
1156
+ private keyface3;
1157
+ private findface;
1158
+ private project2d;
1159
+ allstickers(): void;
1160
+ unswizzle(mv: Move): Move | null;
1161
+ private stringToBlockMove;
1162
+ parseMove(move: Move): [string | undefined, number, number, number, boolean, number];
1163
+ private parsemove;
1164
+ genperms(): void;
1165
+ private getboundarygeometry;
1166
+ private getmovesets;
1167
+ private graybyori;
1168
+ private skipbyori;
1169
+ private skipcubie;
1170
+ private header;
1171
+ writegap(): string;
1172
+ writemathematica(): string;
1173
+ writeksolve(name?: string): string;
1174
+ getKPuzzleDefinition(fortwisty?: boolean, includemoves?: boolean): KPuzzleDefinition;
1175
+ getMoveFromBits(moverange: number[], amount: number, inverted: boolean, axiscmoves: number[][], setmoves: number[] | undefined, movesetorder: number): PGTransform;
1176
+ private omitSet;
1177
+ private diffmvsets;
1178
+ getOrbitsDef(fortwisty: boolean, includemoves?: boolean): PGOrbitsDef;
1179
+ getScramble(n?: number): KTransformationData;
1180
+ getMovesAsPerms(): Perm[];
1181
+ showcanon(disp: (s: string) => void): void;
1182
+ getsolved(): Perm;
1183
+ private getOrientationRotation;
1184
+ private getInitial3DRotation;
1185
+ private generate2dmapping;
1186
+ generatesvg(w?: number, h?: number, trim?: number, threed?: boolean): string;
1187
+ get3d(options?: {
1188
+ stickerColors?: string[];
1189
+ darkIgnoredOrbits?: boolean;
1190
+ }): StickerDat;
1191
+ getGeoNormal(geoname: string): number[] | undefined;
1192
+ private getfaceindex;
1193
+ textForTwizzleExplorer(): string;
1194
+ writeSchreierSims(tw: (s: string) => void): void;
1195
+ }
1196
+ declare class PGNotation {
1197
+ private pg;
1198
+ private orbitNames;
1199
+ constructor(pg: PuzzleGeometry, od: PGOrbitsDef);
1200
+ lookupMove(move: Move): KTransformationData | null;
1201
+ remapKPuzzleDefinition(kpuzzleDefinition: KPuzzleDefinition): KPuzzleDefinition;
1202
+ }
1203
+
1204
+ type KTransformationSource = Alg | Move | string | KTransformation;
1205
+ declare class KPuzzle {
1206
+ #private;
1207
+ readonly definition: KPuzzleDefinition;
1208
+ private experimentalPGNotation;
1209
+ constructor(definition: KPuzzleDefinition, options?: {
1210
+ experimentalPGNotation?: PGNotation;
1211
+ });
1212
+ lookupOrbitDefinition(orbitName: string): KPuzzleOrbitDefinition;
1213
+ name(): string;
1214
+ identityTransformation(): KTransformation;
1215
+ moveToTransformation(move: Move | string): KTransformation;
1216
+ algToTransformation(alg: Alg | string): KTransformation;
1217
+ /** @deprecated */
1218
+ toTransformation(source: KTransformationSource): KTransformation;
1219
+ defaultPattern(): KPattern;
1220
+ canConvertDefaultPatternToUniqueTransformation(): boolean;
1221
+ }
1222
+
1223
+ declare const experimentalStickerings: Record<string, {
1224
+ groups?: Partial<Record<PuzzleID, string>>;
1225
+ }>;
1226
+
1227
+ type FaceletMeshStickeringMask = "regular" | "dim" | "oriented" | "experimentalOriented2" | "ignored" | "invisible";
1228
+ type FaceletStickeringMask = {
1229
+ mask: FaceletMeshStickeringMask;
1230
+ hintMask?: FaceletMeshStickeringMask;
1231
+ };
1232
+ type PieceStickeringMask = {
1233
+ facelets: (FaceletMeshStickeringMask | FaceletStickeringMask | null)[];
1234
+ };
1235
+ type OrbitStickeringMask = {
1236
+ pieces: (PieceStickeringMask | null)[];
1237
+ };
1238
+ type StickeringMask = {
1239
+ specialBehaviour?: "picture";
1240
+ name?: string;
1241
+ orbits: Record<string, OrbitStickeringMask>;
1242
+ };
1243
+
1244
+ type MillisecondTimestamp = number;
1245
+ type Duration = MillisecondTimestamp;
1246
+ type Timestamp = MillisecondTimestamp;
1247
+ declare enum Direction {
1248
+ Forwards = 1,
1249
+ Paused = 0,
1250
+ Backwards = -1
1251
+ }
1252
+ interface MoveInProgress {
1253
+ move: Move;
1254
+ direction: Direction;
1255
+ fraction: number;
1256
+ }
1257
+ type PuzzlePosition = {
1258
+ pattern: KPattern;
1259
+ movesInProgress: MoveInProgress[];
1260
+ };
1261
+ declare enum BoundaryType {
1262
+ Move = "move",
1263
+ EntireTimeline = "entire-timeline"
1264
+ }
1265
+ interface TimeRange {
1266
+ start: MillisecondTimestamp;
1267
+ end: MillisecondTimestamp;
1268
+ }
1269
+
1270
+ interface UserVisibleError {
1271
+ errors: string[];
1272
+ }
1273
+ declare class UserVisibleErrorTracker extends SimpleTwistyPropSource<UserVisibleError> {
1274
+ getDefaultValue(): UserVisibleError;
1275
+ reset(): void;
1276
+ protected canReuseValue(_v1: UserVisibleError, _v2: UserVisibleError): boolean;
1277
+ }
1278
+
1279
+ type InputRecord = Record<string, any>;
1280
+ type InputProps<T extends InputRecord> = {
1281
+ [s in keyof T]: TwistyPropParent<T[s]>;
1282
+ };
1283
+ interface SourceEventDetail<OutputType> {
1284
+ sourceProp: TwistyPropSource<OutputType, any>;
1285
+ value: Promise<OutputType>;
1286
+ generation: number;
1287
+ }
1288
+ type SourceEvent<T> = CustomEvent<SourceEventDetail<T>>;
1289
+ type PromiseOrValue<T> = T | Promise<T>;
1290
+ declare abstract class TwistyPropParent<T> {
1291
+ #private;
1292
+ abstract get(): Promise<T>;
1293
+ canReuse(v1: T, v2: T): boolean;
1294
+ protected canReuseValue(_v1: T, _v2: T): boolean;
1295
+ debugGetChildren(): TwistyPropDerived<any, any>[];
1296
+ protected addChild(child: TwistyPropDerived<any, any>): void;
1297
+ protected removeChild(child: TwistyPropDerived<any, any>): void;
1298
+ protected lastSourceGeneration: number;
1299
+ protected markStale(sourceEvent: SourceEvent<any>): void;
1300
+ /** @deprecated */
1301
+ addRawListener(listener: () => void, options?: {
1302
+ initial: boolean;
1303
+ }): void;
1304
+ /** @deprecated */
1305
+ removeRawListener(listener: () => void): void;
1306
+ addFreshListener(listener: (value: T) => void): void;
1307
+ removeFreshListener(listener: (value: T) => void): void;
1308
+ }
1309
+ declare abstract class TwistyPropSource<OutputType, InputType = OutputType> extends TwistyPropParent<OutputType> {
1310
+ #private;
1311
+ abstract getDefaultValue(): PromiseOrValue<OutputType>;
1312
+ constructor(initialValue?: PromiseOrValue<InputType>);
1313
+ set(input: PromiseOrValue<InputType>): void;
1314
+ get(): Promise<OutputType>;
1315
+ protected deriveFromPromiseOrValue(input: PromiseOrValue<InputType>, oldValuePromise: Promise<OutputType>): Promise<OutputType>;
1316
+ protected abstract derive(input: InputType, oldValuePromise: Promise<OutputType>): PromiseOrValue<OutputType>;
1317
+ }
1318
+ declare abstract class SimpleTwistyPropSource<SimpleType> extends TwistyPropSource<SimpleType> {
1319
+ protected derive(input: SimpleType): PromiseOrValue<SimpleType>;
1320
+ }
1321
+ declare const NO_VALUE: unique symbol;
1322
+ type NoValueType = typeof NO_VALUE;
1323
+ declare abstract class TwistyPropDerived<InputTypes extends InputRecord, OutputType> extends TwistyPropParent<OutputType> {
1324
+ #private;
1325
+ protected userVisibleErrorTracker?: UserVisibleErrorTracker | undefined;
1326
+ constructor(parents: InputProps<InputTypes>, userVisibleErrorTracker?: UserVisibleErrorTracker | undefined);
1327
+ get(): Promise<OutputType>;
1328
+ protected abstract derive(input: InputTypes): PromiseOrValue<OutputType>;
1329
+ }
1330
+
1331
+ type SimpleDirection = Direction.Forwards | Direction.Backwards;
1332
+ interface PlayingInfo {
1333
+ playing: boolean;
1334
+ direction: SimpleDirection;
1335
+ untilBoundary: BoundaryType;
1336
+ loop: boolean;
1337
+ }
1338
+ declare class PlayingInfoProp extends TwistyPropSource<PlayingInfo, Partial<PlayingInfo>> {
1339
+ getDefaultValue(): Promise<PlayingInfo>;
1340
+ protected derive(newInfo: Partial<PlayingInfo>, oldValuePromise: Promise<PlayingInfo>): Promise<PlayingInfo>;
1341
+ protected canReuseValue(v1: PlayingInfo, v2: PlayingInfo): boolean;
1342
+ }
1343
+
1344
+ declare class ArbitraryStringProp extends SimpleTwistyPropSource<string | null> {
1345
+ getDefaultValue(): string | null;
1346
+ }
1347
+
1348
+ declare class URLProp extends TwistyPropSource<URL | null, URL | string | null> {
1349
+ getDefaultValue(): URL | null;
1350
+ derive(input: URL | string | null): URL | null;
1351
+ }
1352
+
1353
+ declare class AlgIssues {
1354
+ readonly warnings: readonly string[];
1355
+ readonly errors: readonly string[];
1356
+ constructor(issues?: {
1357
+ warnings?: string[];
1358
+ errors?: string[];
1359
+ });
1360
+ add(issues?: {
1361
+ warnings?: string[];
1362
+ errors?: string[];
1363
+ }): AlgIssues;
1364
+ /** @deprecated */
1365
+ log(): void;
1366
+ }
1367
+ interface AlgWithIssues {
1368
+ alg: Alg;
1369
+ issues: AlgIssues;
1370
+ }
1371
+ declare class AlgProp extends TwistyPropSource<AlgWithIssues, Alg | string> {
1372
+ getDefaultValue(): AlgWithIssues;
1373
+ protected canReuseValue(v1: AlgWithIssues, v2: AlgWithIssues): boolean;
1374
+ protected derive(newAlg: Alg | string): Promise<AlgWithIssues>;
1375
+ }
1376
+
1377
+ type AlgTransformationPropInputs = {
1378
+ setupAlg: AlgWithIssues;
1379
+ kpuzzle: KPuzzle;
1380
+ };
1381
+ declare class AlgTransformationProp extends TwistyPropDerived<AlgTransformationPropInputs, KTransformation> {
1382
+ derive(input: AlgTransformationPropInputs): KTransformation;
1383
+ }
1384
+
1385
+ type AnimatedLeafAlgNode = Move | Pause;
1386
+
1387
+ interface CurrentMove {
1388
+ move: Move;
1389
+ direction: Direction;
1390
+ fraction: number;
1391
+ startTimestamp: MillisecondTimestamp;
1392
+ endTimestamp: MillisecondTimestamp;
1393
+ }
1394
+ interface CurrentMoveInfo {
1395
+ patternIndex: number;
1396
+ currentMoves: CurrentMove[];
1397
+ movesFinishing: CurrentMove[];
1398
+ movesFinished: CurrentMove[];
1399
+ movesStarting: CurrentMove[];
1400
+ latestStart: number;
1401
+ earliestEnd: number;
1402
+ }
1403
+ interface AlgIndexer {
1404
+ getAnimLeaf(index: number): AnimatedLeafAlgNode | null;
1405
+ indexToMoveStartTimestamp(index: number): Timestamp;
1406
+ patternAtIndex(index: number, startPattern?: KPattern): KPattern;
1407
+ transformationAtIndex(index: number): KTransformation;
1408
+ numAnimatedLeaves(): number;
1409
+ timestampToIndex(timestamp: Timestamp): number;
1410
+ algDuration(): Duration;
1411
+ moveDuration(index: number): number;
1412
+ timestampToPosition?: (timestamp: Timestamp, startPattern?: KPattern) => PuzzlePosition;
1413
+ currentMoveInfo?: (timestamp: Timestamp) => CurrentMoveInfo;
1414
+ }
1415
+
1416
+ declare const setupToLocations: {
1417
+ start: boolean;
1418
+ end: boolean;
1419
+ };
1420
+ type SetupToLocation = keyof typeof setupToLocations;
1421
+ declare class SetupAnchorProp extends SimpleTwistyPropSource<SetupToLocation> {
1422
+ getDefaultValue(): SetupToLocation;
1423
+ }
1424
+
1425
+ interface AnchorTransformationPropInputs {
1426
+ setupTransformation: KTransformation | null;
1427
+ setupAnchor: SetupToLocation;
1428
+ setupAlgTransformation: KTransformation;
1429
+ indexer: AlgIndexer;
1430
+ }
1431
+ declare class AnchorTransformationProp extends TwistyPropDerived<AnchorTransformationPropInputs, KTransformation> {
1432
+ derive(inputs: AnchorTransformationPropInputs): KTransformation;
1433
+ }
1434
+
1435
+ interface CatchUpMove {
1436
+ move: Move | null;
1437
+ amount: number;
1438
+ }
1439
+ declare class CatchUpMoveProp extends SimpleTwistyPropSource<CatchUpMove> {
1440
+ getDefaultValue(): CatchUpMove;
1441
+ protected canReuseValue(v1: CatchUpMove, v2: CatchUpMove): boolean;
1442
+ }
1443
+
1444
+ interface CurrentLeavesSimplifiedPropInputs {
1445
+ currentMoveInfo: CurrentMoveInfo;
1446
+ }
1447
+ interface CurrentLeavesSimplified {
1448
+ patternIndex: number;
1449
+ movesFinishing: Move[];
1450
+ movesFinished: Move[];
1451
+ }
1452
+ declare class CurrentLeavesSimplifiedProp extends TwistyPropDerived<CurrentLeavesSimplifiedPropInputs, CurrentLeavesSimplified> {
1453
+ protected derive(inputs: CurrentLeavesSimplifiedPropInputs): CurrentLeavesSimplified;
1454
+ protected canReuseValue(v1: CurrentLeavesSimplified, v2: CurrentLeavesSimplified): boolean;
1455
+ }
1456
+
1457
+ declare const smartTimestamps: {
1458
+ auto: boolean;
1459
+ start: boolean;
1460
+ end: boolean;
1461
+ anchor: boolean;
1462
+ "opposite-anchor": boolean;
1463
+ };
1464
+ type TimestampRequest = MillisecondTimestamp | keyof typeof smartTimestamps;
1465
+ declare class TimestampRequestProp extends SimpleTwistyPropSource<TimestampRequest> {
1466
+ getDefaultValue(): TimestampRequest;
1467
+ set(v: PromiseOrValue<TimestampRequest>): void;
1468
+ protected validInput(v: TimestampRequest): boolean;
1469
+ }
1470
+
1471
+ interface DetailedTimelineInfoInputs {
1472
+ timestampRequest: TimestampRequest;
1473
+ timeRange: TimeRange;
1474
+ setupAnchor: SetupToLocation;
1475
+ setupAlg: AlgWithIssues;
1476
+ }
1477
+ interface DetailedTimelineInfo {
1478
+ timestamp: MillisecondTimestamp;
1479
+ timeRange: TimeRange;
1480
+ atStart: boolean;
1481
+ atEnd: boolean;
1482
+ }
1483
+ declare class DetailedTimelineInfoProp extends TwistyPropDerived<DetailedTimelineInfoInputs, DetailedTimelineInfo> {
1484
+ #private;
1485
+ protected derive(inputs: DetailedTimelineInfoInputs): DetailedTimelineInfo;
1486
+ protected canReuseValue(v1: DetailedTimelineInfo, v2: DetailedTimelineInfo): boolean;
1487
+ }
1488
+
1489
+ interface PositionPropInputs {
1490
+ indexer: AlgIndexer;
1491
+ detailedTimelineInfo: DetailedTimelineInfo;
1492
+ catchUpMove: CatchUpMove;
1493
+ }
1494
+ declare class CurrentMoveInfoProp extends TwistyPropDerived<PositionPropInputs, CurrentMoveInfo> {
1495
+ derive(inputs: PositionPropInputs): CurrentMoveInfo;
1496
+ }
1497
+
1498
+ interface CurrentTransformationPropInputs {
1499
+ anchoredStart: KTransformation;
1500
+ currentLeavesSimplified: CurrentLeavesSimplified;
1501
+ indexer: AlgIndexer;
1502
+ }
1503
+ declare class CurrentPatternProp extends TwistyPropDerived<CurrentTransformationPropInputs, KPattern> {
1504
+ derive(inputs: CurrentTransformationPropInputs): KPattern;
1505
+ }
1506
+
1507
+ declare const visualizationFormats: {
1508
+ "3D": boolean;
1509
+ "2D": boolean;
1510
+ "experimental-2D-LL": boolean;
1511
+ "experimental-2D-LL-face": boolean;
1512
+ PG3D: boolean;
1513
+ };
1514
+ type VisualizationFormat = keyof typeof visualizationFormats;
1515
+ type VisualizationFormatWithAuto = VisualizationFormat | "auto";
1516
+ declare class VisualizationFormatProp extends SimpleTwistyPropSource<VisualizationFormatWithAuto> {
1517
+ getDefaultValue(): VisualizationFormatWithAuto;
1518
+ }
1519
+
1520
+ type VisualizationStrategyPropInputs = {
1521
+ visualizationRequest: VisualizationFormatWithAuto;
1522
+ puzzleID: PuzzleID;
1523
+ };
1524
+ type VisualizationStrategy = "Cube3D" | "2D" | "experimental-2D-LL" | "experimental-2D-LL-face" | "PG3D";
1525
+ declare class VisualizationStrategyProp extends TwistyPropDerived<VisualizationStrategyPropInputs, VisualizationStrategy> {
1526
+ derive(inputs: VisualizationStrategyPropInputs): VisualizationStrategy;
1527
+ }
1528
+
1529
+ declare const puzzleIDs: {
1530
+ "3x3x3": boolean;
1531
+ custom: boolean;
1532
+ "2x2x2": boolean;
1533
+ "4x4x4": boolean;
1534
+ "5x5x5": boolean;
1535
+ "6x6x6": boolean;
1536
+ "7x7x7": boolean;
1537
+ "40x40x40": boolean;
1538
+ megaminx: boolean;
1539
+ pyraminx: boolean;
1540
+ square1: boolean;
1541
+ clock: boolean;
1542
+ skewb: boolean;
1543
+ fto: boolean;
1544
+ gigaminx: boolean;
1545
+ master_tetraminx: boolean;
1546
+ kilominx: boolean;
1547
+ redi_cube: boolean;
1548
+ melindas2x2x2x2: boolean;
1549
+ tri_quad: boolean;
1550
+ loopover: boolean;
1551
+ };
1552
+ type PuzzleID = keyof typeof puzzleIDs;
1553
+ declare class PuzzleIDRequestProp extends SimpleTwistyPropSource<PuzzleID | NoValueType> {
1554
+ getDefaultValue(): PuzzleID | NoValueType;
1555
+ }
1556
+
1557
+ declare const indexerStrategyNames: {
1558
+ auto: boolean;
1559
+ simple: boolean;
1560
+ tree: boolean;
1561
+ simultaneous: boolean;
1562
+ };
1563
+ type IndexerStrategyName = keyof typeof indexerStrategyNames;
1564
+ declare class IndexerConstructorRequestProp extends SimpleTwistyPropSource<IndexerStrategyName> {
1565
+ getDefaultValue(): IndexerStrategyName;
1566
+ }
1567
+
1568
+ type IndexerConstructor = new (kpuzzle: KPuzzle, alg: Alg) => AlgIndexer;
1569
+ interface IndexerConstructorPropInputs {
1570
+ puzzle: PuzzleID;
1571
+ alg: AlgWithIssues;
1572
+ visualizationStrategy: VisualizationStrategy;
1573
+ indexerConstructorRequest: IndexerStrategyName;
1574
+ }
1575
+ declare class IndexerConstructorProp extends TwistyPropDerived<IndexerConstructorPropInputs, IndexerConstructor> {
1576
+ derive(inputs: IndexerConstructorPropInputs): IndexerConstructor;
1577
+ }
1578
+
1579
+ type IndexerPropInputs = {
1580
+ indexerConstructor: IndexerConstructor;
1581
+ algWithIssues: AlgWithIssues;
1582
+ kpuzzle: KPuzzle;
1583
+ };
1584
+ declare class IndexerProp extends TwistyPropDerived<IndexerPropInputs, AlgIndexer> {
1585
+ derive(input: IndexerPropInputs): AlgIndexer;
1586
+ }
1587
+
1588
+ interface LegacyPositionPropInputs {
1589
+ currentMoveInfo: CurrentMoveInfo;
1590
+ currentPattern: KPattern;
1591
+ }
1592
+ declare class LegacyPositionProp extends TwistyPropDerived<LegacyPositionPropInputs, PuzzlePosition> {
1593
+ derive(inputs: LegacyPositionPropInputs): PuzzlePosition;
1594
+ }
1595
+
1596
+ declare class PuzzleAlgProp extends TwistyPropDerived<{
1597
+ algWithIssues: AlgWithIssues;
1598
+ kpuzzle: KPuzzle;
1599
+ }, AlgWithIssues> {
1600
+ derive(inputs: {
1601
+ algWithIssues: AlgWithIssues;
1602
+ kpuzzle: KPuzzle;
1603
+ }): Promise<AlgWithIssues>;
1604
+ }
1605
+
1606
+ declare class SetupTransformationProp extends SimpleTwistyPropSource<KTransformation | null> {
1607
+ getDefaultValue(): KTransformation | null;
1608
+ }
1609
+
1610
+ declare class KPuzzleProp extends TwistyPropDerived<{
1611
+ puzzleLoader: PuzzleLoader;
1612
+ }, KPuzzle> {
1613
+ derive(inputs: {
1614
+ puzzleLoader: PuzzleLoader;
1615
+ }): Promise<KPuzzle>;
1616
+ }
1617
+
1618
+ declare class PGPuzzleDescriptionStringProp extends SimpleTwistyPropSource<PuzzleDescriptionString | NoValueType> {
1619
+ getDefaultValue(): PuzzleDescriptionString | NoValueType;
1620
+ }
1621
+
1622
+ declare class PuzzleIDProp extends TwistyPropDerived<{
1623
+ puzzleLoader: PuzzleLoader;
1624
+ }, PuzzleID> {
1625
+ derive(inputs: {
1626
+ puzzleLoader: PuzzleLoader;
1627
+ }): Promise<PuzzleID>;
1628
+ }
1629
+
1630
+ interface PuzzleLoaderPropInputs {
1631
+ puzzleIDRequest: PuzzleID | NoValueType;
1632
+ puzzleDescriptionRequest: PuzzleDescriptionString | NoValueType;
1633
+ }
1634
+ declare class PuzzleLoaderProp extends TwistyPropDerived<PuzzleLoaderPropInputs, PuzzleLoader> {
1635
+ derive(inputs: PuzzleLoaderPropInputs): PuzzleLoader;
1636
+ }
1637
+
1638
+ declare let HTMLElementShim: typeof HTMLElement;
1639
+
1640
+ declare class ManagedCustomElement extends HTMLElementShim {
1641
+ readonly shadow: ShadowRoot;
1642
+ readonly contentWrapper: HTMLDivElement;
1643
+ constructor(options?: {
1644
+ mode?: "open" | "closed";
1645
+ });
1646
+ protected addCSS(cssSource: CSSStyleSheet): void;
1647
+ protected removeCSS(cssSource: CSSStyleSheet): void;
1648
+ addElement<T extends Node>(element: T): T;
1649
+ prependElement<T extends Node>(element: T): void;
1650
+ removeElement<T extends Node>(element: T): T;
1651
+ }
1652
+
1653
+ declare const viewerLinkPages: {
1654
+ twizzle: boolean;
1655
+ "experimental-twizzle-explorer": boolean;
1656
+ none: boolean;
1657
+ };
1658
+ type ViewerLinkPage = keyof typeof viewerLinkPages;
1659
+ type ViewerLinkPageWithAuto = ViewerLinkPage | "auto";
1660
+ declare class ViewerLinkProp extends SimpleTwistyPropSource<ViewerLinkPageWithAuto> {
1661
+ getDefaultValue(): ViewerLinkPageWithAuto;
1662
+ }
1663
+
1664
+ declare const buttonIcons: string[];
1665
+ type ButtonIcon = (typeof buttonIcons)[number];
1666
+ interface ButtonAppearance {
1667
+ enabled: boolean;
1668
+ icon: ButtonIcon;
1669
+ title: string;
1670
+ hidden?: boolean;
1671
+ }
1672
+ type ButtonAppearances = Record<ButtonCommand, ButtonAppearance>;
1673
+ interface ButtonAppearancePropInputs {
1674
+ coarseTimelineInfo: CoarseTimelineInfo;
1675
+ viewerLink: ViewerLinkPageWithAuto;
1676
+ }
1677
+ declare class ButtonAppearanceProp extends TwistyPropDerived<ButtonAppearancePropInputs, ButtonAppearances> {
1678
+ derive(inputs: ButtonAppearancePropInputs): ButtonAppearances;
1679
+ }
1680
+
1681
+ declare class TwistyPlayerController {
1682
+ private model;
1683
+ animationController: TwistyAnimationController;
1684
+ constructor(model: TwistyPlayerModel, delegate: TwistyAnimationControllerDelegate);
1685
+ jumpToStart(options?: {
1686
+ flash: boolean;
1687
+ }): void;
1688
+ jumpToEnd(options?: {
1689
+ flash: boolean;
1690
+ }): void;
1691
+ togglePlay(play?: boolean): void;
1692
+ visitTwizzleLink(): Promise<void>;
1693
+ }
1694
+
1695
+ declare const colorSchemes: {
1696
+ light: boolean;
1697
+ dark: boolean;
1698
+ };
1699
+ type ColorScheme = keyof typeof colorSchemes;
1700
+ type ColorSchemeWithAuto = ColorScheme | "auto";
1701
+ declare class ColorSchemeRequestProp extends SimpleTwistyPropSource<ColorSchemeWithAuto> {
1702
+ getDefaultValue(): ColorSchemeWithAuto;
1703
+ }
1704
+
1705
+ declare const buttonCommands: {
1706
+ fullscreen: boolean;
1707
+ "jump-to-start": boolean;
1708
+ "play-step-backwards": boolean;
1709
+ "play-pause": boolean;
1710
+ "play-step": boolean;
1711
+ "jump-to-end": boolean;
1712
+ "twizzle-link": boolean;
1713
+ };
1714
+ type ButtonCommand = keyof typeof buttonCommands;
1715
+ declare class TwistyButtons extends ManagedCustomElement {
1716
+ #private;
1717
+ model?: TwistyPlayerModel | undefined;
1718
+ controller?: TwistyPlayerController | undefined;
1719
+ private defaultFullscreenElement?;
1720
+ buttons: Record<ButtonCommand, TwistyButton> | null;
1721
+ constructor(model?: TwistyPlayerModel | undefined, controller?: TwistyPlayerController | undefined, defaultFullscreenElement?: HTMLElement | undefined);
1722
+ connectedCallback(): void;
1723
+ onFullscreenButton(): Promise<void>;
1724
+ update(buttonAppearances: ButtonAppearances): Promise<void>;
1725
+ updateColorScheme(colorScheme: ColorScheme): void;
1726
+ }
1727
+ declare class TwistyButton extends ManagedCustomElement {
1728
+ #private;
1729
+ htmlButton: HTMLButtonElement;
1730
+ updateColorScheme(colorScheme: ColorScheme): void;
1731
+ connectedCallback(): void;
1732
+ setIcon(iconName: ButtonIcon): void;
1733
+ }
1734
+
1735
+ interface CoarseTimelineInfoInputs {
1736
+ playingInfo: PlayingInfo;
1737
+ detailedTimelineInfo: DetailedTimelineInfo;
1738
+ }
1739
+ interface CoarseTimelineInfo {
1740
+ playing: boolean;
1741
+ atStart: boolean;
1742
+ atEnd: boolean;
1743
+ }
1744
+ declare class CoarseTimelineInfoProp extends TwistyPropDerived<CoarseTimelineInfoInputs, CoarseTimelineInfo> {
1745
+ protected derive(inputs: CoarseTimelineInfoInputs): CoarseTimelineInfo;
1746
+ protected canReuseValue(v1: CoarseTimelineInfo, v2: CoarseTimelineInfo): boolean;
1747
+ }
1748
+
1749
+ declare class TempoScaleProp extends TwistyPropSource<number, number> {
1750
+ getDefaultValue(): number;
1751
+ derive(v: number): number;
1752
+ }
1753
+
1754
+ declare const backViewLayouts: {
1755
+ none: boolean;
1756
+ "side-by-side": boolean;
1757
+ "top-right": boolean;
1758
+ };
1759
+ type BackViewLayout = keyof typeof backViewLayouts;
1760
+ type BackViewLayoutWithAuto = BackViewLayout | "auto";
1761
+ declare class BackViewProp extends SimpleTwistyPropSource<BackViewLayoutWithAuto> {
1762
+ getDefaultValue(): BackViewLayoutWithAuto;
1763
+ }
1764
+
1765
+ declare const controlsLocations: {
1766
+ "bottom-row": boolean;
1767
+ none: boolean;
1768
+ };
1769
+ type ControlsLocation = keyof typeof controlsLocations;
1770
+ type ControlPanelThemeWithAuto = ControlsLocation | "auto";
1771
+ declare class ControlPanelProp extends SimpleTwistyPropSource<ControlPanelThemeWithAuto> {
1772
+ getDefaultValue(): ControlPanelThemeWithAuto;
1773
+ }
1774
+
1775
+ declare class TimeRangeProp extends TwistyPropDerived<{
1776
+ indexer: AlgIndexer;
1777
+ }, TimeRange> {
1778
+ derive(inputs: {
1779
+ indexer: AlgIndexer;
1780
+ }): TimeRange;
1781
+ }
1782
+
1783
+ type FaceletScale = "auto" | number;
1784
+ declare class FaceletScaleProp extends SimpleTwistyPropSource<FaceletScale> {
1785
+ getDefaultValue(): FaceletScale;
1786
+ }
1787
+
1788
+ type FoundationDisplay = "auto" | "opaque" | "none";
1789
+ declare class FoundationDisplayProp extends SimpleTwistyPropSource<FoundationDisplay> {
1790
+ getDefaultValue(): FoundationDisplay;
1791
+ }
1792
+
1793
+ declare const hintFaceletStyles: {
1794
+ floating: boolean;
1795
+ none: boolean;
1796
+ };
1797
+ type HintFaceletStyle = keyof typeof hintFaceletStyles;
1798
+ type HintFaceletStyleWithAuto = HintFaceletStyle | "auto";
1799
+ declare class HintFaceletProp extends SimpleTwistyPropSource<HintFaceletStyleWithAuto> {
1800
+ getDefaultValue(): HintFaceletStyleWithAuto;
1801
+ }
1802
+
1803
+ type InitialHintFaceletsAnimation = "auto" | "always" | "none";
1804
+ declare class InitialHintFaceletsAnimationProp extends SimpleTwistyPropSource<InitialHintFaceletsAnimation> {
1805
+ getDefaultValue(): InitialHintFaceletsAnimation;
1806
+ }
1807
+
1808
+ type SpritePropInputs = {
1809
+ spriteURL: URL | null;
1810
+ };
1811
+ declare class SpriteProp extends TwistyPropDerived<SpritePropInputs, Texture | null> {
1812
+ derive(inputs: SpritePropInputs): Promise<Texture | null>;
1813
+ }
1814
+
1815
+ type ExperimentalStickering = keyof typeof experimentalStickerings;
1816
+ declare class StickeringRequestProp extends SimpleTwistyPropSource<ExperimentalStickering | null> {
1817
+ getDefaultValue(): ExperimentalStickering | null;
1818
+ }
1819
+
1820
+ interface StickeringMaskPropInputs {
1821
+ stickeringMaskRequest: StickeringMask | null;
1822
+ stickeringRequest: ExperimentalStickering | null;
1823
+ puzzleLoader: PuzzleLoader;
1824
+ }
1825
+ declare class StickeringMaskProp extends TwistyPropDerived<StickeringMaskPropInputs, StickeringMask> {
1826
+ getDefaultValue(): StickeringMask;
1827
+ derive(inputs: StickeringMaskPropInputs): Promise<StickeringMask>;
1828
+ }
1829
+
1830
+ declare class StickeringMaskRequestProp extends TwistyPropSource<StickeringMask | null, string | StickeringMask | null> {
1831
+ getDefaultValue(): StickeringMask | null;
1832
+ derive(input: string | StickeringMask | null): StickeringMask | null;
1833
+ }
1834
+
1835
+ declare const dragInputModes: {
1836
+ auto: boolean;
1837
+ none: boolean;
1838
+ };
1839
+ type DragInputMode = keyof typeof dragInputModes;
1840
+ declare class DragInputProp extends SimpleTwistyPropSource<DragInputMode> {
1841
+ getDefaultValue(): DragInputMode;
1842
+ }
1843
+
1844
+ declare class MovePressCancelOptions extends SimpleTwistyPropSource<AppendCancelOptions> {
1845
+ getDefaultValue(): AppendCancelOptions;
1846
+ }
1847
+
1848
+ declare const movePressInputNames: {
1849
+ auto: boolean;
1850
+ none: boolean;
1851
+ basic: boolean;
1852
+ };
1853
+ type MovePressInput = keyof typeof movePressInputNames;
1854
+ declare class MovePressInputProp extends SimpleTwistyPropSource<MovePressInput> {
1855
+ getDefaultValue(): MovePressInput;
1856
+ }
1857
+
1858
+ declare const backgroundThemes: {
1859
+ checkered: boolean;
1860
+ "checkered-transparent": boolean;
1861
+ none: boolean;
1862
+ };
1863
+ type BackgroundTheme = keyof typeof backgroundThemes;
1864
+ type BackgroundThemeWithAuto = BackgroundTheme | "auto";
1865
+ declare class BackgroundProp extends SimpleTwistyPropSource<BackgroundThemeWithAuto> {
1866
+ getDefaultValue(): BackgroundThemeWithAuto;
1867
+ }
1868
+
1869
+ interface ColorSchemePropInputs {
1870
+ colorSchemeRequest: ColorSchemeWithAuto;
1871
+ }
1872
+ declare class ColorSchemeProp extends TwistyPropDerived<ColorSchemePropInputs, ColorScheme> {
1873
+ protected derive(inputs: ColorSchemePropInputs): ColorScheme;
1874
+ }
1875
+
1876
+ declare class DOMElementReferenceProp extends SimpleTwistyPropSource<Element | null> {
1877
+ getDefaultValue(): Element | null;
1878
+ }
1879
+
1880
+ type CoordinateDegrees = number;
1881
+ interface OrbitCoordinates {
1882
+ latitude: CoordinateDegrees;
1883
+ longitude: CoordinateDegrees;
1884
+ distance: number;
1885
+ }
1886
+ type OrbitCoordinatesRequest = Partial<OrbitCoordinates> | "auto";
1887
+ declare class OrbitCoordinatesRequestProp extends TwistyPropSource<OrbitCoordinatesRequest, Partial<OrbitCoordinates> | "auto"> {
1888
+ getDefaultValue(): OrbitCoordinatesRequest;
1889
+ protected canReuseValue(v1: OrbitCoordinates, v2: OrbitCoordinates): boolean;
1890
+ protected derive(newCoordinates: Partial<OrbitCoordinates> | "auto", oldValuePromise: Promise<OrbitCoordinatesRequest>): Promise<OrbitCoordinatesRequest>;
1891
+ }
1892
+
1893
+ declare class LatitudeLimitProp extends SimpleTwistyPropSource<CoordinateDegrees> {
1894
+ getDefaultValue(): CoordinateDegrees;
1895
+ }
1896
+
1897
+ interface OrbitCoordinatesPropInputs {
1898
+ orbitCoordinatesRequest: OrbitCoordinatesRequest;
1899
+ latitudeLimit: CoordinateDegrees;
1900
+ puzzleID: PuzzleID;
1901
+ strategy: VisualizationStrategy;
1902
+ }
1903
+ declare class OrbitCoordinatesProp extends TwistyPropDerived<OrbitCoordinatesPropInputs, OrbitCoordinates> {
1904
+ canReuseValue(v1: OrbitCoordinates, v2: OrbitCoordinates): boolean;
1905
+ derive(inputs: OrbitCoordinatesPropInputs): Promise<OrbitCoordinates>;
1906
+ }
1907
+
1908
+ declare class TwistySceneModel {
1909
+ twistyPlayerModel: TwistyPlayerModel;
1910
+ background: BackgroundProp;
1911
+ colorSchemeRequest: ColorSchemeRequestProp;
1912
+ dragInput: DragInputProp;
1913
+ foundationDisplay: FoundationDisplayProp;
1914
+ foundationStickerSpriteURL: URLProp;
1915
+ fullscreenElement: DOMElementReferenceProp;
1916
+ hintFacelet: HintFaceletProp;
1917
+ hintStickerSpriteURL: URLProp;
1918
+ initialHintFaceletsAnimation: InitialHintFaceletsAnimationProp;
1919
+ latitudeLimit: LatitudeLimitProp;
1920
+ movePressInput: MovePressInputProp;
1921
+ movePressCancelOptions: MovePressCancelOptions;
1922
+ orbitCoordinatesRequest: OrbitCoordinatesRequestProp;
1923
+ stickeringMaskRequest: StickeringMaskRequestProp;
1924
+ stickeringRequest: StickeringRequestProp;
1925
+ faceletScale: FaceletScaleProp;
1926
+ colorScheme: ColorSchemeProp;
1927
+ foundationStickerSprite: SpriteProp;
1928
+ hintStickerSprite: SpriteProp;
1929
+ orbitCoordinates: OrbitCoordinatesProp;
1930
+ stickeringMask: StickeringMaskProp;
1931
+ constructor(twistyPlayerModel: TwistyPlayerModel);
1932
+ }
1933
+
1934
+ type Without<T, K extends string[]> = Pick<T, Exclude<keyof T, K[number]>>;
1935
+ declare class TwistyPlayerModel {
1936
+ userVisibleErrorTracker: UserVisibleErrorTracker;
1937
+ alg: AlgProp;
1938
+ backView: BackViewProp;
1939
+ controlPanel: ControlPanelProp;
1940
+ catchUpMove: CatchUpMoveProp;
1941
+ indexerConstructorRequest: IndexerConstructorRequestProp;
1942
+ playingInfo: PlayingInfoProp;
1943
+ puzzleDescriptionRequest: PGPuzzleDescriptionStringProp;
1944
+ puzzleIDRequest: PuzzleIDRequestProp;
1945
+ setupAnchor: SetupAnchorProp;
1946
+ setupAlg: AlgProp;
1947
+ setupTransformation: SetupTransformationProp;
1948
+ tempoScale: TempoScaleProp;
1949
+ timestampRequest: TimestampRequestProp;
1950
+ viewerLink: ViewerLinkProp;
1951
+ visualizationFormat: VisualizationFormatProp;
1952
+ title: ArbitraryStringProp;
1953
+ videoURL: URLProp;
1954
+ competitionID: ArbitraryStringProp;
1955
+ puzzleLoader: PuzzleLoaderProp;
1956
+ kpuzzle: KPuzzleProp;
1957
+ puzzleID: PuzzleIDProp;
1958
+ puzzleAlg: PuzzleAlgProp;
1959
+ puzzleSetupAlg: PuzzleAlgProp;
1960
+ visualizationStrategy: VisualizationStrategyProp;
1961
+ indexerConstructor: IndexerConstructorProp;
1962
+ setupAlgTransformation: AlgTransformationProp;
1963
+ indexer: IndexerProp;
1964
+ anchorTransformation: AnchorTransformationProp;
1965
+ timeRange: TimeRangeProp;
1966
+ detailedTimelineInfo: DetailedTimelineInfoProp;
1967
+ coarseTimelineInfo: CoarseTimelineInfoProp;
1968
+ currentMoveInfo: CurrentMoveInfoProp;
1969
+ buttonAppearance: ButtonAppearanceProp;
1970
+ currentLeavesSimplified: CurrentLeavesSimplifiedProp;
1971
+ currentPattern: CurrentPatternProp;
1972
+ legacyPosition: LegacyPositionProp;
1973
+ twistySceneModel: TwistySceneModel;
1974
+ twizzleLink(): Promise<string>;
1975
+ experimentalAddAlgLeaf(algLeaf: AlgLeaf, options?: AppendOptions): void;
1976
+ experimentalAddMove(flexibleMove: Move | string, options?: Without<AppendOptions, [
1977
+ "puzzleLoader",
1978
+ "puzzleSpecificSimplifyOptions"
1979
+ ]>): void;
1980
+ experimentalRemoveFinalChild(): void;
1981
+ }
1982
+
1983
+ interface TwistyAnimationControllerDelegate {
1984
+ flash(): void;
1985
+ }
1986
+ declare class TwistyAnimationController {
1987
+ #private;
1988
+ private delegate;
1989
+ private playing;
1990
+ private direction;
1991
+ private catchUpHelper;
1992
+ private model;
1993
+ private lastDatestamp;
1994
+ private lastTimestampPromise;
1995
+ private scheduler;
1996
+ constructor(model: TwistyPlayerModel, delegate: TwistyAnimationControllerDelegate);
1997
+ onPlayingProp(playingInfo: PlayingInfo): Promise<void>;
1998
+ onCatchUpMoveProp(catchUpMove: CatchUpMove): Promise<void>;
1999
+ jumpToStart(options?: {
2000
+ flash: boolean;
2001
+ }): void;
2002
+ jumpToEnd(options?: {
2003
+ flash: boolean;
2004
+ }): void;
2005
+ playPause(): void;
2006
+ play(options?: {
2007
+ direction?: SimpleDirection;
2008
+ untilBoundary?: BoundaryType;
2009
+ autoSkipToOtherEndIfStartingAtBoundary?: boolean;
2010
+ loop?: boolean;
2011
+ }): Promise<void>;
2012
+ pause(): void;
2013
+ animFrame(frameDatestamp: MillisecondTimestamp): Promise<void>;
2014
+ }
2015
+
2016
+ /**
2017
+ * @author mrdoob / http://mrdoob.com/
2018
+ * ESM conversion by Lucas Garron, 2021-12-21
2019
+ */
2020
+ declare class Stats {
2021
+ mode: number;
2022
+ dom: HTMLDivElement;
2023
+ constructor();
2024
+ addPanel(panel: StatsPanel): StatsPanel;
2025
+ showPanel(id: number): void;
2026
+ beginTime: number;
2027
+ prevTime: number;
2028
+ frames: number;
2029
+ fpsPanel: StatsPanel;
2030
+ msPanel: StatsPanel;
2031
+ memPanel: StatsPanel | null;
2032
+ REVISION: number;
2033
+ begin(): void;
2034
+ end(): number;
2035
+ update(): void;
2036
+ }
2037
+ declare class StatsPanel {
2038
+ private name;
2039
+ private fg;
2040
+ private bg;
2041
+ min: number;
2042
+ max: number;
2043
+ dom: HTMLCanvasElement;
2044
+ context: CanvasRenderingContext2D;
2045
+ constructor(name: string, fg: string, bg: string);
2046
+ update(value: number, maxValue: number): void;
2047
+ }
2048
+
2049
+ interface Schedulable {
2050
+ scheduleRender(): void;
2051
+ }
2052
+
2053
+ interface DragMovementInfo {
2054
+ attachedInfo: Record<any, any>;
2055
+ movementX: number;
2056
+ movementY: number;
2057
+ elapsedMs: number;
2058
+ }
2059
+ interface PressInfo {
2060
+ normalizedX: number;
2061
+ normalizedY: number;
2062
+ rightClick: boolean;
2063
+ keys: {
2064
+ altKey: boolean;
2065
+ ctrlOrMetaKey: boolean;
2066
+ shiftKey: boolean;
2067
+ };
2068
+ }
2069
+ declare class DragTracker extends EventTarget {
2070
+ #private;
2071
+ readonly target: HTMLElement;
2072
+ constructor(target: HTMLElement);
2073
+ start(): void;
2074
+ stop(): void;
2075
+ addTargetListener(eventType: string, listener: (e: MouseEvent) => any): void;
2076
+ private onPointerDown;
2077
+ private onPointerMove;
2078
+ private onPointerUp;
2079
+ }
2080
+
2081
+ interface Twisty3DPuzzle extends Object3D {
2082
+ onPositionChange(position: PuzzlePosition): void;
2083
+ setStickeringMask(stickeringMask: StickeringMask): void;
2084
+ }
2085
+
2086
+ declare class Twisty3DPuzzleWrapper extends EventTarget implements Schedulable {
2087
+ #private;
2088
+ private model;
2089
+ schedulable: Schedulable;
2090
+ private puzzleLoader;
2091
+ private visualizationStrategy;
2092
+ constructor(model: TwistyPlayerModel, schedulable: Schedulable, puzzleLoader: PuzzleLoader, visualizationStrategy: VisualizationStrategy);
2093
+ disconnect(): void;
2094
+ scheduleRender(): void;
2095
+ twisty3DPuzzle(): Promise<Twisty3DPuzzle>;
2096
+ raycastMove(raycasterPromise: Promise<Raycaster>, transformations: {
2097
+ invert: boolean;
2098
+ depth?: "secondSlice" | "rotation" | "none";
2099
+ }): Promise<void>;
2100
+ }
2101
+
2102
+ declare class Twisty3DSceneWrapper extends ManagedCustomElement implements Schedulable {
2103
+ #private;
2104
+ model?: TwistyPlayerModel | undefined;
2105
+ disconnect(): void;
2106
+ constructor(model?: TwistyPlayerModel | undefined);
2107
+ connectedCallback(): Promise<void>;
2108
+ setBackView(backView: BackViewLayout): void;
2109
+ onBackView(backView: BackViewLayout): void;
2110
+ onPress(e: CustomEvent<{
2111
+ pressInfo: PressInfo;
2112
+ cameraPromise: Promise<PerspectiveCamera>;
2113
+ }>): Promise<void>;
2114
+ scene(): Promise<Scene>;
2115
+ addVantage(vantage: Twisty3DVantage): void;
2116
+ removeVantage(vantage: Twisty3DVantage): void;
2117
+ experimentalVantages(): Iterable<Twisty3DVantage>;
2118
+ scheduleRender(): void;
2119
+ setCurrentTwisty3DPuzzleWrapper(scene: Scene, twisty3DPuzzleWrapper: Twisty3DPuzzleWrapper): Promise<void>;
2120
+ /** @deprecated */
2121
+ experimentalTwisty3DPuzzleWrapper(): Promise<Twisty3DPuzzleWrapper>;
2122
+ onPuzzle(inputs: [
2123
+ puzzleLoader: PuzzleLoader,
2124
+ visualizationStrategy: VisualizationStrategy
2125
+ ]): Promise<void>;
2126
+ }
2127
+
2128
+ declare class TwistyOrbitControls {
2129
+ private model;
2130
+ private mirror;
2131
+ private canvas;
2132
+ private dragTracker;
2133
+ /** @deprecated */
2134
+ experimentalInertia: boolean;
2135
+ private onMovementBound;
2136
+ experimentalHasBeenMoved: boolean;
2137
+ constructor(model: TwistyPlayerModel, mirror: boolean, canvas: HTMLCanvasElement, dragTracker: DragTracker);
2138
+ temperMovement(f: number): number;
2139
+ onMove(e: CustomEvent<DragMovementInfo>): void;
2140
+ onMovement(movementX: number, movementY: number): {
2141
+ temperedX: number;
2142
+ temperedY: number;
2143
+ };
2144
+ onUp(e: CustomEvent<DragMovementInfo>): void;
2145
+ }
2146
+
2147
+ declare class Twisty3DVantage extends ManagedCustomElement {
2148
+ #private;
2149
+ private model?;
2150
+ private options?;
2151
+ scene: Twisty3DSceneWrapper | null;
2152
+ stats: Stats | null;
2153
+ private rendererIsShared;
2154
+ loadingElement: HTMLDivElement | null;
2155
+ constructor(model?: TwistyPlayerModel | undefined, scene?: Twisty3DSceneWrapper, options?: {
2156
+ backView?: boolean;
2157
+ } | undefined);
2158
+ connectedCallback(): Promise<void>;
2159
+ clearCanvas(): Promise<void>;
2160
+ renderer(): Promise<WebGLRenderer>;
2161
+ canvasInfo(): Promise<{
2162
+ canvas: HTMLCanvasElement;
2163
+ context: CanvasRenderingContext2D;
2164
+ }>;
2165
+ camera(): Promise<PerspectiveCamera>;
2166
+ orbitControls(): Promise<TwistyOrbitControls>;
2167
+ addListener<T>(prop: TwistyPropParent<T>, listener: (value: T) => void): void;
2168
+ disconnect(): void;
2169
+ experimentalNextRenderFinishedCallback(callback: () => void): void;
2170
+ render(): Promise<void>;
2171
+ scheduleRender(): void;
2172
+ }
2173
+
2174
+ declare abstract class TwistyPlayerSettable extends ManagedCustomElement {
2175
+ experimentalModel: TwistyPlayerModel;
2176
+ set alg(newAlg: Alg | string);
2177
+ get alg(): never;
2178
+ set experimentalSetupAlg(newSetup: Alg | string);
2179
+ get experimentalSetupAlg(): never;
2180
+ set experimentalSetupAnchor(anchor: SetupToLocation);
2181
+ get experimentalSetupAnchor(): never;
2182
+ set puzzle(puzzleID: PuzzleID);
2183
+ get puzzle(): never;
2184
+ set experimentalPuzzleDescription(puzzleDescription: PuzzleDescriptionString);
2185
+ get experimentalPuzzleDescription(): never;
2186
+ set timestamp(timestamp: TimestampRequest);
2187
+ get timestamp(): never;
2188
+ set hintFacelets(hintFaceletStyle: HintFaceletStyleWithAuto);
2189
+ get hintFacelets(): never;
2190
+ set experimentalStickering(stickering: ExperimentalStickering);
2191
+ get experimentalStickering(): never;
2192
+ set experimentalStickeringMaskOrbits(stickeringMask: string | StickeringMask);
2193
+ get experimentalStickeringMaskOrbits(): never;
2194
+ set experimentalFaceletScale(faceletScale: FaceletScale);
2195
+ get experimentalFaceletScale(): never;
2196
+ set backView(backView: BackViewLayoutWithAuto);
2197
+ get backView(): never;
2198
+ set background(backgroundTheme: BackgroundThemeWithAuto);
2199
+ get background(): never;
2200
+ set colorScheme(colorScheme: ColorSchemeWithAuto);
2201
+ get colorScheme(): never;
2202
+ set controlPanel(newControlPanel: ControlPanelThemeWithAuto);
2203
+ get controlPanel(): never;
2204
+ set visualization(visualizationFormat: VisualizationFormatWithAuto);
2205
+ get visualization(): never;
2206
+ set experimentalTitle(title: string | null);
2207
+ get experimentalTitle(): never;
2208
+ set experimentalVideoURL(videoURL: string | null);
2209
+ get experimentalVideoURL(): never;
2210
+ set experimentalCompetitionID(competitionID: string | null);
2211
+ get experimentalCompetitionID(): never;
2212
+ set viewerLink(viewerLinkPage: ViewerLinkPageWithAuto);
2213
+ get viewerLink(): never;
2214
+ set experimentalMovePressInput(movePressInput: MovePressInput);
2215
+ get experimentalMovePressInput(): never;
2216
+ set experimentalMovePressCancelOptions(movePressCancelOptions: AppendCancelOptions);
2217
+ get experimentalMovePressCancelOptions(): never;
2218
+ set cameraLatitude(latitude: number);
2219
+ get cameraLatitude(): never;
2220
+ set cameraLongitude(longitude: number);
2221
+ get cameraLongitude(): never;
2222
+ set cameraDistance(distance: number);
2223
+ get cameraDistance(): never;
2224
+ set cameraLatitudeLimit(latitudeLimit: number);
2225
+ get cameraLatitudeLimit(): never;
2226
+ set indexer(indexer: IndexerStrategyName);
2227
+ get indexer(): never;
2228
+ set tempoScale(newTempoScale: number);
2229
+ get tempoScale(): never;
2230
+ set experimentalSprite(url: string | URL);
2231
+ get experimentalSprite(): never;
2232
+ set experimentalHintSprite(url: string | URL);
2233
+ get experimentalHintSprite(): never;
2234
+ set fullscreenElement(element: Element | null);
2235
+ get fullscreenElement(): never;
2236
+ set experimentalInitialHintFaceletsAnimation(anim: InitialHintFaceletsAnimation);
2237
+ get experimentalInitialHintFaceletsAnimation(): never;
2238
+ set experimentalDragInput(dragInputMode: DragInputMode);
2239
+ get experimentalDragInput(): never;
2240
+ experimentalGet: ExperimentalGetters;
2241
+ }
2242
+ declare class ExperimentalGetters {
2243
+ private model;
2244
+ constructor(model: TwistyPlayerModel);
2245
+ alg(): Promise<Alg>;
2246
+ setupAlg(): Promise<Alg>;
2247
+ puzzleID(): Promise<PuzzleID>;
2248
+ timestamp(): Promise<MillisecondTimestamp>;
2249
+ }
2250
+
2251
+ /**
2252
+ * The config argument passed to {@link TwistyPlayer} when calling the
2253
+ * constructor. This interface type be useful for avoiding bugs when you would
2254
+ * like to create a {@link TwistyPlayer} using a dynamic config, or by combining
2255
+ * configs.
2256
+ *
2257
+ * ```js
2258
+ * import { TwistyPlayer, type TwistyPlayerConfig } from "cubing/twisty";
2259
+ *
2260
+ * const MY_DEFAULT_CONFIG: TwistyPlayerConfig = {
2261
+ * puzzle: "megaminx",
2262
+ * alg: "R U R'"
2263
+ * };
2264
+ * export function createTwistyPlayer(overrideConfig: TwistyPlayerConfig) {
2265
+ * const options = { ...MY_DEFAULT_CONFIG, ...overrideConfig };
2266
+ * return new TwistyPlayer(options);
2267
+ * }
2268
+ *
2269
+ * // Example: if the current page is https://alpha.twizzle.net/edit/?alg=M2+E2+S2
2270
+ * // then this gives us the "alg" param value "M2 E2 S2".
2271
+ * const myOverrideConfig: TwistyPlayerConfig = {};
2272
+ * const algParam = new URL(location.href).searchParams.get("alg");
2273
+ * if (algParam) {
2274
+ * myOverrideConfig.alg = algParam;
2275
+ * }
2276
+ * createTwistyPlayer(myOverrideConfig);
2277
+ * ```
2278
+ *
2279
+ * @category TwistyPlayer
2280
+ */
2281
+ interface TwistyPlayerConfig {
2282
+ alg?: Alg | string;
2283
+ experimentalSetupAlg?: Alg | string;
2284
+ experimentalSetupAnchor?: SetupToLocation;
2285
+ puzzle?: PuzzleID;
2286
+ experimentalPuzzleDescription?: PuzzleDescriptionString;
2287
+ visualization?: VisualizationFormatWithAuto;
2288
+ hintFacelets?: HintFaceletStyleWithAuto;
2289
+ experimentalStickering?: ExperimentalStickering;
2290
+ experimentalStickeringMaskOrbits?: StickeringMask | string;
2291
+ background?: BackgroundThemeWithAuto;
2292
+ colorScheme?: ColorSchemeWithAuto;
2293
+ controlPanel?: ControlPanelThemeWithAuto;
2294
+ backView?: BackViewLayoutWithAuto;
2295
+ experimentalInitialHintFaceletsAnimation?: InitialHintFaceletsAnimation;
2296
+ viewerLink?: ViewerLinkPageWithAuto;
2297
+ experimentalMovePressInput?: MovePressInput;
2298
+ experimentalDragInput?: DragInputMode;
2299
+ experimentalTitle?: string | null;
2300
+ experimentalVideoURL?: string;
2301
+ experimentalCompetitionID?: string;
2302
+ cameraLatitude?: number;
2303
+ cameraLongitude?: number;
2304
+ cameraDistance?: number;
2305
+ cameraLatitudeLimit?: number;
2306
+ tempoScale?: number;
2307
+ experimentalSprite?: string | null;
2308
+ experimentalHintSprite?: string | null;
2309
+ experimentalMovePressCancelOptions?: AppendCancelOptions;
2310
+ }
2311
+ /**
2312
+ * TwistyPlayer is the heart of `cubing.js`. It can be used to display a puzzle on a web page like this:
2313
+ *
2314
+ * <script src="path/to/cubing/twisty" type="module"></script>
2315
+ * <twisty-player alg="R U R'"></twisty-player>
2316
+ *
2317
+ * You can also construct it directly in JavaScript:
2318
+ *
2319
+ * ```js
2320
+ * import { TwistyPlayer } from "cubing/twisty";
2321
+ * const twistyPlayer = new TwistyPlayer({alg: "R U R'"});
2322
+ * // Once the page has loaded, you can do this:
2323
+ * document.body.appendChild(twistyPlayer);
2324
+ * ```
2325
+ *
2326
+ * See {@link https://js.cubing.net/cubing/} for more examples.
2327
+ *
2328
+ * @category TwistyPlayer
2329
+ */
2330
+ declare class TwistyPlayer extends TwistyPlayerSettable implements TwistyAnimationControllerDelegate {
2331
+ #private;
2332
+ controller: TwistyPlayerController;
2333
+ buttons: TwistyButtons;
2334
+ experimentalCanvasClickCallback: (...args: any) => void;
2335
+ constructor(config?: TwistyPlayerConfig);
2336
+ connectedCallback(): Promise<void>;
2337
+ /** @deprecated */
2338
+ experimentalSetFlashLevel(newLevel: "auto" | "none"): void;
2339
+ flash(): void;
2340
+ experimentalCurrentVantages(): Promise<Iterable<Twisty3DVantage>>;
2341
+ experimentalCurrentCanvases(): Promise<HTMLCanvasElement[]>;
2342
+ /**
2343
+ * Get the first available puzzle `Object3D`. This can be inserted into
2344
+ * another `three.js` scene, essentially "adopting" it from the
2345
+ * `TwistyPlayer`'s scenes while still allowing the `TwistyPlayer` to animate
2346
+ * it. The function returns a `Promise` that returns if and when the
2347
+ * `Object3D` is available, and accepts a callback that is called whenever a
2348
+ * render is scheduled for the puzzle (essentially, if something about the
2349
+ * puzzle has changed, like its appearance or current animated state).
2350
+ *
2351
+ * Note:
2352
+ * - This may never resolve if the player never creates the relevant 3D object
2353
+ * under the hood (e.g. if the config is set to 2D, or is not valid for
2354
+ * rendering a puzzle)
2355
+ * - The architecture of `cubing.js` may change significantly, so it is not
2356
+ * guaranteed that a `three.js` `Object3D` will be available from the main
2357
+ * thread in the future.
2358
+ * - This function only returns the current `three.js` puzzle object (once one
2359
+ * exists). If you change e.g. the `puzzle` config for the player, then the
2360
+ * object will currently become stale. This may be replaced with more
2361
+ * convenient behaviour in the future.
2362
+ *
2363
+ * @deprecated */
2364
+ experimentalCurrentThreeJSPuzzleObject(puzzleRenderScheduledCallback?: () => void): Promise<Object3D>;
2365
+ jumpToStart(options?: {
2366
+ flash: boolean;
2367
+ }): void;
2368
+ jumpToEnd(options?: {
2369
+ flash: boolean;
2370
+ }): void;
2371
+ play(): void;
2372
+ pause(): void;
2373
+ togglePlay(play?: boolean): void;
2374
+ experimentalAddMove(flexibleMove: Move | string, options?: AppendOptions): void;
2375
+ experimentalAddAlgLeaf(algLeaf: AlgLeaf, options?: AppendOptions): void;
2376
+ static get observedAttributes(): string[];
2377
+ experimentalRemoveFinalChild(): void;
2378
+ attributeChangedCallback(attributeName: string, _oldValue: string, newValue: string): void;
2379
+ experimentalScreenshot(options?: {
2380
+ width: number;
2381
+ height: number;
2382
+ }): Promise<string>;
2383
+ experimentalDownloadScreenshot(filename?: string): Promise<void>;
2384
+ }
2385
+ declare global {
2386
+ interface HTMLElementTagNameMap {
2387
+ "twisty-player": TwistyPlayer;
2388
+ }
2389
+ }
2390
+
2391
+ declare class DataDown {
2392
+ earliestMoveIndex: number;
2393
+ twistyAlgViewer: TwistyAlgViewer;
2394
+ direction: IterationDirection;
2395
+ }
2396
+ declare class DataUp {
2397
+ moveCount: number;
2398
+ element: TwistyAlgWrapperElem | TwistyAlgLeafElem;
2399
+ }
2400
+ declare class TwistyAlgLeafElem extends ManagedCustomElement {
2401
+ algOrAlgNode: Alg | AlgNode;
2402
+ constructor(className: string, text: string, dataDown: DataDown, algOrAlgNode: Alg | AlgNode, offsetIntoMove: boolean, clickable: boolean);
2403
+ pathToIndex(_index: number): (TwistyAlgWrapperElem | TwistyAlgLeafElem)[];
2404
+ setCurrentMove(current: boolean): void;
2405
+ }
2406
+ declare class TwistyAlgWrapperElem extends HTMLElementShim {
2407
+ algOrAlgNode: Alg | AlgNode;
2408
+ private queue;
2409
+ constructor(className: string, algOrAlgNode: Alg | AlgNode);
2410
+ addString(str: string): void;
2411
+ addElem(dataUp: DataUp): number;
2412
+ flushQueue(direction?: IterationDirection): void;
2413
+ pathToIndex(_index: number): (TwistyAlgWrapperElem | TwistyAlgLeafElem)[];
2414
+ }
2415
+ declare class MoveHighlighter {
2416
+ moveCharIndexMap: Map<number, TwistyAlgLeafElem>;
2417
+ currentElem: TwistyAlgLeafElem | null;
2418
+ addMove(charIndex: number, elem: TwistyAlgLeafElem): void;
2419
+ set(move: Parsed<Move> | null): void;
2420
+ }
2421
+ /** @category Other Custom Elements */
2422
+ declare class TwistyAlgViewer extends HTMLElementShim {
2423
+ #private;
2424
+ highlighter: MoveHighlighter;
2425
+ lastClickTimestamp: number | null;
2426
+ constructor(options?: {
2427
+ twistyPlayer?: TwistyPlayer;
2428
+ });
2429
+ protected connectedCallback(): void;
2430
+ private setAlg;
2431
+ get twistyPlayer(): TwistyPlayer | null;
2432
+ set twistyPlayer(twistyPlayer: TwistyPlayer | null);
2433
+ jumpToIndex(index: number, offsetIntoMove: boolean): Promise<void>;
2434
+ protected attributeChangedCallback(attributeName: string, _oldValue: string, newValue: string): Promise<void>;
2435
+ static get observedAttributes(): string[];
2436
+ }
2437
+ declare global {
2438
+ interface HTMLElementTagNameMap {
2439
+ "twisty-alg-viewer": TwistyAlgViewer;
2440
+ }
2441
+ }
2442
+
2443
+ type AnimatedLeafAlgNodeInfo = {
2444
+ leaf: Parsed<AnimatedLeafAlgNode>;
2445
+ idx: number;
2446
+ };
2447
+ type OrderedLeafTokens = AnimatedLeafAlgNodeInfo[];
2448
+
2449
+ declare class TwistyAlgEditorValueProp extends SimpleTwistyPropSource<string> {
2450
+ getDefaultValue(): string;
2451
+ }
2452
+ interface AlgEditorAlgWithIssuesPropInput {
2453
+ value: string;
2454
+ }
2455
+ declare class AlgEditorAlgWithIssuesProp extends TwistyPropDerived<AlgEditorAlgWithIssuesPropInput, AlgWithIssues> {
2456
+ derive(input: AlgEditorAlgWithIssuesPropInput): AlgWithIssues;
2457
+ }
2458
+ interface SelectionInfoPropInput {
2459
+ selectionStart: number;
2460
+ selectionEnd: number;
2461
+ }
2462
+ interface SelectionInfo extends SelectionInfoPropInput {
2463
+ endChangedMostRecently: boolean;
2464
+ }
2465
+ declare class TwistyAlgEditorSelectionProp extends TwistyPropSource<SelectionInfo, SelectionInfoPropInput> {
2466
+ getDefaultValue(): {
2467
+ selectionStart: number;
2468
+ selectionEnd: number;
2469
+ endChangedMostRecently: boolean;
2470
+ };
2471
+ derive(input: SelectionInfoPropInput, oldValue: Promise<SelectionInfo>): Promise<SelectionInfo>;
2472
+ }
2473
+ interface TargetCharPropInputs {
2474
+ selectionInfo: SelectionInfo;
2475
+ }
2476
+ declare class TargetCharProp extends TwistyPropDerived<TargetCharPropInputs, number> {
2477
+ derive(inputs: TargetCharPropInputs): number;
2478
+ }
2479
+ interface LeafTokensPropInputs {
2480
+ algWithIssues: AlgWithIssues;
2481
+ }
2482
+ declare class LeafTokensProp extends TwistyPropDerived<LeafTokensPropInputs, OrderedLeafTokens> {
2483
+ derive(inputs: LeafTokensPropInputs): OrderedLeafTokens;
2484
+ }
2485
+ interface LeafToHighlightPropInputs {
2486
+ targetChar: number;
2487
+ leafTokens: OrderedLeafTokens;
2488
+ }
2489
+ type HighlightWhere = "before" | "start" | "inside" | "end" | "after";
2490
+ interface HighlightInfo {
2491
+ leafInfo: AnimatedLeafAlgNodeInfo;
2492
+ where: HighlightWhere;
2493
+ }
2494
+ declare class LeafToHighlightProp extends TwistyPropDerived<LeafToHighlightPropInputs, HighlightInfo | null> {
2495
+ derive(inputs: LeafToHighlightPropInputs): HighlightInfo | null;
2496
+ }
2497
+ declare class TwistyAlgEditorModel {
2498
+ valueProp: TwistyAlgEditorValueProp;
2499
+ selectionProp: TwistyAlgEditorSelectionProp;
2500
+ targetCharProp: TargetCharProp;
2501
+ algEditorAlgWithIssues: AlgEditorAlgWithIssuesProp;
2502
+ leafTokensProp: LeafTokensProp;
2503
+ leafToHighlight: LeafToHighlightProp;
2504
+ }
2505
+
2506
+ /**
2507
+ * Warning: the current implementation of <twisty-alg-editor> is *not good*,
2508
+ * but it is *good enough*. The important parts is that:
2509
+ *
2510
+ * - The editor can be used in apps without much effort.
2511
+ * - The editor handles alg validation and move highlighting *okay* when not
2512
+ * connected to a `<twisty-player>`.
2513
+ * - The editor stays in sync if it's connected to a `<twisty-player>`.
2514
+ *
2515
+ * The current implementation still has some race conditions and edge cases. A
2516
+ * proper rewrite with a better model would be very welcome.
2517
+ */
2518
+
2519
+ type TwistyPlayerAlgProp = "alg" | "setupAlg";
2520
+ /** @category Other Custom Elements */
2521
+ declare class TwistyAlgEditor extends ManagedCustomElement {
2522
+ #private;
2523
+ model: TwistyAlgEditorModel;
2524
+ debugNeverRequestTimestamp: boolean;
2525
+ constructor(options?: {
2526
+ twistyPlayer?: TwistyPlayer;
2527
+ twistyPlayerProp?: TwistyPlayerAlgProp;
2528
+ });
2529
+ connectedCallback(): void;
2530
+ set algString(s: string);
2531
+ get algString(): string;
2532
+ set placeholder(placeholderText: string);
2533
+ onInput(): void;
2534
+ onSelectionChange(): Promise<void>;
2535
+ onBlur(): Promise<void>;
2536
+ setAlgIssueClassForPuzzle(issues: "none" | "warning" | "error"): void;
2537
+ highlightLeaf(leaf: Parsed<Move | Pause> | null): void;
2538
+ get twistyPlayer(): TwistyPlayer | null;
2539
+ set twistyPlayer(twistyPlayer: TwistyPlayer | null);
2540
+ protected attributeChangedCallback(attributeName: string, _oldValue: string, newValue: string): void;
2541
+ static get observedAttributes(): string[];
2542
+ }
2543
+ declare global {
2544
+ interface HTMLElementTagNameMap {
2545
+ "twisty-alg-editor": TwistyAlgEditor;
2546
+ }
2547
+ }
2548
+
2549
+ declare class TwizzleLink extends ManagedCustomElement {
2550
+ #private;
2551
+ private options?;
2552
+ twistyPlayer: TwistyPlayer | null;
2553
+ a: HTMLAnchorElement | null;
2554
+ constructor(options?: {
2555
+ cdnForumTweaks?: boolean;
2556
+ colorScheme?: ColorSchemeWithAuto;
2557
+ } | undefined);
2558
+ connectedCallback(): Promise<void>;
2559
+ }
2560
+ declare global {
2561
+ interface HTMLElementTagNameMap {
2562
+ "twizzle-link": TwizzleLink;
2563
+ }
2564
+ }
2565
+
2566
+ type KeyMapping = {
2567
+ [keyCode: string]: AlgLeaf;
2568
+ };
2569
+ interface PuzzleLoader {
2570
+ id: string;
2571
+ fullName: string;
2572
+ inventedBy?: string[];
2573
+ inventionYear?: number;
2574
+ /** @deprecated */
2575
+ def?: never;
2576
+ kpuzzle: () => Promise<KPuzzle>;
2577
+ svg: () => Promise<string>;
2578
+ llSVG?: () => Promise<string>;
2579
+ llFaceSVG?: () => Promise<string>;
2580
+ pg?: () => Promise<PuzzleGeometry>;
2581
+ stickeringMask?: (stickering: ExperimentalStickering) => Promise<StickeringMask>;
2582
+ stickerings?: () => Promise<ExperimentalStickering[]>;
2583
+ puzzleSpecificSimplifyOptions?: PuzzleSpecificSimplifyOptions;
2584
+ puzzleSpecificSimplifyOptionsPromise?: Promise<PuzzleSpecificSimplifyOptions>;
2585
+ keyMapping?: () => Promise<KeyMapping>;
2586
+ }
2587
+
2588
+ export { Alg$1 as A, Commutator$1 as C, Grouping$1 as G, IterationDirection$1 as I, type KeyMapping as K, LineComment$1 as L, Move$1 as M, Newline$1 as N, type PuzzleSpecificSimplifyOptions$1 as P, QuantumMove$1 as Q, type SimplifyOptions$1 as S, type AlgNode$1 as a, type AlgLeaf$1 as b, type AppendOptions$1 as c, Conjugate$1 as d, Pause$1 as e, type MoveModifications$1 as f, type AlgBranch$1 as g, type AppendCancelOptions$1 as h };