cubing 0.20.2 → 0.21.0-pre12

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 (770) 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-JZD3V366.js +39 -0
  12. package/dist/esm/3d-JZD3V366.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-5DN4DAAX.js +2512 -0
  21. package/dist/esm/chunk-5DN4DAAX.js.map +7 -0
  22. package/dist/esm/{chunk-KKSDHNLH.js → chunk-7GADUDIG.js} +49 -71
  23. package/dist/esm/chunk-7GADUDIG.js.map +7 -0
  24. package/dist/esm/{chunk-YNB7QLBF.js → chunk-BU5PUJK3.js} +9 -10
  25. package/dist/esm/chunk-BU5PUJK3.js.map +7 -0
  26. package/dist/esm/chunk-CQS6JZ7G.js +762 -0
  27. package/dist/esm/chunk-CQS6JZ7G.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 +4442 -3214
  61. package/dist/esm/twisty/index.js.map +3 -3
  62. package/dist/esm/worker-inside-generated-string-KDZOUGJF.js +2831 -0
  63. package/dist/esm/worker-inside-generated-string-KDZOUGJF.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/fto/index.d.ts +2 -2
  135. package/dist/types/puzzles/implementations/fto/index.d.ts.map +1 -1
  136. package/dist/types/puzzles/implementations/pyraminx/{pyraminx.kpuzzle.json_.d.ts → pyraminx.kpuzzle.json.d.ts} +1 -1
  137. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json.d.ts.map +1 -0
  138. package/dist/types/puzzles/implementations/square1/index.d.ts.map +1 -1
  139. package/dist/types/puzzles/implementations/square1/{sq1-hyperorbit.kpuzzle.json_.d.ts → sq1-hyperorbit.kpuzzle.json.d.ts} +1 -1
  140. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json.d.ts.map +1 -0
  141. package/dist/types/puzzles/index.d.ts +4 -2
  142. package/dist/types/puzzles/index.d.ts.map +1 -1
  143. package/dist/types/puzzles/stickerings/appearance.d.ts +9 -9
  144. package/dist/types/puzzles/stickerings/appearance.d.ts.map +1 -1
  145. package/dist/types/puzzles/stickerings/cube-stickerings.d.ts.map +1 -1
  146. package/dist/types/puzzles/stickerings/fto-stickerings.d.ts.map +1 -1
  147. package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts +3 -0
  148. package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts.map +1 -0
  149. package/dist/types/search/index.d.ts +1 -1
  150. package/dist/types/search/index.d.ts.map +1 -1
  151. package/dist/types/search/inside/api.d.ts +2 -1
  152. package/dist/types/search/inside/api.d.ts.map +1 -1
  153. package/dist/types/search/inside/api.spec.d.ts +2 -0
  154. package/dist/types/search/inside/api.spec.d.ts.map +1 -0
  155. package/dist/types/search/inside/solve/parseSGS.d.ts.map +1 -1
  156. package/dist/types/search/inside/solve/puzzles/3x3x3/filter.d.ts.map +1 -1
  157. package/dist/types/search/inside/solve/puzzles/3x3x3/index.d.ts.map +1 -1
  158. package/dist/types/search/inside/solve/puzzles/megaminx.sgs.json.d.ts.map +1 -1
  159. package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts +2 -0
  160. package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts.map +1 -0
  161. package/dist/types/search/inside/solve/puzzles/skewb.sgs.json.d.ts.map +1 -1
  162. package/dist/types/search/inside/solve/tremble.d.ts.map +1 -1
  163. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts +4 -31
  164. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts.map +1 -1
  165. package/dist/types/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +1 -1
  166. package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts +3 -0
  167. package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts.map +1 -0
  168. package/dist/types/search/inside/solve/vendor/random-uint-below/get-random-values.d.ts.map +1 -1
  169. package/dist/types/search/inside/solve/vendor/random-uint-below/random-int.d.ts.map +1 -1
  170. package/dist/types/search/inside/solve/vendor/sq12phase/scramble_sq1.d.ts.map +1 -1
  171. package/dist/types/search/instantiator.d.ts.map +1 -1
  172. package/dist/types/search/outside.d.ts +4 -2
  173. package/dist/types/search/outside.d.ts.map +1 -1
  174. package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
  175. package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
  176. package/dist/types/stream/twizzle/TwizzleStream.d.ts +9 -8
  177. package/dist/types/stream/twizzle/TwizzleStream.d.ts.map +1 -1
  178. package/dist/types/stream/websocket-proxy.d.ts +1 -1
  179. package/dist/types/stream/websocket-proxy.d.ts.map +1 -1
  180. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +34 -0
  181. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -0
  182. package/dist/types/twisty/controllers/TwistyPlayerController.d.ts +16 -0
  183. package/dist/types/twisty/controllers/TwistyPlayerController.d.ts.map +1 -0
  184. package/dist/types/twisty/heavy-code-imports/3d.d.ts +3 -0
  185. package/dist/types/twisty/heavy-code-imports/3d.d.ts.map +1 -0
  186. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +12 -0
  187. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +1 -0
  188. package/dist/types/twisty/index.d.ts +20 -15
  189. package/dist/types/twisty/index.d.ts.map +1 -1
  190. package/dist/types/twisty/model/PromiseFreshener.d.ts +14 -0
  191. package/dist/types/twisty/model/PromiseFreshener.d.ts.map +1 -0
  192. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +84 -0
  193. package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -0
  194. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts +11 -0
  195. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts.map +1 -0
  196. package/dist/types/twisty/model/helpers.d.ts +5 -0
  197. package/dist/types/twisty/model/helpers.d.ts.map +1 -0
  198. package/dist/types/twisty/model/props/TwistyProp.d.ts +60 -0
  199. package/dist/types/twisty/model/props/TwistyProp.d.ts.map +1 -0
  200. package/dist/types/twisty/model/props/TwistyProp.spec.d.ts +5 -0
  201. package/dist/types/twisty/model/props/TwistyProp.spec.d.ts.map +1 -0
  202. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +28 -0
  203. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -0
  204. package/dist/types/twisty/model/props/general/URLProp.d.ts +6 -0
  205. package/dist/types/twisty/model/props/general/URLProp.d.ts.map +1 -0
  206. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +7 -0
  207. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -0
  208. package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts +10 -0
  209. package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts.map +1 -0
  210. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +6 -0
  211. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -0
  212. package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts +27 -0
  213. package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts.map +1 -0
  214. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts +14 -0
  215. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts.map +1 -0
  216. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +15 -0
  217. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -0
  218. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +12 -0
  219. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -0
  220. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +17 -0
  221. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -0
  222. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +15 -0
  223. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -0
  224. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +17 -0
  225. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -0
  226. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts +12 -0
  227. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts.map +1 -0
  228. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +15 -0
  229. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -0
  230. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +12 -0
  231. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -0
  232. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts +13 -0
  233. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts.map +1 -0
  234. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +6 -0
  235. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -0
  236. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts +11 -0
  237. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts.map +1 -0
  238. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts +6 -0
  239. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts.map +1 -0
  240. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +11 -0
  241. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -0
  242. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +6 -0
  243. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -0
  244. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +13 -0
  245. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -0
  246. package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts +25 -0
  247. package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts.map +1 -0
  248. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +23 -0
  249. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -0
  250. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +15 -0
  251. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -0
  252. package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts +6 -0
  253. package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts.map +1 -0
  254. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +16 -0
  255. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -0
  256. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +7 -0
  257. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -0
  258. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +7 -0
  259. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -0
  260. package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts +22 -0
  261. package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts.map +1 -0
  262. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +7 -0
  263. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -0
  264. package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts +6 -0
  265. package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts.map +1 -0
  266. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +16 -0
  267. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -0
  268. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +15 -0
  269. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -0
  270. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +11 -0
  271. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -0
  272. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +7 -0
  273. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -0
  274. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +7 -0
  275. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -0
  276. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +13 -0
  277. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -0
  278. package/dist/types/twisty/{animation → old/animation}/RenderScheduler.d.ts +3 -0
  279. package/dist/types/twisty/old/animation/RenderScheduler.d.ts.map +1 -0
  280. package/dist/types/twisty/{animation → old/animation}/Timeline.d.ts +0 -0
  281. package/dist/types/twisty/old/animation/Timeline.d.ts.map +1 -0
  282. package/dist/types/twisty/{animation → old/animation}/cursor/AlgCursor.d.ts +4 -4
  283. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts.map +1 -0
  284. package/dist/types/twisty/{animation → old/animation}/cursor/CursorTypes.d.ts +4 -4
  285. package/dist/types/twisty/old/animation/cursor/CursorTypes.d.ts.map +1 -0
  286. package/dist/types/twisty/{animation → old/animation}/easing.d.ts +0 -0
  287. package/dist/types/twisty/old/animation/easing.d.ts.map +1 -0
  288. package/dist/types/twisty/{animation → old/animation}/indexer/AlgDuration.d.ts +1 -1
  289. package/dist/types/twisty/old/animation/indexer/AlgDuration.d.ts.map +1 -0
  290. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts +36 -0
  291. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +1 -0
  292. package/dist/types/twisty/{animation → old/animation}/indexer/SimpleAlgIndexer.d.ts +3 -3
  293. package/dist/types/twisty/old/animation/indexer/SimpleAlgIndexer.d.ts.map +1 -0
  294. package/dist/types/twisty/{animation → old/animation}/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +6 -5
  295. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +1 -0
  296. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +22 -0
  297. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +1 -0
  298. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts +26 -0
  299. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +1 -0
  300. package/dist/types/twisty/{animation → old/animation}/indexer/tree/AlgWalker.d.ts +2 -2
  301. package/dist/types/twisty/old/animation/indexer/tree/AlgWalker.d.ts.map +1 -0
  302. package/dist/types/twisty/{animation → old/animation}/indexer/tree/TreeAlgIndexer.d.ts +3 -3
  303. package/dist/types/twisty/old/animation/indexer/tree/TreeAlgIndexer.d.ts.map +1 -0
  304. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts +3 -0
  305. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts.map +1 -0
  306. package/dist/types/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.d.ts +1 -1
  307. package/dist/types/twisty/old/animation/stream/timeline-move-calculation-draft.d.ts.map +1 -0
  308. package/dist/types/twisty/{dom/TwistyAlgViewer.css_.d.ts → old/dom/TwistyAlgViewerV1.css.d.ts} +1 -1
  309. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts.map +1 -0
  310. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts +52 -0
  311. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts.map +1 -0
  312. package/dist/types/twisty/{dom/TwistyPlayer.css_.d.ts → old/dom/TwistyPlayer.css.d.ts} +1 -1
  313. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +1 -0
  314. package/dist/types/twisty/{dom → old/dom}/TwistyPlayer.d.ts +8 -8
  315. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts.map +1 -0
  316. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts +5 -0
  317. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts.map +1 -0
  318. package/dist/types/twisty/{dom → old/dom}/TwistyPlayerConfig.d.ts +10 -5
  319. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +1 -0
  320. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts +2 -0
  321. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts.map +1 -0
  322. package/dist/types/twisty/{dom/controls/TwistyScrubber.css_.d.ts → old/dom/controls/TwistyScrubber.css.d.ts} +1 -1
  323. package/dist/types/twisty/old/dom/controls/TwistyScrubber.css.d.ts.map +1 -0
  324. package/dist/types/twisty/{dom → old/dom}/controls/TwistyScrubber.d.ts +1 -1
  325. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts.map +1 -0
  326. package/dist/types/twisty/{dom/controls/buttons.css_.d.ts → old/dom/controls/buttons.css.d.ts} +1 -1
  327. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts.map +1 -0
  328. package/dist/types/twisty/{dom → old/dom}/controls/buttons.d.ts +1 -1
  329. package/dist/types/twisty/old/dom/controls/buttons.d.ts.map +1 -0
  330. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts +5 -0
  331. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts.map +1 -0
  332. package/dist/types/twisty/{dom → old/dom}/element/ClassListManager.d.ts +0 -0
  333. package/dist/types/twisty/old/dom/element/ClassListManager.d.ts.map +1 -0
  334. package/dist/types/twisty/{dom → old/dom}/element/ElementConfig.d.ts +1 -1
  335. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts.map +1 -0
  336. package/dist/types/twisty/{dom → old/dom}/element/ManagedCustomElement.d.ts +0 -0
  337. package/dist/types/twisty/old/dom/element/ManagedCustomElement.d.ts.map +1 -0
  338. package/dist/types/twisty/{dom → old/dom}/element/node-custom-element-shims.d.ts +0 -0
  339. package/dist/types/twisty/old/dom/element/node-custom-element-shims.d.ts.map +1 -0
  340. package/dist/types/twisty/{dom/stream/TwistyStreamSource.css_.d.ts → old/dom/stream/TwistyStreamSource.css.d.ts} +1 -1
  341. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts.map +1 -0
  342. package/dist/types/twisty/{dom → old/dom}/stream/TwistyStreamSource.d.ts +0 -0
  343. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.d.ts.map +1 -0
  344. package/dist/types/twisty/{dom → old/dom}/viewers/Twisty2DSVG.d.ts +2 -2
  345. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts.map +1 -0
  346. package/dist/types/twisty/{dom/viewers/Twisty2DSVGView.css_.d.ts → old/dom/viewers/Twisty2DSVGView.css.d.ts} +1 -1
  347. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts.map +1 -0
  348. package/dist/types/twisty/{dom/viewers/Twisty3DCanvas.css_.d.ts → old/dom/viewers/Twisty3DCanvas.css.d.ts} +1 -1
  349. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts.map +1 -0
  350. package/dist/types/twisty/{dom → old/dom}/viewers/Twisty3DCanvas.d.ts +1 -2
  351. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +1 -0
  352. package/dist/types/twisty/{dom → old/dom}/viewers/TwistyOrbitControls.d.ts +0 -0
  353. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts.map +1 -0
  354. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts +4 -0
  355. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts.map +1 -0
  356. package/dist/types/twisty/{dom/viewers/TwistyViewerWrapper.css_.d.ts → old/dom/viewers/TwistyViewerWrapper.css.d.ts} +1 -1
  357. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts.map +1 -0
  358. package/dist/types/twisty/{dom → old/dom}/viewers/TwistyViewerWrapper.d.ts +0 -0
  359. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts.map +1 -0
  360. package/dist/types/twisty/old/dom/viewers/canvas.d.ts +3 -0
  361. package/dist/types/twisty/old/dom/viewers/canvas.d.ts.map +1 -0
  362. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +29 -0
  363. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +1 -0
  364. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +16 -0
  365. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +1 -0
  366. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +20 -0
  367. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +1 -0
  368. package/dist/types/twisty/views/3D/RendererPool.d.ts +4 -0
  369. package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -0
  370. package/dist/types/twisty/{3D → views/3D}/TAU.d.ts +0 -0
  371. package/dist/types/twisty/views/3D/TAU.d.ts.map +1 -0
  372. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +17 -0
  373. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -0
  374. package/dist/types/twisty/{3D → views/3D}/Twisty3DRenderTarget.d.ts +0 -0
  375. package/dist/types/twisty/views/3D/Twisty3DRenderTarget.d.ts.map +1 -0
  376. package/dist/types/twisty/{3D → views/3D}/Twisty3DScene.d.ts +0 -0
  377. package/dist/types/twisty/views/3D/Twisty3DScene.d.ts.map +1 -0
  378. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +28 -0
  379. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -0
  380. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +32 -0
  381. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -0
  382. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +41 -0
  383. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +1 -0
  384. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts +5 -0
  385. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts.map +1 -0
  386. package/dist/types/twisty/{3D → views/3D}/puzzles/Cube3D.d.ts +11 -7
  387. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +1 -0
  388. package/dist/types/twisty/{3D → views/3D}/puzzles/KPuzzleWrapper.d.ts +2 -2
  389. package/dist/types/twisty/views/3D/puzzles/KPuzzleWrapper.d.ts.map +1 -0
  390. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +57 -0
  391. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +1 -0
  392. package/dist/types/twisty/{3D → views/3D}/puzzles/Twisty3DPuzzle.d.ts +1 -1
  393. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +1 -0
  394. package/dist/types/twisty/{3D → views/3D}/puzzles/TwistyTestBox.d.ts +2 -2
  395. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +1 -0
  396. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +18 -0
  397. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +1 -0
  398. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +3 -0
  399. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +1 -0
  400. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +40 -0
  401. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -0
  402. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts +5 -0
  403. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts.map +1 -0
  404. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts +61 -0
  405. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts.map +1 -0
  406. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +3 -0
  407. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +1 -0
  408. package/dist/types/twisty/{dom → views}/TwistyAlgViewer.d.ts +6 -6
  409. package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +1 -0
  410. package/dist/types/twisty/views/TwistyPlayer.d.ts +97 -0
  411. package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -0
  412. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +71 -0
  413. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -0
  414. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +33 -0
  415. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -0
  416. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +14 -0
  417. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -0
  418. package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts +15 -0
  419. package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts.map +1 -0
  420. package/dist/types/twisty/views/document.d.ts +2 -0
  421. package/dist/types/twisty/views/document.d.ts.map +1 -0
  422. package/dist/types/twisty/views/screenshot.d.ts +12 -0
  423. package/dist/types/twisty/views/screenshot.d.ts.map +1 -0
  424. package/dist/types/vendor/p-lazy/p-lazy.d.ts +10 -0
  425. package/dist/types/vendor/p-lazy/p-lazy.d.ts.map +1 -0
  426. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts +33 -0
  427. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts.map +1 -0
  428. package/docs/.DS_Store +0 -0
  429. package/docs/cubing/.DS_Store +0 -0
  430. package/docs/cubing/alg/index.html +37 -23
  431. package/docs/cubing/index.html +56 -252
  432. package/docs/cubing/scramble/index.html +122 -0
  433. package/docs/cubing/twisty/index.html +329 -0
  434. package/docs/main.css +15 -3
  435. package/package.json +83 -57
  436. package/src/cubing/.DS_Store +0 -0
  437. package/src/cubing/alg/.DS_Store +0 -0
  438. package/src/cubing/alg/Alg.ts +89 -0
  439. package/src/cubing/alg/common.ts +4 -2
  440. package/src/cubing/alg/iteration.ts +1 -1
  441. package/src/cubing/alg/parse.ts +2 -0
  442. package/src/cubing/alg/test/alg-comparison.ts +1 -0
  443. package/src/cubing/alg/units/.DS_Store +0 -0
  444. package/src/cubing/alg/units/Unit.ts +0 -3
  445. package/src/cubing/alg/units/containers/Commutator.ts +1 -1
  446. package/src/cubing/alg/units/leaves/Move.ts +4 -4
  447. package/src/cubing/bluetooth/.DS_Store +0 -0
  448. package/src/cubing/bluetooth/connect/index.ts +1 -1
  449. package/src/cubing/bluetooth/smart-puzzle/Heykube.ts +1 -1
  450. package/src/cubing/bluetooth/smart-puzzle/bluetooth-puzzle.ts +1 -1
  451. package/src/cubing/bluetooth/smart-puzzle/gan.ts +5 -5
  452. package/src/cubing/bluetooth/smart-puzzle/giiker.ts +2 -2
  453. package/src/cubing/bluetooth/smart-puzzle/gocube.ts +5 -5
  454. package/src/cubing/bluetooth/smart-robot/GanRobot.ts +5 -5
  455. package/src/cubing/bluetooth/smart-timer/GanTimer.ts +2 -2
  456. package/src/cubing/kpuzzle/.DS_Store +0 -0
  457. package/src/cubing/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.ts +40 -0
  458. package/src/cubing/{puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.ts → kpuzzle/3x3x3/3x3x3.kpuzzle.json.ts} +11 -6
  459. package/src/cubing/kpuzzle/canon.spec.ts +6 -11
  460. package/src/cubing/kpuzzle/canonicalize.ts +1 -1
  461. package/src/cubing/kpuzzle/definition_types.ts +0 -3
  462. package/src/cubing/kpuzzle/index.ts +1 -0
  463. package/src/cubing/kpuzzle/prunetable.spec.ts +2 -4
  464. package/src/cubing/kpuzzle/puzzle-orientation.ts +1 -1
  465. package/src/cubing/kpuzzle/svg.ts +4 -9
  466. package/src/cubing/kpuzzle/transformations.ts +1 -1
  467. package/src/cubing/protocol/binary/binary3x3x3.spec.ts +5 -2
  468. package/src/cubing/protocol/binary/hex.ts +4 -4
  469. package/src/cubing/protocol/binary/orbit-indexing.ts +2 -2
  470. package/src/cubing/protocol/binary/puzzle-orientation.ts +2 -2
  471. package/src/cubing/puzzle-geometry/Options.ts +151 -22
  472. package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +24 -28
  473. package/src/cubing/puzzle-geometry/PermOriSet.ts +99 -98
  474. package/src/cubing/puzzle-geometry/PlatonicGenerator.ts +1 -1
  475. package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +836 -867
  476. package/src/cubing/puzzle-geometry/Quat.ts +1 -68
  477. package/src/cubing/puzzle-geometry/SchreierSims.ts +2 -13
  478. package/src/cubing/puzzle-geometry/index.ts +2 -11
  479. package/src/cubing/puzzle-geometry/interfaces.ts +1 -27
  480. package/src/cubing/puzzle-geometry/orientcenters.spec.ts +24 -30
  481. package/src/cubing/puzzles/.DS_Store +0 -0
  482. package/src/cubing/puzzles/PuzzleLoader.ts +1 -1
  483. package/src/cubing/puzzles/async/async-pg3d.ts +5 -8
  484. package/src/cubing/puzzles/customPGPuzzleLoader.ts +60 -0
  485. package/src/cubing/puzzles/implementations/.DS_Store +0 -0
  486. package/src/cubing/puzzles/implementations/2x2x2/{2x2x2.kpuzzle.json_.ts → 2x2x2.kpuzzle.json.ts} +0 -0
  487. package/src/cubing/puzzles/implementations/2x2x2/index.ts +1 -1
  488. package/src/cubing/puzzles/implementations/3x3x3/index.ts +2 -3
  489. package/src/cubing/puzzles/implementations/clock/{clock.kpuzzle.json_.ts → clock.kpuzzle.json.ts} +0 -0
  490. package/src/cubing/puzzles/implementations/clock/index.ts +1 -1
  491. package/src/cubing/puzzles/implementations/fto/index.ts +19 -11
  492. package/src/cubing/puzzles/implementations/pyraminx/{pyraminx.kpuzzle.json_.ts → pyraminx.kpuzzle.json.ts} +0 -0
  493. package/src/cubing/puzzles/implementations/square1/index.ts +1 -2
  494. package/src/cubing/puzzles/implementations/square1/{sq1-hyperorbit.kpuzzle.json_.ts → sq1-hyperorbit.kpuzzle.json.ts} +0 -0
  495. package/src/cubing/puzzles/index.ts +30 -20
  496. package/src/cubing/puzzles/stickerings/appearance.ts +10 -9
  497. package/src/cubing/puzzles/stickerings/cube-stickerings.ts +8 -0
  498. package/src/cubing/puzzles/stickerings/fto-stickerings.ts +9 -0
  499. package/src/cubing/puzzles/stickerings/global-custom-stickering-hack.ts +61 -0
  500. package/src/cubing/search/.DS_Store +0 -0
  501. package/src/cubing/search/.gitignore +1 -2
  502. package/src/cubing/search/esm-test-worker.js +1 -1
  503. package/src/cubing/search/index.ts +1 -0
  504. package/src/cubing/search/inside/api.spec.ts +1 -0
  505. package/src/cubing/search/inside/api.ts +6 -1
  506. package/src/cubing/search/inside/solve/parseSGS.ts +7 -11
  507. package/src/cubing/search/inside/solve/puzzles/2x2x2.ts +3 -3
  508. package/src/cubing/search/inside/solve/puzzles/3x3x3/filter.ts +0 -6
  509. package/src/cubing/search/inside/solve/puzzles/3x3x3/index.ts +0 -2
  510. package/src/cubing/search/inside/solve/puzzles/FTO.sgs +264 -0
  511. package/src/cubing/search/inside/solve/puzzles/megaminx.sgs.json.ts +4 -6
  512. package/src/cubing/search/inside/solve/puzzles/skewb.sgs.json.ts +4 -6
  513. package/src/cubing/search/inside/solve/tremble.ts +6 -9
  514. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.ts +20 -822
  515. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.ts +177 -252
  516. package/src/cubing/search/inside/solve/vendor/min2phase/gwt.js +62 -222
  517. package/src/cubing/search/inside/solve/vendor/random-uint-below/get-random-values.ts +4 -5
  518. package/src/cubing/search/inside/solve/vendor/random-uint-below/random-int.ts +9 -11
  519. package/src/cubing/search/inside/solve/vendor/sq12phase/scramble_sq1.js +13 -582
  520. package/src/cubing/search/instantiator.ts +11 -7
  521. package/src/cubing/search/outside.ts +8 -2
  522. package/src/cubing/search/worker-inside-generated-string.js +1 -1
  523. package/src/cubing/stream/.DS_Store +0 -0
  524. package/src/cubing/stream/process/ReorientedStream.ts +1 -1
  525. package/src/cubing/stream/twizzle/TwizzleStream.ts +11 -8
  526. package/src/cubing/stream/websocket-proxy.ts +1 -3
  527. package/src/cubing/twisty/.DS_Store +0 -0
  528. package/src/cubing/twisty/controllers/TwistyAnimationController.ts +248 -0
  529. package/src/cubing/twisty/controllers/TwistyPlayerController.ts +38 -0
  530. package/src/cubing/twisty/heavy-code-imports/3d.ts +18 -0
  531. package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +41 -0
  532. package/src/cubing/twisty/index.ts +24 -17
  533. package/src/cubing/twisty/model/.DS_Store +0 -0
  534. package/src/cubing/twisty/model/PromiseFreshener.ts +49 -0
  535. package/src/cubing/twisty/model/TwistyPlayerModel.ts +222 -0
  536. package/src/cubing/twisty/model/UserVisibleErrorTracker.ts +22 -0
  537. package/src/cubing/twisty/model/helpers.ts +47 -0
  538. package/src/cubing/{search/vendor → twisty/model/props}/.DS_Store +0 -0
  539. package/src/cubing/twisty/model/props/TwistyProp.spec.ts +38 -0
  540. package/src/cubing/twisty/model/props/TwistyProp.ts +366 -0
  541. package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +370 -0
  542. package/src/cubing/twisty/model/props/general/URLProp.ts +14 -0
  543. package/src/cubing/{solve → twisty/model/props/puzzle}/.DS_Store +0 -0
  544. package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +10 -0
  545. package/src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts +43 -0
  546. package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +8 -0
  547. package/src/cubing/twisty/model/props/puzzle/state/AlgProp.ts +91 -0
  548. package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +28 -0
  549. package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +44 -0
  550. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +91 -0
  551. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +48 -0
  552. package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +46 -0
  553. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +46 -0
  554. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.ts +15 -0
  555. package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +24 -0
  556. package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +22 -0
  557. package/src/cubing/twisty/model/props/puzzle/state/PuzzleAlgProp.ts +28 -0
  558. package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +8 -0
  559. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDefProp.ts +14 -0
  560. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.ts +14 -0
  561. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +12 -0
  562. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +17 -0
  563. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +38 -0
  564. package/src/cubing/twisty/model/props/timeline/CoarseTimelineInfoProp.ts +45 -0
  565. package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +76 -0
  566. package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +51 -0
  567. package/src/cubing/twisty/model/props/timeline/TempoScaleProp.ts +13 -0
  568. package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +38 -0
  569. package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +10 -0
  570. package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +10 -0
  571. package/src/cubing/twisty/model/props/viewer/ButtonAppearanceProp.ts +86 -0
  572. package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +10 -0
  573. package/src/cubing/twisty/model/props/viewer/LatitudeLimit.ts +11 -0
  574. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +56 -0
  575. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +69 -0
  576. package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +15 -0
  577. package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +10 -0
  578. package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +10 -0
  579. package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +45 -0
  580. package/src/cubing/twisty/old/.DS_Store +0 -0
  581. package/src/cubing/twisty/old/animation/.DS_Store +0 -0
  582. package/src/cubing/twisty/{animation → old/animation}/RenderScheduler.ts +5 -0
  583. package/src/cubing/twisty/{animation → old/animation}/Timeline.ts +0 -0
  584. package/src/cubing/twisty/{animation → old/animation}/cursor/AlgCursor.ts +15 -8
  585. package/src/cubing/twisty/{animation → old/animation}/cursor/CursorTypes.ts +4 -4
  586. package/src/cubing/twisty/{animation → old/animation}/easing.ts +0 -0
  587. package/src/cubing/{search/inside → twisty/old/animation/indexer}/.DS_Store +0 -0
  588. package/src/cubing/twisty/{animation → old/animation}/indexer/AlgDuration.ts +1 -1
  589. package/src/cubing/twisty/old/animation/indexer/AlgIndexer.ts +86 -0
  590. package/src/cubing/twisty/{animation → old/animation}/indexer/SimpleAlgIndexer.ts +9 -6
  591. package/src/cubing/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +181 -0
  592. package/src/cubing/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +243 -0
  593. package/src/cubing/twisty/{animation → old/animation}/indexer/simultaneous-moves/simul-moves.ts +46 -34
  594. package/src/cubing/twisty/{animation → old/animation}/indexer/tree/AlgWalker.ts +6 -3
  595. package/src/cubing/twisty/{animation → old/animation}/indexer/tree/TreeAlgIndexer.ts +8 -5
  596. package/src/cubing/twisty/{animation → old/animation}/indexer/tree/chunkAlgs.ts +2 -2
  597. package/src/cubing/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -0
  598. package/src/cubing/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.ts +2 -2
  599. package/src/cubing/twisty/old/dom/.DS_Store +0 -0
  600. package/src/cubing/twisty/{dom/TwistyAlgViewer.css_.ts → old/dom/TwistyAlgViewerV1.css.ts} +0 -0
  601. package/src/cubing/twisty/{dom/TwistyAlgViewer.ts → old/dom/TwistyAlgViewerV1.ts} +43 -36
  602. package/src/cubing/twisty/{dom/TwistyPlayer.css_.ts → old/dom/TwistyPlayer.css.ts} +28 -1
  603. package/src/cubing/twisty/{dom → old/dom}/TwistyPlayer.spec.ts +5 -6
  604. package/src/cubing/twisty/{dom → old/dom}/TwistyPlayer.ts +36 -43
  605. package/src/cubing/twisty/{dom → old/dom}/TwistyPlayerConfig.ts +27 -10
  606. package/src/cubing/twisty/{dom/controls/TwistyControlElement.ts.ts → old/dom/controls/TwistyControlElement.ts} +0 -0
  607. package/src/cubing/twisty/{dom/controls/TwistyScrubber.css_.ts → old/dom/controls/TwistyScrubber.css.ts} +0 -0
  608. package/src/cubing/twisty/{dom → old/dom}/controls/TwistyScrubber.ts +3 -3
  609. package/src/cubing/twisty/{dom/controls/buttons.css_.ts → old/dom/controls/buttons.css.ts} +14 -1
  610. package/src/cubing/twisty/{dom → old/dom}/controls/buttons.spec.ts +1 -1
  611. package/src/cubing/twisty/{dom → old/dom}/controls/buttons.ts +15 -15
  612. package/src/cubing/twisty/{dom → old/dom}/element/ClassListManager.ts +0 -0
  613. package/src/cubing/twisty/{dom → old/dom}/element/ElementConfig.ts +1 -1
  614. package/src/cubing/twisty/{dom → old/dom}/element/ManagedCustomElement.ts +0 -0
  615. package/src/cubing/twisty/{dom → old/dom}/element/node-custom-element-shims.ts +0 -0
  616. package/src/cubing/twisty/{dom/stream/TwistyStreamSource.css_.ts → old/dom/stream/TwistyStreamSource.css.ts} +0 -0
  617. package/src/cubing/twisty/{dom → old/dom}/stream/TwistyStreamSource.ts +8 -8
  618. package/src/cubing/twisty/{dom → old/dom}/viewers/Twisty2DSVG.ts +7 -9
  619. package/src/cubing/twisty/{dom/viewers/Twisty2DSVGView.css_.ts → old/dom/viewers/Twisty2DSVGView.css.ts} +0 -0
  620. package/src/cubing/twisty/{dom/viewers/Twisty3DCanvas.css_.ts → old/dom/viewers/Twisty3DCanvas.css.ts} +0 -0
  621. package/src/cubing/twisty/{dom → old/dom}/viewers/Twisty3DCanvas.ts +5 -12
  622. package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyOrbitControls.ts +53 -20
  623. package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyViewerElement.ts +1 -1
  624. package/src/cubing/twisty/{dom/viewers/TwistyViewerWrapper.css_.ts → old/dom/viewers/TwistyViewerWrapper.css.ts} +0 -0
  625. package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyViewerWrapper.ts +1 -1
  626. package/src/cubing/twisty/old/dom/viewers/canvas.ts +9 -0
  627. package/src/cubing/twisty/views/.DS_Store +0 -0
  628. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +150 -0
  629. package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +52 -0
  630. package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +77 -0
  631. package/src/cubing/twisty/views/3D/RendererPool.ts +53 -0
  632. package/src/cubing/twisty/{3D → views/3D}/TAU.ts +0 -0
  633. package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +168 -0
  634. package/src/cubing/twisty/{3D → views/3D}/Twisty3DRenderTarget.ts +0 -0
  635. package/src/cubing/twisty/{3D → views/3D}/Twisty3DScene.ts +0 -0
  636. package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +144 -0
  637. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +244 -0
  638. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +209 -0
  639. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +270 -0
  640. package/src/cubing/twisty/{3D → views/3D}/puzzles/Cube3D.ts +36 -15
  641. package/src/cubing/twisty/{3D → views/3D}/puzzles/KPuzzleWrapper.ts +4 -5
  642. package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +988 -0
  643. package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +6 -0
  644. package/src/cubing/twisty/{3D → views/3D}/puzzles/TwistyTestBox.ts +2 -2
  645. package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +116 -0
  646. package/src/cubing/twisty/{dom/TwistyAlgEditor.css_.ts → views/TwistyAlgEditor/TwistyAlgEditor.css.ts} +3 -1
  647. package/src/cubing/twisty/{dom → views/TwistyAlgEditor}/TwistyAlgEditor.spec.ts +7 -6
  648. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +360 -0
  649. package/src/cubing/twisty/views/TwistyAlgEditor/model.ts +179 -0
  650. package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +25 -0
  651. package/src/cubing/twisty/views/TwistyAlgViewer.ts +502 -0
  652. package/src/cubing/twisty/views/TwistyPlayer.ts +327 -0
  653. package/src/cubing/twisty/views/TwistyPlayerSettable.ts +111 -0
  654. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +159 -0
  655. package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +145 -0
  656. package/src/cubing/twisty/views/control-panel/webkit-fullscreen.ts +44 -0
  657. package/src/cubing/twisty/views/document.ts +4 -0
  658. package/src/cubing/twisty/views/screenshot.ts +90 -0
  659. package/src/cubing/vendor/.DS_Store +0 -0
  660. package/src/cubing/vendor/p-lazy/license +9 -0
  661. package/src/cubing/vendor/p-lazy/p-lazy.ts +52 -0
  662. package/src/cubing/vendor/p-lazy/readme.md +54 -0
  663. package/src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts +179 -0
  664. package/dist/esm/chunk-CWVB5RRW.js.map +0 -7
  665. package/dist/esm/chunk-KKSDHNLH.js.map +0 -7
  666. package/dist/esm/chunk-YNB7QLBF.js.map +0 -7
  667. package/dist/esm/worker-inside-generated-string-LT4NV55Q.js +0 -2826
  668. package/dist/esm/worker-inside-generated-string-LT4NV55Q.js.map +0 -7
  669. package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json_.d.ts.map +0 -1
  670. package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.d.ts +0 -3
  671. package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.d.ts.map +0 -1
  672. package/dist/types/puzzles/implementations/clock/clock.kpuzzle.json_.d.ts.map +0 -1
  673. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json_.d.ts.map +0 -1
  674. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json_.d.ts.map +0 -1
  675. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.d.ts +0 -3
  676. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.d.ts.map +0 -1
  677. package/dist/types/twisty/3D/TAU.d.ts.map +0 -1
  678. package/dist/types/twisty/3D/Twisty3DRenderTarget.d.ts.map +0 -1
  679. package/dist/types/twisty/3D/Twisty3DScene.d.ts.map +0 -1
  680. package/dist/types/twisty/3D/puzzles/Cube3D.d.ts.map +0 -1
  681. package/dist/types/twisty/3D/puzzles/KPuzzleWrapper.d.ts.map +0 -1
  682. package/dist/types/twisty/3D/puzzles/PG3D.d.ts +0 -51
  683. package/dist/types/twisty/3D/puzzles/PG3D.d.ts.map +0 -1
  684. package/dist/types/twisty/3D/puzzles/Twisty3DPuzzle.d.ts.map +0 -1
  685. package/dist/types/twisty/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
  686. package/dist/types/twisty/animation/RenderScheduler.d.ts.map +0 -1
  687. package/dist/types/twisty/animation/Timeline.d.ts.map +0 -1
  688. package/dist/types/twisty/animation/cursor/AlgCursor.d.ts.map +0 -1
  689. package/dist/types/twisty/animation/cursor/CursorTypes.d.ts.map +0 -1
  690. package/dist/types/twisty/animation/easing.d.ts.map +0 -1
  691. package/dist/types/twisty/animation/indexer/AlgDuration.d.ts.map +0 -1
  692. package/dist/types/twisty/animation/indexer/AlgIndexer.d.ts +0 -15
  693. package/dist/types/twisty/animation/indexer/AlgIndexer.d.ts.map +0 -1
  694. package/dist/types/twisty/animation/indexer/SimpleAlgIndexer.d.ts.map +0 -1
  695. package/dist/types/twisty/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
  696. package/dist/types/twisty/animation/indexer/simultaneous-moves/simul-moves.d.ts +0 -25
  697. package/dist/types/twisty/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
  698. package/dist/types/twisty/animation/indexer/tree/AlgWalker.d.ts.map +0 -1
  699. package/dist/types/twisty/animation/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
  700. package/dist/types/twisty/animation/indexer/tree/chunkAlgs.d.ts +0 -3
  701. package/dist/types/twisty/animation/indexer/tree/chunkAlgs.d.ts.map +0 -1
  702. package/dist/types/twisty/animation/stream/timeline-move-calculation-draft.d.ts.map +0 -1
  703. package/dist/types/twisty/dom/TwistyAlgEditor.css_.d.ts +0 -3
  704. package/dist/types/twisty/dom/TwistyAlgEditor.css_.d.ts.map +0 -1
  705. package/dist/types/twisty/dom/TwistyAlgEditor.d.ts +0 -27
  706. package/dist/types/twisty/dom/TwistyAlgEditor.d.ts.map +0 -1
  707. package/dist/types/twisty/dom/TwistyAlgEditorStartCharSearch.d.ts +0 -26
  708. package/dist/types/twisty/dom/TwistyAlgEditorStartCharSearch.d.ts.map +0 -1
  709. package/dist/types/twisty/dom/TwistyAlgViewer.css_.d.ts.map +0 -1
  710. package/dist/types/twisty/dom/TwistyAlgViewer.d.ts.map +0 -1
  711. package/dist/types/twisty/dom/TwistyPlayer.css_.d.ts.map +0 -1
  712. package/dist/types/twisty/dom/TwistyPlayer.d.ts.map +0 -1
  713. package/dist/types/twisty/dom/TwistyPlayerConfig.d.ts.map +0 -1
  714. package/dist/types/twisty/dom/controls/TwistyControlElement.ts.d.ts +0 -2
  715. package/dist/types/twisty/dom/controls/TwistyControlElement.ts.d.ts.map +0 -1
  716. package/dist/types/twisty/dom/controls/TwistyScrubber.css_.d.ts.map +0 -1
  717. package/dist/types/twisty/dom/controls/TwistyScrubber.d.ts.map +0 -1
  718. package/dist/types/twisty/dom/controls/buttons.css_.d.ts.map +0 -1
  719. package/dist/types/twisty/dom/controls/buttons.d.ts.map +0 -1
  720. package/dist/types/twisty/dom/element/ClassListManager.d.ts.map +0 -1
  721. package/dist/types/twisty/dom/element/ElementConfig.d.ts.map +0 -1
  722. package/dist/types/twisty/dom/element/ManagedCustomElement.d.ts.map +0 -1
  723. package/dist/types/twisty/dom/element/node-custom-element-shims.d.ts.map +0 -1
  724. package/dist/types/twisty/dom/stream/TwistyStreamSource.css_.d.ts.map +0 -1
  725. package/dist/types/twisty/dom/stream/TwistyStreamSource.d.ts.map +0 -1
  726. package/dist/types/twisty/dom/viewers/Twisty2DSVG.d.ts.map +0 -1
  727. package/dist/types/twisty/dom/viewers/Twisty2DSVGView.css_.d.ts.map +0 -1
  728. package/dist/types/twisty/dom/viewers/Twisty3DCanvas.css_.d.ts.map +0 -1
  729. package/dist/types/twisty/dom/viewers/Twisty3DCanvas.d.ts.map +0 -1
  730. package/dist/types/twisty/dom/viewers/TwistyOrbitControls.d.ts.map +0 -1
  731. package/dist/types/twisty/dom/viewers/TwistyViewerElement.d.ts +0 -4
  732. package/dist/types/twisty/dom/viewers/TwistyViewerElement.d.ts.map +0 -1
  733. package/dist/types/twisty/dom/viewers/TwistyViewerWrapper.css_.d.ts.map +0 -1
  734. package/dist/types/twisty/dom/viewers/TwistyViewerWrapper.d.ts.map +0 -1
  735. package/dist/types/twisty/dom/viewers/canvas.d.ts +0 -2
  736. package/dist/types/twisty/dom/viewers/canvas.d.ts.map +0 -1
  737. package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts +0 -2
  738. package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts.map +0 -1
  739. package/dist/types/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts +0 -21
  740. package/dist/types/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts.map +0 -1
  741. package/src/cubing/protocol/.DS_Store +0 -0
  742. package/src/cubing/puzzle-geometry/.DS_Store +0 -0
  743. package/src/cubing/search/inside/solve/.DS_Store +0 -0
  744. package/src/cubing/search/inside/solve/puzzles/.DS_Store +0 -0
  745. package/src/cubing/search/inside/solve/puzzles/3x3x3/.DS_Store +0 -0
  746. package/src/cubing/search/inside/solve/vendor/.DS_Store +0 -0
  747. package/src/cubing/search/inside/solve/vendor/cstimer/.DS_Store +0 -0
  748. package/src/cubing/search/inside/solve/vendor/cstimer/src/.DS_Store +0 -0
  749. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/.DS_Store +0 -0
  750. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/.DS_Store +0 -0
  751. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.ts +0 -13
  752. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lib/.DS_Store +0 -0
  753. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/scramble/.DS_Store +0 -0
  754. package/src/cubing/search/inside/solve/vendor/sgs/.DS_Store +0 -0
  755. package/src/cubing/search/inside/solve/vendor/sgs/src/.DS_Store +0 -0
  756. package/src/cubing/search/inside/solve/vendor/sgs/src/test/.DS_Store +0 -0
  757. package/src/cubing/search/vendor/comlink-everywhere/.DS_Store +0 -0
  758. package/src/cubing/twisty/3D/puzzles/PG3D.ts +0 -600
  759. package/src/cubing/twisty/3D/puzzles/Twisty3DPuzzle.ts +0 -9
  760. package/src/cubing/twisty/3D/puzzles/mkbhd.svg +0 -5
  761. package/src/cubing/twisty/animation/indexer/AlgIndexer.ts +0 -25
  762. package/src/cubing/twisty/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +0 -168
  763. package/src/cubing/twisty/dom/TwistyAlgEditor.ts +0 -373
  764. package/src/cubing/twisty/dom/TwistyAlgEditorStartCharSearch.ts +0 -138
  765. package/src/cubing/twisty/dom/viewers/canvas.ts +0 -4
  766. package/src/cubing/twisty/views/3D/.DS_Store +0 -0
  767. package/src/cubing/vendor/three/.DS_Store +0 -0
  768. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.ts +0 -2
  769. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts +0 -24
  770. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.wrapped.js +0 -178
@@ -16,142 +16,21 @@ var __privateSet = (obj, member, value, setter) => {
16
16
  setter ? setter.call(obj, value) : member.set(obj, value);
17
17
  return value;
18
18
  };
19
+ var __privateWrapper = (obj, member, setter, getter) => {
20
+ return {
21
+ set _(value) {
22
+ __privateSet(obj, member, value, setter);
23
+ },
24
+ get _() {
25
+ return __privateGet(obj, member, getter);
26
+ }
27
+ };
28
+ };
19
29
  var __privateMethod = (obj, member, method) => {
20
30
  __accessCheck(obj, member, "access private method");
21
31
  return method;
22
32
  };
23
33
 
24
- // src/cubing/puzzle-geometry/Perm.ts
25
- var zeroCache = [];
26
- var iotaCache = [];
27
- function zeros(n) {
28
- if (!zeroCache[n]) {
29
- const c = Array(n);
30
- for (let i = 0; i < n; i++) {
31
- c[i] = 0;
32
- }
33
- zeroCache[n] = c;
34
- }
35
- return zeroCache[n];
36
- }
37
- function iota(n) {
38
- if (!iotaCache[n]) {
39
- const c = Array(n);
40
- for (let i = 0; i < n; i++) {
41
- c[i] = i;
42
- }
43
- iotaCache[n] = c;
44
- }
45
- return iotaCache[n];
46
- }
47
- function identity(n) {
48
- return new Perm(iota(n));
49
- }
50
- function factorial(a) {
51
- let r = 1;
52
- while (a > 1) {
53
- r *= a;
54
- a--;
55
- }
56
- return r;
57
- }
58
- function gcd(a, b) {
59
- if (a > b) {
60
- const t = a;
61
- a = b;
62
- b = t;
63
- }
64
- while (a > 0) {
65
- const m = b % a;
66
- b = a;
67
- a = m;
68
- }
69
- return b;
70
- }
71
- function lcm(a, b) {
72
- return a / gcd(a, b) * b;
73
- }
74
- var Perm = class {
75
- constructor(a) {
76
- this.n = a.length;
77
- this.p = a;
78
- }
79
- toString() {
80
- return "Perm[" + this.p.join(" ") + "]";
81
- }
82
- mul(p2) {
83
- const c = Array(this.n);
84
- for (let i = 0; i < this.n; i++) {
85
- c[i] = p2.p[this.p[i]];
86
- }
87
- return new Perm(c);
88
- }
89
- rmul(p2) {
90
- const c = Array(this.n);
91
- for (let i = 0; i < this.n; i++) {
92
- c[i] = this.p[p2.p[i]];
93
- }
94
- return new Perm(c);
95
- }
96
- inv() {
97
- const c = Array(this.n);
98
- for (let i = 0; i < this.n; i++) {
99
- c[this.p[i]] = i;
100
- }
101
- return new Perm(c);
102
- }
103
- compareTo(p2) {
104
- for (let i = 0; i < this.n; i++) {
105
- if (this.p[i] !== p2.p[i]) {
106
- return this.p[i] - p2.p[i];
107
- }
108
- }
109
- return 0;
110
- }
111
- toGap() {
112
- const cyc = new Array();
113
- const seen = new Array(this.n);
114
- for (let i = 0; i < this.p.length; i++) {
115
- if (seen[i] || this.p[i] === i) {
116
- continue;
117
- }
118
- const incyc = new Array();
119
- for (let j = i; !seen[j]; j = this.p[j]) {
120
- incyc.push(1 + j);
121
- seen[j] = true;
122
- }
123
- cyc.push("(" + incyc.join(",") + ")");
124
- }
125
- return cyc.join("");
126
- }
127
- order() {
128
- let r = 1;
129
- const seen = new Array(this.n);
130
- for (let i = 0; i < this.p.length; i++) {
131
- if (seen[i] || this.p[i] === i) {
132
- continue;
133
- }
134
- let cs = 0;
135
- for (let j = i; !seen[j]; j = this.p[j]) {
136
- cs++;
137
- seen[j] = true;
138
- }
139
- r = lcm(r, cs);
140
- }
141
- return r;
142
- }
143
- };
144
-
145
- // src/cubing/puzzle-geometry/notation-mapping/NullMapper.ts
146
- var NullMapper = class {
147
- notationToInternal(move) {
148
- return move;
149
- }
150
- notationToExternal(move) {
151
- return move;
152
- }
153
- };
154
-
155
34
  // src/cubing/alg/common.ts
156
35
  var writeAlgDebugField = false;
157
36
  var Comparable = class {
@@ -167,7 +46,7 @@ var AlgCommon = class extends Comparable {
167
46
  super();
168
47
  if (writeAlgDebugField) {
169
48
  Object.defineProperty(this, "_debugStr", {
170
- get: function() {
49
+ get: () => {
171
50
  return this.toString();
172
51
  }
173
52
  });
@@ -275,7 +154,7 @@ var _Commutator = class extends AlgCommon {
275
154
  }
276
155
  }
277
156
  toString() {
278
- return `[${__privateGet(this, _A)}, ${__privateGet(this, _B)}]`;
157
+ return `[${__privateGet(this, _A).toString()}, ${__privateGet(this, _B).toString()}]`;
279
158
  }
280
159
  };
281
160
  var Commutator = _Commutator;
@@ -656,15 +535,13 @@ var AlgParser = class {
656
535
  return __privateGet(this, _input).slice(__privateGet(this, _idx));
657
536
  }
658
537
  popNext() {
659
- var _a;
660
538
  const next = __privateGet(this, _input)[__privateGet(this, _idx)];
661
- __privateSet(this, _idx, (_a = +__privateGet(this, _idx)) + 1), _a;
539
+ __privateWrapper(this, _idx)._++;
662
540
  return next;
663
541
  }
664
542
  tryConsumeNext(expected) {
665
- var _a;
666
543
  if (__privateGet(this, _input)[__privateGet(this, _idx)] === expected) {
667
- __privateSet(this, _idx, (_a = +__privateGet(this, _idx)) + 1), _a;
544
+ __privateWrapper(this, _idx)._++;
668
545
  return true;
669
546
  }
670
547
  return false;
@@ -1329,6 +1206,117 @@ var cubeKeyMapping = {
1329
1206
  190: new Move("M'")
1330
1207
  };
1331
1208
 
1209
+ // src/cubing/puzzle-geometry/FaceNameSwizzler.ts
1210
+ var FaceNameSwizzler = class {
1211
+ constructor(facenames, gripnames_arg) {
1212
+ this.facenames = facenames;
1213
+ this.prefixFree = true;
1214
+ this.gripnames = [];
1215
+ if (gripnames_arg) {
1216
+ this.gripnames = gripnames_arg;
1217
+ }
1218
+ for (let i = 0; this.prefixFree && i < facenames.length; i++) {
1219
+ for (let j = 0; this.prefixFree && j < facenames.length; j++) {
1220
+ if (i !== j && facenames[i].startsWith(facenames[j])) {
1221
+ this.prefixFree = false;
1222
+ }
1223
+ }
1224
+ }
1225
+ }
1226
+ setGripNames(names) {
1227
+ this.gripnames = names;
1228
+ }
1229
+ splitByFaceNames(s) {
1230
+ const r = [];
1231
+ let at = 0;
1232
+ while (at < s.length) {
1233
+ if (at > 0 && at < s.length && s[at] === "_") {
1234
+ at++;
1235
+ }
1236
+ let currentMatch = -1;
1237
+ for (let i = 0; i < this.facenames.length; i++) {
1238
+ if (s.substr(at).startsWith(this.facenames[i]) && (currentMatch < 0 || this.facenames[i].length > this.facenames[currentMatch].length)) {
1239
+ currentMatch = i;
1240
+ }
1241
+ }
1242
+ if (currentMatch >= 0) {
1243
+ r.push(currentMatch);
1244
+ at += this.facenames[currentMatch].length;
1245
+ } else {
1246
+ throw new Error("Could not split " + s + " into face names.");
1247
+ }
1248
+ }
1249
+ return r;
1250
+ }
1251
+ joinByFaceIndices(list) {
1252
+ let sep = "";
1253
+ const r = [];
1254
+ for (let i = 0; i < list.length; i++) {
1255
+ r.push(sep);
1256
+ r.push(this.facenames[list[i]]);
1257
+ if (!this.prefixFree) {
1258
+ sep = "_";
1259
+ }
1260
+ }
1261
+ return r.join("");
1262
+ }
1263
+ spinmatch(userinput, longname) {
1264
+ if (userinput === longname) {
1265
+ return true;
1266
+ }
1267
+ try {
1268
+ const e1 = this.splitByFaceNames(userinput);
1269
+ const e2 = this.splitByFaceNames(longname);
1270
+ if (e1.length !== e2.length && e1.length < 3) {
1271
+ return false;
1272
+ }
1273
+ for (let i = 0; i < e1.length; i++) {
1274
+ for (let j = 0; j < i; j++) {
1275
+ if (e1[i] === e1[j]) {
1276
+ return false;
1277
+ }
1278
+ }
1279
+ let found = false;
1280
+ for (let j = 0; j < e2.length; j++) {
1281
+ if (e1[i] === e2[j]) {
1282
+ found = true;
1283
+ break;
1284
+ }
1285
+ }
1286
+ if (!found) {
1287
+ return false;
1288
+ }
1289
+ }
1290
+ return true;
1291
+ } catch (e) {
1292
+ return false;
1293
+ }
1294
+ }
1295
+ unswizzle(s) {
1296
+ if ((s.endsWith("v") || s.endsWith("w")) && s[0] <= "Z") {
1297
+ s = s.slice(0, s.length - 1);
1298
+ }
1299
+ const upperCaseGrip = s.toUpperCase();
1300
+ for (let i = 0; i < this.gripnames.length; i++) {
1301
+ const g = this.gripnames[i];
1302
+ if (this.spinmatch(upperCaseGrip, g)) {
1303
+ return g;
1304
+ }
1305
+ }
1306
+ return s;
1307
+ }
1308
+ };
1309
+
1310
+ // src/cubing/puzzle-geometry/notation-mapping/NullMapper.ts
1311
+ var NullMapper = class {
1312
+ notationToInternal(move) {
1313
+ return move;
1314
+ }
1315
+ notationToExternal(move) {
1316
+ return move;
1317
+ }
1318
+ };
1319
+
1332
1320
  // src/cubing/puzzle-geometry/notation-mapping/FTONotationMapper.ts
1333
1321
  var FTONotationMapper = class {
1334
1322
  constructor(child, sw) {
@@ -1659,17 +1647,236 @@ var SkewbNotationMapper = class {
1659
1647
  }
1660
1648
  };
1661
1649
 
1662
- // src/cubing/puzzle-geometry/PermOriSet.ts
1663
- var OrbitDef = class {
1664
- constructor(size, mod) {
1665
- this.size = size;
1666
- this.mod = mod;
1667
- }
1668
- reassemblySize() {
1669
- return factorial(this.size) * Math.pow(this.mod, this.size);
1650
+ // src/cubing/puzzle-geometry/Options.ts
1651
+ function asstructured(v) {
1652
+ if (typeof v === "string") {
1653
+ return JSON.parse(v);
1670
1654
  }
1671
- };
1672
- function externalName(mapper, moveString) {
1655
+ return v;
1656
+ }
1657
+ function asboolean(v) {
1658
+ if (typeof v === "string") {
1659
+ if (v === "false") {
1660
+ return false;
1661
+ }
1662
+ return true;
1663
+ } else {
1664
+ return v ? true : false;
1665
+ }
1666
+ }
1667
+ var PuzzleGeometryFullOptions = class {
1668
+ constructor(options = {}) {
1669
+ this.verbosity = 0;
1670
+ this.allMoves = false;
1671
+ this.vertexMoves = false;
1672
+ this.addRotations = false;
1673
+ this.moveList = null;
1674
+ this.fixedOrientation = false;
1675
+ this.fixedPieceType = null;
1676
+ this.orientCenters = false;
1677
+ this.includeCornerOrbits = true;
1678
+ this.includeCenterOrbits = true;
1679
+ this.includeEdgeOrbits = true;
1680
+ this.excludeOrbits = [];
1681
+ this.optimizeOrbits = false;
1682
+ this.grayCorners = false;
1683
+ this.grayCenters = false;
1684
+ this.grayEdges = false;
1685
+ this.puzzleOrientation = null;
1686
+ this.puzzleOrientations = null;
1687
+ this.scrambleAmount = 0;
1688
+ Object.assign(this, options);
1689
+ }
1690
+ };
1691
+ function parsePGOptionList(optionlist) {
1692
+ const options = {};
1693
+ if (optionlist !== void 0) {
1694
+ if (optionlist.length % 2 !== 0) {
1695
+ throw new Error("Odd length in option list?");
1696
+ }
1697
+ for (let i = 0; i < optionlist.length; i += 2) {
1698
+ if (optionlist[i] === "verbose") {
1699
+ options.verbosity = (options.verbosity ?? 0) + 1;
1700
+ } else if (optionlist[i] === "quiet") {
1701
+ options.verbosity = 0;
1702
+ } else if (optionlist[i] === "allmoves") {
1703
+ options.allMoves = asboolean(optionlist[i + 1]);
1704
+ } else if (optionlist[i] === "outerblockmoves") {
1705
+ options.outerBlockMoves = asboolean(optionlist[i + 1]);
1706
+ } else if (optionlist[i] === "vertexmoves") {
1707
+ options.vertexMoves = asboolean(optionlist[i + 1]);
1708
+ } else if (optionlist[i] === "rotations") {
1709
+ options.addRotations = asboolean(optionlist[i + 1]);
1710
+ } else if (optionlist[i] === "cornersets") {
1711
+ options.includeCornerOrbits = asboolean(optionlist[i + 1]);
1712
+ } else if (optionlist[i] === "centersets") {
1713
+ options.includeCenterOrbits = asboolean(optionlist[i + 1]);
1714
+ } else if (optionlist[i] === "edgesets") {
1715
+ options.includeEdgeOrbits = asboolean(optionlist[i + 1]);
1716
+ } else if (optionlist[i] === "omit") {
1717
+ options.excludeOrbits = optionlist[i + 1];
1718
+ } else if (optionlist[i] === "graycorners") {
1719
+ options.grayCorners = asboolean(optionlist[i + 1]);
1720
+ } else if (optionlist[i] === "graycenters") {
1721
+ options.grayCenters = asboolean(optionlist[i + 1]);
1722
+ } else if (optionlist[i] === "grayedges") {
1723
+ options.grayEdges = asboolean(optionlist[i + 1]);
1724
+ } else if (optionlist[i] === "movelist") {
1725
+ options.moveList = asstructured(optionlist[i + 1]);
1726
+ } else if (optionlist[i] === "killorientation") {
1727
+ options.fixedOrientation = asboolean(optionlist[i + 1]);
1728
+ } else if (optionlist[i] === "optimize") {
1729
+ options.optimizeOrbits = asboolean(optionlist[i + 1]);
1730
+ } else if (optionlist[i] === "scramble") {
1731
+ options.scrambleAmount = optionlist[i + 1];
1732
+ } else if (optionlist[i] === "fix") {
1733
+ options.fixedPieceType = optionlist[i + 1];
1734
+ } else if (optionlist[i] === "orientcenters") {
1735
+ options.orientCenters = asboolean(optionlist[i + 1]);
1736
+ } else if (optionlist[i] === "puzzleorientation") {
1737
+ options.puzzleOrientation = asstructured(optionlist[i + 1]);
1738
+ } else if (optionlist[i] === "puzzleorientations") {
1739
+ options.puzzleOrientations = asstructured(optionlist[i + 1]);
1740
+ } else {
1741
+ throw new Error("Bad option while processing option list " + optionlist[i]);
1742
+ }
1743
+ }
1744
+ }
1745
+ return options;
1746
+ }
1747
+
1748
+ // src/cubing/puzzle-geometry/Perm.ts
1749
+ var zeroCache = [];
1750
+ var iotaCache = [];
1751
+ function zeros(n) {
1752
+ if (!zeroCache[n]) {
1753
+ const c = Array(n);
1754
+ for (let i = 0; i < n; i++) {
1755
+ c[i] = 0;
1756
+ }
1757
+ zeroCache[n] = c;
1758
+ }
1759
+ return zeroCache[n];
1760
+ }
1761
+ function iota(n) {
1762
+ if (!iotaCache[n]) {
1763
+ const c = Array(n);
1764
+ for (let i = 0; i < n; i++) {
1765
+ c[i] = i;
1766
+ }
1767
+ iotaCache[n] = c;
1768
+ }
1769
+ return iotaCache[n];
1770
+ }
1771
+ function identity(n) {
1772
+ return new Perm(iota(n));
1773
+ }
1774
+ function factorial(a) {
1775
+ let r = 1;
1776
+ while (a > 1) {
1777
+ r *= a;
1778
+ a--;
1779
+ }
1780
+ return r;
1781
+ }
1782
+ function gcd(a, b) {
1783
+ if (a > b) {
1784
+ const t = a;
1785
+ a = b;
1786
+ b = t;
1787
+ }
1788
+ while (a > 0) {
1789
+ const m = b % a;
1790
+ b = a;
1791
+ a = m;
1792
+ }
1793
+ return b;
1794
+ }
1795
+ function lcm(a, b) {
1796
+ return a / gcd(a, b) * b;
1797
+ }
1798
+ var Perm = class {
1799
+ constructor(a) {
1800
+ this.n = a.length;
1801
+ this.p = a;
1802
+ }
1803
+ toString() {
1804
+ return "Perm[" + this.p.join(" ") + "]";
1805
+ }
1806
+ mul(p2) {
1807
+ const c = Array(this.n);
1808
+ for (let i = 0; i < this.n; i++) {
1809
+ c[i] = p2.p[this.p[i]];
1810
+ }
1811
+ return new Perm(c);
1812
+ }
1813
+ rmul(p2) {
1814
+ const c = Array(this.n);
1815
+ for (let i = 0; i < this.n; i++) {
1816
+ c[i] = this.p[p2.p[i]];
1817
+ }
1818
+ return new Perm(c);
1819
+ }
1820
+ inv() {
1821
+ const c = Array(this.n);
1822
+ for (let i = 0; i < this.n; i++) {
1823
+ c[this.p[i]] = i;
1824
+ }
1825
+ return new Perm(c);
1826
+ }
1827
+ compareTo(p2) {
1828
+ for (let i = 0; i < this.n; i++) {
1829
+ if (this.p[i] !== p2.p[i]) {
1830
+ return this.p[i] - p2.p[i];
1831
+ }
1832
+ }
1833
+ return 0;
1834
+ }
1835
+ toGap() {
1836
+ const cyc = new Array();
1837
+ const seen = new Array(this.n);
1838
+ for (let i = 0; i < this.p.length; i++) {
1839
+ if (seen[i] || this.p[i] === i) {
1840
+ continue;
1841
+ }
1842
+ const incyc = new Array();
1843
+ for (let j = i; !seen[j]; j = this.p[j]) {
1844
+ incyc.push(1 + j);
1845
+ seen[j] = true;
1846
+ }
1847
+ cyc.push("(" + incyc.join(",") + ")");
1848
+ }
1849
+ return cyc.join("");
1850
+ }
1851
+ order() {
1852
+ let r = 1;
1853
+ const seen = new Array(this.n);
1854
+ for (let i = 0; i < this.p.length; i++) {
1855
+ if (seen[i] || this.p[i] === i) {
1856
+ continue;
1857
+ }
1858
+ let cs = 0;
1859
+ for (let j = i; !seen[j]; j = this.p[j]) {
1860
+ cs++;
1861
+ seen[j] = true;
1862
+ }
1863
+ r = lcm(r, cs);
1864
+ }
1865
+ return r;
1866
+ }
1867
+ };
1868
+
1869
+ // src/cubing/puzzle-geometry/PermOriSet.ts
1870
+ var PGOrbitDef = class {
1871
+ constructor(size, mod) {
1872
+ this.size = size;
1873
+ this.mod = mod;
1874
+ }
1875
+ reassemblySize() {
1876
+ return factorial(this.size) * Math.pow(this.mod, this.size);
1877
+ }
1878
+ };
1879
+ function externalName(mapper, moveString) {
1673
1880
  const mv = Move.fromString(moveString);
1674
1881
  const mv2 = mapper.notationToExternal(mv);
1675
1882
  if (mv2 === null || mv === mv2) {
@@ -1677,7 +1884,7 @@ function externalName(mapper, moveString) {
1677
1884
  }
1678
1885
  return mv2.toString();
1679
1886
  }
1680
- var OrbitsDef = class {
1887
+ var PGOrbitsDef = class {
1681
1888
  constructor(orbitnames, orbitdefs, solved, movenames, moveops) {
1682
1889
  this.orbitnames = orbitnames;
1683
1890
  this.orbitdefs = orbitdefs;
@@ -1688,14 +1895,14 @@ var OrbitsDef = class {
1688
1895
  transformToKPuzzle(t) {
1689
1896
  const mp = {};
1690
1897
  for (let j = 0; j < this.orbitnames.length; j++) {
1691
- mp[this.orbitnames[j]] = t.orbits[j].toKpuzzle();
1898
+ mp[this.orbitnames[j]] = t.orbits[j].toKPuzzle();
1692
1899
  }
1693
1900
  return mp;
1694
1901
  }
1695
1902
  static transformToKPuzzle(orbitnames, t) {
1696
1903
  const mp = {};
1697
1904
  for (let j = 0; j < orbitnames.length; j++) {
1698
- mp[orbitnames[j]] = t.orbits[j].toKpuzzle();
1905
+ mp[orbitnames[j]] = t.orbits[j].toKPuzzle();
1699
1906
  }
1700
1907
  return mp;
1701
1908
  }
@@ -1704,12 +1911,12 @@ var OrbitsDef = class {
1704
1911
  result.push("Name " + name);
1705
1912
  result.push("");
1706
1913
  for (let i = 0; i < this.orbitnames.length; i++) {
1707
- result.push("Set " + this.orbitnames[i] + " " + this.orbitdefs[i].size + " " + this.orbitdefs[i].mod);
1914
+ result.push(`Set ${this.orbitnames[i]} ${this.orbitdefs[i].size} ${this.orbitdefs[i].mod}`);
1708
1915
  }
1709
1916
  result.push("");
1710
1917
  result.push("Solved");
1711
1918
  for (let i = 0; i < this.orbitnames.length; i++) {
1712
- this.solved.orbits[i].appendConciseDefinition(result, this.orbitnames[i], false);
1919
+ this.solved.orbits[i].appendDefinition(result, this.orbitnames[i], false, false);
1713
1920
  }
1714
1921
  result.push("End");
1715
1922
  for (let i = 0; i < this.movenames.length; i++) {
@@ -1723,16 +1930,16 @@ var OrbitsDef = class {
1723
1930
  result.push("Move " + name2);
1724
1931
  for (let j = 0; j < this.orbitnames.length; j++) {
1725
1932
  if (doinv) {
1726
- this.moveops[i].orbits[j].inv().appendConciseDefinition(result, this.orbitnames[j], true);
1933
+ this.moveops[i].orbits[j].inv().appendDefinition(result, this.orbitnames[j], true);
1727
1934
  } else {
1728
- this.moveops[i].orbits[j].appendConciseDefinition(result, this.orbitnames[j], true);
1935
+ this.moveops[i].orbits[j].appendDefinition(result, this.orbitnames[j], true);
1729
1936
  }
1730
1937
  }
1731
1938
  result.push("End");
1732
1939
  }
1733
1940
  return result;
1734
1941
  }
1735
- toKpuzzle() {
1942
+ toKPuzzle(includemoves) {
1736
1943
  const orbits = {};
1737
1944
  const start = {};
1738
1945
  for (let i = 0; i < this.orbitnames.length; i++) {
@@ -1740,11 +1947,13 @@ var OrbitsDef = class {
1740
1947
  numPieces: this.orbitdefs[i].size,
1741
1948
  orientations: this.orbitdefs[i].mod
1742
1949
  };
1743
- start[this.orbitnames[i]] = this.solved.orbits[i].toKpuzzle();
1950
+ start[this.orbitnames[i]] = this.solved.orbits[i].toKPuzzle();
1744
1951
  }
1745
1952
  const moves = {};
1746
- for (let i = 0; i < this.movenames.length; i++) {
1747
- moves[this.movenames[i]] = this.transformToKPuzzle(this.moveops[i]);
1953
+ if (includemoves) {
1954
+ for (let i = 0; i < this.movenames.length; i++) {
1955
+ moves[this.movenames[i]] = this.transformToKPuzzle(this.moveops[i]);
1956
+ }
1748
1957
  }
1749
1958
  return { name: "PG3D", orbits, startPieces: start, moves };
1750
1959
  }
@@ -1831,18 +2040,18 @@ var OrbitsDef = class {
1831
2040
  }
1832
2041
  }
1833
2042
  if (multiple) {
1834
- neworbitnames.push(this.orbitnames[i] + "_p" + j);
2043
+ neworbitnames.push(`${this.orbitnames[i]}_p${j}`);
1835
2044
  } else {
1836
2045
  neworbitnames.push(this.orbitnames[i]);
1837
2046
  }
1838
2047
  if (keepori) {
1839
- neworbitdefs.push(new OrbitDef(nv, this.orbitdefs[i].mod));
2048
+ neworbitdefs.push(new PGOrbitDef(nv, this.orbitdefs[i].mod));
1840
2049
  newsolved.push(this.solved.orbits[i].remapVS(no, nv));
1841
2050
  for (let k = 0; k < this.moveops.length; k++) {
1842
2051
  newmoveops[k].push(this.moveops[k].orbits[i].remap(no, on, nv));
1843
2052
  }
1844
2053
  } else {
1845
- neworbitdefs.push(new OrbitDef(nv, 1));
2054
+ neworbitdefs.push(new PGOrbitDef(nv, 1));
1846
2055
  newsolved.push(this.solved.orbits[i].remapVS(no, nv).killOri());
1847
2056
  for (let k = 0; k < this.moveops.length; k++) {
1848
2057
  newmoveops[k].push(this.moveops[k].orbits[i].remap(no, on, nv).killOri());
@@ -1850,7 +2059,7 @@ var OrbitsDef = class {
1850
2059
  }
1851
2060
  }
1852
2061
  }
1853
- return new OrbitsDef(neworbitnames, neworbitdefs, new VisibleState(newsolved), this.movenames, newmoveops.map((_) => new Transformation(_)));
2062
+ return new PGOrbitsDef(neworbitnames, neworbitdefs, new VisibleState(newsolved), this.movenames, newmoveops.map((_) => new PGTransform(_)));
1854
2063
  }
1855
2064
  scramble(n) {
1856
2065
  const pool = [];
@@ -1889,14 +2098,14 @@ var OrbitsDef = class {
1889
2098
  return n;
1890
2099
  }
1891
2100
  };
1892
- var _Orbit = class {
2101
+ var _PGOrbit = class {
1893
2102
  constructor(perm, ori, orimod) {
1894
2103
  this.perm = perm;
1895
2104
  this.ori = ori;
1896
2105
  this.orimod = orimod;
1897
2106
  }
1898
2107
  static e(n, mod) {
1899
- return new _Orbit(iota(n), zeros(n), mod);
2108
+ return new _PGOrbit(iota(n), zeros(n), mod);
1900
2109
  }
1901
2110
  mul(b) {
1902
2111
  const n = this.perm.length;
@@ -1905,14 +2114,14 @@ var _Orbit = class {
1905
2114
  for (let i = 0; i < n; i++) {
1906
2115
  newPerm[i] = this.perm[b.perm[i]];
1907
2116
  }
1908
- return new _Orbit(newPerm, this.ori, this.orimod);
2117
+ return new _PGOrbit(newPerm, this.ori, this.orimod);
1909
2118
  } else {
1910
2119
  const newOri = new Array(n);
1911
2120
  for (let i = 0; i < n; i++) {
1912
2121
  newPerm[i] = this.perm[b.perm[i]];
1913
2122
  newOri[i] = (this.ori[b.perm[i]] + b.ori[i]) % this.orimod;
1914
2123
  }
1915
- return new _Orbit(newPerm, newOri, this.orimod);
2124
+ return new _PGOrbit(newPerm, newOri, this.orimod);
1916
2125
  }
1917
2126
  }
1918
2127
  inv() {
@@ -1923,7 +2132,7 @@ var _Orbit = class {
1923
2132
  newPerm[this.perm[i]] = i;
1924
2133
  newOri[this.perm[i]] = (this.orimod - this.ori[i]) % this.orimod;
1925
2134
  }
1926
- return new _Orbit(newPerm, newOri, this.orimod);
2135
+ return new _PGOrbit(newPerm, newOri, this.orimod);
1927
2136
  }
1928
2137
  equal(b) {
1929
2138
  const n = this.perm.length;
@@ -2009,7 +2218,7 @@ var _Orbit = class {
2009
2218
  newPerm[i] = on[this.perm[no[i]]];
2010
2219
  newOri[i] = this.ori[no[i]];
2011
2220
  }
2012
- return new _Orbit(newPerm, newOri, this.orimod);
2221
+ return new _PGOrbit(newPerm, newOri, this.orimod);
2013
2222
  }
2014
2223
  remapVS(no, nv) {
2015
2224
  const newPerm = new Array(nv);
@@ -2024,10 +2233,10 @@ var _Orbit = class {
2024
2233
  newPerm[i] = reassign[ov];
2025
2234
  newOri[i] = this.ori[no[i]];
2026
2235
  }
2027
- return new _Orbit(newPerm, newOri, this.orimod);
2236
+ return new _PGOrbit(newPerm, newOri, this.orimod);
2028
2237
  }
2029
- appendConciseDefinition(result, name, useVS) {
2030
- if (this.isIdentity()) {
2238
+ appendDefinition(result, name, useVS, concise = true) {
2239
+ if (concise && this.isIdentity()) {
2031
2240
  return;
2032
2241
  }
2033
2242
  result.push(name);
@@ -2044,21 +2253,21 @@ var _Orbit = class {
2044
2253
  }
2045
2254
  }
2046
2255
  }
2047
- toKpuzzle() {
2256
+ toKPuzzle() {
2048
2257
  const n = this.perm.length;
2049
2258
  if (this.isIdentity()) {
2050
- if (!_Orbit.kcache[n]) {
2051
- _Orbit.kcache[n] = { permutation: iota(n), orientation: zeros(n) };
2259
+ if (!_PGOrbit.kcache[n]) {
2260
+ _PGOrbit.kcache[n] = { permutation: iota(n), orientation: zeros(n) };
2052
2261
  }
2053
- return _Orbit.kcache[n];
2262
+ return _PGOrbit.kcache[n];
2054
2263
  } else {
2055
2264
  return { permutation: this.perm, orientation: this.ori };
2056
2265
  }
2057
2266
  }
2058
2267
  };
2059
- var Orbit = _Orbit;
2060
- Orbit.kcache = [];
2061
- var TransformationBase = class {
2268
+ var PGOrbit = _PGOrbit;
2269
+ PGOrbit.kcache = [];
2270
+ var PGTransformBase = class {
2062
2271
  constructor(orbits) {
2063
2272
  this.orbits = orbits;
2064
2273
  }
@@ -2071,8 +2280,8 @@ var TransformationBase = class {
2071
2280
  }
2072
2281
  internalInv() {
2073
2282
  const newOrbits = [];
2074
- for (let i = 0; i < this.orbits.length; i++) {
2075
- newOrbits.push(this.orbits[i].inv());
2283
+ for (const orbit of this.orbits) {
2284
+ newOrbits.push(orbit.inv());
2076
2285
  }
2077
2286
  return newOrbits;
2078
2287
  }
@@ -2085,23 +2294,22 @@ var TransformationBase = class {
2085
2294
  return true;
2086
2295
  }
2087
2296
  killOri() {
2088
- for (let i = 0; i < this.orbits.length; i++) {
2089
- this.orbits[i].killOri();
2297
+ for (const orbit of this.orbits) {
2298
+ orbit.killOri();
2090
2299
  }
2091
2300
  return this;
2092
2301
  }
2093
2302
  toPerm() {
2094
2303
  const perms = new Array();
2095
2304
  let n = 0;
2096
- for (let i = 0; i < this.orbits.length; i++) {
2097
- const p = this.orbits[i].toPerm();
2305
+ for (const orbit of this.orbits) {
2306
+ const p = orbit.toPerm();
2098
2307
  perms.push(p);
2099
2308
  n += p.n;
2100
2309
  }
2101
2310
  const newPerm = new Array(n);
2102
2311
  n = 0;
2103
- for (let i = 0; i < this.orbits.length; i++) {
2104
- const p = perms[i];
2312
+ for (const p of perms) {
2105
2313
  for (let j = 0; j < p.n; j++) {
2106
2314
  newPerm[n + j] = n + p.p[j];
2107
2315
  }
@@ -2112,30 +2320,30 @@ var TransformationBase = class {
2112
2320
  identicalPieces() {
2113
2321
  const r = [];
2114
2322
  let n = 0;
2115
- for (let i = 0; i < this.orbits.length; i++) {
2116
- const o = this.orbits[i].orimod;
2117
- const s = this.orbits[i].identicalPieces();
2323
+ for (const orbit of this.orbits) {
2324
+ const o = orbit.orimod;
2325
+ const s = orbit.identicalPieces();
2118
2326
  for (let j = 0; j < s.length; j++) {
2119
2327
  r.push(s[j].map((_) => _ * o + n));
2120
2328
  }
2121
- n += o * this.orbits[i].perm.length;
2329
+ n += o * orbit.perm.length;
2122
2330
  }
2123
2331
  return r;
2124
2332
  }
2125
2333
  order() {
2126
2334
  let r = 1;
2127
- for (let i = 0; i < this.orbits.length; i++) {
2128
- r = lcm(r, this.orbits[i].order());
2335
+ for (const orbit of this.orbits) {
2336
+ r = lcm(r, orbit.order());
2129
2337
  }
2130
2338
  return r;
2131
2339
  }
2132
2340
  };
2133
- var Transformation = class extends TransformationBase {
2341
+ var PGTransform = class extends PGTransformBase {
2134
2342
  constructor(orbits) {
2135
2343
  super(orbits);
2136
2344
  }
2137
2345
  mul(b) {
2138
- return new Transformation(this.internalMul(b));
2346
+ return new PGTransform(this.internalMul(b));
2139
2347
  }
2140
2348
  mulScalar(n) {
2141
2349
  if (n === 0) {
@@ -2167,13 +2375,13 @@ var Transformation = class extends TransformationBase {
2167
2375
  return r;
2168
2376
  }
2169
2377
  inv() {
2170
- return new Transformation(this.internalInv());
2378
+ return new PGTransform(this.internalInv());
2171
2379
  }
2172
2380
  e() {
2173
- return new Transformation(this.orbits.map((_) => Orbit.e(_.perm.length, _.orimod)));
2381
+ return new PGTransform(this.orbits.map((_) => PGOrbit.e(_.perm.length, _.orimod)));
2174
2382
  }
2175
2383
  };
2176
- var VisibleState = class extends TransformationBase {
2384
+ var VisibleState = class extends PGTransformBase {
2177
2385
  constructor(orbits) {
2178
2386
  super(orbits);
2179
2387
  }
@@ -2251,112 +2459,11 @@ function showcanon(g, disp) {
2251
2459
  }
2252
2460
  }
2253
2461
  }
2254
- disp("" + d + ": canonseq " + sum + " states " + uniq);
2462
+ disp(`${d}: canonseq ${sum} states ${uniq}`);
2255
2463
  curlev = nextlev;
2256
2464
  }
2257
2465
  }
2258
2466
 
2259
- // src/cubing/puzzle-geometry/FaceNameSwizzler.ts
2260
- var FaceNameSwizzler = class {
2261
- constructor(facenames, gripnames_arg) {
2262
- this.facenames = facenames;
2263
- this.prefixFree = true;
2264
- this.gripnames = [];
2265
- if (gripnames_arg) {
2266
- this.gripnames = gripnames_arg;
2267
- }
2268
- for (let i = 0; this.prefixFree && i < facenames.length; i++) {
2269
- for (let j = 0; this.prefixFree && j < facenames.length; j++) {
2270
- if (i !== j && facenames[i].startsWith(facenames[j])) {
2271
- this.prefixFree = false;
2272
- }
2273
- }
2274
- }
2275
- }
2276
- setGripNames(names) {
2277
- this.gripnames = names;
2278
- }
2279
- splitByFaceNames(s) {
2280
- const r = [];
2281
- let at = 0;
2282
- while (at < s.length) {
2283
- if (at > 0 && at < s.length && s[at] === "_") {
2284
- at++;
2285
- }
2286
- let currentMatch = -1;
2287
- for (let i = 0; i < this.facenames.length; i++) {
2288
- if (s.substr(at).startsWith(this.facenames[i]) && (currentMatch < 0 || this.facenames[i].length > this.facenames[currentMatch].length)) {
2289
- currentMatch = i;
2290
- }
2291
- }
2292
- if (currentMatch >= 0) {
2293
- r.push(currentMatch);
2294
- at += this.facenames[currentMatch].length;
2295
- } else {
2296
- throw new Error("Could not split " + s + " into face names.");
2297
- }
2298
- }
2299
- return r;
2300
- }
2301
- joinByFaceIndices(list) {
2302
- let sep = "";
2303
- const r = [];
2304
- for (let i = 0; i < list.length; i++) {
2305
- r.push(sep);
2306
- r.push(this.facenames[list[i]]);
2307
- if (!this.prefixFree) {
2308
- sep = "_";
2309
- }
2310
- }
2311
- return r.join("");
2312
- }
2313
- spinmatch(userinput, longname) {
2314
- if (userinput === longname) {
2315
- return true;
2316
- }
2317
- try {
2318
- const e1 = this.splitByFaceNames(userinput);
2319
- const e2 = this.splitByFaceNames(longname);
2320
- if (e1.length !== e2.length && e1.length < 3) {
2321
- return false;
2322
- }
2323
- for (let i = 0; i < e1.length; i++) {
2324
- for (let j = 0; j < i; j++) {
2325
- if (e1[i] === e1[j]) {
2326
- return false;
2327
- }
2328
- }
2329
- let found = false;
2330
- for (let j = 0; j < e2.length; j++) {
2331
- if (e1[i] === e2[j]) {
2332
- found = true;
2333
- break;
2334
- }
2335
- }
2336
- if (!found) {
2337
- return false;
2338
- }
2339
- }
2340
- return true;
2341
- } catch (e) {
2342
- return false;
2343
- }
2344
- }
2345
- unswizzle(s) {
2346
- if ((s.endsWith("v") || s.endsWith("w")) && s[0] <= "Z") {
2347
- s = s.slice(0, s.length - 1);
2348
- }
2349
- const upperCaseGrip = s.toUpperCase();
2350
- for (let i = 0; i < this.gripnames.length; i++) {
2351
- const g = this.gripnames[i];
2352
- if (this.spinmatch(upperCaseGrip, g)) {
2353
- return g;
2354
- }
2355
- }
2356
- return s;
2357
- }
2358
- };
2359
-
2360
2467
  // src/cubing/puzzle-geometry/PGPuzzles.ts
2361
2468
  var PGPuzzles = {
2362
2469
  "2x2x2": "c f 0",
@@ -2430,20 +2537,6 @@ var PGPuzzles = {
2430
2537
 
2431
2538
  // src/cubing/puzzle-geometry/Quat.ts
2432
2539
  var eps = 1e-9;
2433
- function expandfaces(rots, faces) {
2434
- const nfaces = [];
2435
- for (let i = 0; i < rots.length; i++) {
2436
- for (let k = 0; k < faces.length; k++) {
2437
- const face = faces[k];
2438
- const nface = [];
2439
- for (let j = 0; j < face.length; j++) {
2440
- nface.push(face[j].rotateplane(rots[i]));
2441
- }
2442
- nfaces.push(nface);
2443
- }
2444
- }
2445
- return nfaces;
2446
- }
2447
2540
  function centermassface(face) {
2448
2541
  let s = new Quat(0, 0, 0, 0);
2449
2542
  for (let i = 0; i < face.length; i++) {
@@ -2455,49 +2548,17 @@ function solvethreeplanes(p1, p2, p3, planes) {
2455
2548
  const p = planes[p1].intersect3(planes[p2], planes[p3]);
2456
2549
  if (!p) {
2457
2550
  return p;
2458
- }
2459
- for (let i = 0; i < planes.length; i++) {
2460
- if (i !== p1 && i !== p2 && i !== p3) {
2461
- const dt = planes[i].b * p.b + planes[i].c * p.c + planes[i].d * p.d;
2462
- if (planes[i].a > 0 && dt > planes[i].a || planes[i].a < 0 && dt < planes[i].a) {
2463
- return false;
2464
- }
2465
- }
2466
- }
2467
- return p;
2468
- }
2469
- var FaceTree = class {
2470
- constructor(face, left, right) {
2471
- this.face = face;
2472
- this.left = left;
2473
- this.right = right;
2474
- }
2475
- split(q) {
2476
- const t = q.cutface(this.face);
2477
- if (t !== null) {
2478
- if (this.left === void 0) {
2479
- this.left = new FaceTree(t[0]);
2480
- this.right = new FaceTree(t[1]);
2481
- } else {
2482
- this.left = this.left?.split(q);
2483
- this.right = this.right?.split(q);
2484
- }
2485
- }
2486
- return this;
2487
- }
2488
- collect(arr, leftfirst) {
2489
- if (this.left === void 0) {
2490
- arr.push(this.face);
2491
- } else if (leftfirst) {
2492
- this.left?.collect(arr, false);
2493
- this.right?.collect(arr, true);
2494
- } else {
2495
- this.right?.collect(arr, false);
2496
- this.left?.collect(arr, true);
2551
+ }
2552
+ for (let i = 0; i < planes.length; i++) {
2553
+ if (i !== p1 && i !== p2 && i !== p3) {
2554
+ const dt = planes[i].b * p.b + planes[i].c * p.c + planes[i].d * p.d;
2555
+ if (planes[i].a > 0 && dt > planes[i].a || planes[i].a < 0 && dt < planes[i].a) {
2556
+ return false;
2557
+ }
2497
2558
  }
2498
- return arr;
2499
2559
  }
2500
- };
2560
+ return p;
2561
+ }
2501
2562
  var Quat = class {
2502
2563
  constructor(a, b, c, d) {
2503
2564
  this.a = a;
@@ -2509,7 +2570,7 @@ var Quat = class {
2509
2570
  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);
2510
2571
  }
2511
2572
  toString() {
2512
- return "Q[" + this.a + "," + this.b + "," + this.c + "," + this.d + "]";
2573
+ return `Q[${this.a},${this.b},${this.c},${this.d}]`;
2513
2574
  }
2514
2575
  dist(q) {
2515
2576
  return Math.hypot(this.a - q.a, this.b - q.b, this.c - q.c, this.d - q.d);
@@ -2594,9 +2655,6 @@ var Quat = class {
2594
2655
  rotateface(face) {
2595
2656
  return face.map((_) => _.rotatepoint(this));
2596
2657
  }
2597
- rotatecubie(cubie) {
2598
- return cubie.map((_) => this.rotateface(_));
2599
- }
2600
2658
  intersect3(p2, p3) {
2601
2659
  const det = this.det3x3(this.b, this.c, this.d, p2.b, p2.c, p2.d, p3.b, p3.c, p3.d);
2602
2660
  if (Math.abs(det) < eps) {
@@ -2790,9 +2848,231 @@ function getface(planes) {
2790
2848
  return face;
2791
2849
  }
2792
2850
 
2851
+ // src/cubing/puzzle-geometry/SchreierSims.ts
2852
+ var FactoredNumber = class {
2853
+ constructor() {
2854
+ this.mult = [];
2855
+ }
2856
+ multiply(n) {
2857
+ for (let f = 2; f * f <= n; f++) {
2858
+ while (n % f === 0) {
2859
+ if (this.mult[f] !== void 0) {
2860
+ this.mult[f]++;
2861
+ } else {
2862
+ this.mult[f] = 1;
2863
+ }
2864
+ n /= f;
2865
+ }
2866
+ }
2867
+ if (n > 1) {
2868
+ if (this.mult[n] !== void 0) {
2869
+ this.mult[n]++;
2870
+ } else {
2871
+ this.mult[n] = 1;
2872
+ }
2873
+ }
2874
+ }
2875
+ toString() {
2876
+ let r = "";
2877
+ for (let i = 0; i < this.mult.length; i++) {
2878
+ if (this.mult[i] !== void 0) {
2879
+ if (r !== "") {
2880
+ r += "*";
2881
+ }
2882
+ r += i;
2883
+ if (this.mult[i] > 1) {
2884
+ r += `^${this.mult[i]}`;
2885
+ }
2886
+ }
2887
+ }
2888
+ return r;
2889
+ }
2890
+ };
2891
+ function schreierSims(g, disp) {
2892
+ const n = g[0].p.length;
2893
+ const e = identity(n);
2894
+ let sgs = [];
2895
+ let sgsi = [];
2896
+ let sgslen = [];
2897
+ let Tk = [];
2898
+ let Tklen = [];
2899
+ function resolve(p) {
2900
+ for (let i = p.p.length - 1; i >= 0; i--) {
2901
+ const j = p.p[i];
2902
+ if (j !== i) {
2903
+ if (!sgs[i][j]) {
2904
+ return false;
2905
+ }
2906
+ p = p.mul(sgsi[i][j]);
2907
+ }
2908
+ }
2909
+ return true;
2910
+ }
2911
+ function knutha(k, p, len) {
2912
+ Tk[k].push(p);
2913
+ Tklen[k].push(len);
2914
+ for (let i = 0; i < sgs[k].length; i++) {
2915
+ if (sgs[k][i]) {
2916
+ knuthb(k, sgs[k][i].mul(p), len + sgslen[k][i]);
2917
+ }
2918
+ }
2919
+ }
2920
+ function knuthb(k, p, len) {
2921
+ const j = p.p[k];
2922
+ if (!sgs[k][j]) {
2923
+ sgs[k][j] = p;
2924
+ sgsi[k][j] = p.inv();
2925
+ sgslen[k][j] = len;
2926
+ for (let i = 0; i < Tk[k].length; i++) {
2927
+ knuthb(k, p.mul(Tk[k][i]), len + Tklen[k][i]);
2928
+ }
2929
+ return;
2930
+ }
2931
+ const p2 = p.mul(sgsi[k][j]);
2932
+ if (!resolve(p2)) {
2933
+ knutha(k - 1, p2, len + sgslen[k][j]);
2934
+ }
2935
+ }
2936
+ function getsgs() {
2937
+ sgs = [];
2938
+ sgsi = [];
2939
+ Tk = [];
2940
+ sgslen = [];
2941
+ Tklen = [];
2942
+ for (let i = 0; i < n; i++) {
2943
+ sgs.push([]);
2944
+ sgsi.push([]);
2945
+ sgslen.push([]);
2946
+ Tk.push([]);
2947
+ Tklen.push([]);
2948
+ sgs[i][i] = e;
2949
+ sgsi[i][i] = e;
2950
+ sgslen[i][i] = 0;
2951
+ }
2952
+ let none = 0;
2953
+ let sz = 1;
2954
+ for (let i = 0; i < g.length; i++) {
2955
+ knutha(n - 1, g[i], 1);
2956
+ sz = 1;
2957
+ let tks = 0;
2958
+ let sollen = 0;
2959
+ const avgs = [];
2960
+ const mults = new FactoredNumber();
2961
+ for (let j = 0; j < n; j++) {
2962
+ let cnt = 0;
2963
+ let lensum = 0;
2964
+ for (let k = 0; k < n; k++) {
2965
+ if (sgs[j][k]) {
2966
+ cnt++;
2967
+ lensum += sgslen[j][k];
2968
+ if (j !== k) {
2969
+ none++;
2970
+ }
2971
+ }
2972
+ }
2973
+ tks += Tk[j].length;
2974
+ sz *= cnt;
2975
+ if (cnt > 1) {
2976
+ mults.multiply(cnt);
2977
+ }
2978
+ const avg = lensum / cnt;
2979
+ avgs.push(avg);
2980
+ sollen += avg;
2981
+ }
2982
+ disp(`${i}: sz ${sz} T ${tks} sol ${sollen} none ${none} mults ${mults.toString()}`);
2983
+ }
2984
+ return sz;
2985
+ }
2986
+ return getsgs();
2987
+ }
2988
+
2793
2989
  // src/cubing/puzzle-geometry/PuzzleGeometry.ts
2794
- var DEFAULT_COLOR_FRACTION = 0.77;
2795
- var NEW_FACE_NAMES = true;
2990
+ function tstart(s) {
2991
+ return s;
2992
+ }
2993
+ function tend(_) {
2994
+ }
2995
+ var Face = class {
2996
+ constructor(q) {
2997
+ this.coords = new Array(q.length * 3);
2998
+ for (let i = 0; i < q.length; i++) {
2999
+ this.coords[3 * i] = q[i].b;
3000
+ this.coords[3 * i + 1] = q[i].c;
3001
+ this.coords[3 * i + 2] = q[i].d;
3002
+ }
3003
+ this.length = q.length;
3004
+ }
3005
+ get(off) {
3006
+ return new Quat(0, this.coords[3 * off], this.coords[3 * off + 1], this.coords[3 * off + 2]);
3007
+ }
3008
+ centermass() {
3009
+ let sx = 0;
3010
+ let sy = 0;
3011
+ let sz = 0;
3012
+ for (let i = 0; i < this.length; i++) {
3013
+ sx += this.coords[3 * i];
3014
+ sy += this.coords[3 * i + 1];
3015
+ sz += this.coords[3 * i + 2];
3016
+ }
3017
+ return new Quat(0, sx / this.length, sy / this.length, sz / this.length);
3018
+ }
3019
+ rotate(q) {
3020
+ const a = [];
3021
+ for (let i = 0; i < this.length; i++) {
3022
+ a.push(this.get(i).rotatepoint(q));
3023
+ }
3024
+ return new Face(a);
3025
+ }
3026
+ rotateforward() {
3027
+ const a = [];
3028
+ for (let i = 1; i < this.length; i++) {
3029
+ a.push(this.get(i));
3030
+ }
3031
+ a.push(this.get(0));
3032
+ return new Face(a);
3033
+ }
3034
+ };
3035
+ var FaceTree = class {
3036
+ constructor(face, left, right) {
3037
+ this.face = face;
3038
+ this.left = left;
3039
+ this.right = right;
3040
+ }
3041
+ split(q) {
3042
+ const t = q.cutface(this.face);
3043
+ if (t !== null) {
3044
+ if (this.left === void 0) {
3045
+ this.left = new FaceTree(t[0]);
3046
+ this.right = new FaceTree(t[1]);
3047
+ } else {
3048
+ this.left = this.left?.split(q);
3049
+ this.right = this.right?.split(q);
3050
+ }
3051
+ }
3052
+ return this;
3053
+ }
3054
+ collect(arr, leftfirst) {
3055
+ if (this.left === void 0) {
3056
+ arr.push(new Face(this.face));
3057
+ } else if (leftfirst) {
3058
+ this.left?.collect(arr, false);
3059
+ this.right?.collect(arr, true);
3060
+ } else {
3061
+ this.right?.collect(arr, false);
3062
+ this.left?.collect(arr, true);
3063
+ }
3064
+ return arr;
3065
+ }
3066
+ };
3067
+ function expandfaces(rots, faces) {
3068
+ const nfaces = [];
3069
+ for (const rot of rots) {
3070
+ for (const face of faces) {
3071
+ nfaces.push(face.rotate(rot));
3072
+ }
3073
+ }
3074
+ return nfaces;
3075
+ }
2796
3076
  var eps3 = 1e-9;
2797
3077
  var copyright = "PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.";
2798
3078
  var permissivieMoveParsing = false;
@@ -2921,11 +3201,26 @@ function defaultfaceorders() {
2921
3201
  }
2922
3202
  function defaultOrientations() {
2923
3203
  return {
2924
- 4: ["FLR", [0, 1, 0], "F", [0, 0, 1]],
2925
- 6: ["U", [0, 1, 0], "F", [0, 0, 1]],
2926
- 8: ["U", [0, 1, 0], "F", [0, 0, 1]],
2927
- 12: ["U", [0, 1, 0], "F", [0, 0, 1]],
2928
- 20: ["GUQMJ", [0, 1, 0], "F", [0, 0, 1]]
3204
+ 4: [
3205
+ ["FLR", [0, 1, 0]],
3206
+ ["F", [0, 0, 1]]
3207
+ ],
3208
+ 6: [
3209
+ ["U", [0, 1, 0]],
3210
+ ["F", [0, 0, 1]]
3211
+ ],
3212
+ 8: [
3213
+ ["U", [0, 1, 0]],
3214
+ ["F", [0, 0, 1]]
3215
+ ],
3216
+ 12: [
3217
+ ["U", [0, 1, 0]],
3218
+ ["F", [0, 0, 1]]
3219
+ ],
3220
+ 20: [
3221
+ ["GUQMJ", [0, 1, 0]],
3222
+ ["F", [0, 0, 1]]
3223
+ ]
2929
3224
  };
2930
3225
  }
2931
3226
  function findelement(a, p) {
@@ -2939,22 +3234,23 @@ function findelement(a, p) {
2939
3234
  function getpuzzles() {
2940
3235
  return PGPuzzles;
2941
3236
  }
2942
- function parsedesc(s) {
3237
+ function parsePuzzleDescription(s) {
2943
3238
  const a = s.split(/ /).filter(Boolean);
2944
3239
  if (a.length % 2 === 0) {
2945
- return false;
3240
+ return null;
2946
3241
  }
2947
- if (a[0] !== "o" && a[0] !== "c" && a[0] !== "i" && a[0] !== "d" && a[0] !== "t") {
2948
- return false;
3242
+ const shape = a[0];
3243
+ if (shape !== "o" && shape !== "c" && shape !== "i" && shape !== "d" && shape !== "t") {
3244
+ return null;
2949
3245
  }
2950
- const r = [];
3246
+ const cuts = [];
2951
3247
  for (let i = 1; i < a.length; i += 2) {
2952
3248
  if (a[i] !== "f" && a[i] !== "v" && a[i] !== "e") {
2953
- return false;
3249
+ return null;
2954
3250
  }
2955
- r.push([a[i], a[i + 1]]);
3251
+ cuts.push({ cutType: a[i], distance: parseFloat(a[i + 1]) });
2956
3252
  }
2957
- return [a[0], r];
3253
+ return { shape, cuts };
2958
3254
  }
2959
3255
  function getmovename(geo, bits, slices) {
2960
3256
  let inverted = false;
@@ -2977,7 +3273,7 @@ function getmovename(geo, bits, slices) {
2977
3273
  movenamePrefix = String(bits[1] + 1);
2978
3274
  }
2979
3275
  } else {
2980
- throw "We only support slice and outer block moves right now. " + bits;
3276
+ throw `We only support slice and outer block moves right now. ${bits}`;
2981
3277
  }
2982
3278
  return [movenamePrefix + movenameFamily, inverted];
2983
3279
  }
@@ -2989,9 +3285,9 @@ function splitByFaceNames(s, facenames) {
2989
3285
  at++;
2990
3286
  }
2991
3287
  let currentMatch = "";
2992
- for (let i = 0; i < facenames.length; i++) {
2993
- if (s.substr(at).startsWith(facenames[i][1]) && facenames[i][1].length > currentMatch.length) {
2994
- currentMatch = facenames[i][1];
3288
+ for (const facename of facenames) {
3289
+ if (s.substr(at).startsWith(facename[1]) && facename[1].length > currentMatch.length) {
3290
+ currentMatch = facename[1];
2995
3291
  }
2996
3292
  }
2997
3293
  if (currentMatch !== "") {
@@ -3010,55 +3306,16 @@ function toFaceCoords(q, maxdist) {
3010
3306
  const r = [];
3011
3307
  const n = q.length;
3012
3308
  for (let i = 0; i < n; i++) {
3013
- r[n - i - 1] = toCoords(q[i], maxdist);
3309
+ const pt = toCoords(q.get(n - i - 1), maxdist);
3310
+ r[3 * i] = pt[0];
3311
+ r[3 * i + 1] = pt[1];
3312
+ r[3 * i + 2] = pt[2];
3014
3313
  }
3015
3314
  return r;
3016
3315
  }
3017
- function trimEdges(face, tr) {
3018
- const r = [];
3019
- for (let iter = 1; iter < 10; iter++) {
3020
- for (let i = 0; i < face.length; i++) {
3021
- const pi = (i + face.length - 1) % face.length;
3022
- const ni = (i + 1) % face.length;
3023
- const A = face[pi].sub(face[i]).normalize();
3024
- const B = face[ni].sub(face[i]).normalize();
3025
- const d = A.dot(B);
3026
- const m = tr / Math.sqrt(1 - d * d);
3027
- r[i] = face[i].sum(A.sum(B).smul(m));
3028
- }
3029
- let good = true;
3030
- for (let i = 0; good && i < r.length; i++) {
3031
- const pi = (i + face.length - 1) % face.length;
3032
- const ni = (i + 1) % face.length;
3033
- if (r[pi].sub(r[i]).cross(r[ni].sub(r[i])).dot(r[i]) >= 0) {
3034
- good = false;
3035
- }
3036
- }
3037
- if (good) {
3038
- return r;
3039
- }
3040
- tr /= 2;
3041
- }
3042
- return face;
3043
- }
3044
3316
  var PuzzleGeometry = class {
3045
- constructor(shape, cuts, optionlist) {
3046
- this.args = "";
3317
+ constructor(puzzleDescription, options) {
3047
3318
  this.cmovesbyslice = [];
3048
- this.verbose = 0;
3049
- this.allmoves = false;
3050
- this.cornersets = true;
3051
- this.centersets = true;
3052
- this.edgesets = true;
3053
- this.omitsets = [];
3054
- this.graycorners = false;
3055
- this.graycenters = false;
3056
- this.grayedges = false;
3057
- this.killorientation = false;
3058
- this.optimize = false;
3059
- this.scramble = 0;
3060
- this.fixPiece = "";
3061
- this.orientCenters = false;
3062
3319
  this.duplicatedFaces = [];
3063
3320
  this.duplicatedCubies = [];
3064
3321
  this.fixedCubie = -1;
@@ -3069,84 +3326,16 @@ var PuzzleGeometry = class {
3069
3326
  this.notationMapper = new NullMapper();
3070
3327
  this.addNotationMapper = "";
3071
3328
  this.setReidOrder = false;
3072
- function asstructured(v) {
3073
- if (typeof v === "string") {
3074
- return JSON.parse(v);
3075
- }
3076
- return v;
3077
- }
3078
- function asboolean(v) {
3079
- if (typeof v === "string") {
3080
- if (v === "false") {
3081
- return false;
3082
- }
3083
- return true;
3084
- } else {
3085
- return v ? true : false;
3086
- }
3087
- }
3088
- if (optionlist !== void 0) {
3089
- if (optionlist.length % 2 !== 0) {
3090
- throw new Error("Odd length in option list?");
3091
- }
3092
- for (let i = 0; i < optionlist.length; i += 2) {
3093
- if (optionlist[i] === "verbose") {
3094
- this.verbose++;
3095
- } else if (optionlist[i] === "quiet") {
3096
- this.verbose = 0;
3097
- } else if (optionlist[i] === "allmoves") {
3098
- this.allmoves = asboolean(optionlist[i + 1]);
3099
- } else if (optionlist[i] === "outerblockmoves") {
3100
- this.outerblockmoves = asboolean(optionlist[i + 1]);
3101
- } else if (optionlist[i] === "vertexmoves") {
3102
- this.vertexmoves = asboolean(optionlist[i + 1]);
3103
- } else if (optionlist[i] === "rotations") {
3104
- this.addrotations = asboolean(optionlist[i + 1]);
3105
- } else if (optionlist[i] === "cornersets") {
3106
- this.cornersets = asboolean(optionlist[i + 1]);
3107
- } else if (optionlist[i] === "centersets") {
3108
- this.centersets = asboolean(optionlist[i + 1]);
3109
- } else if (optionlist[i] === "edgesets") {
3110
- this.edgesets = asboolean(optionlist[i + 1]);
3111
- } else if (optionlist[i] === "omit") {
3112
- this.omitsets = optionlist[i + 1];
3113
- } else if (optionlist[i] === "graycorners") {
3114
- this.graycorners = asboolean(optionlist[i + 1]);
3115
- } else if (optionlist[i] === "graycenters") {
3116
- this.graycenters = asboolean(optionlist[i + 1]);
3117
- } else if (optionlist[i] === "grayedges") {
3118
- this.grayedges = asboolean(optionlist[i + 1]);
3119
- } else if (optionlist[i] === "movelist") {
3120
- this.movelist = asstructured(optionlist[i + 1]);
3121
- } else if (optionlist[i] === "killorientation") {
3122
- this.killorientation = asboolean(optionlist[i + 1]);
3123
- } else if (optionlist[i] === "optimize") {
3124
- this.optimize = asboolean(optionlist[i + 1]);
3125
- } else if (optionlist[i] === "scramble") {
3126
- this.scramble = optionlist[i + 1];
3127
- } else if (optionlist[i] === "fix") {
3128
- this.fixPiece = optionlist[i + 1];
3129
- } else if (optionlist[i] === "orientcenters") {
3130
- this.orientCenters = asboolean(optionlist[i + 1]);
3131
- } else if (optionlist[i] === "puzzleorientation") {
3132
- this.puzzleOrientation = asstructured(optionlist[i + 1]);
3133
- } else if (optionlist[i] === "puzzleorientations") {
3134
- this.puzzleOrientations = asstructured(optionlist[i + 1]);
3135
- } else {
3136
- throw new Error("Bad option while processing option list " + optionlist[i]);
3137
- }
3138
- }
3139
- }
3140
- this.args = shape + " " + cuts.map((_) => _.join(" ")).join(" ");
3141
- if (optionlist) {
3142
- this.args += " " + optionlist.join(" ");
3143
- }
3144
- if (this.verbose > 0) {
3329
+ const t1 = tstart("genperms");
3330
+ this.options = new PuzzleGeometryFullOptions(options);
3331
+ if (this.options.verbosity > 0) {
3145
3332
  console.log(this.header("# "));
3146
3333
  }
3147
- this.create(shape, cuts);
3334
+ this.create(puzzleDescription);
3335
+ tend(t1);
3148
3336
  }
3149
- create(shape, cuts) {
3337
+ create(puzzleDescription) {
3338
+ const { shape, cuts } = puzzleDescription;
3150
3339
  this.moveplanes = [];
3151
3340
  this.moveplanes2 = [];
3152
3341
  this.faces = [];
@@ -3172,47 +3361,47 @@ var PuzzleGeometry = class {
3172
3361
  throw new Error("Bad shape argument: " + shape);
3173
3362
  }
3174
3363
  this.rotations = closure(g);
3175
- if (this.verbose) {
3364
+ if (this.options.verbosity) {
3176
3365
  console.log("# Rotations: " + this.rotations.length);
3177
3366
  }
3178
3367
  const baseplane = g[0];
3179
3368
  this.baseplanerot = uniqueplanes(baseplane, this.rotations);
3180
3369
  const baseplanes = this.baseplanerot.map((_) => baseplane.rotateplane(_));
3181
3370
  this.baseplanes = baseplanes;
3182
- this.basefacecount = baseplanes.length;
3371
+ this.baseFaceCount = baseplanes.length;
3183
3372
  const net = defaultnets()[baseplanes.length];
3184
3373
  this.net = net;
3185
3374
  this.colors = defaultcolors()[baseplanes.length];
3186
3375
  this.faceorder = defaultfaceorders()[baseplanes.length];
3187
- if (this.verbose) {
3376
+ if (this.options.verbosity > 0) {
3188
3377
  console.log("# Base planes: " + baseplanes.length);
3189
3378
  }
3190
3379
  const baseface = getface(baseplanes);
3191
3380
  const zero = new Quat(0, 0, 0, 0);
3192
- if (this.verbose) {
3381
+ if (this.options.verbosity > 0) {
3193
3382
  console.log("# Face vertices: " + baseface.length);
3194
3383
  }
3195
3384
  const facenormal = baseplanes[0].makenormal();
3196
3385
  const edgenormal = baseface[0].sum(baseface[1]).makenormal();
3197
3386
  const vertexnormal = baseface[0].makenormal();
3198
3387
  const boundary = new Quat(1, facenormal.b, facenormal.c, facenormal.d);
3199
- if (this.verbose) {
3388
+ if (this.options.verbosity > 0) {
3200
3389
  console.log("# Boundary is " + boundary);
3201
3390
  }
3202
3391
  const planerot = uniqueplanes(boundary, this.rotations);
3203
3392
  const planes = planerot.map((_) => boundary.rotateplane(_));
3204
- let faces = [getface(planes)];
3205
- this.edgedistance = faces[0][0].sum(faces[0][1]).smul(0.5).dist(zero);
3206
- this.vertexdistance = faces[0][0].dist(zero);
3393
+ const firstface = getface(planes);
3394
+ this.edgedistance = firstface[0].sum(firstface[1]).smul(0.5).dist(zero);
3395
+ this.vertexdistance = firstface[0].dist(zero);
3207
3396
  const cutplanes = [];
3208
3397
  const intersects = [];
3209
3398
  let sawface = false;
3210
3399
  let sawedge = false;
3211
3400
  let sawvertex = false;
3212
- for (let i = 0; i < cuts.length; i++) {
3401
+ for (const cut of cuts) {
3213
3402
  let normal = null;
3214
3403
  let distance = 0;
3215
- switch (cuts[i][0]) {
3404
+ switch (cut.cutType) {
3216
3405
  case "f":
3217
3406
  normal = facenormal;
3218
3407
  distance = 1;
@@ -3229,12 +3418,12 @@ var PuzzleGeometry = class {
3229
3418
  sawedge = true;
3230
3419
  break;
3231
3420
  default:
3232
- throw new Error("Bad cut argument: " + cuts[i][0]);
3421
+ throw new Error("Bad cut argument: " + cut.cutType);
3233
3422
  }
3234
- cutplanes.push(normal.makecut(Number(cuts[i][1])));
3235
- intersects.push(cuts[i][1] < distance);
3423
+ cutplanes.push(normal.makecut(cut.distance));
3424
+ intersects.push(cut.distance < distance);
3236
3425
  }
3237
- if (this.addrotations) {
3426
+ if (this.options.addRotations) {
3238
3427
  if (!sawface) {
3239
3428
  cutplanes.push(facenormal.makecut(10));
3240
3429
  }
@@ -3246,26 +3435,26 @@ var PuzzleGeometry = class {
3246
3435
  }
3247
3436
  }
3248
3437
  this.basefaces = [];
3249
- for (let i = 0; i < this.baseplanerot.length; i++) {
3250
- const face = this.baseplanerot[i].rotateface(faces[0]);
3251
- this.basefaces.push(face);
3438
+ for (const baseplanerot of this.baseplanerot) {
3439
+ const face = baseplanerot.rotateface(firstface);
3440
+ this.basefaces.push(new Face(face));
3252
3441
  }
3253
3442
  const facenames = [];
3254
3443
  const faceplanes = [];
3255
3444
  const vertexnames = [];
3256
3445
  const edgenames = [];
3257
- const edgesperface = faces[0].length;
3446
+ const edgesperface = firstface.length;
3258
3447
  function searchaddelement(a, p, name) {
3259
- for (let i = 0; i < a.length; i++) {
3260
- if (a[i][0].dist(p) < eps3) {
3261
- a[i].push(name);
3448
+ for (const el of a) {
3449
+ if (el[0].dist(p) < eps3) {
3450
+ el.push(name);
3262
3451
  return;
3263
3452
  }
3264
3453
  }
3265
3454
  a.push([p, name]);
3266
3455
  }
3267
3456
  for (let i = 0; i < this.baseplanerot.length; i++) {
3268
- const face = this.baseplanerot[i].rotateface(faces[0]);
3457
+ const face = this.baseplanerot[i].rotateface(firstface);
3269
3458
  for (let j = 0; j < face.length; j++) {
3270
3459
  const jj = (j + 1) % face.length;
3271
3460
  const midpoint = face[j].sum(face[jj]).smul(0.5);
@@ -3274,7 +3463,7 @@ var PuzzleGeometry = class {
3274
3463
  }
3275
3464
  const otherfaces = [];
3276
3465
  for (let i = 0; i < this.baseplanerot.length; i++) {
3277
- const face = this.baseplanerot[i].rotateface(faces[0]);
3466
+ const face = this.baseplanerot[i].rotateface(firstface);
3278
3467
  const facelist = [];
3279
3468
  for (let j = 0; j < face.length; j++) {
3280
3469
  const jj = (j + 1) % face.length;
@@ -3296,8 +3485,8 @@ var PuzzleGeometry = class {
3296
3485
  facenametoindex[net[0][0]] = 0;
3297
3486
  faceindextoname[otherfaces[0][0]] = net[0][1];
3298
3487
  facenametoindex[net[0][1]] = otherfaces[0][0];
3299
- for (let i = 0; i < net.length; i++) {
3300
- const f0 = net[i][0];
3488
+ for (const neti of net) {
3489
+ const f0 = neti[0];
3301
3490
  const fi = facenametoindex[f0];
3302
3491
  if (fi === void 0) {
3303
3492
  throw new Error("Bad edge description; first edge not connected");
@@ -3305,7 +3494,7 @@ var PuzzleGeometry = class {
3305
3494
  let ii = -1;
3306
3495
  for (let j = 0; j < otherfaces[fi].length; j++) {
3307
3496
  const fn2 = faceindextoname[otherfaces[fi][j]];
3308
- if (fn2 !== void 0 && fn2 === net[i][1]) {
3497
+ if (fn2 !== void 0 && fn2 === neti[1]) {
3309
3498
  ii = j;
3310
3499
  break;
3311
3500
  }
@@ -3313,17 +3502,17 @@ var PuzzleGeometry = class {
3313
3502
  if (ii < 0) {
3314
3503
  throw new Error("First element of a net not known");
3315
3504
  }
3316
- for (let j = 2; j < net[i].length; j++) {
3317
- if (net[i][j] === "") {
3505
+ for (let j = 2; j < neti.length; j++) {
3506
+ if (neti[j] === "") {
3318
3507
  continue;
3319
3508
  }
3320
3509
  const of = otherfaces[fi][(j + ii - 1) % edgesperface];
3321
3510
  const fn2 = faceindextoname[of];
3322
- if (fn2 !== void 0 && fn2 !== net[i][j]) {
3511
+ if (fn2 !== void 0 && fn2 !== neti[j]) {
3323
3512
  throw new Error("Face mismatch in net");
3324
3513
  }
3325
- faceindextoname[of] = net[i][j];
3326
- facenametoindex[net[i][j]] = of;
3514
+ faceindextoname[of] = neti[j];
3515
+ facenametoindex[neti[j]] = of;
3327
3516
  }
3328
3517
  }
3329
3518
  for (let i = 0; i < faceindextoname.length; i++) {
@@ -3340,14 +3529,14 @@ var PuzzleGeometry = class {
3340
3529
  }
3341
3530
  }
3342
3531
  for (let i = 0; i < this.baseplanerot.length; i++) {
3343
- const face = this.baseplanerot[i].rotateface(faces[0]);
3532
+ const face = this.baseplanerot[i].rotateface(firstface);
3344
3533
  const faceplane = boundary.rotateplane(this.baseplanerot[i]);
3345
3534
  const facename = faceindextoname[i];
3346
3535
  facenames.push([face, facename]);
3347
3536
  faceplanes.push([faceplane, facename]);
3348
3537
  }
3349
3538
  for (let i = 0; i < this.baseplanerot.length; i++) {
3350
- const face = this.baseplanerot[i].rotateface(faces[0]);
3539
+ const face = this.baseplanerot[i].rotateface(firstface);
3351
3540
  const facename = faceindextoname[i];
3352
3541
  for (let j = 0; j < face.length; j++) {
3353
3542
  const jj = (j + 1) % face.length;
@@ -3374,7 +3563,6 @@ var PuzzleGeometry = class {
3374
3563
  }
3375
3564
  edgenames[i] = [edgenames[i][0], c1];
3376
3565
  }
3377
- this.cornerfaces = vertexnames[0].length - 1;
3378
3566
  for (let i = 0; i < vertexnames.length; i++) {
3379
3567
  if (vertexnames[i].length < 4) {
3380
3568
  throw new Error("Bad length in vertex names");
@@ -3401,21 +3589,21 @@ var PuzzleGeometry = class {
3401
3589
  }
3402
3590
  vertexnames[i] = [vertexnames[i][0], r];
3403
3591
  }
3404
- if (this.verbose > 1) {
3592
+ if (this.options.verbosity > 1) {
3405
3593
  console.log("# Face precedence list: " + this.faceorder.join(" "));
3406
3594
  console.log("# Face names: " + facenames.map((_) => _[1]).join(" "));
3407
3595
  console.log("# Edge names: " + edgenames.map((_) => _[1]).join(" "));
3408
3596
  console.log("# Vertex names: " + vertexnames.map((_) => _[1]).join(" "));
3409
3597
  }
3410
3598
  const geonormals = [];
3411
- for (let i = 0; i < faceplanes.length; i++) {
3412
- geonormals.push([faceplanes[i][0].makenormal(), faceplanes[i][1], "f"]);
3599
+ for (const faceplane of faceplanes) {
3600
+ geonormals.push([faceplane[0].makenormal(), faceplane[1], "f"]);
3413
3601
  }
3414
- for (let i = 0; i < edgenames.length; i++) {
3415
- geonormals.push([edgenames[i][0].makenormal(), edgenames[i][1], "e"]);
3602
+ for (const edgename of edgenames) {
3603
+ geonormals.push([edgename[0].makenormal(), edgename[1], "e"]);
3416
3604
  }
3417
- for (let i = 0; i < vertexnames.length; i++) {
3418
- geonormals.push([vertexnames[i][0].makenormal(), vertexnames[i][1], "v"]);
3605
+ for (const vertexname of vertexnames) {
3606
+ geonormals.push([vertexname[0].makenormal(), vertexname[1], "v"]);
3419
3607
  }
3420
3608
  this.facenames = facenames;
3421
3609
  this.faceplanes = faceplanes;
@@ -3424,15 +3612,15 @@ var PuzzleGeometry = class {
3424
3612
  this.geonormals = geonormals;
3425
3613
  const geonormalnames = geonormals.map((_) => _[1]);
3426
3614
  this.swizzler.setGripNames(geonormalnames);
3427
- if (this.verbose) {
3615
+ if (this.options.verbosity > 0) {
3428
3616
  console.log("# Distances: face " + 1 + " edge " + this.edgedistance + " vertex " + this.vertexdistance);
3429
3617
  }
3430
3618
  for (let c = 0; c < cutplanes.length; c++) {
3431
- for (let i = 0; i < this.rotations.length; i++) {
3432
- const q = cutplanes[c].rotateplane(this.rotations[i]);
3619
+ for (const rotation of this.rotations) {
3620
+ const q = cutplanes[c].rotateplane(rotation);
3433
3621
  let wasseen = false;
3434
- for (let j = 0; j < this.moveplanes.length; j++) {
3435
- if (q.sameplane(this.moveplanes[j])) {
3622
+ for (const moveplane of this.moveplanes) {
3623
+ if (q.sameplane(moveplane)) {
3436
3624
  wasseen = true;
3437
3625
  break;
3438
3626
  }
@@ -3445,7 +3633,7 @@ var PuzzleGeometry = class {
3445
3633
  }
3446
3634
  }
3447
3635
  }
3448
- let ft = new FaceTree(faces[0]);
3636
+ let ft = new FaceTree(firstface);
3449
3637
  const tar = this.moveplanes2.slice();
3450
3638
  let rval = 31;
3451
3639
  for (let i = 0; i < tar.length; i++) {
@@ -3454,25 +3642,60 @@ var PuzzleGeometry = class {
3454
3642
  tar[j] = tar[i];
3455
3643
  rval = (rval * 1657 + 101) % 65536;
3456
3644
  }
3457
- faces = ft.collect([], true);
3645
+ const faces = ft.collect([], true);
3458
3646
  this.faces = faces;
3459
- if (this.verbose) {
3647
+ if (this.options.verbosity > 0) {
3460
3648
  console.log("# Faces is now " + faces.length);
3461
3649
  }
3462
3650
  this.stickersperface = faces.length;
3463
- let shortedge = 1e99;
3651
+ const simplerot = [];
3652
+ const cm = centermassface(firstface);
3653
+ for (const rotation of this.rotations) {
3654
+ const f = rotation.rotateface(firstface);
3655
+ if (cm.dist(centermassface(f)) < eps3) {
3656
+ simplerot.push(rotation);
3657
+ }
3658
+ }
3659
+ const finished = new Array(faces.length);
3660
+ const sortme = [];
3464
3661
  for (let i = 0; i < faces.length; i++) {
3465
- for (let j = 0; j < faces[i].length; j++) {
3466
- const k = (j + 1) % faces[i].length;
3467
- const t = faces[i][j].dist(faces[i][k]);
3468
- if (t < shortedge) {
3469
- shortedge = t;
3662
+ const cm2 = faces[i].centermass();
3663
+ sortme.push([cm.dist(cm2), cm2, i]);
3664
+ }
3665
+ sortme.sort((a, b) => a[0] - b[0]);
3666
+ for (let ii = 0; ii < faces.length; ii++) {
3667
+ const i = sortme[ii][2];
3668
+ if (!finished[i]) {
3669
+ finished[i] = true;
3670
+ for (const rot of simplerot) {
3671
+ const f2 = faces[i].rotate(rot);
3672
+ const cm2 = f2.centermass();
3673
+ for (let kk = ii + 1; kk < faces.length; kk++) {
3674
+ if (sortme[kk][0] - sortme[ii][0] > eps3) {
3675
+ break;
3676
+ }
3677
+ const k = sortme[kk][2];
3678
+ if (!finished[k] && cm2.dist(sortme[kk][1]) < eps3) {
3679
+ finished[k] = true;
3680
+ faces[k] = f2;
3681
+ break;
3682
+ }
3683
+ }
3470
3684
  }
3471
3685
  }
3472
3686
  }
3473
- this.shortedge = shortedge;
3474
- if (this.verbose) {
3475
- console.log("# Short edge is " + shortedge);
3687
+ this.shortedge = 1e99;
3688
+ for (const face of faces) {
3689
+ for (let j = 0; j < face.length; j++) {
3690
+ const k = (j + 1) % face.length;
3691
+ const t = face.get(j).dist(face.get(k));
3692
+ if (t < this.shortedge) {
3693
+ this.shortedge = t;
3694
+ }
3695
+ }
3696
+ }
3697
+ if (this.options.verbosity > 0) {
3698
+ console.log("# Short edge is " + this.shortedge);
3476
3699
  }
3477
3700
  if (shape === "c" && sawface && !sawedge && !sawvertex) {
3478
3701
  this.addNotationMapper = "NxNxNCubeMapper";
@@ -3484,13 +3707,13 @@ var PuzzleGeometry = class {
3484
3707
  if (shape === "t" && (sawvertex || sawface) && !sawedge) {
3485
3708
  this.addNotationMapper = "PyraminxOrTetraminxMapper";
3486
3709
  }
3487
- if (shape === "o" && sawface && NEW_FACE_NAMES) {
3710
+ if (shape === "o" && sawface) {
3488
3711
  this.notationMapper = new FaceRenamingMapper(this.swizzler, new FaceNameSwizzler(["F", "D", "L", "BL", "R", "U", "BR", "B"]));
3489
3712
  if (!sawedge && !sawvertex) {
3490
3713
  this.addNotationMapper = "FTOMapper";
3491
3714
  }
3492
3715
  }
3493
- if (shape === "d" && sawface && NEW_FACE_NAMES) {
3716
+ if (shape === "d" && sawface) {
3494
3717
  this.addNotationMapper = "MegaminxMapper";
3495
3718
  this.notationMapper = new FaceRenamingMapper(this.swizzler, new FaceNameSwizzler([
3496
3719
  "U",
@@ -3509,55 +3732,66 @@ var PuzzleGeometry = class {
3509
3732
  }
3510
3733
  }
3511
3734
  keyface(face) {
3512
- return this.keyface2(centermassface(face));
3735
+ return this.keyface2(face.centermass());
3513
3736
  }
3514
3737
  keyface2(cm) {
3515
3738
  let s = "";
3516
- for (let i = 0; i < this.moveplanesets.length; i++) {
3517
- if (this.moveplanesets[i].length > 0) {
3518
- const dv = cm.dot(this.moveplanesets[i][0]);
3739
+ const sfcc = String.fromCharCode;
3740
+ for (const moveplaneset of this.moveplanesets) {
3741
+ if (moveplaneset.length > 0) {
3742
+ const dv = cm.dot(moveplaneset[0]);
3519
3743
  let t = 0;
3520
3744
  let b = 1;
3521
- while (b * 2 <= this.moveplanesets[i].length) {
3745
+ while (b * 2 <= moveplaneset.length) {
3522
3746
  b *= 2;
3523
3747
  }
3524
3748
  for (; b > 0; b >>= 1) {
3525
- if (t + b <= this.moveplanesets[i].length && dv > this.moveplanesets[i][t + b - 1].a) {
3749
+ if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
3526
3750
  t += b;
3527
3751
  }
3528
3752
  }
3529
- if (t <= 90) {
3530
- s = s + String.fromCharCode(34 + t);
3753
+ if (t < 47) {
3754
+ s = s + sfcc(33 + t);
3755
+ } else if (t < 47 + 47 * 47) {
3756
+ s = s + sfcc(33 + 47 + Math.floor(t / 47) - 1) + sfcc(33 + t % 47);
3757
+ } else if (t < 47 + 47 * 47 + 47 * 47 * 47) {
3758
+ 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);
3531
3759
  } else {
3532
- s = s + "!" + String.fromCharCode(34 + Math.floor(t / 90)) + String.fromCharCode(34 + t % 90);
3760
+ throw Error("Too many slices for cubie encoding");
3533
3761
  }
3534
3762
  }
3535
3763
  }
3536
3764
  return s;
3537
3765
  }
3538
- findface(face) {
3539
- const cm = centermassface(face);
3540
- const key = this.keyface2(cm);
3541
- const arr = this.facelisthash[key];
3542
- if (arr.length === 1) {
3543
- return arr[0];
3544
- }
3545
- for (let i = 0; i + 1 < arr.length; i++) {
3546
- const face2 = this.facelisthash[key][i];
3547
- if (Math.abs(cm.dist(this.facecentermass[face2])) < eps3) {
3548
- return face2;
3766
+ keyface3(face) {
3767
+ const cm = face.centermass();
3768
+ const r = [];
3769
+ for (const moveplaneset of this.moveplanesets) {
3770
+ if (moveplaneset.length > 0) {
3771
+ const dv = cm.dot(moveplaneset[0]);
3772
+ let t = 0;
3773
+ let b = 1;
3774
+ while (b * 2 <= moveplaneset.length) {
3775
+ b *= 2;
3776
+ }
3777
+ for (; b > 0; b >>= 1) {
3778
+ if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
3779
+ t += b;
3780
+ }
3781
+ }
3782
+ r.push(t);
3549
3783
  }
3550
3784
  }
3551
- return arr[arr.length - 1];
3785
+ return r;
3552
3786
  }
3553
- findface2(cm) {
3787
+ findface(cm) {
3554
3788
  const key = this.keyface2(cm);
3555
- const arr = this.facelisthash[key];
3789
+ const arr = this.facelisthash.get(key);
3556
3790
  if (arr.length === 1) {
3557
3791
  return arr[0];
3558
3792
  }
3559
3793
  for (let i = 0; i + 1 < arr.length; i++) {
3560
- const face2 = this.facelisthash[key][i];
3794
+ const face2 = this.facelisthash.get(key)[i];
3561
3795
  if (Math.abs(cm.dist(this.facecentermass[face2])) < eps3) {
3562
3796
  return face2;
3563
3797
  }
@@ -3583,22 +3817,22 @@ var PuzzleGeometry = class {
3583
3817
  return [x1, y1, off];
3584
3818
  }
3585
3819
  allstickers() {
3820
+ const t1 = tstart("allstickers");
3586
3821
  this.faces = expandfaces(this.baseplanerot, this.faces);
3587
- if (this.verbose) {
3822
+ if (this.options.verbosity > 0) {
3588
3823
  console.log("# Total stickers is now " + this.faces.length);
3589
3824
  }
3590
3825
  this.facecentermass = new Array(this.faces.length);
3591
3826
  for (let i = 0; i < this.faces.length; i++) {
3592
- this.facecentermass[i] = centermassface(this.faces[i]);
3827
+ this.facecentermass[i] = this.faces[i].centermass();
3593
3828
  }
3594
3829
  const moveplanesets = [];
3595
3830
  const moveplanenormals = [];
3596
- for (let i = 0; i < this.moveplanes.length; i++) {
3597
- const q = this.moveplanes[i];
3831
+ for (const q of this.moveplanes) {
3598
3832
  const qnormal = q.makenormal();
3599
3833
  let wasseen = false;
3600
- for (let j = 0; j < moveplanenormals.length; j++) {
3601
- if (qnormal.sameplane(moveplanenormals[j].makenormal())) {
3834
+ for (const moveplanenormal of moveplanenormals) {
3835
+ if (qnormal.sameplane(moveplanenormal.makenormal())) {
3602
3836
  wasseen = true;
3603
3837
  }
3604
3838
  }
@@ -3607,8 +3841,7 @@ var PuzzleGeometry = class {
3607
3841
  moveplanesets.push([]);
3608
3842
  }
3609
3843
  }
3610
- for (let i = 0; i < this.moveplanes2.length; i++) {
3611
- const q = this.moveplanes2[i];
3844
+ for (const q of this.moveplanes2) {
3612
3845
  const qnormal = q.makenormal();
3613
3846
  for (let j = 0; j < moveplanenormals.length; j++) {
3614
3847
  if (qnormal.sameplane(moveplanenormals[j])) {
@@ -3631,15 +3864,14 @@ var PuzzleGeometry = class {
3631
3864
  this.moveplanesets = moveplanesets;
3632
3865
  this.moveplanenormals = moveplanenormals;
3633
3866
  const sizes = moveplanesets.map((_) => _.length);
3634
- if (this.verbose) {
3867
+ if (this.options.verbosity > 0) {
3635
3868
  console.log("# Move plane sets: " + sizes);
3636
3869
  }
3637
3870
  const moverotations = [];
3638
3871
  for (let i = 0; i < moveplanesets.length; i++) {
3639
3872
  moverotations.push([]);
3640
3873
  }
3641
- for (let i = 0; i < this.rotations.length; i++) {
3642
- const q = this.rotations[i];
3874
+ for (const q of this.rotations) {
3643
3875
  if (Math.abs(Math.abs(q.a) - 1) < eps3) {
3644
3876
  continue;
3645
3877
  }
@@ -3673,14 +3905,14 @@ var PuzzleGeometry = class {
3673
3905
  const p0 = moveplanenormals[i];
3674
3906
  let neg = null;
3675
3907
  let pos = null;
3676
- for (let j = 0; j < this.geonormals.length; j++) {
3677
- const d = p0.dot(this.geonormals[j][0]);
3908
+ for (const geonormal of this.geonormals) {
3909
+ const d = p0.dot(geonormal[0]);
3678
3910
  if (Math.abs(d - 1) < eps3) {
3679
- pos = [this.geonormals[j][1], this.geonormals[j][2]];
3680
- gtype = this.geonormals[j][2];
3911
+ pos = [geonormal[1], geonormal[2]];
3912
+ gtype = geonormal[2];
3681
3913
  } else if (Math.abs(d + 1) < eps3) {
3682
- neg = [this.geonormals[j][1], this.geonormals[j][2]];
3683
- gtype = this.geonormals[j][2];
3914
+ neg = [geonormal[1], geonormal[2]];
3915
+ gtype = geonormal[2];
3684
3916
  }
3685
3917
  }
3686
3918
  if (pos === null || neg === null) {
@@ -3724,112 +3956,88 @@ var PuzzleGeometry = class {
3724
3956
  }
3725
3957
  }
3726
3958
  this.movesetgeos = movesetgeos;
3727
- const cubiehash = {};
3728
- const facelisthash = {};
3729
- const cubiekey = {};
3730
- const cubiekeys = [];
3731
- const cubies = [];
3959
+ const facelisthash = new Map();
3732
3960
  const faces = this.faces;
3733
3961
  for (let i = 0; i < faces.length; i++) {
3734
3962
  const face = faces[i];
3735
3963
  const s = this.keyface(face);
3736
- if (!cubiehash[s]) {
3737
- cubiekey[s] = cubies.length;
3738
- cubiekeys.push(s);
3739
- cubiehash[s] = [];
3740
- facelisthash[s] = [];
3741
- cubies.push(cubiehash[s]);
3742
- }
3743
- facelisthash[s].push(i);
3744
- cubiehash[s].push(face);
3745
- if (facelisthash[s].length === this.basefacecount) {
3746
- if (this.verbose) {
3747
- console.log("# Splitting core.");
3748
- }
3749
- for (let suff = 0; suff < this.basefacecount; suff++) {
3750
- const s2 = s + " " + suff;
3751
- facelisthash[s2] = [facelisthash[s][suff]];
3752
- cubiehash[s2] = [cubiehash[s][suff]];
3753
- cubiekeys.push(s2);
3754
- cubiekey[s2] = cubies.length;
3755
- cubies.push(cubiehash[s2]);
3964
+ if (!facelisthash.get(s)) {
3965
+ facelisthash.set(s, [i]);
3966
+ } else {
3967
+ const arr = facelisthash.get(s);
3968
+ arr.push(i);
3969
+ if (arr.length === this.baseFaceCount) {
3970
+ if (this.options.verbosity > 0) {
3971
+ console.log("# Splitting core.");
3972
+ }
3973
+ for (let suff = 0; suff < arr.length; suff++) {
3974
+ const s2 = s + " " + suff;
3975
+ facelisthash.set(s2, [arr[suff]]);
3976
+ }
3756
3977
  }
3757
- cubiehash[s] = [];
3758
- cubies[cubiekey[s]] = [];
3759
3978
  }
3760
3979
  }
3761
- this.cubiekey = cubiekey;
3762
3980
  this.facelisthash = facelisthash;
3763
- this.cubiekeys = cubiekeys;
3764
- if (this.verbose) {
3765
- console.log("# Cubies: " + Object.keys(cubiehash).length);
3981
+ if (this.options.verbosity > 0) {
3982
+ console.log("# Cubies: " + facelisthash.size);
3766
3983
  }
3767
- this.cubies = cubies;
3768
- for (let k = 0; k < cubies.length; k++) {
3769
- const cubie = cubies[k];
3770
- if (cubie.length < 2) {
3771
- continue;
3772
- }
3773
- if (cubie.length === this.basefacecount) {
3984
+ const cubies = [];
3985
+ const facetocubie = [];
3986
+ const facetoord = [];
3987
+ for (const facelist of facelisthash.values()) {
3988
+ if (facelist.length === this.baseFaceCount) {
3774
3989
  continue;
3775
3990
  }
3776
- if (cubie.length > 5) {
3777
- throw new Error("Bad math; too many faces on this cubie " + cubie.length);
3778
- }
3779
- const cm = cubie.map((_) => centermassface(_));
3780
- const s = this.keyface2(cm[0]);
3781
- const facelist = facelisthash[s];
3782
- const cmall = centermassface(cm);
3783
- for (let looplimit = 0; cubie.length > 2; looplimit++) {
3784
- let changed = false;
3785
- for (let i = 0; i < cubie.length; i++) {
3786
- const j = (i + 1) % cubie.length;
3787
- if (cmall.dot(cm[i].cross(cm[j])) < 0) {
3788
- const t = cubie[i];
3789
- cubie[i] = cubie[j];
3790
- cubie[j] = t;
3791
- const u = cm[i];
3792
- cm[i] = cm[j];
3793
- cm[j] = u;
3794
- const v = facelist[i];
3795
- facelist[i] = facelist[j];
3796
- facelist[j] = v;
3797
- changed = true;
3991
+ if (facelist.length > 1) {
3992
+ const cm = facelist.map((_) => faces[_].centermass());
3993
+ const cmall = centermassface(cm);
3994
+ for (let looplimit = 0; facelist.length > 2; looplimit++) {
3995
+ let changed = false;
3996
+ for (let i = 0; i < facelist.length; i++) {
3997
+ const j = (i + 1) % facelist.length;
3998
+ if (cmall.dot(cm[i].cross(cm[j])) < 0) {
3999
+ const u = cm[i];
4000
+ cm[i] = cm[j];
4001
+ cm[j] = u;
4002
+ const v = facelist[i];
4003
+ facelist[i] = facelist[j];
4004
+ facelist[j] = v;
4005
+ changed = true;
4006
+ }
4007
+ }
4008
+ if (!changed) {
4009
+ break;
4010
+ }
4011
+ if (looplimit > 1e3) {
4012
+ throw new Error("Bad epsilon math; too close to border");
3798
4013
  }
3799
4014
  }
3800
- if (!changed) {
3801
- break;
3802
- }
3803
- if (looplimit > 1e3) {
3804
- throw new Error("Bad epsilon math; too close to border");
3805
- }
3806
- }
3807
- let mini = 0;
3808
- let minf = this.findface(cubie[mini]);
3809
- for (let i = 1; i < cubie.length; i++) {
3810
- const temp = this.findface(cubie[i]);
3811
- if (this.faceprecedence[this.getfaceindex(temp)] < this.faceprecedence[this.getfaceindex(minf)]) {
3812
- mini = i;
3813
- minf = temp;
4015
+ let mini = 0;
4016
+ let minf = facelist[mini];
4017
+ for (let i = 1; i < facelist.length; i++) {
4018
+ const temp = facelist[i];
4019
+ if (this.faceprecedence[this.getfaceindex(temp)] < this.faceprecedence[this.getfaceindex(minf)]) {
4020
+ mini = i;
4021
+ minf = temp;
4022
+ }
3814
4023
  }
3815
- }
3816
- if (mini !== 0) {
3817
- const ocubie = cubie.slice();
3818
- const ofacelist = facelist.slice();
3819
- for (let i = 0; i < cubie.length; i++) {
3820
- cubie[i] = ocubie[(mini + i) % cubie.length];
3821
- facelist[i] = ofacelist[(mini + i) % cubie.length];
4024
+ if (mini !== 0) {
4025
+ const ofacelist = facelist.slice();
4026
+ for (let i = 0; i < facelist.length; i++) {
4027
+ facelist[i] = ofacelist[(mini + i) % facelist.length];
4028
+ }
3822
4029
  }
3823
4030
  }
3824
- }
3825
- const facetocubies = [];
3826
- for (let i = 0; i < cubies.length; i++) {
3827
- const facelist = facelisthash[cubiekeys[i]];
3828
4031
  for (let j = 0; j < facelist.length; j++) {
3829
- facetocubies[facelist[j]] = [i, j];
4032
+ const k = facelist[j];
4033
+ facetocubie[k] = cubies.length;
4034
+ facetoord[k] = j;
3830
4035
  }
4036
+ cubies.push(facelist);
3831
4037
  }
3832
- this.facetocubies = facetocubies;
4038
+ this.cubies = cubies;
4039
+ this.facetocubie = facetocubie;
4040
+ this.facetoord = facetoord;
3833
4041
  const typenames = ["?", "CENTERS", "EDGES", "CORNERS", "C4RNER", "C5RNER"];
3834
4042
  const cubiesetnames = [];
3835
4043
  const cubietypecounts = [0, 0, 0, 0, 0, 0];
@@ -3841,7 +4049,7 @@ var PuzzleGeometry = class {
3841
4049
  const cubieords = [];
3842
4050
  const cubievaluemap = [];
3843
4051
  const getcolorkey = (cubienum) => {
3844
- return cubies[cubienum].map((_) => this.getfaceindex(this.findface(_))).join(" ");
4052
+ return cubies[cubienum].map((_) => this.getfaceindex(_)).join(" ");
3845
4053
  };
3846
4054
  const cubiesetcubies = [];
3847
4055
  for (let i = 0; i < cubies.length; i++) {
@@ -3859,7 +4067,7 @@ var PuzzleGeometry = class {
3859
4067
  const facecnt = cubie.length;
3860
4068
  const typectr = cubietypecounts[facecnt]++;
3861
4069
  let typename = typenames[facecnt];
3862
- if (typename === void 0 || facecnt === this.basefacecount) {
4070
+ if (typename === void 0 || facecnt === this.baseFaceCount) {
3863
4071
  typename = "CORE";
3864
4072
  }
3865
4073
  typename = typename + (typectr === 0 ? "" : typectr + 1);
@@ -3879,9 +4087,9 @@ var PuzzleGeometry = class {
3879
4087
  cubiesetcubies[cubiesetnum].push(cind);
3880
4088
  cubieordnums[cind] = cubieords[cubiesetnum]++;
3881
4089
  if (queue.length < this.rotations.length) {
3882
- const cm = centermassface(cubies[cind][0]);
3883
- for (let j = 0; j < moverotations.length; j++) {
3884
- const tq = this.facetocubies[this.findface2(cm.rotatepoint(moverotations[j][0]))][0];
4090
+ const cm = this.facecentermass[cubies[cind][0]];
4091
+ for (const moverotation of moverotations) {
4092
+ const tq = this.facetocubie[this.findface(cm.rotatepoint(moverotation[0]))];
3885
4093
  if (!seen[tq]) {
3886
4094
  queue.push(tq);
3887
4095
  seen[tq] = true;
@@ -3889,21 +4097,6 @@ var PuzzleGeometry = class {
3889
4097
  }
3890
4098
  }
3891
4099
  }
3892
- const that = this;
3893
- queue.sort(function(a, b) {
3894
- if (that.cubiekeys[a] < that.cubiekeys[b]) {
3895
- return 1;
3896
- } else if (that.cubiekeys[a] > that.cubiekeys[b]) {
3897
- return -1;
3898
- } else {
3899
- return 0;
3900
- }
3901
- });
3902
- for (let i2 = 0; i2 < queue.length; i2++) {
3903
- if (i2 > 1e6) {
3904
- cubieordnums[queue[i2]] = i2;
3905
- }
3906
- }
3907
4100
  cubiesetnum++;
3908
4101
  }
3909
4102
  if (this.setReidOrder && 4 <= this.stickersperface && this.stickersperface <= 9) {
@@ -3926,27 +4119,25 @@ var PuzzleGeometry = class {
3926
4119
  ["U", "L", "F", "R", "B", "D"]
3927
4120
  ];
3928
4121
  const reidmap = {};
3929
- for (let i = 0; i < reidorder.length; i++) {
3930
- for (let j = 0; j < reidorder[i].length; j++) {
4122
+ for (const cubie of reidorder) {
4123
+ for (let j = 0; j < cubie.length; j++) {
3931
4124
  let mask = 0;
3932
- for (let k = 0; k < reidorder[i][j].length; k++) {
3933
- mask |= 1 << reidorder[i][j].charCodeAt(k) - 65;
4125
+ for (let k = 0; k < cubie[j].length; k++) {
4126
+ mask |= 1 << cubie[j].charCodeAt(k) - 65;
3934
4127
  }
3935
4128
  reidmap[mask] = j;
3936
4129
  }
3937
4130
  }
3938
- for (let i = 0; i < cubiesetnum; i++) {
3939
- for (let j = 0; j < cubiesetcubies[i].length; j++) {
3940
- const cubienum = cubiesetcubies[i][j];
4131
+ for (const cubieset of cubiesetcubies) {
4132
+ for (const cubienum of cubieset) {
3941
4133
  let mask = 0;
3942
- for (let k = 0; k < cubies[cubienum].length; k++) {
3943
- mask |= 1 << this.facenames[this.getfaceindex(this.findface(cubies[cubienum][k]))][1].charCodeAt(0) - 65;
4134
+ for (const cubie of cubies[cubienum]) {
4135
+ mask |= 1 << this.facenames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65;
3944
4136
  }
3945
4137
  cubieordnums[cubienum] = reidmap[mask];
3946
4138
  }
3947
4139
  }
3948
4140
  }
3949
- this.orbits = cubieords.length;
3950
4141
  this.cubiesetnums = cubiesetnums;
3951
4142
  this.cubieordnums = cubieordnums;
3952
4143
  this.cubiesetnames = cubiesetnames;
@@ -3954,20 +4145,21 @@ var PuzzleGeometry = class {
3954
4145
  this.orbitoris = orbitoris;
3955
4146
  this.cubievaluemap = cubievaluemap;
3956
4147
  this.cubiesetcubies = cubiesetcubies;
3957
- if (this.fixPiece !== "") {
4148
+ if (this.options.fixedPieceType !== null) {
3958
4149
  for (let i = 0; i < cubies.length; i++) {
3959
- if (this.fixPiece === "v" && cubies[i].length > 2 || this.fixPiece === "e" && cubies[i].length === 2 || this.fixPiece === "f" && cubies[i].length === 1) {
4150
+ 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) {
3960
4151
  this.fixedCubie = i;
3961
4152
  break;
3962
4153
  }
3963
4154
  }
3964
4155
  if (this.fixedCubie < 0) {
3965
- throw new Error("Could not find a cubie of type " + this.fixPiece + " to fix.");
4156
+ throw new Error("Could not find a cubie of type " + this.options.fixedPieceType + " to fix.");
3966
4157
  }
3967
4158
  }
3968
- if (this.verbose) {
4159
+ if (this.options.verbosity > 0) {
3969
4160
  console.log("# Cubie orbit sizes " + cubieords);
3970
4161
  }
4162
+ tend(t1);
3971
4163
  }
3972
4164
  unswizzle(mv) {
3973
4165
  const newmv = this.notationMapper.notationToInternal(mv);
@@ -4075,8 +4267,7 @@ var PuzzleGeometry = class {
4075
4267
  if (!permissivieMoveParsing && loslice === 0 && hislice === this.moveplanesets[msi].length && !fullrotation) {
4076
4268
  throw new Error("! full puzzle rotations must be specified with v suffix.");
4077
4269
  }
4078
- const r = [void 0, msi, loslice, hislice, firstgrip, move.amount];
4079
- return r;
4270
+ return [void 0, msi, loslice, hislice, firstgrip, move.amount];
4080
4271
  }
4081
4272
  parsemove(mv) {
4082
4273
  const r = this.parseMove(this.stringToBlockMove(mv));
@@ -4084,19 +4275,20 @@ var PuzzleGeometry = class {
4084
4275
  return r;
4085
4276
  }
4086
4277
  genperms() {
4278
+ const t1 = tstart("genperms");
4087
4279
  if (this.cmovesbyslice.length > 0) {
4088
4280
  return;
4089
4281
  }
4090
4282
  const cmovesbyslice = [];
4091
- if (this.orientCenters) {
4283
+ if (this.options.orientCenters) {
4092
4284
  for (let k = 0; k < this.cubies.length; k++) {
4093
4285
  if (this.cubies[k].length === 1) {
4094
- const kk = this.findface(this.cubies[k][0]);
4286
+ const kk = this.cubies[k][0];
4095
4287
  const i = this.getfaceindex(kk);
4096
- if (centermassface(this.basefaces[i]).dist(this.facecentermass[kk]) < eps3) {
4288
+ if (this.basefaces[i].centermass().dist(this.facecentermass[kk]) < eps3) {
4097
4289
  const o = this.basefaces[i].length;
4098
- for (let m = 0; m < o; m++) {
4099
- this.cubies[k].push(this.cubies[k][0]);
4290
+ for (let m = 1; m < o; m++) {
4291
+ this.cubies[k].push(this.cubies[k][m - 1]);
4100
4292
  }
4101
4293
  this.duplicatedFaces[kk] = o;
4102
4294
  this.duplicatedCubies[k] = o;
@@ -4139,7 +4331,7 @@ var PuzzleGeometry = class {
4139
4331
  if (slicenum[i] < 0) {
4140
4332
  continue;
4141
4333
  }
4142
- const b = this.facetocubies[i].slice();
4334
+ const b = [this.facetocubie[i], this.facetoord[i]];
4143
4335
  let cm = this.facecentermass[i];
4144
4336
  const ocm = cm;
4145
4337
  let fi2 = i;
@@ -4150,19 +4342,18 @@ var PuzzleGeometry = class {
4150
4342
  if (cm2.dist(ocm) < eps3) {
4151
4343
  break;
4152
4344
  }
4153
- fi2 = this.findface2(cm2);
4154
- const c = this.facetocubies[fi2];
4155
- b.push(c[0], c[1]);
4345
+ fi2 = this.findface(cm2);
4346
+ b.push(this.facetocubie[fi2], this.facetoord[fi2]);
4156
4347
  cm = cm2;
4157
4348
  }
4158
- if (b.length > 2 && this.orientCenters && (this.cubies[b[0]].length === 1 || this.cubies[b[0]][0] === this.cubies[b[0]][1])) {
4159
- if (this.facecentermass[i].dist(centermassface(this.basefaces[this.getfaceindex(i)])) < eps3) {
4160
- let face1 = this.cubies[b[0]][0];
4349
+ if (b.length > 2 && this.options.orientCenters && (this.cubies[b[0]].length === 1 || this.duplicatedCubies[b[0]] > 1)) {
4350
+ if (this.facecentermass[i].dist(this.basefaces[this.getfaceindex(i)].centermass()) < eps3) {
4351
+ let face1 = this.faces[this.cubies[b[0]][0]];
4161
4352
  for (let ii = 0; ii < b.length; ii += 2) {
4162
- const face0 = this.cubies[b[ii]][0];
4353
+ const face0 = this.faces[this.cubies[b[ii]][0]];
4163
4354
  let o = -1;
4164
4355
  for (let jj = 0; jj < face1.length; jj++) {
4165
- if (face0[jj].dist(face1[0]) < eps3) {
4356
+ if (face0.get(jj).dist(face1.get(0)) < eps3) {
4166
4357
  o = jj;
4167
4358
  break;
4168
4359
  }
@@ -4171,12 +4362,12 @@ var PuzzleGeometry = class {
4171
4362
  throw new Error("Couldn't find rotation of center faces; ignoring for now.");
4172
4363
  } else {
4173
4364
  b[ii + 1] = o;
4174
- face1 = this.moverotations[k][0].rotateface(face1);
4365
+ face1 = face1.rotate(this.moverotations[k][0]);
4175
4366
  }
4176
4367
  }
4177
4368
  }
4178
4369
  }
4179
- if (b.length === 2 && this.orientCenters) {
4370
+ if (b.length === 2 && this.options.orientCenters) {
4180
4371
  for (let ii = 1; ii < this.movesetorders[k]; ii++) {
4181
4372
  if (sc === 0) {
4182
4373
  b.push(b[0], ii);
@@ -4189,32 +4380,30 @@ var PuzzleGeometry = class {
4189
4380
  if (b.length !== 2 * this.movesetorders[k]) {
4190
4381
  throw new Error("Bad length in perm gen");
4191
4382
  }
4192
- for (let j = 0; j < b.length; j++) {
4193
- axiscmoves[sc].push(b[j]);
4383
+ for (const v of b) {
4384
+ axiscmoves[sc].push(v);
4194
4385
  }
4195
4386
  }
4196
4387
  for (let j = 0; j < b.length; j += 2) {
4197
4388
  cubiedone[b[j]] = true;
4198
4389
  }
4199
4390
  }
4391
+ for (let kk = 0; kk < axiscmoves.length; kk++) {
4392
+ axiscmoves[kk] = axiscmoves[kk].slice();
4393
+ }
4200
4394
  cmovesbyslice.push(axiscmoves);
4201
4395
  }
4202
4396
  this.cmovesbyslice = cmovesbyslice;
4203
- if (this.movelist !== void 0) {
4397
+ if (this.options.moveList) {
4204
4398
  const parsedmovelist = [];
4205
- for (let i = 0; i < this.movelist.length; i++) {
4206
- parsedmovelist.push(this.parsemove(this.movelist[i]));
4399
+ for (const moveString of this.options.moveList) {
4400
+ parsedmovelist.push(this.parsemove(moveString));
4207
4401
  }
4208
4402
  this.parsedmovelist = parsedmovelist;
4209
4403
  }
4210
- this.facelisthash = null;
4404
+ this.facelisthash.clear();
4211
4405
  this.facecentermass = [];
4212
- this.cubiekey = [];
4213
- }
4214
- getfaces() {
4215
- return this.faces.map((_) => {
4216
- return _.map((__) => [__.b, __.c, __.d]);
4217
- });
4406
+ tend(t1);
4218
4407
  }
4219
4408
  getboundarygeometry() {
4220
4409
  return {
@@ -4230,8 +4419,7 @@ var PuzzleGeometry = class {
4230
4419
  const slices = this.moveplanesets[k].length;
4231
4420
  let r = [];
4232
4421
  if (this.parsedmovelist !== void 0) {
4233
- for (let i = 0; i < this.parsedmovelist.length; i++) {
4234
- const parsedmove = this.parsedmovelist[i];
4422
+ for (const parsedmove of this.parsedmovelist) {
4235
4423
  if (parsedmove[1] !== k) {
4236
4424
  continue;
4237
4425
  }
@@ -4242,19 +4430,19 @@ var PuzzleGeometry = class {
4242
4430
  }
4243
4431
  r.push(parsedmove[5]);
4244
4432
  }
4245
- } else if (this.vertexmoves && !this.allmoves) {
4433
+ } else if (this.options.vertexMoves && !this.options.allMoves) {
4246
4434
  const msg = this.movesetgeos[k];
4247
4435
  if (msg[1] !== msg[3]) {
4248
4436
  for (let i = 0; i < slices; i++) {
4249
4437
  if (msg[1] !== "v") {
4250
- if (this.outerblockmoves) {
4438
+ if (this.options.outerBlockMoves) {
4251
4439
  r.push([i + 1, slices]);
4252
4440
  } else {
4253
4441
  r.push([i + 1]);
4254
4442
  }
4255
4443
  r.push(1);
4256
4444
  } else {
4257
- if (this.outerblockmoves) {
4445
+ if (this.options.outerBlockMoves) {
4258
4446
  r.push([0, i]);
4259
4447
  } else {
4260
4448
  r.push([i, i]);
@@ -4265,10 +4453,10 @@ var PuzzleGeometry = class {
4265
4453
  }
4266
4454
  } else {
4267
4455
  for (let i = 0; i <= slices; i++) {
4268
- if (!this.allmoves && i + i === slices) {
4456
+ if (!this.options.allMoves && i + i === slices) {
4269
4457
  continue;
4270
4458
  }
4271
- if (this.outerblockmoves) {
4459
+ if (this.options.outerBlockMoves) {
4272
4460
  if (i + i > slices) {
4273
4461
  r.push([i, slices]);
4274
4462
  } else {
@@ -4281,7 +4469,7 @@ var PuzzleGeometry = class {
4281
4469
  }
4282
4470
  }
4283
4471
  if (this.fixedCubie >= 0) {
4284
- const dep = +this.cubiekeys[this.fixedCubie].trim().split(" ")[k];
4472
+ const dep = this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[k];
4285
4473
  const newr = [];
4286
4474
  for (let i = 0; i < r.length; i += 2) {
4287
4475
  let o = r[i];
@@ -4315,27 +4503,20 @@ var PuzzleGeometry = class {
4315
4503
  if (this.duplicatedCubies[cubie]) {
4316
4504
  ori = 1;
4317
4505
  }
4318
- return ori === 1 && (this.graycenters || !this.centersets) || ori === 2 && (this.grayedges || !this.edgesets) || ori > 2 && (this.graycorners || !this.cornersets);
4506
+ 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);
4319
4507
  }
4320
4508
  skipbyori(cubie) {
4321
4509
  let ori = this.cubies[cubie].length;
4322
4510
  if (this.duplicatedCubies[cubie]) {
4323
4511
  ori = 1;
4324
4512
  }
4325
- return ori === 1 && !this.centersets || ori === 2 && !this.edgesets || ori > 2 && !this.cornersets;
4513
+ return ori === 1 && !this.options.includeCenterOrbits || ori === 2 && !this.options.includeEdgeOrbits || ori > 2 && !this.options.includeCornerOrbits;
4326
4514
  }
4327
4515
  skipcubie(fi) {
4328
4516
  return this.skipbyori(fi);
4329
4517
  }
4330
- skipset(set) {
4331
- if (set.length === 0) {
4332
- return true;
4333
- }
4334
- const fi = set[0];
4335
- return this.skipbyori(this.facetocubies[fi][0]);
4336
- }
4337
4518
  header(comment) {
4338
- return comment + copyright + "\n" + comment + this.args + "\n";
4519
+ return comment + copyright + "\n" + comment + "\n";
4339
4520
  }
4340
4521
  writegap() {
4341
4522
  const os = this.getOrbitsDef(false);
@@ -4360,6 +4541,8 @@ var PuzzleGeometry = class {
4360
4541
  r.push("];");
4361
4542
  const ip = os.solved.identicalPieces();
4362
4543
  r.push("ip:=[" + ip.map((_) => "[" + _.map((__) => __ + 1).join(",") + "]").join(",") + "];");
4544
+ r.push("# Size(Group(Gen));");
4545
+ r.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));");
4363
4546
  r.push("");
4364
4547
  return this.header("# ") + r.join("\n");
4365
4548
  }
@@ -4367,9 +4550,12 @@ var PuzzleGeometry = class {
4367
4550
  const od = this.getOrbitsDef(false);
4368
4551
  return this.header("# ") + od.toKsolve(name, this.notationMapper).join("\n");
4369
4552
  }
4370
- writekpuzzle(fortwisty = true) {
4371
- const od = this.getOrbitsDef(fortwisty);
4372
- const r = od.toKpuzzle();
4553
+ writekpuzzle(fortwisty = true, includemoves = true) {
4554
+ const od = this.getOrbitsDef(fortwisty, includemoves);
4555
+ const r = od.toKPuzzle(includemoves);
4556
+ if (!r) {
4557
+ throw new Error("Missing definition!");
4558
+ }
4373
4559
  r.moveNotation = new PGNotation(this, od);
4374
4560
  return r;
4375
4561
  }
@@ -4377,9 +4563,9 @@ var PuzzleGeometry = class {
4377
4563
  const moveorbits = [];
4378
4564
  const perms = [];
4379
4565
  const oris = [];
4380
- for (let ii = 0; ii < this.cubiesetnames.length; ii++) {
4381
- perms.push(iota(this.cubieords[ii]));
4382
- oris.push(zeros(this.cubieords[ii]));
4566
+ for (const len of this.cubieords) {
4567
+ perms.push(iota(len));
4568
+ oris.push(zeros(len));
4383
4569
  }
4384
4570
  for (let m = moverange[0]; m <= moverange[1]; m++) {
4385
4571
  const slicecmoves = axiscmoves[m];
@@ -4397,49 +4583,49 @@ var PuzzleGeometry = class {
4397
4583
  }
4398
4584
  if (perms[setnum] === iota(this.cubieords[setnum])) {
4399
4585
  perms[setnum] = perms[setnum].slice();
4400
- if (this.orbitoris[setnum] > 1 && !this.killorientation) {
4586
+ if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
4401
4587
  oris[setnum] = oris[setnum].slice();
4402
4588
  }
4403
4589
  }
4404
4590
  for (let ii = 0; ii < mperm.length; ii += 2) {
4405
4591
  perms[setnum][mperm[(ii + inc) % mperm.length]] = mperm[ii];
4406
- if (this.orbitoris[setnum] > 1 && !this.killorientation) {
4592
+ if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
4407
4593
  oris[setnum][mperm[ii]] = (mperm[(ii + oinc) % mperm.length] - mperm[(ii + 1) % mperm.length] + 2 * this.orbitoris[setnum]) % this.orbitoris[setnum];
4408
4594
  }
4409
4595
  }
4410
4596
  }
4411
4597
  }
4412
- let lastId = new Orbit(iota(24), zeros(24), 1);
4598
+ let lastId = new PGOrbit(iota(24), zeros(24), 1);
4413
4599
  for (let ii = 0; ii < this.cubiesetnames.length; ii++) {
4414
4600
  if (setmoves && !setmoves[ii]) {
4415
4601
  continue;
4416
4602
  }
4417
- if (this.orbitoris[ii] === 1 || this.killorientation) {
4603
+ if (this.orbitoris[ii] === 1 || this.options.fixedOrientation) {
4418
4604
  if (perms[ii] === iota(lastId.perm.length)) {
4419
4605
  if (perms[ii] !== lastId.perm) {
4420
- lastId = new Orbit(perms[ii], oris[ii], 1);
4606
+ lastId = new PGOrbit(perms[ii], oris[ii], 1);
4421
4607
  }
4422
4608
  moveorbits.push(lastId);
4423
4609
  } else {
4424
- moveorbits.push(new Orbit(perms[ii], oris[ii], 1));
4610
+ moveorbits.push(new PGOrbit(perms[ii], oris[ii], 1));
4425
4611
  }
4426
4612
  } else {
4427
4613
  const no = new Array(oris[ii].length);
4428
4614
  for (let jj = 0; jj < perms[ii].length; jj++) {
4429
4615
  no[jj] = oris[ii][perms[ii][jj]];
4430
4616
  }
4431
- moveorbits.push(new Orbit(perms[ii], no, this.orbitoris[ii]));
4617
+ moveorbits.push(new PGOrbit(perms[ii], no, this.orbitoris[ii]));
4432
4618
  }
4433
4619
  }
4434
- let mv = new Transformation(moveorbits);
4620
+ let mv = new PGTransform(moveorbits);
4435
4621
  if (amount !== 1) {
4436
4622
  mv = mv.mulScalar(amount);
4437
4623
  }
4438
4624
  return mv;
4439
4625
  }
4440
4626
  omitSet(name) {
4441
- for (let k = 0; k < this.omitsets.length; k++) {
4442
- if (this.omitsets[k] === name) {
4627
+ for (const excludedSet of this.options.excludeOrbits) {
4628
+ if (excludedSet === name) {
4443
4629
  return true;
4444
4630
  }
4445
4631
  }
@@ -4465,7 +4651,7 @@ var PuzzleGeometry = class {
4465
4651
  }
4466
4652
  return false;
4467
4653
  }
4468
- getOrbitsDef(fortwisty) {
4654
+ getOrbitsDef(fortwisty, includemoves = true) {
4469
4655
  const setmoves = [];
4470
4656
  if (fortwisty) {
4471
4657
  for (let i = 0; i < this.cubiesetnames.length; i++) {
@@ -4479,13 +4665,13 @@ var PuzzleGeometry = class {
4479
4665
  for (let k = 0; k < this.moveplanesets.length; k++) {
4480
4666
  const moveset = this.getmovesets(k);
4481
4667
  mps.push(moveset);
4482
- if (this.addrotations) {
4668
+ if (this.options.addRotations) {
4483
4669
  addrot.push(1);
4484
4670
  } else {
4485
4671
  addrot.push(0);
4486
4672
  }
4487
4673
  }
4488
- if (this.movelist && this.addrotations) {
4674
+ if (this.options.moveList && this.options.addRotations) {
4489
4675
  for (let i = 0; i < this.moverotations.length; i++) {
4490
4676
  addrot[i] = 0;
4491
4677
  }
@@ -4499,18 +4685,20 @@ var PuzzleGeometry = class {
4499
4685
  }
4500
4686
  let found = -1;
4501
4687
  let neg = false;
4502
- for (let j = 0; found < 0 && j < this.moveplanenormals.length; j++) {
4688
+ for (let j = 0; j < this.moveplanenormals.length; j++) {
4503
4689
  if (nn.dist(this.moveplanenormals[j]) < eps3) {
4504
4690
  found = j;
4691
+ break;
4505
4692
  } else if (nn.dist(this.moveplanenormals[j].smul(-1)) < eps3) {
4506
4693
  found = j;
4507
4694
  neg = true;
4695
+ break;
4508
4696
  }
4509
4697
  }
4510
4698
  if (found < 0) {
4511
4699
  throw new Error("Could not find rotation");
4512
4700
  }
4513
- let cmp = mps[found];
4701
+ const cmp = mps[found];
4514
4702
  if (cmp.length !== mps[k].length || this.moveplanesets[k].length !== this.moveplanesets[found].length || this.diffmvsets(cmp, mps[k], this.moveplanesets[found].length, neg)) {
4515
4703
  addrot[i] |= ii;
4516
4704
  }
@@ -4579,7 +4767,7 @@ var PuzzleGeometry = class {
4579
4767
  continue;
4580
4768
  }
4581
4769
  setnames.push(this.cubiesetnames[i]);
4582
- setdefs.push(new OrbitDef(this.cubieords[i], this.killorientation ? 1 : this.orbitoris[i]));
4770
+ setdefs.push(new PGOrbitDef(this.cubieords[i], this.options.fixedOrientation ? 1 : this.orbitoris[i]));
4583
4771
  }
4584
4772
  const solved = [];
4585
4773
  for (let i = 0; i < this.cubiesetnames.length; i++) {
@@ -4600,36 +4788,37 @@ var PuzzleGeometry = class {
4600
4788
  }
4601
4789
  o.push(0);
4602
4790
  }
4603
- solved.push(new Orbit(p, o, this.killorientation ? 1 : this.orbitoris[i]));
4791
+ solved.push(new PGOrbit(p, o, this.options.fixedOrientation ? 1 : this.orbitoris[i]));
4604
4792
  }
4605
4793
  const movenames = [];
4606
4794
  const moves = [];
4607
- for (let k = 0; k < this.moveplanesets.length; k++) {
4608
- const moveplaneset = this.moveplanesets[k];
4609
- const slices = moveplaneset.length;
4610
- const moveset = mps[k];
4611
- const movesetgeo = this.movesetgeos[k];
4612
- for (let i = 0; i < moveset.length; i += 2) {
4613
- const movebits = moveset[i];
4614
- const mna = getmovename(movesetgeo, movebits, slices);
4615
- const movename = mna[0];
4616
- const inverted = mna[1];
4617
- if (moveset[i + 1] === 1) {
4618
- movenames.push(movename);
4619
- } else {
4620
- movenames.push(movename + moveset[i + 1]);
4795
+ if (includemoves) {
4796
+ for (let k = 0; k < this.moveplanesets.length; k++) {
4797
+ const moveplaneset = this.moveplanesets[k];
4798
+ const slices = moveplaneset.length;
4799
+ const moveset = mps[k];
4800
+ const movesetgeo = this.movesetgeos[k];
4801
+ for (let i = 0; i < moveset.length; i += 2) {
4802
+ const movebits = moveset[i];
4803
+ const mna = getmovename(movesetgeo, movebits, slices);
4804
+ const movename = mna[0];
4805
+ const inverted = mna[1];
4806
+ if (moveset[i + 1] === 1) {
4807
+ movenames.push(movename);
4808
+ } else {
4809
+ movenames.push(movename + moveset[i + 1]);
4810
+ }
4811
+ const mv = this.getMoveFromBits(movebits, moveset[i + 1], inverted, this.cmovesbyslice[k], setmoves, this.movesetorders[k]);
4812
+ moves.push(mv);
4621
4813
  }
4622
- const mv = this.getMoveFromBits(movebits, moveset[i + 1], inverted, this.cmovesbyslice[k], setmoves, this.movesetorders[k]);
4623
- moves.push(mv);
4624
4814
  }
4625
4815
  }
4626
- this.ksolvemovenames = movenames;
4627
- let r = new OrbitsDef(setnames, setdefs, new VisibleState(solved), movenames, moves);
4628
- if (this.optimize) {
4816
+ let r = new PGOrbitsDef(setnames, setdefs, new VisibleState(solved), movenames, moves);
4817
+ if (this.options.optimizeOrbits) {
4629
4818
  r = r.optimize();
4630
4819
  }
4631
- if (this.scramble !== 0) {
4632
- r.scramble(this.scramble);
4820
+ if (this.options.scrambleAmount !== 0) {
4821
+ r.scramble(this.options.scrambleAmount);
4633
4822
  }
4634
4823
  return r;
4635
4824
  }
@@ -4641,7 +4830,7 @@ var PuzzleGeometry = class {
4641
4830
  }
4642
4831
  getsolved() {
4643
4832
  const r = [];
4644
- for (let i = 0; i < this.basefacecount; i++) {
4833
+ for (let i = 0; i < this.baseFaceCount; i++) {
4645
4834
  for (let j = 0; j < this.stickersperface; j++) {
4646
4835
  r.push(i);
4647
4836
  }
@@ -4649,10 +4838,10 @@ var PuzzleGeometry = class {
4649
4838
  return new Perm(r);
4650
4839
  }
4651
4840
  getOrientationRotation(desiredRotation) {
4652
- const feature1name = desiredRotation[0];
4653
- const direction1 = new Quat(0, desiredRotation[1][0], -desiredRotation[1][1], desiredRotation[1][2]);
4654
- const feature2name = desiredRotation[2];
4655
- const direction2 = new Quat(0, desiredRotation[3][0], -desiredRotation[3][1], desiredRotation[3][2]);
4841
+ const [feature1name, [x1, y1, z1]] = desiredRotation[0];
4842
+ const direction1 = new Quat(0, x1, -y1, z1);
4843
+ const [feature2name, [x2, y2, z2]] = desiredRotation[1];
4844
+ const direction2 = new Quat(0, x2, -y2, z2);
4656
4845
  let feature1 = null;
4657
4846
  let feature2 = null;
4658
4847
  const feature1geoname = this.swizzler.unswizzle(feature1name);
@@ -4677,22 +4866,22 @@ var PuzzleGeometry = class {
4677
4866
  return r2.mul(r1);
4678
4867
  }
4679
4868
  getInitial3DRotation() {
4680
- const basefacecount = this.basefacecount;
4681
- let rotDesc = null;
4682
- if (this.puzzleOrientation) {
4683
- rotDesc = this.puzzleOrientation;
4684
- } else if (this.puzzleOrientations) {
4685
- rotDesc = this.puzzleOrientations[basefacecount];
4869
+ const basefacecount = this.baseFaceCount;
4870
+ let orientationDescription = null;
4871
+ if (this.options.puzzleOrientation) {
4872
+ orientationDescription = this.options.puzzleOrientation;
4873
+ } else if (this.options.puzzleOrientations) {
4874
+ orientationDescription = this.options.puzzleOrientations[basefacecount];
4686
4875
  }
4687
- if (!rotDesc) {
4688
- rotDesc = defaultOrientations()[basefacecount];
4876
+ if (!orientationDescription) {
4877
+ orientationDescription = defaultOrientations()[basefacecount];
4689
4878
  }
4690
- if (!rotDesc) {
4879
+ if (!orientationDescription) {
4691
4880
  throw new Error("No default orientation?");
4692
4881
  }
4693
- return this.getOrientationRotation(rotDesc);
4882
+ return this.getOrientationRotation(orientationDescription);
4694
4883
  }
4695
- generatesvg(w = 800, h = 500, trim = 10, threed = false) {
4884
+ generate2dmapping(w = 800, h = 500, trim = 10, threed = false, twodshrink = 0.92) {
4696
4885
  w -= 2 * trim;
4697
4886
  h -= 2 * trim;
4698
4887
  function extendedges(a, n) {
@@ -4708,29 +4897,6 @@ var PuzzleGeometry = class {
4708
4897
  a.push([a[i - 1][0] + dx, a[i - 1][1] + dy]);
4709
4898
  }
4710
4899
  }
4711
- function noise(c) {
4712
- return c + 0 * (Math.random() - 0.5);
4713
- }
4714
- function drawedges(id, pts, color) {
4715
- return '<polygon id="' + id + '" class="sticker" style="fill: ' + color + '" points="' + pts.map((p) => noise(p[0]) + " " + noise(p[1])).join(" ") + '"/>\n';
4716
- }
4717
- let needvertexgrips = this.addrotations;
4718
- let neededgegrips = this.addrotations;
4719
- let needfacegrips = this.addrotations;
4720
- for (let i = 0; i < this.movesetgeos.length; i++) {
4721
- const msg = this.movesetgeos[i];
4722
- for (let j = 1; j <= 3; j += 2) {
4723
- if (msg[j] === "v") {
4724
- needvertexgrips = true;
4725
- }
4726
- if (msg[j] === "f") {
4727
- needfacegrips = true;
4728
- }
4729
- if (msg[j] === "e") {
4730
- neededgegrips = true;
4731
- }
4732
- }
4733
- }
4734
4900
  this.genperms();
4735
4901
  const boundarygeo = this.getboundarygeometry();
4736
4902
  const face0 = boundarygeo.facenames[0][0];
@@ -4749,13 +4915,13 @@ var PuzzleGeometry = class {
4749
4915
  [0, 0]
4750
4916
  ];
4751
4917
  extendedges(edges[net[0][0]], polyn);
4752
- for (let i = 0; i < net.length; i++) {
4753
- const f0 = net[i][0];
4918
+ for (const neti of net) {
4919
+ const f0 = neti[0];
4754
4920
  if (!edges[f0]) {
4755
4921
  throw new Error("Bad edge description; first edge not connected.");
4756
4922
  }
4757
- for (let j = 1; j < net[i].length; j++) {
4758
- const f1 = net[i][j];
4923
+ for (let j = 1; j < neti.length; j++) {
4924
+ const f1 = neti[j];
4759
4925
  if (f1 === "" || edges[f1]) {
4760
4926
  continue;
4761
4927
  }
@@ -4765,11 +4931,11 @@ var PuzzleGeometry = class {
4765
4931
  }
4766
4932
  for (const f in edges) {
4767
4933
  const es = edges[f];
4768
- for (let i = 0; i < es.length; i++) {
4769
- minx = Math.min(minx, es[i][0]);
4770
- maxx = Math.max(maxx, es[i][0]);
4771
- miny = Math.min(miny, es[i][1]);
4772
- maxy = Math.max(maxy, es[i][1]);
4934
+ for (const esi of es) {
4935
+ minx = Math.min(minx, esi[0]);
4936
+ maxx = Math.max(maxx, esi[0]);
4937
+ miny = Math.min(miny, esi[1]);
4938
+ maxy = Math.max(maxy, esi[1]);
4773
4939
  }
4774
4940
  }
4775
4941
  const sc = Math.min(w / (maxx - minx), h / (maxy - miny));
@@ -4790,8 +4956,8 @@ var PuzzleGeometry = class {
4790
4956
  ]);
4791
4957
  const connectat = [];
4792
4958
  connectat[0] = 0;
4793
- for (let i = 0; i < net.length; i++) {
4794
- const f0 = net[i][0];
4959
+ for (const neti of net) {
4960
+ const f0 = neti[0];
4795
4961
  if (!edges2[f0]) {
4796
4962
  throw new Error("Bad edge description; first edge not connected.");
4797
4963
  }
@@ -4806,8 +4972,8 @@ var PuzzleGeometry = class {
4806
4972
  throw new Error("Could not find first face name " + f0);
4807
4973
  }
4808
4974
  const thisface = bg.facenames[gfi][0];
4809
- for (let j = 1; j < net[i].length; j++) {
4810
- const f1 = net[i][j];
4975
+ for (let j = 1; j < neti.length; j++) {
4976
+ const f1 = neti[j];
4811
4977
  if (f1 === "" || edges2[f1]) {
4812
4978
  continue;
4813
4979
  }
@@ -4848,26 +5014,22 @@ var PuzzleGeometry = class {
4848
5014
  }
4849
5015
  }
4850
5016
  }
4851
- const pos = this.getsolved();
4852
- const colormap = [];
4853
- const facegeo = [];
4854
- for (let i = 0; i < this.basefacecount; i++) {
4855
- colormap[i] = this.colors[this.facenames[i][1]];
4856
- }
4857
5017
  let hix = 0;
4858
5018
  let hiy = 0;
4859
5019
  const rot = this.getInitial3DRotation();
4860
- for (let i = 0; i < this.faces.length; i++) {
4861
- let face = this.faces[i];
4862
- face = rot.rotateface(face);
5020
+ for (let face of this.faces) {
5021
+ if (threed) {
5022
+ face = face.rotate(rot);
5023
+ }
4863
5024
  for (let j = 0; j < face.length; j++) {
4864
- hix = Math.max(hix, Math.abs(face[j].b));
4865
- hiy = Math.max(hiy, Math.abs(face[j].c));
5025
+ hix = Math.max(hix, Math.abs(face.get(j).b));
5026
+ hiy = Math.max(hiy, Math.abs(face.get(j).c));
4866
5027
  }
4867
5028
  }
4868
5029
  const sc2 = Math.min(h / hiy / 2, (w - trim) / hix / 4);
4869
5030
  const mappt2d = (fn, q) => {
4870
5031
  if (threed) {
5032
+ q = q.rotatepoint(rot);
4871
5033
  const xoff2 = 0.5 * trim + 0.25 * w;
4872
5034
  const xmul = this.baseplanes[fn].rotateplane(rot).d < 0 ? 1 : -1;
4873
5035
  return [
@@ -4876,25 +5038,42 @@ var PuzzleGeometry = class {
4876
5038
  ];
4877
5039
  } else {
4878
5040
  const g = geos[this.facenames[fn][1]];
4879
- return [trim + q.dot(g[0]) + g[2].b, trim + h - q.dot(g[1]) - g[2].c];
5041
+ return [
5042
+ trim + twodshrink * q.dot(g[0]) + g[2].b,
5043
+ trim + h - twodshrink * q.dot(g[1]) - g[2].c
5044
+ ];
4880
5045
  }
4881
5046
  };
5047
+ return mappt2d;
5048
+ }
5049
+ generatesvg(w = 800, h = 500, trim = 10, threed = false) {
5050
+ const mappt2d = this.generate2dmapping(w, h, trim, threed);
5051
+ function drawedges(id, pts, color) {
5052
+ return '<polygon id="' + id + '" class="sticker" style="fill: ' + color + '" points="' + pts.map((p) => p[0] + " " + p[1]).join(" ") + '"/>\n';
5053
+ }
5054
+ const pos = this.getsolved();
5055
+ const colormap = [];
5056
+ const facegeo = [];
5057
+ for (let i = 0; i < this.baseFaceCount; i++) {
5058
+ colormap[i] = this.colors[this.facenames[i][1]];
5059
+ }
4882
5060
  for (let i = 0; i < this.faces.length; i++) {
4883
- let face = this.faces[i];
5061
+ const face = this.faces[i];
4884
5062
  const facenum = Math.floor(i / this.stickersperface);
4885
- if (threed) {
4886
- face = rot.rotateface(face);
5063
+ const fg = [];
5064
+ for (let j = 0; j < face.length; j++) {
5065
+ fg.push(mappt2d(facenum, face.get(j)));
4887
5066
  }
4888
- facegeo.push(face.map((_) => mappt2d(facenum, _)));
5067
+ facegeo.push(fg);
4889
5068
  }
4890
5069
  const svg = [];
4891
- for (let j = 0; j < this.basefacecount; j++) {
5070
+ for (let j = 0; j < this.baseFaceCount; j++) {
4892
5071
  svg.push("<g>");
4893
5072
  svg.push("<title>" + this.facenames[j][1] + "</title>\n");
4894
5073
  for (let ii = 0; ii < this.stickersperface; ii++) {
4895
5074
  const i = j * this.stickersperface + ii;
4896
- const cubie = this.facetocubies[i][0];
4897
- const cubieori = this.facetocubies[i][1];
5075
+ const cubie = this.facetocubie[i];
5076
+ const cubieori = this.facetoord[i];
4898
5077
  const cubiesetnum = this.cubiesetnums[cubie];
4899
5078
  const cubieord = this.cubieordnums[cubie];
4900
5079
  const color = this.graybyori(cubie) ? "#808080" : colormap[pos.p[i]];
@@ -4909,122 +5088,53 @@ var PuzzleGeometry = class {
4909
5088
  }
4910
5089
  svg.push("</g>");
4911
5090
  }
4912
- const svggrips = [];
4913
- function addgrip(onface, name, pt, order) {
4914
- const pt2 = mappt2d(onface, pt);
4915
- for (let i = 0; i < svggrips.length; i++) {
4916
- if (Math.hypot(pt2[0] - svggrips[i][0], pt2[1] - svggrips[i][1]) < eps3) {
4917
- return;
4918
- }
4919
- }
4920
- svggrips.push([pt2[0], pt2[1], name, order]);
4921
- }
4922
- for (let i = 0; i < this.faceplanes.length; i++) {
4923
- const baseface = this.facenames[i][0];
4924
- let facecoords = baseface;
4925
- if (threed) {
4926
- facecoords = rot.rotateface(facecoords);
4927
- }
4928
- if (needfacegrips) {
4929
- let pt = this.faceplanes[i][0];
4930
- if (threed) {
4931
- pt = pt.rotatepoint(rot);
4932
- }
4933
- addgrip(i, this.faceplanes[i][1], pt, polyn);
4934
- }
4935
- for (let j = 0; j < baseface.length; j++) {
4936
- if (neededgegrips) {
4937
- const mp = baseface[j].sum(baseface[(j + 1) % baseface.length]).smul(0.5);
4938
- const ep = findelement(this.edgenames, mp);
4939
- const mpc = facecoords[j].sum(facecoords[(j + 1) % baseface.length]).smul(0.5);
4940
- addgrip(i, this.edgenames[ep][1], mpc, 2);
4941
- }
4942
- if (needvertexgrips) {
4943
- const vp = findelement(this.vertexnames, baseface[j]);
4944
- addgrip(i, this.vertexnames[vp][1], facecoords[j], this.cornerfaces);
4945
- }
4946
- }
4947
- }
4948
5091
  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>";
4949
- this.svggrips = svggrips;
4950
5092
  return html;
4951
5093
  }
4952
- dist(a, b) {
4953
- return Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
4954
- }
4955
- triarea(a, b, c) {
4956
- const ab = this.dist(a, b);
4957
- const bc = this.dist(b, c);
4958
- const ac = this.dist(a, c);
4959
- const p = (ab + bc + ac) / 2;
4960
- return Math.sqrt(p * (p - ab) * (p - bc) * (p - ac));
4961
- }
4962
- polyarea(coords) {
4963
- let sum = 0;
4964
- for (let i = 2; i < coords.length; i++) {
4965
- sum += this.triarea(coords[0], coords[1], coords[i]);
4966
- }
4967
- return sum;
4968
- }
4969
- get3d(colorfrac = DEFAULT_COLOR_FRACTION, options) {
5094
+ get3d(options) {
4970
5095
  const stickers = [];
4971
- const foundations = [];
4972
5096
  const rot = this.getInitial3DRotation();
4973
5097
  const faces = [];
4974
- const maxdist = 0.52 * this.basefaces[0][0].len();
4975
- let avgstickerarea = 0;
5098
+ const maxdist = 0.52 * this.basefaces[0].get(0).len();
4976
5099
  for (let i = 0; i < this.basefaces.length; i++) {
4977
- const coords = rot.rotateface(this.basefaces[i]);
5100
+ const coords = this.basefaces[i].rotate(rot);
4978
5101
  const name = this.facenames[i][1];
4979
5102
  faces.push({ coords: toFaceCoords(coords, maxdist), name });
4980
- avgstickerarea += this.polyarea(faces[i].coords);
4981
5103
  }
4982
- avgstickerarea /= this.faces.length;
4983
- const trim = Math.sqrt(avgstickerarea) * (1 - Math.sqrt(colorfrac)) / 2;
4984
5104
  for (let i = 0; i < this.faces.length; i++) {
4985
5105
  const facenum = Math.floor(i / this.stickersperface);
4986
- const cubie = this.facetocubies[i][0];
4987
- const cubieori = this.facetocubies[i][1];
5106
+ const cubie = this.facetocubie[i];
5107
+ const cubieori = this.facetoord[i];
4988
5108
  const cubiesetnum = this.cubiesetnums[cubie];
4989
5109
  const cubieord = this.cubieordnums[cubie];
4990
5110
  let color = this.graybyori(cubie) ? "#808080" : this.colors[this.facenames[facenum][1]];
4991
5111
  if (options?.stickerColors) {
4992
5112
  color = options.stickerColors[i];
4993
5113
  }
4994
- let coords = rot.rotateface(this.faces[i]);
4995
- foundations.push({
4996
- coords: toFaceCoords(coords, maxdist),
4997
- color,
4998
- orbit: this.cubiesetnames[cubiesetnum],
4999
- ord: cubieord,
5000
- ori: cubieori
5001
- });
5002
- const fcoords = coords;
5003
- if (trim && trim > 0) {
5004
- coords = trimEdges(coords, trim);
5005
- }
5114
+ const coords = this.faces[i].rotate(rot);
5006
5115
  stickers.push({
5007
5116
  coords: toFaceCoords(coords, maxdist),
5008
5117
  color,
5009
5118
  orbit: this.cubiesetnames[cubiesetnum],
5010
5119
  ord: cubieord,
5011
- ori: cubieori
5120
+ ori: cubieori,
5121
+ face: facenum
5012
5122
  });
5123
+ let fcoords = coords;
5013
5124
  if (this.duplicatedFaces[i]) {
5125
+ const rotdist = fcoords.length / this.duplicatedFaces[i];
5014
5126
  for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {
5127
+ for (let k = 0; k < rotdist; k++) {
5128
+ fcoords = fcoords.rotateforward();
5129
+ }
5015
5130
  stickers.push({
5016
- coords: toFaceCoords(coords, maxdist),
5017
- color,
5018
- orbit: this.cubiesetnames[cubiesetnum],
5019
- ord: cubieord,
5020
- ori: jj
5021
- });
5022
- foundations.push({
5023
5131
  coords: toFaceCoords(fcoords, maxdist),
5024
5132
  color,
5025
5133
  orbit: this.cubiesetnames[cubiesetnum],
5026
5134
  ord: cubieord,
5027
- ori: jj
5135
+ ori: jj,
5136
+ face: facenum,
5137
+ isDup: true
5028
5138
  });
5029
5139
  }
5030
5140
  }
@@ -5033,8 +5143,7 @@ var PuzzleGeometry = class {
5033
5143
  for (let i = 0; i < this.movesetgeos.length; i++) {
5034
5144
  const msg = this.movesetgeos[i];
5035
5145
  const order = this.movesetorders[i];
5036
- for (let j = 0; j < this.geonormals.length; j++) {
5037
- const gn = this.geonormals[j];
5146
+ for (const gn of this.geonormals) {
5038
5147
  if (msg[0] === gn[1] && msg[1] === gn[2]) {
5039
5148
  grips.push([toCoords(gn[0].rotatepoint(rot), 1), msg[0], order]);
5040
5149
  grips.push([
@@ -5045,25 +5154,31 @@ var PuzzleGeometry = class {
5045
5154
  }
5046
5155
  }
5047
5156
  }
5048
- const f = function() {
5049
- return function(mv) {
5050
- return this.unswizzle(mv);
5157
+ const twodmapper = this.generate2dmapping(2880, 2160, 0, false, 1);
5158
+ const g = function() {
5159
+ const irot = rot.invrot();
5160
+ return function(facenum, coords) {
5161
+ let q = new Quat(0, coords[0] * maxdist, -coords[1] * maxdist, coords[2] * maxdist);
5162
+ q = q.rotatepoint(irot);
5163
+ const x = twodmapper(facenum, q);
5164
+ x[0] /= 2880;
5165
+ x[1] = 1 - x[1] / 2160;
5166
+ return x;
5051
5167
  };
5052
5168
  }().bind(this);
5053
5169
  return {
5054
5170
  stickers,
5055
- foundations,
5056
5171
  faces,
5057
5172
  axis: grips,
5058
- unswizzle: f,
5059
- notationMapper: this.notationMapper
5173
+ unswizzle: this.unswizzle.bind(this),
5174
+ notationMapper: this.notationMapper,
5175
+ textureMapper: { getuv: g }
5060
5176
  };
5061
5177
  }
5062
5178
  getGeoNormal(geoname) {
5063
5179
  const rot = this.getInitial3DRotation();
5064
5180
  const grip = this.swizzler.unswizzle(geoname);
5065
- for (let j = 0; j < this.geonormals.length; j++) {
5066
- const gn = this.geonormals[j];
5181
+ for (const gn of this.geonormals) {
5067
5182
  if (grip === gn[1]) {
5068
5183
  const r = toCoords(gn[0].rotatepoint(rot), 1);
5069
5184
  if (Math.abs(r[0]) < eps3 && Math.abs(r[2]) < eps3) {
@@ -5079,6 +5194,22 @@ var PuzzleGeometry = class {
5079
5194
  const divid = this.stickersperface;
5080
5195
  return Math.floor(facenum / divid);
5081
5196
  }
5197
+ textForTwizzleExplorer() {
5198
+ return `Faces ${this.baseplanerot.length}
5199
+ Stickers per face ${this.stickersperface}
5200
+ Short edge ${this.shortedge}
5201
+ Cubies ${this.cubies.length}
5202
+ Edge distance ${this.edgedistance}
5203
+ Vertex distance ${this.vertexdistance}`;
5204
+ }
5205
+ writeSchreierSims(tw) {
5206
+ const os = this.getOrbitsDef(false);
5207
+ const as = os.reassemblySize();
5208
+ tw(`Reassembly size is ${as}`);
5209
+ const ss = schreierSims(this.getMovesAsPerms(), tw);
5210
+ const r = as / ss;
5211
+ tw(`Ratio is ${r}`);
5212
+ }
5082
5213
  };
5083
5214
  var PGNotation = class {
5084
5215
  constructor(pg, od) {
@@ -5094,8 +5225,8 @@ var PGNotation = class {
5094
5225
  const mv = this.pg.parseMove(move);
5095
5226
  if (this.pg.parsedmovelist) {
5096
5227
  let found = false;
5097
- for (let i = 0; i < this.pg.parsedmovelist.length; i++) {
5098
- 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]) {
5228
+ for (const parsedmove of this.pg.parsedmovelist) {
5229
+ if (parsedmove[1] === mv[1] && parsedmove[2] === mv[2] && parsedmove[3] === mv[3] && parsedmove[4] === mv[4]) {
5099
5230
  found = true;
5100
5231
  }
5101
5232
  }
@@ -5109,7 +5240,7 @@ var PGNotation = class {
5109
5240
  bits = [slices - mv[3], slices - mv[2]];
5110
5241
  }
5111
5242
  const pgmv = this.pg.getMoveFromBits(bits, mv[5], !mv[4], this.pg.cmovesbyslice[mv[1]], void 0, this.pg.movesetorders[mv[1]]);
5112
- const r = OrbitsDef.transformToKPuzzle(this.orbitNames, pgmv);
5243
+ const r = PGOrbitsDef.transformToKPuzzle(this.orbitNames, pgmv);
5113
5244
  this.cache[key] = r;
5114
5245
  return r;
5115
5246
  }
@@ -5126,144 +5257,6 @@ var PGNotation = class {
5126
5257
  }
5127
5258
  };
5128
5259
 
5129
- // src/cubing/puzzle-geometry/SchreierSims.ts
5130
- var FactoredNumber = class {
5131
- constructor() {
5132
- this.mult = [];
5133
- }
5134
- multiply(n) {
5135
- for (let f = 2; f * f <= n; f++) {
5136
- while (n % f === 0) {
5137
- if (this.mult[f] !== void 0) {
5138
- this.mult[f]++;
5139
- } else {
5140
- this.mult[f] = 1;
5141
- }
5142
- n /= f;
5143
- }
5144
- }
5145
- if (n > 1) {
5146
- if (this.mult[n] !== void 0) {
5147
- this.mult[n]++;
5148
- } else {
5149
- this.mult[n] = 1;
5150
- }
5151
- }
5152
- }
5153
- toString() {
5154
- let r = "";
5155
- for (let i = 0; i < this.mult.length; i++) {
5156
- if (this.mult[i] !== void 0) {
5157
- if (r !== "") {
5158
- r += "*";
5159
- }
5160
- r += i;
5161
- if (this.mult[i] > 1) {
5162
- r += "^" + this.mult[i];
5163
- }
5164
- }
5165
- }
5166
- return r;
5167
- }
5168
- };
5169
- function schreierSims(g, disp) {
5170
- const n = g[0].p.length;
5171
- const e = identity(n);
5172
- let sgs = [];
5173
- let sgsi = [];
5174
- let sgslen = [];
5175
- let Tk = [];
5176
- let Tklen = [];
5177
- function resolve(p) {
5178
- for (let i = p.p.length - 1; i >= 0; i--) {
5179
- const j = p.p[i];
5180
- if (j !== i) {
5181
- if (!sgs[i][j]) {
5182
- return false;
5183
- }
5184
- p = p.mul(sgsi[i][j]);
5185
- }
5186
- }
5187
- return true;
5188
- }
5189
- function knutha(k, p, len) {
5190
- Tk[k].push(p);
5191
- Tklen[k].push(len);
5192
- for (let i = 0; i < sgs[k].length; i++) {
5193
- if (sgs[k][i]) {
5194
- knuthb(k, sgs[k][i].mul(p), len + sgslen[k][i]);
5195
- }
5196
- }
5197
- }
5198
- function knuthb(k, p, len) {
5199
- const j = p.p[k];
5200
- if (!sgs[k][j]) {
5201
- sgs[k][j] = p;
5202
- sgsi[k][j] = p.inv();
5203
- sgslen[k][j] = len;
5204
- for (let i = 0; i < Tk[k].length; i++) {
5205
- knuthb(k, p.mul(Tk[k][i]), len + Tklen[k][i]);
5206
- }
5207
- return;
5208
- }
5209
- const p2 = p.mul(sgsi[k][j]);
5210
- if (!resolve(p2)) {
5211
- knutha(k - 1, p2, len + sgslen[k][j]);
5212
- }
5213
- }
5214
- function getsgs() {
5215
- sgs = [];
5216
- sgsi = [];
5217
- Tk = [];
5218
- sgslen = [];
5219
- Tklen = [];
5220
- for (let i = 0; i < n; i++) {
5221
- sgs.push([]);
5222
- sgsi.push([]);
5223
- sgslen.push([]);
5224
- Tk.push([]);
5225
- Tklen.push([]);
5226
- sgs[i][i] = e;
5227
- sgsi[i][i] = e;
5228
- sgslen[i][i] = 0;
5229
- }
5230
- let none = 0;
5231
- let sz = 1;
5232
- for (let i = 0; i < g.length; i++) {
5233
- knutha(n - 1, g[i], 1);
5234
- sz = 1;
5235
- let tks = 0;
5236
- let sollen = 0;
5237
- const avgs = [];
5238
- const mults = new FactoredNumber();
5239
- for (let j = 0; j < n; j++) {
5240
- let cnt = 0;
5241
- let lensum = 0;
5242
- for (let k = 0; k < n; k++) {
5243
- if (sgs[j][k]) {
5244
- cnt++;
5245
- lensum += sgslen[j][k];
5246
- if (j !== k) {
5247
- none++;
5248
- }
5249
- }
5250
- }
5251
- tks += Tk[j].length;
5252
- sz *= cnt;
5253
- if (cnt > 1) {
5254
- mults.multiply(cnt);
5255
- }
5256
- const avg = lensum / cnt;
5257
- avgs.push(avg);
5258
- sollen += avg;
5259
- }
5260
- disp("" + i + ": sz " + sz + " T " + tks + " sol " + sollen + " none " + none + " mults " + mults);
5261
- }
5262
- return sz;
5263
- }
5264
- return getsgs();
5265
- }
5266
-
5267
5260
  // src/bin/puzzle-geometry-bin.ts
5268
5261
  var dosvg = false;
5269
5262
  var doss = false;
@@ -5400,23 +5393,31 @@ if (typeof process !== "undefined" && process.argv && process.argv.length >= 3)
5400
5393
  break;
5401
5394
  }
5402
5395
  }
5403
- let createargs = [];
5396
+ let puzzleDescription;
5404
5397
  if (showargs) {
5405
5398
  console.log("# " + process.argv.join(" "));
5406
5399
  }
5407
5400
  if (desc !== void 0) {
5408
- createargs = parsedesc(desc);
5401
+ const parsed = parsePuzzleDescription(desc);
5402
+ if (parsed === null) {
5403
+ throw new Error("Could not parse puzzle description!");
5404
+ }
5405
+ puzzleDescription = parsed;
5409
5406
  argp++;
5410
5407
  } else {
5411
5408
  const cuts = [];
5412
5409
  const cutarg = argp++;
5413
5410
  while (argp + 1 < process.argv.length && process.argv[argp].length === 1) {
5414
- cuts.push([process.argv[argp], process.argv[argp + 1]]);
5411
+ cuts.push({
5412
+ cutType: process.argv[argp],
5413
+ distance: parseFloat(process.argv[argp + 1])
5414
+ });
5415
5415
  argp += 2;
5416
5416
  }
5417
- createargs = [process.argv[cutarg], cuts];
5417
+ puzzleDescription = { shape: process.argv[cutarg], cuts };
5418
5418
  }
5419
- const pg = new PuzzleGeometry(createargs[0], createargs[1], optionlist);
5419
+ const options = parsePGOptionList(optionlist);
5420
+ const pg = new PuzzleGeometry(puzzleDescription, options);
5420
5421
  pg.allstickers();
5421
5422
  pg.genperms();
5422
5423
  if (argp < process.argv.length) {
@@ -5431,12 +5432,7 @@ if (typeof process !== "undefined" && process.argv && process.argv.length >= 3)
5431
5432
  } else if (do3d) {
5432
5433
  console.log(JSON.stringify(pg.get3d()));
5433
5434
  } else if (doss) {
5434
- const os = pg.getOrbitsDef(false);
5435
- const as = os.reassemblySize();
5436
- console.log("Reassembly size is " + as);
5437
- const ss = schreierSims(os.moveops.map((_) => _.toPerm()), (_) => console.log(_));
5438
- const r = as / ss;
5439
- console.log("Ratio is " + r);
5435
+ pg.writeSchreierSims(console.log);
5440
5436
  } else if (docanon) {
5441
5437
  pg.showcanon((_) => console.log(_));
5442
5438
  }