cubing 0.63.2 → 0.63.3

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 (62) hide show
  1. package/dist/bin/chunks/{chunk-52ODPET6.js → chunk-OI3YIXMQ.js} +2 -2
  2. package/dist/bin/order.js +1 -1
  3. package/dist/bin/puzzle-geometry-bin.js +1 -1
  4. package/dist/bin/scramble.js +1 -1
  5. package/dist/lib/cubing/{PuzzleLoader-R-puDLmC.d.ts → PuzzleLoader-Bp8zngUn.d.ts} +10 -0
  6. package/dist/lib/cubing/alg/index.d.ts +2 -2
  7. package/dist/lib/cubing/bluetooth/index.d.ts +2 -2
  8. package/dist/lib/cubing/chunks/chunk-44CFF24P.js +239 -0
  9. package/dist/lib/cubing/chunks/chunk-44CFF24P.js.map +7 -0
  10. package/dist/lib/cubing/chunks/chunk-DQGYYYHZ.js +1180 -0
  11. package/dist/lib/cubing/chunks/chunk-DQGYYYHZ.js.map +7 -0
  12. package/dist/lib/cubing/chunks/chunk-FTE3QI5X.js +1074 -0
  13. package/dist/lib/cubing/chunks/chunk-FTE3QI5X.js.map +7 -0
  14. package/dist/lib/cubing/chunks/chunk-FZBKZ5ZB.js +265 -0
  15. package/dist/lib/cubing/chunks/chunk-FZBKZ5ZB.js.map +7 -0
  16. package/dist/lib/cubing/chunks/chunk-OUM32GEA.js +239 -0
  17. package/dist/lib/cubing/chunks/chunk-OUM32GEA.js.map +7 -0
  18. package/dist/lib/cubing/chunks/chunk-SGJ5WPE4.js +1074 -0
  19. package/dist/lib/cubing/chunks/chunk-SGJ5WPE4.js.map +7 -0
  20. package/dist/lib/cubing/chunks/chunk-TAVR35KU.js +265 -0
  21. package/dist/lib/cubing/chunks/chunk-TAVR35KU.js.map +7 -0
  22. package/dist/lib/cubing/chunks/chunk-VRTKWZPL.js +10084 -0
  23. package/dist/lib/cubing/chunks/chunk-VRTKWZPL.js.map +7 -0
  24. package/dist/lib/cubing/chunks/chunk-VSMFYTG6.js +10086 -0
  25. package/dist/lib/cubing/chunks/chunk-VSMFYTG6.js.map +7 -0
  26. package/dist/lib/cubing/chunks/inside-IHWQVDVU.js +564 -0
  27. package/dist/lib/cubing/chunks/inside-IHWQVDVU.js.map +7 -0
  28. package/dist/lib/cubing/chunks/inside-L2JI2BEY.js +564 -0
  29. package/dist/lib/cubing/chunks/inside-L2JI2BEY.js.map +7 -0
  30. package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-MXHP7O4R.js +1890 -0
  31. package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-MXHP7O4R.js.map +7 -0
  32. package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-XFECDWOF.js +1890 -0
  33. package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-XFECDWOF.js.map +7 -0
  34. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-CM33KT7L.js +1267 -0
  35. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-CM33KT7L.js.map +7 -0
  36. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-Q4LLHL2O.js +1267 -0
  37. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-Q4LLHL2O.js.map +7 -0
  38. package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-COSEVJBV.js +2922 -0
  39. package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-COSEVJBV.js.map +7 -0
  40. package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-NANDMURR.js +2922 -0
  41. package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-NANDMURR.js.map +7 -0
  42. package/dist/lib/cubing/chunks/twisty-dynamic-3d-5NZRNZ7C.js +1881 -0
  43. package/dist/lib/cubing/chunks/twisty-dynamic-3d-5NZRNZ7C.js.map +7 -0
  44. package/dist/lib/cubing/chunks/twisty-dynamic-3d-VGZIQ64W.js +1927 -0
  45. package/dist/lib/cubing/chunks/twisty-dynamic-3d-VGZIQ64W.js.map +7 -0
  46. package/dist/lib/cubing/chunks/twisty-dynamic-3d-XLUOPCLN.js +1881 -0
  47. package/dist/lib/cubing/chunks/twisty-dynamic-3d-XLUOPCLN.js.map +7 -0
  48. package/dist/lib/cubing/{events-IfSwQLYm.d.ts → events-CewDA1aS.d.ts} +1 -1
  49. package/dist/lib/cubing/{index-btIxbuNp.d.ts → index-DabjED-w.d.ts} +1 -1
  50. package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
  51. package/dist/lib/cubing/notation/index.d.ts +1 -1
  52. package/dist/lib/cubing/protocol/index.d.ts +1 -1
  53. package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
  54. package/dist/lib/cubing/puzzles/index.d.ts +1 -1
  55. package/dist/lib/cubing/scramble/index.d.ts +2 -2
  56. package/dist/lib/cubing/search/index.d.ts +3 -3
  57. package/dist/lib/cubing/stream/index.d.ts +3 -3
  58. package/dist/lib/cubing/twisty/index.d.ts +2 -2
  59. package/dist/lib/cubing/twisty/index.js +37 -4
  60. package/dist/lib/cubing/twisty/index.js.map +3 -3
  61. package/package.json +1 -1
  62. /package/dist/bin/chunks/{chunk-52ODPET6.js.map → chunk-OI3YIXMQ.js.map} +0 -0
@@ -0,0 +1,1074 @@
1
+ import {
2
+ LazyPromise,
3
+ puzzles
4
+ } from "./chunk-VSMFYTG6.js";
5
+ import {
6
+ KPattern
7
+ } from "./chunk-RINY3U6G.js";
8
+ import {
9
+ Alg,
10
+ AlgBuilder,
11
+ Move
12
+ } from "./chunk-O6HEZXGY.js";
13
+
14
+ // src/cubing/search/inside/solve/puzzles/3x3x3/index.ts
15
+ import { randomChoice as randomChoice2 } from "random-uint-below";
16
+
17
+ // src/cubing/search/inside/inside-worker.ts
18
+ var isInsideWorker = false;
19
+ function setIsInsideWorker(inside) {
20
+ isInsideWorker = inside;
21
+ }
22
+ function mustBeInsideWorker() {
23
+ if (!isInsideWorker) {
24
+ throw new Error(
25
+ "Must be called from inside a worker, to avoid impact on page performance. Try importing from the top level of `cubing/solve`?"
26
+ );
27
+ }
28
+ }
29
+
30
+ // src/cubing/search/inside/solve/addOrientationSuffix.ts
31
+ import { randomChoice } from "random-uint-below";
32
+ function addOrientationSuffix(alg, suffixSpec) {
33
+ const algBuilder = new AlgBuilder();
34
+ algBuilder.experimentalPushAlg(alg);
35
+ for (const suffix of suffixSpec) {
36
+ const choice = randomChoice(suffix);
37
+ if (choice !== null) {
38
+ algBuilder.push(Move.fromString(choice));
39
+ }
40
+ }
41
+ return algBuilder.toAlg();
42
+ }
43
+
44
+ // src/cubing/search/inside/solve/puzzles/dynamic/3x3x3/index.ts
45
+ var dynamic3x3x3min2phase = new LazyPromise(
46
+ () => import("./search-dynamic-solve-3x3x3-B2L4IN34.js")
47
+ );
48
+
49
+ // src/cubing/search/inside/solve/puzzles/3x3x3/convert.ts
50
+ var reidEdgeOrder = "UF UR UB UL DF DR DB DL FR FL BR BL".split(" ");
51
+ var reidCornerOrder = "UFR URB UBL ULF DRF DFL DLB DBR".split(" ");
52
+ var centerOrder = "U L F R B D".split(" ");
53
+ var map = [
54
+ [1, 2, 0],
55
+ [0, 2, 0],
56
+ [1, 1, 0],
57
+ [0, 3, 0],
58
+ [2, 0, 0],
59
+ [0, 1, 0],
60
+ [1, 3, 0],
61
+ [0, 0, 0],
62
+ [1, 0, 0],
63
+ [1, 0, 2],
64
+ [0, 1, 1],
65
+ [1, 1, 1],
66
+ [0, 8, 1],
67
+ [2, 3, 0],
68
+ [0, 10, 1],
69
+ [1, 4, 1],
70
+ [0, 5, 1],
71
+ [1, 7, 2],
72
+ [1, 3, 2],
73
+ [0, 0, 1],
74
+ [1, 0, 1],
75
+ [0, 9, 0],
76
+ [2, 2, 0],
77
+ [0, 8, 0],
78
+ [1, 5, 1],
79
+ [0, 4, 1],
80
+ [1, 4, 2],
81
+ [1, 5, 0],
82
+ [0, 4, 0],
83
+ [1, 4, 0],
84
+ [0, 7, 0],
85
+ [2, 5, 0],
86
+ [0, 5, 0],
87
+ [1, 6, 0],
88
+ [0, 6, 0],
89
+ [1, 7, 0],
90
+ [1, 2, 2],
91
+ [0, 3, 1],
92
+ [1, 3, 1],
93
+ [0, 11, 1],
94
+ [2, 1, 0],
95
+ [0, 9, 1],
96
+ [1, 6, 1],
97
+ [0, 7, 1],
98
+ [1, 5, 2],
99
+ [1, 1, 2],
100
+ [0, 2, 1],
101
+ [1, 2, 1],
102
+ [0, 10, 0],
103
+ [2, 4, 0],
104
+ [0, 11, 0],
105
+ [1, 7, 1],
106
+ [0, 6, 1],
107
+ [1, 6, 2]
108
+ ];
109
+ function rotateLeft(s, i) {
110
+ return s.slice(i) + s.slice(0, i);
111
+ }
112
+ function toReid333Struct(pattern) {
113
+ const output = [[], []];
114
+ for (let i = 0; i < 6; i++) {
115
+ if (pattern.patternData["CENTERS"].pieces[i] !== i) {
116
+ throw new Error("non-oriented puzzles are not supported");
117
+ }
118
+ }
119
+ for (let i = 0; i < 12; i++) {
120
+ output[0].push(
121
+ rotateLeft(
122
+ reidEdgeOrder[pattern.patternData["EDGES"].pieces[i]],
123
+ pattern.patternData["EDGES"].orientation[i]
124
+ )
125
+ );
126
+ }
127
+ for (let i = 0; i < 8; i++) {
128
+ output[1].push(
129
+ rotateLeft(
130
+ reidCornerOrder[pattern.patternData["CORNERS"].pieces[i]],
131
+ pattern.patternData["CORNERS"].orientation[i]
132
+ )
133
+ );
134
+ }
135
+ output.push(centerOrder);
136
+ return output;
137
+ }
138
+ function toMin2PhasePattern(pattern) {
139
+ const reid = toReid333Struct(pattern);
140
+ return map.map(([orbit, perm, ori]) => reid[orbit][perm][ori]).join("");
141
+ }
142
+
143
+ // src/cubing/search/inside/solve/puzzles/3x3x3/filter.ts
144
+ function isEquivalentTranformationIgnoringCENTERS(t1, t2) {
145
+ const t1NoCenterOri = new KPattern(t1.kpuzzle, {
146
+ EDGES: t1.patternData["EDGES"],
147
+ CORNERS: t1.patternData["CORNERS"],
148
+ CENTERS: {
149
+ pieces: t1.patternData["CENTERS"].pieces,
150
+ orientation: new Array(6).fill(0)
151
+ }
152
+ }).experimentalToTransformation();
153
+ const t2NoCenterOri = new KPattern(t2.kpuzzle, {
154
+ EDGES: t2.patternData["EDGES"],
155
+ CORNERS: t2.patternData["CORNERS"],
156
+ CENTERS: {
157
+ pieces: t2.patternData["CENTERS"].pieces,
158
+ orientation: new Array(6).fill(0)
159
+ }
160
+ }).experimentalToTransformation();
161
+ return t1NoCenterOri.isIdentical(t2NoCenterOri);
162
+ }
163
+ function passesFilter(kpuzzle, pattern) {
164
+ if (isEquivalentTranformationIgnoringCENTERS(kpuzzle.defaultPattern(), pattern)) {
165
+ return false;
166
+ }
167
+ for (const face of "ULFRBD") {
168
+ for (let amount = 1; amount < 4; amount++) {
169
+ const transformation = kpuzzle.moveToTransformation(new Move(face, amount)).toKPattern();
170
+ if (isEquivalentTranformationIgnoringCENTERS(transformation, pattern)) {
171
+ return false;
172
+ }
173
+ }
174
+ }
175
+ return true;
176
+ }
177
+
178
+ // src/cubing/search/inside/solve/puzzles/3x3x3/legacy-sgs.ts
179
+ var sgs3x3x3 = [
180
+ [
181
+ "R U'",
182
+ "R2 B",
183
+ //
184
+ "D2 B2",
185
+ "D' L B'",
186
+ //
187
+ "R' U'",
188
+ "B",
189
+ //
190
+ "D B2",
191
+ "R' B",
192
+ //
193
+ "L' U",
194
+ "L2 B'",
195
+ //
196
+ "B2",
197
+ "D L B'",
198
+ //
199
+ "L U",
200
+ "B'",
201
+ //
202
+ "U'",
203
+ "R B",
204
+ //
205
+ "D' B2",
206
+ "L B'",
207
+ //
208
+ "U2",
209
+ "U L' B'",
210
+ //
211
+ "",
212
+ "U' L' B'",
213
+ //
214
+ "U",
215
+ "L' B'"
216
+ ],
217
+ [
218
+ "F2 L2",
219
+ "F' L'",
220
+ "R' F L2",
221
+ //
222
+ "D' L2",
223
+ "F L2",
224
+ "F2 L'",
225
+ //
226
+ "R' F' L'",
227
+ "R2 F L2",
228
+ "R2 F2 L'",
229
+ //
230
+ "L2",
231
+ "F L'",
232
+ "D' L",
233
+ //
234
+ "D2 L2",
235
+ "R2 F' L'",
236
+ "D L",
237
+ //
238
+ "",
239
+ "L2 F L'",
240
+ "L F' L2",
241
+ //
242
+ "L F L'",
243
+ "F' L2",
244
+ "L'",
245
+ //
246
+ "D L2",
247
+ "D F L'",
248
+ "L"
249
+ ],
250
+ [
251
+ "R B U2 B'",
252
+ "R2 B U' B'",
253
+ //
254
+ "F2 B U B'",
255
+ "F B2 L' B2",
256
+ //
257
+ "B2 L B2",
258
+ "B U' B'",
259
+ //
260
+ "R2 B U2 B'",
261
+ "R' B U' B'",
262
+ //
263
+ "B2 L' B2",
264
+ "F B U B'",
265
+ //
266
+ "B2 U' B2",
267
+ "B' L B",
268
+ //
269
+ "L F' B D' B'",
270
+ "B' U' B2 D B'",
271
+ //
272
+ "B U2 B'",
273
+ "R B U' B'",
274
+ //
275
+ "B2 L2 B2",
276
+ "D' B' L B",
277
+ //
278
+ "B U B'",
279
+ "F' B2 L' B2",
280
+ //
281
+ "",
282
+ "B2 L' B' U' B'"
283
+ ],
284
+ [
285
+ "U F2 L2 U'",
286
+ "F' U L' U'",
287
+ //
288
+ "F2 U L' U'",
289
+ "U F L2 U'",
290
+ //
291
+ "U2 B2 U2",
292
+ "R' U' B U",
293
+ //
294
+ "D2 U L U'",
295
+ "D U2 B' U2",
296
+ //
297
+ "U L2 U'",
298
+ "F U L' U'",
299
+ //
300
+ "D U L U'",
301
+ "U2 B' U2",
302
+ //
303
+ "",
304
+ "U2 B' U' L' U'",
305
+ //
306
+ "U2 L' U2",
307
+ "U' B U",
308
+ //
309
+ "U L U'",
310
+ "D' U2 B' U2",
311
+ //
312
+ "U L' U'",
313
+ "U2 B U2"
314
+ ],
315
+ [
316
+ "R' D' F2",
317
+ "F'",
318
+ //
319
+ "F2",
320
+ "D R F'",
321
+ //
322
+ "R D' F2",
323
+ "R2 F'",
324
+ //
325
+ "D' F2",
326
+ "R F'",
327
+ //
328
+ "F2 R' D' F2",
329
+ "F",
330
+ //
331
+ "D2 F2",
332
+ "D' R F'",
333
+ //
334
+ "R2 D' F2",
335
+ "R' F'",
336
+ //
337
+ "D F2",
338
+ "D2 R F'",
339
+ //
340
+ "",
341
+ "F R' D' F2"
342
+ ],
343
+ [
344
+ "R' D2 F' D F",
345
+ "R F2 R2 F2",
346
+ "R2 F' D2 F",
347
+ //
348
+ "F' R2 D2 F",
349
+ "L D' L'",
350
+ "D F' D2 F",
351
+ //
352
+ "F2 R2 F2",
353
+ "R F' D2 F",
354
+ "F' R2 D' F",
355
+ //
356
+ "F' R' D2 F",
357
+ "F2 R' F2",
358
+ "L D L'",
359
+ //
360
+ "F' R D' F",
361
+ "F2 R F2",
362
+ "F' D2 F",
363
+ //
364
+ "",
365
+ "L D2 R D' L'",
366
+ "F' D2 F' R F2",
367
+ //
368
+ "D2 R2 F2 R2 F2",
369
+ "D F' D' F",
370
+ "F' D F"
371
+ ],
372
+ [
373
+ "U F2 U'",
374
+ "R U F' U'",
375
+ //
376
+ "D R U F2 U'",
377
+ "U F U'",
378
+ //
379
+ "R2 U F2 U'",
380
+ "R' U F' U'",
381
+ //
382
+ "R U F2 U'",
383
+ "R2 U F' U'",
384
+ //
385
+ "",
386
+ "U L D L' F U'",
387
+ //
388
+ "F2 D' R D F2",
389
+ "D2 U F U'",
390
+ //
391
+ "R' U F2 U'",
392
+ "U F' U'",
393
+ //
394
+ "F2 D2 R D2 F2",
395
+ "D U F U'"
396
+ ],
397
+ [
398
+ "R2",
399
+ "R' B' D B",
400
+ //
401
+ "D R'",
402
+ "F' R2 F",
403
+ //
404
+ "",
405
+ "R B' D B",
406
+ //
407
+ "R'",
408
+ "B' D B",
409
+ //
410
+ "D' R'",
411
+ "D2 F' R2 F",
412
+ //
413
+ "R",
414
+ "R2 B' D B",
415
+ //
416
+ "D2 R'",
417
+ "B' D' B"
418
+ ],
419
+ [
420
+ "R2 D' R2",
421
+ "F' R' F R",
422
+ "R D' R2 D R'",
423
+ //
424
+ "D2 R2 D2 R2",
425
+ "R' D' F' R F",
426
+ "U F D F' U'",
427
+ //
428
+ "",
429
+ "R2 D2 B R' B' R'",
430
+ "R' F D' F2 R F",
431
+ //
432
+ "R2 D R2",
433
+ "F2 U F U' F",
434
+ "R' D F' R F",
435
+ //
436
+ "D R2 D2 R2",
437
+ "U F D' F' U'",
438
+ "D R' D2 F' R F",
439
+ //
440
+ "R2 D2 R2",
441
+ "U F D2 F' U'",
442
+ "R' D2 F' R F"
443
+ ],
444
+ [
445
+ "B R B'",
446
+ "F D F' B R2 B'",
447
+ //
448
+ "D B R2 B'",
449
+ "D2 B R' B'",
450
+ //
451
+ "B R2 B'",
452
+ "D B R' B'",
453
+ //
454
+ "D' B R2 B'",
455
+ "B R' B'",
456
+ //
457
+ "",
458
+ "B R2 B' D B R' B'",
459
+ //
460
+ "D2 B R2 B'",
461
+ "D' B R' B'"
462
+ ],
463
+ [
464
+ "",
465
+ "R' D R F D2 F'",
466
+ //
467
+ "R' D R",
468
+ "D F D' F'",
469
+ //
470
+ "R F' R' F",
471
+ "F D' F'",
472
+ //
473
+ "R' D' R",
474
+ "F D2 F'",
475
+ //
476
+ "R' D2 R",
477
+ "F D F'"
478
+ ],
479
+ [
480
+ "",
481
+ "F2 D2 R F' R' D2 F' D2 F'",
482
+ "F2 D2 F' D' F D' F' D2 F'",
483
+ //
484
+ "F2 D F2 D F2 D2 F2",
485
+ "D2 F L D2 L' D2 F'",
486
+ "D F D2 L D2 L' F'",
487
+ //
488
+ "R' D B' D2 B D' R",
489
+ "R' D2 B' D2 B R",
490
+ "F D2 F' D F D F'",
491
+ //
492
+ "F D' L D2 L' D F'",
493
+ "B D' F D B' D' F'",
494
+ "F D2 L D2 L' F'",
495
+ //
496
+ "F D' L D L' D F'",
497
+ "F L D2 L' D2 F'",
498
+ "R' B' D2 B D2 R"
499
+ ],
500
+ [
501
+ "D'",
502
+ "F L D L' D' F'",
503
+ //
504
+ "D2",
505
+ "L B D B' D' L'",
506
+ //
507
+ "D",
508
+ "B' L' D' L D B",
509
+ //
510
+ "",
511
+ "D F L D L' D' F'"
512
+ ],
513
+ [
514
+ "F' D2 F D F' D F",
515
+ "F' D' R' D R F",
516
+ //
517
+ "F' R' D' R D F",
518
+ "B D R D' R' B'",
519
+ //
520
+ "",
521
+ "D B' D' L' D L B"
522
+ ],
523
+ [
524
+ "D F D F' D F D2 F'",
525
+ "F' U2 B' R' B U2 F' L F' L' F'",
526
+ //
527
+ "",
528
+ "D2 L D L2 F L F2 D F"
529
+ ],
530
+ [
531
+ "L B' L' F L B L' F'",
532
+ "F2 U F' D2 F U' F' D2 F'",
533
+ "D' F' D B D' F D B'",
534
+ //
535
+ "F L2 F R2 F' L2 F R2 F2",
536
+ "D B D' F' D B' D' F",
537
+ "R F L F' R' F L' F'",
538
+ //
539
+ "",
540
+ "D2 B L' U2 L B' D2 B L' U2 L B'",
541
+ "D2 F R' U2 R F' D2 F R' U2 R F'",
542
+ //
543
+ "R F L' F' R' F L F'",
544
+ "D F D' B' D F' D' B",
545
+ "L2 F2 L' B2 L F2 L' B2 L'"
546
+ ],
547
+ [
548
+ "L B R' B' L' B R B'",
549
+ "R' B R F' R' B' R F",
550
+ "L D2 L U L' D2 L U' L2",
551
+ //
552
+ "",
553
+ "D2 B' D2 F D' L2 F L2 F' D2 B D' F'",
554
+ "D2 F' R' F R2 B' D2 B D2 R' F D2 F'",
555
+ //
556
+ "L B L' F L B' L' F'",
557
+ "F' D2 F' U' F D2 F' U F2",
558
+ "D' B' D F D' B D F'"
559
+ ],
560
+ ["", "D2 F' L U2 L' F D2 F' L U2 L' F", "D2 B' R U2 R' B D2 B' R U2 R' B"]
561
+ ];
562
+
563
+ // src/cubing/search/inside/solve/puzzles/3x3x3/index.ts
564
+ async function random333Pattern() {
565
+ const kpuzzle = await puzzles["3x3x3"].kpuzzle();
566
+ let pattern = kpuzzle.defaultPattern();
567
+ for (const piece of sgs3x3x3) {
568
+ pattern = pattern.applyAlg(Alg.fromString(randomChoice2(piece)));
569
+ }
570
+ if (!passesFilter(kpuzzle, pattern)) {
571
+ return random333Pattern();
572
+ }
573
+ return pattern;
574
+ }
575
+ async function solve333(s) {
576
+ mustBeInsideWorker();
577
+ return Alg.fromString(
578
+ (await dynamic3x3x3min2phase).solvePattern(toMin2PhasePattern(s))
579
+ );
580
+ }
581
+ async function random333Scramble() {
582
+ return solve333(await random333Pattern());
583
+ }
584
+ async function initialize333() {
585
+ (await dynamic3x3x3min2phase).initialize();
586
+ }
587
+ var randomSuffixes = [
588
+ [null, "Rw", "Rw2", "Rw'", "Fw", "Fw'"],
589
+ [null, "Dw", "Dw2", "Dw'"]
590
+ ];
591
+ async function random333OrientedScramble() {
592
+ return addOrientationSuffix(await random333Scramble(), randomSuffixes);
593
+ }
594
+
595
+ // src/cubing/vendor/apache/comlink-everywhere/comlink.ts
596
+ var proxyMarker = Symbol("Comlink.proxy");
597
+ var createEndpoint = Symbol("Comlink.endpoint");
598
+ var releaseProxy = Symbol("Comlink.releaseProxy");
599
+ var finalizer = Symbol("Comlink.finalizer");
600
+ var throwMarker = Symbol("Comlink.thrown");
601
+ var REF_COUNT_BY_DEFAULT = true;
602
+ var isObject = (val) => typeof val === "object" && val !== null || typeof val === "function";
603
+ var proxyTransferHandler = {
604
+ canHandle: (val) => isObject(val) && val[proxyMarker],
605
+ serialize(obj) {
606
+ const { port1, port2 } = new MessageChannel();
607
+ expose(obj, port1);
608
+ return [port2, [port2]];
609
+ },
610
+ deserialize(port) {
611
+ port.start();
612
+ return wrap(port);
613
+ }
614
+ };
615
+ var throwTransferHandler = {
616
+ canHandle: (value) => isObject(value) && throwMarker in value,
617
+ serialize({ value }) {
618
+ let serialized;
619
+ if (value instanceof Error) {
620
+ serialized = {
621
+ isError: true,
622
+ value: {
623
+ message: value.message,
624
+ name: value.name,
625
+ stack: value.stack
626
+ }
627
+ };
628
+ } else {
629
+ serialized = { isError: false, value };
630
+ }
631
+ return [serialized, []];
632
+ },
633
+ deserialize(serialized) {
634
+ if (serialized.isError) {
635
+ throw Object.assign(
636
+ new Error(serialized.value.message),
637
+ serialized.value
638
+ );
639
+ }
640
+ throw serialized.value;
641
+ }
642
+ };
643
+ function unrefWorkaround(reffable) {
644
+ const unref = reffable.unref?.bind(reffable);
645
+ if (!unref) {
646
+ return;
647
+ }
648
+ return () => {
649
+ for (let i = 0; i < 5; i++) {
650
+ unref();
651
+ }
652
+ };
653
+ }
654
+ var transferHandlers = /* @__PURE__ */ new Map([
655
+ ["proxy", proxyTransferHandler],
656
+ ["throw", throwTransferHandler]
657
+ ]);
658
+ function nodeEndpoint(rawEndpoint) {
659
+ const listeners = {};
660
+ function removeEventListener(event, eh) {
661
+ const l = listeners[event]?.get(eh);
662
+ if (!l) {
663
+ return;
664
+ }
665
+ rawEndpoint.off(event, l);
666
+ listeners[event]?.delete(eh);
667
+ }
668
+ return {
669
+ postMessage: rawEndpoint.postMessage.bind(rawEndpoint),
670
+ addEventListener: (event, handler, options) => {
671
+ const listener = (data) => {
672
+ if (options?.once) {
673
+ removeEventListener(event, listener);
674
+ }
675
+ if ("handleEvent" in handler) {
676
+ handler.handleEvent({ data });
677
+ } else {
678
+ handler({ data });
679
+ }
680
+ };
681
+ rawEndpoint.on(event, listener);
682
+ (listeners[event] ?? /* @__PURE__ */ new WeakMap()).set(handler, listener);
683
+ },
684
+ removeEventListener,
685
+ // In theory, `node` exposes these on `Symbol.for('nodejs.ref') ` and
686
+ // `Symbol.for('nodejs.unref') ` fields. In practice, this is not supported across all runtimes.
687
+ ref: rawEndpoint.ref?.bind(rawEndpoint),
688
+ unref: unrefWorkaround(rawEndpoint),
689
+ start: rawEndpoint.start?.bind(rawEndpoint),
690
+ terminate: rawEndpoint.terminate?.bind(
691
+ rawEndpoint
692
+ ),
693
+ close: rawEndpoint.close?.bind(rawEndpoint)
694
+ };
695
+ }
696
+ function toEndpoint(endpoint) {
697
+ if (!("addEventListener" in endpoint) || !("removeEventListener" in endpoint)) {
698
+ return nodeEndpoint(endpoint);
699
+ }
700
+ return endpoint;
701
+ }
702
+ function isAllowedOrigin(allowedOrigins, origin) {
703
+ for (const allowedOrigin of allowedOrigins) {
704
+ if (origin === allowedOrigin || allowedOrigin === "*") {
705
+ return true;
706
+ }
707
+ if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {
708
+ return true;
709
+ }
710
+ }
711
+ return false;
712
+ }
713
+ function defaultExposeEndpoint() {
714
+ return globalThis.process?.getBuiltinModule("node:worker_threads").parentPort ?? globalThis;
715
+ }
716
+ function expose(obj, endpoint = defaultExposeEndpoint(), allowedOrigins = ["*"]) {
717
+ const ep = toEndpoint(endpoint);
718
+ ep.addEventListener("message", function callback(ev) {
719
+ if (!ev || !ev.data) {
720
+ return;
721
+ }
722
+ if (!isAllowedOrigin(allowedOrigins, ev.origin)) {
723
+ console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);
724
+ return;
725
+ }
726
+ const { id, type, path } = {
727
+ path: [],
728
+ ...ev.data
729
+ };
730
+ const argumentList = (ev.data.argumentList || []).map(fromWireValue);
731
+ let returnValue;
732
+ try {
733
+ const parent = path.slice(0, -1).reduce((obj2, prop) => obj2[prop], obj);
734
+ const rawValue = path.reduce((obj2, prop) => obj2[prop], obj);
735
+ switch (type) {
736
+ case "GET" /* GET */:
737
+ {
738
+ returnValue = rawValue;
739
+ }
740
+ break;
741
+ case "SET" /* SET */:
742
+ {
743
+ parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);
744
+ returnValue = true;
745
+ }
746
+ break;
747
+ case "APPLY" /* APPLY */:
748
+ {
749
+ returnValue = rawValue.apply(parent, argumentList);
750
+ }
751
+ break;
752
+ case "CONSTRUCT" /* CONSTRUCT */:
753
+ {
754
+ const value = new rawValue(...argumentList);
755
+ returnValue = proxy(value);
756
+ }
757
+ break;
758
+ case "ENDPOINT" /* ENDPOINT */:
759
+ {
760
+ const { port1, port2 } = new MessageChannel();
761
+ expose(obj, port2);
762
+ returnValue = transfer(port1, [port1]);
763
+ }
764
+ break;
765
+ case "RELEASE" /* RELEASE */:
766
+ {
767
+ returnValue = void 0;
768
+ }
769
+ break;
770
+ default:
771
+ return;
772
+ }
773
+ } catch (value) {
774
+ returnValue = { value, [throwMarker]: 0 };
775
+ }
776
+ Promise.resolve(returnValue).catch((value) => {
777
+ return { value, [throwMarker]: 0 };
778
+ }).then((returnValue2) => {
779
+ const [wireValue, transferables] = toWireValue(returnValue2);
780
+ ep.postMessage({ ...wireValue, id }, transferables);
781
+ if (type === "RELEASE" /* RELEASE */) {
782
+ ep.removeEventListener("message", callback);
783
+ closeEndPoint(ep);
784
+ if (finalizer in obj && typeof obj[finalizer] === "function") {
785
+ obj[finalizer]();
786
+ }
787
+ }
788
+ }).catch((_error) => {
789
+ console.log(_error);
790
+ const [wireValue, transferables] = toWireValue({
791
+ value: new TypeError("Unserializable return value"),
792
+ [throwMarker]: 0
793
+ });
794
+ ep.postMessage({ ...wireValue, id }, transferables);
795
+ });
796
+ });
797
+ ep.start?.();
798
+ }
799
+ function closeEndPoint(endpoint) {
800
+ endpoint.close?.();
801
+ endpoint.terminate?.();
802
+ }
803
+ function wrap(endpoint, target, options) {
804
+ const ep = toEndpoint(endpoint);
805
+ const pendingListeners = /* @__PURE__ */ new Map();
806
+ ep.addEventListener("message", function handleMessage(ev) {
807
+ const { data } = ev;
808
+ if (!data || !data.id) {
809
+ return;
810
+ }
811
+ const resolver = pendingListeners.get(data.id);
812
+ if (!resolver) {
813
+ return;
814
+ }
815
+ try {
816
+ resolver(data);
817
+ } finally {
818
+ pendingListeners.delete(data.id);
819
+ if (pendingListeners.size === 0 && (options?.refCount ?? REF_COUNT_BY_DEFAULT)) {
820
+ ep.unref?.();
821
+ }
822
+ }
823
+ });
824
+ return createProxy({ endpoint: ep, pendingListeners }, [], target);
825
+ }
826
+ function throwIfProxyReleased(isReleased) {
827
+ if (isReleased) {
828
+ throw new Error("Proxy has been released and is not useable");
829
+ }
830
+ }
831
+ function releaseEndpoint(epWithPendingListeners) {
832
+ return requestResponseMessage(epWithPendingListeners, {
833
+ type: "RELEASE" /* RELEASE */
834
+ }).then(() => {
835
+ closeEndPoint(epWithPendingListeners.endpoint);
836
+ });
837
+ }
838
+ var proxyCounter = /* @__PURE__ */ new WeakMap();
839
+ var proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry(
840
+ (epWithPendingListeners) => {
841
+ const newCount = (proxyCounter.get(epWithPendingListeners) || 0) - 1;
842
+ proxyCounter.set(epWithPendingListeners, newCount);
843
+ if (newCount === 0) {
844
+ void releaseEndpoint(epWithPendingListeners).finally(() => {
845
+ epWithPendingListeners.pendingListeners.clear();
846
+ });
847
+ }
848
+ }
849
+ );
850
+ function registerProxy(proxy2, epWithPendingListeners) {
851
+ const newCount = (proxyCounter.get(epWithPendingListeners) || 0) + 1;
852
+ proxyCounter.set(epWithPendingListeners, newCount);
853
+ if (proxyFinalizers) {
854
+ proxyFinalizers.register(proxy2, epWithPendingListeners, proxy2);
855
+ }
856
+ }
857
+ function unregisterProxy(proxy2) {
858
+ if (proxyFinalizers) {
859
+ proxyFinalizers.unregister(proxy2);
860
+ }
861
+ }
862
+ function createProxy(epWithPendingListeners, path = [], target = () => {
863
+ }) {
864
+ let isProxyReleased = false;
865
+ const proxy2 = new Proxy(target, {
866
+ get(_target, prop) {
867
+ throwIfProxyReleased(isProxyReleased);
868
+ if (prop === releaseProxy) {
869
+ return () => {
870
+ unregisterProxy(proxy2);
871
+ void releaseEndpoint(epWithPendingListeners).finally(() => {
872
+ epWithPendingListeners.pendingListeners.clear();
873
+ });
874
+ isProxyReleased = true;
875
+ };
876
+ }
877
+ if (prop === "then") {
878
+ if (path.length === 0) {
879
+ return { then: () => proxy2 };
880
+ }
881
+ const r = requestResponseMessage(epWithPendingListeners, {
882
+ type: "GET" /* GET */,
883
+ path: path.map((p) => p.toString())
884
+ }).then(fromWireValue);
885
+ return r.then.bind(r);
886
+ }
887
+ return createProxy(epWithPendingListeners, [...path, prop]);
888
+ },
889
+ set(_target, prop, rawValue) {
890
+ throwIfProxyReleased(isProxyReleased);
891
+ const [value, transferables] = toWireValue(rawValue);
892
+ return requestResponseMessage(
893
+ epWithPendingListeners,
894
+ {
895
+ type: "SET" /* SET */,
896
+ path: [...path, prop].map((p) => p.toString()),
897
+ value
898
+ },
899
+ transferables
900
+ ).then(fromWireValue);
901
+ },
902
+ apply(_target, _thisArg, rawArgumentList) {
903
+ throwIfProxyReleased(isProxyReleased);
904
+ const last = path[path.length - 1];
905
+ if (last === createEndpoint) {
906
+ return requestResponseMessage(epWithPendingListeners, {
907
+ type: "ENDPOINT" /* ENDPOINT */
908
+ }).then(fromWireValue);
909
+ }
910
+ if (last === "bind") {
911
+ return createProxy(epWithPendingListeners, path.slice(0, -1));
912
+ }
913
+ const [argumentList, transferables] = processArguments(rawArgumentList);
914
+ return requestResponseMessage(
915
+ epWithPendingListeners,
916
+ {
917
+ type: "APPLY" /* APPLY */,
918
+ path: path.map((p) => p.toString()),
919
+ argumentList
920
+ },
921
+ transferables
922
+ ).then(fromWireValue);
923
+ },
924
+ construct(_target, rawArgumentList) {
925
+ throwIfProxyReleased(isProxyReleased);
926
+ const [argumentList, transferables] = processArguments(rawArgumentList);
927
+ return requestResponseMessage(
928
+ epWithPendingListeners,
929
+ {
930
+ type: "CONSTRUCT" /* CONSTRUCT */,
931
+ path: path.map((p) => p.toString()),
932
+ argumentList
933
+ },
934
+ transferables
935
+ ).then(fromWireValue);
936
+ }
937
+ });
938
+ registerProxy(proxy2, epWithPendingListeners);
939
+ return proxy2;
940
+ }
941
+ function myFlat(arr) {
942
+ return Array.prototype.concat.apply([], arr);
943
+ }
944
+ function processArguments(argumentList) {
945
+ const processed = argumentList.map(toWireValue);
946
+ return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];
947
+ }
948
+ var transferCache = /* @__PURE__ */ new WeakMap();
949
+ function transfer(obj, transfers) {
950
+ transferCache.set(obj, transfers);
951
+ return obj;
952
+ }
953
+ function proxy(obj) {
954
+ return Object.assign(obj, { [proxyMarker]: true });
955
+ }
956
+ function toWireValue(value) {
957
+ for (const [name, handler] of transferHandlers) {
958
+ if (handler.canHandle(value)) {
959
+ const [serializedValue, transferables] = handler.serialize(value);
960
+ return [
961
+ {
962
+ type: "HANDLER" /* HANDLER */,
963
+ name,
964
+ value: serializedValue
965
+ },
966
+ transferables
967
+ ];
968
+ }
969
+ }
970
+ return [
971
+ {
972
+ type: "RAW" /* RAW */,
973
+ value
974
+ },
975
+ transferCache.get(value) || []
976
+ ];
977
+ }
978
+ function fromWireValue(value) {
979
+ switch (value.type) {
980
+ case "HANDLER" /* HANDLER */:
981
+ return transferHandlers.get(value.name).deserialize(value.value);
982
+ case "RAW" /* RAW */:
983
+ return value.value;
984
+ }
985
+ }
986
+ function requestResponseMessage(epWithPendingListeners, msg, transfers) {
987
+ const ep = epWithPendingListeners.endpoint;
988
+ const pendingListeners = epWithPendingListeners.pendingListeners;
989
+ return new Promise((resolve) => {
990
+ const id = generateUUID();
991
+ pendingListeners.set(id, resolve);
992
+ ep.start?.();
993
+ ep.ref?.();
994
+ ep.postMessage({ id, ...msg }, transfers);
995
+ });
996
+ }
997
+ function generateUUID() {
998
+ return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
999
+ }
1000
+
1001
+ // src/cubing/vendor/apache/comlink-everywhere/PortableWorker.ts
1002
+ function isCrossOrigin(url) {
1003
+ if (!globalThis.location) {
1004
+ return false;
1005
+ }
1006
+ const scriptOrigin = globalThis.location.origin;
1007
+ const workerOrigin = new URL(url, globalThis.location.href).origin;
1008
+ return scriptOrigin !== workerOrigin;
1009
+ }
1010
+ function constructPortableWebWorker(url, workerOptions) {
1011
+ const useTrampoline = isCrossOrigin(url);
1012
+ if (useTrampoline) {
1013
+ const trampolineSource = `import ${JSON.stringify(url.toString())};`;
1014
+ const blob = new Blob([trampolineSource], {
1015
+ type: "text/javascript"
1016
+ });
1017
+ url = URL.createObjectURL(blob);
1018
+ }
1019
+ const worker = new globalThis.Worker(url, {
1020
+ ...workerOptions,
1021
+ type: "module"
1022
+ });
1023
+ if (useTrampoline) {
1024
+ const originalTerminate = worker.terminate.bind(worker);
1025
+ Object.defineProperty(worker, "terminate", {
1026
+ get() {
1027
+ URL.revokeObjectURL(url);
1028
+ originalTerminate();
1029
+ }
1030
+ });
1031
+ }
1032
+ return worker;
1033
+ }
1034
+ function constructNodeStyleWorker(url, workerOptions) {
1035
+ const { Worker: NodeWorker } = globalThis.process.getBuiltinModule(
1036
+ "node:worker_threads"
1037
+ );
1038
+ url = typeof url === "string" && url.startsWith("file://") ? new URL(url) : url;
1039
+ return new NodeWorker(url, workerOptions);
1040
+ }
1041
+ function constructPortableWorker(url, workerOptions) {
1042
+ const hasWebWorkers = globalThis.Worker;
1043
+ const hasBuiltinModules = !!globalThis.process?.getBuiltinModule;
1044
+ if (hasWebWorkers && !hasBuiltinModules) {
1045
+ return constructPortableWebWorker(url, workerOptions);
1046
+ }
1047
+ const webWorkersHaveUnref = globalThis.Worker?.prototype.unref;
1048
+ if (hasWebWorkers && hasBuiltinModules && webWorkersHaveUnref) {
1049
+ return constructPortableWebWorker(url, workerOptions);
1050
+ } else {
1051
+ return constructNodeStyleWorker(url, workerOptions);
1052
+ }
1053
+ }
1054
+ var PortableWorker = constructPortableWorker;
1055
+
1056
+ export {
1057
+ setIsInsideWorker,
1058
+ mustBeInsideWorker,
1059
+ addOrientationSuffix,
1060
+ random333Pattern,
1061
+ solve333,
1062
+ random333Scramble,
1063
+ initialize333,
1064
+ random333OrientedScramble,
1065
+ expose,
1066
+ wrap,
1067
+ PortableWorker
1068
+ };
1069
+ /**
1070
+ * @license
1071
+ * Copyright 2019 Google LLC
1072
+ * SPDX-License-Identifier: Apache-2.0
1073
+ */
1074
+ //# sourceMappingURL=chunk-FTE3QI5X.js.map