cubing 0.57.2 → 0.57.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 (24) hide show
  1. package/dist/lib/cubing/alg/index.d.ts +2 -2
  2. package/dist/lib/cubing/bluetooth/index.d.ts +3 -3
  3. package/dist/lib/cubing/{bluetooth-puzzle-wivjKx0u.d.ts → bluetooth-puzzle-nh-dCXPL.d.ts} +1 -1
  4. package/dist/lib/cubing/chunks/{chunk-7DQIG5TO.js → chunk-XWAGJB3J.js} +6 -6
  5. package/dist/lib/cubing/chunks/{chunk-7DQIG5TO.js.map → chunk-XWAGJB3J.js.map} +2 -2
  6. package/dist/lib/cubing/chunks/{inside-I7JABMUQ.js → inside-CE7DDCWK.js} +2 -2
  7. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-7D4J3U7P.js → search-dynamic-solve-4x4x4-6CAJNKYW.js} +2 -2
  8. package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
  9. package/dist/lib/cubing/{index-If8W3A2Q.d.ts → index-BOJwUPsI.d.ts} +1 -1
  10. package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
  11. package/dist/lib/cubing/notation/index.d.ts +1 -1
  12. package/dist/lib/cubing/protocol/index.d.ts +1 -1
  13. package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
  14. package/dist/lib/cubing/puzzles/index.d.ts +1 -1
  15. package/dist/lib/cubing/scramble/index.d.ts +2 -2
  16. package/dist/lib/cubing/scramble/index.js +1 -1
  17. package/dist/lib/cubing/search/index.d.ts +2 -2
  18. package/dist/lib/cubing/search/index.js +1 -1
  19. package/dist/lib/cubing/stream/index.d.ts +2 -2
  20. package/dist/lib/cubing/twisty/index.d.ts +2 -2
  21. package/package.json +1 -1
  22. package/dist/lib/cubing/{KPattern-mvBrQSuc.d.ts → PuzzleLoader-B7Ly-OAs.d.ts} +20 -20
  23. /package/dist/lib/cubing/chunks/{inside-I7JABMUQ.js.map → inside-CE7DDCWK.js.map} +0 -0
  24. /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-7D4J3U7P.js.map → search-dynamic-solve-4x4x4-6CAJNKYW.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- import { O as AlgNode, s as Alg, M as Move, R as AppendOptions, U as Grouping, W as LineComment, X as Commutator, Y as Conjugate, Z as Newline, _ as Pause, $ as KeyMapping, A as AlgLeaf } from '../KPattern-mvBrQSuc.js';
2
- export { a0 as AlgBranch, a5 as AppendCancelOptions, a3 as ExperimentalNotationType, a2 as ExperimentalParsed, a4 as ExperimentalSerializationOptions, a1 as MoveModifications, x as PuzzleSpecificSimplifyOptions, a7 as QuantumMove, a6 as SimplifyOptions } from '../KPattern-mvBrQSuc.js';
1
+ import { O as AlgNode, s as Alg, M as Move, R as AppendOptions, U as Grouping, W as LineComment, X as Commutator, Y as Conjugate, Z as Newline, _ as Pause, $ as KeyMapping, A as AlgLeaf } from '../PuzzleLoader-B7Ly-OAs.js';
2
+ export { a0 as AlgBranch, a5 as AppendCancelOptions, a3 as ExperimentalNotationType, a2 as ExperimentalParsed, a4 as ExperimentalSerializationOptions, a1 as MoveModifications, x as PuzzleSpecificSimplifyOptions, a7 as QuantumMove, a6 as SimplifyOptions } from '../PuzzleLoader-B7Ly-OAs.js';
3
3
  import 'three/src/Three.js';
4
4
 
5
5
  /** @deprecated */
@@ -1,6 +1,6 @@
1
- import { u as PuzzleID, t as PuzzleLoader, $ as KeyMapping, K as KPattern, s as Alg, M as Move } from '../KPattern-mvBrQSuc.js';
2
- import { B as BluetoothPuzzle } from '../bluetooth-puzzle-wivjKx0u.js';
3
- export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-wivjKx0u.js';
1
+ import { u as PuzzleID, t as PuzzleLoader, $ as KeyMapping, K as KPattern, s as Alg, M as Move } from '../PuzzleLoader-B7Ly-OAs.js';
2
+ import { B as BluetoothPuzzle } from '../bluetooth-puzzle-nh-dCXPL.js';
3
+ export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-nh-dCXPL.js';
4
4
  import 'three/src/Three.js';
5
5
 
6
6
  declare function enableDebugLogging(enable: boolean): void;
@@ -1,4 +1,4 @@
1
- import { A as AlgLeaf, K as KPattern } from './KPattern-mvBrQSuc.js';
1
+ import { A as AlgLeaf, K as KPattern } from './PuzzleLoader-B7Ly-OAs.js';
2
2
 
3
3
  interface StreamTransformer {
4
4
  transformAlgLeaf(algLeafEvent: AlgLeafEvent): void;
@@ -210,6 +210,11 @@ async function instantiateWorkerImplementation() {
210
210
  "using `import.meta.resolve(\u2026)",
211
211
  null
212
212
  ],
213
+ [
214
+ async () => instantiateModuleWorker(await searchWorkerURLEsbuildWorkaround()),
215
+ "using the `esbuild` workaround",
216
+ "will"
217
+ ],
213
218
  // TODO: This fallback should be lower (because it's less portable), but we need to try it earlier to work around https://github.com/parcel-bundler/parcel/issues/9051
214
219
  [
215
220
  instantiateModuleWorkerDirectlyForBrowser,
@@ -220,11 +225,6 @@ async function instantiateWorkerImplementation() {
220
225
  async () => instantiateModuleWorker(searchWorkerURLNewURLImportMetaURL()),
221
226
  "using `new URL(\u2026, import.meta.url)`",
222
227
  "will"
223
- ],
224
- [
225
- async () => instantiateModuleWorker(await searchWorkerURLEsbuildWorkaround()),
226
- "using the `esbuild` workaround",
227
- "will"
228
228
  ]
229
229
  ];
230
230
  for (const [fn, description, warnOnSuccess] of fallbackOrder) {
@@ -361,4 +361,4 @@ export {
361
361
  solveTwsearch,
362
362
  setSearchDebug
363
363
  };
364
- //# sourceMappingURL=chunk-7DQIG5TO.js.map
364
+ //# sourceMappingURL=chunk-XWAGJB3J.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cubing/search/inside/solve/puzzles/clock.ts", "../../../../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 { randomUIntBelow } from \"random-uint-below\";\n\nconst backMoves = [\"U\", \"R\", \"D\", \"L\", \"ALL\"];\nconst frontMoves = [\"UR\", \"DR\", \"DL\", \"UL\"].concat(backMoves);\n\nexport function randomClockScrambleString(): string {\n let filteringMoveCount = 0;\n\n function randomSuffix() {\n const amount = randomUIntBelow(12);\n if (amount !== 0) {\n filteringMoveCount++;\n }\n if (amount <= 6) {\n return `${amount}+`;\n } else {\n return `${12 - amount}-`;\n }\n }\n\n const moves = [];\n function side(families: string[]): void {\n for (const family of families) {\n moves.push(`${family}${randomSuffix()}`);\n }\n }\n\n side(frontMoves);\n moves.push(\"y2\");\n side(backMoves);\n\n // https://www.worldcubeassociation.org/regulations/#4b3\n if (filteringMoveCount < 2) {\n return randomClockScrambleString();\n }\n\n return moves.join(\" \");\n}\n", "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 async function searchWorkerURLImportMetaResolve(): Promise<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 // - `import.meta.resolve(\u2026)` returns a sync result in every environment except `bun`: https://loadeverything.net/#compatibility-dashboard\n // - We assume that it's `async`, just in case.\n // @ts-ignore\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}\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\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 fallbackOrder: [\n fn: () => Promise<InsideOutsideAPI>,\n description: string,\n warnOnSuccess: null | string,\n ][] = [\n [\n async () =>\n instantiateModuleWorker(await searchWorkerURLImportMetaResolve()),\n \"using `import.meta.resolve(\u2026)\",\n null,\n ],\n // TODO: This fallback should be lower (because it's less portable), but we need to try it earlier to work around https://github.com/parcel-bundler/parcel/issues/9051\n [\n instantiateModuleWorkerDirectlyForBrowser,\n \"using inline `new URL(\u2026, import.meta.url)`\",\n \"may\",\n ],\n [\n async () => instantiateModuleWorker(searchWorkerURLNewURLImportMetaURL()),\n \"using `new URL(\u2026, import.meta.url)`\",\n \"will\",\n ],\n [\n async () =>\n instantiateModuleWorker(await searchWorkerURLEsbuildWorkaround()),\n \"using the `esbuild` workaround\",\n \"will\",\n ],\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 { randomClockScrambleString } from \"./inside/solve/puzzles/clock\"; // TODO: don't reach into `inside` code.\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 switch (eventID) {\n case \"clock\":\n return Alg.fromString(await randomClockScrambleString());\n }\n const prom = _randomScrambleStringForEvent(eventID);\n const wat = await prom;\n return Alg.fromString(wat);\n}\n\nexport async function _randomScrambleStringForEvent(\n eventID: string,\n): Promise<string> {\n if (searchOutsideDebugGlobals.forceNewWorkerForEveryScramble) {\n }\n const worker = searchOutsideDebugGlobals.forceNewWorkerForEveryScramble\n ? await instantiateWorker()\n : await getCachedWorkerInstance();\n return worker.insideAPI.randomScrambleStringForEvent(eventID);\n}\n\nexport async function randomScrambleStringForEvent(\n eventID: string,\n): Promise<string> {\n switch (eventID) {\n case \"clock\":\n return randomClockScrambleString();\n }\n return await _randomScrambleStringForEvent(eventID);\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 disableStringWorker: boolean;\n forceNewWorkerForEveryScramble: boolean;\n showWorkerInstantiationWarnings: boolean;\n}\nexport const searchOutsideDebugGlobals: SearchOutsideDebugGlobals = {\n logPerf: true,\n scramblePrefetchLevel: \"auto\",\n disableStringWorker: false,\n forceNewWorkerForEveryScramble: false,\n showWorkerInstantiationWarnings: true,\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 if (\"disableStringWorker\" in options) {\n searchOutsideDebugGlobals.disableStringWorker =\n !!options.disableStringWorker;\n }\n if (\"forceNewWorkerForEveryScramble\" in options) {\n searchOutsideDebugGlobals.forceNewWorkerForEveryScramble =\n !!options.forceNewWorkerForEveryScramble;\n }\n if (\"showWorkerInstantiationWarnings\" in options) {\n searchOutsideDebugGlobals.showWorkerInstantiationWarnings =\n !!options.showWorkerInstantiationWarnings;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;AAAA,SAAS,uBAAuB;AAEhC,IAAM,YAA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CAAoC,SAAS;AAC/C,8BAA0B,iCACxB,CAAC,CAAC,QAAQ;AAAA,EACd;AACA,MAAI,qCAAqC,SAAS;AAChD,8BAA0B,kCACxB,CAAC,CAAC,QAAQ;AAAA,EACd;AACF;",
4
+ "sourcesContent": ["import { randomUIntBelow } from \"random-uint-below\";\n\nconst backMoves = [\"U\", \"R\", \"D\", \"L\", \"ALL\"];\nconst frontMoves = [\"UR\", \"DR\", \"DL\", \"UL\"].concat(backMoves);\n\nexport function randomClockScrambleString(): string {\n let filteringMoveCount = 0;\n\n function randomSuffix() {\n const amount = randomUIntBelow(12);\n if (amount !== 0) {\n filteringMoveCount++;\n }\n if (amount <= 6) {\n return `${amount}+`;\n } else {\n return `${12 - amount}-`;\n }\n }\n\n const moves = [];\n function side(families: string[]): void {\n for (const family of families) {\n moves.push(`${family}${randomSuffix()}`);\n }\n }\n\n side(frontMoves);\n moves.push(\"y2\");\n side(backMoves);\n\n // https://www.worldcubeassociation.org/regulations/#4b3\n if (filteringMoveCount < 2) {\n return randomClockScrambleString();\n }\n\n return moves.join(\" \");\n}\n", "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 async function searchWorkerURLImportMetaResolve(): Promise<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 // - `import.meta.resolve(\u2026)` returns a sync result in every environment except `bun`: https://loadeverything.net/#compatibility-dashboard\n // - We assume that it's `async`, just in case.\n // @ts-ignore\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}\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\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 fallbackOrder: [\n fn: () => Promise<InsideOutsideAPI>,\n description: string,\n warnOnSuccess: null | string,\n ][] = [\n [\n async () =>\n instantiateModuleWorker(await searchWorkerURLImportMetaResolve()),\n \"using `import.meta.resolve(\u2026)\",\n null,\n ],\n [\n async () =>\n instantiateModuleWorker(await searchWorkerURLEsbuildWorkaround()),\n \"using the `esbuild` workaround\",\n \"will\",\n ],\n // TODO: This fallback should be lower (because it's less portable), but we need to try it earlier to work around https://github.com/parcel-bundler/parcel/issues/9051\n [\n instantiateModuleWorkerDirectlyForBrowser,\n \"using inline `new URL(\u2026, import.meta.url)`\",\n \"may\",\n ],\n [\n async () => instantiateModuleWorker(searchWorkerURLNewURLImportMetaURL()),\n \"using `new URL(\u2026, import.meta.url)`\",\n \"will\",\n ],\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 { randomClockScrambleString } from \"./inside/solve/puzzles/clock\"; // TODO: don't reach into `inside` code.\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 switch (eventID) {\n case \"clock\":\n return Alg.fromString(await randomClockScrambleString());\n }\n const prom = _randomScrambleStringForEvent(eventID);\n const wat = await prom;\n return Alg.fromString(wat);\n}\n\nexport async function _randomScrambleStringForEvent(\n eventID: string,\n): Promise<string> {\n if (searchOutsideDebugGlobals.forceNewWorkerForEveryScramble) {\n }\n const worker = searchOutsideDebugGlobals.forceNewWorkerForEveryScramble\n ? await instantiateWorker()\n : await getCachedWorkerInstance();\n return worker.insideAPI.randomScrambleStringForEvent(eventID);\n}\n\nexport async function randomScrambleStringForEvent(\n eventID: string,\n): Promise<string> {\n switch (eventID) {\n case \"clock\":\n return randomClockScrambleString();\n }\n return await _randomScrambleStringForEvent(eventID);\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 disableStringWorker: boolean;\n forceNewWorkerForEveryScramble: boolean;\n showWorkerInstantiationWarnings: boolean;\n}\nexport const searchOutsideDebugGlobals: SearchOutsideDebugGlobals = {\n logPerf: true,\n scramblePrefetchLevel: \"auto\",\n disableStringWorker: false,\n forceNewWorkerForEveryScramble: false,\n showWorkerInstantiationWarnings: true,\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 if (\"disableStringWorker\" in options) {\n searchOutsideDebugGlobals.disableStringWorker =\n !!options.disableStringWorker;\n }\n if (\"forceNewWorkerForEveryScramble\" in options) {\n searchOutsideDebugGlobals.forceNewWorkerForEveryScramble =\n !!options.forceNewWorkerForEveryScramble;\n }\n if (\"showWorkerInstantiationWarnings\"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AAO,UAAU;AAAA,QACf;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,MAAI,yBAAyB,SAAS;AACpC,8BAA0B,sBACxB,CAAC,CAAC,QAAQ;AAAA,EACd;AACA,MAAI,oCAAoC,SAAS;AAC/C,8BAA0B,iCACxB,CAAC,CAAC,QAAQ;AAAA,EACd;AACA,MAAI,qCAAqC,SAAS;AAChD,8BAA0B,kCACxB,CAAC,CAAC,QAAQ;AAAA,EACd;AACF;",
6
6
  "names": []
7
7
  }
@@ -200,7 +200,7 @@ async function solve222(pattern) {
200
200
  }
201
201
 
202
202
  // src/cubing/search/inside/solve/puzzles/dynamic/4x4x4/index.ts
203
- var dynamic4x4x4Solver = from(() => import("./search-dynamic-solve-4x4x4-7D4J3U7P.js"));
203
+ var dynamic4x4x4Solver = from(() => import("./search-dynamic-solve-4x4x4-6CAJNKYW.js"));
204
204
 
205
205
  // src/cubing/search/inside/solve/puzzles/4x4x4.ts
206
206
  var randomSuffixes = [
@@ -550,4 +550,4 @@ var insideAPI = {
550
550
 
551
551
  // src/cubing/search/inside/index.ts
552
552
  expose(insideAPI);
553
- //# sourceMappingURL=inside-I7JABMUQ.js.map
553
+ //# sourceMappingURL=inside-CE7DDCWK.js.map
@@ -1,5 +1,5 @@
1
1
  import "./chunk-NAPITA3L.js";
2
- import "./chunk-7DQIG5TO.js";
2
+ import "./chunk-XWAGJB3J.js";
3
3
  import {
4
4
  random333Scramble
5
5
  } from "./chunk-VZOWBQJT.js";
@@ -2921,4 +2921,4 @@ export {
2921
2921
  initialize,
2922
2922
  random444Scramble
2923
2923
  };
2924
- //# sourceMappingURL=search-dynamic-solve-4x4x4-7D4J3U7P.js.map
2924
+ //# sourceMappingURL=search-dynamic-solve-4x4x4-6CAJNKYW.js.map
@@ -9,7 +9,7 @@ import "./chunk-RDSQRW3G.js";
9
9
  // src/cubing/search/worker-workarounds/search-worker-entry.js
10
10
  if (exposeAPI.expose) {
11
11
  (async () => {
12
- await import("./inside-I7JABMUQ.js");
12
+ await import("./inside-CE7DDCWK.js");
13
13
  const messagePort = globalThis.postMessage ? globalThis : await nodeEndpointPort();
14
14
  messagePort.postMessage("comlink-exposed");
15
15
  })();
@@ -1,4 +1,4 @@
1
- import { s as Alg, K as KPattern, v as KPuzzle } from './KPattern-mvBrQSuc.js';
1
+ import { s as Alg, K as KPattern, v as KPuzzle } from './PuzzleLoader-B7Ly-OAs.js';
2
2
 
3
3
  declare enum PrefetchLevel {
4
4
  Auto = "auto",
@@ -1,2 +1,2 @@
1
- export { K as KPattern, a8 as KPatternData, a9 as KPatternOrbitData, v as KPuzzle, aa as KPuzzleDefinition, z as KTransformation, ab as KTransformationData, ac as KTransformationOrbitData } from '../KPattern-mvBrQSuc.js';
1
+ export { K as KPattern, a8 as KPatternData, a9 as KPatternOrbitData, v as KPuzzle, aa as KPuzzleDefinition, z as KTransformation, ab as KTransformationData, ac as KTransformationOrbitData } from '../PuzzleLoader-B7Ly-OAs.js';
2
2
  import 'three/src/Three.js';
@@ -1,4 +1,4 @@
1
- import { s as Alg, t as PuzzleLoader } from '../KPattern-mvBrQSuc.js';
1
+ import { s as Alg, t as PuzzleLoader } from '../PuzzleLoader-B7Ly-OAs.js';
2
2
  import 'three/src/Three.js';
3
3
 
4
4
  declare const countAnimatedLeaves: (alg: Alg) => number;
@@ -1,4 +1,4 @@
1
- import { K as KPattern } from '../KPattern-mvBrQSuc.js';
1
+ import { K as KPattern } from '../PuzzleLoader-B7Ly-OAs.js';
2
2
  import 'three/src/Three.js';
3
3
 
4
4
  type Binary3x3x3Pattern = Uint8Array;
@@ -1,5 +1,5 @@
1
- import { P as Perm } from '../KPattern-mvBrQSuc.js';
2
- export { j as EXPERIMENTAL_PUZZLE_BASE_SHAPES, k as EXPERIMENTAL_PUZZLE_CUT_TYPES, i as ExperimentalPGNotation, l as ExperimentalPuzzleBaseShape, m as ExperimentalPuzzleCutDescription, n as ExperimentalPuzzleCutType, o as ExperimentalPuzzleDescription, a as ExperimentalPuzzleGeometryOptions, q as PuzzleGeometry, Q as Quat, S as StickerDat, b as StickerDatAxis, c as StickerDatFace, d as StickerDatSticker, g as getPG3DNamedPuzzles, e as getPuzzleDescriptionString, f as getPuzzleGeometryByDesc, h as getPuzzleGeometryByName, p as parseOptions, r as parsePuzzleDescription } from '../KPattern-mvBrQSuc.js';
1
+ import { P as Perm } from '../PuzzleLoader-B7Ly-OAs.js';
2
+ export { j as EXPERIMENTAL_PUZZLE_BASE_SHAPES, k as EXPERIMENTAL_PUZZLE_CUT_TYPES, i as ExperimentalPGNotation, l as ExperimentalPuzzleBaseShape, m as ExperimentalPuzzleCutDescription, n as ExperimentalPuzzleCutType, o as ExperimentalPuzzleDescription, a as ExperimentalPuzzleGeometryOptions, q as PuzzleGeometry, Q as Quat, S as StickerDat, b as StickerDatAxis, c as StickerDatFace, d as StickerDatSticker, g as getPG3DNamedPuzzles, e as getPuzzleDescriptionString, f as getPuzzleGeometryByDesc, h as getPuzzleGeometryByName, p as parseOptions, r as parsePuzzleDescription } from '../PuzzleLoader-B7Ly-OAs.js';
3
3
  import 'three/src/Three.js';
4
4
 
5
5
  declare function schreierSims(g: Perm[], disp: (s: string) => void): bigint;
@@ -1,4 +1,4 @@
1
- import { u as PuzzleID, t as PuzzleLoader, v as KPuzzle, q as PuzzleGeometry, E as ExperimentalStickering, w as StickeringMask, x as PuzzleSpecificSimplifyOptions, A as AlgLeaf } from '../KPattern-mvBrQSuc.js';
1
+ import { u as PuzzleID, t as PuzzleLoader, v as KPuzzle, q as PuzzleGeometry, E as ExperimentalStickering, w as StickeringMask, x as PuzzleSpecificSimplifyOptions, A as AlgLeaf } from '../PuzzleLoader-B7Ly-OAs.js';
2
2
  import 'three/src/Three.js';
3
3
 
4
4
  interface EventInfo {
@@ -1,3 +1,3 @@
1
- import '../KPattern-mvBrQSuc.js';
2
- export { r as randomScrambleForEvent } from '../index-If8W3A2Q.js';
1
+ import '../PuzzleLoader-B7Ly-OAs.js';
2
+ export { r as randomScrambleForEvent } from '../index-BOJwUPsI.js';
3
3
  import 'three/src/Three.js';
@@ -1,7 +1,7 @@
1
1
  import "../chunks/chunk-NAPITA3L.js";
2
2
  import {
3
3
  randomScrambleForEvent
4
- } from "../chunks/chunk-7DQIG5TO.js";
4
+ } from "../chunks/chunk-XWAGJB3J.js";
5
5
  import "../chunks/chunk-VZOWBQJT.js";
6
6
  import "../chunks/chunk-7GUL3OBQ.js";
7
7
  import "../chunks/chunk-RDSQRW3G.js";
@@ -1,5 +1,5 @@
1
- import { K as KPattern } from '../KPattern-mvBrQSuc.js';
2
- export { e as experimentalSolve2x2x2, a as experimentalSolve3x3x3IgnoringCenters, f as experimentalSolveTwsearch, s as setSearchDebug, b as solveMegaminx, c as solvePyraminx, d as solveSkewb } from '../index-If8W3A2Q.js';
1
+ import { K as KPattern } from '../PuzzleLoader-B7Ly-OAs.js';
2
+ export { e as experimentalSolve2x2x2, a as experimentalSolve3x3x3IgnoringCenters, f as experimentalSolveTwsearch, s as setSearchDebug, b as solveMegaminx, c as solvePyraminx, d as solveSkewb } from '../index-BOJwUPsI.js';
3
3
  import 'three/src/Three.js';
4
4
 
5
5
  declare function random333Pattern(): Promise<KPattern>;
@@ -6,7 +6,7 @@ import {
6
6
  solvePyraminx,
7
7
  solveSkewb,
8
8
  solveTwsearch
9
- } from "../chunks/chunk-7DQIG5TO.js";
9
+ } from "../chunks/chunk-XWAGJB3J.js";
10
10
  import {
11
11
  random333Pattern
12
12
  } from "../chunks/chunk-VZOWBQJT.js";
@@ -1,5 +1,5 @@
1
- import '../KPattern-mvBrQSuc.js';
2
- import { A as AlgLeafEvent, O as OrientationEvent } from '../bluetooth-puzzle-wivjKx0u.js';
1
+ import '../PuzzleLoader-B7Ly-OAs.js';
2
+ import { A as AlgLeafEvent, O as OrientationEvent } from '../bluetooth-puzzle-nh-dCXPL.js';
3
3
  import 'three/src/Three.js';
4
4
 
5
5
  interface ProxyMoveEvent {
@@ -1,5 +1,5 @@
1
- import { y as AlgIndexer, v as KPuzzle, s as Alg, M as Move, T as Timestamp, K as KPattern, z as KTransformation, D as Duration, w as StickeringMask } from '../KPattern-mvBrQSuc.js';
2
- export { C as BackViewLayout, N as EXPERIMENTAL_PROP_NO_VALUE, B as ExperimentalMillisecondTimestamp, E as ExperimentalStickering, u as PuzzleID, G as TwistyAlgEditor, H as TwistyAlgViewer, J as TwistyPlayer, I as TwistyPlayerConfig, L as TwizzleLink, V as VisualizationFormat, F as backViewLayouts } from '../KPattern-mvBrQSuc.js';
1
+ import { y as AlgIndexer, v as KPuzzle, s as Alg, M as Move, T as Timestamp, K as KPattern, z as KTransformation, D as Duration, w as StickeringMask } from '../PuzzleLoader-B7Ly-OAs.js';
2
+ export { C as BackViewLayout, N as EXPERIMENTAL_PROP_NO_VALUE, B as ExperimentalMillisecondTimestamp, E as ExperimentalStickering, u as PuzzleID, G as TwistyAlgEditor, H as TwistyAlgViewer, J as TwistyPlayer, I as TwistyPlayerConfig, L as TwizzleLink, V as VisualizationFormat, F as backViewLayouts } from '../PuzzleLoader-B7Ly-OAs.js';
3
3
  import 'three/src/Three.js';
4
4
 
5
5
  declare class SimpleAlgIndexer implements AlgIndexer {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cubing",
3
- "version": "0.57.2",
3
+ "version": "0.57.3",
4
4
  "description": "A collection of JavaScript cubing libraries.",
5
5
  "author": "The js.cubing.net team",
6
6
  "type": "module",
@@ -873,6 +873,26 @@ declare class KPuzzle {
873
873
  canConvertDefaultPatternToUniqueTransformation(): boolean;
874
874
  }
875
875
 
876
+ declare class KPattern {
877
+ readonly kpuzzle: KPuzzle;
878
+ readonly patternData: KPatternData;
879
+ constructor(kpuzzle: KPuzzle, patternData: KPatternData);
880
+ toJSON(): any;
881
+ static fromTransformation(transformation: KTransformation): KPattern;
882
+ /** @deprecated */
883
+ apply(source: KTransformationSource): KPattern;
884
+ applyTransformation(transformation: KTransformation): KPattern;
885
+ applyMove(move: Move | string): KPattern;
886
+ applyAlg(alg: Alg | string): KPattern;
887
+ isIdentical(other: KPattern): boolean;
888
+ /** @deprecated */
889
+ experimentalToTransformation(): KTransformation | null;
890
+ experimentalIsSolved(options: {
891
+ ignorePuzzleOrientation: boolean;
892
+ ignoreCenterOrientation: boolean;
893
+ }): boolean;
894
+ }
895
+
876
896
  type MillisecondTimestamp = number;
877
897
  type Duration = MillisecondTimestamp;
878
898
  type Timestamp = MillisecondTimestamp;
@@ -2309,24 +2329,4 @@ interface PuzzleLoader {
2309
2329
  keyMapping?: () => Promise<KeyMapping>;
2310
2330
  }
2311
2331
 
2312
- declare class KPattern {
2313
- readonly kpuzzle: KPuzzle;
2314
- readonly patternData: KPatternData;
2315
- constructor(kpuzzle: KPuzzle, patternData: KPatternData);
2316
- toJSON(): any;
2317
- static fromTransformation(transformation: KTransformation): KPattern;
2318
- /** @deprecated */
2319
- apply(source: KTransformationSource): KPattern;
2320
- applyTransformation(transformation: KTransformation): KPattern;
2321
- applyMove(move: Move | string): KPattern;
2322
- applyAlg(alg: Alg | string): KPattern;
2323
- isIdentical(other: KPattern): boolean;
2324
- /** @deprecated */
2325
- experimentalToTransformation(): KTransformation | null;
2326
- experimentalIsSolved(options: {
2327
- ignorePuzzleOrientation: boolean;
2328
- ignoreCenterOrientation: boolean;
2329
- }): boolean;
2330
- }
2331
-
2332
2332
  export { type KeyMapping as $, type AlgLeaf as A, type MillisecondTimestamp as B, type BackViewLayout as C, type Duration as D, type ExperimentalStickering as E, backViewLayouts as F, TwistyAlgEditor as G, TwistyAlgViewer as H, type TwistyPlayerConfig as I, TwistyPlayer as J, KPattern as K, TwizzleLink as L, Move as M, NO_VALUE as N, type AlgNode as O, Perm as P, Quat as Q, type AppendOptions as R, type StickerDat as S, type Timestamp as T, Grouping as U, type VisualizationFormat as V, LineComment as W, Commutator as X, Conjugate as Y, Newline as Z, Pause as _, type PuzzleGeometryOptions as a, type AlgBranch as a0, type MoveModifications as a1, type Parsed as a2, type ExperimentalNotationType as a3, type ExperimentalSerializationOptions as a4, type AppendCancelOptions as a5, type SimplifyOptions as a6, QuantumMove as a7, type KPatternData as a8, type KPatternOrbitData as a9, type KPuzzleDefinition as aa, type KTransformationData as ab, type KTransformationOrbitData as ac, type StickerDatAxis as b, type StickerDatFace as c, type StickerDatSticker as d, getPuzzleDescriptionString as e, getPuzzleGeometryByDesc as f, getPG3DNamedPuzzles as g, getPuzzleGeometryByName as h, PGNotation as i, PUZZLE_BASE_SHAPES as j, PUZZLE_CUT_TYPES as k, type PuzzleBaseShape as l, type PuzzleCutDescription as m, type PuzzleCutType as n, type PuzzleDescription as o, parseOptions as p, PuzzleGeometry as q, parsePuzzleDescription as r, Alg as s, type PuzzleLoader as t, type PuzzleID as u, KPuzzle as v, type StickeringMask as w, type PuzzleSpecificSimplifyOptions as x, type AlgIndexer as y, KTransformation as z };