cubing 0.61.0 → 0.61.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.
- package/dist/bin/chunks/chunk-ZQLNUW2N.js +14 -0
- package/dist/bin/chunks/chunk-ZQLNUW2N.js.map +7 -0
- package/dist/bin/order.js +46 -42
- package/dist/bin/order.js.map +2 -2
- package/dist/bin/puzzle-geometry-bin.js +379 -257
- package/dist/bin/puzzle-geometry-bin.js.map +3 -3
- package/dist/bin/scramble.js +124 -102
- package/dist/bin/scramble.js.map +3 -3
- package/dist/lib/cubing/{KPattern-CU9Suh1T.d.ts → PuzzleLoader-CkghxdIL.d.ts} +186 -179
- package/dist/lib/cubing/alg/index.d.ts +2 -2
- package/dist/lib/cubing/bluetooth/index.d.ts +3 -3
- package/dist/lib/cubing/bluetooth/index.js +4 -4
- package/dist/lib/cubing/{bluetooth-puzzle-gTRbIRyj.d.ts → bluetooth-puzzle-c-_IBAdu.d.ts} +1 -1
- package/dist/lib/cubing/chunks/{chunk-ABQAUY7H.js → chunk-557DMXD6.js} +3 -3
- package/dist/lib/cubing/chunks/{chunk-RKTO4CAU.js → chunk-7DT3G3FA.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-BUZPONAW.js → chunk-I5QO52OG.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-PVOSBZRD.js → chunk-KZGAQEPN.js} +3 -3
- package/dist/lib/cubing/chunks/{chunk-RUSWM2KK.js → chunk-ST4K23C3.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-RUSWM2KK.js.map → chunk-ST4K23C3.js.map} +1 -1
- package/dist/lib/cubing/chunks/{chunk-REBGU5ET.js → chunk-T3SF7NHB.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-OJI4YUWF.js → chunk-UMNYMJKD.js} +4 -4
- package/dist/lib/cubing/chunks/{chunk-WIZJQ7QS.js → chunk-UZ7SWKN6.js} +15 -15
- package/dist/lib/cubing/chunks/{chunk-PSQEELP4.js → chunk-WAYEJXCG.js} +1 -1
- package/dist/lib/cubing/chunks/chunk-WAYEJXCG.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-NX2Q6B7Y.js → chunk-ZKJKRQKY.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-NX2Q6B7Y.js.map → chunk-ZKJKRQKY.js.map} +2 -2
- package/dist/lib/cubing/chunks/{inside-PM6546BQ.js → inside-K3VX2AIZ.js} +12 -12
- package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-BOGUHF4Q.js → puzzles-dynamic-side-events-IMYJ533P.js} +1 -1
- package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-IMYJ533P.js.map +7 -0
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-SYC27DSG.js → search-dynamic-sgs-side-events-RIRYKEP5.js} +4 -4
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-QGGV4PCJ.js → search-dynamic-sgs-unofficial-N4CRUF4Q.js} +4 -4
- package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-IE5W637Q.js → search-dynamic-solve-4x4x4-4UB4NMF3.js} +7 -7
- package/dist/lib/cubing/chunks/search-worker-entry.js +3 -3
- package/dist/lib/cubing/chunks/{twisty-dynamic-3d-LPZQIDD2.js → twisty-dynamic-3d-OCL53BVF.js} +5 -5
- package/dist/lib/cubing/{index-CORXpckt.d.ts → index-B_8W-2zR.d.ts} +1 -1
- package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
- package/dist/lib/cubing/kpuzzle/index.js +1 -1
- package/dist/lib/cubing/notation/index.d.ts +1 -1
- package/dist/lib/cubing/notation/index.js +3 -3
- package/dist/lib/cubing/protocol/index.d.ts +1 -1
- package/dist/lib/cubing/protocol/index.js +3 -3
- package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
- package/dist/lib/cubing/puzzle-geometry/index.js +138 -179
- package/dist/lib/cubing/puzzle-geometry/index.js.map +3 -3
- package/dist/lib/cubing/puzzles/index.d.ts +1 -1
- package/dist/lib/cubing/puzzles/index.js +3 -3
- package/dist/lib/cubing/scramble/index.d.ts +2 -2
- package/dist/lib/cubing/scramble/index.js +6 -6
- package/dist/lib/cubing/search/index.d.ts +3 -3
- package/dist/lib/cubing/search/index.js +6 -6
- package/dist/lib/cubing/stream/index.d.ts +2 -2
- package/dist/lib/cubing/twisty/index.d.ts +2 -2
- package/dist/lib/cubing/twisty/index.js +5 -5
- package/dist/lib/cubing/twisty/index.js.map +1 -1
- package/experimental-json-schema/kpuzzle/KPatternData.schema.json +22 -30
- package/experimental-json-schema/kpuzzle/KPuzzleDefinition.schema.json +72 -89
- package/experimental-json-schema/kpuzzle/KTransformationData.schema.json +17 -26
- package/package.json +54 -100
- package/dist/bin/chunks/chunk-J53ID3VX.js +0 -26
- package/dist/bin/chunks/chunk-J53ID3VX.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-PSQEELP4.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-BOGUHF4Q.js.map +0 -7
- /package/dist/lib/cubing/chunks/{chunk-ABQAUY7H.js.map → chunk-557DMXD6.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-RKTO4CAU.js.map → chunk-7DT3G3FA.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-BUZPONAW.js.map → chunk-I5QO52OG.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-PVOSBZRD.js.map → chunk-KZGAQEPN.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-REBGU5ET.js.map → chunk-T3SF7NHB.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-OJI4YUWF.js.map → chunk-UMNYMJKD.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-WIZJQ7QS.js.map → chunk-UZ7SWKN6.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{inside-PM6546BQ.js.map → inside-K3VX2AIZ.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-SYC27DSG.js.map → search-dynamic-sgs-side-events-RIRYKEP5.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-QGGV4PCJ.js.map → search-dynamic-sgs-unofficial-N4CRUF4Q.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-IE5W637Q.js.map → search-dynamic-solve-4x4x4-4UB4NMF3.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{twisty-dynamic-3d-LPZQIDD2.js.map → twisty-dynamic-3d-OCL53BVF.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cubing/kpuzzle/combine.ts", "../../../../src/cubing/kpuzzle/construct.ts", "../../../../src/cubing/kpuzzle/KTransformation.ts", "../../../../src/cubing/kpuzzle/calculate.ts", "../../../../src/cubing/kpuzzle/KPattern.ts", "../../../../src/cubing/kpuzzle/KPuzzle.ts"],
|
|
4
|
+
"sourcesContent": ["import { isOrbitTransformationDataIdentityUncached } from \"./calculate\";\nimport type { KPuzzleDefinition } from \"./KPuzzleDefinition\";\nimport type {\n KPatternData,\n KPatternOrbitData,\n KTransformationData,\n} from \"./KPuzzleDefinitionJSON\";\n\nexport function combineTransformationData(\n definition: KPuzzleDefinition,\n transformationData1: KTransformationData,\n transformationData2: KTransformationData,\n): KTransformationData {\n const newTransformationData = {} as KTransformationData;\n for (const orbitDefinition of definition.orbits) {\n const orbit1 = transformationData1[orbitDefinition.orbitName];\n const orbit2 = transformationData2[orbitDefinition.orbitName];\n if (\n isOrbitTransformationDataIdentityUncached(\n orbitDefinition.numOrientations,\n orbit2,\n )\n ) {\n // common case for big cubes\n newTransformationData[orbitDefinition.orbitName] = orbit1;\n } else if (\n isOrbitTransformationDataIdentityUncached(\n orbitDefinition.numOrientations,\n orbit1,\n )\n ) {\n newTransformationData[orbitDefinition.orbitName] = orbit2;\n } else {\n const newPerm = new Array(orbitDefinition.numPieces);\n if (orbitDefinition.numOrientations === 1) {\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n newPerm[idx] = orbit1.permutation[orbit2.permutation[idx]];\n }\n newTransformationData[orbitDefinition.orbitName] = {\n permutation: newPerm,\n orientationDelta: orbit1.orientationDelta,\n };\n } else {\n const newOri = new Array(orbitDefinition.numPieces);\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n newOri[idx] =\n (orbit1.orientationDelta[orbit2.permutation[idx]] +\n orbit2.orientationDelta[idx]) %\n orbitDefinition.numOrientations;\n newPerm[idx] = orbit1.permutation[orbit2.permutation[idx]];\n }\n newTransformationData[orbitDefinition.orbitName] = {\n permutation: newPerm,\n orientationDelta: newOri,\n };\n }\n }\n }\n return newTransformationData;\n}\n\nexport function applyTransformationDataToKPatternData(\n definition: KPuzzleDefinition,\n patternData: KPatternData,\n transformationData: KTransformationData,\n): KPatternData {\n const newPatternData = {} as KPatternData;\n for (const orbitDefinition of definition.orbits) {\n const patternOrbit = patternData[orbitDefinition.orbitName];\n const transformationOrbit = transformationData[orbitDefinition.orbitName];\n if (\n isOrbitTransformationDataIdentityUncached(\n orbitDefinition.numOrientations,\n transformationOrbit,\n )\n ) {\n // common case for big cubes\n newPatternData[orbitDefinition.orbitName] = patternOrbit;\n } else {\n const newPieces = new Array(orbitDefinition.numPieces);\n if (orbitDefinition.numOrientations === 1) {\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n newPieces[idx] =\n patternOrbit.pieces[transformationOrbit.permutation[idx]];\n }\n const newOrbitData: KPatternOrbitData = {\n pieces: newPieces,\n orientation: patternOrbit.orientation, // copy all 0\n };\n newPatternData[orbitDefinition.orbitName] = newOrbitData;\n } else {\n const newOrientation = new Array(orbitDefinition.numPieces);\n const newOrientationMod: number[] | undefined =\n patternOrbit.orientationMod\n ? new Array(orbitDefinition.numPieces)\n : undefined;\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n const transformationIdx = transformationOrbit.permutation[idx];\n let mod = orbitDefinition.numOrientations;\n if (patternOrbit.orientationMod) {\n const orientationMod =\n patternOrbit.orientationMod[transformationIdx];\n newOrientationMod![idx] = orientationMod;\n mod = orientationMod || orbitDefinition.numOrientations;\n }\n newOrientation[idx] =\n (patternOrbit.orientation[transformationIdx] +\n transformationOrbit.orientationDelta[idx]) %\n mod; // We don't have to use `modIntoRange` (assuming input is well-formed), because we're adding.\n newPieces[idx] = patternOrbit.pieces[transformationIdx];\n }\n const newOrbitData: KPatternOrbitData = {\n pieces: newPieces,\n orientation: newOrientation,\n };\n if (newOrientationMod) {\n newOrbitData.orientationMod = newOrientationMod;\n }\n newPatternData[orbitDefinition.orbitName] = newOrbitData;\n }\n }\n }\n return newPatternData;\n}\n", "import type { Move } from \"../alg\";\nimport { repeatTransformationUncached } from \"./calculate\";\nimport type { KPuzzle } from \"./KPuzzle\";\nimport type { KPuzzleDefinition } from \"./KPuzzleDefinition\";\nimport type {\n KTransformationData,\n KTransformationOrbitData,\n} from \"./KPuzzleDefinitionJSON\";\n\nconst FREEZE: boolean = false;\n\nconst identityOrbitCache = new Map<number, KTransformationOrbitData>();\nfunction constructIdentityOrbitTransformation(\n numPieces: number,\n): KTransformationOrbitData {\n const cached = identityOrbitCache.get(numPieces);\n if (cached) {\n return cached;\n }\n\n const newPermutation = new Array(numPieces);\n const newOrientation = new Array(numPieces);\n for (let i = 0; i < numPieces; i++) {\n newPermutation[i] = i;\n newOrientation[i] = 0;\n }\n const orbitTransformation = {\n permutation: newPermutation,\n orientationDelta: newOrientation,\n };\n if (FREEZE) {\n Object.freeze(newPermutation); // TODO\n Object.freeze(newOrientation); // TODO\n Object.freeze(orbitTransformation); // TODO\n }\n identityOrbitCache.set(numPieces, orbitTransformation);\n return orbitTransformation;\n}\n\nexport function constructIdentityTransformationDataUncached(\n definition: KPuzzleDefinition,\n): KTransformationData {\n const transformation = {} as KTransformationData;\n for (const orbitDefinition of definition.orbits) {\n transformation[orbitDefinition.orbitName] =\n constructIdentityOrbitTransformation(orbitDefinition.numPieces);\n }\n if (FREEZE) {\n Object.freeze(transformation); // TODO\n }\n return transformation;\n}\n\nexport function moveToTransformationUncached(\n kpuzzle: KPuzzle,\n move: Move,\n): KTransformationData {\n function getTransformationData(\n key: {\n toString: () => string;\n },\n multiplyAmount: number,\n ): KTransformationData | undefined {\n const s = key.toString();\n const movesDef = kpuzzle.definition.moves[s];\n if (movesDef) {\n return repeatTransformationUncached(kpuzzle, movesDef, multiplyAmount);\n }\n const derivedDef = kpuzzle.definition.derivedMoves?.[s];\n if (derivedDef) {\n return repeatTransformationUncached(\n kpuzzle,\n kpuzzle.algToTransformation(derivedDef).transformationData,\n multiplyAmount,\n );\n }\n return undefined;\n }\n\n // TODO: Use Euclid's algorithm to pre-calculate the GCD of moves for each\n // quantum, along with its transformation. This will make lookup `O(1)` for multiples of e.g. `y2`.\n\n const data =\n getTransformationData(move.quantum, move.amount) ??\n // Handle e.g. `y2` if `y2` is defined.\n // Note: this doesn't handle multiples.\n getTransformationData(move, 1) ??\n // Handle e.g. `y2'` if `y2` is defined.\n // Note: this doesn't handle multiples.\n getTransformationData(move.invert, -1);\n\n if (data) {\n return data;\n }\n throw new Error(`Invalid move for KPuzzle (${kpuzzle.name()}): ${move}`);\n}\n", "import type { Alg, Move } from \"../alg\";\nimport {\n invertTransformation,\n isTransformationDataIdentical,\n repeatTransformationUncached,\n transformationRepetitionOrder,\n} from \"./calculate\";\nimport { combineTransformationData } from \"./combine\";\nimport { constructIdentityTransformationDataUncached } from \"./construct\";\nimport { KPattern } from \"./KPattern\";\nimport type { KPuzzle, KTransformationSource } from \"./KPuzzle\";\nimport type { KTransformationData } from \"./KPuzzleDefinitionJSON\";\n\nexport class KTransformation {\n constructor(\n public readonly kpuzzle: KPuzzle,\n public readonly transformationData: KTransformationData,\n ) {}\n\n toJSON(): any {\n return {\n experimentalPuzzleName: this.kpuzzle.name(),\n transformationData: this.transformationData,\n };\n }\n\n invert(): KTransformation {\n return new KTransformation(\n this.kpuzzle,\n invertTransformation(this.kpuzzle, this.transformationData),\n );\n }\n\n // For optimizations, we want to make it cheap to rely on optimizations when a\n // transformation is an identity. Here, we try to make it cheaper by:\n // - only calculating when needed, and\n // - caching the result.\n #cachedIsIdentity: boolean | undefined; // TODO: is `null` worse here?\n isIdentityTransformation(): boolean {\n return (this.#cachedIsIdentity ??= this.isIdentical(\n this.kpuzzle.identityTransformation(),\n ));\n }\n\n /** @deprecated */\n static experimentalConstructIdentity(kpuzzle: KPuzzle) {\n const transformation = new KTransformation(\n kpuzzle,\n constructIdentityTransformationDataUncached(kpuzzle.definition),\n );\n transformation.#cachedIsIdentity = true;\n return transformation;\n }\n\n isIdentical(t2: KTransformation): boolean {\n return isTransformationDataIdentical(\n this.kpuzzle,\n this.transformationData,\n t2.transformationData,\n );\n }\n\n // Convenience function\n /** @deprecated */\n apply(source: KTransformationSource): KTransformation {\n return this.applyTransformation(this.kpuzzle.toTransformation(source));\n }\n\n applyTransformation(t2: KTransformation): KTransformation {\n if (this.kpuzzle !== t2.kpuzzle) {\n throw new Error(\n `Tried to apply a transformation for a KPuzzle (${t2.kpuzzle.name()}) to a different KPuzzle (${this.kpuzzle.name()}).`,\n );\n }\n\n if (this.#cachedIsIdentity) {\n return new KTransformation(this.kpuzzle, t2.transformationData);\n }\n if (t2.#cachedIsIdentity) {\n return new KTransformation(this.kpuzzle, this.transformationData);\n }\n\n return new KTransformation(\n this.kpuzzle,\n combineTransformationData(\n this.kpuzzle.definition,\n this.transformationData,\n t2.transformationData,\n ),\n );\n }\n\n applyMove(move: Move | string): KTransformation {\n return this.applyTransformation(this.kpuzzle.moveToTransformation(move));\n }\n\n applyAlg(alg: Alg | string): KTransformation {\n return this.applyTransformation(this.kpuzzle.algToTransformation(alg));\n }\n\n // Convenience. Useful for chaining.\n toKPattern(): KPattern {\n return KPattern.fromTransformation(this);\n }\n\n // TODO: support calculating this for a given start state. (For `R U R' U` on 3x3x3, should this default to 5 or 10?)\n repetitionOrder(): number {\n return transformationRepetitionOrder(this.kpuzzle.definition, this);\n }\n\n selfMultiply(amount: number): KTransformation {\n return new KTransformation(\n this.kpuzzle,\n repeatTransformationUncached(\n this.kpuzzle,\n this.transformationData,\n amount,\n ),\n );\n }\n}\n", "import {\n type Alg,\n type Commutator,\n type Conjugate,\n functionFromTraversal,\n type Grouping,\n type LineComment,\n type Move,\n type Newline,\n type Pause,\n TraversalDownUp,\n} from \"../alg\";\nimport { combineTransformationData } from \"./combine\";\nimport type { KPuzzle } from \"./KPuzzle\";\nimport type { KPuzzleDefinition } from \"./KPuzzleDefinition\";\nimport type {\n KPatternData,\n KPatternOrbitData,\n KPuzzleOrbitDefinition,\n KTransformationData,\n KTransformationOrbitData,\n} from \"./KPuzzleDefinitionJSON\";\nimport { KTransformation } from \"./KTransformation\";\n\nexport function isOrbitTransformationDataIdentityUncached(\n numOrientations: number,\n orbitTransformationData: KTransformationOrbitData,\n): boolean {\n // TODO\n // if (o === lasto) {\n // return true;\n // }\n if (!orbitTransformationData.permutation) {\n console.log(orbitTransformationData);\n }\n const { permutation } = orbitTransformationData;\n const numPieces = permutation.length;\n for (let idx = 0; idx < numPieces; idx++) {\n if (permutation[idx] !== idx) {\n return false;\n }\n }\n if (numOrientations > 1) {\n const { orientationDelta: orientation } = orbitTransformationData;\n for (let idx = 0; idx < numPieces; idx++) {\n if (orientation[idx] !== 0) {\n return false;\n }\n }\n }\n // lasto = o; // TODO\n return true;\n}\n\nexport function isOrbitTransformationDataIdentical(\n orbitDefinition: KPuzzleOrbitDefinition,\n orbitTransformationData1: KTransformationOrbitData,\n orbitTransformationData2: KTransformationOrbitData,\n options: {\n ignorePieceOrientations?: boolean;\n ignorePiecePermutation?: boolean;\n } = {},\n): boolean {\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n if (\n !options?.ignorePieceOrientations &&\n orbitTransformationData1.orientationDelta[idx] !==\n orbitTransformationData2.orientationDelta[idx]\n ) {\n return false;\n }\n if (\n !options?.ignorePiecePermutation &&\n orbitTransformationData1.permutation[idx] !==\n orbitTransformationData2.permutation[idx]\n ) {\n return false;\n }\n }\n return true;\n}\n\nexport function isTransformationDataIdentical(\n kpuzzle: KPuzzle,\n transformationData1: KTransformationData,\n transformationData2: KTransformationData,\n): boolean {\n for (const orbitDefinition of kpuzzle.definition.orbits) {\n if (\n !isOrbitTransformationDataIdentical(\n orbitDefinition,\n transformationData1[orbitDefinition.orbitName],\n transformationData2[orbitDefinition.orbitName],\n )\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction isOrbitPatternDataIdentical(\n orbitDefinition: KPuzzleOrbitDefinition,\n orbitPatternData1: KPatternOrbitData,\n orbitPatternData2: KPatternOrbitData,\n options: {\n ignorePieceOrientations?: boolean;\n ignorePieceIndices?: boolean;\n } = {},\n): boolean {\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n if (\n !options?.ignorePieceOrientations &&\n (orbitPatternData1.orientation[idx] !==\n orbitPatternData2.orientation[idx] ||\n (orbitPatternData1.orientationMod?.[idx] ?? 0) !==\n (orbitPatternData2.orientationMod?.[idx] ?? 0))\n ) {\n return false;\n }\n if (\n !options?.ignorePieceIndices &&\n orbitPatternData1.pieces[idx] !== orbitPatternData2.pieces[idx]\n ) {\n return false;\n }\n }\n return true;\n}\n\nexport function isPatternDataIdentical(\n kpuzzle: KPuzzle,\n patternData1: KPatternData,\n patternData2: KPatternData,\n): boolean {\n for (const orbitDefinition of kpuzzle.definition.orbits) {\n if (\n !isOrbitPatternDataIdentical(\n orbitDefinition,\n patternData1[orbitDefinition.orbitName],\n patternData2[orbitDefinition.orbitName],\n )\n ) {\n return false;\n }\n }\n return true;\n}\n\nexport function invertTransformation(\n kpuzzle: KPuzzle,\n transformationData: KTransformationData,\n): KTransformationData {\n const newTransformationData: KTransformationData = {};\n for (const orbitDefinition of kpuzzle.definition.orbits) {\n const orbitTransformationData =\n transformationData[orbitDefinition.orbitName];\n if (\n isOrbitTransformationDataIdentityUncached(\n orbitDefinition.numOrientations,\n orbitTransformationData,\n )\n ) {\n newTransformationData[orbitDefinition.orbitName] =\n orbitTransformationData;\n } else if (orbitDefinition.numOrientations === 1) {\n const newPerm = new Array(orbitDefinition.numPieces);\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n newPerm[orbitTransformationData.permutation[idx]] = idx;\n }\n newTransformationData[orbitDefinition.orbitName] = {\n permutation: newPerm,\n orientationDelta: orbitTransformationData.orientationDelta,\n };\n } else {\n const newPerm = new Array(orbitDefinition.numPieces);\n const newOri = new Array(orbitDefinition.numPieces);\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n const fromIdx = orbitTransformationData.permutation[idx];\n newPerm[fromIdx] = idx;\n newOri[fromIdx] =\n (orbitDefinition.numOrientations -\n orbitTransformationData.orientationDelta[idx] +\n orbitDefinition.numOrientations) %\n orbitDefinition.numOrientations;\n }\n newTransformationData[orbitDefinition.orbitName] = {\n permutation: newPerm,\n orientationDelta: newOri,\n };\n }\n }\n return newTransformationData;\n}\n\nexport function repeatTransformationUncached(\n kpuzzle: KPuzzle,\n transformationData: KTransformationData,\n amount: number,\n): KTransformationData {\n // This is used for move construction, so we optimize for the quantum move case.\n if (amount === 1) {\n return transformationData;\n }\n if (amount < 0) {\n return repeatTransformationUncached(\n kpuzzle,\n invertTransformation(kpuzzle, transformationData),\n -amount,\n );\n }\n if (amount === 0) {\n // TODO\n const { transformationData } = kpuzzle.identityTransformation();\n return transformationData;\n }\n let halfish = transformationData;\n if (amount !== 2) {\n halfish = repeatTransformationUncached(\n kpuzzle,\n transformationData,\n Math.floor(amount / 2),\n );\n }\n const twiceHalfish = combineTransformationData(\n kpuzzle.definition,\n halfish,\n halfish,\n );\n if (amount % 2 === 0) {\n return twiceHalfish;\n } else {\n return combineTransformationData(\n kpuzzle.definition,\n transformationData,\n twiceHalfish,\n );\n }\n}\n\nclass AlgToTransformationTraversal extends TraversalDownUp<\n KPuzzle,\n KTransformation\n> {\n traverseAlg(alg: Alg, kpuzzle: KPuzzle): KTransformation {\n let transformation: KTransformation | null = null;\n for (const algNode of alg.childAlgNodes()) {\n if (transformation) {\n transformation = transformation.applyTransformation(\n this.traverseAlgNode(algNode, kpuzzle),\n );\n } else {\n transformation = this.traverseAlgNode(algNode, kpuzzle);\n }\n }\n return transformation ?? kpuzzle.identityTransformation();\n }\n traverseGrouping(grouping: Grouping, kpuzzle: KPuzzle): KTransformation {\n const algTransformation = this.traverseAlg(grouping.alg, kpuzzle);\n return new KTransformation(\n kpuzzle,\n repeatTransformationUncached(\n kpuzzle,\n algTransformation.transformationData,\n grouping.amount,\n ),\n );\n }\n traverseMove(move: Move, kpuzzle: KPuzzle): KTransformation {\n return kpuzzle.moveToTransformation(move);\n }\n traverseCommutator(\n commutator: Commutator,\n kpuzzle: KPuzzle,\n ): KTransformation {\n const aTransformation = this.traverseAlg(commutator.A, kpuzzle);\n const bTransformation = this.traverseAlg(commutator.B, kpuzzle);\n return aTransformation\n .applyTransformation(bTransformation)\n .applyTransformation(aTransformation.invert())\n .applyTransformation(bTransformation.invert());\n }\n traverseConjugate(conjugate: Conjugate, kpuzzle: KPuzzle): KTransformation {\n const aTransformation = this.traverseAlg(conjugate.A, kpuzzle);\n const bTransformation = this.traverseAlg(conjugate.B, kpuzzle);\n return aTransformation\n .applyTransformation(bTransformation)\n .applyTransformation(aTransformation.invert());\n }\n traversePause(_: Pause, kpuzzle: KPuzzle): KTransformation {\n return kpuzzle.identityTransformation();\n }\n traverseNewline(_: Newline, kpuzzle: KPuzzle): KTransformation {\n return kpuzzle.identityTransformation();\n }\n traverseLineComment(_: LineComment, kpuzzle: KPuzzle): KTransformation {\n return kpuzzle.identityTransformation();\n }\n}\n\nexport const algToTransformation = functionFromTraversal(\n AlgToTransformationTraversal,\n);\n\n// export function canConvertDefaultPatternToUniqueTransformationUncached(\n// definition: KPuzzleDefinition,\n// ): boolean {\n// for (const orbitDefinition of definition.orbits) {\n// const pieces = new Array(orbitDefinition.numPieces).fill(false);\n// for (const piece of definition.defaultPattern[orbitDefinition.orbitName]\n// .pieces) {\n// pieces[piece] = true;\n// }\n// for (const piece of pieces) {\n// if (!piece) {\n// return false;\n// }\n// }\n// }\n// return true;\n// }\n\nfunction gcd(a: number, b: number): number {\n if (b) {\n return gcd(b, a % b);\n }\n return a;\n}\n\n/* calculate the order of a particular transformation. */\nexport function transformationRepetitionOrder(\n definition: KPuzzleDefinition,\n transformation: KTransformation,\n): number {\n let order: number = 1;\n for (const orbitDefinition of definition.orbits) {\n const transformationOrbit =\n transformation.transformationData[orbitDefinition.orbitName];\n const orbitPieces = new Array(orbitDefinition.numPieces);\n for (let startIdx = 0; startIdx < orbitDefinition.numPieces; startIdx++) {\n if (!orbitPieces[startIdx]) {\n let currentIdx = startIdx;\n let orientationSum = 0;\n let cycleLength = 0;\n for (;;) {\n orbitPieces[currentIdx] = true;\n orientationSum =\n orientationSum + transformationOrbit.orientationDelta[currentIdx];\n cycleLength = cycleLength + 1;\n currentIdx = transformationOrbit.permutation[currentIdx];\n if (currentIdx === startIdx) {\n break;\n }\n }\n if (orientationSum !== 0) {\n cycleLength =\n (cycleLength * orbitDefinition.numOrientations) /\n gcd(orbitDefinition.numOrientations, Math.abs(orientationSum));\n }\n order = (order * cycleLength) / gcd(order, cycleLength);\n }\n }\n }\n return order;\n}\n", "import type { Alg, Move } from \"../alg\";\nimport { isPatternDataIdentical } from \"./calculate\";\nimport { applyTransformationDataToKPatternData } from \"./combine\";\nimport type { KPuzzle, KTransformationSource } from \"./KPuzzle\";\nimport type {\n KPatternData,\n KTransformationData,\n KTransformationOrbitData,\n} from \"./KPuzzleDefinitionJSON\";\nimport { KTransformation } from \"./KTransformation\";\n\nexport class KPattern {\n constructor(\n public readonly kpuzzle: KPuzzle,\n public readonly patternData: KPatternData,\n ) {}\n\n toJSON(): any {\n return {\n experimentalPuzzleName: this.kpuzzle.name(),\n patternData: this.patternData,\n };\n }\n\n static fromTransformation(transformation: KTransformation): KPattern {\n const newPatternData = applyTransformationDataToKPatternData(\n transformation.kpuzzle.definition,\n transformation.kpuzzle.definition.defaultPattern,\n transformation.transformationData,\n );\n return new KPattern(transformation.kpuzzle, newPatternData);\n }\n\n // Convenience function\n /** @deprecated */\n apply(source: KTransformationSource): KPattern {\n return this.applyTransformation(this.kpuzzle.toTransformation(source));\n }\n\n applyTransformation(transformation: KTransformation): KPattern {\n if (transformation.isIdentityTransformation()) {\n return new KPattern(this.kpuzzle, this.patternData);\n }\n const newPatternData = applyTransformationDataToKPatternData(\n this.kpuzzle.definition,\n this.patternData,\n transformation.transformationData,\n );\n return new KPattern(this.kpuzzle, newPatternData);\n }\n\n applyMove(move: Move | string): KPattern {\n return this.applyTransformation(this.kpuzzle.moveToTransformation(move));\n }\n\n applyAlg(alg: Alg | string): KPattern {\n return this.applyTransformation(this.kpuzzle.algToTransformation(alg));\n }\n\n isIdentical(other: KPattern): boolean {\n return isPatternDataIdentical(\n this.kpuzzle,\n this.patternData,\n other.patternData,\n );\n }\n\n /** @deprecated */\n experimentalToTransformation(): KTransformation | null {\n if (!this.kpuzzle.canConvertDefaultPatternToUniqueTransformation()) {\n return null;\n }\n const transformationData: KTransformationData = {};\n for (const [orbitName, patternOrbitData] of Object.entries(\n this.patternData,\n )) {\n const transformationOrbit: KTransformationOrbitData = {\n permutation: patternOrbitData.pieces,\n orientationDelta: patternOrbitData.orientation,\n };\n transformationData[orbitName] = transformationOrbit;\n }\n return new KTransformation(this.kpuzzle, transformationData);\n }\n\n experimentalIsSolved(options: {\n ignorePuzzleOrientation: boolean;\n // Note: `ignoreCenterOrientation` must currently be specified even if the puzzle does not have centers with indistinguishable orientations (in which case the value will be ignored).\n ignoreCenterOrientation: boolean;\n }): boolean {\n if (!this.kpuzzle.definition.experimentalIsPatternSolved) {\n throw new Error(\n \"`KPattern.experimentalIsPatternSolved()` is not supported for this puzzle at the moment.\",\n );\n }\n return this.kpuzzle.definition.experimentalIsPatternSolved(this, options);\n }\n}\n", "import { Alg, Move } from \"../alg\";\nimport type { PGNotation } from \"../puzzle-geometry/PuzzleGeometry\";\nimport { algToTransformation } from \"./calculate\";\nimport { moveToTransformationUncached } from \"./construct\";\nimport { KPattern } from \"./KPattern\";\nimport type { KPuzzleDefinition } from \"./KPuzzleDefinition\";\nimport type {\n KPuzzleOrbitDefinition,\n KTransformationData,\n} from \"./KPuzzleDefinitionJSON\";\nimport { KTransformation } from \"./KTransformation\";\n\nexport type KTransformationSource = Alg | Move | string | KTransformation;\n\nexport class KPuzzle {\n private experimentalPGNotation: PGNotation | undefined;\n constructor(\n public readonly definition: KPuzzleDefinition,\n options?: {\n experimentalPGNotation?: PGNotation;\n },\n ) {\n this.experimentalPGNotation = options?.experimentalPGNotation;\n }\n\n #indexedOrbits: Record<string, KPuzzleOrbitDefinition> | undefined;\n // Note: this function is needed much more rarely than you might think. Most\n // operations related to orbits require iterating through all of them, for\n // which the following is better:\n //\n // for (const orbitDefinition of kpuzzle.definition.orbits) { // \u2026\n // }\n lookupOrbitDefinition(orbitName: string): KPuzzleOrbitDefinition {\n this.#indexedOrbits ||= (() => {\n const indexedOrbits: Record<string, KPuzzleOrbitDefinition> = {};\n for (const orbitDefinition of this.definition.orbits) {\n indexedOrbits[orbitDefinition.orbitName] = orbitDefinition;\n }\n return indexedOrbits;\n })();\n return this.#indexedOrbits[orbitName];\n }\n\n name(): string {\n return this.definition.name; // TODO\n }\n\n identityTransformation(): KTransformation {\n return KTransformation.experimentalConstructIdentity(this);\n }\n\n #moveToTransformationDataCache = new Map<string, KTransformationData>();\n moveToTransformation(move: Move | string): KTransformation {\n if (typeof move === \"string\") {\n move = new Move(move);\n }\n const cacheKey = move.toString();\n const cachedTransformationData: KTransformationData | undefined =\n this.#moveToTransformationDataCache.get(cacheKey);\n if (cachedTransformationData) {\n return new KTransformation(this, cachedTransformationData);\n }\n\n if (this.experimentalPGNotation) {\n const transformationData = this.experimentalPGNotation.lookupMove(move);\n if (!transformationData) {\n throw new Error(`could not map to internal move: ${move}`);\n }\n this.#moveToTransformationDataCache.set(cacheKey, transformationData);\n return new KTransformation(this, transformationData);\n }\n\n const transformationData = moveToTransformationUncached(this, move);\n this.#moveToTransformationDataCache.set(cacheKey, transformationData);\n return new KTransformation(this, transformationData);\n }\n\n algToTransformation(alg: Alg | string): KTransformation {\n if (typeof alg === \"string\") {\n alg = new Alg(alg);\n }\n return algToTransformation(alg, this);\n }\n\n /** @deprecated */\n toTransformation(source: KTransformationSource): KTransformation {\n if (typeof source === \"string\") {\n return this.algToTransformation(source);\n } else if ((source as Alg | null)?.is?.(Alg)) {\n return this.algToTransformation(source as Alg);\n } else if ((source as Move | null)?.is?.(Move)) {\n return this.moveToTransformation(source as Move);\n } else {\n return source as KTransformation;\n }\n }\n\n defaultPattern(): KPattern {\n return new KPattern(this, this.definition.defaultPattern);\n }\n\n #cachedCanConvertDefaultPatternToUniqueTransformation: boolean | undefined;\n // TODO: Handle incomplete default pattern data\n canConvertDefaultPatternToUniqueTransformation(): boolean {\n return (this.#cachedCanConvertDefaultPatternToUniqueTransformation ??=\n ((): boolean => {\n for (const orbitDefinition of this.definition.orbits) {\n const pieces = new Array(orbitDefinition.numPieces).fill(false);\n for (const piece of this.definition.defaultPattern[\n orbitDefinition.orbitName\n ].pieces) {\n pieces[piece] = true;\n }\n for (const piece of pieces) {\n if (!piece) {\n return false;\n }\n }\n }\n return true;\n })());\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAQO,SAAS,0BACd,YACA,qBACA,qBACqB;AACrB,QAAM,wBAAwB,CAAC;AAC/B,aAAW,mBAAmB,WAAW,QAAQ;AAC/C,UAAM,SAAS,oBAAoB,gBAAgB,SAAS;AAC5D,UAAM,SAAS,oBAAoB,gBAAgB,SAAS;AAC5D,QACE;AAAA,MACE,gBAAgB;AAAA,MAChB;AAAA,IACF,GACA;AAEA,4BAAsB,gBAAgB,SAAS,IAAI;AAAA,IACrD,WACE;AAAA,MACE,gBAAgB;AAAA,MAChB;AAAA,IACF,GACA;AACA,4BAAsB,gBAAgB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|
29
29
|
}
|
|
30
30
|
// start: nep.start && nep.start.bind(nep),
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
parentPortAsNodeWorker.unref();
|
|
33
33
|
return constructedWorker;
|
|
34
34
|
}
|
|
35
35
|
var node_adapter_default = nodeEndpoint;
|
|
@@ -37,4 +37,4 @@ var node_adapter_default = nodeEndpoint;
|
|
|
37
37
|
export {
|
|
38
38
|
node_adapter_default
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-ZKJKRQKY.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cubing/vendor/apache/comlink-everywhere/node-adapter.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n MessagePort as NodeMessagePort,\n Worker as NodeWorker,\n} from \"node:worker_threads\";\n\n/**\n * Copyright 2019 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype EventHandler = EventListenerObject | ((event: any) => void);\n\nfunction nodeEndpoint(parentPort: NodeMessagePort | NodeWorker): Worker & {\n nodeWorker?: import(\"node:worker_threads\").Worker;\n} {\n const listeners = new WeakMap();\n const parentPortAsNodeWorker = parentPort as NodeWorker;\n const constructedWorker = {\n postMessage: parentPort.postMessage.bind(parentPort),\n addEventListener: (_: string, eh: EventHandler) => {\n const l = (data: Event) => {\n if (\"handleEvent\" in eh) {\n eh.handleEvent({ data } as any);\n } else {\n eh({ data });\n }\n };\n parentPort.on(\"message\", l);\n listeners.set(eh, l);\n },\n removeEventListener: (_: string, eh: EventHandler) => {\n const l = listeners.get(eh);\n if (!l) {\n return;\n }\n parentPort.off(\"message\", l);\n listeners.delete(eh);\n },\n nodeWorker: parentPortAsNodeWorker,\n terminate: () => {\n parentPortAsNodeWorker.terminate();\n },\n // start: nep.start && nep.start.bind(nep),\n } as Worker & {\n nodeWorker?: import(\"worker_threads\").Worker;\n };\n\n /** Unref the parent port to prevent `node` from hanging:\n *\n * - https://github.com/cubing/cubing.js/issues/358\n * - https://github.com/nodejs/node/issues/53036#issuecomment-2118106710\n */\n
|
|
5
|
-
"mappings": ";AAoBA,SAAS,aAAa,YAEpB;AACA,QAAM,YAAY,oBAAI,QAAQ;AAC9B,QAAM,yBAAyB;AAC/B,QAAM,oBAAoB;AAAA,IACxB,aAAa,WAAW,YAAY,KAAK,UAAU;AAAA,IACnD,kBAAkB,CAAC,GAAW,OAAqB;AACjD,YAAM,IAAI,CAAC,SAAgB;AACzB,YAAI,iBAAiB,IAAI;AACvB,aAAG,YAAY,EAAE,KAAK,CAAQ;AAAA,QAChC,OAAO;AACL,aAAG,EAAE,KAAK,CAAC;AAAA,QACb;AAAA,MACF;AACA,iBAAW,GAAG,WAAW,CAAC;AAC1B,gBAAU,IAAI,IAAI,CAAC;AAAA,IACrB;AAAA,IACA,qBAAqB,CAAC,GAAW,OAAqB;AACpD,YAAM,IAAI,UAAU,IAAI,EAAE;AAC1B,UAAI,CAAC,GAAG;AACN;AAAA,MACF;AACA,iBAAW,IAAI,WAAW,CAAC;AAC3B,gBAAU,OAAO,EAAE;AAAA,IACrB;AAAA,IACA,YAAY;AAAA,IACZ,WAAW,MAAM;AACf,6BAAuB,UAAU;AAAA,IACnC;AAAA;AAAA,EAEF;AASA,
|
|
4
|
+
"sourcesContent": ["import type {\n MessagePort as NodeMessagePort,\n Worker as NodeWorker,\n} from \"node:worker_threads\";\n\n/**\n * Copyright 2019 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype EventHandler = EventListenerObject | ((event: any) => void);\n\nfunction nodeEndpoint(parentPort: NodeMessagePort | NodeWorker): Worker & {\n nodeWorker?: import(\"node:worker_threads\").Worker;\n} {\n const listeners = new WeakMap();\n const parentPortAsNodeWorker = parentPort as NodeWorker;\n const constructedWorker = {\n postMessage: parentPort.postMessage.bind(parentPort),\n addEventListener: (_: string, eh: EventHandler) => {\n const l = (data: Event) => {\n if (\"handleEvent\" in eh) {\n eh.handleEvent({ data } as any);\n } else {\n eh({ data });\n }\n };\n parentPort.on(\"message\", l);\n listeners.set(eh, l);\n },\n removeEventListener: (_: string, eh: EventHandler) => {\n const l = listeners.get(eh);\n if (!l) {\n return;\n }\n parentPort.off(\"message\", l);\n listeners.delete(eh);\n },\n nodeWorker: parentPortAsNodeWorker,\n terminate: () => {\n parentPortAsNodeWorker.terminate();\n },\n // start: nep.start && nep.start.bind(nep),\n } as Worker & {\n nodeWorker?: import(\"worker_threads\").Worker;\n };\n\n /** Unref the parent port to prevent `node` from hanging:\n *\n * - https://github.com/cubing/cubing.js/issues/358\n * - https://github.com/nodejs/node/issues/53036#issuecomment-2118106710\n */\n parentPortAsNodeWorker.unref();\n\n return constructedWorker;\n}\n\nexport default nodeEndpoint;\n//# sourceMappingURL=node-adapter.mjs.map\n"],
|
|
5
|
+
"mappings": ";AAoBA,SAAS,aAAa,YAEpB;AACA,QAAM,YAAY,oBAAI,QAAQ;AAC9B,QAAM,yBAAyB;AAC/B,QAAM,oBAAoB;AAAA,IACxB,aAAa,WAAW,YAAY,KAAK,UAAU;AAAA,IACnD,kBAAkB,CAAC,GAAW,OAAqB;AACjD,YAAM,IAAI,CAAC,SAAgB;AACzB,YAAI,iBAAiB,IAAI;AACvB,aAAG,YAAY,EAAE,KAAK,CAAQ;AAAA,QAChC,OAAO;AACL,aAAG,EAAE,KAAK,CAAC;AAAA,QACb;AAAA,MACF;AACA,iBAAW,GAAG,WAAW,CAAC;AAC1B,gBAAU,IAAI,IAAI,CAAC;AAAA,IACrB;AAAA,IACA,qBAAqB,CAAC,GAAW,OAAqB;AACpD,YAAM,IAAI,UAAU,IAAI,EAAE;AAC1B,UAAI,CAAC,GAAG;AACN;AAAA,MACF;AACA,iBAAW,IAAI,WAAW,CAAC;AAC3B,gBAAU,OAAO,EAAE;AAAA,IACrB;AAAA,IACA,YAAY;AAAA,IACZ,WAAW,MAAM;AACf,6BAAuB,UAAU;AAAA,IACnC;AAAA;AAAA,EAEF;AASA,yBAAuB,MAAM;AAE7B,SAAO;AACT;AAEA,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
expose
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T3SF7NHB.js";
|
|
4
4
|
import {
|
|
5
5
|
countMoves
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I5QO52OG.js";
|
|
7
7
|
import {
|
|
8
8
|
addOrientationSuffix,
|
|
9
9
|
initialize333,
|
|
@@ -12,19 +12,19 @@ import {
|
|
|
12
12
|
random333Scramble,
|
|
13
13
|
setIsInsideWorker,
|
|
14
14
|
solve333
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-UMNYMJKD.js";
|
|
16
|
+
import "./chunk-ZKJKRQKY.js";
|
|
17
17
|
import {
|
|
18
18
|
cube2x2x2,
|
|
19
19
|
puzzles
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-UZ7SWKN6.js";
|
|
21
21
|
import {
|
|
22
22
|
from
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ST4K23C3.js";
|
|
24
24
|
import {
|
|
25
25
|
KPattern,
|
|
26
26
|
KPuzzle
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-WAYEJXCG.js";
|
|
28
28
|
import {
|
|
29
29
|
Alg,
|
|
30
30
|
AlgBuilder,
|
|
@@ -183,7 +183,7 @@ async function wasmDeriveScrambleForEvent(derivationSeedHex, derivationSaltHiera
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
// src/cubing/search/inside/solve/puzzles/dynamic/sgs-side-events/index.ts
|
|
186
|
-
var searchDynamicSideEvents = from(() => import("./search-dynamic-sgs-side-events-
|
|
186
|
+
var searchDynamicSideEvents = from(() => import("./search-dynamic-sgs-side-events-RIRYKEP5.js"));
|
|
187
187
|
|
|
188
188
|
// src/cubing/search/inside/solve/puzzles/2x2x2.ts
|
|
189
189
|
var cachedTrembleSolver = null;
|
|
@@ -208,7 +208,7 @@ async function solve222(pattern) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
// src/cubing/search/inside/solve/puzzles/dynamic/4x4x4/index.ts
|
|
211
|
-
var dynamic4x4x4Solver = from(() => import("./search-dynamic-solve-4x4x4-
|
|
211
|
+
var dynamic4x4x4Solver = from(() => import("./search-dynamic-solve-4x4x4-4UB4NMF3.js"));
|
|
212
212
|
|
|
213
213
|
// src/cubing/search/inside/solve/puzzles/4x4x4.ts
|
|
214
214
|
var randomSuffixes = [
|
|
@@ -232,7 +232,7 @@ var dynamicFTO = from(
|
|
|
232
232
|
);
|
|
233
233
|
|
|
234
234
|
// src/cubing/search/inside/solve/puzzles/fto.ts
|
|
235
|
-
var dynamic = from(() => import("./search-dynamic-sgs-unofficial-
|
|
235
|
+
var dynamic = from(() => import("./search-dynamic-sgs-unofficial-N4CRUF4Q.js"));
|
|
236
236
|
async function randomFTOScramble() {
|
|
237
237
|
mustBeInsideWorker();
|
|
238
238
|
return new Alg(await (await dynamicFTO).getRandomFTOScramble());
|
|
@@ -312,7 +312,7 @@ async function solvePyraminx(pattern) {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
// src/cubing/search/inside/solve/puzzles/dynamic/sgs-unofficial/index.ts
|
|
315
|
-
var searchDynamicUnofficial = from(() => import("./search-dynamic-sgs-unofficial-
|
|
315
|
+
var searchDynamicUnofficial = from(() => import("./search-dynamic-sgs-unofficial-N4CRUF4Q.js"));
|
|
316
316
|
|
|
317
317
|
// src/cubing/search/inside/solve/puzzles/redi_cube.ts
|
|
318
318
|
async function randomRediCubeScramble() {
|
|
@@ -569,4 +569,4 @@ var insideAPI = {
|
|
|
569
569
|
|
|
570
570
|
// src/cubing/search/inside/index.ts
|
|
571
571
|
expose(insideAPI);
|
|
572
|
-
//# sourceMappingURL=inside-
|
|
572
|
+
//# sourceMappingURL=inside-K3VX2AIZ.js.map
|