cubing 0.20.1 → 0.21.0-pre11

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 (760) hide show
  1. package/README.md +6 -9
  2. package/dist/.DS_Store +0 -0
  3. package/dist/bin/puzzle-geometry-bin.js +1124 -1128
  4. package/dist/bin/puzzle-geometry-bin.js.map +3 -3
  5. package/dist/bundle-global/cubing.bundle-global.js +3978 -3587
  6. package/dist/esm/.DS_Store +0 -0
  7. package/dist/esm/{2x2x2.kpuzzle.json_-ZLJSYD5K.js → 2x2x2.kpuzzle.json-JOGUSQ4N.js} +3 -3
  8. package/dist/esm/{2x2x2.kpuzzle.json_-ZLJSYD5K.js.map → 2x2x2.kpuzzle.json-JOGUSQ4N.js.map} +1 -1
  9. package/dist/esm/{2x2x2.kpuzzle.svg-BNXPAM3A.js → 2x2x2.kpuzzle.svg-CQF2FTV7.js} +2 -2
  10. package/dist/esm/{2x2x2.kpuzzle.svg-BNXPAM3A.js.map → 2x2x2.kpuzzle.svg-CQF2FTV7.js.map} +0 -0
  11. package/dist/esm/3d-BRT2MZMN.js +39 -0
  12. package/dist/esm/3d-BRT2MZMN.js.map +7 -0
  13. package/dist/esm/{3x3x3-ll.kpuzzle.svg-EC42JHOH.js → 3x3x3-ll.kpuzzle.svg-53CBPG5O.js} +2 -2
  14. package/dist/esm/{3x3x3-ll.kpuzzle.svg-EC42JHOH.js.map → 3x3x3-ll.kpuzzle.svg-53CBPG5O.js.map} +0 -0
  15. package/dist/esm/{3x3x3.kpuzzle.svg-DUKG2WHC.js → 3x3x3.kpuzzle.svg-ERSSH66P.js} +2 -2
  16. package/dist/esm/{3x3x3.kpuzzle.svg-DUKG2WHC.js.map → 3x3x3.kpuzzle.svg-ERSSH66P.js.map} +0 -0
  17. package/dist/esm/alg/index.js +2 -2
  18. package/dist/esm/bluetooth/index.js +13 -11
  19. package/dist/esm/bluetooth/index.js.map +2 -2
  20. package/dist/esm/chunk-BGFVB2OS.js +740 -0
  21. package/dist/esm/chunk-BGFVB2OS.js.map +7 -0
  22. package/dist/esm/{chunk-YNB7QLBF.js → chunk-BU5PUJK3.js} +9 -10
  23. package/dist/esm/chunk-BU5PUJK3.js.map +7 -0
  24. package/dist/esm/chunk-EM5F24AO.js +2511 -0
  25. package/dist/esm/chunk-EM5F24AO.js.map +7 -0
  26. package/dist/esm/{chunk-KKSDHNLH.js → chunk-H7EP5SIJ.js} +49 -71
  27. package/dist/esm/chunk-H7EP5SIJ.js.map +7 -0
  28. package/dist/esm/{chunk-2GRKPQQL.js → chunk-RE7MIN5R.js} +2 -2
  29. package/dist/esm/{chunk-2GRKPQQL.js.map → chunk-RE7MIN5R.js.map} +0 -0
  30. package/dist/esm/{chunk-WJ7AVUI7.js → chunk-WO2AXYFE.js} +12 -1
  31. package/dist/esm/{chunk-WJ7AVUI7.js.map → chunk-WO2AXYFE.js.map} +0 -0
  32. package/dist/esm/{chunk-CWVB5RRW.js → chunk-YV3RT5PX.js} +625 -1282
  33. package/dist/esm/chunk-YV3RT5PX.js.map +7 -0
  34. package/dist/esm/{clock.kpuzzle.json_-PXORG6YF.js → clock.kpuzzle.json-EKWRMHJM.js} +3 -3
  35. package/dist/esm/{clock.kpuzzle.json_-PXORG6YF.js.map → clock.kpuzzle.json-EKWRMHJM.js.map} +1 -1
  36. package/dist/esm/{clock.kpuzzle.svg-E52B5OQV.js → clock.kpuzzle.svg-B7TMN3SY.js} +2 -2
  37. package/dist/esm/{clock.kpuzzle.svg-E52B5OQV.js.map → clock.kpuzzle.svg-B7TMN3SY.js.map} +0 -0
  38. package/dist/esm/esm-test-worker.js +2 -2
  39. package/dist/esm/esm-test-worker.js.map +1 -1
  40. package/dist/esm/kpuzzle/index.js +5 -3
  41. package/dist/esm/{node-SIGYKAZG.js → node-BSAQKO3G.js} +2 -2
  42. package/dist/esm/{node-SIGYKAZG.js.map → node-BSAQKO3G.js.map} +0 -0
  43. package/dist/esm/{node-BHGOVUN3.js → node-WEHVBEKP.js} +2 -2
  44. package/dist/esm/{node-BHGOVUN3.js.map → node-WEHVBEKP.js.map} +0 -0
  45. package/dist/esm/notation/index.js +3 -3
  46. package/dist/esm/protocol/index.js +3 -3
  47. package/dist/esm/puzzle-geometry/index.js +1085 -1179
  48. package/dist/esm/puzzle-geometry/index.js.map +3 -3
  49. package/dist/esm/puzzles/index.js +10 -4
  50. package/dist/esm/{pyraminx.kpuzzle.svg-QKUJX37T.js → pyraminx.kpuzzle.svg-QBBMZVDY.js} +2 -2
  51. package/dist/esm/{pyraminx.kpuzzle.svg-QKUJX37T.js.map → pyraminx.kpuzzle.svg-QBBMZVDY.js.map} +0 -0
  52. package/dist/esm/scramble/index.js +5 -4
  53. package/dist/esm/search/index.js +7 -4
  54. package/dist/esm/{sq1-hyperorbit.kpuzzle.json_-7KW5LSXC.js → sq1-hyperorbit.kpuzzle.json-N3FGCPML.js} +3 -3
  55. package/dist/esm/{sq1-hyperorbit.kpuzzle.json_-7KW5LSXC.js.map → sq1-hyperorbit.kpuzzle.json-N3FGCPML.js.map} +1 -1
  56. package/dist/esm/{sq1-hyperorbit.kpuzzle.svg-7Y7N37NN.js → sq1-hyperorbit.kpuzzle.svg-ID57EER7.js} +2 -2
  57. package/dist/esm/{sq1-hyperorbit.kpuzzle.svg-7Y7N37NN.js.map → sq1-hyperorbit.kpuzzle.svg-ID57EER7.js.map} +0 -0
  58. package/dist/esm/stream/index.js +3 -3
  59. package/dist/esm/stream/index.js.map +2 -2
  60. package/dist/esm/twisty/index.js +4445 -3213
  61. package/dist/esm/twisty/index.js.map +3 -3
  62. package/dist/esm/worker-inside-generated-string-LA5JHD4B.js +2831 -0
  63. package/dist/esm/worker-inside-generated-string-LA5JHD4B.js.map +7 -0
  64. package/dist/types/alg/Alg.d.ts +88 -0
  65. package/dist/types/alg/Alg.d.ts.map +1 -1
  66. package/dist/types/alg/Alg.spec.d.ts +2 -0
  67. package/dist/types/alg/Alg.spec.d.ts.map +1 -0
  68. package/dist/types/alg/common.d.ts.map +1 -1
  69. package/dist/types/alg/operation.spec.d.ts +2 -0
  70. package/dist/types/alg/operation.spec.d.ts.map +1 -0
  71. package/dist/types/alg/parse.spec.d.ts +2 -0
  72. package/dist/types/alg/parse.spec.d.ts.map +1 -0
  73. package/dist/types/alg/test/alg-comparison.d.ts.map +1 -1
  74. package/dist/types/alg/test/alg.spec.d.ts +2 -0
  75. package/dist/types/alg/test/alg.spec.d.ts.map +1 -0
  76. package/dist/types/alg/units/leaves/LineComment.spec.d.ts +2 -0
  77. package/dist/types/alg/units/leaves/LineComment.spec.d.ts.map +1 -0
  78. package/dist/types/alg/units/leaves/Move.spec.d.ts +2 -0
  79. package/dist/types/alg/units/leaves/Move.spec.d.ts.map +1 -0
  80. package/dist/types/alg/url.spec.d.ts +2 -0
  81. package/dist/types/alg/url.spec.d.ts.map +1 -0
  82. package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts +1 -1
  83. package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts.map +1 -1
  84. package/dist/types/bluetooth/smart-puzzle/giiker.spec.d.ts +5 -0
  85. package/dist/types/bluetooth/smart-puzzle/giiker.spec.d.ts.map +1 -0
  86. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.d.ts +3 -0
  87. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.d.ts.map +1 -0
  88. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.d.ts +2 -0
  89. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.d.ts.map +1 -0
  90. package/dist/types/kpuzzle/canon.spec.d.ts +2 -0
  91. package/dist/types/kpuzzle/canon.spec.d.ts.map +1 -0
  92. package/dist/types/kpuzzle/index.d.ts +1 -0
  93. package/dist/types/kpuzzle/index.d.ts.map +1 -1
  94. package/dist/types/kpuzzle/kpuzzle.spec.d.ts +2 -0
  95. package/dist/types/kpuzzle/kpuzzle.spec.d.ts.map +1 -0
  96. package/dist/types/kpuzzle/prunetable.spec.d.ts +2 -0
  97. package/dist/types/kpuzzle/prunetable.spec.d.ts.map +1 -0
  98. package/dist/types/kpuzzle/svg.d.ts.map +1 -1
  99. package/dist/types/kpuzzle/transformations.spec.d.ts +2 -0
  100. package/dist/types/kpuzzle/transformations.spec.d.ts.map +1 -0
  101. package/dist/types/protocol/binary/binary3x3x3.spec.d.ts +2 -0
  102. package/dist/types/protocol/binary/binary3x3x3.spec.d.ts.map +1 -0
  103. package/dist/types/protocol/binary/hex.spec.d.ts +2 -0
  104. package/dist/types/protocol/binary/hex.spec.d.ts.map +1 -0
  105. package/dist/types/protocol/binary/orbit-indexing.spec.d.ts +2 -0
  106. package/dist/types/protocol/binary/orbit-indexing.spec.d.ts.map +1 -0
  107. package/dist/types/puzzle-geometry/Options.d.ts +45 -1
  108. package/dist/types/puzzle-geometry/Options.d.ts.map +1 -1
  109. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts +2 -0
  110. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts.map +1 -0
  111. package/dist/types/puzzle-geometry/PermOriSet.d.ts +39 -39
  112. package/dist/types/puzzle-geometry/PermOriSet.d.ts.map +1 -1
  113. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +118 -110
  114. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts.map +1 -1
  115. package/dist/types/puzzle-geometry/Quat.d.ts +0 -11
  116. package/dist/types/puzzle-geometry/Quat.d.ts.map +1 -1
  117. package/dist/types/puzzle-geometry/Quat.spec.d.ts +2 -0
  118. package/dist/types/puzzle-geometry/Quat.spec.d.ts.map +1 -0
  119. package/dist/types/puzzle-geometry/SchreierSims.d.ts.map +1 -1
  120. package/dist/types/puzzle-geometry/index.d.ts +2 -4
  121. package/dist/types/puzzle-geometry/index.d.ts.map +1 -1
  122. package/dist/types/puzzle-geometry/interfaces.d.ts +1 -21
  123. package/dist/types/puzzle-geometry/interfaces.d.ts.map +1 -1
  124. package/dist/types/puzzle-geometry/orientcenters.spec.d.ts +2 -0
  125. package/dist/types/puzzle-geometry/orientcenters.spec.d.ts.map +1 -0
  126. package/dist/types/puzzles/async/async-pg3d.d.ts.map +1 -1
  127. package/dist/types/puzzles/customPGPuzzleLoader.d.ts +12 -0
  128. package/dist/types/puzzles/customPGPuzzleLoader.d.ts.map +1 -0
  129. package/dist/types/puzzles/implementations/2x2x2/{2x2x2.kpuzzle.json_.d.ts → 2x2x2.kpuzzle.json.d.ts} +1 -1
  130. package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json.d.ts.map +1 -0
  131. package/dist/types/puzzles/implementations/3x3x3/index.d.ts.map +1 -1
  132. package/dist/types/puzzles/implementations/clock/{clock.kpuzzle.json_.d.ts → clock.kpuzzle.json.d.ts} +1 -1
  133. package/dist/types/puzzles/implementations/clock/clock.kpuzzle.json.d.ts.map +1 -0
  134. package/dist/types/puzzles/implementations/pyraminx/{pyraminx.kpuzzle.json_.d.ts → pyraminx.kpuzzle.json.d.ts} +1 -1
  135. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json.d.ts.map +1 -0
  136. package/dist/types/puzzles/implementations/square1/index.d.ts.map +1 -1
  137. package/dist/types/puzzles/implementations/square1/{sq1-hyperorbit.kpuzzle.json_.d.ts → sq1-hyperorbit.kpuzzle.json.d.ts} +1 -1
  138. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json.d.ts.map +1 -0
  139. package/dist/types/puzzles/index.d.ts +4 -2
  140. package/dist/types/puzzles/index.d.ts.map +1 -1
  141. package/dist/types/puzzles/stickerings/appearance.d.ts +9 -9
  142. package/dist/types/puzzles/stickerings/appearance.d.ts.map +1 -1
  143. package/dist/types/puzzles/stickerings/cube-stickerings.d.ts.map +1 -1
  144. package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts +3 -0
  145. package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts.map +1 -0
  146. package/dist/types/search/index.d.ts +1 -1
  147. package/dist/types/search/index.d.ts.map +1 -1
  148. package/dist/types/search/inside/api.d.ts +2 -1
  149. package/dist/types/search/inside/api.d.ts.map +1 -1
  150. package/dist/types/search/inside/api.spec.d.ts +2 -0
  151. package/dist/types/search/inside/api.spec.d.ts.map +1 -0
  152. package/dist/types/search/inside/solve/parseSGS.d.ts.map +1 -1
  153. package/dist/types/search/inside/solve/puzzles/3x3x3/filter.d.ts.map +1 -1
  154. package/dist/types/search/inside/solve/puzzles/3x3x3/index.d.ts.map +1 -1
  155. package/dist/types/search/inside/solve/puzzles/megaminx.sgs.json.d.ts.map +1 -1
  156. package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts +2 -0
  157. package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts.map +1 -0
  158. package/dist/types/search/inside/solve/puzzles/skewb.sgs.json.d.ts.map +1 -1
  159. package/dist/types/search/inside/solve/tremble.d.ts.map +1 -1
  160. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts +4 -31
  161. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts.map +1 -1
  162. package/dist/types/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +1 -1
  163. package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts +3 -0
  164. package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts.map +1 -0
  165. package/dist/types/search/inside/solve/vendor/random-uint-below/get-random-values.d.ts.map +1 -1
  166. package/dist/types/search/inside/solve/vendor/random-uint-below/random-int.d.ts.map +1 -1
  167. package/dist/types/search/inside/solve/vendor/sq12phase/scramble_sq1.d.ts.map +1 -1
  168. package/dist/types/search/instantiator.d.ts.map +1 -1
  169. package/dist/types/search/outside.d.ts +4 -2
  170. package/dist/types/search/outside.d.ts.map +1 -1
  171. package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
  172. package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
  173. package/dist/types/stream/twizzle/TwizzleStream.d.ts +9 -8
  174. package/dist/types/stream/twizzle/TwizzleStream.d.ts.map +1 -1
  175. package/dist/types/stream/websocket-proxy.d.ts +1 -1
  176. package/dist/types/stream/websocket-proxy.d.ts.map +1 -1
  177. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +34 -0
  178. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -0
  179. package/dist/types/twisty/controllers/TwistyPlayerController.d.ts +16 -0
  180. package/dist/types/twisty/controllers/TwistyPlayerController.d.ts.map +1 -0
  181. package/dist/types/twisty/heavy-code-imports/3d.d.ts +3 -0
  182. package/dist/types/twisty/heavy-code-imports/3d.d.ts.map +1 -0
  183. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +12 -0
  184. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +1 -0
  185. package/dist/types/twisty/index.d.ts +20 -15
  186. package/dist/types/twisty/index.d.ts.map +1 -1
  187. package/dist/types/twisty/model/PromiseFreshener.d.ts +14 -0
  188. package/dist/types/twisty/model/PromiseFreshener.d.ts.map +1 -0
  189. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +84 -0
  190. package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -0
  191. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts +11 -0
  192. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts.map +1 -0
  193. package/dist/types/twisty/model/helpers.d.ts +5 -0
  194. package/dist/types/twisty/model/helpers.d.ts.map +1 -0
  195. package/dist/types/twisty/model/props/TwistyProp.d.ts +60 -0
  196. package/dist/types/twisty/model/props/TwistyProp.d.ts.map +1 -0
  197. package/dist/types/twisty/model/props/TwistyProp.spec.d.ts +5 -0
  198. package/dist/types/twisty/model/props/TwistyProp.spec.d.ts.map +1 -0
  199. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +28 -0
  200. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -0
  201. package/dist/types/twisty/model/props/general/URLProp.d.ts +6 -0
  202. package/dist/types/twisty/model/props/general/URLProp.d.ts.map +1 -0
  203. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +7 -0
  204. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -0
  205. package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts +10 -0
  206. package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts.map +1 -0
  207. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +6 -0
  208. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -0
  209. package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts +27 -0
  210. package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts.map +1 -0
  211. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts +14 -0
  212. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts.map +1 -0
  213. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +15 -0
  214. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -0
  215. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +12 -0
  216. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -0
  217. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +17 -0
  218. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -0
  219. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +15 -0
  220. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -0
  221. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +17 -0
  222. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -0
  223. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts +12 -0
  224. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts.map +1 -0
  225. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +15 -0
  226. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -0
  227. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +12 -0
  228. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -0
  229. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts +13 -0
  230. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts.map +1 -0
  231. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +6 -0
  232. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -0
  233. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts +11 -0
  234. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts.map +1 -0
  235. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts +6 -0
  236. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts.map +1 -0
  237. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +11 -0
  238. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -0
  239. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +6 -0
  240. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -0
  241. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +13 -0
  242. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -0
  243. package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts +25 -0
  244. package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts.map +1 -0
  245. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +23 -0
  246. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -0
  247. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +15 -0
  248. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -0
  249. package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts +6 -0
  250. package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts.map +1 -0
  251. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +16 -0
  252. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -0
  253. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +7 -0
  254. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -0
  255. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +7 -0
  256. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -0
  257. package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts +22 -0
  258. package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts.map +1 -0
  259. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +7 -0
  260. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -0
  261. package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts +6 -0
  262. package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts.map +1 -0
  263. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +16 -0
  264. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -0
  265. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +15 -0
  266. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -0
  267. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +11 -0
  268. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -0
  269. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +7 -0
  270. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -0
  271. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +7 -0
  272. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -0
  273. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +13 -0
  274. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -0
  275. package/dist/types/twisty/{animation → old/animation}/RenderScheduler.d.ts +3 -0
  276. package/dist/types/twisty/old/animation/RenderScheduler.d.ts.map +1 -0
  277. package/dist/types/twisty/{animation → old/animation}/Timeline.d.ts +0 -0
  278. package/dist/types/twisty/old/animation/Timeline.d.ts.map +1 -0
  279. package/dist/types/twisty/{animation → old/animation}/cursor/AlgCursor.d.ts +4 -4
  280. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts.map +1 -0
  281. package/dist/types/twisty/{animation → old/animation}/cursor/CursorTypes.d.ts +4 -4
  282. package/dist/types/twisty/old/animation/cursor/CursorTypes.d.ts.map +1 -0
  283. package/dist/types/twisty/{animation → old/animation}/easing.d.ts +0 -0
  284. package/dist/types/twisty/old/animation/easing.d.ts.map +1 -0
  285. package/dist/types/twisty/{animation → old/animation}/indexer/AlgDuration.d.ts +1 -1
  286. package/dist/types/twisty/old/animation/indexer/AlgDuration.d.ts.map +1 -0
  287. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts +36 -0
  288. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +1 -0
  289. package/dist/types/twisty/{animation → old/animation}/indexer/SimpleAlgIndexer.d.ts +3 -3
  290. package/dist/types/twisty/old/animation/indexer/SimpleAlgIndexer.d.ts.map +1 -0
  291. package/dist/types/twisty/{animation → old/animation}/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +6 -5
  292. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +1 -0
  293. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +22 -0
  294. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +1 -0
  295. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts +26 -0
  296. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +1 -0
  297. package/dist/types/twisty/{animation → old/animation}/indexer/tree/AlgWalker.d.ts +2 -2
  298. package/dist/types/twisty/old/animation/indexer/tree/AlgWalker.d.ts.map +1 -0
  299. package/dist/types/twisty/{animation → old/animation}/indexer/tree/TreeAlgIndexer.d.ts +3 -3
  300. package/dist/types/twisty/old/animation/indexer/tree/TreeAlgIndexer.d.ts.map +1 -0
  301. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts +3 -0
  302. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts.map +1 -0
  303. package/dist/types/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.d.ts +1 -1
  304. package/dist/types/twisty/old/animation/stream/timeline-move-calculation-draft.d.ts.map +1 -0
  305. package/dist/types/twisty/{dom/TwistyAlgViewer.css_.d.ts → old/dom/TwistyAlgViewerV1.css.d.ts} +1 -1
  306. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts.map +1 -0
  307. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts +52 -0
  308. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts.map +1 -0
  309. package/dist/types/twisty/{dom/TwistyPlayer.css_.d.ts → old/dom/TwistyPlayer.css.d.ts} +1 -1
  310. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +1 -0
  311. package/dist/types/twisty/{dom → old/dom}/TwistyPlayer.d.ts +8 -8
  312. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts.map +1 -0
  313. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts +5 -0
  314. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts.map +1 -0
  315. package/dist/types/twisty/{dom → old/dom}/TwistyPlayerConfig.d.ts +9 -5
  316. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +1 -0
  317. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts +2 -0
  318. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts.map +1 -0
  319. package/dist/types/twisty/{dom/controls/TwistyScrubber.css_.d.ts → old/dom/controls/TwistyScrubber.css.d.ts} +1 -1
  320. package/dist/types/twisty/old/dom/controls/TwistyScrubber.css.d.ts.map +1 -0
  321. package/dist/types/twisty/{dom → old/dom}/controls/TwistyScrubber.d.ts +1 -1
  322. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts.map +1 -0
  323. package/dist/types/twisty/{dom/controls/buttons.css_.d.ts → old/dom/controls/buttons.css.d.ts} +1 -1
  324. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts.map +1 -0
  325. package/dist/types/twisty/{dom → old/dom}/controls/buttons.d.ts +1 -1
  326. package/dist/types/twisty/old/dom/controls/buttons.d.ts.map +1 -0
  327. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts +5 -0
  328. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts.map +1 -0
  329. package/dist/types/twisty/{dom → old/dom}/element/ClassListManager.d.ts +0 -0
  330. package/dist/types/twisty/old/dom/element/ClassListManager.d.ts.map +1 -0
  331. package/dist/types/twisty/{dom → old/dom}/element/ElementConfig.d.ts +1 -1
  332. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts.map +1 -0
  333. package/dist/types/twisty/{dom → old/dom}/element/ManagedCustomElement.d.ts +0 -0
  334. package/dist/types/twisty/old/dom/element/ManagedCustomElement.d.ts.map +1 -0
  335. package/dist/types/twisty/{dom → old/dom}/element/node-custom-element-shims.d.ts +0 -0
  336. package/dist/types/twisty/old/dom/element/node-custom-element-shims.d.ts.map +1 -0
  337. package/dist/types/twisty/{dom/stream/TwistyStreamSource.css_.d.ts → old/dom/stream/TwistyStreamSource.css.d.ts} +1 -1
  338. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts.map +1 -0
  339. package/dist/types/twisty/{dom → old/dom}/stream/TwistyStreamSource.d.ts +0 -0
  340. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.d.ts.map +1 -0
  341. package/dist/types/twisty/{dom → old/dom}/viewers/Twisty2DSVG.d.ts +2 -2
  342. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts.map +1 -0
  343. package/dist/types/twisty/{dom/viewers/Twisty2DSVGView.css_.d.ts → old/dom/viewers/Twisty2DSVGView.css.d.ts} +1 -1
  344. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts.map +1 -0
  345. package/dist/types/twisty/{dom/viewers/Twisty3DCanvas.css_.d.ts → old/dom/viewers/Twisty3DCanvas.css.d.ts} +1 -1
  346. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts.map +1 -0
  347. package/dist/types/twisty/{dom → old/dom}/viewers/Twisty3DCanvas.d.ts +1 -2
  348. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +1 -0
  349. package/dist/types/twisty/{dom → old/dom}/viewers/TwistyOrbitControls.d.ts +0 -0
  350. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts.map +1 -0
  351. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts +4 -0
  352. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts.map +1 -0
  353. package/dist/types/twisty/{dom/viewers/TwistyViewerWrapper.css_.d.ts → old/dom/viewers/TwistyViewerWrapper.css.d.ts} +1 -1
  354. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts.map +1 -0
  355. package/dist/types/twisty/{dom → old/dom}/viewers/TwistyViewerWrapper.d.ts +0 -0
  356. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts.map +1 -0
  357. package/dist/types/twisty/old/dom/viewers/canvas.d.ts +3 -0
  358. package/dist/types/twisty/old/dom/viewers/canvas.d.ts.map +1 -0
  359. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +29 -0
  360. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +1 -0
  361. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +16 -0
  362. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +1 -0
  363. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +20 -0
  364. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +1 -0
  365. package/dist/types/twisty/views/3D/RendererPool.d.ts +4 -0
  366. package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -0
  367. package/dist/types/twisty/{3D → views/3D}/TAU.d.ts +0 -0
  368. package/dist/types/twisty/views/3D/TAU.d.ts.map +1 -0
  369. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +17 -0
  370. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -0
  371. package/dist/types/twisty/{3D → views/3D}/Twisty3DRenderTarget.d.ts +0 -0
  372. package/dist/types/twisty/views/3D/Twisty3DRenderTarget.d.ts.map +1 -0
  373. package/dist/types/twisty/{3D → views/3D}/Twisty3DScene.d.ts +0 -0
  374. package/dist/types/twisty/views/3D/Twisty3DScene.d.ts.map +1 -0
  375. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +28 -0
  376. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -0
  377. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +32 -0
  378. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -0
  379. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +41 -0
  380. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +1 -0
  381. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts +5 -0
  382. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts.map +1 -0
  383. package/dist/types/twisty/{3D → views/3D}/puzzles/Cube3D.d.ts +11 -7
  384. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +1 -0
  385. package/dist/types/twisty/{3D → views/3D}/puzzles/KPuzzleWrapper.d.ts +2 -2
  386. package/dist/types/twisty/views/3D/puzzles/KPuzzleWrapper.d.ts.map +1 -0
  387. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +57 -0
  388. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +1 -0
  389. package/dist/types/twisty/{3D → views/3D}/puzzles/Twisty3DPuzzle.d.ts +1 -1
  390. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +1 -0
  391. package/dist/types/twisty/{3D → views/3D}/puzzles/TwistyTestBox.d.ts +2 -2
  392. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +1 -0
  393. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +18 -0
  394. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +1 -0
  395. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +3 -0
  396. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +1 -0
  397. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +40 -0
  398. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -0
  399. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts +5 -0
  400. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts.map +1 -0
  401. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts +61 -0
  402. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts.map +1 -0
  403. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +3 -0
  404. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +1 -0
  405. package/dist/types/twisty/{dom → views}/TwistyAlgViewer.d.ts +6 -6
  406. package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +1 -0
  407. package/dist/types/twisty/views/TwistyPlayer.d.ts +97 -0
  408. package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -0
  409. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +71 -0
  410. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -0
  411. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +33 -0
  412. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -0
  413. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +14 -0
  414. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -0
  415. package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts +15 -0
  416. package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts.map +1 -0
  417. package/dist/types/twisty/views/document.d.ts +2 -0
  418. package/dist/types/twisty/views/document.d.ts.map +1 -0
  419. package/dist/types/twisty/views/screenshot.d.ts +12 -0
  420. package/dist/types/twisty/views/screenshot.d.ts.map +1 -0
  421. package/dist/types/vendor/p-lazy/p-lazy.d.ts +10 -0
  422. package/dist/types/vendor/p-lazy/p-lazy.d.ts.map +1 -0
  423. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts +33 -0
  424. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts.map +1 -0
  425. package/docs/.DS_Store +0 -0
  426. package/docs/cubing/.DS_Store +0 -0
  427. package/docs/cubing/alg/index.html +37 -23
  428. package/docs/cubing/index.html +56 -252
  429. package/docs/cubing/scramble/index.html +122 -0
  430. package/docs/cubing/twisty/index.html +329 -0
  431. package/docs/main.css +15 -3
  432. package/package.json +83 -57
  433. package/src/cubing/.DS_Store +0 -0
  434. package/src/cubing/alg/.DS_Store +0 -0
  435. package/src/cubing/alg/Alg.ts +89 -0
  436. package/src/cubing/alg/common.ts +4 -2
  437. package/src/cubing/alg/iteration.ts +1 -1
  438. package/src/cubing/alg/parse.ts +2 -0
  439. package/src/cubing/alg/test/alg-comparison.ts +1 -0
  440. package/src/cubing/alg/units/.DS_Store +0 -0
  441. package/src/cubing/alg/units/Unit.ts +0 -3
  442. package/src/cubing/alg/units/containers/Commutator.ts +1 -1
  443. package/src/cubing/alg/units/leaves/Move.ts +4 -4
  444. package/src/cubing/bluetooth/.DS_Store +0 -0
  445. package/src/cubing/bluetooth/connect/index.ts +1 -1
  446. package/src/cubing/bluetooth/smart-puzzle/Heykube.ts +1 -1
  447. package/src/cubing/bluetooth/smart-puzzle/bluetooth-puzzle.ts +1 -1
  448. package/src/cubing/bluetooth/smart-puzzle/gan.ts +5 -5
  449. package/src/cubing/bluetooth/smart-puzzle/giiker.ts +2 -2
  450. package/src/cubing/bluetooth/smart-puzzle/gocube.ts +5 -5
  451. package/src/cubing/bluetooth/smart-robot/GanRobot.ts +5 -5
  452. package/src/cubing/bluetooth/smart-timer/GanTimer.ts +2 -2
  453. package/src/cubing/{solve → kpuzzle}/.DS_Store +0 -0
  454. package/src/cubing/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.ts +40 -0
  455. package/src/cubing/{puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.ts → kpuzzle/3x3x3/3x3x3.kpuzzle.json.ts} +11 -6
  456. package/src/cubing/kpuzzle/canon.spec.ts +6 -11
  457. package/src/cubing/kpuzzle/canonicalize.ts +1 -1
  458. package/src/cubing/kpuzzle/definition_types.ts +0 -3
  459. package/src/cubing/kpuzzle/index.ts +1 -0
  460. package/src/cubing/kpuzzle/prunetable.spec.ts +2 -4
  461. package/src/cubing/kpuzzle/puzzle-orientation.ts +1 -1
  462. package/src/cubing/kpuzzle/svg.ts +4 -9
  463. package/src/cubing/kpuzzle/transformations.ts +1 -1
  464. package/src/cubing/protocol/binary/binary3x3x3.spec.ts +5 -2
  465. package/src/cubing/protocol/binary/hex.ts +4 -4
  466. package/src/cubing/protocol/binary/orbit-indexing.ts +2 -2
  467. package/src/cubing/protocol/binary/puzzle-orientation.ts +2 -2
  468. package/src/cubing/puzzle-geometry/Options.ts +151 -22
  469. package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +24 -28
  470. package/src/cubing/puzzle-geometry/PermOriSet.ts +99 -98
  471. package/src/cubing/puzzle-geometry/PlatonicGenerator.ts +1 -1
  472. package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +836 -867
  473. package/src/cubing/puzzle-geometry/Quat.ts +1 -68
  474. package/src/cubing/puzzle-geometry/SchreierSims.ts +2 -13
  475. package/src/cubing/puzzle-geometry/index.ts +2 -11
  476. package/src/cubing/puzzle-geometry/interfaces.ts +1 -27
  477. package/src/cubing/puzzle-geometry/orientcenters.spec.ts +24 -30
  478. package/src/cubing/puzzles/.DS_Store +0 -0
  479. package/src/cubing/puzzles/async/async-pg3d.ts +5 -8
  480. package/src/cubing/puzzles/customPGPuzzleLoader.ts +60 -0
  481. package/src/cubing/puzzles/implementations/.DS_Store +0 -0
  482. package/src/cubing/puzzles/implementations/2x2x2/{2x2x2.kpuzzle.json_.ts → 2x2x2.kpuzzle.json.ts} +0 -0
  483. package/src/cubing/puzzles/implementations/2x2x2/index.ts +1 -1
  484. package/src/cubing/puzzles/implementations/3x3x3/index.ts +2 -3
  485. package/src/cubing/puzzles/implementations/clock/{clock.kpuzzle.json_.ts → clock.kpuzzle.json.ts} +0 -0
  486. package/src/cubing/puzzles/implementations/clock/index.ts +1 -1
  487. package/src/cubing/puzzles/implementations/pyraminx/{pyraminx.kpuzzle.json_.ts → pyraminx.kpuzzle.json.ts} +0 -0
  488. package/src/cubing/puzzles/implementations/square1/index.ts +1 -2
  489. package/src/cubing/puzzles/implementations/square1/{sq1-hyperorbit.kpuzzle.json_.ts → sq1-hyperorbit.kpuzzle.json.ts} +0 -0
  490. package/src/cubing/puzzles/index.ts +5 -2
  491. package/src/cubing/puzzles/stickerings/appearance.ts +10 -9
  492. package/src/cubing/puzzles/stickerings/cube-stickerings.ts +8 -0
  493. package/src/cubing/puzzles/stickerings/global-custom-stickering-hack.ts +61 -0
  494. package/src/cubing/search/.DS_Store +0 -0
  495. package/src/cubing/search/.gitignore +1 -2
  496. package/src/cubing/search/esm-test-worker.js +1 -1
  497. package/src/cubing/search/index.ts +1 -0
  498. package/src/cubing/search/inside/api.ts +5 -1
  499. package/src/cubing/search/inside/solve/parseSGS.ts +7 -11
  500. package/src/cubing/search/inside/solve/puzzles/2x2x2.ts +3 -3
  501. package/src/cubing/search/inside/solve/puzzles/3x3x3/filter.ts +0 -6
  502. package/src/cubing/search/inside/solve/puzzles/3x3x3/index.ts +0 -2
  503. package/src/cubing/search/inside/solve/puzzles/FTO.sgs +264 -0
  504. package/src/cubing/search/inside/solve/puzzles/megaminx.sgs.json.ts +4 -6
  505. package/src/cubing/search/inside/solve/puzzles/skewb.sgs.json.ts +4 -6
  506. package/src/cubing/search/inside/solve/tremble.ts +6 -9
  507. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.ts +20 -822
  508. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.ts +177 -252
  509. package/src/cubing/search/inside/solve/vendor/min2phase/gwt.js +62 -222
  510. package/src/cubing/search/inside/solve/vendor/random-uint-below/get-random-values.ts +4 -5
  511. package/src/cubing/search/inside/solve/vendor/random-uint-below/random-int.ts +9 -11
  512. package/src/cubing/search/inside/solve/vendor/sq12phase/scramble_sq1.js +13 -582
  513. package/src/cubing/search/instantiator.ts +11 -7
  514. package/src/cubing/search/outside.ts +8 -2
  515. package/src/cubing/search/worker-inside-generated-string.js +1 -1
  516. package/src/cubing/stream/.DS_Store +0 -0
  517. package/src/cubing/stream/process/ReorientedStream.ts +1 -1
  518. package/src/cubing/stream/twizzle/TwizzleStream.ts +11 -8
  519. package/src/cubing/stream/websocket-proxy.ts +1 -3
  520. package/src/cubing/twisty/.DS_Store +0 -0
  521. package/src/cubing/twisty/controllers/TwistyAnimationController.ts +248 -0
  522. package/src/cubing/twisty/controllers/TwistyPlayerController.ts +38 -0
  523. package/src/cubing/twisty/heavy-code-imports/3d.ts +18 -0
  524. package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +41 -0
  525. package/src/cubing/twisty/index.ts +24 -17
  526. package/src/cubing/{protocol → twisty/model}/.DS_Store +0 -0
  527. package/src/cubing/twisty/model/PromiseFreshener.ts +49 -0
  528. package/src/cubing/twisty/model/TwistyPlayerModel.ts +222 -0
  529. package/src/cubing/twisty/model/UserVisibleErrorTracker.ts +22 -0
  530. package/src/cubing/twisty/model/helpers.ts +47 -0
  531. package/src/cubing/{search/vendor → twisty/model/props}/.DS_Store +0 -0
  532. package/src/cubing/twisty/model/props/TwistyProp.spec.ts +38 -0
  533. package/src/cubing/twisty/model/props/TwistyProp.ts +366 -0
  534. package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +370 -0
  535. package/src/cubing/twisty/model/props/general/URLProp.ts +14 -0
  536. package/src/cubing/twisty/{3D → model/props/puzzle}/.DS_Store +0 -0
  537. package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +10 -0
  538. package/src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts +43 -0
  539. package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +8 -0
  540. package/src/cubing/twisty/model/props/puzzle/state/AlgProp.ts +91 -0
  541. package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +28 -0
  542. package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +44 -0
  543. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +91 -0
  544. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +48 -0
  545. package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +46 -0
  546. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +46 -0
  547. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.ts +15 -0
  548. package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +24 -0
  549. package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +22 -0
  550. package/src/cubing/twisty/model/props/puzzle/state/PuzzleAlgProp.ts +28 -0
  551. package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +8 -0
  552. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDefProp.ts +14 -0
  553. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.ts +14 -0
  554. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +12 -0
  555. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +17 -0
  556. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +38 -0
  557. package/src/cubing/twisty/model/props/timeline/CoarseTimelineInfoProp.ts +45 -0
  558. package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +76 -0
  559. package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +51 -0
  560. package/src/cubing/twisty/model/props/timeline/TempoScaleProp.ts +13 -0
  561. package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +38 -0
  562. package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +10 -0
  563. package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +10 -0
  564. package/src/cubing/twisty/model/props/viewer/ButtonAppearanceProp.ts +86 -0
  565. package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +10 -0
  566. package/src/cubing/twisty/model/props/viewer/LatitudeLimit.ts +11 -0
  567. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +56 -0
  568. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +69 -0
  569. package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +15 -0
  570. package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +10 -0
  571. package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +10 -0
  572. package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +45 -0
  573. package/src/cubing/twisty/{animation → old}/.DS_Store +0 -0
  574. package/src/cubing/{search/inside → twisty/old/animation}/.DS_Store +0 -0
  575. package/src/cubing/twisty/{animation → old/animation}/RenderScheduler.ts +5 -0
  576. package/src/cubing/twisty/{animation → old/animation}/Timeline.ts +0 -0
  577. package/src/cubing/twisty/{animation → old/animation}/cursor/AlgCursor.ts +15 -8
  578. package/src/cubing/twisty/{animation → old/animation}/cursor/CursorTypes.ts +4 -4
  579. package/src/cubing/twisty/{animation → old/animation}/easing.ts +0 -0
  580. package/src/cubing/twisty/old/animation/indexer/.DS_Store +0 -0
  581. package/src/cubing/twisty/{animation → old/animation}/indexer/AlgDuration.ts +1 -1
  582. package/src/cubing/twisty/old/animation/indexer/AlgIndexer.ts +86 -0
  583. package/src/cubing/twisty/{animation → old/animation}/indexer/SimpleAlgIndexer.ts +9 -6
  584. package/src/cubing/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +181 -0
  585. package/src/cubing/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +243 -0
  586. package/src/cubing/twisty/{animation → old/animation}/indexer/simultaneous-moves/simul-moves.ts +46 -34
  587. package/src/cubing/twisty/{animation → old/animation}/indexer/tree/AlgWalker.ts +6 -3
  588. package/src/cubing/twisty/{animation → old/animation}/indexer/tree/TreeAlgIndexer.ts +8 -5
  589. package/src/cubing/twisty/{animation → old/animation}/indexer/tree/chunkAlgs.ts +2 -2
  590. package/src/cubing/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -0
  591. package/src/cubing/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.ts +2 -2
  592. package/src/cubing/{search/vendor/comlink-everywhere → twisty/old/dom}/.DS_Store +0 -0
  593. package/src/cubing/twisty/{dom/TwistyAlgViewer.css_.ts → old/dom/TwistyAlgViewerV1.css.ts} +0 -0
  594. package/src/cubing/twisty/{dom/TwistyAlgViewer.ts → old/dom/TwistyAlgViewerV1.ts} +43 -36
  595. package/src/cubing/twisty/{dom/TwistyPlayer.css_.ts → old/dom/TwistyPlayer.css.ts} +28 -1
  596. package/src/cubing/twisty/{dom → old/dom}/TwistyPlayer.spec.ts +5 -6
  597. package/src/cubing/twisty/{dom → old/dom}/TwistyPlayer.ts +36 -43
  598. package/src/cubing/twisty/{dom → old/dom}/TwistyPlayerConfig.ts +26 -10
  599. package/src/cubing/twisty/{dom/controls/TwistyControlElement.ts.ts → old/dom/controls/TwistyControlElement.ts} +0 -0
  600. package/src/cubing/twisty/{dom/controls/TwistyScrubber.css_.ts → old/dom/controls/TwistyScrubber.css.ts} +0 -0
  601. package/src/cubing/twisty/{dom → old/dom}/controls/TwistyScrubber.ts +3 -3
  602. package/src/cubing/twisty/{dom/controls/buttons.css_.ts → old/dom/controls/buttons.css.ts} +14 -1
  603. package/src/cubing/twisty/{dom → old/dom}/controls/buttons.spec.ts +1 -1
  604. package/src/cubing/twisty/{dom → old/dom}/controls/buttons.ts +15 -15
  605. package/src/cubing/twisty/{dom → old/dom}/element/ClassListManager.ts +0 -0
  606. package/src/cubing/twisty/{dom → old/dom}/element/ElementConfig.ts +1 -1
  607. package/src/cubing/twisty/{dom → old/dom}/element/ManagedCustomElement.ts +0 -0
  608. package/src/cubing/twisty/{dom → old/dom}/element/node-custom-element-shims.ts +0 -0
  609. package/src/cubing/twisty/{dom/stream/TwistyStreamSource.css_.ts → old/dom/stream/TwistyStreamSource.css.ts} +0 -0
  610. package/src/cubing/twisty/{dom → old/dom}/stream/TwistyStreamSource.ts +8 -8
  611. package/src/cubing/twisty/{dom → old/dom}/viewers/Twisty2DSVG.ts +7 -9
  612. package/src/cubing/twisty/{dom/viewers/Twisty2DSVGView.css_.ts → old/dom/viewers/Twisty2DSVGView.css.ts} +0 -0
  613. package/src/cubing/twisty/{dom/viewers/Twisty3DCanvas.css_.ts → old/dom/viewers/Twisty3DCanvas.css.ts} +0 -0
  614. package/src/cubing/twisty/{dom → old/dom}/viewers/Twisty3DCanvas.ts +5 -12
  615. package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyOrbitControls.ts +57 -20
  616. package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyViewerElement.ts +1 -1
  617. package/src/cubing/twisty/{dom/viewers/TwistyViewerWrapper.css_.ts → old/dom/viewers/TwistyViewerWrapper.css.ts} +0 -0
  618. package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyViewerWrapper.ts +1 -1
  619. package/src/cubing/twisty/old/dom/viewers/canvas.ts +9 -0
  620. package/src/cubing/twisty/{dom/twisty-player-model → views}/.DS_Store +0 -0
  621. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +150 -0
  622. package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +52 -0
  623. package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +77 -0
  624. package/src/cubing/twisty/views/3D/RendererPool.ts +53 -0
  625. package/src/cubing/twisty/{3D → views/3D}/TAU.ts +0 -0
  626. package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +168 -0
  627. package/src/cubing/twisty/{3D → views/3D}/Twisty3DRenderTarget.ts +0 -0
  628. package/src/cubing/twisty/{3D → views/3D}/Twisty3DScene.ts +0 -0
  629. package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +144 -0
  630. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +244 -0
  631. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +209 -0
  632. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +270 -0
  633. package/src/cubing/twisty/{3D → views/3D}/puzzles/Cube3D.ts +36 -15
  634. package/src/cubing/twisty/{3D → views/3D}/puzzles/KPuzzleWrapper.ts +4 -5
  635. package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +988 -0
  636. package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +6 -0
  637. package/src/cubing/twisty/{3D → views/3D}/puzzles/TwistyTestBox.ts +2 -2
  638. package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +116 -0
  639. package/src/cubing/twisty/{dom/TwistyAlgEditor.css_.ts → views/TwistyAlgEditor/TwistyAlgEditor.css.ts} +3 -1
  640. package/src/cubing/twisty/{dom → views/TwistyAlgEditor}/TwistyAlgEditor.spec.ts +7 -6
  641. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +360 -0
  642. package/src/cubing/twisty/views/TwistyAlgEditor/model.ts +179 -0
  643. package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +25 -0
  644. package/src/cubing/twisty/views/TwistyAlgViewer.ts +502 -0
  645. package/src/cubing/twisty/views/TwistyPlayer.ts +327 -0
  646. package/src/cubing/twisty/views/TwistyPlayerSettable.ts +111 -0
  647. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +159 -0
  648. package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +145 -0
  649. package/src/cubing/twisty/views/control-panel/webkit-fullscreen.ts +44 -0
  650. package/src/cubing/twisty/views/document.ts +4 -0
  651. package/src/cubing/twisty/views/screenshot.ts +90 -0
  652. package/src/cubing/{twisty/animation/indexer → vendor}/.DS_Store +0 -0
  653. package/src/cubing/vendor/p-lazy/license +9 -0
  654. package/src/cubing/vendor/p-lazy/p-lazy.ts +52 -0
  655. package/src/cubing/vendor/p-lazy/readme.md +54 -0
  656. package/src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts +179 -0
  657. package/dist/esm/chunk-CWVB5RRW.js.map +0 -7
  658. package/dist/esm/chunk-KKSDHNLH.js.map +0 -7
  659. package/dist/esm/chunk-YNB7QLBF.js.map +0 -7
  660. package/dist/esm/worker-inside-generated-string-LT4NV55Q.js +0 -2826
  661. package/dist/esm/worker-inside-generated-string-LT4NV55Q.js.map +0 -7
  662. package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json_.d.ts.map +0 -1
  663. package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.d.ts +0 -3
  664. package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.d.ts.map +0 -1
  665. package/dist/types/puzzles/implementations/clock/clock.kpuzzle.json_.d.ts.map +0 -1
  666. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json_.d.ts.map +0 -1
  667. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json_.d.ts.map +0 -1
  668. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.d.ts +0 -3
  669. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.d.ts.map +0 -1
  670. package/dist/types/twisty/3D/TAU.d.ts.map +0 -1
  671. package/dist/types/twisty/3D/Twisty3DRenderTarget.d.ts.map +0 -1
  672. package/dist/types/twisty/3D/Twisty3DScene.d.ts.map +0 -1
  673. package/dist/types/twisty/3D/puzzles/Cube3D.d.ts.map +0 -1
  674. package/dist/types/twisty/3D/puzzles/KPuzzleWrapper.d.ts.map +0 -1
  675. package/dist/types/twisty/3D/puzzles/PG3D.d.ts +0 -51
  676. package/dist/types/twisty/3D/puzzles/PG3D.d.ts.map +0 -1
  677. package/dist/types/twisty/3D/puzzles/Twisty3DPuzzle.d.ts.map +0 -1
  678. package/dist/types/twisty/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
  679. package/dist/types/twisty/animation/RenderScheduler.d.ts.map +0 -1
  680. package/dist/types/twisty/animation/Timeline.d.ts.map +0 -1
  681. package/dist/types/twisty/animation/cursor/AlgCursor.d.ts.map +0 -1
  682. package/dist/types/twisty/animation/cursor/CursorTypes.d.ts.map +0 -1
  683. package/dist/types/twisty/animation/easing.d.ts.map +0 -1
  684. package/dist/types/twisty/animation/indexer/AlgDuration.d.ts.map +0 -1
  685. package/dist/types/twisty/animation/indexer/AlgIndexer.d.ts +0 -15
  686. package/dist/types/twisty/animation/indexer/AlgIndexer.d.ts.map +0 -1
  687. package/dist/types/twisty/animation/indexer/SimpleAlgIndexer.d.ts.map +0 -1
  688. package/dist/types/twisty/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
  689. package/dist/types/twisty/animation/indexer/simultaneous-moves/simul-moves.d.ts +0 -25
  690. package/dist/types/twisty/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
  691. package/dist/types/twisty/animation/indexer/tree/AlgWalker.d.ts.map +0 -1
  692. package/dist/types/twisty/animation/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
  693. package/dist/types/twisty/animation/indexer/tree/chunkAlgs.d.ts +0 -3
  694. package/dist/types/twisty/animation/indexer/tree/chunkAlgs.d.ts.map +0 -1
  695. package/dist/types/twisty/animation/stream/timeline-move-calculation-draft.d.ts.map +0 -1
  696. package/dist/types/twisty/dom/TwistyAlgEditor.css_.d.ts +0 -3
  697. package/dist/types/twisty/dom/TwistyAlgEditor.css_.d.ts.map +0 -1
  698. package/dist/types/twisty/dom/TwistyAlgEditor.d.ts +0 -27
  699. package/dist/types/twisty/dom/TwistyAlgEditor.d.ts.map +0 -1
  700. package/dist/types/twisty/dom/TwistyAlgEditorStartCharSearch.d.ts +0 -26
  701. package/dist/types/twisty/dom/TwistyAlgEditorStartCharSearch.d.ts.map +0 -1
  702. package/dist/types/twisty/dom/TwistyAlgViewer.css_.d.ts.map +0 -1
  703. package/dist/types/twisty/dom/TwistyAlgViewer.d.ts.map +0 -1
  704. package/dist/types/twisty/dom/TwistyPlayer.css_.d.ts.map +0 -1
  705. package/dist/types/twisty/dom/TwistyPlayer.d.ts.map +0 -1
  706. package/dist/types/twisty/dom/TwistyPlayerConfig.d.ts.map +0 -1
  707. package/dist/types/twisty/dom/controls/TwistyControlElement.ts.d.ts +0 -2
  708. package/dist/types/twisty/dom/controls/TwistyControlElement.ts.d.ts.map +0 -1
  709. package/dist/types/twisty/dom/controls/TwistyScrubber.css_.d.ts.map +0 -1
  710. package/dist/types/twisty/dom/controls/TwistyScrubber.d.ts.map +0 -1
  711. package/dist/types/twisty/dom/controls/buttons.css_.d.ts.map +0 -1
  712. package/dist/types/twisty/dom/controls/buttons.d.ts.map +0 -1
  713. package/dist/types/twisty/dom/element/ClassListManager.d.ts.map +0 -1
  714. package/dist/types/twisty/dom/element/ElementConfig.d.ts.map +0 -1
  715. package/dist/types/twisty/dom/element/ManagedCustomElement.d.ts.map +0 -1
  716. package/dist/types/twisty/dom/element/node-custom-element-shims.d.ts.map +0 -1
  717. package/dist/types/twisty/dom/stream/TwistyStreamSource.css_.d.ts.map +0 -1
  718. package/dist/types/twisty/dom/stream/TwistyStreamSource.d.ts.map +0 -1
  719. package/dist/types/twisty/dom/viewers/Twisty2DSVG.d.ts.map +0 -1
  720. package/dist/types/twisty/dom/viewers/Twisty2DSVGView.css_.d.ts.map +0 -1
  721. package/dist/types/twisty/dom/viewers/Twisty3DCanvas.css_.d.ts.map +0 -1
  722. package/dist/types/twisty/dom/viewers/Twisty3DCanvas.d.ts.map +0 -1
  723. package/dist/types/twisty/dom/viewers/TwistyOrbitControls.d.ts.map +0 -1
  724. package/dist/types/twisty/dom/viewers/TwistyViewerElement.d.ts +0 -4
  725. package/dist/types/twisty/dom/viewers/TwistyViewerElement.d.ts.map +0 -1
  726. package/dist/types/twisty/dom/viewers/TwistyViewerWrapper.css_.d.ts.map +0 -1
  727. package/dist/types/twisty/dom/viewers/TwistyViewerWrapper.d.ts.map +0 -1
  728. package/dist/types/twisty/dom/viewers/canvas.d.ts +0 -2
  729. package/dist/types/twisty/dom/viewers/canvas.d.ts.map +0 -1
  730. package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts +0 -2
  731. package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts.map +0 -1
  732. package/dist/types/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts +0 -21
  733. package/dist/types/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts.map +0 -1
  734. package/src/cubing/puzzle-geometry/.DS_Store +0 -0
  735. package/src/cubing/search/inside/solve/.DS_Store +0 -0
  736. package/src/cubing/search/inside/solve/puzzles/.DS_Store +0 -0
  737. package/src/cubing/search/inside/solve/puzzles/3x3x3/.DS_Store +0 -0
  738. package/src/cubing/search/inside/solve/vendor/.DS_Store +0 -0
  739. package/src/cubing/search/inside/solve/vendor/cstimer/.DS_Store +0 -0
  740. package/src/cubing/search/inside/solve/vendor/cstimer/src/.DS_Store +0 -0
  741. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/.DS_Store +0 -0
  742. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/.DS_Store +0 -0
  743. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.ts +0 -13
  744. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lib/.DS_Store +0 -0
  745. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/scramble/.DS_Store +0 -0
  746. package/src/cubing/search/inside/solve/vendor/sgs/.DS_Store +0 -0
  747. package/src/cubing/search/inside/solve/vendor/sgs/src/.DS_Store +0 -0
  748. package/src/cubing/search/inside/solve/vendor/sgs/src/test/.DS_Store +0 -0
  749. package/src/cubing/twisty/3D/puzzles/PG3D.ts +0 -600
  750. package/src/cubing/twisty/3D/puzzles/Twisty3DPuzzle.ts +0 -9
  751. package/src/cubing/twisty/3D/puzzles/mkbhd.svg +0 -5
  752. package/src/cubing/twisty/animation/indexer/AlgIndexer.ts +0 -25
  753. package/src/cubing/twisty/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +0 -168
  754. package/src/cubing/twisty/dom/.DS_Store +0 -0
  755. package/src/cubing/twisty/dom/TwistyAlgEditor.ts +0 -373
  756. package/src/cubing/twisty/dom/TwistyAlgEditorStartCharSearch.ts +0 -138
  757. package/src/cubing/twisty/dom/viewers/canvas.ts +0 -4
  758. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.ts +0 -2
  759. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts +0 -24
  760. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.wrapped.js +0 -178
@@ -1,127 +1,107 @@
1
1
  import {
2
2
  Move,
3
3
  QuantumMove
4
- } from "../chunk-YNB7QLBF.js";
5
- import "../chunk-WJ7AVUI7.js";
4
+ } from "../chunk-BU5PUJK3.js";
5
+ import "../chunk-WO2AXYFE.js";
6
6
 
7
- // src/cubing/puzzle-geometry/Perm.ts
8
- var zeroCache = [];
9
- var iotaCache = [];
10
- function zeros(n) {
11
- if (!zeroCache[n]) {
12
- const c = Array(n);
13
- for (let i = 0; i < n; i++) {
14
- c[i] = 0;
15
- }
16
- zeroCache[n] = c;
17
- }
18
- return zeroCache[n];
19
- }
20
- function iota(n) {
21
- if (!iotaCache[n]) {
22
- const c = Array(n);
23
- for (let i = 0; i < n; i++) {
24
- c[i] = i;
7
+ // src/cubing/puzzle-geometry/FaceNameSwizzler.ts
8
+ var FaceNameSwizzler = class {
9
+ constructor(facenames, gripnames_arg) {
10
+ this.facenames = facenames;
11
+ this.prefixFree = true;
12
+ this.gripnames = [];
13
+ if (gripnames_arg) {
14
+ this.gripnames = gripnames_arg;
25
15
  }
26
- iotaCache[n] = c;
27
- }
28
- return iotaCache[n];
29
- }
30
- function identity(n) {
31
- return new Perm(iota(n));
32
- }
33
- function factorial(a) {
34
- let r = 1;
35
- while (a > 1) {
36
- r *= a;
37
- a--;
38
- }
39
- return r;
40
- }
41
- function gcd(a, b) {
42
- if (a > b) {
43
- const t = a;
44
- a = b;
45
- b = t;
46
- }
47
- while (a > 0) {
48
- const m = b % a;
49
- b = a;
50
- a = m;
51
- }
52
- return b;
53
- }
54
- function lcm(a, b) {
55
- return a / gcd(a, b) * b;
56
- }
57
- var Perm = class {
58
- constructor(a) {
59
- this.n = a.length;
60
- this.p = a;
61
- }
62
- toString() {
63
- return "Perm[" + this.p.join(" ") + "]";
64
- }
65
- mul(p2) {
66
- const c = Array(this.n);
67
- for (let i = 0; i < this.n; i++) {
68
- c[i] = p2.p[this.p[i]];
16
+ for (let i = 0; this.prefixFree && i < facenames.length; i++) {
17
+ for (let j = 0; this.prefixFree && j < facenames.length; j++) {
18
+ if (i !== j && facenames[i].startsWith(facenames[j])) {
19
+ this.prefixFree = false;
20
+ }
21
+ }
69
22
  }
70
- return new Perm(c);
71
23
  }
72
- rmul(p2) {
73
- const c = Array(this.n);
74
- for (let i = 0; i < this.n; i++) {
75
- c[i] = this.p[p2.p[i]];
76
- }
77
- return new Perm(c);
24
+ setGripNames(names) {
25
+ this.gripnames = names;
78
26
  }
79
- inv() {
80
- const c = Array(this.n);
81
- for (let i = 0; i < this.n; i++) {
82
- c[this.p[i]] = i;
27
+ splitByFaceNames(s) {
28
+ const r = [];
29
+ let at = 0;
30
+ while (at < s.length) {
31
+ if (at > 0 && at < s.length && s[at] === "_") {
32
+ at++;
33
+ }
34
+ let currentMatch = -1;
35
+ for (let i = 0; i < this.facenames.length; i++) {
36
+ if (s.substr(at).startsWith(this.facenames[i]) && (currentMatch < 0 || this.facenames[i].length > this.facenames[currentMatch].length)) {
37
+ currentMatch = i;
38
+ }
39
+ }
40
+ if (currentMatch >= 0) {
41
+ r.push(currentMatch);
42
+ at += this.facenames[currentMatch].length;
43
+ } else {
44
+ throw new Error("Could not split " + s + " into face names.");
45
+ }
83
46
  }
84
- return new Perm(c);
47
+ return r;
85
48
  }
86
- compareTo(p2) {
87
- for (let i = 0; i < this.n; i++) {
88
- if (this.p[i] !== p2.p[i]) {
89
- return this.p[i] - p2.p[i];
49
+ joinByFaceIndices(list) {
50
+ let sep = "";
51
+ const r = [];
52
+ for (let i = 0; i < list.length; i++) {
53
+ r.push(sep);
54
+ r.push(this.facenames[list[i]]);
55
+ if (!this.prefixFree) {
56
+ sep = "_";
90
57
  }
91
58
  }
92
- return 0;
59
+ return r.join("");
93
60
  }
94
- toGap() {
95
- const cyc = new Array();
96
- const seen = new Array(this.n);
97
- for (let i = 0; i < this.p.length; i++) {
98
- if (seen[i] || this.p[i] === i) {
99
- continue;
61
+ spinmatch(userinput, longname) {
62
+ if (userinput === longname) {
63
+ return true;
64
+ }
65
+ try {
66
+ const e1 = this.splitByFaceNames(userinput);
67
+ const e2 = this.splitByFaceNames(longname);
68
+ if (e1.length !== e2.length && e1.length < 3) {
69
+ return false;
100
70
  }
101
- const incyc = new Array();
102
- for (let j = i; !seen[j]; j = this.p[j]) {
103
- incyc.push(1 + j);
104
- seen[j] = true;
71
+ for (let i = 0; i < e1.length; i++) {
72
+ for (let j = 0; j < i; j++) {
73
+ if (e1[i] === e1[j]) {
74
+ return false;
75
+ }
76
+ }
77
+ let found = false;
78
+ for (let j = 0; j < e2.length; j++) {
79
+ if (e1[i] === e2[j]) {
80
+ found = true;
81
+ break;
82
+ }
83
+ }
84
+ if (!found) {
85
+ return false;
86
+ }
105
87
  }
106
- cyc.push("(" + incyc.join(",") + ")");
88
+ return true;
89
+ } catch (e) {
90
+ return false;
107
91
  }
108
- return cyc.join("");
109
92
  }
110
- order() {
111
- let r = 1;
112
- const seen = new Array(this.n);
113
- for (let i = 0; i < this.p.length; i++) {
114
- if (seen[i] || this.p[i] === i) {
115
- continue;
116
- }
117
- let cs = 0;
118
- for (let j = i; !seen[j]; j = this.p[j]) {
119
- cs++;
120
- seen[j] = true;
93
+ unswizzle(s) {
94
+ if ((s.endsWith("v") || s.endsWith("w")) && s[0] <= "Z") {
95
+ s = s.slice(0, s.length - 1);
96
+ }
97
+ const upperCaseGrip = s.toUpperCase();
98
+ for (let i = 0; i < this.gripnames.length; i++) {
99
+ const g = this.gripnames[i];
100
+ if (this.spinmatch(upperCaseGrip, g)) {
101
+ return g;
121
102
  }
122
- r = lcm(r, cs);
123
103
  }
124
- return r;
104
+ return s;
125
105
  }
126
106
  };
127
107
 
@@ -465,8 +445,204 @@ var SkewbNotationMapper = class {
465
445
  }
466
446
  };
467
447
 
448
+ // src/cubing/puzzle-geometry/Options.ts
449
+ function parseOptions(argv) {
450
+ let argp = 0;
451
+ const options = {};
452
+ while (argp < argv.length && argv[argp][0] === "-") {
453
+ const option = argv[argp++];
454
+ if (option === "--rotations") {
455
+ options.addRotations = true;
456
+ } else if (option === "--allmoves") {
457
+ options.allMoves = true;
458
+ } else if (option === "--outerblockmoves") {
459
+ options.outerBlockMoves = true;
460
+ } else if (option === "--vertexmoves") {
461
+ options.vertexMoves = true;
462
+ } else if (option === "--nocorners") {
463
+ options.includeCornerOrbits = false;
464
+ } else if (option === "--noedges") {
465
+ options.includeEdgeOrbits = false;
466
+ } else if (option === "--noorientation") {
467
+ options.fixedOrientation = true;
468
+ } else if (option === "--nocenters") {
469
+ options.includeCenterOrbits = false;
470
+ } else if (option === "--omit") {
471
+ options.excludeOrbits = argv[argp].split(",");
472
+ argp++;
473
+ } else if (option === "--moves") {
474
+ options.moveList = argv[argp].split(",");
475
+ argp++;
476
+ } else if (option === "--optimize") {
477
+ options.optimizeOrbits = true;
478
+ } else if (option === "--scramble") {
479
+ options.scrambleAmount = 100;
480
+ } else if (option === "--fixcorner") {
481
+ options.fixedPieceType = "v";
482
+ } else if (option === "--fixedge") {
483
+ options.fixedPieceType = "e";
484
+ } else if (option === "--fixcenter") {
485
+ options.fixedPieceType = "f";
486
+ } else if (option === "--orientcenters") {
487
+ options.orientCenters = true;
488
+ } else if (option === "--puzzleorientation") {
489
+ options.puzzleOrientation = JSON.parse(argv[argp]);
490
+ argp++;
491
+ } else {
492
+ throw new Error("Bad option: " + option);
493
+ }
494
+ }
495
+ const puzzleDescription = parsePuzzleDescription(argv.slice(argp).join(" "));
496
+ return { puzzleDescription, options };
497
+ }
498
+ var PuzzleGeometryFullOptions = class {
499
+ constructor(options = {}) {
500
+ this.verbosity = 0;
501
+ this.allMoves = false;
502
+ this.vertexMoves = false;
503
+ this.addRotations = false;
504
+ this.moveList = null;
505
+ this.fixedOrientation = false;
506
+ this.fixedPieceType = null;
507
+ this.orientCenters = false;
508
+ this.includeCornerOrbits = true;
509
+ this.includeCenterOrbits = true;
510
+ this.includeEdgeOrbits = true;
511
+ this.excludeOrbits = [];
512
+ this.optimizeOrbits = false;
513
+ this.grayCorners = false;
514
+ this.grayCenters = false;
515
+ this.grayEdges = false;
516
+ this.puzzleOrientation = null;
517
+ this.puzzleOrientations = null;
518
+ this.scrambleAmount = 0;
519
+ Object.assign(this, options);
520
+ }
521
+ };
522
+
523
+ // src/cubing/puzzle-geometry/Perm.ts
524
+ var zeroCache = [];
525
+ var iotaCache = [];
526
+ function zeros(n) {
527
+ if (!zeroCache[n]) {
528
+ const c = Array(n);
529
+ for (let i = 0; i < n; i++) {
530
+ c[i] = 0;
531
+ }
532
+ zeroCache[n] = c;
533
+ }
534
+ return zeroCache[n];
535
+ }
536
+ function iota(n) {
537
+ if (!iotaCache[n]) {
538
+ const c = Array(n);
539
+ for (let i = 0; i < n; i++) {
540
+ c[i] = i;
541
+ }
542
+ iotaCache[n] = c;
543
+ }
544
+ return iotaCache[n];
545
+ }
546
+ function identity(n) {
547
+ return new Perm(iota(n));
548
+ }
549
+ function factorial(a) {
550
+ let r = 1;
551
+ while (a > 1) {
552
+ r *= a;
553
+ a--;
554
+ }
555
+ return r;
556
+ }
557
+ function gcd(a, b) {
558
+ if (a > b) {
559
+ const t = a;
560
+ a = b;
561
+ b = t;
562
+ }
563
+ while (a > 0) {
564
+ const m = b % a;
565
+ b = a;
566
+ a = m;
567
+ }
568
+ return b;
569
+ }
570
+ function lcm(a, b) {
571
+ return a / gcd(a, b) * b;
572
+ }
573
+ var Perm = class {
574
+ constructor(a) {
575
+ this.n = a.length;
576
+ this.p = a;
577
+ }
578
+ toString() {
579
+ return "Perm[" + this.p.join(" ") + "]";
580
+ }
581
+ mul(p2) {
582
+ const c = Array(this.n);
583
+ for (let i = 0; i < this.n; i++) {
584
+ c[i] = p2.p[this.p[i]];
585
+ }
586
+ return new Perm(c);
587
+ }
588
+ rmul(p2) {
589
+ const c = Array(this.n);
590
+ for (let i = 0; i < this.n; i++) {
591
+ c[i] = this.p[p2.p[i]];
592
+ }
593
+ return new Perm(c);
594
+ }
595
+ inv() {
596
+ const c = Array(this.n);
597
+ for (let i = 0; i < this.n; i++) {
598
+ c[this.p[i]] = i;
599
+ }
600
+ return new Perm(c);
601
+ }
602
+ compareTo(p2) {
603
+ for (let i = 0; i < this.n; i++) {
604
+ if (this.p[i] !== p2.p[i]) {
605
+ return this.p[i] - p2.p[i];
606
+ }
607
+ }
608
+ return 0;
609
+ }
610
+ toGap() {
611
+ const cyc = new Array();
612
+ const seen = new Array(this.n);
613
+ for (let i = 0; i < this.p.length; i++) {
614
+ if (seen[i] || this.p[i] === i) {
615
+ continue;
616
+ }
617
+ const incyc = new Array();
618
+ for (let j = i; !seen[j]; j = this.p[j]) {
619
+ incyc.push(1 + j);
620
+ seen[j] = true;
621
+ }
622
+ cyc.push("(" + incyc.join(",") + ")");
623
+ }
624
+ return cyc.join("");
625
+ }
626
+ order() {
627
+ let r = 1;
628
+ const seen = new Array(this.n);
629
+ for (let i = 0; i < this.p.length; i++) {
630
+ if (seen[i] || this.p[i] === i) {
631
+ continue;
632
+ }
633
+ let cs = 0;
634
+ for (let j = i; !seen[j]; j = this.p[j]) {
635
+ cs++;
636
+ seen[j] = true;
637
+ }
638
+ r = lcm(r, cs);
639
+ }
640
+ return r;
641
+ }
642
+ };
643
+
468
644
  // src/cubing/puzzle-geometry/PermOriSet.ts
469
- var OrbitDef = class {
645
+ var PGOrbitDef = class {
470
646
  constructor(size, mod) {
471
647
  this.size = size;
472
648
  this.mod = mod;
@@ -483,7 +659,7 @@ function externalName(mapper, moveString) {
483
659
  }
484
660
  return mv2.toString();
485
661
  }
486
- var OrbitsDef = class {
662
+ var PGOrbitsDef = class {
487
663
  constructor(orbitnames, orbitdefs, solved, movenames, moveops) {
488
664
  this.orbitnames = orbitnames;
489
665
  this.orbitdefs = orbitdefs;
@@ -494,14 +670,14 @@ var OrbitsDef = class {
494
670
  transformToKPuzzle(t) {
495
671
  const mp = {};
496
672
  for (let j = 0; j < this.orbitnames.length; j++) {
497
- mp[this.orbitnames[j]] = t.orbits[j].toKpuzzle();
673
+ mp[this.orbitnames[j]] = t.orbits[j].toKPuzzle();
498
674
  }
499
675
  return mp;
500
676
  }
501
677
  static transformToKPuzzle(orbitnames, t) {
502
678
  const mp = {};
503
679
  for (let j = 0; j < orbitnames.length; j++) {
504
- mp[orbitnames[j]] = t.orbits[j].toKpuzzle();
680
+ mp[orbitnames[j]] = t.orbits[j].toKPuzzle();
505
681
  }
506
682
  return mp;
507
683
  }
@@ -510,12 +686,12 @@ var OrbitsDef = class {
510
686
  result.push("Name " + name);
511
687
  result.push("");
512
688
  for (let i = 0; i < this.orbitnames.length; i++) {
513
- result.push("Set " + this.orbitnames[i] + " " + this.orbitdefs[i].size + " " + this.orbitdefs[i].mod);
689
+ result.push(`Set ${this.orbitnames[i]} ${this.orbitdefs[i].size} ${this.orbitdefs[i].mod}`);
514
690
  }
515
691
  result.push("");
516
692
  result.push("Solved");
517
693
  for (let i = 0; i < this.orbitnames.length; i++) {
518
- this.solved.orbits[i].appendConciseDefinition(result, this.orbitnames[i], false);
694
+ this.solved.orbits[i].appendDefinition(result, this.orbitnames[i], false, false);
519
695
  }
520
696
  result.push("End");
521
697
  for (let i = 0; i < this.movenames.length; i++) {
@@ -529,16 +705,16 @@ var OrbitsDef = class {
529
705
  result.push("Move " + name2);
530
706
  for (let j = 0; j < this.orbitnames.length; j++) {
531
707
  if (doinv) {
532
- this.moveops[i].orbits[j].inv().appendConciseDefinition(result, this.orbitnames[j], true);
708
+ this.moveops[i].orbits[j].inv().appendDefinition(result, this.orbitnames[j], true);
533
709
  } else {
534
- this.moveops[i].orbits[j].appendConciseDefinition(result, this.orbitnames[j], true);
710
+ this.moveops[i].orbits[j].appendDefinition(result, this.orbitnames[j], true);
535
711
  }
536
712
  }
537
713
  result.push("End");
538
714
  }
539
715
  return result;
540
716
  }
541
- toKpuzzle() {
717
+ toKPuzzle(includemoves) {
542
718
  const orbits = {};
543
719
  const start = {};
544
720
  for (let i = 0; i < this.orbitnames.length; i++) {
@@ -546,11 +722,13 @@ var OrbitsDef = class {
546
722
  numPieces: this.orbitdefs[i].size,
547
723
  orientations: this.orbitdefs[i].mod
548
724
  };
549
- start[this.orbitnames[i]] = this.solved.orbits[i].toKpuzzle();
725
+ start[this.orbitnames[i]] = this.solved.orbits[i].toKPuzzle();
550
726
  }
551
727
  const moves = {};
552
- for (let i = 0; i < this.movenames.length; i++) {
553
- moves[this.movenames[i]] = this.transformToKPuzzle(this.moveops[i]);
728
+ if (includemoves) {
729
+ for (let i = 0; i < this.movenames.length; i++) {
730
+ moves[this.movenames[i]] = this.transformToKPuzzle(this.moveops[i]);
731
+ }
554
732
  }
555
733
  return { name: "PG3D", orbits, startPieces: start, moves };
556
734
  }
@@ -637,18 +815,18 @@ var OrbitsDef = class {
637
815
  }
638
816
  }
639
817
  if (multiple) {
640
- neworbitnames.push(this.orbitnames[i] + "_p" + j);
818
+ neworbitnames.push(`${this.orbitnames[i]}_p${j}`);
641
819
  } else {
642
820
  neworbitnames.push(this.orbitnames[i]);
643
821
  }
644
822
  if (keepori) {
645
- neworbitdefs.push(new OrbitDef(nv, this.orbitdefs[i].mod));
823
+ neworbitdefs.push(new PGOrbitDef(nv, this.orbitdefs[i].mod));
646
824
  newsolved.push(this.solved.orbits[i].remapVS(no, nv));
647
825
  for (let k = 0; k < this.moveops.length; k++) {
648
826
  newmoveops[k].push(this.moveops[k].orbits[i].remap(no, on, nv));
649
827
  }
650
828
  } else {
651
- neworbitdefs.push(new OrbitDef(nv, 1));
829
+ neworbitdefs.push(new PGOrbitDef(nv, 1));
652
830
  newsolved.push(this.solved.orbits[i].remapVS(no, nv).killOri());
653
831
  for (let k = 0; k < this.moveops.length; k++) {
654
832
  newmoveops[k].push(this.moveops[k].orbits[i].remap(no, on, nv).killOri());
@@ -656,7 +834,7 @@ var OrbitsDef = class {
656
834
  }
657
835
  }
658
836
  }
659
- return new OrbitsDef(neworbitnames, neworbitdefs, new VisibleState(newsolved), this.movenames, newmoveops.map((_) => new Transformation(_)));
837
+ return new PGOrbitsDef(neworbitnames, neworbitdefs, new VisibleState(newsolved), this.movenames, newmoveops.map((_) => new PGTransform(_)));
660
838
  }
661
839
  scramble(n) {
662
840
  const pool = [];
@@ -695,14 +873,14 @@ var OrbitsDef = class {
695
873
  return n;
696
874
  }
697
875
  };
698
- var _Orbit = class {
876
+ var _PGOrbit = class {
699
877
  constructor(perm, ori, orimod) {
700
878
  this.perm = perm;
701
879
  this.ori = ori;
702
880
  this.orimod = orimod;
703
881
  }
704
882
  static e(n, mod) {
705
- return new _Orbit(iota(n), zeros(n), mod);
883
+ return new _PGOrbit(iota(n), zeros(n), mod);
706
884
  }
707
885
  mul(b) {
708
886
  const n = this.perm.length;
@@ -711,14 +889,14 @@ var _Orbit = class {
711
889
  for (let i = 0; i < n; i++) {
712
890
  newPerm[i] = this.perm[b.perm[i]];
713
891
  }
714
- return new _Orbit(newPerm, this.ori, this.orimod);
892
+ return new _PGOrbit(newPerm, this.ori, this.orimod);
715
893
  } else {
716
894
  const newOri = new Array(n);
717
895
  for (let i = 0; i < n; i++) {
718
896
  newPerm[i] = this.perm[b.perm[i]];
719
897
  newOri[i] = (this.ori[b.perm[i]] + b.ori[i]) % this.orimod;
720
898
  }
721
- return new _Orbit(newPerm, newOri, this.orimod);
899
+ return new _PGOrbit(newPerm, newOri, this.orimod);
722
900
  }
723
901
  }
724
902
  inv() {
@@ -729,7 +907,7 @@ var _Orbit = class {
729
907
  newPerm[this.perm[i]] = i;
730
908
  newOri[this.perm[i]] = (this.orimod - this.ori[i]) % this.orimod;
731
909
  }
732
- return new _Orbit(newPerm, newOri, this.orimod);
910
+ return new _PGOrbit(newPerm, newOri, this.orimod);
733
911
  }
734
912
  equal(b) {
735
913
  const n = this.perm.length;
@@ -815,7 +993,7 @@ var _Orbit = class {
815
993
  newPerm[i] = on[this.perm[no[i]]];
816
994
  newOri[i] = this.ori[no[i]];
817
995
  }
818
- return new _Orbit(newPerm, newOri, this.orimod);
996
+ return new _PGOrbit(newPerm, newOri, this.orimod);
819
997
  }
820
998
  remapVS(no, nv) {
821
999
  const newPerm = new Array(nv);
@@ -830,10 +1008,10 @@ var _Orbit = class {
830
1008
  newPerm[i] = reassign[ov];
831
1009
  newOri[i] = this.ori[no[i]];
832
1010
  }
833
- return new _Orbit(newPerm, newOri, this.orimod);
1011
+ return new _PGOrbit(newPerm, newOri, this.orimod);
834
1012
  }
835
- appendConciseDefinition(result, name, useVS) {
836
- if (this.isIdentity()) {
1013
+ appendDefinition(result, name, useVS, concise = true) {
1014
+ if (concise && this.isIdentity()) {
837
1015
  return;
838
1016
  }
839
1017
  result.push(name);
@@ -850,21 +1028,21 @@ var _Orbit = class {
850
1028
  }
851
1029
  }
852
1030
  }
853
- toKpuzzle() {
1031
+ toKPuzzle() {
854
1032
  const n = this.perm.length;
855
1033
  if (this.isIdentity()) {
856
- if (!_Orbit.kcache[n]) {
857
- _Orbit.kcache[n] = { permutation: iota(n), orientation: zeros(n) };
1034
+ if (!_PGOrbit.kcache[n]) {
1035
+ _PGOrbit.kcache[n] = { permutation: iota(n), orientation: zeros(n) };
858
1036
  }
859
- return _Orbit.kcache[n];
1037
+ return _PGOrbit.kcache[n];
860
1038
  } else {
861
1039
  return { permutation: this.perm, orientation: this.ori };
862
1040
  }
863
1041
  }
864
1042
  };
865
- var Orbit = _Orbit;
866
- Orbit.kcache = [];
867
- var TransformationBase = class {
1043
+ var PGOrbit = _PGOrbit;
1044
+ PGOrbit.kcache = [];
1045
+ var PGTransformBase = class {
868
1046
  constructor(orbits) {
869
1047
  this.orbits = orbits;
870
1048
  }
@@ -877,8 +1055,8 @@ var TransformationBase = class {
877
1055
  }
878
1056
  internalInv() {
879
1057
  const newOrbits = [];
880
- for (let i = 0; i < this.orbits.length; i++) {
881
- newOrbits.push(this.orbits[i].inv());
1058
+ for (const orbit of this.orbits) {
1059
+ newOrbits.push(orbit.inv());
882
1060
  }
883
1061
  return newOrbits;
884
1062
  }
@@ -891,23 +1069,22 @@ var TransformationBase = class {
891
1069
  return true;
892
1070
  }
893
1071
  killOri() {
894
- for (let i = 0; i < this.orbits.length; i++) {
895
- this.orbits[i].killOri();
1072
+ for (const orbit of this.orbits) {
1073
+ orbit.killOri();
896
1074
  }
897
1075
  return this;
898
1076
  }
899
1077
  toPerm() {
900
1078
  const perms = new Array();
901
1079
  let n = 0;
902
- for (let i = 0; i < this.orbits.length; i++) {
903
- const p = this.orbits[i].toPerm();
1080
+ for (const orbit of this.orbits) {
1081
+ const p = orbit.toPerm();
904
1082
  perms.push(p);
905
1083
  n += p.n;
906
1084
  }
907
1085
  const newPerm = new Array(n);
908
1086
  n = 0;
909
- for (let i = 0; i < this.orbits.length; i++) {
910
- const p = perms[i];
1087
+ for (const p of perms) {
911
1088
  for (let j = 0; j < p.n; j++) {
912
1089
  newPerm[n + j] = n + p.p[j];
913
1090
  }
@@ -918,30 +1095,30 @@ var TransformationBase = class {
918
1095
  identicalPieces() {
919
1096
  const r = [];
920
1097
  let n = 0;
921
- for (let i = 0; i < this.orbits.length; i++) {
922
- const o = this.orbits[i].orimod;
923
- const s = this.orbits[i].identicalPieces();
1098
+ for (const orbit of this.orbits) {
1099
+ const o = orbit.orimod;
1100
+ const s = orbit.identicalPieces();
924
1101
  for (let j = 0; j < s.length; j++) {
925
1102
  r.push(s[j].map((_) => _ * o + n));
926
1103
  }
927
- n += o * this.orbits[i].perm.length;
1104
+ n += o * orbit.perm.length;
928
1105
  }
929
1106
  return r;
930
1107
  }
931
1108
  order() {
932
1109
  let r = 1;
933
- for (let i = 0; i < this.orbits.length; i++) {
934
- r = lcm(r, this.orbits[i].order());
1110
+ for (const orbit of this.orbits) {
1111
+ r = lcm(r, orbit.order());
935
1112
  }
936
1113
  return r;
937
1114
  }
938
1115
  };
939
- var Transformation = class extends TransformationBase {
1116
+ var PGTransform = class extends PGTransformBase {
940
1117
  constructor(orbits) {
941
1118
  super(orbits);
942
1119
  }
943
1120
  mul(b) {
944
- return new Transformation(this.internalMul(b));
1121
+ return new PGTransform(this.internalMul(b));
945
1122
  }
946
1123
  mulScalar(n) {
947
1124
  if (n === 0) {
@@ -973,13 +1150,13 @@ var Transformation = class extends TransformationBase {
973
1150
  return r;
974
1151
  }
975
1152
  inv() {
976
- return new Transformation(this.internalInv());
1153
+ return new PGTransform(this.internalInv());
977
1154
  }
978
1155
  e() {
979
- return new Transformation(this.orbits.map((_) => Orbit.e(_.perm.length, _.orimod)));
1156
+ return new PGTransform(this.orbits.map((_) => PGOrbit.e(_.perm.length, _.orimod)));
980
1157
  }
981
1158
  };
982
- var VisibleState = class extends TransformationBase {
1159
+ var VisibleState = class extends PGTransformBase {
983
1160
  constructor(orbits) {
984
1161
  super(orbits);
985
1162
  }
@@ -1057,112 +1234,11 @@ function showcanon(g, disp) {
1057
1234
  }
1058
1235
  }
1059
1236
  }
1060
- disp("" + d + ": canonseq " + sum + " states " + uniq);
1237
+ disp(`${d}: canonseq ${sum} states ${uniq}`);
1061
1238
  curlev = nextlev;
1062
1239
  }
1063
1240
  }
1064
1241
 
1065
- // src/cubing/puzzle-geometry/FaceNameSwizzler.ts
1066
- var FaceNameSwizzler = class {
1067
- constructor(facenames, gripnames_arg) {
1068
- this.facenames = facenames;
1069
- this.prefixFree = true;
1070
- this.gripnames = [];
1071
- if (gripnames_arg) {
1072
- this.gripnames = gripnames_arg;
1073
- }
1074
- for (let i = 0; this.prefixFree && i < facenames.length; i++) {
1075
- for (let j = 0; this.prefixFree && j < facenames.length; j++) {
1076
- if (i !== j && facenames[i].startsWith(facenames[j])) {
1077
- this.prefixFree = false;
1078
- }
1079
- }
1080
- }
1081
- }
1082
- setGripNames(names) {
1083
- this.gripnames = names;
1084
- }
1085
- splitByFaceNames(s) {
1086
- const r = [];
1087
- let at = 0;
1088
- while (at < s.length) {
1089
- if (at > 0 && at < s.length && s[at] === "_") {
1090
- at++;
1091
- }
1092
- let currentMatch = -1;
1093
- for (let i = 0; i < this.facenames.length; i++) {
1094
- if (s.substr(at).startsWith(this.facenames[i]) && (currentMatch < 0 || this.facenames[i].length > this.facenames[currentMatch].length)) {
1095
- currentMatch = i;
1096
- }
1097
- }
1098
- if (currentMatch >= 0) {
1099
- r.push(currentMatch);
1100
- at += this.facenames[currentMatch].length;
1101
- } else {
1102
- throw new Error("Could not split " + s + " into face names.");
1103
- }
1104
- }
1105
- return r;
1106
- }
1107
- joinByFaceIndices(list) {
1108
- let sep = "";
1109
- const r = [];
1110
- for (let i = 0; i < list.length; i++) {
1111
- r.push(sep);
1112
- r.push(this.facenames[list[i]]);
1113
- if (!this.prefixFree) {
1114
- sep = "_";
1115
- }
1116
- }
1117
- return r.join("");
1118
- }
1119
- spinmatch(userinput, longname) {
1120
- if (userinput === longname) {
1121
- return true;
1122
- }
1123
- try {
1124
- const e1 = this.splitByFaceNames(userinput);
1125
- const e2 = this.splitByFaceNames(longname);
1126
- if (e1.length !== e2.length && e1.length < 3) {
1127
- return false;
1128
- }
1129
- for (let i = 0; i < e1.length; i++) {
1130
- for (let j = 0; j < i; j++) {
1131
- if (e1[i] === e1[j]) {
1132
- return false;
1133
- }
1134
- }
1135
- let found = false;
1136
- for (let j = 0; j < e2.length; j++) {
1137
- if (e1[i] === e2[j]) {
1138
- found = true;
1139
- break;
1140
- }
1141
- }
1142
- if (!found) {
1143
- return false;
1144
- }
1145
- }
1146
- return true;
1147
- } catch (e) {
1148
- return false;
1149
- }
1150
- }
1151
- unswizzle(s) {
1152
- if ((s.endsWith("v") || s.endsWith("w")) && s[0] <= "Z") {
1153
- s = s.slice(0, s.length - 1);
1154
- }
1155
- const upperCaseGrip = s.toUpperCase();
1156
- for (let i = 0; i < this.gripnames.length; i++) {
1157
- const g = this.gripnames[i];
1158
- if (this.spinmatch(upperCaseGrip, g)) {
1159
- return g;
1160
- }
1161
- }
1162
- return s;
1163
- }
1164
- };
1165
-
1166
1242
  // src/cubing/puzzle-geometry/PGPuzzles.ts
1167
1243
  var PGPuzzles = {
1168
1244
  "2x2x2": "c f 0",
@@ -1236,20 +1312,6 @@ var PGPuzzles = {
1236
1312
 
1237
1313
  // src/cubing/puzzle-geometry/Quat.ts
1238
1314
  var eps = 1e-9;
1239
- function expandfaces(rots, faces) {
1240
- const nfaces = [];
1241
- for (let i = 0; i < rots.length; i++) {
1242
- for (let k = 0; k < faces.length; k++) {
1243
- const face = faces[k];
1244
- const nface = [];
1245
- for (let j = 0; j < face.length; j++) {
1246
- nface.push(face[j].rotateplane(rots[i]));
1247
- }
1248
- nfaces.push(nface);
1249
- }
1250
- }
1251
- return nfaces;
1252
- }
1253
1315
  function centermassface(face) {
1254
1316
  let s = new Quat(0, 0, 0, 0);
1255
1317
  for (let i = 0; i < face.length; i++) {
@@ -1272,38 +1334,6 @@ function solvethreeplanes(p1, p2, p3, planes) {
1272
1334
  }
1273
1335
  return p;
1274
1336
  }
1275
- var FaceTree = class {
1276
- constructor(face, left, right) {
1277
- this.face = face;
1278
- this.left = left;
1279
- this.right = right;
1280
- }
1281
- split(q) {
1282
- const t = q.cutface(this.face);
1283
- if (t !== null) {
1284
- if (this.left === void 0) {
1285
- this.left = new FaceTree(t[0]);
1286
- this.right = new FaceTree(t[1]);
1287
- } else {
1288
- this.left = this.left?.split(q);
1289
- this.right = this.right?.split(q);
1290
- }
1291
- }
1292
- return this;
1293
- }
1294
- collect(arr, leftfirst) {
1295
- if (this.left === void 0) {
1296
- arr.push(this.face);
1297
- } else if (leftfirst) {
1298
- this.left?.collect(arr, false);
1299
- this.right?.collect(arr, true);
1300
- } else {
1301
- this.right?.collect(arr, false);
1302
- this.left?.collect(arr, true);
1303
- }
1304
- return arr;
1305
- }
1306
- };
1307
1337
  var Quat = class {
1308
1338
  constructor(a, b, c, d) {
1309
1339
  this.a = a;
@@ -1315,7 +1345,7 @@ var Quat = class {
1315
1345
  return new Quat(this.a * q.a - this.b * q.b - this.c * q.c - this.d * q.d, this.a * q.b + this.b * q.a + this.c * q.d - this.d * q.c, this.a * q.c - this.b * q.d + this.c * q.a + this.d * q.b, this.a * q.d + this.b * q.c - this.c * q.b + this.d * q.a);
1316
1346
  }
1317
1347
  toString() {
1318
- return "Q[" + this.a + "," + this.b + "," + this.c + "," + this.d + "]";
1348
+ return `Q[${this.a},${this.b},${this.c},${this.d}]`;
1319
1349
  }
1320
1350
  dist(q) {
1321
1351
  return Math.hypot(this.a - q.a, this.b - q.b, this.c - q.c, this.d - q.d);
@@ -1400,9 +1430,6 @@ var Quat = class {
1400
1430
  rotateface(face) {
1401
1431
  return face.map((_) => _.rotatepoint(this));
1402
1432
  }
1403
- rotatecubie(cubie) {
1404
- return cubie.map((_) => this.rotateface(_));
1405
- }
1406
1433
  intersect3(p2, p3) {
1407
1434
  const det = this.det3x3(this.b, this.c, this.d, p2.b, p2.c, p2.d, p3.b, p3.c, p3.d);
1408
1435
  if (Math.abs(det) < eps) {
@@ -1533,74 +1560,293 @@ function closure(g) {
1533
1560
  break;
1534
1561
  }
1535
1562
  }
1536
- if (!wasseen) {
1537
- q.push(ns);
1563
+ if (!wasseen) {
1564
+ q.push(ns);
1565
+ }
1566
+ }
1567
+ }
1568
+ return q;
1569
+ }
1570
+ function uniqueplanes(p, g) {
1571
+ const planes = [];
1572
+ const planerot = [];
1573
+ for (let i = 0; i < g.length; i++) {
1574
+ const p2 = p.rotateplane(g[i]);
1575
+ let wasseen = false;
1576
+ for (let j = 0; j < planes.length; j++) {
1577
+ if (p2.dist(planes[j]) < eps2) {
1578
+ wasseen = true;
1579
+ break;
1580
+ }
1581
+ }
1582
+ if (!wasseen) {
1583
+ planes.push(p2);
1584
+ planerot.push(g[i]);
1585
+ }
1586
+ }
1587
+ return planerot;
1588
+ }
1589
+ function getface(planes) {
1590
+ const face = [];
1591
+ for (let i = 1; i < planes.length; i++) {
1592
+ for (let j = i + 1; j < planes.length; j++) {
1593
+ const p = solvethreeplanes(0, i, j, planes);
1594
+ if (p) {
1595
+ let wasseen = false;
1596
+ for (let k = 0; k < face.length; k++) {
1597
+ if (p.dist(face[k]) < eps2) {
1598
+ wasseen = true;
1599
+ break;
1600
+ }
1601
+ }
1602
+ if (!wasseen) {
1603
+ face.push(p);
1604
+ }
1605
+ }
1606
+ }
1607
+ }
1608
+ for (; ; ) {
1609
+ let changed = false;
1610
+ for (let i = 0; i < face.length; i++) {
1611
+ const j = (i + 1) % face.length;
1612
+ if (planes[0].dot(face[i].cross(face[j])) < 0) {
1613
+ const t = face[i];
1614
+ face[i] = face[j];
1615
+ face[j] = t;
1616
+ changed = true;
1617
+ }
1618
+ }
1619
+ if (!changed) {
1620
+ break;
1621
+ }
1622
+ }
1623
+ return face;
1624
+ }
1625
+
1626
+ // src/cubing/puzzle-geometry/SchreierSims.ts
1627
+ var FactoredNumber = class {
1628
+ constructor() {
1629
+ this.mult = [];
1630
+ }
1631
+ multiply(n) {
1632
+ for (let f = 2; f * f <= n; f++) {
1633
+ while (n % f === 0) {
1634
+ if (this.mult[f] !== void 0) {
1635
+ this.mult[f]++;
1636
+ } else {
1637
+ this.mult[f] = 1;
1638
+ }
1639
+ n /= f;
1640
+ }
1641
+ }
1642
+ if (n > 1) {
1643
+ if (this.mult[n] !== void 0) {
1644
+ this.mult[n]++;
1645
+ } else {
1646
+ this.mult[n] = 1;
1647
+ }
1648
+ }
1649
+ }
1650
+ toString() {
1651
+ let r = "";
1652
+ for (let i = 0; i < this.mult.length; i++) {
1653
+ if (this.mult[i] !== void 0) {
1654
+ if (r !== "") {
1655
+ r += "*";
1656
+ }
1657
+ r += i;
1658
+ if (this.mult[i] > 1) {
1659
+ r += `^${this.mult[i]}`;
1660
+ }
1661
+ }
1662
+ }
1663
+ return r;
1664
+ }
1665
+ };
1666
+ function schreierSims(g, disp) {
1667
+ const n = g[0].p.length;
1668
+ const e = identity(n);
1669
+ let sgs = [];
1670
+ let sgsi = [];
1671
+ let sgslen = [];
1672
+ let Tk = [];
1673
+ let Tklen = [];
1674
+ function resolve(p) {
1675
+ for (let i = p.p.length - 1; i >= 0; i--) {
1676
+ const j = p.p[i];
1677
+ if (j !== i) {
1678
+ if (!sgs[i][j]) {
1679
+ return false;
1680
+ }
1681
+ p = p.mul(sgsi[i][j]);
1682
+ }
1683
+ }
1684
+ return true;
1685
+ }
1686
+ function knutha(k, p, len) {
1687
+ Tk[k].push(p);
1688
+ Tklen[k].push(len);
1689
+ for (let i = 0; i < sgs[k].length; i++) {
1690
+ if (sgs[k][i]) {
1691
+ knuthb(k, sgs[k][i].mul(p), len + sgslen[k][i]);
1538
1692
  }
1539
1693
  }
1540
1694
  }
1541
- return q;
1542
- }
1543
- function uniqueplanes(p, g) {
1544
- const planes = [];
1545
- const planerot = [];
1546
- for (let i = 0; i < g.length; i++) {
1547
- const p2 = p.rotateplane(g[i]);
1548
- let wasseen = false;
1549
- for (let j = 0; j < planes.length; j++) {
1550
- if (p2.dist(planes[j]) < eps2) {
1551
- wasseen = true;
1552
- break;
1695
+ function knuthb(k, p, len) {
1696
+ const j = p.p[k];
1697
+ if (!sgs[k][j]) {
1698
+ sgs[k][j] = p;
1699
+ sgsi[k][j] = p.inv();
1700
+ sgslen[k][j] = len;
1701
+ for (let i = 0; i < Tk[k].length; i++) {
1702
+ knuthb(k, p.mul(Tk[k][i]), len + Tklen[k][i]);
1553
1703
  }
1704
+ return;
1554
1705
  }
1555
- if (!wasseen) {
1556
- planes.push(p2);
1557
- planerot.push(g[i]);
1706
+ const p2 = p.mul(sgsi[k][j]);
1707
+ if (!resolve(p2)) {
1708
+ knutha(k - 1, p2, len + sgslen[k][j]);
1558
1709
  }
1559
1710
  }
1560
- return planerot;
1561
- }
1562
- function getface(planes) {
1563
- const face = [];
1564
- for (let i = 1; i < planes.length; i++) {
1565
- for (let j = i + 1; j < planes.length; j++) {
1566
- const p = solvethreeplanes(0, i, j, planes);
1567
- if (p) {
1568
- let wasseen = false;
1569
- for (let k = 0; k < face.length; k++) {
1570
- if (p.dist(face[k]) < eps2) {
1571
- wasseen = true;
1572
- break;
1711
+ function getsgs() {
1712
+ sgs = [];
1713
+ sgsi = [];
1714
+ Tk = [];
1715
+ sgslen = [];
1716
+ Tklen = [];
1717
+ for (let i = 0; i < n; i++) {
1718
+ sgs.push([]);
1719
+ sgsi.push([]);
1720
+ sgslen.push([]);
1721
+ Tk.push([]);
1722
+ Tklen.push([]);
1723
+ sgs[i][i] = e;
1724
+ sgsi[i][i] = e;
1725
+ sgslen[i][i] = 0;
1726
+ }
1727
+ let none = 0;
1728
+ let sz = 1;
1729
+ for (let i = 0; i < g.length; i++) {
1730
+ knutha(n - 1, g[i], 1);
1731
+ sz = 1;
1732
+ let tks = 0;
1733
+ let sollen = 0;
1734
+ const avgs = [];
1735
+ const mults = new FactoredNumber();
1736
+ for (let j = 0; j < n; j++) {
1737
+ let cnt = 0;
1738
+ let lensum = 0;
1739
+ for (let k = 0; k < n; k++) {
1740
+ if (sgs[j][k]) {
1741
+ cnt++;
1742
+ lensum += sgslen[j][k];
1743
+ if (j !== k) {
1744
+ none++;
1745
+ }
1573
1746
  }
1574
1747
  }
1575
- if (!wasseen) {
1576
- face.push(p);
1748
+ tks += Tk[j].length;
1749
+ sz *= cnt;
1750
+ if (cnt > 1) {
1751
+ mults.multiply(cnt);
1577
1752
  }
1753
+ const avg = lensum / cnt;
1754
+ avgs.push(avg);
1755
+ sollen += avg;
1578
1756
  }
1757
+ disp(`${i}: sz ${sz} T ${tks} sol ${sollen} none ${none} mults ${mults.toString()}`);
1579
1758
  }
1759
+ return sz;
1580
1760
  }
1581
- for (; ; ) {
1582
- let changed = false;
1583
- for (let i = 0; i < face.length; i++) {
1584
- const j = (i + 1) % face.length;
1585
- if (planes[0].dot(face[i].cross(face[j])) < 0) {
1586
- const t = face[i];
1587
- face[i] = face[j];
1588
- face[j] = t;
1589
- changed = true;
1761
+ return getsgs();
1762
+ }
1763
+
1764
+ // src/cubing/puzzle-geometry/PuzzleGeometry.ts
1765
+ function tstart(s) {
1766
+ return s;
1767
+ }
1768
+ function tend(_) {
1769
+ }
1770
+ var Face = class {
1771
+ constructor(q) {
1772
+ this.coords = new Array(q.length * 3);
1773
+ for (let i = 0; i < q.length; i++) {
1774
+ this.coords[3 * i] = q[i].b;
1775
+ this.coords[3 * i + 1] = q[i].c;
1776
+ this.coords[3 * i + 2] = q[i].d;
1777
+ }
1778
+ this.length = q.length;
1779
+ }
1780
+ get(off) {
1781
+ return new Quat(0, this.coords[3 * off], this.coords[3 * off + 1], this.coords[3 * off + 2]);
1782
+ }
1783
+ centermass() {
1784
+ let sx = 0;
1785
+ let sy = 0;
1786
+ let sz = 0;
1787
+ for (let i = 0; i < this.length; i++) {
1788
+ sx += this.coords[3 * i];
1789
+ sy += this.coords[3 * i + 1];
1790
+ sz += this.coords[3 * i + 2];
1791
+ }
1792
+ return new Quat(0, sx / this.length, sy / this.length, sz / this.length);
1793
+ }
1794
+ rotate(q) {
1795
+ const a = [];
1796
+ for (let i = 0; i < this.length; i++) {
1797
+ a.push(this.get(i).rotatepoint(q));
1798
+ }
1799
+ return new Face(a);
1800
+ }
1801
+ rotateforward() {
1802
+ const a = [];
1803
+ for (let i = 1; i < this.length; i++) {
1804
+ a.push(this.get(i));
1805
+ }
1806
+ a.push(this.get(0));
1807
+ return new Face(a);
1808
+ }
1809
+ };
1810
+ var FaceTree = class {
1811
+ constructor(face, left, right) {
1812
+ this.face = face;
1813
+ this.left = left;
1814
+ this.right = right;
1815
+ }
1816
+ split(q) {
1817
+ const t = q.cutface(this.face);
1818
+ if (t !== null) {
1819
+ if (this.left === void 0) {
1820
+ this.left = new FaceTree(t[0]);
1821
+ this.right = new FaceTree(t[1]);
1822
+ } else {
1823
+ this.left = this.left?.split(q);
1824
+ this.right = this.right?.split(q);
1590
1825
  }
1591
1826
  }
1592
- if (!changed) {
1593
- break;
1827
+ return this;
1828
+ }
1829
+ collect(arr, leftfirst) {
1830
+ if (this.left === void 0) {
1831
+ arr.push(new Face(this.face));
1832
+ } else if (leftfirst) {
1833
+ this.left?.collect(arr, false);
1834
+ this.right?.collect(arr, true);
1835
+ } else {
1836
+ this.right?.collect(arr, false);
1837
+ this.left?.collect(arr, true);
1594
1838
  }
1839
+ return arr;
1595
1840
  }
1596
- return face;
1597
- }
1598
-
1599
- // src/cubing/puzzle-geometry/PuzzleGeometry.ts
1600
- var DEFAULT_COLOR_FRACTION = 0.77;
1601
- var NEW_FACE_NAMES = true;
1602
- function useNewFaceNames(use) {
1603
- NEW_FACE_NAMES = use;
1841
+ };
1842
+ function expandfaces(rots, faces) {
1843
+ const nfaces = [];
1844
+ for (const rot of rots) {
1845
+ for (const face of faces) {
1846
+ nfaces.push(face.rotate(rot));
1847
+ }
1848
+ }
1849
+ return nfaces;
1604
1850
  }
1605
1851
  var eps3 = 1e-9;
1606
1852
  var copyright = "PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.";
@@ -1730,11 +1976,26 @@ function defaultfaceorders() {
1730
1976
  }
1731
1977
  function defaultOrientations() {
1732
1978
  return {
1733
- 4: ["FLR", [0, 1, 0], "F", [0, 0, 1]],
1734
- 6: ["U", [0, 1, 0], "F", [0, 0, 1]],
1735
- 8: ["U", [0, 1, 0], "F", [0, 0, 1]],
1736
- 12: ["U", [0, 1, 0], "F", [0, 0, 1]],
1737
- 20: ["GUQMJ", [0, 1, 0], "F", [0, 0, 1]]
1979
+ 4: [
1980
+ ["FLR", [0, 1, 0]],
1981
+ ["F", [0, 0, 1]]
1982
+ ],
1983
+ 6: [
1984
+ ["U", [0, 1, 0]],
1985
+ ["F", [0, 0, 1]]
1986
+ ],
1987
+ 8: [
1988
+ ["U", [0, 1, 0]],
1989
+ ["F", [0, 0, 1]]
1990
+ ],
1991
+ 12: [
1992
+ ["U", [0, 1, 0]],
1993
+ ["F", [0, 0, 1]]
1994
+ ],
1995
+ 20: [
1996
+ ["GUQMJ", [0, 1, 0]],
1997
+ ["F", [0, 0, 1]]
1998
+ ]
1738
1999
  };
1739
2000
  }
1740
2001
  function findelement(a, p) {
@@ -1751,31 +2012,35 @@ function getpuzzles() {
1751
2012
  function getpuzzle(puzzleName) {
1752
2013
  return PGPuzzles[puzzleName];
1753
2014
  }
1754
- function parsedesc(s) {
2015
+ function parsePuzzleDescription(s) {
1755
2016
  const a = s.split(/ /).filter(Boolean);
1756
2017
  if (a.length % 2 === 0) {
1757
- return false;
2018
+ return null;
1758
2019
  }
1759
- if (a[0] !== "o" && a[0] !== "c" && a[0] !== "i" && a[0] !== "d" && a[0] !== "t") {
1760
- return false;
2020
+ const shape = a[0];
2021
+ if (shape !== "o" && shape !== "c" && shape !== "i" && shape !== "d" && shape !== "t") {
2022
+ return null;
1761
2023
  }
1762
- const r = [];
2024
+ const cuts = [];
1763
2025
  for (let i = 1; i < a.length; i += 2) {
1764
2026
  if (a[i] !== "f" && a[i] !== "v" && a[i] !== "e") {
1765
- return false;
2027
+ return null;
1766
2028
  }
1767
- r.push([a[i], a[i + 1]]);
2029
+ cuts.push({ cutType: a[i], distance: parseFloat(a[i + 1]) });
1768
2030
  }
1769
- return [a[0], r];
2031
+ return { shape, cuts };
1770
2032
  }
1771
- function getPuzzleGeometryByDesc(desc, options = []) {
1772
- const [shape, cuts] = parsedesc(desc);
1773
- const pg = new PuzzleGeometry(shape, cuts, ["allmoves", "true"].concat(options));
2033
+ function getPuzzleGeometryByDesc(desc, options = {}) {
2034
+ const parsed = parsePuzzleDescription(desc);
2035
+ if (parsed === null) {
2036
+ throw new Error("Could not parse the puzzle description");
2037
+ }
2038
+ const pg = new PuzzleGeometry(parsed, Object.assign({}, { allMoves: true }, options));
1774
2039
  pg.allstickers();
1775
2040
  pg.genperms();
1776
2041
  return pg;
1777
2042
  }
1778
- function getPuzzleGeometryByName(puzzleName, options = []) {
2043
+ function getPuzzleGeometryByName(puzzleName, options) {
1779
2044
  return getPuzzleGeometryByDesc(PGPuzzles[puzzleName], options);
1780
2045
  }
1781
2046
  function getmovename(geo, bits, slices) {
@@ -1799,7 +2064,7 @@ function getmovename(geo, bits, slices) {
1799
2064
  movenamePrefix = String(bits[1] + 1);
1800
2065
  }
1801
2066
  } else {
1802
- throw "We only support slice and outer block moves right now. " + bits;
2067
+ throw `We only support slice and outer block moves right now. ${bits}`;
1803
2068
  }
1804
2069
  return [movenamePrefix + movenameFamily, inverted];
1805
2070
  }
@@ -1811,9 +2076,9 @@ function splitByFaceNames(s, facenames) {
1811
2076
  at++;
1812
2077
  }
1813
2078
  let currentMatch = "";
1814
- for (let i = 0; i < facenames.length; i++) {
1815
- if (s.substr(at).startsWith(facenames[i][1]) && facenames[i][1].length > currentMatch.length) {
1816
- currentMatch = facenames[i][1];
2079
+ for (const facename of facenames) {
2080
+ if (s.substr(at).startsWith(facename[1]) && facename[1].length > currentMatch.length) {
2081
+ currentMatch = facename[1];
1817
2082
  }
1818
2083
  }
1819
2084
  if (currentMatch !== "") {
@@ -1832,55 +2097,16 @@ function toFaceCoords(q, maxdist) {
1832
2097
  const r = [];
1833
2098
  const n = q.length;
1834
2099
  for (let i = 0; i < n; i++) {
1835
- r[n - i - 1] = toCoords(q[i], maxdist);
2100
+ const pt = toCoords(q.get(n - i - 1), maxdist);
2101
+ r[3 * i] = pt[0];
2102
+ r[3 * i + 1] = pt[1];
2103
+ r[3 * i + 2] = pt[2];
1836
2104
  }
1837
2105
  return r;
1838
2106
  }
1839
- function trimEdges(face, tr) {
1840
- const r = [];
1841
- for (let iter = 1; iter < 10; iter++) {
1842
- for (let i = 0; i < face.length; i++) {
1843
- const pi = (i + face.length - 1) % face.length;
1844
- const ni = (i + 1) % face.length;
1845
- const A = face[pi].sub(face[i]).normalize();
1846
- const B = face[ni].sub(face[i]).normalize();
1847
- const d = A.dot(B);
1848
- const m = tr / Math.sqrt(1 - d * d);
1849
- r[i] = face[i].sum(A.sum(B).smul(m));
1850
- }
1851
- let good = true;
1852
- for (let i = 0; good && i < r.length; i++) {
1853
- const pi = (i + face.length - 1) % face.length;
1854
- const ni = (i + 1) % face.length;
1855
- if (r[pi].sub(r[i]).cross(r[ni].sub(r[i])).dot(r[i]) >= 0) {
1856
- good = false;
1857
- }
1858
- }
1859
- if (good) {
1860
- return r;
1861
- }
1862
- tr /= 2;
1863
- }
1864
- return face;
1865
- }
1866
2107
  var PuzzleGeometry = class {
1867
- constructor(shape, cuts, optionlist) {
1868
- this.args = "";
2108
+ constructor(puzzleDescription, options) {
1869
2109
  this.cmovesbyslice = [];
1870
- this.verbose = 0;
1871
- this.allmoves = false;
1872
- this.cornersets = true;
1873
- this.centersets = true;
1874
- this.edgesets = true;
1875
- this.omitsets = [];
1876
- this.graycorners = false;
1877
- this.graycenters = false;
1878
- this.grayedges = false;
1879
- this.killorientation = false;
1880
- this.optimize = false;
1881
- this.scramble = 0;
1882
- this.fixPiece = "";
1883
- this.orientCenters = false;
1884
2110
  this.duplicatedFaces = [];
1885
2111
  this.duplicatedCubies = [];
1886
2112
  this.fixedCubie = -1;
@@ -1891,84 +2117,16 @@ var PuzzleGeometry = class {
1891
2117
  this.notationMapper = new NullMapper();
1892
2118
  this.addNotationMapper = "";
1893
2119
  this.setReidOrder = false;
1894
- function asstructured(v) {
1895
- if (typeof v === "string") {
1896
- return JSON.parse(v);
1897
- }
1898
- return v;
1899
- }
1900
- function asboolean(v) {
1901
- if (typeof v === "string") {
1902
- if (v === "false") {
1903
- return false;
1904
- }
1905
- return true;
1906
- } else {
1907
- return v ? true : false;
1908
- }
1909
- }
1910
- if (optionlist !== void 0) {
1911
- if (optionlist.length % 2 !== 0) {
1912
- throw new Error("Odd length in option list?");
1913
- }
1914
- for (let i = 0; i < optionlist.length; i += 2) {
1915
- if (optionlist[i] === "verbose") {
1916
- this.verbose++;
1917
- } else if (optionlist[i] === "quiet") {
1918
- this.verbose = 0;
1919
- } else if (optionlist[i] === "allmoves") {
1920
- this.allmoves = asboolean(optionlist[i + 1]);
1921
- } else if (optionlist[i] === "outerblockmoves") {
1922
- this.outerblockmoves = asboolean(optionlist[i + 1]);
1923
- } else if (optionlist[i] === "vertexmoves") {
1924
- this.vertexmoves = asboolean(optionlist[i + 1]);
1925
- } else if (optionlist[i] === "rotations") {
1926
- this.addrotations = asboolean(optionlist[i + 1]);
1927
- } else if (optionlist[i] === "cornersets") {
1928
- this.cornersets = asboolean(optionlist[i + 1]);
1929
- } else if (optionlist[i] === "centersets") {
1930
- this.centersets = asboolean(optionlist[i + 1]);
1931
- } else if (optionlist[i] === "edgesets") {
1932
- this.edgesets = asboolean(optionlist[i + 1]);
1933
- } else if (optionlist[i] === "omit") {
1934
- this.omitsets = optionlist[i + 1];
1935
- } else if (optionlist[i] === "graycorners") {
1936
- this.graycorners = asboolean(optionlist[i + 1]);
1937
- } else if (optionlist[i] === "graycenters") {
1938
- this.graycenters = asboolean(optionlist[i + 1]);
1939
- } else if (optionlist[i] === "grayedges") {
1940
- this.grayedges = asboolean(optionlist[i + 1]);
1941
- } else if (optionlist[i] === "movelist") {
1942
- this.movelist = asstructured(optionlist[i + 1]);
1943
- } else if (optionlist[i] === "killorientation") {
1944
- this.killorientation = asboolean(optionlist[i + 1]);
1945
- } else if (optionlist[i] === "optimize") {
1946
- this.optimize = asboolean(optionlist[i + 1]);
1947
- } else if (optionlist[i] === "scramble") {
1948
- this.scramble = optionlist[i + 1];
1949
- } else if (optionlist[i] === "fix") {
1950
- this.fixPiece = optionlist[i + 1];
1951
- } else if (optionlist[i] === "orientcenters") {
1952
- this.orientCenters = asboolean(optionlist[i + 1]);
1953
- } else if (optionlist[i] === "puzzleorientation") {
1954
- this.puzzleOrientation = asstructured(optionlist[i + 1]);
1955
- } else if (optionlist[i] === "puzzleorientations") {
1956
- this.puzzleOrientations = asstructured(optionlist[i + 1]);
1957
- } else {
1958
- throw new Error("Bad option while processing option list " + optionlist[i]);
1959
- }
1960
- }
1961
- }
1962
- this.args = shape + " " + cuts.map((_) => _.join(" ")).join(" ");
1963
- if (optionlist) {
1964
- this.args += " " + optionlist.join(" ");
1965
- }
1966
- if (this.verbose > 0) {
2120
+ const t1 = tstart("genperms");
2121
+ this.options = new PuzzleGeometryFullOptions(options);
2122
+ if (this.options.verbosity > 0) {
1967
2123
  console.log(this.header("# "));
1968
2124
  }
1969
- this.create(shape, cuts);
2125
+ this.create(puzzleDescription);
2126
+ tend(t1);
1970
2127
  }
1971
- create(shape, cuts) {
2128
+ create(puzzleDescription) {
2129
+ const { shape, cuts } = puzzleDescription;
1972
2130
  this.moveplanes = [];
1973
2131
  this.moveplanes2 = [];
1974
2132
  this.faces = [];
@@ -1994,47 +2152,47 @@ var PuzzleGeometry = class {
1994
2152
  throw new Error("Bad shape argument: " + shape);
1995
2153
  }
1996
2154
  this.rotations = closure(g);
1997
- if (this.verbose) {
2155
+ if (this.options.verbosity) {
1998
2156
  console.log("# Rotations: " + this.rotations.length);
1999
2157
  }
2000
2158
  const baseplane = g[0];
2001
2159
  this.baseplanerot = uniqueplanes(baseplane, this.rotations);
2002
2160
  const baseplanes = this.baseplanerot.map((_) => baseplane.rotateplane(_));
2003
2161
  this.baseplanes = baseplanes;
2004
- this.basefacecount = baseplanes.length;
2162
+ this.baseFaceCount = baseplanes.length;
2005
2163
  const net = defaultnets()[baseplanes.length];
2006
2164
  this.net = net;
2007
2165
  this.colors = defaultcolors()[baseplanes.length];
2008
2166
  this.faceorder = defaultfaceorders()[baseplanes.length];
2009
- if (this.verbose) {
2167
+ if (this.options.verbosity > 0) {
2010
2168
  console.log("# Base planes: " + baseplanes.length);
2011
2169
  }
2012
2170
  const baseface = getface(baseplanes);
2013
2171
  const zero = new Quat(0, 0, 0, 0);
2014
- if (this.verbose) {
2172
+ if (this.options.verbosity > 0) {
2015
2173
  console.log("# Face vertices: " + baseface.length);
2016
2174
  }
2017
2175
  const facenormal = baseplanes[0].makenormal();
2018
2176
  const edgenormal = baseface[0].sum(baseface[1]).makenormal();
2019
2177
  const vertexnormal = baseface[0].makenormal();
2020
2178
  const boundary = new Quat(1, facenormal.b, facenormal.c, facenormal.d);
2021
- if (this.verbose) {
2179
+ if (this.options.verbosity > 0) {
2022
2180
  console.log("# Boundary is " + boundary);
2023
2181
  }
2024
2182
  const planerot = uniqueplanes(boundary, this.rotations);
2025
2183
  const planes = planerot.map((_) => boundary.rotateplane(_));
2026
- let faces = [getface(planes)];
2027
- this.edgedistance = faces[0][0].sum(faces[0][1]).smul(0.5).dist(zero);
2028
- this.vertexdistance = faces[0][0].dist(zero);
2184
+ const firstface = getface(planes);
2185
+ this.edgedistance = firstface[0].sum(firstface[1]).smul(0.5).dist(zero);
2186
+ this.vertexdistance = firstface[0].dist(zero);
2029
2187
  const cutplanes = [];
2030
2188
  const intersects = [];
2031
2189
  let sawface = false;
2032
2190
  let sawedge = false;
2033
2191
  let sawvertex = false;
2034
- for (let i = 0; i < cuts.length; i++) {
2192
+ for (const cut of cuts) {
2035
2193
  let normal = null;
2036
2194
  let distance = 0;
2037
- switch (cuts[i][0]) {
2195
+ switch (cut.cutType) {
2038
2196
  case "f":
2039
2197
  normal = facenormal;
2040
2198
  distance = 1;
@@ -2051,12 +2209,12 @@ var PuzzleGeometry = class {
2051
2209
  sawedge = true;
2052
2210
  break;
2053
2211
  default:
2054
- throw new Error("Bad cut argument: " + cuts[i][0]);
2212
+ throw new Error("Bad cut argument: " + cut.cutType);
2055
2213
  }
2056
- cutplanes.push(normal.makecut(Number(cuts[i][1])));
2057
- intersects.push(cuts[i][1] < distance);
2214
+ cutplanes.push(normal.makecut(cut.distance));
2215
+ intersects.push(cut.distance < distance);
2058
2216
  }
2059
- if (this.addrotations) {
2217
+ if (this.options.addRotations) {
2060
2218
  if (!sawface) {
2061
2219
  cutplanes.push(facenormal.makecut(10));
2062
2220
  }
@@ -2068,26 +2226,26 @@ var PuzzleGeometry = class {
2068
2226
  }
2069
2227
  }
2070
2228
  this.basefaces = [];
2071
- for (let i = 0; i < this.baseplanerot.length; i++) {
2072
- const face = this.baseplanerot[i].rotateface(faces[0]);
2073
- this.basefaces.push(face);
2229
+ for (const baseplanerot of this.baseplanerot) {
2230
+ const face = baseplanerot.rotateface(firstface);
2231
+ this.basefaces.push(new Face(face));
2074
2232
  }
2075
2233
  const facenames = [];
2076
2234
  const faceplanes = [];
2077
2235
  const vertexnames = [];
2078
2236
  const edgenames = [];
2079
- const edgesperface = faces[0].length;
2237
+ const edgesperface = firstface.length;
2080
2238
  function searchaddelement(a, p, name) {
2081
- for (let i = 0; i < a.length; i++) {
2082
- if (a[i][0].dist(p) < eps3) {
2083
- a[i].push(name);
2239
+ for (const el of a) {
2240
+ if (el[0].dist(p) < eps3) {
2241
+ el.push(name);
2084
2242
  return;
2085
2243
  }
2086
2244
  }
2087
2245
  a.push([p, name]);
2088
2246
  }
2089
2247
  for (let i = 0; i < this.baseplanerot.length; i++) {
2090
- const face = this.baseplanerot[i].rotateface(faces[0]);
2248
+ const face = this.baseplanerot[i].rotateface(firstface);
2091
2249
  for (let j = 0; j < face.length; j++) {
2092
2250
  const jj = (j + 1) % face.length;
2093
2251
  const midpoint = face[j].sum(face[jj]).smul(0.5);
@@ -2096,7 +2254,7 @@ var PuzzleGeometry = class {
2096
2254
  }
2097
2255
  const otherfaces = [];
2098
2256
  for (let i = 0; i < this.baseplanerot.length; i++) {
2099
- const face = this.baseplanerot[i].rotateface(faces[0]);
2257
+ const face = this.baseplanerot[i].rotateface(firstface);
2100
2258
  const facelist = [];
2101
2259
  for (let j = 0; j < face.length; j++) {
2102
2260
  const jj = (j + 1) % face.length;
@@ -2118,8 +2276,8 @@ var PuzzleGeometry = class {
2118
2276
  facenametoindex[net[0][0]] = 0;
2119
2277
  faceindextoname[otherfaces[0][0]] = net[0][1];
2120
2278
  facenametoindex[net[0][1]] = otherfaces[0][0];
2121
- for (let i = 0; i < net.length; i++) {
2122
- const f0 = net[i][0];
2279
+ for (const neti of net) {
2280
+ const f0 = neti[0];
2123
2281
  const fi = facenametoindex[f0];
2124
2282
  if (fi === void 0) {
2125
2283
  throw new Error("Bad edge description; first edge not connected");
@@ -2127,7 +2285,7 @@ var PuzzleGeometry = class {
2127
2285
  let ii = -1;
2128
2286
  for (let j = 0; j < otherfaces[fi].length; j++) {
2129
2287
  const fn2 = faceindextoname[otherfaces[fi][j]];
2130
- if (fn2 !== void 0 && fn2 === net[i][1]) {
2288
+ if (fn2 !== void 0 && fn2 === neti[1]) {
2131
2289
  ii = j;
2132
2290
  break;
2133
2291
  }
@@ -2135,17 +2293,17 @@ var PuzzleGeometry = class {
2135
2293
  if (ii < 0) {
2136
2294
  throw new Error("First element of a net not known");
2137
2295
  }
2138
- for (let j = 2; j < net[i].length; j++) {
2139
- if (net[i][j] === "") {
2296
+ for (let j = 2; j < neti.length; j++) {
2297
+ if (neti[j] === "") {
2140
2298
  continue;
2141
2299
  }
2142
2300
  const of = otherfaces[fi][(j + ii - 1) % edgesperface];
2143
2301
  const fn2 = faceindextoname[of];
2144
- if (fn2 !== void 0 && fn2 !== net[i][j]) {
2302
+ if (fn2 !== void 0 && fn2 !== neti[j]) {
2145
2303
  throw new Error("Face mismatch in net");
2146
2304
  }
2147
- faceindextoname[of] = net[i][j];
2148
- facenametoindex[net[i][j]] = of;
2305
+ faceindextoname[of] = neti[j];
2306
+ facenametoindex[neti[j]] = of;
2149
2307
  }
2150
2308
  }
2151
2309
  for (let i = 0; i < faceindextoname.length; i++) {
@@ -2162,14 +2320,14 @@ var PuzzleGeometry = class {
2162
2320
  }
2163
2321
  }
2164
2322
  for (let i = 0; i < this.baseplanerot.length; i++) {
2165
- const face = this.baseplanerot[i].rotateface(faces[0]);
2323
+ const face = this.baseplanerot[i].rotateface(firstface);
2166
2324
  const faceplane = boundary.rotateplane(this.baseplanerot[i]);
2167
2325
  const facename = faceindextoname[i];
2168
2326
  facenames.push([face, facename]);
2169
2327
  faceplanes.push([faceplane, facename]);
2170
2328
  }
2171
2329
  for (let i = 0; i < this.baseplanerot.length; i++) {
2172
- const face = this.baseplanerot[i].rotateface(faces[0]);
2330
+ const face = this.baseplanerot[i].rotateface(firstface);
2173
2331
  const facename = faceindextoname[i];
2174
2332
  for (let j = 0; j < face.length; j++) {
2175
2333
  const jj = (j + 1) % face.length;
@@ -2196,7 +2354,6 @@ var PuzzleGeometry = class {
2196
2354
  }
2197
2355
  edgenames[i] = [edgenames[i][0], c1];
2198
2356
  }
2199
- this.cornerfaces = vertexnames[0].length - 1;
2200
2357
  for (let i = 0; i < vertexnames.length; i++) {
2201
2358
  if (vertexnames[i].length < 4) {
2202
2359
  throw new Error("Bad length in vertex names");
@@ -2223,21 +2380,21 @@ var PuzzleGeometry = class {
2223
2380
  }
2224
2381
  vertexnames[i] = [vertexnames[i][0], r];
2225
2382
  }
2226
- if (this.verbose > 1) {
2383
+ if (this.options.verbosity > 1) {
2227
2384
  console.log("# Face precedence list: " + this.faceorder.join(" "));
2228
2385
  console.log("# Face names: " + facenames.map((_) => _[1]).join(" "));
2229
2386
  console.log("# Edge names: " + edgenames.map((_) => _[1]).join(" "));
2230
2387
  console.log("# Vertex names: " + vertexnames.map((_) => _[1]).join(" "));
2231
2388
  }
2232
2389
  const geonormals = [];
2233
- for (let i = 0; i < faceplanes.length; i++) {
2234
- geonormals.push([faceplanes[i][0].makenormal(), faceplanes[i][1], "f"]);
2390
+ for (const faceplane of faceplanes) {
2391
+ geonormals.push([faceplane[0].makenormal(), faceplane[1], "f"]);
2235
2392
  }
2236
- for (let i = 0; i < edgenames.length; i++) {
2237
- geonormals.push([edgenames[i][0].makenormal(), edgenames[i][1], "e"]);
2393
+ for (const edgename of edgenames) {
2394
+ geonormals.push([edgename[0].makenormal(), edgename[1], "e"]);
2238
2395
  }
2239
- for (let i = 0; i < vertexnames.length; i++) {
2240
- geonormals.push([vertexnames[i][0].makenormal(), vertexnames[i][1], "v"]);
2396
+ for (const vertexname of vertexnames) {
2397
+ geonormals.push([vertexname[0].makenormal(), vertexname[1], "v"]);
2241
2398
  }
2242
2399
  this.facenames = facenames;
2243
2400
  this.faceplanes = faceplanes;
@@ -2246,15 +2403,15 @@ var PuzzleGeometry = class {
2246
2403
  this.geonormals = geonormals;
2247
2404
  const geonormalnames = geonormals.map((_) => _[1]);
2248
2405
  this.swizzler.setGripNames(geonormalnames);
2249
- if (this.verbose) {
2406
+ if (this.options.verbosity > 0) {
2250
2407
  console.log("# Distances: face " + 1 + " edge " + this.edgedistance + " vertex " + this.vertexdistance);
2251
2408
  }
2252
2409
  for (let c = 0; c < cutplanes.length; c++) {
2253
- for (let i = 0; i < this.rotations.length; i++) {
2254
- const q = cutplanes[c].rotateplane(this.rotations[i]);
2410
+ for (const rotation of this.rotations) {
2411
+ const q = cutplanes[c].rotateplane(rotation);
2255
2412
  let wasseen = false;
2256
- for (let j = 0; j < this.moveplanes.length; j++) {
2257
- if (q.sameplane(this.moveplanes[j])) {
2413
+ for (const moveplane of this.moveplanes) {
2414
+ if (q.sameplane(moveplane)) {
2258
2415
  wasseen = true;
2259
2416
  break;
2260
2417
  }
@@ -2267,7 +2424,7 @@ var PuzzleGeometry = class {
2267
2424
  }
2268
2425
  }
2269
2426
  }
2270
- let ft = new FaceTree(faces[0]);
2427
+ let ft = new FaceTree(firstface);
2271
2428
  const tar = this.moveplanes2.slice();
2272
2429
  let rval = 31;
2273
2430
  for (let i = 0; i < tar.length; i++) {
@@ -2276,25 +2433,60 @@ var PuzzleGeometry = class {
2276
2433
  tar[j] = tar[i];
2277
2434
  rval = (rval * 1657 + 101) % 65536;
2278
2435
  }
2279
- faces = ft.collect([], true);
2436
+ const faces = ft.collect([], true);
2280
2437
  this.faces = faces;
2281
- if (this.verbose) {
2438
+ if (this.options.verbosity > 0) {
2282
2439
  console.log("# Faces is now " + faces.length);
2283
2440
  }
2284
2441
  this.stickersperface = faces.length;
2285
- let shortedge = 1e99;
2442
+ const simplerot = [];
2443
+ const cm = centermassface(firstface);
2444
+ for (const rotation of this.rotations) {
2445
+ const f = rotation.rotateface(firstface);
2446
+ if (cm.dist(centermassface(f)) < eps3) {
2447
+ simplerot.push(rotation);
2448
+ }
2449
+ }
2450
+ const finished = new Array(faces.length);
2451
+ const sortme = [];
2286
2452
  for (let i = 0; i < faces.length; i++) {
2287
- for (let j = 0; j < faces[i].length; j++) {
2288
- const k = (j + 1) % faces[i].length;
2289
- const t = faces[i][j].dist(faces[i][k]);
2290
- if (t < shortedge) {
2291
- shortedge = t;
2453
+ const cm2 = faces[i].centermass();
2454
+ sortme.push([cm.dist(cm2), cm2, i]);
2455
+ }
2456
+ sortme.sort((a, b) => a[0] - b[0]);
2457
+ for (let ii = 0; ii < faces.length; ii++) {
2458
+ const i = sortme[ii][2];
2459
+ if (!finished[i]) {
2460
+ finished[i] = true;
2461
+ for (const rot of simplerot) {
2462
+ const f2 = faces[i].rotate(rot);
2463
+ const cm2 = f2.centermass();
2464
+ for (let kk = ii + 1; kk < faces.length; kk++) {
2465
+ if (sortme[kk][0] - sortme[ii][0] > eps3) {
2466
+ break;
2467
+ }
2468
+ const k = sortme[kk][2];
2469
+ if (!finished[k] && cm2.dist(sortme[kk][1]) < eps3) {
2470
+ finished[k] = true;
2471
+ faces[k] = f2;
2472
+ break;
2473
+ }
2474
+ }
2292
2475
  }
2293
2476
  }
2294
2477
  }
2295
- this.shortedge = shortedge;
2296
- if (this.verbose) {
2297
- console.log("# Short edge is " + shortedge);
2478
+ this.shortedge = 1e99;
2479
+ for (const face of faces) {
2480
+ for (let j = 0; j < face.length; j++) {
2481
+ const k = (j + 1) % face.length;
2482
+ const t = face.get(j).dist(face.get(k));
2483
+ if (t < this.shortedge) {
2484
+ this.shortedge = t;
2485
+ }
2486
+ }
2487
+ }
2488
+ if (this.options.verbosity > 0) {
2489
+ console.log("# Short edge is " + this.shortedge);
2298
2490
  }
2299
2491
  if (shape === "c" && sawface && !sawedge && !sawvertex) {
2300
2492
  this.addNotationMapper = "NxNxNCubeMapper";
@@ -2306,13 +2498,13 @@ var PuzzleGeometry = class {
2306
2498
  if (shape === "t" && (sawvertex || sawface) && !sawedge) {
2307
2499
  this.addNotationMapper = "PyraminxOrTetraminxMapper";
2308
2500
  }
2309
- if (shape === "o" && sawface && NEW_FACE_NAMES) {
2501
+ if (shape === "o" && sawface) {
2310
2502
  this.notationMapper = new FaceRenamingMapper(this.swizzler, new FaceNameSwizzler(["F", "D", "L", "BL", "R", "U", "BR", "B"]));
2311
2503
  if (!sawedge && !sawvertex) {
2312
2504
  this.addNotationMapper = "FTOMapper";
2313
2505
  }
2314
2506
  }
2315
- if (shape === "d" && sawface && NEW_FACE_NAMES) {
2507
+ if (shape === "d" && sawface) {
2316
2508
  this.addNotationMapper = "MegaminxMapper";
2317
2509
  this.notationMapper = new FaceRenamingMapper(this.swizzler, new FaceNameSwizzler([
2318
2510
  "U",
@@ -2331,55 +2523,66 @@ var PuzzleGeometry = class {
2331
2523
  }
2332
2524
  }
2333
2525
  keyface(face) {
2334
- return this.keyface2(centermassface(face));
2526
+ return this.keyface2(face.centermass());
2335
2527
  }
2336
2528
  keyface2(cm) {
2337
2529
  let s = "";
2338
- for (let i = 0; i < this.moveplanesets.length; i++) {
2339
- if (this.moveplanesets[i].length > 0) {
2340
- const dv = cm.dot(this.moveplanesets[i][0]);
2530
+ const sfcc = String.fromCharCode;
2531
+ for (const moveplaneset of this.moveplanesets) {
2532
+ if (moveplaneset.length > 0) {
2533
+ const dv = cm.dot(moveplaneset[0]);
2341
2534
  let t = 0;
2342
2535
  let b = 1;
2343
- while (b * 2 <= this.moveplanesets[i].length) {
2536
+ while (b * 2 <= moveplaneset.length) {
2344
2537
  b *= 2;
2345
2538
  }
2346
2539
  for (; b > 0; b >>= 1) {
2347
- if (t + b <= this.moveplanesets[i].length && dv > this.moveplanesets[i][t + b - 1].a) {
2540
+ if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
2348
2541
  t += b;
2349
2542
  }
2350
2543
  }
2351
- if (t <= 90) {
2352
- s = s + String.fromCharCode(34 + t);
2544
+ if (t < 47) {
2545
+ s = s + sfcc(33 + t);
2546
+ } else if (t < 47 + 47 * 47) {
2547
+ s = s + sfcc(33 + 47 + Math.floor(t / 47) - 1) + sfcc(33 + t % 47);
2548
+ } else if (t < 47 + 47 * 47 + 47 * 47 * 47) {
2549
+ s = s + sfcc(33 + 47 + Math.floor((t - 47) / (47 * 47) - 1)) + sfcc(33 + 47 + Math.floor((t - 47) / 47) % 47) + sfcc(33 + t % 47);
2353
2550
  } else {
2354
- s = s + "!" + String.fromCharCode(34 + Math.floor(t / 90)) + String.fromCharCode(34 + t % 90);
2551
+ throw Error("Too many slices for cubie encoding");
2355
2552
  }
2356
2553
  }
2357
2554
  }
2358
2555
  return s;
2359
2556
  }
2360
- findface(face) {
2361
- const cm = centermassface(face);
2362
- const key = this.keyface2(cm);
2363
- const arr = this.facelisthash[key];
2364
- if (arr.length === 1) {
2365
- return arr[0];
2366
- }
2367
- for (let i = 0; i + 1 < arr.length; i++) {
2368
- const face2 = this.facelisthash[key][i];
2369
- if (Math.abs(cm.dist(this.facecentermass[face2])) < eps3) {
2370
- return face2;
2557
+ keyface3(face) {
2558
+ const cm = face.centermass();
2559
+ const r = [];
2560
+ for (const moveplaneset of this.moveplanesets) {
2561
+ if (moveplaneset.length > 0) {
2562
+ const dv = cm.dot(moveplaneset[0]);
2563
+ let t = 0;
2564
+ let b = 1;
2565
+ while (b * 2 <= moveplaneset.length) {
2566
+ b *= 2;
2567
+ }
2568
+ for (; b > 0; b >>= 1) {
2569
+ if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
2570
+ t += b;
2571
+ }
2572
+ }
2573
+ r.push(t);
2371
2574
  }
2372
2575
  }
2373
- return arr[arr.length - 1];
2576
+ return r;
2374
2577
  }
2375
- findface2(cm) {
2578
+ findface(cm) {
2376
2579
  const key = this.keyface2(cm);
2377
- const arr = this.facelisthash[key];
2580
+ const arr = this.facelisthash.get(key);
2378
2581
  if (arr.length === 1) {
2379
2582
  return arr[0];
2380
2583
  }
2381
2584
  for (let i = 0; i + 1 < arr.length; i++) {
2382
- const face2 = this.facelisthash[key][i];
2585
+ const face2 = this.facelisthash.get(key)[i];
2383
2586
  if (Math.abs(cm.dist(this.facecentermass[face2])) < eps3) {
2384
2587
  return face2;
2385
2588
  }
@@ -2405,22 +2608,22 @@ var PuzzleGeometry = class {
2405
2608
  return [x1, y1, off];
2406
2609
  }
2407
2610
  allstickers() {
2611
+ const t1 = tstart("allstickers");
2408
2612
  this.faces = expandfaces(this.baseplanerot, this.faces);
2409
- if (this.verbose) {
2613
+ if (this.options.verbosity > 0) {
2410
2614
  console.log("# Total stickers is now " + this.faces.length);
2411
2615
  }
2412
2616
  this.facecentermass = new Array(this.faces.length);
2413
2617
  for (let i = 0; i < this.faces.length; i++) {
2414
- this.facecentermass[i] = centermassface(this.faces[i]);
2618
+ this.facecentermass[i] = this.faces[i].centermass();
2415
2619
  }
2416
2620
  const moveplanesets = [];
2417
2621
  const moveplanenormals = [];
2418
- for (let i = 0; i < this.moveplanes.length; i++) {
2419
- const q = this.moveplanes[i];
2622
+ for (const q of this.moveplanes) {
2420
2623
  const qnormal = q.makenormal();
2421
2624
  let wasseen = false;
2422
- for (let j = 0; j < moveplanenormals.length; j++) {
2423
- if (qnormal.sameplane(moveplanenormals[j].makenormal())) {
2625
+ for (const moveplanenormal of moveplanenormals) {
2626
+ if (qnormal.sameplane(moveplanenormal.makenormal())) {
2424
2627
  wasseen = true;
2425
2628
  }
2426
2629
  }
@@ -2429,8 +2632,7 @@ var PuzzleGeometry = class {
2429
2632
  moveplanesets.push([]);
2430
2633
  }
2431
2634
  }
2432
- for (let i = 0; i < this.moveplanes2.length; i++) {
2433
- const q = this.moveplanes2[i];
2635
+ for (const q of this.moveplanes2) {
2434
2636
  const qnormal = q.makenormal();
2435
2637
  for (let j = 0; j < moveplanenormals.length; j++) {
2436
2638
  if (qnormal.sameplane(moveplanenormals[j])) {
@@ -2453,15 +2655,14 @@ var PuzzleGeometry = class {
2453
2655
  this.moveplanesets = moveplanesets;
2454
2656
  this.moveplanenormals = moveplanenormals;
2455
2657
  const sizes = moveplanesets.map((_) => _.length);
2456
- if (this.verbose) {
2658
+ if (this.options.verbosity > 0) {
2457
2659
  console.log("# Move plane sets: " + sizes);
2458
2660
  }
2459
2661
  const moverotations = [];
2460
2662
  for (let i = 0; i < moveplanesets.length; i++) {
2461
2663
  moverotations.push([]);
2462
2664
  }
2463
- for (let i = 0; i < this.rotations.length; i++) {
2464
- const q = this.rotations[i];
2665
+ for (const q of this.rotations) {
2465
2666
  if (Math.abs(Math.abs(q.a) - 1) < eps3) {
2466
2667
  continue;
2467
2668
  }
@@ -2495,14 +2696,14 @@ var PuzzleGeometry = class {
2495
2696
  const p0 = moveplanenormals[i];
2496
2697
  let neg = null;
2497
2698
  let pos = null;
2498
- for (let j = 0; j < this.geonormals.length; j++) {
2499
- const d = p0.dot(this.geonormals[j][0]);
2699
+ for (const geonormal of this.geonormals) {
2700
+ const d = p0.dot(geonormal[0]);
2500
2701
  if (Math.abs(d - 1) < eps3) {
2501
- pos = [this.geonormals[j][1], this.geonormals[j][2]];
2502
- gtype = this.geonormals[j][2];
2702
+ pos = [geonormal[1], geonormal[2]];
2703
+ gtype = geonormal[2];
2503
2704
  } else if (Math.abs(d + 1) < eps3) {
2504
- neg = [this.geonormals[j][1], this.geonormals[j][2]];
2505
- gtype = this.geonormals[j][2];
2705
+ neg = [geonormal[1], geonormal[2]];
2706
+ gtype = geonormal[2];
2506
2707
  }
2507
2708
  }
2508
2709
  if (pos === null || neg === null) {
@@ -2546,112 +2747,88 @@ var PuzzleGeometry = class {
2546
2747
  }
2547
2748
  }
2548
2749
  this.movesetgeos = movesetgeos;
2549
- const cubiehash = {};
2550
- const facelisthash = {};
2551
- const cubiekey = {};
2552
- const cubiekeys = [];
2553
- const cubies = [];
2750
+ const facelisthash = new Map();
2554
2751
  const faces = this.faces;
2555
2752
  for (let i = 0; i < faces.length; i++) {
2556
2753
  const face = faces[i];
2557
2754
  const s = this.keyface(face);
2558
- if (!cubiehash[s]) {
2559
- cubiekey[s] = cubies.length;
2560
- cubiekeys.push(s);
2561
- cubiehash[s] = [];
2562
- facelisthash[s] = [];
2563
- cubies.push(cubiehash[s]);
2564
- }
2565
- facelisthash[s].push(i);
2566
- cubiehash[s].push(face);
2567
- if (facelisthash[s].length === this.basefacecount) {
2568
- if (this.verbose) {
2569
- console.log("# Splitting core.");
2570
- }
2571
- for (let suff = 0; suff < this.basefacecount; suff++) {
2572
- const s2 = s + " " + suff;
2573
- facelisthash[s2] = [facelisthash[s][suff]];
2574
- cubiehash[s2] = [cubiehash[s][suff]];
2575
- cubiekeys.push(s2);
2576
- cubiekey[s2] = cubies.length;
2577
- cubies.push(cubiehash[s2]);
2755
+ if (!facelisthash.get(s)) {
2756
+ facelisthash.set(s, [i]);
2757
+ } else {
2758
+ const arr = facelisthash.get(s);
2759
+ arr.push(i);
2760
+ if (arr.length === this.baseFaceCount) {
2761
+ if (this.options.verbosity > 0) {
2762
+ console.log("# Splitting core.");
2763
+ }
2764
+ for (let suff = 0; suff < arr.length; suff++) {
2765
+ const s2 = s + " " + suff;
2766
+ facelisthash.set(s2, [arr[suff]]);
2767
+ }
2578
2768
  }
2579
- cubiehash[s] = [];
2580
- cubies[cubiekey[s]] = [];
2581
2769
  }
2582
2770
  }
2583
- this.cubiekey = cubiekey;
2584
2771
  this.facelisthash = facelisthash;
2585
- this.cubiekeys = cubiekeys;
2586
- if (this.verbose) {
2587
- console.log("# Cubies: " + Object.keys(cubiehash).length);
2772
+ if (this.options.verbosity > 0) {
2773
+ console.log("# Cubies: " + facelisthash.size);
2588
2774
  }
2589
- this.cubies = cubies;
2590
- for (let k = 0; k < cubies.length; k++) {
2591
- const cubie = cubies[k];
2592
- if (cubie.length < 2) {
2593
- continue;
2594
- }
2595
- if (cubie.length === this.basefacecount) {
2775
+ const cubies = [];
2776
+ const facetocubie = [];
2777
+ const facetoord = [];
2778
+ for (const facelist of facelisthash.values()) {
2779
+ if (facelist.length === this.baseFaceCount) {
2596
2780
  continue;
2597
2781
  }
2598
- if (cubie.length > 5) {
2599
- throw new Error("Bad math; too many faces on this cubie " + cubie.length);
2600
- }
2601
- const cm = cubie.map((_) => centermassface(_));
2602
- const s = this.keyface2(cm[0]);
2603
- const facelist = facelisthash[s];
2604
- const cmall = centermassface(cm);
2605
- for (let looplimit = 0; cubie.length > 2; looplimit++) {
2606
- let changed = false;
2607
- for (let i = 0; i < cubie.length; i++) {
2608
- const j = (i + 1) % cubie.length;
2609
- if (cmall.dot(cm[i].cross(cm[j])) < 0) {
2610
- const t = cubie[i];
2611
- cubie[i] = cubie[j];
2612
- cubie[j] = t;
2613
- const u = cm[i];
2614
- cm[i] = cm[j];
2615
- cm[j] = u;
2616
- const v = facelist[i];
2617
- facelist[i] = facelist[j];
2618
- facelist[j] = v;
2619
- changed = true;
2782
+ if (facelist.length > 1) {
2783
+ const cm = facelist.map((_) => faces[_].centermass());
2784
+ const cmall = centermassface(cm);
2785
+ for (let looplimit = 0; facelist.length > 2; looplimit++) {
2786
+ let changed = false;
2787
+ for (let i = 0; i < facelist.length; i++) {
2788
+ const j = (i + 1) % facelist.length;
2789
+ if (cmall.dot(cm[i].cross(cm[j])) < 0) {
2790
+ const u = cm[i];
2791
+ cm[i] = cm[j];
2792
+ cm[j] = u;
2793
+ const v = facelist[i];
2794
+ facelist[i] = facelist[j];
2795
+ facelist[j] = v;
2796
+ changed = true;
2797
+ }
2798
+ }
2799
+ if (!changed) {
2800
+ break;
2801
+ }
2802
+ if (looplimit > 1e3) {
2803
+ throw new Error("Bad epsilon math; too close to border");
2620
2804
  }
2621
2805
  }
2622
- if (!changed) {
2623
- break;
2624
- }
2625
- if (looplimit > 1e3) {
2626
- throw new Error("Bad epsilon math; too close to border");
2627
- }
2628
- }
2629
- let mini = 0;
2630
- let minf = this.findface(cubie[mini]);
2631
- for (let i = 1; i < cubie.length; i++) {
2632
- const temp = this.findface(cubie[i]);
2633
- if (this.faceprecedence[this.getfaceindex(temp)] < this.faceprecedence[this.getfaceindex(minf)]) {
2634
- mini = i;
2635
- minf = temp;
2806
+ let mini = 0;
2807
+ let minf = facelist[mini];
2808
+ for (let i = 1; i < facelist.length; i++) {
2809
+ const temp = facelist[i];
2810
+ if (this.faceprecedence[this.getfaceindex(temp)] < this.faceprecedence[this.getfaceindex(minf)]) {
2811
+ mini = i;
2812
+ minf = temp;
2813
+ }
2636
2814
  }
2637
- }
2638
- if (mini !== 0) {
2639
- const ocubie = cubie.slice();
2640
- const ofacelist = facelist.slice();
2641
- for (let i = 0; i < cubie.length; i++) {
2642
- cubie[i] = ocubie[(mini + i) % cubie.length];
2643
- facelist[i] = ofacelist[(mini + i) % cubie.length];
2815
+ if (mini !== 0) {
2816
+ const ofacelist = facelist.slice();
2817
+ for (let i = 0; i < facelist.length; i++) {
2818
+ facelist[i] = ofacelist[(mini + i) % facelist.length];
2819
+ }
2644
2820
  }
2645
2821
  }
2646
- }
2647
- const facetocubies = [];
2648
- for (let i = 0; i < cubies.length; i++) {
2649
- const facelist = facelisthash[cubiekeys[i]];
2650
2822
  for (let j = 0; j < facelist.length; j++) {
2651
- facetocubies[facelist[j]] = [i, j];
2823
+ const k = facelist[j];
2824
+ facetocubie[k] = cubies.length;
2825
+ facetoord[k] = j;
2652
2826
  }
2827
+ cubies.push(facelist);
2653
2828
  }
2654
- this.facetocubies = facetocubies;
2829
+ this.cubies = cubies;
2830
+ this.facetocubie = facetocubie;
2831
+ this.facetoord = facetoord;
2655
2832
  const typenames = ["?", "CENTERS", "EDGES", "CORNERS", "C4RNER", "C5RNER"];
2656
2833
  const cubiesetnames = [];
2657
2834
  const cubietypecounts = [0, 0, 0, 0, 0, 0];
@@ -2663,7 +2840,7 @@ var PuzzleGeometry = class {
2663
2840
  const cubieords = [];
2664
2841
  const cubievaluemap = [];
2665
2842
  const getcolorkey = (cubienum) => {
2666
- return cubies[cubienum].map((_) => this.getfaceindex(this.findface(_))).join(" ");
2843
+ return cubies[cubienum].map((_) => this.getfaceindex(_)).join(" ");
2667
2844
  };
2668
2845
  const cubiesetcubies = [];
2669
2846
  for (let i = 0; i < cubies.length; i++) {
@@ -2681,7 +2858,7 @@ var PuzzleGeometry = class {
2681
2858
  const facecnt = cubie.length;
2682
2859
  const typectr = cubietypecounts[facecnt]++;
2683
2860
  let typename = typenames[facecnt];
2684
- if (typename === void 0 || facecnt === this.basefacecount) {
2861
+ if (typename === void 0 || facecnt === this.baseFaceCount) {
2685
2862
  typename = "CORE";
2686
2863
  }
2687
2864
  typename = typename + (typectr === 0 ? "" : typectr + 1);
@@ -2701,9 +2878,9 @@ var PuzzleGeometry = class {
2701
2878
  cubiesetcubies[cubiesetnum].push(cind);
2702
2879
  cubieordnums[cind] = cubieords[cubiesetnum]++;
2703
2880
  if (queue.length < this.rotations.length) {
2704
- const cm = centermassface(cubies[cind][0]);
2705
- for (let j = 0; j < moverotations.length; j++) {
2706
- const tq = this.facetocubies[this.findface2(cm.rotatepoint(moverotations[j][0]))][0];
2881
+ const cm = this.facecentermass[cubies[cind][0]];
2882
+ for (const moverotation of moverotations) {
2883
+ const tq = this.facetocubie[this.findface(cm.rotatepoint(moverotation[0]))];
2707
2884
  if (!seen[tq]) {
2708
2885
  queue.push(tq);
2709
2886
  seen[tq] = true;
@@ -2711,21 +2888,6 @@ var PuzzleGeometry = class {
2711
2888
  }
2712
2889
  }
2713
2890
  }
2714
- const that = this;
2715
- queue.sort(function(a, b) {
2716
- if (that.cubiekeys[a] < that.cubiekeys[b]) {
2717
- return 1;
2718
- } else if (that.cubiekeys[a] > that.cubiekeys[b]) {
2719
- return -1;
2720
- } else {
2721
- return 0;
2722
- }
2723
- });
2724
- for (let i2 = 0; i2 < queue.length; i2++) {
2725
- if (i2 > 1e6) {
2726
- cubieordnums[queue[i2]] = i2;
2727
- }
2728
- }
2729
2891
  cubiesetnum++;
2730
2892
  }
2731
2893
  if (this.setReidOrder && 4 <= this.stickersperface && this.stickersperface <= 9) {
@@ -2748,27 +2910,25 @@ var PuzzleGeometry = class {
2748
2910
  ["U", "L", "F", "R", "B", "D"]
2749
2911
  ];
2750
2912
  const reidmap = {};
2751
- for (let i = 0; i < reidorder.length; i++) {
2752
- for (let j = 0; j < reidorder[i].length; j++) {
2913
+ for (const cubie of reidorder) {
2914
+ for (let j = 0; j < cubie.length; j++) {
2753
2915
  let mask = 0;
2754
- for (let k = 0; k < reidorder[i][j].length; k++) {
2755
- mask |= 1 << reidorder[i][j].charCodeAt(k) - 65;
2916
+ for (let k = 0; k < cubie[j].length; k++) {
2917
+ mask |= 1 << cubie[j].charCodeAt(k) - 65;
2756
2918
  }
2757
2919
  reidmap[mask] = j;
2758
2920
  }
2759
2921
  }
2760
- for (let i = 0; i < cubiesetnum; i++) {
2761
- for (let j = 0; j < cubiesetcubies[i].length; j++) {
2762
- const cubienum = cubiesetcubies[i][j];
2922
+ for (const cubieset of cubiesetcubies) {
2923
+ for (const cubienum of cubieset) {
2763
2924
  let mask = 0;
2764
- for (let k = 0; k < cubies[cubienum].length; k++) {
2765
- mask |= 1 << this.facenames[this.getfaceindex(this.findface(cubies[cubienum][k]))][1].charCodeAt(0) - 65;
2925
+ for (const cubie of cubies[cubienum]) {
2926
+ mask |= 1 << this.facenames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65;
2766
2927
  }
2767
2928
  cubieordnums[cubienum] = reidmap[mask];
2768
2929
  }
2769
2930
  }
2770
2931
  }
2771
- this.orbits = cubieords.length;
2772
2932
  this.cubiesetnums = cubiesetnums;
2773
2933
  this.cubieordnums = cubieordnums;
2774
2934
  this.cubiesetnames = cubiesetnames;
@@ -2776,20 +2936,21 @@ var PuzzleGeometry = class {
2776
2936
  this.orbitoris = orbitoris;
2777
2937
  this.cubievaluemap = cubievaluemap;
2778
2938
  this.cubiesetcubies = cubiesetcubies;
2779
- if (this.fixPiece !== "") {
2939
+ if (this.options.fixedPieceType !== null) {
2780
2940
  for (let i = 0; i < cubies.length; i++) {
2781
- if (this.fixPiece === "v" && cubies[i].length > 2 || this.fixPiece === "e" && cubies[i].length === 2 || this.fixPiece === "f" && cubies[i].length === 1) {
2941
+ if (this.options.fixedPieceType === "v" && cubies[i].length > 2 || this.options.fixedPieceType === "e" && cubies[i].length === 2 || this.options.fixedPieceType === "f" && cubies[i].length === 1) {
2782
2942
  this.fixedCubie = i;
2783
2943
  break;
2784
2944
  }
2785
2945
  }
2786
2946
  if (this.fixedCubie < 0) {
2787
- throw new Error("Could not find a cubie of type " + this.fixPiece + " to fix.");
2947
+ throw new Error("Could not find a cubie of type " + this.options.fixedPieceType + " to fix.");
2788
2948
  }
2789
2949
  }
2790
- if (this.verbose) {
2950
+ if (this.options.verbosity > 0) {
2791
2951
  console.log("# Cubie orbit sizes " + cubieords);
2792
2952
  }
2953
+ tend(t1);
2793
2954
  }
2794
2955
  unswizzle(mv) {
2795
2956
  const newmv = this.notationMapper.notationToInternal(mv);
@@ -2897,8 +3058,7 @@ var PuzzleGeometry = class {
2897
3058
  if (!permissivieMoveParsing && loslice === 0 && hislice === this.moveplanesets[msi].length && !fullrotation) {
2898
3059
  throw new Error("! full puzzle rotations must be specified with v suffix.");
2899
3060
  }
2900
- const r = [void 0, msi, loslice, hislice, firstgrip, move.amount];
2901
- return r;
3061
+ return [void 0, msi, loslice, hislice, firstgrip, move.amount];
2902
3062
  }
2903
3063
  parsemove(mv) {
2904
3064
  const r = this.parseMove(this.stringToBlockMove(mv));
@@ -2906,19 +3066,20 @@ var PuzzleGeometry = class {
2906
3066
  return r;
2907
3067
  }
2908
3068
  genperms() {
3069
+ const t1 = tstart("genperms");
2909
3070
  if (this.cmovesbyslice.length > 0) {
2910
3071
  return;
2911
3072
  }
2912
3073
  const cmovesbyslice = [];
2913
- if (this.orientCenters) {
3074
+ if (this.options.orientCenters) {
2914
3075
  for (let k = 0; k < this.cubies.length; k++) {
2915
3076
  if (this.cubies[k].length === 1) {
2916
- const kk = this.findface(this.cubies[k][0]);
3077
+ const kk = this.cubies[k][0];
2917
3078
  const i = this.getfaceindex(kk);
2918
- if (centermassface(this.basefaces[i]).dist(this.facecentermass[kk]) < eps3) {
3079
+ if (this.basefaces[i].centermass().dist(this.facecentermass[kk]) < eps3) {
2919
3080
  const o = this.basefaces[i].length;
2920
- for (let m = 0; m < o; m++) {
2921
- this.cubies[k].push(this.cubies[k][0]);
3081
+ for (let m = 1; m < o; m++) {
3082
+ this.cubies[k].push(this.cubies[k][m - 1]);
2922
3083
  }
2923
3084
  this.duplicatedFaces[kk] = o;
2924
3085
  this.duplicatedCubies[k] = o;
@@ -2961,7 +3122,7 @@ var PuzzleGeometry = class {
2961
3122
  if (slicenum[i] < 0) {
2962
3123
  continue;
2963
3124
  }
2964
- const b = this.facetocubies[i].slice();
3125
+ const b = [this.facetocubie[i], this.facetoord[i]];
2965
3126
  let cm = this.facecentermass[i];
2966
3127
  const ocm = cm;
2967
3128
  let fi2 = i;
@@ -2972,19 +3133,18 @@ var PuzzleGeometry = class {
2972
3133
  if (cm2.dist(ocm) < eps3) {
2973
3134
  break;
2974
3135
  }
2975
- fi2 = this.findface2(cm2);
2976
- const c = this.facetocubies[fi2];
2977
- b.push(c[0], c[1]);
3136
+ fi2 = this.findface(cm2);
3137
+ b.push(this.facetocubie[fi2], this.facetoord[fi2]);
2978
3138
  cm = cm2;
2979
3139
  }
2980
- if (b.length > 2 && this.orientCenters && (this.cubies[b[0]].length === 1 || this.cubies[b[0]][0] === this.cubies[b[0]][1])) {
2981
- if (this.facecentermass[i].dist(centermassface(this.basefaces[this.getfaceindex(i)])) < eps3) {
2982
- let face1 = this.cubies[b[0]][0];
3140
+ if (b.length > 2 && this.options.orientCenters && (this.cubies[b[0]].length === 1 || this.duplicatedCubies[b[0]] > 1)) {
3141
+ if (this.facecentermass[i].dist(this.basefaces[this.getfaceindex(i)].centermass()) < eps3) {
3142
+ let face1 = this.faces[this.cubies[b[0]][0]];
2983
3143
  for (let ii = 0; ii < b.length; ii += 2) {
2984
- const face0 = this.cubies[b[ii]][0];
3144
+ const face0 = this.faces[this.cubies[b[ii]][0]];
2985
3145
  let o = -1;
2986
3146
  for (let jj = 0; jj < face1.length; jj++) {
2987
- if (face0[jj].dist(face1[0]) < eps3) {
3147
+ if (face0.get(jj).dist(face1.get(0)) < eps3) {
2988
3148
  o = jj;
2989
3149
  break;
2990
3150
  }
@@ -2993,12 +3153,12 @@ var PuzzleGeometry = class {
2993
3153
  throw new Error("Couldn't find rotation of center faces; ignoring for now.");
2994
3154
  } else {
2995
3155
  b[ii + 1] = o;
2996
- face1 = this.moverotations[k][0].rotateface(face1);
3156
+ face1 = face1.rotate(this.moverotations[k][0]);
2997
3157
  }
2998
3158
  }
2999
3159
  }
3000
3160
  }
3001
- if (b.length === 2 && this.orientCenters) {
3161
+ if (b.length === 2 && this.options.orientCenters) {
3002
3162
  for (let ii = 1; ii < this.movesetorders[k]; ii++) {
3003
3163
  if (sc === 0) {
3004
3164
  b.push(b[0], ii);
@@ -3011,32 +3171,30 @@ var PuzzleGeometry = class {
3011
3171
  if (b.length !== 2 * this.movesetorders[k]) {
3012
3172
  throw new Error("Bad length in perm gen");
3013
3173
  }
3014
- for (let j = 0; j < b.length; j++) {
3015
- axiscmoves[sc].push(b[j]);
3174
+ for (const v of b) {
3175
+ axiscmoves[sc].push(v);
3016
3176
  }
3017
3177
  }
3018
3178
  for (let j = 0; j < b.length; j += 2) {
3019
3179
  cubiedone[b[j]] = true;
3020
3180
  }
3021
3181
  }
3182
+ for (let kk = 0; kk < axiscmoves.length; kk++) {
3183
+ axiscmoves[kk] = axiscmoves[kk].slice();
3184
+ }
3022
3185
  cmovesbyslice.push(axiscmoves);
3023
3186
  }
3024
3187
  this.cmovesbyslice = cmovesbyslice;
3025
- if (this.movelist !== void 0) {
3188
+ if (this.options.moveList) {
3026
3189
  const parsedmovelist = [];
3027
- for (let i = 0; i < this.movelist.length; i++) {
3028
- parsedmovelist.push(this.parsemove(this.movelist[i]));
3190
+ for (const moveString of this.options.moveList) {
3191
+ parsedmovelist.push(this.parsemove(moveString));
3029
3192
  }
3030
3193
  this.parsedmovelist = parsedmovelist;
3031
3194
  }
3032
- this.facelisthash = null;
3195
+ this.facelisthash.clear();
3033
3196
  this.facecentermass = [];
3034
- this.cubiekey = [];
3035
- }
3036
- getfaces() {
3037
- return this.faces.map((_) => {
3038
- return _.map((__) => [__.b, __.c, __.d]);
3039
- });
3197
+ tend(t1);
3040
3198
  }
3041
3199
  getboundarygeometry() {
3042
3200
  return {
@@ -3052,8 +3210,7 @@ var PuzzleGeometry = class {
3052
3210
  const slices = this.moveplanesets[k].length;
3053
3211
  let r = [];
3054
3212
  if (this.parsedmovelist !== void 0) {
3055
- for (let i = 0; i < this.parsedmovelist.length; i++) {
3056
- const parsedmove = this.parsedmovelist[i];
3213
+ for (const parsedmove of this.parsedmovelist) {
3057
3214
  if (parsedmove[1] !== k) {
3058
3215
  continue;
3059
3216
  }
@@ -3064,19 +3221,19 @@ var PuzzleGeometry = class {
3064
3221
  }
3065
3222
  r.push(parsedmove[5]);
3066
3223
  }
3067
- } else if (this.vertexmoves && !this.allmoves) {
3224
+ } else if (this.options.vertexMoves && !this.options.allMoves) {
3068
3225
  const msg = this.movesetgeos[k];
3069
3226
  if (msg[1] !== msg[3]) {
3070
3227
  for (let i = 0; i < slices; i++) {
3071
3228
  if (msg[1] !== "v") {
3072
- if (this.outerblockmoves) {
3229
+ if (this.options.outerBlockMoves) {
3073
3230
  r.push([i + 1, slices]);
3074
3231
  } else {
3075
3232
  r.push([i + 1]);
3076
3233
  }
3077
3234
  r.push(1);
3078
3235
  } else {
3079
- if (this.outerblockmoves) {
3236
+ if (this.options.outerBlockMoves) {
3080
3237
  r.push([0, i]);
3081
3238
  } else {
3082
3239
  r.push([i, i]);
@@ -3087,10 +3244,10 @@ var PuzzleGeometry = class {
3087
3244
  }
3088
3245
  } else {
3089
3246
  for (let i = 0; i <= slices; i++) {
3090
- if (!this.allmoves && i + i === slices) {
3247
+ if (!this.options.allMoves && i + i === slices) {
3091
3248
  continue;
3092
3249
  }
3093
- if (this.outerblockmoves) {
3250
+ if (this.options.outerBlockMoves) {
3094
3251
  if (i + i > slices) {
3095
3252
  r.push([i, slices]);
3096
3253
  } else {
@@ -3103,7 +3260,7 @@ var PuzzleGeometry = class {
3103
3260
  }
3104
3261
  }
3105
3262
  if (this.fixedCubie >= 0) {
3106
- const dep = +this.cubiekeys[this.fixedCubie].trim().split(" ")[k];
3263
+ const dep = this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[k];
3107
3264
  const newr = [];
3108
3265
  for (let i = 0; i < r.length; i += 2) {
3109
3266
  let o = r[i];
@@ -3137,27 +3294,20 @@ var PuzzleGeometry = class {
3137
3294
  if (this.duplicatedCubies[cubie]) {
3138
3295
  ori = 1;
3139
3296
  }
3140
- return ori === 1 && (this.graycenters || !this.centersets) || ori === 2 && (this.grayedges || !this.edgesets) || ori > 2 && (this.graycorners || !this.cornersets);
3297
+ return ori === 1 && (this.options.grayCenters || !this.options.includeCenterOrbits) || ori === 2 && (this.options.grayEdges || !this.options.includeEdgeOrbits) || ori > 2 && (this.options.grayCorners || !this.options.includeCornerOrbits);
3141
3298
  }
3142
3299
  skipbyori(cubie) {
3143
3300
  let ori = this.cubies[cubie].length;
3144
3301
  if (this.duplicatedCubies[cubie]) {
3145
3302
  ori = 1;
3146
3303
  }
3147
- return ori === 1 && !this.centersets || ori === 2 && !this.edgesets || ori > 2 && !this.cornersets;
3304
+ return ori === 1 && !this.options.includeCenterOrbits || ori === 2 && !this.options.includeEdgeOrbits || ori > 2 && !this.options.includeCornerOrbits;
3148
3305
  }
3149
3306
  skipcubie(fi) {
3150
3307
  return this.skipbyori(fi);
3151
3308
  }
3152
- skipset(set) {
3153
- if (set.length === 0) {
3154
- return true;
3155
- }
3156
- const fi = set[0];
3157
- return this.skipbyori(this.facetocubies[fi][0]);
3158
- }
3159
3309
  header(comment) {
3160
- return comment + copyright + "\n" + comment + this.args + "\n";
3310
+ return comment + copyright + "\n" + comment + "\n";
3161
3311
  }
3162
3312
  writegap() {
3163
3313
  const os = this.getOrbitsDef(false);
@@ -3182,6 +3332,8 @@ var PuzzleGeometry = class {
3182
3332
  r.push("];");
3183
3333
  const ip = os.solved.identicalPieces();
3184
3334
  r.push("ip:=[" + ip.map((_) => "[" + _.map((__) => __ + 1).join(",") + "]").join(",") + "];");
3335
+ r.push("# Size(Group(Gen));");
3336
+ r.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));");
3185
3337
  r.push("");
3186
3338
  return this.header("# ") + r.join("\n");
3187
3339
  }
@@ -3189,9 +3341,12 @@ var PuzzleGeometry = class {
3189
3341
  const od = this.getOrbitsDef(false);
3190
3342
  return this.header("# ") + od.toKsolve(name, this.notationMapper).join("\n");
3191
3343
  }
3192
- writekpuzzle(fortwisty = true) {
3193
- const od = this.getOrbitsDef(fortwisty);
3194
- const r = od.toKpuzzle();
3344
+ writekpuzzle(fortwisty = true, includemoves = true) {
3345
+ const od = this.getOrbitsDef(fortwisty, includemoves);
3346
+ const r = od.toKPuzzle(includemoves);
3347
+ if (!r) {
3348
+ throw new Error("Missing definition!");
3349
+ }
3195
3350
  r.moveNotation = new PGNotation(this, od);
3196
3351
  return r;
3197
3352
  }
@@ -3199,9 +3354,9 @@ var PuzzleGeometry = class {
3199
3354
  const moveorbits = [];
3200
3355
  const perms = [];
3201
3356
  const oris = [];
3202
- for (let ii = 0; ii < this.cubiesetnames.length; ii++) {
3203
- perms.push(iota(this.cubieords[ii]));
3204
- oris.push(zeros(this.cubieords[ii]));
3357
+ for (const len of this.cubieords) {
3358
+ perms.push(iota(len));
3359
+ oris.push(zeros(len));
3205
3360
  }
3206
3361
  for (let m = moverange[0]; m <= moverange[1]; m++) {
3207
3362
  const slicecmoves = axiscmoves[m];
@@ -3219,49 +3374,49 @@ var PuzzleGeometry = class {
3219
3374
  }
3220
3375
  if (perms[setnum] === iota(this.cubieords[setnum])) {
3221
3376
  perms[setnum] = perms[setnum].slice();
3222
- if (this.orbitoris[setnum] > 1 && !this.killorientation) {
3377
+ if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
3223
3378
  oris[setnum] = oris[setnum].slice();
3224
3379
  }
3225
3380
  }
3226
3381
  for (let ii = 0; ii < mperm.length; ii += 2) {
3227
3382
  perms[setnum][mperm[(ii + inc) % mperm.length]] = mperm[ii];
3228
- if (this.orbitoris[setnum] > 1 && !this.killorientation) {
3383
+ if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
3229
3384
  oris[setnum][mperm[ii]] = (mperm[(ii + oinc) % mperm.length] - mperm[(ii + 1) % mperm.length] + 2 * this.orbitoris[setnum]) % this.orbitoris[setnum];
3230
3385
  }
3231
3386
  }
3232
3387
  }
3233
3388
  }
3234
- let lastId = new Orbit(iota(24), zeros(24), 1);
3389
+ let lastId = new PGOrbit(iota(24), zeros(24), 1);
3235
3390
  for (let ii = 0; ii < this.cubiesetnames.length; ii++) {
3236
3391
  if (setmoves && !setmoves[ii]) {
3237
3392
  continue;
3238
3393
  }
3239
- if (this.orbitoris[ii] === 1 || this.killorientation) {
3394
+ if (this.orbitoris[ii] === 1 || this.options.fixedOrientation) {
3240
3395
  if (perms[ii] === iota(lastId.perm.length)) {
3241
3396
  if (perms[ii] !== lastId.perm) {
3242
- lastId = new Orbit(perms[ii], oris[ii], 1);
3397
+ lastId = new PGOrbit(perms[ii], oris[ii], 1);
3243
3398
  }
3244
3399
  moveorbits.push(lastId);
3245
3400
  } else {
3246
- moveorbits.push(new Orbit(perms[ii], oris[ii], 1));
3401
+ moveorbits.push(new PGOrbit(perms[ii], oris[ii], 1));
3247
3402
  }
3248
3403
  } else {
3249
3404
  const no = new Array(oris[ii].length);
3250
3405
  for (let jj = 0; jj < perms[ii].length; jj++) {
3251
3406
  no[jj] = oris[ii][perms[ii][jj]];
3252
3407
  }
3253
- moveorbits.push(new Orbit(perms[ii], no, this.orbitoris[ii]));
3408
+ moveorbits.push(new PGOrbit(perms[ii], no, this.orbitoris[ii]));
3254
3409
  }
3255
3410
  }
3256
- let mv = new Transformation(moveorbits);
3411
+ let mv = new PGTransform(moveorbits);
3257
3412
  if (amount !== 1) {
3258
3413
  mv = mv.mulScalar(amount);
3259
3414
  }
3260
3415
  return mv;
3261
3416
  }
3262
3417
  omitSet(name) {
3263
- for (let k = 0; k < this.omitsets.length; k++) {
3264
- if (this.omitsets[k] === name) {
3418
+ for (const excludedSet of this.options.excludeOrbits) {
3419
+ if (excludedSet === name) {
3265
3420
  return true;
3266
3421
  }
3267
3422
  }
@@ -3287,7 +3442,7 @@ var PuzzleGeometry = class {
3287
3442
  }
3288
3443
  return false;
3289
3444
  }
3290
- getOrbitsDef(fortwisty) {
3445
+ getOrbitsDef(fortwisty, includemoves = true) {
3291
3446
  const setmoves = [];
3292
3447
  if (fortwisty) {
3293
3448
  for (let i = 0; i < this.cubiesetnames.length; i++) {
@@ -3301,13 +3456,13 @@ var PuzzleGeometry = class {
3301
3456
  for (let k = 0; k < this.moveplanesets.length; k++) {
3302
3457
  const moveset = this.getmovesets(k);
3303
3458
  mps.push(moveset);
3304
- if (this.addrotations) {
3459
+ if (this.options.addRotations) {
3305
3460
  addrot.push(1);
3306
3461
  } else {
3307
3462
  addrot.push(0);
3308
3463
  }
3309
3464
  }
3310
- if (this.movelist && this.addrotations) {
3465
+ if (this.options.moveList && this.options.addRotations) {
3311
3466
  for (let i = 0; i < this.moverotations.length; i++) {
3312
3467
  addrot[i] = 0;
3313
3468
  }
@@ -3321,18 +3476,20 @@ var PuzzleGeometry = class {
3321
3476
  }
3322
3477
  let found = -1;
3323
3478
  let neg = false;
3324
- for (let j = 0; found < 0 && j < this.moveplanenormals.length; j++) {
3479
+ for (let j = 0; j < this.moveplanenormals.length; j++) {
3325
3480
  if (nn.dist(this.moveplanenormals[j]) < eps3) {
3326
3481
  found = j;
3482
+ break;
3327
3483
  } else if (nn.dist(this.moveplanenormals[j].smul(-1)) < eps3) {
3328
3484
  found = j;
3329
3485
  neg = true;
3486
+ break;
3330
3487
  }
3331
3488
  }
3332
3489
  if (found < 0) {
3333
3490
  throw new Error("Could not find rotation");
3334
3491
  }
3335
- let cmp = mps[found];
3492
+ const cmp = mps[found];
3336
3493
  if (cmp.length !== mps[k].length || this.moveplanesets[k].length !== this.moveplanesets[found].length || this.diffmvsets(cmp, mps[k], this.moveplanesets[found].length, neg)) {
3337
3494
  addrot[i] |= ii;
3338
3495
  }
@@ -3401,7 +3558,7 @@ var PuzzleGeometry = class {
3401
3558
  continue;
3402
3559
  }
3403
3560
  setnames.push(this.cubiesetnames[i]);
3404
- setdefs.push(new OrbitDef(this.cubieords[i], this.killorientation ? 1 : this.orbitoris[i]));
3561
+ setdefs.push(new PGOrbitDef(this.cubieords[i], this.options.fixedOrientation ? 1 : this.orbitoris[i]));
3405
3562
  }
3406
3563
  const solved = [];
3407
3564
  for (let i = 0; i < this.cubiesetnames.length; i++) {
@@ -3422,36 +3579,37 @@ var PuzzleGeometry = class {
3422
3579
  }
3423
3580
  o.push(0);
3424
3581
  }
3425
- solved.push(new Orbit(p, o, this.killorientation ? 1 : this.orbitoris[i]));
3582
+ solved.push(new PGOrbit(p, o, this.options.fixedOrientation ? 1 : this.orbitoris[i]));
3426
3583
  }
3427
3584
  const movenames = [];
3428
3585
  const moves = [];
3429
- for (let k = 0; k < this.moveplanesets.length; k++) {
3430
- const moveplaneset = this.moveplanesets[k];
3431
- const slices = moveplaneset.length;
3432
- const moveset = mps[k];
3433
- const movesetgeo = this.movesetgeos[k];
3434
- for (let i = 0; i < moveset.length; i += 2) {
3435
- const movebits = moveset[i];
3436
- const mna = getmovename(movesetgeo, movebits, slices);
3437
- const movename = mna[0];
3438
- const inverted = mna[1];
3439
- if (moveset[i + 1] === 1) {
3440
- movenames.push(movename);
3441
- } else {
3442
- movenames.push(movename + moveset[i + 1]);
3586
+ if (includemoves) {
3587
+ for (let k = 0; k < this.moveplanesets.length; k++) {
3588
+ const moveplaneset = this.moveplanesets[k];
3589
+ const slices = moveplaneset.length;
3590
+ const moveset = mps[k];
3591
+ const movesetgeo = this.movesetgeos[k];
3592
+ for (let i = 0; i < moveset.length; i += 2) {
3593
+ const movebits = moveset[i];
3594
+ const mna = getmovename(movesetgeo, movebits, slices);
3595
+ const movename = mna[0];
3596
+ const inverted = mna[1];
3597
+ if (moveset[i + 1] === 1) {
3598
+ movenames.push(movename);
3599
+ } else {
3600
+ movenames.push(movename + moveset[i + 1]);
3601
+ }
3602
+ const mv = this.getMoveFromBits(movebits, moveset[i + 1], inverted, this.cmovesbyslice[k], setmoves, this.movesetorders[k]);
3603
+ moves.push(mv);
3443
3604
  }
3444
- const mv = this.getMoveFromBits(movebits, moveset[i + 1], inverted, this.cmovesbyslice[k], setmoves, this.movesetorders[k]);
3445
- moves.push(mv);
3446
3605
  }
3447
3606
  }
3448
- this.ksolvemovenames = movenames;
3449
- let r = new OrbitsDef(setnames, setdefs, new VisibleState(solved), movenames, moves);
3450
- if (this.optimize) {
3607
+ let r = new PGOrbitsDef(setnames, setdefs, new VisibleState(solved), movenames, moves);
3608
+ if (this.options.optimizeOrbits) {
3451
3609
  r = r.optimize();
3452
3610
  }
3453
- if (this.scramble !== 0) {
3454
- r.scramble(this.scramble);
3611
+ if (this.options.scrambleAmount !== 0) {
3612
+ r.scramble(this.options.scrambleAmount);
3455
3613
  }
3456
3614
  return r;
3457
3615
  }
@@ -3463,7 +3621,7 @@ var PuzzleGeometry = class {
3463
3621
  }
3464
3622
  getsolved() {
3465
3623
  const r = [];
3466
- for (let i = 0; i < this.basefacecount; i++) {
3624
+ for (let i = 0; i < this.baseFaceCount; i++) {
3467
3625
  for (let j = 0; j < this.stickersperface; j++) {
3468
3626
  r.push(i);
3469
3627
  }
@@ -3471,10 +3629,10 @@ var PuzzleGeometry = class {
3471
3629
  return new Perm(r);
3472
3630
  }
3473
3631
  getOrientationRotation(desiredRotation) {
3474
- const feature1name = desiredRotation[0];
3475
- const direction1 = new Quat(0, desiredRotation[1][0], -desiredRotation[1][1], desiredRotation[1][2]);
3476
- const feature2name = desiredRotation[2];
3477
- const direction2 = new Quat(0, desiredRotation[3][0], -desiredRotation[3][1], desiredRotation[3][2]);
3632
+ const [feature1name, [x1, y1, z1]] = desiredRotation[0];
3633
+ const direction1 = new Quat(0, x1, -y1, z1);
3634
+ const [feature2name, [x2, y2, z2]] = desiredRotation[1];
3635
+ const direction2 = new Quat(0, x2, -y2, z2);
3478
3636
  let feature1 = null;
3479
3637
  let feature2 = null;
3480
3638
  const feature1geoname = this.swizzler.unswizzle(feature1name);
@@ -3499,22 +3657,22 @@ var PuzzleGeometry = class {
3499
3657
  return r2.mul(r1);
3500
3658
  }
3501
3659
  getInitial3DRotation() {
3502
- const basefacecount = this.basefacecount;
3503
- let rotDesc = null;
3504
- if (this.puzzleOrientation) {
3505
- rotDesc = this.puzzleOrientation;
3506
- } else if (this.puzzleOrientations) {
3507
- rotDesc = this.puzzleOrientations[basefacecount];
3660
+ const basefacecount = this.baseFaceCount;
3661
+ let orientationDescription = null;
3662
+ if (this.options.puzzleOrientation) {
3663
+ orientationDescription = this.options.puzzleOrientation;
3664
+ } else if (this.options.puzzleOrientations) {
3665
+ orientationDescription = this.options.puzzleOrientations[basefacecount];
3508
3666
  }
3509
- if (!rotDesc) {
3510
- rotDesc = defaultOrientations()[basefacecount];
3667
+ if (!orientationDescription) {
3668
+ orientationDescription = defaultOrientations()[basefacecount];
3511
3669
  }
3512
- if (!rotDesc) {
3670
+ if (!orientationDescription) {
3513
3671
  throw new Error("No default orientation?");
3514
3672
  }
3515
- return this.getOrientationRotation(rotDesc);
3673
+ return this.getOrientationRotation(orientationDescription);
3516
3674
  }
3517
- generatesvg(w = 800, h = 500, trim = 10, threed = false) {
3675
+ generate2dmapping(w = 800, h = 500, trim = 10, threed = false, twodshrink = 0.92) {
3518
3676
  w -= 2 * trim;
3519
3677
  h -= 2 * trim;
3520
3678
  function extendedges(a, n) {
@@ -3530,29 +3688,6 @@ var PuzzleGeometry = class {
3530
3688
  a.push([a[i - 1][0] + dx, a[i - 1][1] + dy]);
3531
3689
  }
3532
3690
  }
3533
- function noise(c) {
3534
- return c + 0 * (Math.random() - 0.5);
3535
- }
3536
- function drawedges(id, pts, color) {
3537
- return '<polygon id="' + id + '" class="sticker" style="fill: ' + color + '" points="' + pts.map((p) => noise(p[0]) + " " + noise(p[1])).join(" ") + '"/>\n';
3538
- }
3539
- let needvertexgrips = this.addrotations;
3540
- let neededgegrips = this.addrotations;
3541
- let needfacegrips = this.addrotations;
3542
- for (let i = 0; i < this.movesetgeos.length; i++) {
3543
- const msg = this.movesetgeos[i];
3544
- for (let j = 1; j <= 3; j += 2) {
3545
- if (msg[j] === "v") {
3546
- needvertexgrips = true;
3547
- }
3548
- if (msg[j] === "f") {
3549
- needfacegrips = true;
3550
- }
3551
- if (msg[j] === "e") {
3552
- neededgegrips = true;
3553
- }
3554
- }
3555
- }
3556
3691
  this.genperms();
3557
3692
  const boundarygeo = this.getboundarygeometry();
3558
3693
  const face0 = boundarygeo.facenames[0][0];
@@ -3571,13 +3706,13 @@ var PuzzleGeometry = class {
3571
3706
  [0, 0]
3572
3707
  ];
3573
3708
  extendedges(edges[net[0][0]], polyn);
3574
- for (let i = 0; i < net.length; i++) {
3575
- const f0 = net[i][0];
3709
+ for (const neti of net) {
3710
+ const f0 = neti[0];
3576
3711
  if (!edges[f0]) {
3577
3712
  throw new Error("Bad edge description; first edge not connected.");
3578
3713
  }
3579
- for (let j = 1; j < net[i].length; j++) {
3580
- const f1 = net[i][j];
3714
+ for (let j = 1; j < neti.length; j++) {
3715
+ const f1 = neti[j];
3581
3716
  if (f1 === "" || edges[f1]) {
3582
3717
  continue;
3583
3718
  }
@@ -3587,11 +3722,11 @@ var PuzzleGeometry = class {
3587
3722
  }
3588
3723
  for (const f in edges) {
3589
3724
  const es = edges[f];
3590
- for (let i = 0; i < es.length; i++) {
3591
- minx = Math.min(minx, es[i][0]);
3592
- maxx = Math.max(maxx, es[i][0]);
3593
- miny = Math.min(miny, es[i][1]);
3594
- maxy = Math.max(maxy, es[i][1]);
3725
+ for (const esi of es) {
3726
+ minx = Math.min(minx, esi[0]);
3727
+ maxx = Math.max(maxx, esi[0]);
3728
+ miny = Math.min(miny, esi[1]);
3729
+ maxy = Math.max(maxy, esi[1]);
3595
3730
  }
3596
3731
  }
3597
3732
  const sc = Math.min(w / (maxx - minx), h / (maxy - miny));
@@ -3612,8 +3747,8 @@ var PuzzleGeometry = class {
3612
3747
  ]);
3613
3748
  const connectat = [];
3614
3749
  connectat[0] = 0;
3615
- for (let i = 0; i < net.length; i++) {
3616
- const f0 = net[i][0];
3750
+ for (const neti of net) {
3751
+ const f0 = neti[0];
3617
3752
  if (!edges2[f0]) {
3618
3753
  throw new Error("Bad edge description; first edge not connected.");
3619
3754
  }
@@ -3628,8 +3763,8 @@ var PuzzleGeometry = class {
3628
3763
  throw new Error("Could not find first face name " + f0);
3629
3764
  }
3630
3765
  const thisface = bg.facenames[gfi][0];
3631
- for (let j = 1; j < net[i].length; j++) {
3632
- const f1 = net[i][j];
3766
+ for (let j = 1; j < neti.length; j++) {
3767
+ const f1 = neti[j];
3633
3768
  if (f1 === "" || edges2[f1]) {
3634
3769
  continue;
3635
3770
  }
@@ -3670,26 +3805,22 @@ var PuzzleGeometry = class {
3670
3805
  }
3671
3806
  }
3672
3807
  }
3673
- const pos = this.getsolved();
3674
- const colormap = [];
3675
- const facegeo = [];
3676
- for (let i = 0; i < this.basefacecount; i++) {
3677
- colormap[i] = this.colors[this.facenames[i][1]];
3678
- }
3679
3808
  let hix = 0;
3680
3809
  let hiy = 0;
3681
3810
  const rot = this.getInitial3DRotation();
3682
- for (let i = 0; i < this.faces.length; i++) {
3683
- let face = this.faces[i];
3684
- face = rot.rotateface(face);
3811
+ for (let face of this.faces) {
3812
+ if (threed) {
3813
+ face = face.rotate(rot);
3814
+ }
3685
3815
  for (let j = 0; j < face.length; j++) {
3686
- hix = Math.max(hix, Math.abs(face[j].b));
3687
- hiy = Math.max(hiy, Math.abs(face[j].c));
3816
+ hix = Math.max(hix, Math.abs(face.get(j).b));
3817
+ hiy = Math.max(hiy, Math.abs(face.get(j).c));
3688
3818
  }
3689
3819
  }
3690
3820
  const sc2 = Math.min(h / hiy / 2, (w - trim) / hix / 4);
3691
3821
  const mappt2d = (fn, q) => {
3692
3822
  if (threed) {
3823
+ q = q.rotatepoint(rot);
3693
3824
  const xoff2 = 0.5 * trim + 0.25 * w;
3694
3825
  const xmul = this.baseplanes[fn].rotateplane(rot).d < 0 ? 1 : -1;
3695
3826
  return [
@@ -3698,25 +3829,42 @@ var PuzzleGeometry = class {
3698
3829
  ];
3699
3830
  } else {
3700
3831
  const g = geos[this.facenames[fn][1]];
3701
- return [trim + q.dot(g[0]) + g[2].b, trim + h - q.dot(g[1]) - g[2].c];
3832
+ return [
3833
+ trim + twodshrink * q.dot(g[0]) + g[2].b,
3834
+ trim + h - twodshrink * q.dot(g[1]) - g[2].c
3835
+ ];
3702
3836
  }
3703
3837
  };
3838
+ return mappt2d;
3839
+ }
3840
+ generatesvg(w = 800, h = 500, trim = 10, threed = false) {
3841
+ const mappt2d = this.generate2dmapping(w, h, trim, threed);
3842
+ function drawedges(id, pts, color) {
3843
+ return '<polygon id="' + id + '" class="sticker" style="fill: ' + color + '" points="' + pts.map((p) => p[0] + " " + p[1]).join(" ") + '"/>\n';
3844
+ }
3845
+ const pos = this.getsolved();
3846
+ const colormap = [];
3847
+ const facegeo = [];
3848
+ for (let i = 0; i < this.baseFaceCount; i++) {
3849
+ colormap[i] = this.colors[this.facenames[i][1]];
3850
+ }
3704
3851
  for (let i = 0; i < this.faces.length; i++) {
3705
- let face = this.faces[i];
3852
+ const face = this.faces[i];
3706
3853
  const facenum = Math.floor(i / this.stickersperface);
3707
- if (threed) {
3708
- face = rot.rotateface(face);
3854
+ const fg = [];
3855
+ for (let j = 0; j < face.length; j++) {
3856
+ fg.push(mappt2d(facenum, face.get(j)));
3709
3857
  }
3710
- facegeo.push(face.map((_) => mappt2d(facenum, _)));
3858
+ facegeo.push(fg);
3711
3859
  }
3712
3860
  const svg = [];
3713
- for (let j = 0; j < this.basefacecount; j++) {
3861
+ for (let j = 0; j < this.baseFaceCount; j++) {
3714
3862
  svg.push("<g>");
3715
3863
  svg.push("<title>" + this.facenames[j][1] + "</title>\n");
3716
3864
  for (let ii = 0; ii < this.stickersperface; ii++) {
3717
3865
  const i = j * this.stickersperface + ii;
3718
- const cubie = this.facetocubies[i][0];
3719
- const cubieori = this.facetocubies[i][1];
3866
+ const cubie = this.facetocubie[i];
3867
+ const cubieori = this.facetoord[i];
3720
3868
  const cubiesetnum = this.cubiesetnums[cubie];
3721
3869
  const cubieord = this.cubieordnums[cubie];
3722
3870
  const color = this.graybyori(cubie) ? "#808080" : colormap[pos.p[i]];
@@ -3731,122 +3879,53 @@ var PuzzleGeometry = class {
3731
3879
  }
3732
3880
  svg.push("</g>");
3733
3881
  }
3734
- const svggrips = [];
3735
- function addgrip(onface, name, pt, order) {
3736
- const pt2 = mappt2d(onface, pt);
3737
- for (let i = 0; i < svggrips.length; i++) {
3738
- if (Math.hypot(pt2[0] - svggrips[i][0], pt2[1] - svggrips[i][1]) < eps3) {
3739
- return;
3740
- }
3741
- }
3742
- svggrips.push([pt2[0], pt2[1], name, order]);
3743
- }
3744
- for (let i = 0; i < this.faceplanes.length; i++) {
3745
- const baseface = this.facenames[i][0];
3746
- let facecoords = baseface;
3747
- if (threed) {
3748
- facecoords = rot.rotateface(facecoords);
3749
- }
3750
- if (needfacegrips) {
3751
- let pt = this.faceplanes[i][0];
3752
- if (threed) {
3753
- pt = pt.rotatepoint(rot);
3754
- }
3755
- addgrip(i, this.faceplanes[i][1], pt, polyn);
3756
- }
3757
- for (let j = 0; j < baseface.length; j++) {
3758
- if (neededgegrips) {
3759
- const mp = baseface[j].sum(baseface[(j + 1) % baseface.length]).smul(0.5);
3760
- const ep = findelement(this.edgenames, mp);
3761
- const mpc = facecoords[j].sum(facecoords[(j + 1) % baseface.length]).smul(0.5);
3762
- addgrip(i, this.edgenames[ep][1], mpc, 2);
3763
- }
3764
- if (needvertexgrips) {
3765
- const vp = findelement(this.vertexnames, baseface[j]);
3766
- addgrip(i, this.vertexnames[vp][1], facecoords[j], this.cornerfaces);
3767
- }
3768
- }
3769
- }
3770
3882
  const html = '<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 800 500">\n<style type="text/css"><![CDATA[.sticker { stroke: #000000; stroke-width: 1px; }]]></style>\n' + svg.join("") + "</svg>";
3771
- this.svggrips = svggrips;
3772
3883
  return html;
3773
3884
  }
3774
- dist(a, b) {
3775
- return Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
3776
- }
3777
- triarea(a, b, c) {
3778
- const ab = this.dist(a, b);
3779
- const bc = this.dist(b, c);
3780
- const ac = this.dist(a, c);
3781
- const p = (ab + bc + ac) / 2;
3782
- return Math.sqrt(p * (p - ab) * (p - bc) * (p - ac));
3783
- }
3784
- polyarea(coords) {
3785
- let sum = 0;
3786
- for (let i = 2; i < coords.length; i++) {
3787
- sum += this.triarea(coords[0], coords[1], coords[i]);
3788
- }
3789
- return sum;
3790
- }
3791
- get3d(colorfrac = DEFAULT_COLOR_FRACTION, options) {
3885
+ get3d(options) {
3792
3886
  const stickers = [];
3793
- const foundations = [];
3794
3887
  const rot = this.getInitial3DRotation();
3795
3888
  const faces = [];
3796
- const maxdist = 0.52 * this.basefaces[0][0].len();
3797
- let avgstickerarea = 0;
3889
+ const maxdist = 0.52 * this.basefaces[0].get(0).len();
3798
3890
  for (let i = 0; i < this.basefaces.length; i++) {
3799
- const coords = rot.rotateface(this.basefaces[i]);
3891
+ const coords = this.basefaces[i].rotate(rot);
3800
3892
  const name = this.facenames[i][1];
3801
3893
  faces.push({ coords: toFaceCoords(coords, maxdist), name });
3802
- avgstickerarea += this.polyarea(faces[i].coords);
3803
3894
  }
3804
- avgstickerarea /= this.faces.length;
3805
- const trim = Math.sqrt(avgstickerarea) * (1 - Math.sqrt(colorfrac)) / 2;
3806
3895
  for (let i = 0; i < this.faces.length; i++) {
3807
3896
  const facenum = Math.floor(i / this.stickersperface);
3808
- const cubie = this.facetocubies[i][0];
3809
- const cubieori = this.facetocubies[i][1];
3897
+ const cubie = this.facetocubie[i];
3898
+ const cubieori = this.facetoord[i];
3810
3899
  const cubiesetnum = this.cubiesetnums[cubie];
3811
3900
  const cubieord = this.cubieordnums[cubie];
3812
3901
  let color = this.graybyori(cubie) ? "#808080" : this.colors[this.facenames[facenum][1]];
3813
3902
  if (options?.stickerColors) {
3814
3903
  color = options.stickerColors[i];
3815
3904
  }
3816
- let coords = rot.rotateface(this.faces[i]);
3817
- foundations.push({
3818
- coords: toFaceCoords(coords, maxdist),
3819
- color,
3820
- orbit: this.cubiesetnames[cubiesetnum],
3821
- ord: cubieord,
3822
- ori: cubieori
3823
- });
3824
- const fcoords = coords;
3825
- if (trim && trim > 0) {
3826
- coords = trimEdges(coords, trim);
3827
- }
3905
+ const coords = this.faces[i].rotate(rot);
3828
3906
  stickers.push({
3829
3907
  coords: toFaceCoords(coords, maxdist),
3830
3908
  color,
3831
3909
  orbit: this.cubiesetnames[cubiesetnum],
3832
3910
  ord: cubieord,
3833
- ori: cubieori
3911
+ ori: cubieori,
3912
+ face: facenum
3834
3913
  });
3914
+ let fcoords = coords;
3835
3915
  if (this.duplicatedFaces[i]) {
3916
+ const rotdist = fcoords.length / this.duplicatedFaces[i];
3836
3917
  for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {
3918
+ for (let k = 0; k < rotdist; k++) {
3919
+ fcoords = fcoords.rotateforward();
3920
+ }
3837
3921
  stickers.push({
3838
- coords: toFaceCoords(coords, maxdist),
3839
- color,
3840
- orbit: this.cubiesetnames[cubiesetnum],
3841
- ord: cubieord,
3842
- ori: jj
3843
- });
3844
- foundations.push({
3845
3922
  coords: toFaceCoords(fcoords, maxdist),
3846
3923
  color,
3847
3924
  orbit: this.cubiesetnames[cubiesetnum],
3848
3925
  ord: cubieord,
3849
- ori: jj
3926
+ ori: jj,
3927
+ face: facenum,
3928
+ isDup: true
3850
3929
  });
3851
3930
  }
3852
3931
  }
@@ -3855,8 +3934,7 @@ var PuzzleGeometry = class {
3855
3934
  for (let i = 0; i < this.movesetgeos.length; i++) {
3856
3935
  const msg = this.movesetgeos[i];
3857
3936
  const order = this.movesetorders[i];
3858
- for (let j = 0; j < this.geonormals.length; j++) {
3859
- const gn = this.geonormals[j];
3937
+ for (const gn of this.geonormals) {
3860
3938
  if (msg[0] === gn[1] && msg[1] === gn[2]) {
3861
3939
  grips.push([toCoords(gn[0].rotatepoint(rot), 1), msg[0], order]);
3862
3940
  grips.push([
@@ -3867,25 +3945,31 @@ var PuzzleGeometry = class {
3867
3945
  }
3868
3946
  }
3869
3947
  }
3870
- const f = function() {
3871
- return function(mv) {
3872
- return this.unswizzle(mv);
3948
+ const twodmapper = this.generate2dmapping(2880, 2160, 0, false, 1);
3949
+ const g = function() {
3950
+ const irot = rot.invrot();
3951
+ return function(facenum, coords) {
3952
+ let q = new Quat(0, coords[0] * maxdist, -coords[1] * maxdist, coords[2] * maxdist);
3953
+ q = q.rotatepoint(irot);
3954
+ const x = twodmapper(facenum, q);
3955
+ x[0] /= 2880;
3956
+ x[1] = 1 - x[1] / 2160;
3957
+ return x;
3873
3958
  };
3874
3959
  }().bind(this);
3875
3960
  return {
3876
3961
  stickers,
3877
- foundations,
3878
3962
  faces,
3879
3963
  axis: grips,
3880
- unswizzle: f,
3881
- notationMapper: this.notationMapper
3964
+ unswizzle: this.unswizzle.bind(this),
3965
+ notationMapper: this.notationMapper,
3966
+ textureMapper: { getuv: g }
3882
3967
  };
3883
3968
  }
3884
3969
  getGeoNormal(geoname) {
3885
3970
  const rot = this.getInitial3DRotation();
3886
3971
  const grip = this.swizzler.unswizzle(geoname);
3887
- for (let j = 0; j < this.geonormals.length; j++) {
3888
- const gn = this.geonormals[j];
3972
+ for (const gn of this.geonormals) {
3889
3973
  if (grip === gn[1]) {
3890
3974
  const r = toCoords(gn[0].rotatepoint(rot), 1);
3891
3975
  if (Math.abs(r[0]) < eps3 && Math.abs(r[2]) < eps3) {
@@ -3901,6 +3985,22 @@ var PuzzleGeometry = class {
3901
3985
  const divid = this.stickersperface;
3902
3986
  return Math.floor(facenum / divid);
3903
3987
  }
3988
+ textForTwizzleExplorer() {
3989
+ return `Faces ${this.baseplanerot.length}
3990
+ Stickers per face ${this.stickersperface}
3991
+ Short edge ${this.shortedge}
3992
+ Cubies ${this.cubies.length}
3993
+ Edge distance ${this.edgedistance}
3994
+ Vertex distance ${this.vertexdistance}`;
3995
+ }
3996
+ writeSchreierSims(tw) {
3997
+ const os = this.getOrbitsDef(false);
3998
+ const as = os.reassemblySize();
3999
+ tw(`Reassembly size is ${as}`);
4000
+ const ss = schreierSims(this.getMovesAsPerms(), tw);
4001
+ const r = as / ss;
4002
+ tw(`Ratio is ${r}`);
4003
+ }
3904
4004
  };
3905
4005
  var PGNotation = class {
3906
4006
  constructor(pg, od) {
@@ -3916,8 +4016,8 @@ var PGNotation = class {
3916
4016
  const mv = this.pg.parseMove(move);
3917
4017
  if (this.pg.parsedmovelist) {
3918
4018
  let found = false;
3919
- for (let i = 0; i < this.pg.parsedmovelist.length; i++) {
3920
- if (this.pg.parsedmovelist[i][1] === mv[1] && this.pg.parsedmovelist[i][2] === mv[2] && this.pg.parsedmovelist[i][3] === mv[3] && this.pg.parsedmovelist[i][4] === mv[4]) {
4019
+ for (const parsedmove of this.pg.parsedmovelist) {
4020
+ if (parsedmove[1] === mv[1] && parsedmove[2] === mv[2] && parsedmove[3] === mv[3] && parsedmove[4] === mv[4]) {
3921
4021
  found = true;
3922
4022
  }
3923
4023
  }
@@ -3931,7 +4031,7 @@ var PGNotation = class {
3931
4031
  bits = [slices - mv[3], slices - mv[2]];
3932
4032
  }
3933
4033
  const pgmv = this.pg.getMoveFromBits(bits, mv[5], !mv[4], this.pg.cmovesbyslice[mv[1]], void 0, this.pg.movesetorders[mv[1]]);
3934
- const r = OrbitsDef.transformToKPuzzle(this.orbitNames, pgmv);
4034
+ const r = PGOrbitsDef.transformToKPuzzle(this.orbitNames, pgmv);
3935
4035
  this.cache[key] = r;
3936
4036
  return r;
3937
4037
  }
@@ -3947,209 +4047,15 @@ var PGNotation = class {
3947
4047
  return r;
3948
4048
  }
3949
4049
  };
3950
-
3951
- // src/cubing/puzzle-geometry/Options.ts
3952
- function parseoptions(argv, optionlist) {
3953
- let argp = 0;
3954
- while (argp < argv.length && argv[argp][0] === "-") {
3955
- const option = argv[argp++];
3956
- if (option === "--rotations") {
3957
- optionlist.push("rotations", true);
3958
- } else if (option === "--allmoves") {
3959
- optionlist.push("allmoves", true);
3960
- } else if (option === "--outerblockmoves") {
3961
- optionlist.push("outerblockmoves", true);
3962
- } else if (option === "--vertexmoves") {
3963
- optionlist.push("vertexmoves", true);
3964
- } else if (option === "--nocorners") {
3965
- optionlist.push("cornersets", false);
3966
- } else if (option === "--noedges") {
3967
- optionlist.push("edgesets", false);
3968
- } else if (option === "--noorientation") {
3969
- optionlist.push("killorientation", true);
3970
- } else if (option === "--nocenters") {
3971
- optionlist.push("centersets", false);
3972
- } else if (option === "--omit") {
3973
- optionlist.push("omit", argv[argp].split(","));
3974
- argp++;
3975
- } else if (option === "--moves") {
3976
- optionlist.push("movelist", argv[argp].split(","));
3977
- argp++;
3978
- } else if (option === "--optimize") {
3979
- optionlist.push("optimize", true);
3980
- } else if (option === "--scramble") {
3981
- optionlist.push("scramble", 100);
3982
- } else if (option === "--fixcorner") {
3983
- optionlist.push("fix", "v");
3984
- } else if (option === "--fixedge") {
3985
- optionlist.push("fix", "e");
3986
- } else if (option === "--fixcenter") {
3987
- optionlist.push("fix", "f");
3988
- } else if (option === "--orientcenters") {
3989
- optionlist.push("orientcenters", true);
3990
- } else if (option === "--puzzleorientation") {
3991
- optionlist.push("puzzleorientation", argv[argp]);
3992
- argp++;
3993
- } else {
3994
- throw new Error("Bad option: " + option);
3995
- }
3996
- }
3997
- return argp;
3998
- }
3999
-
4000
- // src/cubing/puzzle-geometry/SchreierSims.ts
4001
- var FactoredNumber = class {
4002
- constructor() {
4003
- this.mult = [];
4004
- }
4005
- multiply(n) {
4006
- for (let f = 2; f * f <= n; f++) {
4007
- while (n % f === 0) {
4008
- if (this.mult[f] !== void 0) {
4009
- this.mult[f]++;
4010
- } else {
4011
- this.mult[f] = 1;
4012
- }
4013
- n /= f;
4014
- }
4015
- }
4016
- if (n > 1) {
4017
- if (this.mult[n] !== void 0) {
4018
- this.mult[n]++;
4019
- } else {
4020
- this.mult[n] = 1;
4021
- }
4022
- }
4023
- }
4024
- toString() {
4025
- let r = "";
4026
- for (let i = 0; i < this.mult.length; i++) {
4027
- if (this.mult[i] !== void 0) {
4028
- if (r !== "") {
4029
- r += "*";
4030
- }
4031
- r += i;
4032
- if (this.mult[i] > 1) {
4033
- r += "^" + this.mult[i];
4034
- }
4035
- }
4036
- }
4037
- return r;
4038
- }
4039
- };
4040
- function schreierSims(g, disp) {
4041
- const n = g[0].p.length;
4042
- const e = identity(n);
4043
- let sgs = [];
4044
- let sgsi = [];
4045
- let sgslen = [];
4046
- let Tk = [];
4047
- let Tklen = [];
4048
- function resolve(p) {
4049
- for (let i = p.p.length - 1; i >= 0; i--) {
4050
- const j = p.p[i];
4051
- if (j !== i) {
4052
- if (!sgs[i][j]) {
4053
- return false;
4054
- }
4055
- p = p.mul(sgsi[i][j]);
4056
- }
4057
- }
4058
- return true;
4059
- }
4060
- function knutha(k, p, len) {
4061
- Tk[k].push(p);
4062
- Tklen[k].push(len);
4063
- for (let i = 0; i < sgs[k].length; i++) {
4064
- if (sgs[k][i]) {
4065
- knuthb(k, sgs[k][i].mul(p), len + sgslen[k][i]);
4066
- }
4067
- }
4068
- }
4069
- function knuthb(k, p, len) {
4070
- const j = p.p[k];
4071
- if (!sgs[k][j]) {
4072
- sgs[k][j] = p;
4073
- sgsi[k][j] = p.inv();
4074
- sgslen[k][j] = len;
4075
- for (let i = 0; i < Tk[k].length; i++) {
4076
- knuthb(k, p.mul(Tk[k][i]), len + Tklen[k][i]);
4077
- }
4078
- return;
4079
- }
4080
- const p2 = p.mul(sgsi[k][j]);
4081
- if (!resolve(p2)) {
4082
- knutha(k - 1, p2, len + sgslen[k][j]);
4083
- }
4084
- }
4085
- function getsgs() {
4086
- sgs = [];
4087
- sgsi = [];
4088
- Tk = [];
4089
- sgslen = [];
4090
- Tklen = [];
4091
- for (let i = 0; i < n; i++) {
4092
- sgs.push([]);
4093
- sgsi.push([]);
4094
- sgslen.push([]);
4095
- Tk.push([]);
4096
- Tklen.push([]);
4097
- sgs[i][i] = e;
4098
- sgsi[i][i] = e;
4099
- sgslen[i][i] = 0;
4100
- }
4101
- let none = 0;
4102
- let sz = 1;
4103
- for (let i = 0; i < g.length; i++) {
4104
- knutha(n - 1, g[i], 1);
4105
- sz = 1;
4106
- let tks = 0;
4107
- let sollen = 0;
4108
- const avgs = [];
4109
- const mults = new FactoredNumber();
4110
- for (let j = 0; j < n; j++) {
4111
- let cnt = 0;
4112
- let lensum = 0;
4113
- for (let k = 0; k < n; k++) {
4114
- if (sgs[j][k]) {
4115
- cnt++;
4116
- lensum += sgslen[j][k];
4117
- if (j !== k) {
4118
- none++;
4119
- }
4120
- }
4121
- }
4122
- tks += Tk[j].length;
4123
- sz *= cnt;
4124
- if (cnt > 1) {
4125
- mults.multiply(cnt);
4126
- }
4127
- const avg = lensum / cnt;
4128
- avgs.push(avg);
4129
- sollen += avg;
4130
- }
4131
- disp("" + i + ": sz " + sz + " T " + tks + " sol " + sollen + " none " + none + " mults " + mults);
4132
- }
4133
- return sz;
4134
- }
4135
- return getsgs();
4136
- }
4137
4050
  export {
4138
- Orbit,
4139
- OrbitDef,
4140
- OrbitsDef,
4141
- Perm,
4142
4051
  PuzzleGeometry,
4143
4052
  Quat,
4144
- Transformation,
4145
- VisibleState,
4146
4053
  getPuzzleGeometryByDesc,
4147
4054
  getPuzzleGeometryByName,
4148
4055
  getpuzzle,
4149
4056
  getpuzzles,
4150
- parsedesc,
4151
- parseoptions,
4152
- schreierSims,
4153
- useNewFaceNames
4057
+ parseOptions,
4058
+ parsePuzzleDescription,
4059
+ schreierSims
4154
4060
  };
4155
4061
  //# sourceMappingURL=index.js.map