cubing 0.58.2 → 0.59.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 (99) hide show
  1. package/dist/bin/scramble.js +5 -3
  2. package/dist/bin/scramble.js.map +2 -2
  3. package/dist/lib/cubing/alg/index.d.ts +2 -2
  4. package/dist/lib/cubing/alg/index.js +1 -1
  5. package/dist/lib/cubing/bluetooth/index.d.ts +3 -3
  6. package/dist/lib/cubing/bluetooth/index.js +12 -9
  7. package/dist/lib/cubing/bluetooth/index.js.map +2 -2
  8. package/dist/lib/cubing/{bluetooth-puzzle-BIDZuWiS.d.ts → bluetooth-puzzle-CweI5h6j.d.ts} +1 -1
  9. package/dist/lib/cubing/chunks/{big-puzzle-orientation-CQUVRARW.js → big-puzzle-orientation-3GQ3L26S.js} +2 -2
  10. package/dist/lib/cubing/chunks/{chunk-KRRCGESD.js → chunk-2HSEQ2FC.js} +68 -86
  11. package/dist/lib/cubing/chunks/chunk-2HSEQ2FC.js.map +7 -0
  12. package/dist/lib/cubing/chunks/{chunk-3MMNI5O2.js → chunk-7D7ZUWUK.js} +8 -5
  13. package/dist/lib/cubing/chunks/{chunk-3MMNI5O2.js.map → chunk-7D7ZUWUK.js.map} +2 -2
  14. package/dist/lib/cubing/chunks/{chunk-BDJ57WFX.js → chunk-ABQAUY7H.js} +3 -3
  15. package/dist/lib/cubing/chunks/{chunk-7M7ZAS5G.js → chunk-AVOUJS6N.js} +3 -3
  16. package/dist/lib/cubing/chunks/chunk-AVOUJS6N.js.map +7 -0
  17. package/dist/lib/cubing/chunks/{chunk-RDSQRW3G.js → chunk-NX2Q6B7Y.js} +11 -8
  18. package/dist/lib/cubing/chunks/chunk-NX2Q6B7Y.js.map +7 -0
  19. package/dist/lib/cubing/chunks/{chunk-LLQHQ7KT.js → chunk-OJI4YUWF.js} +6 -6
  20. package/dist/lib/cubing/chunks/{chunk-CZGLT7LF.js → chunk-PSQEELP4.js} +2 -2
  21. package/dist/lib/cubing/chunks/{chunk-SR66SYE2.js → chunk-QDEGPHPS.js} +2 -2
  22. package/dist/lib/cubing/chunks/chunk-QDEGPHPS.js.map +7 -0
  23. package/dist/lib/cubing/chunks/{chunk-6WYRN27C.js → chunk-REBGU5ET.js} +3 -5
  24. package/dist/lib/cubing/chunks/{chunk-6WYRN27C.js.map → chunk-REBGU5ET.js.map} +2 -2
  25. package/dist/lib/cubing/chunks/{chunk-GTMMBSYI.js → chunk-RUSWM2KK.js} +4 -4
  26. package/dist/lib/cubing/chunks/{chunk-C6NCOBGN.js → chunk-UD4LT3FY.js} +3 -3
  27. package/dist/lib/cubing/chunks/{chunk-DOOLIV56.js → chunk-V7MAXDP4.js} +5 -5
  28. package/dist/lib/cubing/chunks/{chunk-DOOLIV56.js.map → chunk-V7MAXDP4.js.map} +1 -1
  29. package/dist/lib/cubing/chunks/{chunk-XWYOASV3.js → chunk-WIZJQ7QS.js} +4 -4
  30. package/dist/lib/cubing/chunks/{inside-Q4UKUE5C.js → inside-NS3PIQ5Z.js} +37 -18
  31. package/dist/lib/cubing/chunks/inside-NS3PIQ5Z.js.map +7 -0
  32. package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-KFGZMHFE.js → search-dynamic-sgs-side-events-SYC27DSG.js} +6 -6
  33. package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-MWWB3OYG.js → search-dynamic-sgs-unofficial-QGGV4PCJ.js} +6 -6
  34. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-QGGV4PCJ.js.map +7 -0
  35. package/dist/lib/cubing/chunks/{search-dynamic-solve-3x3x3-QHRLSVAC.js → search-dynamic-solve-3x3x3-B2L4IN34.js} +1 -1
  36. package/dist/lib/cubing/chunks/search-dynamic-solve-3x3x3-B2L4IN34.js.map +7 -0
  37. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-AOHNELZ2.js → search-dynamic-solve-4x4x4-GNM5XEZR.js} +8 -8
  38. package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-BHX3R6ZT.js → search-dynamic-solve-fto-HZREG6ZH.js} +8 -8
  39. package/dist/lib/cubing/chunks/search-dynamic-solve-fto-HZREG6ZH.js.map +7 -0
  40. package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-SAJCQILQ.js → search-dynamic-solve-kilominx-GCNVEBDJ.js} +2 -2
  41. package/dist/lib/cubing/chunks/search-dynamic-solve-kilominx-GCNVEBDJ.js.map +7 -0
  42. package/dist/lib/cubing/chunks/{search-dynamic-solve-master_tetraminx-3D4MBF3V.js → search-dynamic-solve-master_tetraminx-GIS7T5B7.js} +1 -1
  43. package/dist/lib/cubing/chunks/search-dynamic-solve-master_tetraminx-GIS7T5B7.js.map +7 -0
  44. package/dist/lib/cubing/chunks/search-worker-entry.js +3 -3
  45. package/dist/lib/cubing/chunks/search-worker-entry.js.map +2 -2
  46. package/dist/lib/cubing/chunks/{twisty-dynamic-3d-OY64TJYU.js → twisty-dynamic-3d-SIRF3JVR.js} +6 -6
  47. package/dist/lib/cubing/chunks/twsearch-SXB7BAMF.js +433 -0
  48. package/dist/lib/cubing/chunks/twsearch-SXB7BAMF.js.map +7 -0
  49. package/dist/lib/cubing/chunks/twsearch_wasm_bg-2J7XXRGI-WOU3FVAE.js +10 -0
  50. package/dist/lib/cubing/chunks/twsearch_wasm_bg-2J7XXRGI-WOU3FVAE.js.map +7 -0
  51. package/dist/lib/cubing/{index-1uDGfzzz.d.ts → index-B28YEQVF.d.ts} +5 -3
  52. package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
  53. package/dist/lib/cubing/kpuzzle/index.js +2 -2
  54. package/dist/lib/cubing/notation/index.d.ts +1 -1
  55. package/dist/lib/cubing/notation/index.js +4 -4
  56. package/dist/lib/cubing/protocol/index.d.ts +1 -1
  57. package/dist/lib/cubing/protocol/index.js +4 -4
  58. package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
  59. package/dist/lib/cubing/puzzle-geometry/index.js +1 -1
  60. package/dist/lib/cubing/puzzles/index.d.ts +1 -1
  61. package/dist/lib/cubing/puzzles/index.js +4 -4
  62. package/dist/lib/cubing/scramble/index.d.ts +2 -2
  63. package/dist/lib/cubing/scramble/index.js +9 -7
  64. package/dist/lib/cubing/search/index.d.ts +2 -2
  65. package/dist/lib/cubing/search/index.js +7 -7
  66. package/dist/lib/cubing/stream/index.d.ts +2 -2
  67. package/dist/lib/cubing/stream/index.js +1 -1
  68. package/dist/lib/cubing/twisty/index.d.ts +2 -2
  69. package/dist/lib/cubing/twisty/index.js +10 -10
  70. package/dist/lib/cubing/twisty/index.js.map +2 -2
  71. package/experimental-json-schema/kpuzzle/KPatternData.schema.json +1 -1
  72. package/experimental-json-schema/kpuzzle/KPuzzleDefinition.schema.json +1 -1
  73. package/experimental-json-schema/kpuzzle/KTransformationData.schema.json +1 -1
  74. package/package.json +9 -10
  75. package/dist/lib/cubing/chunks/chunk-7M7ZAS5G.js.map +0 -7
  76. package/dist/lib/cubing/chunks/chunk-KRRCGESD.js.map +0 -7
  77. package/dist/lib/cubing/chunks/chunk-RDSQRW3G.js.map +0 -7
  78. package/dist/lib/cubing/chunks/chunk-SR66SYE2.js.map +0 -7
  79. package/dist/lib/cubing/chunks/inside-Q4UKUE5C.js.map +0 -7
  80. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-MWWB3OYG.js.map +0 -7
  81. package/dist/lib/cubing/chunks/search-dynamic-solve-3x3x3-QHRLSVAC.js.map +0 -7
  82. package/dist/lib/cubing/chunks/search-dynamic-solve-fto-BHX3R6ZT.js.map +0 -7
  83. package/dist/lib/cubing/chunks/search-dynamic-solve-kilominx-SAJCQILQ.js.map +0 -7
  84. package/dist/lib/cubing/chunks/search-dynamic-solve-master_tetraminx-3D4MBF3V.js.map +0 -7
  85. package/dist/lib/cubing/chunks/twsearch-T3W5T5WE.js +0 -481
  86. package/dist/lib/cubing/chunks/twsearch-T3W5T5WE.js.map +0 -7
  87. package/dist/lib/cubing/chunks/twsearch_wasm_bg-Q5AYUFKA-AHAAY6HU.js +0 -10
  88. package/dist/lib/cubing/chunks/twsearch_wasm_bg-Q5AYUFKA-AHAAY6HU.js.map +0 -7
  89. package/dist/lib/cubing/{PuzzleLoader-BskBhUgu.d.ts → KPattern-DEaZMwD9.d.ts} +20 -20
  90. /package/dist/lib/cubing/chunks/{big-puzzle-orientation-CQUVRARW.js.map → big-puzzle-orientation-3GQ3L26S.js.map} +0 -0
  91. /package/dist/lib/cubing/chunks/{chunk-BDJ57WFX.js.map → chunk-ABQAUY7H.js.map} +0 -0
  92. /package/dist/lib/cubing/chunks/{chunk-LLQHQ7KT.js.map → chunk-OJI4YUWF.js.map} +0 -0
  93. /package/dist/lib/cubing/chunks/{chunk-CZGLT7LF.js.map → chunk-PSQEELP4.js.map} +0 -0
  94. /package/dist/lib/cubing/chunks/{chunk-GTMMBSYI.js.map → chunk-RUSWM2KK.js.map} +0 -0
  95. /package/dist/lib/cubing/chunks/{chunk-C6NCOBGN.js.map → chunk-UD4LT3FY.js.map} +0 -0
  96. /package/dist/lib/cubing/chunks/{chunk-XWYOASV3.js.map → chunk-WIZJQ7QS.js.map} +0 -0
  97. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-KFGZMHFE.js.map → search-dynamic-sgs-side-events-SYC27DSG.js.map} +0 -0
  98. /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-AOHNELZ2.js.map → search-dynamic-solve-4x4x4-GNM5XEZR.js.map} +0 -0
  99. /package/dist/lib/cubing/chunks/{twisty-dynamic-3d-OY64TJYU.js.map → twisty-dynamic-3d-SIRF3JVR.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { A as AlgLeaf, K as KPattern } from './PuzzleLoader-BskBhUgu.js';
1
+ import { A as AlgLeaf, K as KPattern } from './KPattern-DEaZMwD9.js';
2
2
 
3
3
  interface StreamTransformer {
4
4
  transformAlgLeaf(algLeafEvent: AlgLeafEvent): void;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Alg,
3
3
  Grouping
4
- } from "./chunk-3MMNI5O2.js";
4
+ } from "./chunk-7D7ZUWUK.js";
5
5
 
6
6
  // src/cubing/puzzles/implementations/dynamic/big-cubes/big-puzzle-orientation.ts
7
7
  function puzzleOrientationBigCubeIdx(pattern) {
@@ -65,4 +65,4 @@ export {
65
65
  puzzleOrientationBigCubeCache,
66
66
  puzzleOrientationBigCubeIdx
67
67
  };
68
- //# sourceMappingURL=big-puzzle-orientation-CQUVRARW.js.map
68
+ //# sourceMappingURL=big-puzzle-orientation-3GQ3L26S.js.map
@@ -3,42 +3,10 @@ import {
3
3
  } from "./chunk-7GUL3OBQ.js";
4
4
  import {
5
5
  node_adapter_default
6
- } from "./chunk-RDSQRW3G.js";
6
+ } from "./chunk-NX2Q6B7Y.js";
7
7
  import {
8
8
  Alg
9
- } from "./chunk-3MMNI5O2.js";
10
-
11
- // src/cubing/search/inside/solve/puzzles/clock.ts
12
- import { randomUIntBelow } from "random-uint-below";
13
- var backMoves = ["U", "R", "D", "L", "ALL"];
14
- var frontMoves = ["UR", "DR", "DL", "UL"].concat(backMoves);
15
- function randomClockScrambleString() {
16
- let filteringMoveCount = 0;
17
- function randomSuffix() {
18
- const amount = randomUIntBelow(12);
19
- if (amount !== 0) {
20
- filteringMoveCount++;
21
- }
22
- if (amount <= 6) {
23
- return `${amount}+`;
24
- } else {
25
- return `${12 - amount}-`;
26
- }
27
- }
28
- const moves = [];
29
- function side(families) {
30
- for (const family of families) {
31
- moves.push(`${family}${randomSuffix()}`);
32
- }
33
- }
34
- side(frontMoves);
35
- moves.push("y2");
36
- side(backMoves);
37
- if (filteringMoveCount < 2) {
38
- return randomClockScrambleString();
39
- }
40
- return moves.join(" ");
41
- }
9
+ } from "./chunk-7D7ZUWUK.js";
42
10
 
43
11
  // src/cubing/vendor/apache/comlink-everywhere/outside/index.ts
44
12
  import { wrap } from "comlink";
@@ -65,7 +33,7 @@ async function constructWorker(source, options) {
65
33
  }
66
34
 
67
35
  // src/cubing/search/worker-workarounds/index.ts
68
- async function searchWorkerURLImportMetaResolve() {
36
+ function searchWorkerURLImportMetaResolve() {
69
37
  return import.meta.resolve("./search-worker-entry.js");
70
38
  }
71
39
  function searchWorkerURLNewURLImportMetaURL() {
@@ -204,36 +172,45 @@ async function instantiateWorkerImplementation() {
204
172
  function failed(methodDescription) {
205
173
  return `Module worker instantiation${methodDescription ? ` ${methodDescription}` : ""} failed`;
206
174
  }
207
- const fallbackOrder = [
208
- [
209
- async () => instantiateModuleWorker(await searchWorkerURLImportMetaResolve()),
210
- "using `import.meta.resolve(\u2026)",
211
- null
212
- ],
213
- [
214
- async () => instantiateModuleWorker(await searchWorkerURLEsbuildWorkaround()),
215
- "using the `esbuild` workaround",
216
- // TODO: we will hopefully discontinue the `esbuild` workaround at some
217
- // point, but `esbuild` has been stuck for 3 years on this issue. Because
218
- // `esbuild` and Vite (which uses `esbuild`) are now dominating the
219
- // ecosystem, this just causes a warning for a lot of devs/users that they
220
- // can't do anything about. As frustrating as the situation is, the
221
- // workaround is semantically fine (even if it's convoluted) and is
222
- // preserved by `esbuild`-based flows in practice. So we suppress the
223
- // warning in the medium-term but maintain long-term hope that we can
224
- // remove it (and the other fallbacks as well).
225
- null
226
- ],
227
- [
228
- async () => instantiateModuleWorker(searchWorkerURLNewURLImportMetaURL()),
229
- "using `new URL(\u2026, import.meta.url)`",
230
- "will"
231
- ],
232
- [
233
- instantiateModuleWorkerDirectlyForBrowser,
234
- "using inline `new URL(\u2026, import.meta.url)`",
235
- "may"
236
- ]
175
+ const importMetaResolveStrategy = [
176
+ async () => instantiateModuleWorker(searchWorkerURLImportMetaResolve()),
177
+ "using `import.meta.resolve(\u2026)",
178
+ null
179
+ ];
180
+ const esbuildWorkaroundStrategy = [
181
+ async () => instantiateModuleWorker(await searchWorkerURLEsbuildWorkaround()),
182
+ "using the `esbuild` workaround",
183
+ // TODO: we will hopefully discontinue the `esbuild` workaround at some
184
+ // point, but `esbuild` has been stuck for 3 years on this issue. Because
185
+ // `esbuild` and Vite (which uses `esbuild`) are now dominating the
186
+ // ecosystem, this just causes a warning for a lot of devs/users that they
187
+ // can't do anything about. As frustrating as the situation is, the
188
+ // workaround is semantically fine (even if it's convoluted) and is
189
+ // preserved by `esbuild`-based flows in practice. So we suppress the
190
+ // warning in the medium-term but maintain long-term hope that we can
191
+ // remove it (and the other fallbacks as well).
192
+ null
193
+ ];
194
+ const newURLStrategy = [
195
+ async () => instantiateModuleWorker(searchWorkerURLNewURLImportMetaURL()),
196
+ "using `new URL(\u2026, import.meta.url)`",
197
+ "will"
198
+ ];
199
+ const inlineNewURLStrategy = [
200
+ instantiateModuleWorkerDirectlyForBrowser,
201
+ "using inline `new URL(\u2026, import.meta.url)`",
202
+ "may"
203
+ ];
204
+ const fallbackOrder = searchOutsideDebugGlobals.prioritizeEsbuildWorkaroundForWorkerInstantiation ? [
205
+ esbuildWorkaroundStrategy,
206
+ importMetaResolveStrategy,
207
+ newURLStrategy,
208
+ inlineNewURLStrategy
209
+ ] : [
210
+ importMetaResolveStrategy,
211
+ esbuildWorkaroundStrategy,
212
+ newURLStrategy,
213
+ inlineNewURLStrategy
237
214
  ];
238
215
  for (const [fn, description, warnOnSuccess] of fallbackOrder) {
239
216
  try {
@@ -258,19 +235,21 @@ function getCachedWorkerInstance() {
258
235
  return cachedWorkerInstance ??= instantiateWorker();
259
236
  }
260
237
  async function randomScrambleForEvent(eventID) {
261
- switch (eventID) {
262
- case "clock":
263
- return Alg.fromString(await randomClockScrambleString());
264
- }
265
- const prom = _randomScrambleStringForEvent(eventID);
266
- const wat = await prom;
267
- return Alg.fromString(wat);
238
+ const worker = searchOutsideDebugGlobals.forceNewWorkerForEveryScramble ? await instantiateWorker() : await getCachedWorkerInstance();
239
+ const scrambleString = await worker.insideAPI.randomScrambleStringForEvent(eventID);
240
+ return Alg.fromString(scrambleString);
268
241
  }
269
- async function _randomScrambleStringForEvent(eventID) {
270
- if (searchOutsideDebugGlobals.forceNewWorkerForEveryScramble) {
242
+ async function deriveScrambleForEvent(derivationSeedHex, derivationSaltHierarchy, eventID) {
243
+ if (!searchOutsideDebugGlobals.allowDerivedScrambles) {
244
+ throw new Error("Derived scrambles are not allowed.");
271
245
  }
272
246
  const worker = searchOutsideDebugGlobals.forceNewWorkerForEveryScramble ? await instantiateWorker() : await getCachedWorkerInstance();
273
- return worker.insideAPI.randomScrambleStringForEvent(eventID);
247
+ const scrambleString = await worker.insideAPI.deriveScrambleStringForEvent(
248
+ derivationSeedHex,
249
+ derivationSaltHierarchy,
250
+ eventID
251
+ );
252
+ return Alg.fromString(scrambleString);
274
253
  }
275
254
  async function experimentalSolve3x3x3IgnoringCenters(pattern) {
276
255
  const cwi = await getCachedWorkerInstance();
@@ -327,9 +306,10 @@ async function solveTwsearch(kpuzzle, pattern, options) {
327
306
  var searchOutsideDebugGlobals = {
328
307
  logPerf: true,
329
308
  scramblePrefetchLevel: "auto",
330
- disableStringWorker: false,
331
309
  forceNewWorkerForEveryScramble: false,
332
- showWorkerInstantiationWarnings: true
310
+ showWorkerInstantiationWarnings: true,
311
+ prioritizeEsbuildWorkaroundForWorkerInstantiation: false,
312
+ allowDerivedScrambles: false
333
313
  };
334
314
  function setSearchDebug(options) {
335
315
  const { logPerf, scramblePrefetchLevel } = options;
@@ -345,19 +325,21 @@ function setSearchDebug(options) {
345
325
  )
346
326
  );
347
327
  }
348
- if ("disableStringWorker" in options) {
349
- searchOutsideDebugGlobals.disableStringWorker = !!options.disableStringWorker;
350
- }
351
- if ("forceNewWorkerForEveryScramble" in options) {
352
- searchOutsideDebugGlobals.forceNewWorkerForEveryScramble = !!options.forceNewWorkerForEveryScramble;
353
- }
354
- if ("showWorkerInstantiationWarnings" in options) {
355
- searchOutsideDebugGlobals.showWorkerInstantiationWarnings = !!options.showWorkerInstantiationWarnings;
328
+ for (const booleanField of [
329
+ "forceNewWorkerForEveryScramble",
330
+ "showWorkerInstantiationWarnings",
331
+ "prioritizeEsbuildWorkaroundForWorkerInstantiation",
332
+ "allowDerivedScrambles"
333
+ ]) {
334
+ if (booleanField in options) {
335
+ searchOutsideDebugGlobals[booleanField] = options[booleanField] ?? searchOutsideDebugGlobals[booleanField];
336
+ }
356
337
  }
357
338
  }
358
339
 
359
340
  export {
360
341
  randomScrambleForEvent,
342
+ deriveScrambleForEvent,
361
343
  experimentalSolve3x3x3IgnoringCenters,
362
344
  experimentalSolve2x2x2,
363
345
  solveSkewb,
@@ -366,4 +348,4 @@ export {
366
348
  solveTwsearch,
367
349
  setSearchDebug
368
350
  };
369
- //# sourceMappingURL=chunk-KRRCGESD.js.map
351
+ //# sourceMappingURL=chunk-2HSEQ2FC.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/cubing/vendor/apache/comlink-everywhere/outside/index.ts", "../../../../src/cubing/search/worker-workarounds/index.ts", "../../../../src/cubing/search/instantiator.ts", "../../../../src/cubing/search/outside.ts"],
4
+ "sourcesContent": ["import nodeEndpoint from \"../node-adapter\";\n\nexport { wrap } from \"comlink\";\n\nconst useNodeWorkarounds =\n typeof globalThis.Worker === \"undefined\" &&\n typeof (globalThis as any).WorkerNavigator === \"undefined\";\n\nasync function nodeWorker(\n source: string | URL,\n options?: { eval?: boolean },\n): Promise<Worker> {\n const { Worker: NodeWorker } = globalThis.process.getBuiltinModule(\n \"node:worker_threads\",\n );\n const worker = new NodeWorker(source, options);\n worker.unref();\n return nodeEndpoint(worker);\n}\n\nexport async function constructWorker(\n source: string | URL,\n options?: { type?: WorkerType },\n): Promise<Worker> {\n let worker: Worker;\n if (useNodeWorkarounds) {\n return nodeWorker(source);\n } else {\n worker = new globalThis.Worker(source, {\n type: options ? options.type : undefined, // TODO: Is it safe to use `options?.type`?\n });\n }\n return worker;\n}\n", "import { exposeAPI } from \"./worker-guard\";\n\nexport function searchWorkerURLImportMetaResolve(): string {\n // Note:\n // - We have to hardcode the expected path of the entry file in the ESM build, due to lack of `esbuild` support: https://github.com/evanw/esbuild/issues/2866\n // - This URL is based on the assumption that the code from this file ends up in a shared chunk in the `esm` build. This is not guaranteed by `esbuild`, but it consistently happens for our codebase.\n // - We inline the value (instead of using a constant), to maximize compatibility for hardcoded syntax detection in bundlers.\n return import.meta.resolve(\"./search-worker-entry.js\");\n}\n\nexport function searchWorkerURLNewURLImportMetaURL(): URL {\n // Note:\n // - We have to hardcode the expected path of the entry file in the ESM build, due to lack of `esbuild` support: https://github.com/evanw/esbuild/issues/795\n // - This URL is based on the assumption that the code from this file ends up in a shared chunk in the `esm` build. This is not guaranteed by `esbuild`, but it consistently happens for our codebase.\n // - We inline the value (instead of using a constant), to maximize compatibility for hardcoded syntax detection in bundlers.\n return new URL(\"./search-worker-entry.js\", import.meta.url);\n}\n\n// Workaround for `esbuild`: https://github.com/evanw/esbuild/issues/312#issuecomment-1092195778\nexport async function searchWorkerURLEsbuildWorkaround(): Promise<string> {\n exposeAPI.expose = false;\n return (await import(\"./search-worker-entry.js\")).WORKER_ENTRY_FILE_URL;\n}\n\nexport function instantiateSearchWorkerURLNewURLImportMetaURL(): Worker {\n return new Worker(new URL(\"./search-worker-entry.js\", import.meta.url), {\n type: \"module\",\n });\n}\n", "import {\n constructWorker,\n wrap,\n} from \"../vendor/apache/comlink-everywhere/outside\";\nimport type { WorkerInsideAPI } from \"./inside/api\";\nimport { searchOutsideDebugGlobals } from \"./outside\";\nimport {\n instantiateSearchWorkerURLNewURLImportMetaURL,\n searchWorkerURLEsbuildWorkaround,\n searchWorkerURLImportMetaResolve,\n searchWorkerURLNewURLImportMetaURL,\n} from \"./worker-workarounds\";\n\nexport interface WorkerOutsideAPI {\n terminate: () => void; // `node` can return a `Promise` with an exit code, but we match the web worker API.\n}\n\nexport interface InsideOutsideAPI {\n insideAPI: WorkerInsideAPI;\n outsideAPI: WorkerOutsideAPI;\n}\n\nfunction probablyCrossOrigin(workerEntryFileURL: URL): boolean {\n try {\n const scriptOrigin = globalThis.location?.origin;\n const workerOrigin = workerEntryFileURL.origin;\n return !!scriptOrigin && !!workerOrigin && scriptOrigin !== workerOrigin;\n } catch {\n return false;\n }\n}\n\nasync function instantiateModuleWorker(\n workerEntryFileURL: string | URL,\n): Promise<InsideOutsideAPI> {\n // We need the `import.meta.url` base for `bun`.\n const url = new URL(workerEntryFileURL, import.meta.url);\n const tryTrampolineFirst = probablyCrossOrigin(url);\n try {\n return instantiateModuleWorkerAttempt(url, tryTrampolineFirst);\n } catch {\n return instantiateModuleWorkerAttempt(url, !tryTrampolineFirst);\n }\n}\n\ninterface BunWorker extends Worker {\n unref?: () => void;\n}\n\nasync function instantiateModuleWorkerAttempt(\n workerEntryFileURL: URL,\n crossOriginTrampoline: boolean,\n): Promise<InsideOutsideAPI> {\n // biome-ignore lint/suspicious/noAsyncPromiseExecutor: TODO\n return new Promise<InsideOutsideAPI>(async (resolve, reject) => {\n try {\n if (!workerEntryFileURL) {\n reject(new Error(\"Could not get worker entry file URL.\"));\n }\n let url: URL = workerEntryFileURL;\n if (crossOriginTrampoline) {\n // Standard browser-like environment.\n const importSrc = `import ${JSON.stringify(\n workerEntryFileURL.toString(),\n )};`;\n const blob = new Blob([importSrc], {\n type: \"text/javascript\",\n });\n url = new URL(URL.createObjectURL(blob));\n }\n\n const worker = (await constructWorker(url, {\n type: \"module\",\n })) as Worker & {\n nodeWorker?: import(\"worker_threads\").Worker;\n } & BunWorker;\n\n worker.unref?.(); // Unref in `bun`.\n\n const onError = (e: ErrorEvent) => {\n reject(e);\n };\n\n // TODO: Remove this once we can remove the workarounds for lack of `import.meta.resolve(\u2026)` support.\n const onFirstMessage = (messageData: string) => {\n if (messageData === \"comlink-exposed\") {\n // We need to clear the timeout so that we don't prevent `node` from exiting in the meantime.\n resolve(wrapWithTerminate(worker));\n } else {\n reject(\n new Error(`wrong module instantiation message ${messageData}`),\n );\n }\n };\n\n if (worker.nodeWorker) {\n // We have to use `once` so the `unref()` from `comlink-everywhere` allows the process to quit as expected.\n worker.nodeWorker.once(\"message\", onFirstMessage);\n } else {\n worker.addEventListener(\"error\", onError, {\n once: true,\n });\n worker.addEventListener(\"message\", (e) => onFirstMessage(e.data), {\n once: true,\n });\n }\n } catch (e) {\n reject(e);\n }\n });\n}\n\n// Maybe some day if we work really hard, this code path can work:\n// - in `node` (https://github.com/nodejs/node/issues/43583#issuecomment-1540025755)\n// - for CDNs (https://github.com/tc39/proposal-module-expressions or https://github.com/whatwg/html/issues/6911)\nexport async function instantiateModuleWorkerDirectlyForBrowser(): Promise<InsideOutsideAPI> {\n // biome-ignore lint/suspicious/noAsyncPromiseExecutor: TODO\n return new Promise<InsideOutsideAPI>(async (resolve, reject) => {\n try {\n const worker = instantiateSearchWorkerURLNewURLImportMetaURL();\n\n const onError = (e: ErrorEvent) => {\n reject(e);\n };\n\n // TODO: Remove this once we can remove the workarounds for lack of `import.meta.resolve(\u2026)` support.\n const onFirstMessage = (messageData: string) => {\n if (messageData === \"comlink-exposed\") {\n // We need to clear the timeout so that we don't prevent `node` from exiting in the meantime.\n resolve(wrapWithTerminate(worker));\n } else {\n reject(\n new Error(`wrong module instantiation message ${messageData}`),\n );\n }\n };\n\n worker.addEventListener(\"error\", onError, {\n once: true,\n });\n worker.addEventListener(\"message\", (e) => onFirstMessage(e.data), {\n once: true,\n });\n } catch (e) {\n reject(e);\n }\n });\n}\n\nfunction wrapWithTerminate(worker: Worker): InsideOutsideAPI {\n const insideAPI = wrap<WorkerInsideAPI>(worker);\n const terminate = worker.terminate.bind(worker);\n return { insideAPI, outsideAPI: { terminate } };\n}\n\nexport const allInsideOutsideAPIPromises: Promise<InsideOutsideAPI>[] = [];\n\nexport async function instantiateWorker(): Promise<InsideOutsideAPI> {\n const insideOutsideAPIPromise = instantiateWorkerImplementation();\n allInsideOutsideAPIPromises.push(insideOutsideAPIPromise);\n const { insideAPI } = await insideOutsideAPIPromise;\n insideAPI.setDebugMeasurePerf(searchOutsideDebugGlobals.logPerf);\n insideAPI.setScramblePrefetchLevel(\n searchOutsideDebugGlobals.scramblePrefetchLevel,\n );\n return insideOutsideAPIPromise;\n}\n\nexport async function mapToAllWorkers(\n f: (worker: InsideOutsideAPI) => void,\n): Promise<void> {\n await Promise.all(\n allInsideOutsideAPIPromises.map((worker) => worker.then(f)),\n );\n}\n\ntype FallbackStrategyInfo = [\n fn: () => Promise<InsideOutsideAPI>,\n description: string,\n warnOnSuccess: null | string,\n];\n\nasync function instantiateWorkerImplementation(): Promise<InsideOutsideAPI> {\n if (globalThis.location?.protocol === \"file:\") {\n console.warn(\n \"This current web page is loaded from the local filesystem (a URL that starts with `file://`). In this situation, `cubing.js` may be unable to generate scrambles or perform searches in some browsers. See: https://js.cubing.net/cubing/scramble/#file-server-required\",\n );\n }\n\n function failed(methodDescription?: string) {\n return `Module worker instantiation${\n methodDescription ? ` ${methodDescription}` : \"\"\n } failed`;\n }\n\n const importMetaResolveStrategy: FallbackStrategyInfo = [\n async () => instantiateModuleWorker(searchWorkerURLImportMetaResolve()),\n \"using `import.meta.resolve(\u2026)\",\n null,\n ];\n const esbuildWorkaroundStrategy: FallbackStrategyInfo = [\n async () =>\n instantiateModuleWorker(await searchWorkerURLEsbuildWorkaround()),\n \"using the `esbuild` workaround\",\n // TODO: we will hopefully discontinue the `esbuild` workaround at some\n // point, but `esbuild` has been stuck for 3 years on this issue. Because\n // `esbuild` and Vite (which uses `esbuild`) are now dominating the\n // ecosystem, this just causes a warning for a lot of devs/users that they\n // can't do anything about. As frustrating as the situation is, the\n // workaround is semantically fine (even if it's convoluted) and is\n // preserved by `esbuild`-based flows in practice. So we suppress the\n // warning in the medium-term but maintain long-term hope that we can\n // remove it (and the other fallbacks as well).\n null,\n ];\n const newURLStrategy: FallbackStrategyInfo = [\n async () => instantiateModuleWorker(searchWorkerURLNewURLImportMetaURL()),\n \"using `new URL(\u2026, import.meta.url)`\",\n \"will\",\n ];\n const inlineNewURLStrategy: FallbackStrategyInfo = [\n instantiateModuleWorkerDirectlyForBrowser,\n \"using inline `new URL(\u2026, import.meta.url)`\",\n \"may\",\n ];\n\n const fallbackOrder: FallbackStrategyInfo[] =\n searchOutsideDebugGlobals.prioritizeEsbuildWorkaroundForWorkerInstantiation\n ? [\n esbuildWorkaroundStrategy,\n importMetaResolveStrategy,\n newURLStrategy,\n inlineNewURLStrategy,\n ]\n : [\n importMetaResolveStrategy,\n esbuildWorkaroundStrategy,\n newURLStrategy,\n inlineNewURLStrategy,\n ];\n\n for (const [fn, description, warnOnSuccess] of fallbackOrder) {\n try {\n const worker = await fn();\n if (warnOnSuccess) {\n if (searchOutsideDebugGlobals.showWorkerInstantiationWarnings) {\n console.warn(\n `Module worker instantiation required ${description}. \\`cubing.js\\` ${warnOnSuccess} not support this fallback in the future.`,\n );\n }\n }\n return worker;\n } catch {\n // if (searchOutsideDebugGlobals.showWorkerInstantiationWarnings) {\n // console.warn(`${failed(description)}, falling back.`);\n // }\n }\n }\n\n throw new Error(`${failed()}. There are no more fallbacks available.`);\n}\n", "import { Alg } from \"../alg\";\nimport type { KPuzzle } from \"../kpuzzle\";\n// import { preInitialize222 } from \"../implementations/2x2x2\";\nimport type { KPattern } from \"../kpuzzle/KPattern\";\nimport type { PrefetchLevel } from \"./inside/api\";\nimport type { TwsearchOptions } from \"./inside/solve/twsearch\";\nimport {\n type InsideOutsideAPI,\n instantiateWorker,\n mapToAllWorkers,\n} from \"./instantiator\";\n\nlet cachedWorkerInstance: Promise<InsideOutsideAPI> | undefined;\nfunction getCachedWorkerInstance(): Promise<InsideOutsideAPI> {\n return (cachedWorkerInstance ??= instantiateWorker());\n}\n\n// Pre-initialize the scrambler for the given event. (Otherwise, an event is\n// initialized the first time you ask for a scramble for that event.)\n//\n// Some typical numbers for a fast computer:\n// - 3x3x3 initialization: 200ms\n// - Each 3x3x3 scramble: 50ms\n// - 4x4x4 initialization: 2500ms\n// - Each 4x4x4 scramble: 300ms to 800ms\n//\n// It is safe to immediately call for a scramble\n// any time after starting pre-initialization, or to call for them without\n// pre-initializing. Pre-initializing essentially gives the scramble worker a\n// head start in case a scramble doesn't get requested immediately.\n//\n// Note that events cannot be pre-initialized in parallel. Attempting to\n// pre-initialize multiple events will initialize them consecutively. Scrambles\n// for a given event cannot be computed while another event is being initialized.\nexport function _preInitializationHintForEvent(\n eventID: string,\n // callback?: () => void\n): void {\n switch (eventID) {\n case \"333oh\":\n _preInitializationHintForEvent(\"333\");\n return;\n }\n (async () => {\n await (await getCachedWorkerInstance()).insideAPI.initialize(eventID);\n })();\n}\n\nexport async function randomScrambleForEvent(eventID: string): Promise<Alg> {\n const worker = searchOutsideDebugGlobals.forceNewWorkerForEveryScramble\n ? await instantiateWorker()\n : await getCachedWorkerInstance();\n const scrambleString =\n await worker.insideAPI.randomScrambleStringForEvent(eventID);\n return Alg.fromString(scrambleString);\n}\n\nexport async function deriveScrambleForEvent(\n derivationSeedHex: string,\n derivationSaltHierarchy: string[],\n eventID: string,\n): Promise<Alg> {\n if (!searchOutsideDebugGlobals.allowDerivedScrambles) {\n throw new Error(\"Derived scrambles are not allowed.\");\n }\n const worker = searchOutsideDebugGlobals.forceNewWorkerForEveryScramble\n ? await instantiateWorker()\n : await getCachedWorkerInstance();\n const scrambleString = await worker.insideAPI.deriveScrambleStringForEvent(\n derivationSeedHex,\n derivationSaltHierarchy,\n eventID,\n );\n return Alg.fromString(scrambleString);\n}\n\nexport async function experimentalSolve3x3x3IgnoringCenters(\n pattern: KPattern,\n): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(\n await cwi.insideAPI.solve333ToString(pattern.patternData),\n );\n}\n\nexport async function experimentalSolve2x2x2(pattern: KPattern): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(\n await cwi.insideAPI.solve222ToString(pattern.patternData),\n );\n}\n\nexport async function solveSkewb(pattern: KPattern): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(\n await cwi.insideAPI.solveSkewbToString(pattern.patternData),\n );\n}\n\nexport async function solvePyraminx(pattern: KPattern): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(\n await cwi.insideAPI.solvePyraminxToString(pattern.patternData),\n );\n}\n\nexport async function solveMegaminx(pattern: KPattern): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(\n await cwi.insideAPI.solveMegaminxToString(pattern.patternData),\n );\n}\n\nexport interface SolveTwsearchOptions {\n generatorMoves?: string[];\n targetPattern?: KPattern;\n minDepth?: number;\n maxDepth?: number;\n}\n\nexport async function solveTwsearch(\n kpuzzle: KPuzzle,\n pattern: KPattern,\n options?: SolveTwsearchOptions,\n): Promise<Alg> {\n const { targetPattern, ...otherOptions } = options ?? {};\n const apiOptions: TwsearchOptions = otherOptions;\n if (targetPattern) {\n apiOptions.targetPattern = targetPattern.patternData;\n }\n const { ...def } = kpuzzle.definition;\n delete def.experimentalIsPatternSolved;\n // delete def.derivedMoves;\n const dedicatedWorker = await instantiateWorker();\n try {\n return Alg.fromString(\n await dedicatedWorker.insideAPI.solveTwsearchToString(\n def,\n pattern.patternData,\n apiOptions,\n ),\n );\n } finally {\n console.log(\"Search ended, terminating dedicated `twsearch` worker.\");\n // TODO: support re-using the same worker for multiple searches..\n await dedicatedWorker.outsideAPI.terminate();\n }\n}\n\ninterface SearchOutsideDebugGlobals {\n logPerf: boolean;\n scramblePrefetchLevel: `${PrefetchLevel}`;\n forceNewWorkerForEveryScramble: boolean;\n showWorkerInstantiationWarnings: boolean;\n // This can prevent a request to `search-worker-entry.js` when it doesn't exist, if the library semantics have been mangled by `esbuild`.\n prioritizeEsbuildWorkaroundForWorkerInstantiation: boolean;\n allowDerivedScrambles: boolean;\n}\n\nexport const searchOutsideDebugGlobals: SearchOutsideDebugGlobals = {\n logPerf: true,\n scramblePrefetchLevel: \"auto\",\n forceNewWorkerForEveryScramble: false,\n showWorkerInstantiationWarnings: true,\n prioritizeEsbuildWorkaroundForWorkerInstantiation: false,\n allowDerivedScrambles: false,\n};\n\nexport function setSearchDebug(\n options: Partial<SearchOutsideDebugGlobals>,\n): void {\n const { logPerf, scramblePrefetchLevel } = options;\n if (typeof logPerf !== \"undefined\") {\n searchOutsideDebugGlobals.logPerf = logPerf;\n mapToAllWorkers((worker) => worker.insideAPI.setDebugMeasurePerf(logPerf));\n }\n if (typeof scramblePrefetchLevel !== \"undefined\") {\n searchOutsideDebugGlobals.scramblePrefetchLevel = scramblePrefetchLevel;\n mapToAllWorkers((worker) =>\n worker.insideAPI.setScramblePrefetchLevel(\n scramblePrefetchLevel as PrefetchLevel,\n ),\n );\n }\n for (const booleanField of [\n \"forceNewWorkerForEveryScramble\",\n \"showWorkerInstantiationWarnings\",\n \"prioritizeEsbuildWorkaroundForWorkerInstantiation\",\n \"allowDerivedScrambles\",\n ] as const) {\n if (booleanField in options) {\n searchOutsideDebugGlobals[booleanField] =\n options[booleanField] ?? searchOutsideDebugGlobals[booleanField];\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAEA,SAAS,YAAY;AAErB,IAAM,qBACJ,OAAO,WAAW,WAAW,eAC7B,OAAQ,WAAmB,oBAAoB;AAEjD,eAAe,WACb,QACA,SACiB;AACjB,QAAM,EAAE,QAAQ,WAAW,IAAI,WAAW,QAAQ;AAAA,IAChD;AAAA,EACF;AACA,QAAM,SAAS,IAAI,WAAW,QAAQ,OAAO;AAC7C,SAAO,MAAM;AACb,SAAO,qBAAa,MAAM;AAC5B;AAEA,eAAsB,gBACpB,QACA,SACiB;AACjB,MAAI;AACJ,MAAI,oBAAoB;AACtB,WAAO,WAAW,MAAM;AAAA,EAC1B,OAAO;AACL,aAAS,IAAI,WAAW,OAAO,QAAQ;AAAA,MACrC,MAAM,UAAU,QAAQ,OAAO;AAAA;AAAA,IACjC,CAAC;AAAA,EACH;AACA,SAAO;AACT;;;AC/BO,SAAS,mCAA2C;AAKzD,SAAO,YAAY,QAAQ,0BAA0B;AACvD;AAEO,SAAS,qCAA0C;AAKxD,SAAO,IAAI,IAAI,4BAA4B,YAAY,GAAG;AAC5D;AAGA,eAAsB,mCAAoD;AACxE,YAAU,SAAS;AACn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AA,EACF;AACA,aAAW,gBAAgB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAY;AACV,QAAI,gBAAgB,SAAS;AAC3B,gCAA0B,YAAY,IACpC,QAAQ,YAAY,KAAK,0BAA0B,YAAY;AAAA,IACnE;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -268,7 +268,7 @@ function setAlgDebug(options) {
268
268
 
269
269
  // src/cubing/alg/parseAlg.ts
270
270
  function parseIntWithEmptyFallback(n, emptyFallback) {
271
- return n ? parseInt(n) : emptyFallback;
271
+ return n ? parseInt(n, 10) : emptyFallback;
272
272
  }
273
273
  var AMOUNT_REGEX = /^(\d+)?('?)/;
274
274
  var MOVE_START_REGEX = /^[_\dA-Za-z]/;
@@ -380,12 +380,15 @@ var AlgParser = class {
380
380
  const savedCharIndexD = this.#idx;
381
381
  const sq1PairEndMatch = this.parseRegex(SQUARE1_PAIR_END_REGEX);
382
382
  const uMove = addCharIndices(
383
- new Move(new QuantumMove("U_SQ_"), parseInt(topAmountString)),
383
+ new Move(new QuantumMove("U_SQ_"), parseInt(topAmountString, 10)),
384
384
  savedCharIndex + 1,
385
385
  savedCharIndex + 1 + topAmountString.length
386
386
  );
387
387
  const dMove = addCharIndices(
388
- new Move(new QuantumMove("D_SQ_"), parseInt(sq1PairEndMatch[1])),
388
+ new Move(
389
+ new QuantumMove("D_SQ_"),
390
+ parseInt(sq1PairEndMatch[1], 10)
391
+ ),
389
392
  savedCharIndexD,
390
393
  this.#idx - 1
391
394
  );
@@ -779,7 +782,7 @@ var QuantumMove = class _QuantumMove extends Comparable {
779
782
  }
780
783
  };
781
784
  var Move = class _Move extends AlgCommon {
782
- // @ts-ignore False positive due to the `return` in the constructor.
785
+ // @ts-expect-error False positive due to the `return` in the constructor.
783
786
  #quantumWithAmount;
784
787
  constructor(...args) {
785
788
  super();
@@ -1869,4 +1872,4 @@ export {
1869
1872
  keyToMove,
1870
1873
  experimentalAlgCubingNetLink
1871
1874
  };
1872
- //# sourceMappingURL=chunk-3MMNI5O2.js.map
1875
+ //# sourceMappingURL=chunk-7D7ZUWUK.js.map