cubing 0.61.2 → 0.62.0

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 (96) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/chunks/{chunk-BIRBVHTR.js → chunk-STSENBFQ.js} +2 -2
  3. package/dist/bin/order.js +1 -1
  4. package/dist/bin/order.js.map +1 -1
  5. package/dist/bin/puzzle-geometry-bin.js +1 -1
  6. package/dist/bin/puzzle-geometry-bin.js.map +1 -1
  7. package/dist/bin/scramble.js +1 -1
  8. package/dist/bin/scramble.js.map +1 -1
  9. package/dist/lib/cubing/{PuzzleLoader-CkghxdIL.d.ts → PuzzleLoader-B2JfN7uX.d.ts} +7 -7
  10. package/dist/lib/cubing/alg/index.d.ts +2 -2
  11. package/dist/lib/cubing/alg/index.js +1 -1
  12. package/dist/lib/cubing/bluetooth/index.d.ts +23 -4
  13. package/dist/lib/cubing/bluetooth/index.js +13 -10
  14. package/dist/lib/cubing/bluetooth/index.js.map +2 -2
  15. package/dist/lib/cubing/chunks/{big-puzzle-orientation-3GQ3L26S.js → big-puzzle-orientation-ZVZQJEF5.js} +2 -2
  16. package/dist/lib/cubing/chunks/{chunk-T3SF7NHB.js → chunk-2AUSVPAU.js} +3 -3
  17. package/dist/lib/cubing/chunks/{chunk-T3SF7NHB.js.map → chunk-2AUSVPAU.js.map} +2 -2
  18. package/dist/lib/cubing/chunks/{chunk-ZGT5MZSV.js → chunk-5F7JRCTP.js} +5 -5
  19. package/dist/lib/cubing/chunks/{chunk-FKKRSXUI.js → chunk-E3YLQC45.js} +2 -2
  20. package/dist/lib/cubing/chunks/chunk-E3YLQC45.js.map +7 -0
  21. package/dist/lib/cubing/chunks/{chunk-MZKROP74.js → chunk-FLK6AZKB.js} +4 -4
  22. package/dist/lib/cubing/chunks/{chunk-MZKROP74.js.map → chunk-FLK6AZKB.js.map} +1 -1
  23. package/dist/lib/cubing/chunks/{chunk-QSGI7DXX.js → chunk-FUHYAW74.js} +4 -4
  24. package/dist/lib/cubing/chunks/{chunk-QSGI7DXX.js.map → chunk-FUHYAW74.js.map} +1 -1
  25. package/dist/lib/cubing/chunks/{chunk-IHFKNNCV.js → chunk-LIVDX4MD.js} +79 -35
  26. package/dist/lib/cubing/chunks/chunk-LIVDX4MD.js.map +7 -0
  27. package/dist/lib/cubing/chunks/{chunk-3PS5LIPR.js → chunk-LWCBAAHO.js} +15 -9
  28. package/dist/lib/cubing/chunks/{chunk-3PS5LIPR.js.map → chunk-LWCBAAHO.js.map} +2 -2
  29. package/dist/lib/cubing/chunks/{chunk-WI337PMF.js → chunk-NGW52SHR.js} +3 -3
  30. package/dist/lib/cubing/chunks/{chunk-7D7ZUWUK.js → chunk-O6HEZXGY.js} +1 -1
  31. package/dist/lib/cubing/chunks/chunk-O6HEZXGY.js.map +7 -0
  32. package/dist/lib/cubing/chunks/{chunk-WAYEJXCG.js → chunk-RINY3U6G.js} +2 -2
  33. package/dist/lib/cubing/chunks/{chunk-AVOUJS6N.js → chunk-ROB5TROI.js} +2 -2
  34. package/dist/lib/cubing/chunks/{chunk-ZKJKRQKY.js → chunk-XO3JAA3V.js} +1 -2
  35. package/dist/lib/cubing/chunks/chunk-XO3JAA3V.js.map +7 -0
  36. package/dist/lib/cubing/chunks/{chunk-LCJT5ROJ.js → chunk-ZU7PSGX4.js} +3 -3
  37. package/dist/lib/cubing/chunks/chunk-ZU7PSGX4.js.map +7 -0
  38. package/dist/lib/cubing/chunks/{inside-UAY7NCJR.js → inside-TJAQBDDY.js} +16 -16
  39. package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-E5KVBK2Y.js → search-dynamic-sgs-side-events-GB4WAJ7I.js} +6 -6
  40. package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-IFHNOIEL.js → search-dynamic-sgs-unofficial-2CECFBP3.js} +6 -6
  41. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-QVAXVZBA.js → search-dynamic-solve-4x4x4-NRWKTCNT.js} +8 -8
  42. package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-HZREG6ZH.js → search-dynamic-solve-fto-UZMNOI6U.js} +2 -2
  43. package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-GCNVEBDJ.js → search-dynamic-solve-kilominx-CD57C3C4.js} +2 -2
  44. package/dist/lib/cubing/chunks/search-worker-entry.js +5 -7
  45. package/dist/lib/cubing/chunks/search-worker-entry.js.map +2 -2
  46. package/dist/lib/cubing/chunks/{twips-UDB2NAAU.js → twips-YHXBF55O.js} +33 -33
  47. package/dist/lib/cubing/chunks/{twips-UDB2NAAU.js.map → twips-YHXBF55O.js.map} +3 -3
  48. package/dist/lib/cubing/chunks/twips_wasm_bg-RWVQBVBA-5YCKA6O5.js +10 -0
  49. package/dist/lib/cubing/chunks/twips_wasm_bg-RWVQBVBA-5YCKA6O5.js.map +7 -0
  50. package/dist/lib/cubing/chunks/{twisty-dynamic-3d-O6UL3R7C.js → twisty-dynamic-3d-IKE4BUQG.js} +9 -9
  51. package/dist/lib/cubing/chunks/twisty-dynamic-3d-IKE4BUQG.js.map +7 -0
  52. package/dist/lib/cubing/events-BDkOaqlG.d.ts +35 -0
  53. package/dist/lib/cubing/{index-B_8W-2zR.d.ts → index-DWA95mSl.d.ts} +1 -1
  54. package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
  55. package/dist/lib/cubing/kpuzzle/index.js +2 -2
  56. package/dist/lib/cubing/notation/index.d.ts +1 -1
  57. package/dist/lib/cubing/notation/index.js +4 -4
  58. package/dist/lib/cubing/protocol/index.d.ts +1 -1
  59. package/dist/lib/cubing/protocol/index.js +4 -4
  60. package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
  61. package/dist/lib/cubing/puzzle-geometry/index.js +1 -1
  62. package/dist/lib/cubing/puzzle-geometry/index.js.map +1 -1
  63. package/dist/lib/cubing/puzzles/index.d.ts +1 -1
  64. package/dist/lib/cubing/puzzles/index.js +4 -4
  65. package/dist/lib/cubing/scramble/index.d.ts +2 -2
  66. package/dist/lib/cubing/scramble/index.js +7 -7
  67. package/dist/lib/cubing/search/index.d.ts +3 -3
  68. package/dist/lib/cubing/search/index.js +7 -7
  69. package/dist/lib/cubing/stream/index.d.ts +4 -16
  70. package/dist/lib/cubing/stream/index.js +1 -1
  71. package/dist/lib/cubing/stream/index.js.map +2 -2
  72. package/dist/lib/cubing/twisty/index.d.ts +2 -2
  73. package/dist/lib/cubing/twisty/index.js +70 -62
  74. package/dist/lib/cubing/twisty/index.js.map +2 -2
  75. package/package.json +3 -3
  76. package/dist/lib/cubing/bluetooth-puzzle-c-_IBAdu.d.ts +0 -43
  77. package/dist/lib/cubing/chunks/chunk-7D7ZUWUK.js.map +0 -7
  78. package/dist/lib/cubing/chunks/chunk-FKKRSXUI.js.map +0 -7
  79. package/dist/lib/cubing/chunks/chunk-IHFKNNCV.js.map +0 -7
  80. package/dist/lib/cubing/chunks/chunk-LCJT5ROJ.js.map +0 -7
  81. package/dist/lib/cubing/chunks/chunk-ZKJKRQKY.js.map +0 -7
  82. package/dist/lib/cubing/chunks/twips_wasm_bg-TPXD7W4R-2BXON3G5.js +0 -10
  83. package/dist/lib/cubing/chunks/twips_wasm_bg-TPXD7W4R-2BXON3G5.js.map +0 -7
  84. package/dist/lib/cubing/chunks/twisty-dynamic-3d-O6UL3R7C.js.map +0 -7
  85. /package/dist/bin/chunks/{chunk-BIRBVHTR.js.map → chunk-STSENBFQ.js.map} +0 -0
  86. /package/dist/lib/cubing/chunks/{big-puzzle-orientation-3GQ3L26S.js.map → big-puzzle-orientation-ZVZQJEF5.js.map} +0 -0
  87. /package/dist/lib/cubing/chunks/{chunk-ZGT5MZSV.js.map → chunk-5F7JRCTP.js.map} +0 -0
  88. /package/dist/lib/cubing/chunks/{chunk-WI337PMF.js.map → chunk-NGW52SHR.js.map} +0 -0
  89. /package/dist/lib/cubing/chunks/{chunk-WAYEJXCG.js.map → chunk-RINY3U6G.js.map} +0 -0
  90. /package/dist/lib/cubing/chunks/{chunk-AVOUJS6N.js.map → chunk-ROB5TROI.js.map} +0 -0
  91. /package/dist/lib/cubing/chunks/{inside-UAY7NCJR.js.map → inside-TJAQBDDY.js.map} +0 -0
  92. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-E5KVBK2Y.js.map → search-dynamic-sgs-side-events-GB4WAJ7I.js.map} +0 -0
  93. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-IFHNOIEL.js.map → search-dynamic-sgs-unofficial-2CECFBP3.js.map} +0 -0
  94. /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-QVAXVZBA.js.map → search-dynamic-solve-4x4x4-NRWKTCNT.js.map} +0 -0
  95. /package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-HZREG6ZH.js.map → search-dynamic-solve-fto-UZMNOI6U.js.map} +0 -0
  96. /package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-GCNVEBDJ.js.map → search-dynamic-solve-kilominx-CD57C3C4.js.map} +0 -0
package/README.md CHANGED
@@ -66,7 +66,7 @@ make dev
66
66
  # Now visit http://cubing.localhost:3333
67
67
  ```
68
68
 
69
- To quickly check any changes for issues, try `make test-fast`. Run `make test` for more thorough testing options.
69
+ To quickly check any changes for issues, try `make check-fast`. Run `make check` to run all possible checks.
70
70
 
71
71
  ### Developing on Windows
72
72
 
@@ -5,10 +5,10 @@ import "path-class";
5
5
  var packageVersion = (
6
6
  // biome-ignore lint/suspicious/noTsIgnore: This comment is stil present in the compiled file, where an error is *not* expected.
7
7
  /** @ts-ignore Populated by `esbuild` at compile time. */
8
- "0.61.2"
8
+ "0.62.0"
9
9
  );
10
10
 
11
11
  export {
12
12
  packageVersion
13
13
  };
14
- //# sourceMappingURL=chunk-BIRBVHTR.js.map
14
+ //# sourceMappingURL=chunk-STSENBFQ.js.map
package/dist/bin/order.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env -S node --
2
2
  import {
3
3
  packageVersion
4
- } from "./chunks/chunk-BIRBVHTR.js";
4
+ } from "./chunks/chunk-STSENBFQ.js";
5
5
 
6
6
  // src/bin/order.ts
7
7
  import { argv } from "node:process";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/bin/order.ts"],
4
- "sourcesContent": ["/**\n\nTo run this file directly:\n\n```shell\nbun run ./src/bin/order.ts -- 3x3x3 \"R U R' U R U2' R'\"\n```\n\nTo test completions:\n\n```shell\n# fish (from repo root)\nset PATH (pwd)/src/test/bin-path $PATH\norder --completions fish | source\n```\n\n```shell\n# zsh (from repo root)\nautoload -Uz compinit\ncompinit\nexport PATH=$(pwd)/src/test/bin-path:$PATH\nsource <(order --completions zsh)\n```\n\n*/\n\nimport { argv } from \"node:process\";\nimport { argument, map, message, object, string } from \"@optique/core\";\nimport { run } from \"@optique/run\";\nimport { Alg } from \"cubing/alg\";\nimport { KPuzzle } from \"cubing/kpuzzle\";\nimport { getPuzzleGeometryByName } from \"cubing/puzzle-geometry\";\nimport { puzzles } from \"cubing/puzzles\";\nimport { Path } from \"path-class\";\nimport { packageVersion } from \"../metadata/packageVersion\";\n\nconst args = run(\n object({\n puzzleGeometryID: argument(string({ metavar: \"PUZZLE\" }), {\n description: message`Puzzle geometry ID`,\n }),\n alg: map(\n argument(string({ metavar: \"ALG\" }), {\n description: message`Alg`,\n }),\n Alg.fromString,\n ),\n }),\n {\n programName: new Path(argv[1]).basename.path,\n description: message`Example: order 3x3x3 \"R U R' U R U2' R'\"`,\n help: \"option\",\n completion: {\n mode: \"option\",\n name: \"plural\",\n },\n version: {\n mode: \"option\",\n value: packageVersion,\n },\n },\n);\n\nconst { puzzleGeometryID, alg } = args;\n\n/*\n * Turn a name into a geometry.\n */\nconst puzzleLoader = puzzles[puzzleGeometryID];\nconst kpuzzle = await (async () => {\n if (puzzleLoader) {\n return await puzzles[puzzleGeometryID].kpuzzle();\n } else {\n const pg = getPuzzleGeometryByName(puzzleGeometryID, {\n allMoves: true,\n });\n return new KPuzzle(pg.getKPuzzleDefinition(true));\n }\n})();\n\nconst order = kpuzzle.algToTransformation(alg).repetitionOrder();\nconsole.log(order);\n"],
4
+ "sourcesContent": ["/**\n\nTo run this file directly:\n\n```shell\nbun run -- ./src/bin/order.ts 3x3x3 \"R U R' U R U2' R'\"\n```\n\nTo test completions:\n\n```shell\n# fish (from repo root)\nset PATH (pwd)/src/test/bin-path $PATH\norder --completions fish | source\n```\n\n```shell\n# zsh (from repo root)\nautoload -Uz compinit\ncompinit\nexport PATH=$(pwd)/src/test/bin-path:$PATH\nsource <(order --completions zsh)\n```\n\n*/\n\nimport { argv } from \"node:process\";\nimport { argument, map, message, object, string } from \"@optique/core\";\nimport { run } from \"@optique/run\";\nimport { Alg } from \"cubing/alg\";\nimport { KPuzzle } from \"cubing/kpuzzle\";\nimport { getPuzzleGeometryByName } from \"cubing/puzzle-geometry\";\nimport { puzzles } from \"cubing/puzzles\";\nimport { Path } from \"path-class\";\nimport { packageVersion } from \"../metadata/packageVersion\";\n\nconst args = run(\n object({\n puzzleGeometryID: argument(string({ metavar: \"PUZZLE\" }), {\n description: message`Puzzle geometry ID`,\n }),\n alg: map(\n argument(string({ metavar: \"ALG\" }), {\n description: message`Alg`,\n }),\n Alg.fromString,\n ),\n }),\n {\n programName: new Path(argv[1]).basename.path,\n description: message`Example: order 3x3x3 \"R U R' U R U2' R'\"`,\n help: \"option\",\n completion: {\n mode: \"option\",\n name: \"plural\",\n },\n version: {\n mode: \"option\",\n value: packageVersion,\n },\n },\n);\n\nconst { puzzleGeometryID, alg } = args;\n\n/*\n * Turn a name into a geometry.\n */\nconst puzzleLoader = puzzles[puzzleGeometryID];\nconst kpuzzle = await (async () => {\n if (puzzleLoader) {\n return await puzzles[puzzleGeometryID].kpuzzle();\n } else {\n const pg = getPuzzleGeometryByName(puzzleGeometryID, {\n allMoves: true,\n });\n return new KPuzzle(pg.getKPuzzleDefinition(true));\n }\n})();\n\nconst order = kpuzzle.algToTransformation(alg).repetitionOrder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packageVersion
4
- } from "./chunks/chunk-BIRBVHTR.js";
4
+ } from "./chunks/chunk-STSENBFQ.js";
5
5
 
6
6
  // src/bin/puzzle-geometry-bin.ts
7
7
  import { argv } from "node:process";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/bin/puzzle-geometry-bin.ts"],
4
- "sourcesContent": ["/**\n\nTo run this file directly:\n\n```shell\nbun run ./src/bin/puzzle-geometry-bin.ts -- <program args>\n```\n\nTo test completions:\n\n```shell\n# fish (from repo root)\nset PATH (pwd)/src/test/bin-path $PATH\npuzzle-geometry --completions fish | source\n```\n\n```shell\n# zsh (from repo root)\nautoload -Uz compinit\ncompinit\nexport PATH=$(pwd)/src/test/bin-path:$PATH\nsource <(puzzle-geometry --completions zsh)\n```\n\n*/\n\nimport { argv } from \"node:process\";\nimport {\n argument,\n constant,\n flag,\n integer,\n type Message,\n map,\n merge,\n message,\n multiple,\n type OptionName,\n object,\n option,\n optional,\n or,\n string,\n} from \"@optique/core\";\nimport { run } from \"@optique/run\";\nimport { Move } from \"cubing/alg\";\nimport {\n type ExperimentalPuzzleGeometryOptions,\n getPG3DNamedPuzzles,\n PuzzleGeometry,\n parsePuzzleDescription,\n} from \"cubing/puzzle-geometry\";\nimport { Path } from \"path-class\";\nimport { PrintableShellCommand } from \"printable-shell-command\";\nimport { packageVersion } from \"../metadata/packageVersion\";\n\nconst puzzleList = getPG3DNamedPuzzles();\n\n// TODO: make this a `ValueParser`?\nfunction antiBool(optionName: OptionName, description: Message) {\n return optional(\n map(\n flag(optionName, {\n description,\n }),\n (v) => !v,\n ),\n );\n}\n\n// Include using `...subcommandDefaults` at the *beginning* of a subcommand `object({ \u2026 })`.\nconst subcommandDefaults = {\n commentStyle: constant(\"hash\"),\n forceQuiet: constant(undefined),\n} as const;\n\nconst args = run(\n merge(\n object({\n verbosity: optional(\n or(\n map(multiple(flag(\"--verbose\", \"-v\")), (v) => v.length),\n map(flag(\"--quiet\", \"-q\"), () => 0),\n ),\n ),\n }),\n or(\n object({\n ...subcommandDefaults,\n subcommand: constant(\"KSolve\"),\n subcommandFlag: flag(\"--ksolve\", {\n description: message`Print KSolve (\\`.tws\\`).`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"SVG\"),\n subcommandFlag: flag(\"--svg\", {\n description: message`Print SVG. Forces \\`--quiet\\`.`,\n }),\n commentStyle: constant(\"none\"),\n svg3D: optional(\n option(\"--3d\", {\n description: message`Use 3D format for SVG file.`,\n }),\n ),\n verbosity: constant(0),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"GAP\"),\n subcommandFlag: flag(\"--gap\", {\n description: message`Print GAP output.`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"Mathematica\"),\n subcommandFlag: flag(\"--mathematica\", {\n description: message`Print Mathematica output.`,\n }),\n commentStyle: constant(\"Pascal\"),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"Schreier-Sims\"),\n subcommandFlag: flag(\"--ss\", {\n description: message`Perform Schrier-Sims calculation.`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"Canonical string analysis\"),\n subcommandFlag: flag(\"--canon\", {\n description: message`Print canonical string analysis.`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"3D\"),\n subcommandFlag: flag(\"--3d\", {\n description: message`Print 3D information.`,\n }),\n }),\n ),\n object({\n // This doesn't apply to SVG, but we place it here so that it doesn't print once for each non-SVG subcommand in the help string.\n optimizeOrbits: option(\"--optimize\", {\n description: message`Optimize output (when possible).`,\n }),\n addRotations: option(\"--rotations\", {\n description: message`Include full-puzzle rotations as moves.`,\n }),\n allMoves: option(\"--allmoves\", {\n description: message`Includes all moves (i.e., slice moves for 3x3x3).`,\n }),\n outerBlockMoves: option(\"--outerblockmoves\", {\n description: message`Use outer block moves rather than slice moves.`,\n }),\n vertexMoves: option(\"--vertexmoves\", {\n description: message`For tetrahedral puzzles, prefer vertex moves to face moves.`,\n }),\n includeCornerOrbits: antiBool(\n \"--nocorners\",\n message`Ignore all corners.`,\n ),\n excludeOrbits: optional(\n map(\n option(\"--omit\", string({ metavar: \"COMMA_SEPARATED_ORBITS\" }), {\n description: message`Omit orbits.`,\n }),\n (s) => s.split(\",\"),\n ),\n ),\n includeEdgeOrbits: antiBool(\"--noedges\", message`Ignore all edges.`),\n includeCenterOrbits: antiBool(\n \"--nocenters\",\n message`Ignore all centers.`,\n ),\n grayCorners: option(\"--graycorners\", {\n description: message`Gray corners.`,\n }),\n grayEdges: option(\"--grayedges\", { description: message`Gray edges.` }),\n grayCenters: option(\"--graycenters\", {\n description: message`Gray centers.`,\n }),\n fixedOrientation: option(\"--noorientation\", {\n description: message`Ignore orientations.`,\n }),\n orientCenters: option(\"--orientcenters\", {\n description: message`Give centers an orientation.`,\n }),\n }),\n optional(\n or(\n object({\n puzzleOrientation: optional(\n map(\n option(\n \"--puzzleorientation\",\n string({ metavar: \"JSON_STRING\" }),\n {\n description: message`For 3D formats, give puzzle orientation.`,\n },\n ),\n (s) => JSON.parse(s),\n ),\n ),\n puzzleOrientations: constant(undefined),\n }),\n object({\n puzzleOrientation: constant(undefined),\n puzzleOrientations: optional(\n map(\n option(\n \"--puzzleorientations\",\n string({ metavar: \"JSON_STRING\" }),\n {\n description: message`For 3D formats, give puzzle orientations.`,\n },\n ),\n (s) => JSON.parse(s),\n ),\n ),\n }),\n ),\n ),\n object({\n fixedPieceType: optional(\n or(\n map(\n flag(\"--fixcorner\", {\n description: message`Auto-select a subset of moves to keep a corner fixed in place.`,\n }),\n () => \"v\" as const,\n ),\n map(\n flag(\"--fixedge\", {\n description: message`Auto-select a subset of moves to keep an edge fixed in place.`,\n }),\n () => \"e\" as const,\n ),\n map(\n flag(\"--fixcenter\", {\n description: message`Auto-select a subset of moves to keep a center fixed in place.`,\n }),\n () => \"f\" as const,\n ),\n ),\n ),\n // TODO: this doesn't make sense for all subcommands?\n scrambleAmount: optional(\n option(\"--scramble\", integer({ min: 0 }), {\n description: message`Scramble solved position.`,\n }),\n ),\n moveList: optional(\n map(\n option(\"--moves\", string({ metavar: \"COMMA_SEPARATED_MOVES\" }), {\n description: message`Restrict moves to this list. Example: \\\"U2,F,r\\\").`,\n }),\n (s) => s.split(\",\").map((m) => Move.fromString(m)),\n ),\n ),\n puzzle: map(\n argument(string({ metavar: \"PUZZLE\" }), {\n description: message`The puzzle can be given as a geometric description or by name.\nThe geometric description starts with one of:\n\n- \\`c\\` (cube),\\n\n- \\`t\\` (tetrahedron),\\n\n- \\`d\\` (dodecahedron),\\n\n- \\`i\\` (icosahedron),\\n\n- \\`o\\` (octahedron),\\n\n\nthen a space, then a series of cuts. Each cut begins with one of:\n\n- \\`f\\` (for a cut parallel to faces),\\n\n- \\`v\\` (for a cut perpendicular to a ray from the center through a corner),\\n\n- \\`e\\` (for a cut perpendicular to a ray from the center through an edge),\\n\n\nfollowed by a decimal number giving a distance, where 1 is the distance\nbetween the center of the puzzle and the center of a face.\n\nExample description: \\`c f 0 v 0.577350269189626 e 0\\`. Corresponds to: https://alpha.twizzle.net/explore/?puzzle=2x2x2+%2B+dino+%2B+little+chop\n\nThe recognized puzzle names are: ${Object.keys(puzzleList)\n .map((p) => JSON.stringify(p))\n .join(\", \")}`,\n }),\n (s) => {\n const parsed = parsePuzzleDescription(puzzleList[s] ?? s);\n if (parsed === null) {\n throw new Error(\"Could not parse puzzle description!\");\n }\n return parsed;\n },\n ),\n }),\n ),\n {\n programName: new Path(argv[1]).basename.path,\n description: message`\nExamples:\n\n puzzle-geometry --ss 2x2x2\\n\n puzzle-geometry --ss --fixcorner 2x2x2\\n\n puzzle-geometry --ss --moves U,F2,r 4x4x4\\n\n puzzle-geometry --ksolve --optimize --moves U,F,R megaminx\\n\n puzzle-geometry --gap --noedges megaminx\n`,\n help: \"option\",\n completion: {\n mode: \"option\",\n name: \"plural\",\n },\n version: {\n mode: \"option\",\n value: packageVersion,\n },\n },\n);\n\nif (args.verbosity !== 0) {\n const cmd = () => {\n const [command, ...args] = argv;\n return new PrintableShellCommand(command, args).getPrintableCommand({\n argumentLineWrapping: \"inline\",\n });\n };\n\n switch (args.commentStyle) {\n case \"hash\": {\n console.log(`# ${cmd()}`);\n break;\n }\n case \"none\": {\n break;\n }\n case \"Pascal\": {\n console.log(`(* ${cmd()} *)`);\n break;\n }\n default:\n throw new Error(\"Invalid comment style.\") as never;\n }\n}\n\nfunction buildPuzzleGeometry(): PuzzleGeometry {\n const {\n verbosity,\n optimizeOrbits,\n addRotations,\n allMoves,\n outerBlockMoves,\n vertexMoves,\n includeCornerOrbits,\n includeCenterOrbits,\n includeEdgeOrbits,\n excludeOrbits,\n grayCorners,\n grayEdges,\n grayCenters,\n fixedOrientation,\n orientCenters,\n puzzleOrientation,\n puzzleOrientations,\n fixedPieceType,\n scrambleAmount,\n moveList,\n } = args;\n const options: ExperimentalPuzzleGeometryOptions = {\n verbosity,\n optimizeOrbits,\n addRotations,\n allMoves,\n outerBlockMoves,\n vertexMoves,\n includeCornerOrbits,\n includeCenterOrbits,\n includeEdgeOrbits,\n excludeOrbits,\n grayCorners,\n grayEdges,\n grayCenters,\n fixedOrientation,\n orientCenters,\n puzzleOrientation,\n puzzleOrientations,\n fixedPieceType,\n scrambleAmount,\n moveList,\n };\n\n const puzzleGeometry = new PuzzleGeometry(args.puzzle, options);\n // TODO: why are these calls needed?\n puzzleGeometry.allstickers();\n puzzleGeometry.genperms();\n return puzzleGeometry;\n}\n\nswitch (args.subcommand) {\n case \"KSolve\": {\n console.log(buildPuzzleGeometry().writeksolve());\n break;\n }\n case \"SVG\": {\n console.log(\n buildPuzzleGeometry().generatesvg(\n undefined,\n undefined,\n undefined,\n args.svg3D,\n ),\n );\n break;\n }\n case \"GAP\": {\n console.log(buildPuzzleGeometry().writegap());\n break;\n }\n case \"Mathematica\": {\n console.log(buildPuzzleGeometry().writemathematica());\n break;\n }\n case \"Schreier-Sims\": {\n buildPuzzleGeometry().writeSchreierSims(console.log);\n break;\n }\n case \"Canonical string analysis\": {\n buildPuzzleGeometry().showcanon(console.log);\n break;\n }\n case \"3D\": {\n console.log(JSON.stringify(buildPuzzleGeometry().get3d(), null, \" \"));\n break;\n }\n default:\n throw new Error(\"Invalid subcommand.\") as never;\n}\n"],
4
+ "sourcesContent": ["/**\n\nTo run this file directly:\n\n```shell\nbun run -- ./src/bin/puzzle-geometry-bin.ts <program args>\n```\n\nTo test completions:\n\n```shell\n# fish (from repo root)\nset PATH (pwd)/src/test/bin-path $PATH\npuzzle-geometry --completions fish | source\n```\n\n```shell\n# zsh (from repo root)\nautoload -Uz compinit\ncompinit\nexport PATH=$(pwd)/src/test/bin-path:$PATH\nsource <(puzzle-geometry --completions zsh)\n```\n\n*/\n\nimport { argv } from \"node:process\";\nimport {\n argument,\n constant,\n flag,\n integer,\n type Message,\n map,\n merge,\n message,\n multiple,\n type OptionName,\n object,\n option,\n optional,\n or,\n string,\n} from \"@optique/core\";\nimport { run } from \"@optique/run\";\nimport { Move } from \"cubing/alg\";\nimport {\n type ExperimentalPuzzleGeometryOptions,\n getPG3DNamedPuzzles,\n PuzzleGeometry,\n parsePuzzleDescription,\n} from \"cubing/puzzle-geometry\";\nimport { Path } from \"path-class\";\nimport { PrintableShellCommand } from \"printable-shell-command\";\nimport { packageVersion } from \"../metadata/packageVersion\";\n\nconst puzzleList = getPG3DNamedPuzzles();\n\n// TODO: make this a `ValueParser`?\nfunction antiBool(optionName: OptionName, description: Message) {\n return optional(\n map(\n flag(optionName, {\n description,\n }),\n (v) => !v,\n ),\n );\n}\n\n// Include using `...subcommandDefaults` at the *beginning* of a subcommand `object({ \u2026 })`.\nconst subcommandDefaults = {\n commentStyle: constant(\"hash\"),\n forceQuiet: constant(undefined),\n} as const;\n\nconst args = run(\n merge(\n object({\n verbosity: optional(\n or(\n map(multiple(flag(\"--verbose\", \"-v\")), (v) => v.length),\n map(flag(\"--quiet\", \"-q\"), () => 0),\n ),\n ),\n }),\n or(\n object({\n ...subcommandDefaults,\n subcommand: constant(\"KSolve\"),\n subcommandFlag: flag(\"--ksolve\", {\n description: message`Print KSolve (\\`.tws\\`).`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"SVG\"),\n subcommandFlag: flag(\"--svg\", {\n description: message`Print SVG. Forces \\`--quiet\\`.`,\n }),\n commentStyle: constant(\"none\"),\n svg3D: optional(\n option(\"--3d\", {\n description: message`Use 3D format for SVG file.`,\n }),\n ),\n verbosity: constant(0),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"GAP\"),\n subcommandFlag: flag(\"--gap\", {\n description: message`Print GAP output.`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"Mathematica\"),\n subcommandFlag: flag(\"--mathematica\", {\n description: message`Print Mathematica output.`,\n }),\n commentStyle: constant(\"Pascal\"),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"Schreier-Sims\"),\n subcommandFlag: flag(\"--ss\", {\n description: message`Perform Schrier-Sims calculation.`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"Canonical string analysis\"),\n subcommandFlag: flag(\"--canon\", {\n description: message`Print canonical string analysis.`,\n }),\n }),\n object({\n ...subcommandDefaults,\n subcommand: constant(\"3D\"),\n subcommandFlag: flag(\"--3d\", {\n description: message`Print 3D information.`,\n }),\n }),\n ),\n object({\n // This doesn't apply to SVG, but we place it here so that it doesn't print once for each non-SVG subcommand in the help string.\n optimizeOrbits: option(\"--optimize\", {\n description: message`Optimize output (when possible).`,\n }),\n addRotations: option(\"--rotations\", {\n description: message`Include full-puzzle rotations as moves.`,\n }),\n allMoves: option(\"--allmoves\", {\n description: message`Includes all moves (i.e., slice moves for 3x3x3).`,\n }),\n outerBlockMoves: option(\"--outerblockmoves\", {\n description: message`Use outer block moves rather than slice moves.`,\n }),\n vertexMoves: option(\"--vertexmoves\", {\n description: message`For tetrahedral puzzles, prefer vertex moves to face moves.`,\n }),\n includeCornerOrbits: antiBool(\n \"--nocorners\",\n message`Ignore all corners.`,\n ),\n excludeOrbits: optional(\n map(\n option(\"--omit\", string({ metavar: \"COMMA_SEPARATED_ORBITS\" }), {\n description: message`Omit orbits.`,\n }),\n (s) => s.split(\",\"),\n ),\n ),\n includeEdgeOrbits: antiBool(\"--noedges\", message`Ignore all edges.`),\n includeCenterOrbits: antiBool(\n \"--nocenters\",\n message`Ignore all centers.`,\n ),\n grayCorners: option(\"--graycorners\", {\n description: message`Gray corners.`,\n }),\n grayEdges: option(\"--grayedges\", { description: message`Gray edges.` }),\n grayCenters: option(\"--graycenters\", {\n description: message`Gray centers.`,\n }),\n fixedOrientation: option(\"--noorientation\", {\n description: message`Ignore orientations.`,\n }),\n orientCenters: option(\"--orientcenters\", {\n description: message`Give centers an orientation.`,\n }),\n }),\n optional(\n or(\n object({\n puzzleOrientation: optional(\n map(\n option(\n \"--puzzleorientation\",\n string({ metavar: \"JSON_STRING\" }),\n {\n description: message`For 3D formats, give puzzle orientation.`,\n },\n ),\n (s) => JSON.parse(s),\n ),\n ),\n puzzleOrientations: constant(undefined),\n }),\n object({\n puzzleOrientation: constant(undefined),\n puzzleOrientations: optional(\n map(\n option(\n \"--puzzleorientations\",\n string({ metavar: \"JSON_STRING\" }),\n {\n description: message`For 3D formats, give puzzle orientations.`,\n },\n ),\n (s) => JSON.parse(s),\n ),\n ),\n }),\n ),\n ),\n object({\n fixedPieceType: optional(\n or(\n map(\n flag(\"--fixcorner\", {\n description: message`Auto-select a subset of moves to keep a corner fixed in place.`,\n }),\n () => \"v\" as const,\n ),\n map(\n flag(\"--fixedge\", {\n description: message`Auto-select a subset of moves to keep an edge fixed in place.`,\n }),\n () => \"e\" as const,\n ),\n map(\n flag(\"--fixcenter\", {\n description: message`Auto-select a subset of moves to keep a center fixed in place.`,\n }),\n () => \"f\" as const,\n ),\n ),\n ),\n // TODO: this doesn't make sense for all subcommands?\n scrambleAmount: optional(\n option(\"--scramble\", integer({ min: 0 }), {\n description: message`Scramble solved position.`,\n }),\n ),\n moveList: optional(\n map(\n option(\"--moves\", string({ metavar: \"COMMA_SEPARATED_MOVES\" }), {\n description: message`Restrict moves to this list. Example: \\\"U2,F,r\\\").`,\n }),\n (s) => s.split(\",\").map((m) => Move.fromString(m)),\n ),\n ),\n puzzle: map(\n argument(string({ metavar: \"PUZZLE\" }), {\n description: message`The puzzle can be given as a geometric description or by name.\nThe geometric description starts with one of:\n\n- \\`c\\` (cube),\\n\n- \\`t\\` (tetrahedron),\\n\n- \\`d\\` (dodecahedron),\\n\n- \\`i\\` (icosahedron),\\n\n- \\`o\\` (octahedron),\\n\n\nthen a space, then a series of cuts. Each cut begins with one of:\n\n- \\`f\\` (for a cut parallel to faces),\\n\n- \\`v\\` (for a cut perpendicular to a ray from the center through a corner),\\n\n- \\`e\\` (for a cut perpendicular to a ray from the center through an edge),\\n\n\nfollowed by a decimal number giving a distance, where 1 is the distance\nbetween the center of the puzzle and the center of a face.\n\nExample description: \\`c f 0 v 0.577350269189626 e 0\\`. Corresponds to: https://alpha.twizzle.net/explore/?puzzle=2x2x2+%2B+dino+%2B+little+chop\n\nThe recognized puzzle names are: ${Object.keys(puzzleList)\n .map((p) => JSON.stringify(p))\n .join(\", \")}`,\n }),\n (s) => {\n const parsed = parsePuzzleDescription(puzzleList[s] ?? s);\n if (parsed === null) {\n throw new Error(\"Could not parse puzzle description!\");\n }\n return parsed;\n },\n ),\n }),\n ),\n {\n programName: new Path(argv[1]).basename.path,\n description: message`\nExamples:\n\n puzzle-geometry --ss 2x2x2\\n\n puzzle-geometry --ss --fixcorner 2x2x2\\n\n puzzle-geometry --ss --moves U,F2,r 4x4x4\\n\n puzzle-geometry --ksolve --optimize --moves U,F,R megaminx\\n\n puzzle-geometry --gap --noedges megaminx\n`,\n help: \"option\",\n completion: {\n mode: \"option\",\n name: \"plural\",\n },\n version: {\n mode: \"option\",\n value: packageVersion,\n },\n },\n);\n\nif (args.verbosity !== 0) {\n const cmd = () => {\n const [command, ...args] = argv;\n return new PrintableShellCommand(command, args).getPrintableCommand({\n argumentLineWrapping: \"inline\",\n });\n };\n\n switch (args.commentStyle) {\n case \"hash\": {\n console.log(`# ${cmd()}`);\n break;\n }\n case \"none\": {\n break;\n }\n case \"Pascal\": {\n console.log(`(* ${cmd()} *)`);\n break;\n }\n default:\n throw new Error(\"Invalid comment style.\") as never;\n }\n}\n\nfunction buildPuzzleGeometry(): PuzzleGeometry {\n const {\n verbosity,\n optimizeOrbits,\n addRotations,\n allMoves,\n outerBlockMoves,\n vertexMoves,\n includeCornerOrbits,\n includeCenterOrbits,\n includeEdgeOrbits,\n excludeOrbits,\n grayCorners,\n grayEdges,\n grayCenters,\n fixedOrientation,\n orientCenters,\n puzzleOrientation,\n puzzleOrientations,\n fixedPieceType,\n scrambleAmount,\n moveList,\n } = args;\n const options: ExperimentalPuzzleGeometryOptions = {\n verbosity,\n optimizeOrbits,\n addRotations,\n allMoves,\n outerBlockMoves,\n vertexMoves,\n includeCornerOrbits,\n includeCenterOrbits,\n includeEdgeOrbits,\n excludeOrbits,\n grayCorners,\n grayEdges,\n grayCenters,\n fixedOrientation,\n orientCenters,\n puzzleOrientation,\n puzzleOrientations,\n fixedPieceType,\n scrambleAmount,\n moveList,\n };\n\n const puzzleGeometry = new PuzzleGeometry(args.puzzle, options);\n // TODO: why are these calls needed?\n puzzleGeometry.allstickers();\n puzzleGeometry.genperms();\n return puzzleGeometry;\n}\n\nswitch (args.subcommand) {\n case \"KSolve\": {\n console.log(buildPuzzleGeometry().writeksolve());\n break;\n }\n case \"SVG\": {\n console.log(\n buildPuzzleGeometry().generatesvg(\n undefined,\n undefined,\n undefined,\n args.svg3D,\n ),\n );\n break;\n }\n case \"GAP\": {\n console.log(buildPuzzleGeometry().writegap());\n break;\n }\n case \"Mathematica\": {\n console.log(buildPuzzleGeometry().writemathematica());\n break;\n }\n case \"Schreier-Sims\": {\n buildPuzzleGeometry().writeSchreierSims(console.log);\n break;\n }\n case \"Canonical string analysis\": {\n buildPuzzleGeometry().showcanon(console.log);\n break;\n }\n case \"3D\": {\n console.log(JSON.stringify(buildPuzzleGeometry().get3d(), null, \" \"));\n break;\n }\n default:\n throw new Error(\"Invalid subcommand.\") as never;\n}\n"],
5
5
  "mappings": ";;;;;;AA0BA,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW;AACpB,SAAS,YAAY;AACrB;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AACrB,SAAS,6BAA6B;AAGtC,IAAM,aAAa,oBAAoB;AAGvC,SAAS,SAAS,YAAwB,aAAsB;AAC9D,SAAO;AAAA,IACL;AAAA,MACE,KAAK,YAAY;AAAA,QACf;AAAA,MACF,CAAC;AAAA,MACD,CAAC,MAAM,CAAC;AAAA,IACV;AAAA,EACF;AACF;AAGA,IAAM,qBAAqB;AAAA,EACzB,cAAc,SAAS,MAAM;AAAA,EAC7B,YAAY,SAAS,MAAS;AAChC;AAEA,IAAM,OAAO;AAAA,EACX;AAAA,IACE,OAAO;AAAA,MACL,WAAW;AAAA,QACT;AAAA,UACE,IAAI,SAAS,KAAK,aAAa,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM;AAAA,UACtD,IAAI,KAAK,WAAW,IAAI,GAAG,MAAM,CAAC;AAAA,QACpC;AAAA,MACF;AAAA,IACF,CAAC;AAAA,IACD;AAAA,MACE,OAAO;AAAA,QACL,GAAG;AAAA,QACH,YAAY,SAAS,QAAQ;AAAA,QAC7B,gBAAgB,KAAK,YAAY;AAAA,UAC/B,aAAa;AAAA,QACf,CAAC;AAAA,MACH,CAAC;AAAA,MACD,OAAO;AAAA,QACL,GAAG;AAAA,QACH,YAAY,SAAS,KAAK;AAAA,QAC1B,gBAAgB,KAAK,SAAS;AAAA,UAC5B,aAAa;A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UAA6C;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,iBAAiB,IAAI,eAAe,KAAK,QAAQ,OAAO;AAE9D,iBAAe,YAAY;AAC3B,iBAAe,SAAS;AACxB,SAAO;AACT;AAEA,QAAQ,KAAK,YAAY;AAAA,EACvB,KAAK,UAAU;AACb,YAAQ,IAAI,oBAAoB,EAAE,YAAY,CAAC;AAC/C;AAAA,EACF;AAAA,EACA,KAAK,OAAO;AACV,YAAQ;AAAA,MACN,oBAAoB,EAAE;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK;AAAA,MACP;AAAA,IACF;AACA;AAAA,EACF;AAAA,EACA,KAAK,OAAO;AACV,YAAQ,IAAI,oBAAoB,EAAE,SAAS,CAAC;AAC5C;AAAA,EACF;AAAA,EACA,KAAK,eAAe;AAClB,YAAQ,IAAI,oBAAoB,EAAE,iBAAiB,CAAC;AACpD;AAAA,EACF;AAAA,EACA,KAAK,iBAAiB;AACpB,wBAAoB,EAAE,kBAAkB,QAAQ,GAAG;AACnD;AAAA,EACF;AAAA,EACA,KAAK,6BAA6B;AAChC,wBAAoB,EAAE,UAAU,QAAQ,GAAG;AAC3C;AAAA,EACF;AAAA,EACA,KAAK,MAAM;AACT,YAAQ,IAAI,KAAK,UAAU,oBAAoB,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC;AACrE;AAAA,EACF;AAAA,EACA;AACE,UAAM,IAAI,MAAM,qBAAqB;AACzC;",
6
6
  "names": ["args"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env -S node --
2
2
  import {
3
3
  packageVersion
4
- } from "./chunks/chunk-BIRBVHTR.js";
4
+ } from "./chunks/chunk-STSENBFQ.js";
5
5
 
6
6
  // src/bin/scramble.ts
7
7
  import { argv } from "node:process";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/bin/scramble.ts"],
4
- "sourcesContent": ["/**\n\nTo run this file directly:\n\n```shell\nbun run ./src/bin/scramble.ts -- 333\n```\n\nTo test completions:\n\n```shell\n# fish (from repo root)\nset PATH (pwd)/src/test/bin-path $PATH\nscramble --completions fish | source\n```\n\n```shell\n# zsh (from repo root)\nautoload -Uz compinit\ncompinit\nexport PATH=$(pwd)/src/test/bin-path:$PATH\nsource <(scramble --completions zsh)\n```\n\n*/\n\nimport { argv } from \"node:process\";\nimport {\n argument,\n choice,\n integer,\n map,\n merge,\n message,\n object,\n option,\n withDefault,\n} from \"@optique/core\";\nimport { run } from \"@optique/run\";\nimport type { Alg } from \"cubing/alg\";\nimport { eventInfo, twizzleEvents } from \"cubing/puzzles\";\nimport { randomScrambleForEvent } from \"cubing/scramble\";\nimport { setSearchDebug } from \"cubing/search\";\nimport { Path } from \"path-class\";\nimport { packageVersion } from \"../metadata/packageVersion\";\n\nconst outputFormats = [\"auto\", \"text\", \"link\", \"json-text\"] as const;\nconst notationTypes = [\"auto\", \"LGN\"] as const;\nconst eventIDs = Object.entries(twizzleEvents)\n .filter(([_, eventInfo]) => !!eventInfo.scramblesImplemented)\n .map(([eventID, _]) => eventID);\n\nconst args = run(\n merge(\n object({\n amount: withDefault(\n option(\"--amount\", \"-n\", integer({ metavar: \"AMOUNT\", min: 1 }), {\n description: message`Amount of scrambles.`,\n }),\n 1,\n ),\n notation: withDefault(\n option(\"--notation\", choice(notationTypes, { metavar: \"NOTATION\" })),\n \"auto\",\n ),\n }),\n object({\n format: withDefault(\n option(\"--format\", \"-f\", choice(outputFormats, { metavar: \"FORMAT\" })),\n \"auto\",\n ),\n }),\n object({\n // TODO: consolidate this with `format`: https://github.com/dahlia/optique/issues/57\n text: map(\n option(\"--text\", \"-t\", {\n description: message`Convenient shorthand for \\`--format text\\`.`,\n }),\n () => \"text\",\n ),\n }),\n object({\n eventID: argument(choice(eventIDs, { metavar: \"EVENT_ID\" }), {\n description: message`WCA or unoffiical event ID.`,\n }),\n }),\n ),\n {\n programName: new Path(argv[1]).basename.path,\n description: message`Example: order 3x3x3 \"R U R' U R U2' R'\"`,\n help: \"option\",\n completion: {\n mode: \"option\",\n name: \"plural\",\n },\n version: {\n mode: \"option\",\n value: packageVersion,\n },\n },\n);\n\nconst { amount, format: argsFormat, notation, text, eventID } = args;\nconst format = argsFormat ?? text ?? (!process.stdout.isTTY ? \"text\" : \"auto\");\n\nsetSearchDebug({ logPerf: false, showWorkerInstantiationWarnings: false });\n\nfunction scrambleText(scramble: Alg): string {\n return scramble.toString({\n // TODO: any\n notation: notation as (typeof notationTypes)[number], // TODO: handle type conversion at arg parse time.\n });\n}\n\nfunction scrambleLink(scramble: Alg): string {\n const url = new URL(\"https://alpha.twizzle.net/edit/\");\n const puzzleID = eventInfo(eventID)?.puzzleID;\n puzzleID && url.searchParams.set(\"puzzle\", puzzleID);\n url.searchParams.set(\"alg\", scrambleText(scramble));\n return url.toString();\n}\n\nclass JSONListPrinter<T> {\n #finished = false;\n #firstValuePrintedAlready = false;\n constructor() {\n process.stdout.write(\"[\\n \");\n }\n\n push(value: T) {\n if (this.#firstValuePrintedAlready) {\n process.stdout.write(\",\\n \");\n }\n this.#firstValuePrintedAlready = true;\n process.stdout.write(JSON.stringify(value));\n }\n\n finish() {\n if (this.#finished) {\n throw new Error(\"Tried to finish JSON list printing multiple times.\");\n }\n this.#finished = true;\n console.log(\"\\n]\");\n }\n}\n\n// Possibly: https://github.com/nodejs/node/issues/55468 Technically we could\n// just remove `await` from the called function, but this is semantically\n// unsound. This function encapsulates the unsoundness.\nfunction nodeForgetTopLevelAwaitWorkaround(\n _promise: Promise<void>,\n): Promise<void> {\n return Promise.resolve();\n}\n\nawait nodeForgetTopLevelAwaitWorkaround(\n (async () => {\n if (format !== \"json-text\" && amount === 1) {\n const scramble = await randomScrambleForEvent(eventID);\n\n switch (format) {\n case \"auto\": {\n console.log(`${scrambleText(scramble)}\n\n\uD83D\uDD17 ${scrambleLink(scramble)}`);\n break;\n }\n case \"text\": {\n console.log(scrambleText(scramble));\n break;\n }\n case \"link\": {\n console.log(scrambleLink(scramble));\n break;\n }\n // @ts-expect-error This is a code guard for future refactoring.\n case \"json-text\": {\n throw new Error(\n \"Encountered `json` format in code that is not expected to handle it.\",\n );\n }\n default: {\n throw new Error(\"Invalid format!\") as never;\n }\n }\n } else {\n const jsonListPrinter: JSONListPrinter<string> | undefined =\n format === \"json-text\" ? new JSONListPrinter() : undefined;\n for (let i = 0; i < amount; i++) {\n const scramble = await randomScrambleForEvent(eventID);\n switch (format) {\n case \"auto\": {\n console.log(`// Scramble #${i + 1}\n${scrambleText(scramble)}\n\n\uD83D\uDD17 ${scrambleLink(scramble)}\n`);\n break;\n }\n case \"text\": {\n console.log(`// Scramble #${i + 1}`);\n console.log(`${scrambleText(scramble)}\\n`);\n break;\n }\n case \"link\": {\n console.log(`// Scramble #${i + 1}`);\n console.log(`${scrambleLink(scramble)}\\n`);\n break;\n }\n case \"json-text\": {\n jsonListPrinter?.push(scramble.toString());\n break;\n }\n default: {\n throw new Error(\"Invalid format!\") as never;\n }\n }\n }\n jsonListPrinter?.finish();\n }\n })(),\n);\n"],
4
+ "sourcesContent": ["/**\n\nTo run this file directly:\n\n```shell\nbun run -- ./src/bin/scramble.ts 333\n```\n\nTo test completions:\n\n```shell\n# fish (from repo root)\nset PATH (pwd)/src/test/bin-path $PATH\nscramble --completions fish | source\n```\n\n```shell\n# zsh (from repo root)\nautoload -Uz compinit\ncompinit\nexport PATH=$(pwd)/src/test/bin-path:$PATH\nsource <(scramble --completions zsh)\n```\n\n*/\n\nimport { argv } from \"node:process\";\nimport {\n argument,\n choice,\n integer,\n map,\n merge,\n message,\n object,\n option,\n withDefault,\n} from \"@optique/core\";\nimport { run } from \"@optique/run\";\nimport type { Alg } from \"cubing/alg\";\nimport { eventInfo, twizzleEvents } from \"cubing/puzzles\";\nimport { randomScrambleForEvent } from \"cubing/scramble\";\nimport { setSearchDebug } from \"cubing/search\";\nimport { Path } from \"path-class\";\nimport { packageVersion } from \"../metadata/packageVersion\";\n\nconst outputFormats = [\"auto\", \"text\", \"link\", \"json-text\"] as const;\nconst notationTypes = [\"auto\", \"LGN\"] as const;\nconst eventIDs = Object.entries(twizzleEvents)\n .filter(([_, eventInfo]) => !!eventInfo.scramblesImplemented)\n .map(([eventID, _]) => eventID);\n\nconst args = run(\n merge(\n object({\n amount: withDefault(\n option(\"--amount\", \"-n\", integer({ metavar: \"AMOUNT\", min: 1 }), {\n description: message`Amount of scrambles.`,\n }),\n 1,\n ),\n notation: withDefault(\n option(\"--notation\", choice(notationTypes, { metavar: \"NOTATION\" })),\n \"auto\",\n ),\n }),\n object({\n format: withDefault(\n option(\"--format\", \"-f\", choice(outputFormats, { metavar: \"FORMAT\" })),\n \"auto\",\n ),\n }),\n object({\n // TODO: consolidate this with `format`: https://github.com/dahlia/optique/issues/57\n text: map(\n option(\"--text\", \"-t\", {\n description: message`Convenient shorthand for \\`--format text\\`.`,\n }),\n () => \"text\",\n ),\n }),\n object({\n eventID: argument(choice(eventIDs, { metavar: \"EVENT_ID\" }), {\n description: message`WCA or unoffiical event ID.`,\n }),\n }),\n ),\n {\n programName: new Path(argv[1]).basename.path,\n description: message`Example: order 3x3x3 \"R U R' U R U2' R'\"`,\n help: \"option\",\n completion: {\n mode: \"option\",\n name: \"plural\",\n },\n version: {\n mode: \"option\",\n value: packageVersion,\n },\n },\n);\n\nconst { amount, format: argsFormat, notation, text, eventID } = args;\nconst format = argsFormat ?? text ?? (!process.stdout.isTTY ? \"text\" : \"auto\");\n\nsetSearchDebug({ logPerf: false, showWorkerInstantiationWarnings: false });\n\nfunction scrambleText(scramble: Alg): string {\n return scramble.toString({\n // TODO: any\n notation: notation as (typeof notationTypes)[number], // TODO: handle type conversion at arg parse time.\n });\n}\n\nfunction scrambleLink(scramble: Alg): string {\n const url = new URL(\"https://alpha.twizzle.net/edit/\");\n const puzzleID = eventInfo(eventID)?.puzzleID;\n puzzleID && url.searchParams.set(\"puzzle\", puzzleID);\n url.searchParams.set(\"alg\", scrambleText(scramble));\n return url.toString();\n}\n\nclass JSONListPrinter<T> {\n #finished = false;\n #firstValuePrintedAlready = false;\n constructor() {\n process.stdout.write(\"[\\n \");\n }\n\n push(value: T) {\n if (this.#firstValuePrintedAlready) {\n process.stdout.write(\",\\n \");\n }\n this.#firstValuePrintedAlready = true;\n process.stdout.write(JSON.stringify(value));\n }\n\n finish() {\n if (this.#finished) {\n throw new Error(\"Tried to finish JSON list printing multiple times.\");\n }\n this.#finished = true;\n console.log(\"\\n]\");\n }\n}\n\n// Possibly: https://github.com/nodejs/node/issues/55468 Technically we could\n// just remove `await` from the called function, but this is semantically\n// unsound. This function encapsulates the unsoundness.\nfunction nodeForgetTopLevelAwaitWorkaround(\n _promise: Promise<void>,\n): Promise<void> {\n return Promise.resolve();\n}\n\nawait nodeForgetTopLevelAwaitWorkaround(\n (async () => {\n if (format !== \"json-text\" && amount === 1) {\n const scramble = await randomScrambleForEvent(eventID);\n\n switch (format) {\n case \"auto\": {\n console.log(`${scrambleText(scramble)}\n\n\uD83D\uDD17 ${scrambleLink(scramble)}`);\n break;\n }\n case \"text\": {\n console.log(scrambleText(scramble));\n break;\n }\n case \"link\": {\n console.log(scrambleLink(scramble));\n break;\n }\n // @ts-expect-error This is a code guard for future refactoring.\n case \"json-text\": {\n throw new Error(\n \"Encountered `json` format in code that is not expected to handle it.\",\n );\n }\n default: {\n throw new Error(\"Invalid format!\") as never;\n }\n }\n } else {\n const jsonListPrinter: JSONListPrinter<string> | undefined =\n format === \"json-text\" ? new JSONListPrinter() : undefined;\n for (let i = 0; i < amount; i++) {\n const scramble = await randomScrambleForEvent(eventID);\n switch (format) {\n case \"auto\": {\n console.log(`// Scramble #${i + 1}\n${scrambleText(scramble)}\n\n\uD83D\uDD17 ${scrambleLink(scramble)}\n`);\n break;\n }\n case \"text\": {\n console.log(`// Scramble #${i + 1}`);\n console.log(`${scrambleText(scramble)}\\n`);\n break;\n }\n case \"link\": {\n console.log(`// Scramble #${i + 1}`);\n console.log(`${scrambleLink(scramble)}\\n`);\n break;\n }\n case \"json-text\": {\n jsonListPrinter?.push(scramble.toString());\n break;\n }\n default: {\n throw new Error(\"Invalid format!\") as never;\n }\n }\n }\n jsonListPrinter?.finish();\n }\n })(),\n);\n"],
5
5
  "mappings": ";;;;;;AA0BA,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW;AAEpB,SAAS,WAAW,qBAAqB;AACzC,SAAS,8BAA8B;AACvC,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AAGrB,IAAM,gBAAgB,CAAC,QAAQ,QAAQ,QAAQ,WAAW;AAC1D,IAAM,gBAAgB,CAAC,QAAQ,KAAK;AACpC,IAAM,WAAW,OAAO,QAAQ,aAAa,EAC1C,OAAO,CAAC,CAAC,GAAGA,UAAS,MAAM,CAAC,CAACA,WAAU,oBAAoB,EAC3D,IAAI,CAAC,CAACC,UAAS,CAAC,MAAMA,QAAO;AAEhC,IAAM,OAAO;AAAA,EACX;AAAA,IACE,OAAO;AAAA,MACL,QAAQ;AAAA,QACN,OAAO,YAAY,MAAM,QAAQ,EAAE,SAAS,UAAU,KAAK,EAAE,CAAC,GAAG;AAAA,UAC/D,aAAa;AAAA,QACf,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MACA,UAAU;AAAA,QACR,OAAO,cAAc,OAAO,eAAe,EAAE,SAAS,WAAW,CAAC,CAAC;AAAA,QACnE;AAAA,MACF;AAAA,IACF,CAAC;AAAA,IACD,OAAO;AAAA,MACL,QAAQ;AAAA,QACN,OAAO,YAAY,MAAM,OAAO,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,YAEnB,aAAa,QAAQ,CAAC;AAAA,CAC1B;AACW;AAAA,UACF;AAAA,UACA,KAAK,QAAQ;AACX,oBAAQ,IAAI,gBAAgB,IAAI,CAAC,EAAE;AACnC,oBAAQ,IAAI,GAAG,aAAa,QAAQ,CAAC;AAAA,CAAI;AACzC;AAAA,UACF;AAAA,UACA,KAAK,QAAQ;AACX,oBAAQ,IAAI,gBAAgB,IAAI,CAAC,EAAE;AACnC,oBAAQ,IAAI,GAAG,aAAa,QAAQ,CAAC;AAAA,CAAI;AACzC;AAAA,UACF;AAAA,UACA,KAAK,aAAa;AAChB,6BAAiB,KAAK,SAAS,SAAS,CAAC;AACzC;AAAA,UACF;AAAA,UACA,SAAS;AACP,kBAAM,IAAI,MAAM,iBAAiB;AAAA,UACnC;AAAA,QACF;AAAA,MACF;AACA,uBAAiB,OAAO;AAAA,IAC1B;AAAA,EACF,GAAG;AACL;",
6
6
  "names": ["eventInfo", "eventID"]
7
7
  }
@@ -1,16 +1,16 @@
1
1
  import { Tagged } from 'type-fest';
2
2
  import { Texture, Object3D, Raycaster, PerspectiveCamera, Scene, WebGLRenderer } from 'three/src/Three.js';
3
3
 
4
- type ExperimentalNotationType = "auto" | "LGN";
5
- interface ExperimentalSerializationOptions {
6
- notation?: ExperimentalNotationType;
7
- }
8
-
9
4
  declare enum IterationDirection {
10
5
  Forwards = 1,
11
6
  Backwards = -1
12
7
  }
13
8
 
9
+ type ExperimentalNotationType = "auto" | "LGN";
10
+ interface ExperimentalSerializationOptions {
11
+ notation?: ExperimentalNotationType;
12
+ }
13
+
14
14
  declare abstract class Comparable {
15
15
  is(c: any): boolean;
16
16
  as<T>(c: new (...args: any) => T): T | null;
@@ -1757,7 +1757,7 @@ declare class TwistyAnimationController {
1757
1757
  untilBoundary?: BoundaryType;
1758
1758
  autoSkipToOtherEndIfStartingAtBoundary?: boolean;
1759
1759
  loop?: boolean;
1760
- }): Promise<void>;
1760
+ }): void;
1761
1761
  pause(): void;
1762
1762
  animFrame(frameDatestamp: MillisecondTimestamp): Promise<void>;
1763
1763
  }
@@ -2082,7 +2082,7 @@ declare class TwistyPlayer extends TwistyPlayerSettable implements TwistyAnimati
2082
2082
  buttons?: TwistyButtons;
2083
2083
  experimentalCanvasClickCallback: (...args: any) => void;
2084
2084
  constructor(config?: TwistyPlayerConfig);
2085
- connectedCallback(): Promise<void>;
2085
+ connectedCallback(): void;
2086
2086
  [intersectedCallback](): Promise<void>;
2087
2087
  /** @deprecated */
2088
2088
  experimentalSetFlashLevel(newLevel: "auto" | "none"): void;
@@ -1,5 +1,5 @@
1
- import { R as AlgNode, r as Alg, M as Move, U as AppendOptions, W as Grouping, X as LineComment, Y as Commutator, Z as Conjugate, _ as Newline, $ as Pause, a0 as KeyMapping, A as AlgLeaf } from '../PuzzleLoader-CkghxdIL.js';
2
- export { a1 as AlgBranch, a7 as AppendCancelOptions, a5 as ExperimentalNotationType, a4 as ExperimentalParsed, a6 as ExperimentalSerializationOptions, a2 as GroupingModifications, a3 as MoveModifications, w as PuzzleSpecificSimplifyOptions, a9 as QuantumMove, a8 as SimplifyOptions } from '../PuzzleLoader-CkghxdIL.js';
1
+ import { R as AlgNode, r as Alg, M as Move, U as AppendOptions, W as Grouping, X as LineComment, Y as Commutator, Z as Conjugate, _ as Newline, $ as Pause, a0 as KeyMapping, A as AlgLeaf } from '../PuzzleLoader-B2JfN7uX.js';
2
+ export { a1 as AlgBranch, a7 as AppendCancelOptions, a5 as ExperimentalNotationType, a4 as ExperimentalParsed, a6 as ExperimentalSerializationOptions, a2 as GroupingModifications, a3 as MoveModifications, w as PuzzleSpecificSimplifyOptions, a9 as QuantumMove, a8 as SimplifyOptions } from '../PuzzleLoader-B2JfN7uX.js';
3
3
  import 'type-fest';
4
4
  import 'three/src/Three.js';
5
5
 
@@ -18,7 +18,7 @@ import {
18
18
  functionFromTraversal,
19
19
  keyToMove,
20
20
  setAlgDebug
21
- } from "../chunks/chunk-7D7ZUWUK.js";
21
+ } from "../chunks/chunk-O6HEZXGY.js";
22
22
  export {
23
23
  Alg,
24
24
  AlgBuilder,
@@ -1,11 +1,30 @@
1
- import { t as PuzzleID, s as PuzzleLoader, a0 as KeyMapping, K as KPattern, r as Alg, M as Move, z as MillisecondTimestamp } from '../PuzzleLoader-CkghxdIL.js';
2
- import { B as BluetoothPuzzle } from '../bluetooth-puzzle-c-_IBAdu.js';
3
- export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-c-_IBAdu.js';
1
+ import { A as AlgLeafEvent, O as OrientationEvent } from '../events-BDkOaqlG.js';
2
+ import { K as KPattern, t as PuzzleID, s as PuzzleLoader, a0 as KeyMapping, r as Alg, M as Move, z as MillisecondTimestamp } from '../PuzzleLoader-B2JfN7uX.js';
4
3
  import 'type-fest';
5
4
  import 'three/src/Three.js';
6
5
 
7
6
  declare function enableDebugLogging(enable: boolean): void;
8
7
 
8
+ interface StreamTransformer {
9
+ transformAlgLeaf(algLeafEvent: AlgLeafEvent): void;
10
+ transformOrientation(orientationEvent: OrientationEvent): void;
11
+ }
12
+
13
+ /** @category Smart Puzzles */
14
+ declare abstract class BluetoothPuzzle extends EventTarget {
15
+ transformers: StreamTransformer[];
16
+ protected listeners: Array<(e: AlgLeafEvent) => void>;
17
+ protected orientationListeners: Array<(e: OrientationEvent) => void>;
18
+ abstract name(): string | undefined;
19
+ abstract disconnect(): void;
20
+ getPattern(): Promise<KPattern>;
21
+ addAlgLeafListener(listener: (e: AlgLeafEvent) => void): void;
22
+ addOrientationListener(listener: (e: OrientationEvent) => void): void;
23
+ experimentalAddBasicRotationTransformer(): void;
24
+ protected dispatchAlgLeaf(algLeaf: AlgLeafEvent): void;
25
+ protected dispatchOrientation(orientationEvent: OrientationEvent): void;
26
+ }
27
+
9
28
  /** @category Keyboard Puzzles */
10
29
  declare class KeyboardPuzzle extends BluetoothPuzzle {
11
30
  private target;
@@ -154,4 +173,4 @@ type BluetoothTimer = GanTimer;
154
173
  /** @category Timers */
155
174
  declare function connectSmartTimer(options?: BluetoothConnectOptions): Promise<BluetoothTimer>;
156
175
 
157
- export { BluetoothPuzzle, type BluetoothRobot, type BluetoothTimer, GanCube, GiiKERCube, GoCube, KeyboardPuzzle, connectSmartPuzzle, connectSmartRobot, connectSmartTimer, debugKeyboardConnect, enableDebugLogging };
176
+ export { BluetoothPuzzle, type BluetoothRobot, type BluetoothTimer, GanCube, GiiKERCube, GoCube, KeyboardPuzzle, AlgLeafEvent as MoveEvent, OrientationEvent, connectSmartPuzzle, connectSmartRobot, connectSmartTimer, debugKeyboardConnect, enableDebugLogging };
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  binaryComponentsToReid3x3x3,
3
3
  twizzleBinaryToBinaryComponents
4
- } from "../chunks/chunk-WI337PMF.js";
4
+ } from "../chunks/chunk-NGW52SHR.js";
5
5
  import {
6
6
  puzzles
7
- } from "../chunks/chunk-MZKROP74.js";
7
+ } from "../chunks/chunk-FLK6AZKB.js";
8
8
  import {
9
9
  cube3x3x3,
10
10
  experimental3x3x3KPuzzle
11
- } from "../chunks/chunk-QSGI7DXX.js";
11
+ } from "../chunks/chunk-FUHYAW74.js";
12
12
  import {
13
13
  KPattern
14
- } from "../chunks/chunk-WAYEJXCG.js";
14
+ } from "../chunks/chunk-RINY3U6G.js";
15
15
  import {
16
16
  Alg,
17
17
  Move,
18
18
  experimentalAppendMove,
19
19
  keyToMove
20
- } from "../chunks/chunk-7D7ZUWUK.js";
20
+ } from "../chunks/chunk-O6HEZXGY.js";
21
21
 
22
22
  // src/cubing/bluetooth/debug.ts
23
23
  var DEBUG_LOGGING_ENABLED = false;
@@ -261,7 +261,7 @@ async function importKey(keyBytes) {
261
261
  );
262
262
  }
263
263
  async function unsafeEncryptBlockWithIV(key, plaintextBlock, iv) {
264
- const cryptoResult = await window.crypto.subtle.encrypt(
264
+ const cryptoResult = await globalThis.crypto.subtle.encrypt(
265
265
  {
266
266
  name: AES_CBC,
267
267
  iv
@@ -286,7 +286,7 @@ async function unsafeDecryptBlock(key, ciphertextBlock) {
286
286
  const cbcCiphertext = new Uint8Array(2 * blockSize);
287
287
  cbcCiphertext.set(new Uint8Array(ciphertextBlock), 0);
288
288
  cbcCiphertext.set(new Uint8Array(paddingBlock), blockSize);
289
- const cryptoResult = await window.crypto.subtle.decrypt(
289
+ const cryptoResult = await globalThis.crypto.subtle.decrypt(
290
290
  {
291
291
  name: AES_CBC,
292
292
  iv: zeros
@@ -1605,9 +1605,12 @@ var QiyiCube = class _QiyiCube extends BluetoothPuzzle {
1605
1605
  this.kpuzzle = kpuzzle;
1606
1606
  this.aesKey = aesKey;
1607
1607
  this.server = server;
1608
- this.startNotifications().then(this.sendAppHello.bind(this));
1609
1608
  this.allTimeStamps = /* @__PURE__ */ new Set();
1610
1609
  this.allTimeStampsQueue = [];
1610
+ void (async () => {
1611
+ await this.startNotifications();
1612
+ void this.sendAppHello();
1613
+ })();
1611
1614
  }
1612
1615
  latestTimestamp;
1613
1616
  allTimeStamps;
@@ -2195,7 +2198,7 @@ var GanTimer = class _GanTimer extends EventTarget {
2195
2198
  }
2196
2199
  }
2197
2200
  this.previousDetail = detail;
2198
- this.poll();
2201
+ void this.poll();
2199
2202
  }
2200
2203
  onDisconnect() {
2201
2204
  this.dispatchEvent(new CustomEvent("disconnect"));
@@ -2212,7 +2215,7 @@ var GanTimer = class _GanTimer extends EventTarget {
2212
2215
  }
2213
2216
  startPolling() {
2214
2217
  this.polling = true;
2215
- this.poll();
2218
+ void this.poll();
2216
2219
  }
2217
2220
  stopPolling() {
2218
2221
  this.polling = false;