cubing 0.21.1 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (528) hide show
  1. package/README.md +4 -7
  2. package/{src/cubing/kpuzzle → dist}/.DS_Store +0 -0
  3. package/dist/bin/order.js +16675 -0
  4. package/dist/bin/order.js.map +7 -0
  5. package/dist/bin/puzzle-geometry-bin.js +13 -9
  6. package/dist/bin/puzzle-geometry-bin.js.map +2 -2
  7. package/dist/bundle-global/cubing.bundle-global.js +555 -298
  8. package/dist/esm/3d-M7GBIT3X.js +21 -0
  9. package/dist/esm/3d-M7GBIT3X.js.map +7 -0
  10. package/dist/esm/alg/index.js +1 -1
  11. package/dist/esm/bluetooth/index.js +10 -8
  12. package/dist/esm/bluetooth/index.js.map +3 -3
  13. package/dist/esm/{chunk-RE7MIN5R.js → chunk-4IUYLRHT.js} +2 -2
  14. package/dist/esm/{chunk-RE7MIN5R.js.map → chunk-4IUYLRHT.js.map} +0 -0
  15. package/dist/esm/{chunk-CSVAFZSB.js → chunk-6BZSKSG7.js} +724 -735
  16. package/dist/esm/chunk-6BZSKSG7.js.map +7 -0
  17. package/dist/esm/{chunk-BU5PUJK3.js → chunk-EWRBHQFX.js} +1 -1
  18. package/dist/esm/{chunk-BU5PUJK3.js.map → chunk-EWRBHQFX.js.map} +1 -1
  19. package/dist/esm/{chunk-APIIMJG6.js → chunk-GF76PWEV.js} +450 -1052
  20. package/dist/esm/chunk-GF76PWEV.js.map +7 -0
  21. package/dist/esm/{chunk-MUQMBH2S.js → chunk-R3HRHYIW.js} +16 -4
  22. package/dist/esm/chunk-R3HRHYIW.js.map +7 -0
  23. package/dist/esm/{chunk-YV3RT5PX.js → chunk-X6JHXPDX.js} +2 -2
  24. package/dist/esm/{chunk-YV3RT5PX.js.map → chunk-X6JHXPDX.js.map} +0 -0
  25. package/dist/esm/esm-test-worker.js +2 -2
  26. package/dist/esm/esm-test-worker.js.map +2 -2
  27. package/dist/esm/kpuzzle/index.js +2 -2
  28. package/dist/esm/{node-WEHVBEKP.js → node-HFBX5WHK.js} +2 -2
  29. package/dist/esm/{node-WEHVBEKP.js.map → node-HFBX5WHK.js.map} +1 -1
  30. package/dist/esm/{node-BSAQKO3G.js → node-SP4L2AKI.js} +2 -2
  31. package/dist/esm/{node-BSAQKO3G.js.map → node-SP4L2AKI.js.map} +1 -1
  32. package/dist/esm/notation/index.js +2 -2
  33. package/dist/esm/protocol/index.js +2 -2
  34. package/dist/esm/puzzle-geometry/index.js +14 -10
  35. package/dist/esm/puzzle-geometry/index.js.map +2 -2
  36. package/dist/esm/puzzles/index.js +3 -3
  37. package/dist/esm/scramble/index.js +4 -4
  38. package/dist/esm/search/index.js +4 -4
  39. package/dist/esm/stream/index.js +1 -1
  40. package/dist/esm/twisty/index.js +729 -2346
  41. package/dist/esm/twisty/index.js.map +3 -3
  42. package/dist/esm/worker-inside-generated-string-RQYYANYQ.js +3107 -0
  43. package/dist/esm/worker-inside-generated-string-RQYYANYQ.js.map +7 -0
  44. package/dist/types/alg/index.d.ts +1 -0
  45. package/dist/types/alg/index.d.ts.map +1 -1
  46. package/dist/types/alg/units/leaves/Move.d.ts +1 -1
  47. package/dist/types/alg/units/leaves/Move.d.ts.map +1 -1
  48. package/dist/types/bluetooth/smart-puzzle/gan.d.ts.map +1 -1
  49. package/dist/types/cubing.bundle-global.d.ts +1 -24
  50. package/dist/types/cubing.bundle-global.d.ts.map +1 -1
  51. package/dist/types/cubing.bundle-global.exports.d.ts +25 -0
  52. package/dist/types/cubing.bundle-global.exports.d.ts.map +1 -0
  53. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts +3 -0
  54. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts.map +1 -1
  55. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +7 -3
  56. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts.map +1 -1
  57. package/dist/types/puzzle-geometry/index.d.ts +1 -1
  58. package/dist/types/puzzle-geometry/index.d.ts.map +1 -1
  59. package/dist/types/puzzles/index.d.ts +1 -1
  60. package/dist/types/puzzles/index.d.ts.map +1 -1
  61. package/dist/types/puzzles/stickerings/cube-stickerings.d.ts.map +1 -1
  62. package/dist/types/search/inside/api.d.ts.map +1 -1
  63. package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts +1 -1
  64. package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts.map +1 -1
  65. package/dist/types/search/inside/solve/puzzles/fto.d.ts +6 -0
  66. package/dist/types/search/inside/solve/puzzles/fto.d.ts.map +1 -0
  67. package/dist/types/search/inside/solve/puzzles/fto.sgs.json.d.ts +5 -0
  68. package/dist/types/search/inside/solve/puzzles/fto.sgs.json.d.ts.map +1 -0
  69. package/dist/types/search/inside/solve/tremble.d.ts.map +1 -1
  70. package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
  71. package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
  72. package/dist/types/twisty/{old/animation/cursor/CursorTypes.d.ts → controllers/AnimationTypes.d.ts} +10 -3
  73. package/dist/types/twisty/controllers/AnimationTypes.d.ts.map +1 -0
  74. package/dist/types/twisty/{old/animation → controllers}/RenderScheduler.d.ts +0 -0
  75. package/dist/types/twisty/controllers/RenderScheduler.d.ts.map +1 -0
  76. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +1 -1
  77. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -1
  78. package/dist/types/twisty/{old/animation → controllers}/easing.d.ts +0 -0
  79. package/dist/types/twisty/controllers/easing.d.ts.map +1 -0
  80. package/dist/types/twisty/{old/animation → controllers}/indexer/AlgDuration.d.ts +2 -2
  81. package/dist/types/twisty/controllers/indexer/AlgDuration.d.ts.map +1 -0
  82. package/dist/types/twisty/{old/animation → controllers}/indexer/AlgIndexer.d.ts +3 -3
  83. package/dist/types/twisty/controllers/indexer/AlgIndexer.d.ts.map +1 -0
  84. package/dist/types/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.d.ts +3 -3
  85. package/dist/types/twisty/controllers/indexer/SimpleAlgIndexer.d.ts.map +1 -0
  86. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +3 -3
  87. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +1 -0
  88. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +3 -3
  89. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +1 -0
  90. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.d.ts +2 -2
  91. package/dist/types/twisty/controllers/indexer/simultaneous-moves/simul-moves.d.ts.map +1 -0
  92. package/dist/types/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.d.ts +2 -2
  93. package/dist/types/twisty/controllers/indexer/tree/AlgWalker.d.ts.map +1 -0
  94. package/dist/types/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.d.ts +3 -3
  95. package/dist/types/twisty/controllers/indexer/tree/TreeAlgIndexer.d.ts.map +1 -0
  96. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts +3 -0
  97. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts.map +1 -0
  98. package/dist/types/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.d.ts +2 -2
  99. package/dist/types/twisty/controllers/stream/timeline-move-calculation-draft.d.ts.map +1 -0
  100. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +1 -2
  101. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +1 -1
  102. package/dist/types/twisty/index.d.ts +9 -12
  103. package/dist/types/twisty/index.d.ts.map +1 -1
  104. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +11 -0
  105. package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -1
  106. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +1 -1
  107. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -1
  108. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts +6 -0
  109. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts.map +1 -0
  110. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +5 -1
  111. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -1
  112. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +46 -1
  113. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -1
  114. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +2 -2
  115. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -1
  116. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +1 -1
  117. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -1
  118. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +1 -1
  119. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -1
  120. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +1 -1
  121. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -1
  122. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +5 -2
  123. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -1
  124. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +2 -2
  125. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -1
  126. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +2 -2
  127. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -1
  128. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts +11 -0
  129. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts.map +1 -0
  130. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts +10 -0
  131. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts.map +1 -0
  132. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +5 -1
  133. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -1
  134. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +1 -1
  135. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -1
  136. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +19 -1
  137. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -1
  138. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +1 -1
  139. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -1
  140. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +2 -3
  141. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -1
  142. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +1 -1
  143. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -1
  144. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +1 -1
  145. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -1
  146. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +6 -1
  147. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -1
  148. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +5 -1
  149. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -1
  150. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +5 -1
  151. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -1
  152. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +18 -5
  153. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -1
  154. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +6 -6
  155. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -1
  156. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +2 -2
  157. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -1
  158. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +5 -1
  159. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -1
  160. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +7 -1
  161. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -1
  162. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +1 -1
  163. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -1
  164. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts +3 -0
  165. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts.map +1 -0
  166. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +4 -6
  167. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +1 -1
  168. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +1 -1
  169. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +1 -1
  170. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +2 -2
  171. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +1 -1
  172. package/dist/types/twisty/views/3D/DragTracker.d.ts +28 -0
  173. package/dist/types/twisty/views/3D/DragTracker.d.ts.map +1 -0
  174. package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -1
  175. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +6 -1
  176. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -1
  177. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +9 -4
  178. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -1
  179. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts +3 -0
  180. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts.map +1 -0
  181. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +12 -8
  182. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -1
  183. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts +24 -0
  184. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts.map +1 -0
  185. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts +5 -0
  186. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts.map +1 -0
  187. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts +4 -4
  188. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +1 -1
  189. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +17 -10
  190. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +1 -1
  191. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts +1 -1
  192. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +1 -1
  193. package/dist/types/twisty/{old/dom/element → views}/ClassListManager.d.ts +0 -0
  194. package/dist/types/twisty/views/ClassListManager.d.ts.map +1 -0
  195. package/dist/types/twisty/{old/dom/element → views}/ManagedCustomElement.d.ts +0 -0
  196. package/dist/types/twisty/views/ManagedCustomElement.d.ts.map +1 -0
  197. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +1 -1
  198. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +1 -1
  199. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +1 -1
  200. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +1 -1
  201. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +2 -1
  202. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -1
  203. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +1 -1
  204. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +1 -1
  205. package/dist/types/twisty/views/TwistyAlgViewer.d.ts +2 -2
  206. package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +1 -1
  207. package/dist/types/twisty/views/TwistyPlayer.css.d.ts +3 -0
  208. package/dist/types/twisty/views/TwistyPlayer.css.d.ts.map +1 -0
  209. package/dist/types/twisty/views/TwistyPlayer.d.ts +7 -3
  210. package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -1
  211. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +7 -4
  212. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -1
  213. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts +3 -0
  214. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts.map +1 -0
  215. package/dist/types/twisty/{old/dom/viewers → views}/canvas.d.ts +0 -0
  216. package/dist/types/twisty/views/canvas.d.ts.map +1 -0
  217. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts +4 -0
  218. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts.map +1 -0
  219. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +1 -1
  220. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -1
  221. package/dist/types/twisty/views/control-panel/TwistyScrubber.css.d.ts +3 -0
  222. package/dist/types/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.d.ts.map +1 -1
  223. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +1 -1
  224. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -1
  225. package/dist/types/twisty/{old/dom/element → views}/node-custom-element-shims.d.ts +0 -0
  226. package/dist/types/twisty/views/node-custom-element-shims.d.ts.map +1 -0
  227. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts +3 -0
  228. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts.map +1 -0
  229. package/dist/types/twisty/{old/dom → views}/stream/TwistyStreamSource.d.ts +1 -1
  230. package/dist/types/twisty/views/stream/TwistyStreamSource.d.ts.map +1 -0
  231. package/dist/types/{search/vendor → vendor}/comlink-everywhere/inside/index.d.ts +0 -0
  232. package/dist/types/vendor/comlink-everywhere/inside/index.d.ts.map +1 -0
  233. package/dist/types/{search/vendor → vendor}/comlink-everywhere/inside/node.d.ts +0 -0
  234. package/dist/types/vendor/comlink-everywhere/inside/node.d.ts.map +1 -0
  235. package/dist/types/{search/vendor → vendor}/comlink-everywhere/outside/index.d.ts +0 -0
  236. package/dist/types/vendor/comlink-everywhere/outside/index.d.ts.map +1 -0
  237. package/dist/types/{search/vendor → vendor}/comlink-everywhere/outside/node.d.ts +0 -0
  238. package/dist/types/vendor/comlink-everywhere/outside/node.d.ts.map +1 -0
  239. package/dist/types/{search/inside/solve/vendor → vendor}/cstimer/src/js/lib/mathlib.d.ts +0 -0
  240. package/dist/types/vendor/cstimer/src/js/lib/mathlib.d.ts.map +1 -0
  241. package/dist/types/{search/inside/solve/vendor → vendor}/cstimer/src/js/scramble/scramble_444.d.ts +1 -1
  242. package/dist/types/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +1 -0
  243. package/dist/types/{search/inside/solve/vendor → vendor}/min2phase/gwt.d.ts +0 -0
  244. package/dist/types/vendor/min2phase/gwt.d.ts.map +1 -0
  245. package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/get-random-values.d.ts +0 -0
  246. package/dist/types/vendor/random-uint-below/get-random-values.d.ts.map +1 -0
  247. package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/index.d.ts +1 -1
  248. package/dist/types/vendor/random-uint-below/index.d.ts.map +1 -0
  249. package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/random-choice.d.ts +0 -0
  250. package/dist/types/vendor/random-uint-below/random-choice.d.ts.map +1 -0
  251. package/dist/types/{search/inside/solve/vendor/random-uint-below/random-int.d.ts → vendor/random-uint-below/random53BitValue.d.ts} +1 -1
  252. package/dist/types/vendor/random-uint-below/random53BitValue.d.ts.map +1 -0
  253. package/dist/types/{search/inside/solve/vendor → vendor}/sq12phase/scramble_sq1.d.ts +0 -0
  254. package/dist/types/vendor/sq12phase/scramble_sq1.d.ts.map +1 -0
  255. package/dist/types/{bluetooth/smart-puzzle → vendor/unsafe-raw-aes}/unsafe-raw-aes.d.ts +0 -0
  256. package/dist/types/vendor/unsafe-raw-aes/unsafe-raw-aes.d.ts.map +1 -0
  257. package/docs/.DS_Store +0 -0
  258. package/docs/cubing/.DS_Store +0 -0
  259. package/docs/cubing/api/index.html +11 -52
  260. package/docs/cubing/index.html +67 -27
  261. package/docs/main.css +7 -6
  262. package/package.json +8 -9
  263. package/src/cubing/.DS_Store +0 -0
  264. package/src/cubing/alg/index.ts +1 -0
  265. package/src/cubing/alg/units/leaves/Move.ts +1 -1
  266. package/src/cubing/bluetooth/smart-puzzle/gan.ts +4 -1
  267. package/src/cubing/bluetooth/smart-timer/GanTimer.ts +1 -1
  268. package/src/cubing/cubing.bundle-global.exports.ts +25 -0
  269. package/src/cubing/cubing.bundle-global.ts +3 -27
  270. package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +4 -0
  271. package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +20 -8
  272. package/src/cubing/puzzle-geometry/index.ts +2 -2
  273. package/src/cubing/puzzles/.DS_Store +0 -0
  274. package/src/cubing/puzzles/implementations/.DS_Store +0 -0
  275. package/src/cubing/puzzles/index.ts +1 -1
  276. package/src/cubing/puzzles/stickerings/cube-stickerings.ts +18 -0
  277. package/src/cubing/puzzles/stickerings/global-custom-stickering-hack.ts +1 -1
  278. package/src/cubing/search/.DS_Store +0 -0
  279. package/src/cubing/search/esm-test-worker.js +1 -1
  280. package/src/cubing/search/inside/.DS_Store +0 -0
  281. package/src/cubing/search/inside/api.ts +3 -0
  282. package/src/cubing/search/inside/entry.js +1 -1
  283. package/src/cubing/search/inside/inside-worker.ts +1 -1
  284. package/src/cubing/search/inside/solve/.DS_Store +0 -0
  285. package/src/cubing/search/inside/solve/addOrientationSuffix.ts +1 -1
  286. package/src/cubing/{alg → search/inside/solve/puzzles}/.DS_Store +0 -0
  287. package/src/cubing/search/inside/solve/puzzles/2x2x2.ts +1 -1
  288. package/src/cubing/search/inside/solve/puzzles/3x3x3/index.ts +2 -2
  289. package/src/cubing/search/inside/solve/puzzles/4x4x4.ts +2 -2
  290. package/src/cubing/search/inside/solve/puzzles/big-cubes.ts +1 -1
  291. package/src/cubing/search/inside/solve/puzzles/clock.ts +1 -1
  292. package/src/cubing/search/inside/solve/puzzles/{FTO.sgs → fto.sgs.json.ts} +116 -80
  293. package/src/cubing/search/inside/solve/puzzles/fto.ts +58 -0
  294. package/src/cubing/search/inside/solve/puzzles/sq1.ts +1 -1
  295. package/src/cubing/search/inside/solve/puzzles/wca-minx.ts +1 -1
  296. package/src/cubing/search/inside/solve/tremble.ts +2 -1
  297. package/src/cubing/search/inside/solve/vendor/.DS_Store +0 -0
  298. package/src/cubing/search/instantiator.ts +1 -1
  299. package/src/cubing/search/worker-inside-generated-string.js +1 -1
  300. package/src/cubing/twisty/.DS_Store +0 -0
  301. package/src/cubing/{alg/units → twisty/controllers}/.DS_Store +0 -0
  302. package/src/cubing/twisty/{old/animation/cursor/CursorTypes.ts → controllers/AnimationTypes.ts} +11 -2
  303. package/src/cubing/twisty/{old/animation → controllers}/RenderScheduler.ts +0 -0
  304. package/src/cubing/twisty/controllers/TwistyAnimationController.ts +4 -4
  305. package/src/cubing/twisty/controllers/animation/.DS_Store +0 -0
  306. package/src/cubing/twisty/{old/animation → controllers}/easing.ts +0 -0
  307. package/src/cubing/{stream → twisty/controllers/indexer}/.DS_Store +0 -0
  308. package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgDuration.ts +2 -2
  309. package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgIndexer.ts +4 -4
  310. package/src/cubing/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.ts +4 -4
  311. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +3 -3
  312. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +3 -3
  313. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.ts +2 -2
  314. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.ts +4 -4
  315. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.ts +3 -3
  316. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/chunkAlgs.ts +2 -2
  317. package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -0
  318. package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.ts +2 -2
  319. package/src/cubing/twisty/heavy-code-imports/.DS_Store +0 -0
  320. package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +2 -12
  321. package/src/cubing/twisty/index.ts +12 -19
  322. package/src/cubing/twisty/model/.DS_Store +0 -0
  323. package/src/cubing/twisty/model/TwistyPlayerModel.ts +38 -7
  324. package/src/cubing/twisty/model/props/.DS_Store +0 -0
  325. package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +3 -3
  326. package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
  327. package/src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts +9 -0
  328. package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +6 -1
  329. package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +49 -1
  330. package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +1 -1
  331. package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +2 -2
  332. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +2 -2
  333. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +1 -1
  334. package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +1 -1
  335. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +12 -5
  336. package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +2 -2
  337. package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +2 -2
  338. package/src/cubing/twisty/model/props/puzzle/state/MovePressInputProp.ts +14 -0
  339. package/src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts +20 -0
  340. package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +7 -1
  341. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +1 -1
  342. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +20 -1
  343. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +1 -1
  344. package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +5 -3
  345. package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +1 -4
  346. package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +1 -1
  347. package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +7 -1
  348. package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +6 -1
  349. package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +5 -1
  350. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +83 -12
  351. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +8 -8
  352. package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +2 -2
  353. package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +5 -1
  354. package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +8 -1
  355. package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +1 -1
  356. package/src/cubing/twisty/old/.DS_Store +0 -0
  357. package/src/cubing/twisty/old/animation/.DS_Store +0 -0
  358. package/src/cubing/twisty/old/dom/.DS_Store +0 -0
  359. package/src/cubing/twisty/views/.DS_Store +0 -0
  360. package/src/cubing/twisty/{old/dom/viewers/Twisty2DSVGView.css.ts → views/2D/Twisty2DPuzzle.css.ts} +1 -1
  361. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +8 -12
  362. package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +1 -1
  363. package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +4 -4
  364. package/src/cubing/{bluetooth → twisty/views/3D}/.DS_Store +0 -0
  365. package/src/cubing/twisty/views/3D/DragTracker.ts +184 -0
  366. package/src/cubing/twisty/views/3D/RendererPool.ts +2 -1
  367. package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +51 -5
  368. package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +51 -10
  369. package/src/cubing/twisty/{old/dom/viewers/Twisty3DCanvas.css.ts → views/3D/Twisty3DVantage.css.ts} +2 -2
  370. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +103 -35
  371. package/src/cubing/twisty/views/3D/TwistyOrbitControls.spec.ts +213 -0
  372. package/src/cubing/twisty/views/3D/TwistyOrbitControls.ts +176 -0
  373. package/src/cubing/twisty/views/3D/puzzles/Cube3D.ts +5 -9
  374. package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +127 -37
  375. package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +1 -1
  376. package/src/cubing/twisty/{old/dom/element → views}/ClassListManager.ts +0 -0
  377. package/src/cubing/twisty/{old/dom/element → views}/ManagedCustomElement.ts +0 -0
  378. package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +1 -1
  379. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.ts +1 -1
  380. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +11 -4
  381. package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +1 -1
  382. package/src/cubing/twisty/views/TwistyAlgViewer.ts +4 -4
  383. package/src/cubing/twisty/{old/dom → views}/TwistyPlayer.css.ts +4 -1
  384. package/src/cubing/twisty/views/TwistyPlayer.ts +16 -25
  385. package/src/cubing/twisty/views/TwistyPlayerSettable.ts +14 -10
  386. package/src/cubing/twisty/{old/dom/viewers → views}/TwistyViewerWrapper.css.ts +1 -1
  387. package/src/cubing/twisty/{old/dom/viewers → views}/canvas.ts +0 -0
  388. package/src/cubing/twisty/{old/dom/controls/buttons.css.ts → views/control-panel/TwistyButtonsV2.css.ts} +1 -1
  389. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +5 -8
  390. package/src/cubing/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.ts +1 -1
  391. package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +3 -3
  392. package/src/cubing/twisty/{old/dom/element → views}/node-custom-element-shims.ts +2 -2
  393. package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.css.ts +1 -1
  394. package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.ts +9 -9
  395. package/src/cubing/vendor/.DS_Store +0 -0
  396. package/src/cubing/{twisty/old/animation/indexer → vendor/comlink-everywhere}/.DS_Store +0 -0
  397. package/src/cubing/{search/vendor → vendor}/comlink-everywhere/comlink-everywhere.webloc +0 -0
  398. package/src/cubing/{search/vendor → vendor}/comlink-everywhere/inside/index.d.ts +0 -0
  399. package/src/cubing/{search/vendor → vendor}/comlink-everywhere/inside/index.js +0 -0
  400. package/src/cubing/{search/vendor → vendor}/comlink-everywhere/inside/node.js +0 -0
  401. package/src/cubing/{search/vendor → vendor}/comlink-everywhere/outside/index.d.ts +0 -0
  402. package/src/cubing/{search/vendor → vendor}/comlink-everywhere/outside/index.js +0 -0
  403. package/src/cubing/{search/vendor → vendor}/comlink-everywhere/outside/node.js +0 -0
  404. package/src/cubing/vendor/cstimer/.DS_Store +0 -0
  405. package/src/cubing/{search/inside/solve/vendor → vendor}/cstimer/LICENSE +0 -0
  406. package/src/cubing/{search/inside/solve/vendor → vendor}/cstimer/src/js/lib/mathlib.ts +0 -0
  407. package/src/cubing/{search/inside/solve/vendor → vendor}/cstimer/src/js/scramble/scramble_444.ts +3 -3
  408. package/src/cubing/{search/inside/solve/vendor → vendor}/min2phase/gwt.d.ts +0 -0
  409. package/src/cubing/{search/inside/solve/vendor → vendor}/min2phase/gwt.js +0 -0
  410. package/src/cubing/vendor/random-uint-below/get-random-values.ts +23 -0
  411. package/src/cubing/{search/inside/solve/vendor → vendor}/random-uint-below/index.ts +2 -2
  412. package/src/cubing/{search/inside/solve/vendor → vendor}/random-uint-below/random-choice.ts +1 -1
  413. package/src/cubing/{search/inside/solve/vendor/random-uint-below/random-int.ts → vendor/random-uint-below/random53BitValue.ts} +0 -0
  414. package/src/cubing/{search/inside/solve/vendor → vendor}/sq12phase/scramble_sq1.js +0 -0
  415. package/src/cubing/{bluetooth/smart-puzzle → vendor/unsafe-raw-aes}/unsafe-raw-aes.ts +18 -20
  416. package/dist/esm/3d-B25DP5PE.js +0 -39
  417. package/dist/esm/3d-B25DP5PE.js.map +0 -7
  418. package/dist/esm/chunk-APIIMJG6.js.map +0 -7
  419. package/dist/esm/chunk-CSVAFZSB.js.map +0 -7
  420. package/dist/esm/chunk-MUQMBH2S.js.map +0 -7
  421. package/dist/esm/worker-inside-generated-string-KDZOUGJF.js +0 -2831
  422. package/dist/esm/worker-inside-generated-string-KDZOUGJF.js.map +0 -7
  423. package/dist/types/bluetooth/smart-puzzle/unsafe-raw-aes.d.ts.map +0 -1
  424. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts.map +0 -1
  425. package/dist/types/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +0 -1
  426. package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts.map +0 -1
  427. package/dist/types/search/inside/solve/vendor/random-uint-below/get-random-values.d.ts.map +0 -1
  428. package/dist/types/search/inside/solve/vendor/random-uint-below/index.d.ts.map +0 -1
  429. package/dist/types/search/inside/solve/vendor/random-uint-below/random-choice.d.ts.map +0 -1
  430. package/dist/types/search/inside/solve/vendor/random-uint-below/random-int.d.ts.map +0 -1
  431. package/dist/types/search/inside/solve/vendor/sq12phase/scramble_sq1.d.ts.map +0 -1
  432. package/dist/types/search/vendor/comlink-everywhere/inside/index.d.ts.map +0 -1
  433. package/dist/types/search/vendor/comlink-everywhere/inside/node.d.ts.map +0 -1
  434. package/dist/types/search/vendor/comlink-everywhere/outside/index.d.ts.map +0 -1
  435. package/dist/types/search/vendor/comlink-everywhere/outside/node.d.ts.map +0 -1
  436. package/dist/types/twisty/old/animation/RenderScheduler.d.ts.map +0 -1
  437. package/dist/types/twisty/old/animation/Timeline.d.ts +0 -72
  438. package/dist/types/twisty/old/animation/Timeline.d.ts.map +0 -1
  439. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts +0 -53
  440. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts.map +0 -1
  441. package/dist/types/twisty/old/animation/cursor/CursorTypes.d.ts.map +0 -1
  442. package/dist/types/twisty/old/animation/easing.d.ts.map +0 -1
  443. package/dist/types/twisty/old/animation/indexer/AlgDuration.d.ts.map +0 -1
  444. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +0 -1
  445. package/dist/types/twisty/old/animation/indexer/SimpleAlgIndexer.d.ts.map +0 -1
  446. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
  447. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +0 -1
  448. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
  449. package/dist/types/twisty/old/animation/indexer/tree/AlgWalker.d.ts.map +0 -1
  450. package/dist/types/twisty/old/animation/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
  451. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts +0 -3
  452. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts.map +0 -1
  453. package/dist/types/twisty/old/animation/stream/timeline-move-calculation-draft.d.ts.map +0 -1
  454. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts +0 -3
  455. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts.map +0 -1
  456. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts +0 -52
  457. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts.map +0 -1
  458. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts +0 -3
  459. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +0 -1
  460. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts +0 -92
  461. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts.map +0 -1
  462. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts +0 -5
  463. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts.map +0 -1
  464. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts +0 -165
  465. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +0 -1
  466. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts +0 -2
  467. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts.map +0 -1
  468. package/dist/types/twisty/old/dom/controls/TwistyScrubber.css.d.ts +0 -3
  469. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts +0 -14
  470. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts.map +0 -1
  471. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts +0 -4
  472. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts.map +0 -1
  473. package/dist/types/twisty/old/dom/controls/buttons.d.ts +0 -40
  474. package/dist/types/twisty/old/dom/controls/buttons.d.ts.map +0 -1
  475. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts +0 -5
  476. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts.map +0 -1
  477. package/dist/types/twisty/old/dom/element/ClassListManager.d.ts.map +0 -1
  478. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts +0 -49
  479. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts.map +0 -1
  480. package/dist/types/twisty/old/dom/element/ManagedCustomElement.d.ts.map +0 -1
  481. package/dist/types/twisty/old/dom/element/node-custom-element-shims.d.ts.map +0 -1
  482. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts +0 -3
  483. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts.map +0 -1
  484. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.d.ts.map +0 -1
  485. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts +0 -26
  486. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts.map +0 -1
  487. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts +0 -3
  488. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts.map +0 -1
  489. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts +0 -3
  490. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts.map +0 -1
  491. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts +0 -41
  492. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +0 -1
  493. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts +0 -59
  494. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts.map +0 -1
  495. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts +0 -4
  496. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts.map +0 -1
  497. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts +0 -3
  498. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts.map +0 -1
  499. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts +0 -18
  500. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts.map +0 -1
  501. package/dist/types/twisty/old/dom/viewers/canvas.d.ts.map +0 -1
  502. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +0 -41
  503. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +0 -1
  504. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts +0 -5
  505. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts.map +0 -1
  506. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts +0 -9
  507. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
  508. package/src/cubing/search/inside/solve/vendor/random-uint-below/get-random-values.ts +0 -38
  509. package/src/cubing/twisty/old/animation/Timeline.ts +0 -378
  510. package/src/cubing/twisty/old/animation/cursor/AlgCursor.ts +0 -252
  511. package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.css.ts +0 -25
  512. package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.ts +0 -516
  513. package/src/cubing/twisty/old/dom/TwistyPlayer.spec.ts +0 -25
  514. package/src/cubing/twisty/old/dom/TwistyPlayer.ts +0 -927
  515. package/src/cubing/twisty/old/dom/TwistyPlayerConfig.ts +0 -378
  516. package/src/cubing/twisty/old/dom/controls/TwistyControlElement.ts +0 -1
  517. package/src/cubing/twisty/old/dom/controls/TwistyScrubber.ts +0 -53
  518. package/src/cubing/twisty/old/dom/controls/buttons.spec.ts +0 -37
  519. package/src/cubing/twisty/old/dom/controls/buttons.ts +0 -326
  520. package/src/cubing/twisty/old/dom/element/ElementConfig.ts +0 -180
  521. package/src/cubing/twisty/old/dom/viewers/Twisty2DSVG.ts +0 -118
  522. package/src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.ts +0 -256
  523. package/src/cubing/twisty/old/dom/viewers/TwistyOrbitControls.ts +0 -420
  524. package/src/cubing/twisty/old/dom/viewers/TwistyViewerElement.ts +0 -5
  525. package/src/cubing/twisty/old/dom/viewers/TwistyViewerWrapper.ts +0 -45
  526. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +0 -209
  527. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +0 -270
  528. package/src/cubing/twisty/views/3D/puzzles/TwistyTestBox.ts +0 -22
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/cubing/alg/common.ts", "../../src/cubing/alg/iteration.ts", "../../src/cubing/alg/limits.ts", "../../src/cubing/alg/AlgBuilder.ts", "../../src/cubing/alg/units/containers/Commutator.ts", "../../src/cubing/alg/units/containers/Conjugate.ts", "../../src/cubing/alg/units/leaves/LineComment.ts", "../../src/cubing/alg/units/leaves/Newline.ts", "../../src/cubing/alg/units/leaves/Pause.ts", "../../src/cubing/alg/parse.ts", "../../src/cubing/alg/warnOnce.ts", "../../src/cubing/alg/units/QuantumWithAmount.ts", "../../src/cubing/alg/units/leaves/Move.ts", "../../src/cubing/alg/units/containers/Grouping.ts", "../../src/cubing/alg/units/index.ts", "../../src/cubing/alg/is.ts", "../../src/cubing/alg/traversal.ts", "../../src/cubing/alg/Alg.ts", "../../src/cubing/alg/example.ts", "../../src/cubing/alg/keyboard.ts", "../../src/cubing/alg/url.ts", "../../src/cubing/alg/operation.ts", "../../src/cubing/alg/index.ts", "../../src/cubing/kpuzzle/transformations.ts", "../../src/cubing/kpuzzle/kpuzzle.ts", "../../src/cubing/kpuzzle/canonicalize.ts", "../../src/cubing/kpuzzle/parser/parser-peggy.js", "../../src/cubing/kpuzzle/parser/parser-shim.ts", "../../src/cubing/kpuzzle/parser/index.ts", "../../src/cubing/kpuzzle/svg.ts", "../../src/cubing/kpuzzle/3x3x3/3x3x3.kpuzzle.json.ts", "../../src/cubing/protocol/binary/orbit-indexing.ts", "../../src/cubing/protocol/binary/puzzle-orientation.ts", "../../src/cubing/protocol/binary/binary3x3x3.ts", "../../src/cubing/protocol/binary/hex.ts", "../../src/cubing/protocol/index.ts", "../../src/cubing/kpuzzle/puzzle-orientation.ts", "../../src/cubing/kpuzzle/index.ts", "../../src/cubing/puzzle-geometry/FaceNameSwizzler.ts", "../../src/cubing/puzzle-geometry/notation-mapping/NullMapper.ts", "../../src/cubing/puzzle-geometry/notation-mapping/FTONotationMapper.ts", "../../src/cubing/puzzle-geometry/notation-mapping/FaceRenamingMapper.ts", "../../src/cubing/puzzle-geometry/notation-mapping/MegaminxScramblingNotationMapper.ts", "../../src/cubing/puzzle-geometry/notation-mapping/NxNxNCubeMapper.ts", "../../src/cubing/puzzle-geometry/notation-mapping/PyraminxNotationMapper.ts", "../../src/cubing/puzzle-geometry/notation-mapping/SkewbNotationMapper.ts", "../../src/cubing/puzzle-geometry/notation-mapping/index.ts", "../../src/cubing/puzzle-geometry/Options.ts", "../../src/cubing/puzzle-geometry/Perm.ts", "../../src/cubing/puzzle-geometry/PermOriSet.ts", "../../src/cubing/puzzle-geometry/PGPuzzles.ts", "../../src/cubing/puzzle-geometry/Quat.ts", "../../src/cubing/puzzle-geometry/PlatonicGenerator.ts", "../../src/cubing/puzzle-geometry/SchreierSims.ts", "../../src/cubing/puzzle-geometry/PuzzleGeometry.ts", "../../src/cubing/puzzle-geometry/index.ts", "../../src/cubing/twisty/model/PromiseFreshener.ts", "../../src/cubing/vendor/p-lazy/p-lazy.ts", "../../src/cubing/twisty/model/props/TwistyProp.ts", "../../src/cubing/puzzles/customPGPuzzleLoader.ts", "../../src/cubing/puzzles/stickerings/appearance.ts", "../../src/cubing/puzzles/stickerings/global-custom-stickering-hack.ts", "../../src/cubing/puzzles/stickerings/cube-stickerings.ts", "../../src/cubing/puzzles/async/async-pg3d.ts", "../../src/cubing/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json.ts", "../../src/cubing/puzzles/implementations/2x2x2/2x2x2.kpuzzle.svg.ts", "../../src/cubing/puzzles/implementations/2x2x2/index.ts", "../../src/cubing/puzzles/implementations/3x3x3/3x3x3.kpuzzle.svg.ts", "../../src/cubing/puzzles/implementations/3x3x3/3x3x3-ll.kpuzzle.svg.ts", "../../src/cubing/puzzles/implementations/3x3x3/index.ts", "../../src/cubing/puzzles/implementations/clock/clock.kpuzzle.json.ts", "../../src/cubing/puzzles/implementations/clock/clock.kpuzzle.svg.ts", "../../src/cubing/puzzles/implementations/clock/index.ts", "../../src/cubing/puzzles/stickerings/fto-stickerings.ts", "../../src/cubing/puzzles/implementations/fto/index.ts", "../../src/cubing/puzzles/stickerings/megaminx-stickerings.ts", "../../src/cubing/puzzles/implementations/megaminx/index.ts", "../../src/cubing/puzzles/implementations/pyraminx/pyraminx.kpuzzle.svg.ts", "../../src/cubing/puzzles/implementations/pyraminx/index.ts", "../../src/cubing/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json.ts", "../../src/cubing/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.svg.ts", "../../src/cubing/puzzles/implementations/square1/index.ts", "../../src/cubing/puzzles/index.ts", "../../src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts", "../../src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts", "../../src/cubing/twisty/controllers/easing.ts", "../../src/cubing/twisty/views/3D/TAU.ts", "../../src/cubing/twisty/views/3D/puzzles/Cube3D.ts", "../../src/cubing/twisty/views/3D/puzzles/PG3D.ts", "../../src/cubing/twisty/views/3D/Twisty3DScene.ts", "../../src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts", "../../src/bin/order.ts", "../../src/cubing/twisty/controllers/AnimationTypes.ts", "../../src/cubing/twisty/controllers/RenderScheduler.ts", "../../src/cubing/twisty/controllers/TwistyAnimationController.ts", "../../src/cubing/twisty/model/helpers.ts", "../../src/cubing/twisty/controllers/TwistyPlayerController.ts", "../../src/cubing/twisty/model/props/viewer/ControlPanelProp.ts", "../../src/cubing/twisty/views/ClassListManager.ts", "../../src/cubing/twisty/views/node-custom-element-shims.ts", "../../src/cubing/twisty/views/ManagedCustomElement.ts", "../../src/cubing/twisty/views/TwistyPlayer.css.ts", "../../src/cubing/twisty/heavy-code-imports/3d.ts", "../../src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts", "../../src/cubing/twisty/views/TwistyViewerWrapper.css.ts", "../../src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts", "../../src/cubing/twisty/views/2D/Twisty2DPuzzle.ts", "../../src/cubing/twisty/views/2D/Twisty2DPuzzle.css.ts", "../../src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts", "../../src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts", "../../src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts", "../../src/cubing/twisty/views/3D/Twisty3DVantage.ts", "../../src/cubing/twisty/views/canvas.ts", "../../src/cubing/twisty/views/3D/Twisty3DVantage.css.ts", "../../src/cubing/twisty/views/3D/DragTracker.ts", "../../src/cubing/twisty/views/3D/RendererPool.ts", "../../src/cubing/twisty/views/3D/TwistyOrbitControls.ts", "../../src/cubing/twisty/views/control-panel/TwistyButtonsV2.css.ts", "../../src/cubing/twisty/views/document.ts", "../../src/cubing/twisty/views/control-panel/webkit-fullscreen.ts", "../../src/cubing/twisty/model/props/viewer/ButtonAppearanceProp.ts", "../../src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts", "../../src/cubing/twisty/views/control-panel/TwistyScrubber.css.ts", "../../src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts", "../../src/cubing/twisty/views/screenshot.ts", "../../src/cubing/twisty/model/props/puzzle/state/AlgProp.ts", "../../src/cubing/twisty/model/props/viewer/BackgroundProp.ts", "../../src/cubing/twisty/model/props/viewer/BackViewProp.ts", "../../src/cubing/twisty/model/TwistyPlayerModel.ts", "../../src/cubing/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.ts", "../../src/cubing/twisty/model/props/viewer/LatitudeLimit.ts", "../../src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts", "../../src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts", "../../src/cubing/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.ts", "../../src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts", "../../src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts", "../../src/cubing/twisty/model/props/timeline/TempoScaleProp.ts", "../../src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts", "../../src/cubing/twisty/model/props/general/URLProp.ts", "../../src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts", "../../src/cubing/twisty/model/props/viewer/VisualizationProp.ts", "../../src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts", "../../src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts", "../../src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts", "../../src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts", "../../src/cubing/notation/CountMoves.ts", "../../src/cubing/notation/CountAnimatedLeaves.ts", "../../src/cubing/twisty/controllers/indexer/SimpleAlgIndexer.ts", "../../src/cubing/twisty/controllers/indexer/AlgDuration.ts", "../../src/cubing/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts", "../../src/cubing/twisty/controllers/indexer/simultaneous-moves/simul-moves.ts", "../../src/cubing/twisty/controllers/indexer/tree/chunkAlgs.ts", "../../src/cubing/twisty/controllers/indexer/tree/AlgWalker.ts", "../../src/cubing/twisty/controllers/indexer/tree/TreeAlgIndexer.ts", "../../src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/PuzzleAlgProp.ts", "../../src/cubing/twisty/views/3D/puzzles/KPuzzleWrapper.ts", "../../src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts", "../../src/cubing/twisty/model/props/viewer/TimeRangeProp.ts", "../../src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts", "../../src/cubing/twisty/model/props/timeline/CoarseTimelineInfoProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts", "../../src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts", "../../src/cubing/twisty/model/props/puzzle/structure/PuzzleDefProp.ts", "../../src/cubing/twisty/model/UserVisibleErrorTracker.ts", "../../src/cubing/twisty/model/props/puzzle/state/CatchUpMoveProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts", "../../src/cubing/twisty/model/props/puzzle/state/MovePressInputProp.ts", "../../src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts", "../../src/cubing/twisty/views/TwistyPlayerSettable.ts", "../../src/cubing/twisty/views/TwistyPlayer.ts", "../../src/cubing/twisty/views/TwistyAlgViewer.ts", "../../src/cubing/twisty/views/TwistyAlgViewer.css.ts", "../../src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts", "../../src/cubing/twisty/views/TwistyAlgEditor/model.ts", "../../src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts", "../../src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.ts", "../../src/cubing/twisty/index.ts"],
4
+ "sourcesContent": ["import type { Alg } from \"./Alg\";\nimport type { IterationDirection } from \"./iteration\";\nimport type { LeafUnit, Unit } from \"./units/Unit\";\n\nlet writeAlgDebugField = false;\nexport function setAlgDebugField(debug: boolean): void {\n writeAlgDebugField = debug;\n}\n\nexport abstract class Comparable {\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n is(c: any): boolean {\n return this instanceof c;\n }\n\n as<T>(c: new (...args: any) => T): T | null {\n return this instanceof c ? this : null;\n }\n\n abstract isIdentical(other: Comparable): boolean;\n}\n\nexport interface Repeatable extends Comparable {\n experimentalExpand(\n iterDir?: IterationDirection,\n depth?: number,\n ): Generator<LeafUnit>;\n}\n\n// Common to algs or units\nexport abstract class AlgCommon<T extends Alg | Unit>\n extends Comparable\n implements Repeatable\n{\n constructor() {\n super();\n if (writeAlgDebugField) {\n Object.defineProperty(this, \"_debugStr\", {\n get: () => {\n return this.toString();\n },\n });\n }\n }\n\n get log(): (message?: any) => void {\n // By returning a (bound) version of `console.log`, we ensure that DevTools\n // logs the call site instead of this function.\n return console.log.bind(console, this, this.toString()) as (\n message?: any,\n ) => void;\n }\n\n abstract toString(): string;\n\n abstract invert(): T;\n\n abstract experimentalExpand(iterDir: IterationDirection): Generator<LeafUnit>;\n}\n", "export enum IterationDirection {\n Forwards = 1,\n Backwards = -1,\n}\n\nexport function toggleDirection(\n iterationDirection: IterationDirection,\n flip: boolean = true,\n): IterationDirection {\n if (!flip) {\n return iterationDirection;\n }\n switch (iterationDirection) {\n case IterationDirection.Forwards:\n return IterationDirection.Backwards;\n case IterationDirection.Backwards:\n return IterationDirection.Forwards;\n }\n}\n\nexport function direct<T>(\n g: Iterable<T>,\n iterDir: IterationDirection,\n): Iterable<T> {\n return iterDir === IterationDirection.Backwards ? Array.from(g).reverse() : g;\n}\n\nexport function reverse<T>(g: Iterable<T>): Iterable<T> {\n return Array.from(g).reverse();\n}\n\nexport function* directedGenerator<T>(\n g: Generator<T>,\n direction: IterationDirection,\n): Generator<T> {\n direction === IterationDirection.Backwards\n ? yield* reverseGenerator(g)\n : yield* g;\n}\n\nexport function* reverseGenerator<T>(g: Generator<T>): Generator<T> {\n for (const t of Array.from(g).reverse()) {\n yield t;\n }\n}\n", "export const MAX_INT = 0x7fffffff; // 2^32-1, the max value for signed 32-bit ints.\nexport const MAX_INT_DESCRIPTION = \"2^31 - 1\";\nexport const MIN_INT = -0x80000000;\nexport const MINT_INT_DESCRIPTION = \"-2^31\";\n", "import { Alg } from \"./Alg\";\nimport type { Unit } from \"./units/Unit\";\n\nexport class AlgBuilder {\n #units: Unit[] = [];\n\n push(u: Unit): void {\n this.#units.push(u);\n }\n\n // TODO: Allow FlexibleAlgSource?\n /** @deprecated */\n experimentalPushAlg(alg: Alg): void {\n // TODO: Optimize?\n for (const u of alg.units()) {\n this.push(u);\n }\n }\n\n // TODO: can we guarantee this to be fast in the permanent API?\n experimentalNumUnits(): number {\n return this.#units.length;\n }\n\n // can be called multiple times, even if you push units inbetween.\n toAlg(): Alg {\n return new Alg(this.#units);\n }\n\n reset(): void {\n this.#units = [];\n }\n}\n", "import { Alg, experimentalEnsureAlg, FlexibleAlgSource } from \"../../Alg\";\nimport { AlgCommon, Comparable } from \"../../common\";\nimport { IterationDirection } from \"../../iteration\";\nimport type { LeafUnit } from \"../Unit\";\n\nexport class Commutator extends AlgCommon<Commutator> {\n readonly #A: Alg;\n readonly #B: Alg;\n\n constructor(aSource: FlexibleAlgSource, bSource: FlexibleAlgSource) {\n super();\n this.#A = experimentalEnsureAlg(aSource);\n this.#B = experimentalEnsureAlg(bSource);\n }\n\n get A(): Alg {\n return this.#A;\n }\n\n get B(): Alg {\n return this.#B;\n }\n\n isIdentical(other: Comparable): boolean {\n const otherAsCommutator = other.as(Commutator);\n return !!(\n otherAsCommutator?.A.isIdentical(this.A) &&\n otherAsCommutator?.B.isIdentical(this.B)\n );\n }\n\n invert(): Commutator {\n return new Commutator(this.#B, this.#A);\n }\n\n *experimentalExpand(\n iterDir: IterationDirection = IterationDirection.Forwards,\n depth?: number,\n ): Generator<LeafUnit> {\n depth ??= Infinity;\n if (depth === 0) {\n yield iterDir === IterationDirection.Forwards ? this : this.invert();\n } else {\n if (iterDir === IterationDirection.Forwards) {\n yield* this.A.experimentalExpand(\n IterationDirection.Forwards,\n depth - 1,\n );\n yield* this.B.experimentalExpand(\n IterationDirection.Forwards,\n depth - 1,\n );\n yield* this.A.experimentalExpand(\n IterationDirection.Backwards,\n depth - 1,\n );\n yield* this.B.experimentalExpand(\n IterationDirection.Backwards,\n depth - 1,\n );\n } else {\n yield* this.B.experimentalExpand(\n IterationDirection.Forwards,\n depth - 1,\n );\n yield* this.A.experimentalExpand(\n IterationDirection.Forwards,\n depth - 1,\n );\n yield* this.B.experimentalExpand(\n IterationDirection.Backwards,\n depth - 1,\n );\n yield* this.A.experimentalExpand(\n IterationDirection.Backwards,\n depth - 1,\n );\n }\n }\n }\n\n toString(): string {\n return `[${this.#A.toString()}, ${this.#B.toString()}]`;\n }\n}\n", "import { Alg, experimentalEnsureAlg, FlexibleAlgSource } from \"../../Alg\";\nimport { AlgCommon, Comparable } from \"../../common\";\nimport { IterationDirection } from \"../../iteration\";\nimport type { LeafUnit } from \"../Unit\";\n\nexport class Conjugate extends AlgCommon<Conjugate> {\n readonly #A: Alg;\n readonly #B: Alg;\n\n constructor(aSource: FlexibleAlgSource, bSource: FlexibleAlgSource) {\n super();\n this.#A = experimentalEnsureAlg(aSource);\n this.#B = experimentalEnsureAlg(bSource);\n }\n\n get A(): Alg {\n return this.#A;\n }\n\n get B(): Alg {\n return this.#B;\n }\n\n isIdentical(other: Comparable): boolean {\n const otherAsConjugate = other.as(Conjugate);\n return !!(\n otherAsConjugate?.A.isIdentical(this.A) &&\n otherAsConjugate?.B.isIdentical(this.B)\n );\n }\n\n invert(): Conjugate {\n return new Conjugate(this.#A, this.#B.invert());\n }\n\n *experimentalExpand(\n iterDir: IterationDirection,\n depth?: number,\n ): Generator<LeafUnit> {\n depth ??= Infinity;\n if (depth === 0) {\n yield iterDir === IterationDirection.Forwards ? this : this.invert();\n } else {\n yield* this.A.experimentalExpand(IterationDirection.Forwards, depth - 1);\n yield* this.B.experimentalExpand(iterDir, depth - 1);\n yield* this.A.experimentalExpand(IterationDirection.Backwards, depth - 1);\n }\n }\n\n toString(): string {\n return `[${this.A}: ${this.B}]`;\n }\n}\n", "import { AlgCommon, Comparable } from \"../../common\";\nimport { IterationDirection } from \"../../iteration\";\nimport type { LeafUnit } from \"../Unit\";\n\n// TODO: hash\n// TODO: this conflicts with the HTML `LineComment` class\nexport class LineComment extends AlgCommon<LineComment> {\n readonly #text: string;\n\n constructor(commentText: string) {\n super();\n if (commentText.includes(\"\\n\") || commentText.includes(\"\\r\")) {\n throw new Error(\"LineComment cannot contain newline\");\n }\n this.#text = commentText;\n }\n\n get text(): string {\n return this.#text;\n }\n\n isIdentical(other: Comparable): boolean {\n const otherAsLineComment = other as LineComment;\n return other.is(LineComment) && this.#text === otherAsLineComment.#text;\n }\n\n invert(): LineComment {\n return this;\n }\n\n *experimentalExpand(\n _iterDir: IterationDirection = IterationDirection.Forwards,\n _depth: number = Infinity,\n ): Generator<LeafUnit> {\n yield this;\n }\n\n toString(): string {\n return `//${this.#text}`;\n }\n\n // toJSON(): LineCommentJSON {\n // return {\n // type: \"comment\",\n // text: this.#text,\n // };\n // }\n}\n", "import { AlgCommon, Comparable } from \"../../common\";\nimport { IterationDirection } from \"../../iteration\";\nimport type { LeafUnit } from \"../Unit\";\n\nexport class Newline extends AlgCommon<Newline> {\n toString(): string {\n return `\\n`;\n }\n\n isIdentical(other: Comparable): boolean {\n return other.is(Newline);\n }\n\n invert(): Newline {\n return this;\n }\n\n *experimentalExpand(\n _iterDir: IterationDirection = IterationDirection.Forwards,\n _depth: number = Infinity,\n ): Generator<LeafUnit> {\n yield this;\n }\n}\n", "import { AlgCommon, Comparable } from \"../../common\";\nimport { IterationDirection } from \"../../iteration\";\nimport type { LeafUnit } from \"../Unit\";\n\nexport class Pause extends AlgCommon<Pause> {\n toString(): string {\n return `.`;\n }\n\n isIdentical(other: Comparable): boolean {\n return other.is(Pause);\n }\n\n invert(): Pause {\n return this;\n }\n\n *experimentalExpand(\n _iterDir: IterationDirection = IterationDirection.Forwards,\n _depth: number = Infinity,\n ): Generator<LeafUnit> {\n yield this;\n }\n}\n", "import { Alg } from \"./Alg\";\nimport { AlgBuilder } from \"./AlgBuilder\";\nimport type { Unit } from \"./units\";\nimport { Commutator } from \"./units/containers/Commutator\";\nimport { Conjugate } from \"./units/containers/Conjugate\";\nimport { Grouping } from \"./units/containers/Grouping\";\nimport { LineComment } from \"./units/leaves/LineComment\";\nimport { Move, QuantumMove } from \"./units/leaves/Move\";\nimport { Newline } from \"./units/leaves/Newline\";\nimport { Pause } from \"./units/leaves/Pause\";\n\ntype StoppingChar = \",\" | \":\" | \"]\" | \")\";\n\nfunction parseIntWithEmptyFallback<T>(n: string, emptyFallback: T): number | T {\n return n ? parseInt(n) : emptyFallback;\n}\n\nconst amountRegex = /^(\\d+)?('?)/;\nconst moveStartRegex = /^[_\\dA-Za-z]/; // TODO: Handle slash\nconst quantumMoveRegex = /^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/;\nconst commentTextRegex = /^[^\\n]*/;\nconst square1PairStart = /^(-?\\d+), ?/; // TODO: match up with other whitespace handling?\nconst square1PairEnd = /^(-?\\d+)\\)/; // TODO: match up with other whitespace handling?\n\nexport function parseAlg(s: string): Alg {\n return new AlgParser().parseAlg(s);\n}\n\nexport function parseMove(s: string): Move {\n return new AlgParser().parseMove(s);\n}\n\nexport function parseQuantumMove(s: string): QuantumMove {\n return new AlgParser().parseQuantumMove(s);\n}\n\nexport interface ParserIndexed {\n startCharIndex: number;\n endCharIndex: number;\n}\n\nexport type Parsed<T extends Alg | Unit> = T & ParserIndexed;\n\n// TODO: attach to parser so the end char index can default to `this.#idx`?\nfunction addCharIndices<T extends Alg | Unit>(\n t: T,\n startCharIndex: number,\n endCharIndex: number,\n): Parsed<T> {\n const parsedT = t as ParserIndexed & T;\n parsedT.startCharIndex = startCharIndex;\n parsedT.endCharIndex = endCharIndex;\n return parsedT;\n}\n\nexport function transferCharIndex<T extends Alg | Unit>(from: T, to: T): T {\n if (\"startCharIndex\" in from) {\n (to as Parsed<T>).startCharIndex = (from as Parsed<T>).startCharIndex;\n }\n if (\"endCharIndex\" in from) {\n (to as Parsed<T>).endCharIndex = (from as Parsed<T>).endCharIndex;\n }\n return to;\n}\n\ntype MoveSuffix = \"+\" | \"++\" | \"-\" | \"--\";\n\n// TODO: support recording string locations for moves.\nclass AlgParser {\n #input: string = \"\";\n #idx: number = 0;\n\n parseAlg(input: string): Parsed<Alg> {\n this.#input = input;\n this.#idx = 0;\n const alg = this.parseAlgWithStopping([]);\n this.mustBeAtEndOfInput();\n return alg;\n }\n\n parseMove(input: string): Parsed<Move> {\n this.#input = input;\n this.#idx = 0;\n const move = this.parseMoveImpl();\n this.mustBeAtEndOfInput();\n return move;\n }\n\n parseQuantumMove(input: string): QuantumMove {\n this.#input = input;\n this.#idx = 0;\n const quantumMove = this.parseQuantumMoveImpl();\n this.mustBeAtEndOfInput();\n return quantumMove;\n }\n\n private mustBeAtEndOfInput() {\n if (this.#idx !== this.#input.length) {\n throw new Error(\"parsing unexpectedly ended early\");\n }\n }\n\n private parseAlgWithStopping(stopBefore: StoppingChar[]): Parsed<Alg> {\n let algStartIdx = this.#idx;\n let algEndIdx = this.#idx;\n const algBuilder = new AlgBuilder();\n\n // We're \"crowded\" if there was not a space or newline since the last unit.\n let crowded = false;\n\n const mustNotBeCrowded = (idx: number): void => {\n if (crowded) {\n throw new Error(\n `Unexpected character at index ${idx}. Are you missing a space?`,\n ); // TODO better error message\n }\n };\n\n mainLoop: while (this.#idx < this.#input.length) {\n const savedCharIndex = this.#idx;\n if ((stopBefore as string[]).includes(this.#input[this.#idx])) {\n return addCharIndices(algBuilder.toAlg(), algStartIdx, algEndIdx);\n }\n if (this.tryConsumeNext(\" \")) {\n crowded = false;\n if (algBuilder.experimentalNumUnits() === 0) {\n algStartIdx = this.#idx;\n }\n continue mainLoop;\n } else if (moveStartRegex.test(this.#input[this.#idx])) {\n mustNotBeCrowded(savedCharIndex);\n const move = this.parseMoveImpl();\n algBuilder.push(move);\n crowded = true;\n algEndIdx = this.#idx;\n continue mainLoop;\n } else if (this.tryConsumeNext(\"(\")) {\n mustNotBeCrowded(savedCharIndex);\n const sq1PairStartMatch = this.tryRegex(square1PairStart);\n if (sq1PairStartMatch) {\n const topAmountString = sq1PairStartMatch[1];\n const savedCharIndexD = this.#idx;\n const sq1PairEndMatch = this.parseRegex(square1PairEnd);\n const uMove = addCharIndices(\n new Move(new QuantumMove(\"U_SQ_\"), parseInt(topAmountString)),\n savedCharIndex + 1,\n savedCharIndex + 1 + topAmountString.length,\n );\n const dMove = addCharIndices(\n new Move(new QuantumMove(\"D_SQ_\"), parseInt(sq1PairEndMatch[1])),\n savedCharIndexD,\n this.#idx - 1,\n );\n const alg = addCharIndices(\n new Alg([uMove, dMove]),\n savedCharIndex + 1,\n this.#idx - 1,\n );\n algBuilder.push(\n addCharIndices(new Grouping(alg), savedCharIndex, this.#idx),\n );\n crowded = true;\n algEndIdx = this.#idx;\n continue mainLoop;\n } else {\n const alg = this.parseAlgWithStopping([\")\"]);\n this.mustConsumeNext(\")\");\n const amount = this.parseAmount();\n algBuilder.push(\n addCharIndices(\n new Grouping(alg, amount),\n savedCharIndex,\n this.#idx,\n ),\n );\n crowded = true;\n algEndIdx = this.#idx;\n continue mainLoop;\n }\n } else if (this.tryConsumeNext(\"[\")) {\n mustNotBeCrowded(savedCharIndex);\n const A = this.parseAlgWithStopping([\",\", \":\"]);\n const separator = this.popNext();\n const B = this.parseAlgWithStopping([\"]\"]);\n this.mustConsumeNext(\"]\");\n switch (separator) {\n case \":\":\n algBuilder.push(\n addCharIndices(new Conjugate(A, B), savedCharIndex, this.#idx),\n );\n crowded = true;\n algEndIdx = this.#idx;\n continue mainLoop;\n case \",\":\n algBuilder.push(\n addCharIndices(new Commutator(A, B), savedCharIndex, this.#idx),\n );\n crowded = true;\n algEndIdx = this.#idx;\n continue mainLoop;\n default:\n throw \"unexpected parsing error\";\n }\n } else if (this.tryConsumeNext(\"\\n\")) {\n algBuilder.push(\n addCharIndices(new Newline(), savedCharIndex, this.#idx),\n );\n crowded = false;\n algEndIdx = this.#idx;\n continue mainLoop;\n } else if (this.tryConsumeNext(\"/\")) {\n if (this.tryConsumeNext(\"/\")) {\n mustNotBeCrowded(savedCharIndex);\n const [text] = this.parseRegex(commentTextRegex);\n algBuilder.push(\n addCharIndices(new LineComment(text), savedCharIndex, this.#idx),\n );\n crowded = false;\n algEndIdx = this.#idx;\n continue mainLoop;\n } else {\n // We allow crowding here to account for csTimer scrambles, which don't have a space between a Square-1 tuple and the following slash.\n algBuilder.push(\n addCharIndices(new Move(\"_SLASH_\"), savedCharIndex, this.#idx),\n );\n crowded = true;\n algEndIdx = this.#idx;\n continue mainLoop;\n }\n } else if (this.tryConsumeNext(\".\")) {\n mustNotBeCrowded(savedCharIndex);\n algBuilder.push(addCharIndices(new Pause(), savedCharIndex, this.#idx));\n crowded = true;\n algEndIdx = this.#idx;\n continue mainLoop;\n } else {\n throw new Error(`Unexpected character: ${this.popNext()}`);\n }\n }\n\n if (this.#idx !== this.#input.length) {\n throw new Error(\"did not finish parsing?\");\n }\n if (stopBefore.length > 0) {\n throw new Error(\"expected stopping\");\n }\n return addCharIndices(algBuilder.toAlg(), algStartIdx, algEndIdx);\n }\n\n private parseQuantumMoveImpl(): QuantumMove {\n const [, , , outerLayerStr, innerLayerStr, family] =\n this.parseRegex(quantumMoveRegex);\n\n return new QuantumMove(\n family,\n parseIntWithEmptyFallback(innerLayerStr, undefined),\n parseIntWithEmptyFallback(outerLayerStr, undefined),\n );\n }\n\n private parseMoveImpl(): Parsed<Move> {\n const savedCharIndex = this.#idx;\n\n if (this.tryConsumeNext(\"/\")) {\n return addCharIndices(new Move(\"_SLASH_\"), savedCharIndex, this.#idx);\n }\n\n let quantumMove = this.parseQuantumMoveImpl();\n // Only `hadEmptyAbsAmount` is `const`.\n // eslint-disable-next-line prefer-const\n let [amount, hadEmptyAbsAmount] = this.parseAmountAndTrackEmptyAbsAmount();\n const suffix = this.parseMoveSuffix();\n\n if (suffix) {\n if (amount < 0) {\n throw new Error(\"uh-oh\");\n }\n if ((suffix === \"++\" || suffix === \"--\") && amount !== 1) {\n // TODO: Handle 1 vs. null\n throw new Error(\n \"Pochmann ++ or -- moves cannot have an amount other than 1.\",\n );\n }\n if ((suffix === \"++\" || suffix === \"--\") && !hadEmptyAbsAmount) {\n throw new Error(\n \"Pochmann ++ or -- moves cannot have an amount written as a number.\",\n );\n }\n if ((suffix === \"+\" || suffix === \"-\") && hadEmptyAbsAmount) {\n throw new Error(\n \"Clock dial moves must have an amount written as a natural number followed by + or -.\",\n );\n }\n if (suffix.startsWith(\"+\")) {\n quantumMove = quantumMove.modified({\n family: `${quantumMove.family}_${\n suffix === \"+\" ? \"PLUS\" : \"PLUSPLUS\"\n }_`, // TODO\n });\n }\n if (suffix.startsWith(\"-\")) {\n quantumMove = quantumMove.modified({\n family: `${quantumMove.family}_${\n suffix === \"-\" ? \"PLUS\" : \"PLUSPLUS\"\n }_`, // TODO\n });\n amount *= -1;\n }\n }\n\n const move = addCharIndices(\n new Move(quantumMove, amount),\n savedCharIndex,\n this.#idx,\n );\n return move;\n }\n\n private parseMoveSuffix(): MoveSuffix | null {\n if (this.tryConsumeNext(\"+\")) {\n if (this.tryConsumeNext(\"+\")) {\n return \"++\";\n }\n return \"+\";\n }\n if (this.tryConsumeNext(\"-\")) {\n if (this.tryConsumeNext(\"-\")) {\n return \"--\";\n }\n return \"-\";\n }\n return null;\n }\n\n private parseAmountAndTrackEmptyAbsAmount(): [number, boolean] {\n const savedIdx = this.#idx;\n const [, absAmountStr, primeStr] = this.parseRegex(amountRegex);\n if (absAmountStr?.startsWith(\"0\") && absAmountStr !== \"0\") {\n throw new Error(\n `Error at char index ${savedIdx}: An amount can only start with 0 if it's exactly the digit 0.`,\n );\n }\n return [\n parseIntWithEmptyFallback(absAmountStr, 1) * (primeStr === \"'\" ? -1 : 1),\n !absAmountStr,\n ];\n }\n\n private parseAmount(): number {\n const savedIdx = this.#idx;\n const [, absAmountStr, primeStr] = this.parseRegex(amountRegex);\n if (absAmountStr?.startsWith(\"0\") && absAmountStr !== \"0\") {\n throw new Error(\n `Error at char index ${savedIdx}: An amount number can only start with 0 if it's exactly the digit 0.`,\n );\n }\n return (\n parseIntWithEmptyFallback(absAmountStr, 1) * (primeStr === \"'\" ? -1 : 1)\n );\n }\n\n private parseRegex(regex: RegExp): RegExpExecArray {\n const arr = regex.exec(this.remaining());\n if (arr === null) {\n throw new Error(\"internal parsing error\"); // TODO\n }\n this.#idx += arr[0].length;\n return arr;\n }\n\n // TOD: can we avoid this?\n private tryRegex(regex: RegExp): RegExpExecArray | null {\n const arr = regex.exec(this.remaining());\n if (arr === null) {\n return null;\n }\n this.#idx += arr[0].length;\n return arr;\n }\n\n private remaining(): string {\n return this.#input.slice(this.#idx);\n }\n\n private popNext(): string {\n const next = this.#input[this.#idx];\n this.#idx++;\n return next;\n }\n\n private tryConsumeNext(expected: string): boolean {\n if (this.#input[this.#idx] === expected) {\n this.#idx++;\n return true;\n }\n return false;\n }\n\n private mustConsumeNext(expected: string): string {\n const next = this.popNext();\n if (next !== expected) {\n throw new Error(\n `expected \\`${expected}\\` while parsing, encountered ${next}`,\n ); // TODO: be more helpful\n }\n return next;\n }\n}\n", "const warned = new Set<string>();\nexport function warnOnce(s: string): void {\n if (!warned.has(s)) {\n console.warn(s);\n warned.add(s);\n }\n}\n", "import type { Repeatable } from \"../common\";\nimport { IterationDirection, toggleDirection } from \"../iteration\";\nimport { MAX_INT, MAX_INT_DESCRIPTION, MIN_INT } from \"../limits\";\nimport type { LeafUnit } from \"./Unit\";\n\nexport class QuantumWithAmount<Q extends Repeatable> {\n readonly quantum: Q;\n readonly amount: number;\n\n constructor(quantum: Q, amount: number = 1) {\n this.quantum = quantum;\n this.amount = amount;\n\n if (\n !Number.isInteger(this.amount) ||\n this.amount < MIN_INT ||\n this.amount > MAX_INT\n ) {\n throw new Error(\n `Unit amount absolute value must be a non-negative integer from ${MAX_INT_DESCRIPTION} to ${MAX_INT_DESCRIPTION}.`,\n );\n }\n }\n\n suffix(): string {\n let s: string = \"\";\n // TODO\n const absAmount = Math.abs(this.amount);\n if (absAmount !== 1) {\n s += absAmount;\n }\n if (this.amount < 0) {\n s += \"'\";\n }\n return s;\n }\n\n isIdentical(other: QuantumWithAmount<Q>): boolean {\n return (\n this.quantum.isIdentical(other.quantum) && this.amount === other.amount\n );\n }\n\n // TODO: `Conjugate` and `Commutator` decrement `depth` inside the quantum, `Grouping` has to do it outside the quantum.\n *experimentalExpand(\n iterDir: IterationDirection,\n depth: number,\n ): Generator<LeafUnit> {\n const absAmount = Math.abs(this.amount);\n const newIterDir = toggleDirection(iterDir, this.amount < 0);\n for (let i = 0; i < absAmount; i++) {\n yield* this.quantum.experimentalExpand(newIterDir, depth);\n }\n }\n}\n", "import { AlgCommon, Comparable } from \"../../common\";\nimport { IterationDirection } from \"../../iteration\";\nimport { MAX_INT, MAX_INT_DESCRIPTION } from \"../../limits\";\nimport { parseMove, parseQuantumMove, transferCharIndex } from \"../../parse\";\nimport { warnOnce } from \"../../warnOnce\";\nimport { QuantumWithAmount } from \"../QuantumWithAmount\";\nimport type { LeafUnit } from \"../Unit\";\n\ninterface QuantumMoveModifications {\n outerLayer?: number;\n innerLayer?: number;\n family?: string;\n}\n\nexport class QuantumMove extends Comparable {\n readonly #family: string;\n readonly #innerLayer: number | null;\n readonly #outerLayer: number | null;\n\n constructor(\n family: string,\n innerLayer?: number | null,\n outerLayer?: number | null,\n ) {\n super();\n this.#family = family;\n this.#innerLayer = innerLayer ?? null;\n this.#outerLayer = outerLayer ?? null;\n Object.freeze(this);\n\n if (\n this.#innerLayer !== null &&\n (!Number.isInteger(this.#innerLayer) ||\n this.#innerLayer < 1 ||\n this.#innerLayer > MAX_INT)\n ) {\n throw new Error(\n `QuantumMove inner layer must be a positive integer below ${MAX_INT_DESCRIPTION}.`,\n );\n }\n\n if (\n this.#outerLayer !== null &&\n (!Number.isInteger(this.#outerLayer) ||\n this.#outerLayer < 1 ||\n this.#outerLayer > MAX_INT)\n ) {\n throw new Error(\n `QuantumMove outer layer must be a positive integer below ${MAX_INT_DESCRIPTION}.`,\n );\n }\n\n if (\n this.#outerLayer !== null &&\n this.#innerLayer !== null &&\n this.#innerLayer <= this.#outerLayer\n ) {\n throw new Error(\n \"QuantumMove outer layer must be smaller than inner layer.\",\n );\n }\n\n if (this.#outerLayer !== null && this.#innerLayer === null) {\n throw new Error(\n \"QuantumMove with an outer layer must have an inner layer\",\n ); // TODO: test\n }\n }\n\n static fromString(s: string): QuantumMove {\n return parseQuantumMove(s);\n }\n\n // TODO: `modify`?\n modified(modifications: QuantumMoveModifications): QuantumMove {\n return new QuantumMove(\n modifications.family ?? this.#family,\n modifications.innerLayer ?? this.#innerLayer,\n modifications.outerLayer ?? this.#outerLayer,\n );\n }\n\n isIdentical(other: QuantumMove): boolean {\n const otherAsQuantumMove = other;\n return (\n other.is(QuantumMove) &&\n this.#family === otherAsQuantumMove.#family &&\n this.#innerLayer === otherAsQuantumMove.#innerLayer &&\n this.#outerLayer === otherAsQuantumMove.#outerLayer\n );\n }\n\n // TODO: provide something more useful on average.\n /** @deprecated */\n get family(): string {\n return this.#family;\n }\n\n // TODO: provide something more useful on average.\n /** @deprecated */\n get outerLayer(): number | null {\n return this.#outerLayer;\n }\n\n // TODO: provide something more useful on average.\n /** @deprecated */\n get innerLayer(): number | null {\n return this.#innerLayer;\n }\n\n experimentalExpand(): Generator<LeafUnit> {\n throw new Error(\n \"experimentalExpand() cannot be called on a `QuantumMove` directly.\",\n );\n }\n\n toString(): string {\n let s = this.#family;\n if (this.#innerLayer !== null) {\n s = String(this.#innerLayer) + s;\n if (this.#outerLayer !== null) {\n s = String(this.#outerLayer) + \"-\" + s;\n }\n }\n return s;\n }\n}\n\nexport interface MoveModifications {\n outerLayer?: number;\n innerLayer?: number;\n family?: string;\n amount?: number;\n}\n\nexport class Move extends AlgCommon<Move> {\n readonly #quantumWithAmount: QuantumWithAmount<QuantumMove>;\n\n constructor(\n ...args: [QuantumMove] | [QuantumMove, number] | [string] | [string, number]\n ) {\n super();\n if (typeof args[0] === \"string\") {\n if (args[1] ?? null) {\n this.#quantumWithAmount = new QuantumWithAmount(\n QuantumMove.fromString(args[0]),\n args[1],\n );\n return;\n } else {\n return Move.fromString(args[0]); // TODO: can we return here?\n }\n }\n this.#quantumWithAmount = new QuantumWithAmount<QuantumMove>(\n args[0],\n args[1],\n );\n }\n\n isIdentical(other: Comparable): boolean {\n const otherAsMove = other.as(Move);\n return (\n !!otherAsMove &&\n this.#quantumWithAmount.isIdentical(otherAsMove.#quantumWithAmount)\n );\n }\n\n invert(): Move {\n // TODO: handle char indices more consistently among units.\n return transferCharIndex(\n this,\n new Move(this.#quantumWithAmount.quantum, -this.amount),\n );\n }\n\n *experimentalExpand(\n iterDir: IterationDirection = IterationDirection.Forwards,\n ): Generator<LeafUnit> {\n if (iterDir === IterationDirection.Forwards) {\n yield this;\n } else {\n yield this.modified({\n amount: -this.amount,\n });\n }\n }\n\n get quantum(): QuantumMove {\n return this.#quantumWithAmount.quantum;\n }\n\n // TODO: `modify`?\n modified(modifications: MoveModifications): Move {\n // TODO: Avoid creating a new quantum move\n return new Move(\n this.#quantumWithAmount.quantum.modified(modifications),\n modifications.amount ?? this.amount,\n );\n }\n\n static fromString(s: string): Move {\n return parseMove(s);\n }\n\n get amount(): number {\n return this.#quantumWithAmount.amount;\n }\n\n /** @deprecated */\n get type(): string {\n warnOnce(\"deprecated: type\");\n return \"blockMove\";\n }\n\n /** @deprecated */\n get family(): string {\n return this.#quantumWithAmount.quantum.family ?? undefined;\n }\n\n /** @deprecated */\n get outerLayer(): number | undefined {\n return this.#quantumWithAmount.quantum.outerLayer ?? undefined;\n }\n\n /** @deprecated */\n get innerLayer(): number | undefined {\n return this.#quantumWithAmount.quantum.innerLayer ?? undefined;\n }\n\n toString(): string {\n if (this.family === \"_SLASH_\") {\n return \"/\"; // TODO: validate no amount\n }\n if (this.family.endsWith(\"_PLUS_\")) {\n return (\n this.#quantumWithAmount.quantum.toString().slice(0, -6) +\n Math.abs(this.amount) +\n (this.amount < 0 ? \"-\" : \"+\")\n ); // TODO\n }\n if (this.family.endsWith(\"_PLUSPLUS_\")) {\n const absAmount = Math.abs(this.amount);\n return (\n this.#quantumWithAmount.quantum.toString().slice(0, -10) +\n (absAmount === 1 ? \"\" : absAmount) +\n (this.amount < 0 ? \"--\" : \"++\")\n ); // TODO\n }\n\n return (\n this.#quantumWithAmount.quantum.toString() +\n this.#quantumWithAmount.suffix()\n );\n }\n\n // // TODO: Serialize as a string?\n // toJSON(): MoveJSON {\n // return {\n // type: \"move\",\n // family: this.family,\n // innerLayer: this.innerLayer,\n // outerLayer: this.outerLayer,\n // };\n // }\n}\n", "import { Alg, experimentalEnsureAlg, FlexibleAlgSource } from \"../../Alg\";\nimport { AlgCommon, Comparable } from \"../../common\";\nimport { IterationDirection } from \"../../iteration\";\nimport { Move, QuantumMove } from \"../leaves/Move\";\nimport { QuantumWithAmount } from \"../QuantumWithAmount\";\nimport type { LeafUnit } from \"../Unit\";\n\n// This is a workaround for `jest`, which doesn't handle cycles of imports inside `cubing/alg`.\n// We need to lazy-initialize the reusable quantum moves for Square-1, so we create this wrapper for it.\nclass Square1TupleFormatter {\n quantumU_SQ_: QuantumMove | null = null;\n quantumD_SQ_: QuantumMove | null = null;\n\n format(grouping: Grouping): string | null {\n const amounts = this.tuple(grouping);\n if (!amounts) {\n return null;\n }\n return `(${amounts.map((move) => move.amount).join(\", \")})`;\n }\n\n tuple(grouping: Grouping): [moveU: Move, moveD: Move] | null {\n this.quantumU_SQ_ ||= new QuantumMove(\"U_SQ_\");\n this.quantumD_SQ_ ||= new QuantumMove(\"D_SQ_\");\n\n const quantumAlg = grouping.alg;\n if (quantumAlg.experimentalNumUnits() === 2) {\n const [U, D] = quantumAlg.units();\n if (\n U.as(Move)?.quantum.isIdentical(this.quantumU_SQ_) &&\n D.as(Move)?.quantum.isIdentical(this.quantumD_SQ_)\n ) {\n if (grouping.amount !== 1) {\n throw new Error(\n \"Square-1 tuples cannot have an amount other than 1.\",\n );\n }\n return [U as Move, D as Move]; // TODO: can we reuse the casting from above?\n }\n }\n return null;\n }\n}\nconst square1TupleFormatterInstance = new Square1TupleFormatter();\n\nexport class Grouping extends AlgCommon<Grouping> {\n readonly #quantumWithAmount: QuantumWithAmount<Alg>;\n\n constructor(algSource: FlexibleAlgSource, amount?: number) {\n super();\n const alg = experimentalEnsureAlg(algSource);\n this.#quantumWithAmount = new QuantumWithAmount(alg, amount);\n }\n\n isIdentical(other: Comparable): boolean {\n const otherAsGrouping = other as Grouping;\n return (\n other.is(Grouping) &&\n this.#quantumWithAmount.isIdentical(otherAsGrouping.#quantumWithAmount)\n );\n }\n\n get alg(): Alg {\n return this.#quantumWithAmount.quantum;\n }\n\n get amount(): number {\n return this.#quantumWithAmount.amount;\n }\n\n /** @deprecated */\n get experimentalRepetitionSuffix(): string {\n return this.#quantumWithAmount.suffix();\n }\n\n invert(): Grouping {\n return new Grouping(\n this.#quantumWithAmount.quantum,\n -this.#quantumWithAmount.amount,\n );\n }\n\n *experimentalExpand(\n iterDir: IterationDirection = IterationDirection.Forwards,\n depth?: number,\n ): Generator<LeafUnit> {\n depth ??= Infinity;\n if (depth === 0) {\n yield iterDir === IterationDirection.Forwards ? this : this.invert();\n } else {\n yield* this.#quantumWithAmount.experimentalExpand(iterDir, depth - 1);\n }\n }\n\n static fromString(): Grouping {\n throw new Error(\"unimplemented\");\n }\n\n toString(): string {\n return (\n square1TupleFormatterInstance.format(this) ??\n `(${this.#quantumWithAmount.quantum.toString()})${this.#quantumWithAmount.suffix()}`\n );\n }\n\n experimentalAsSquare1Tuple(): [moveU: Move, moveD: Move] | null {\n return square1TupleFormatterInstance.tuple(this);\n }\n\n // toJSON(): GroupingJSON {\n // return {\n // type: \"grouping\",\n // alg: this.#quanta.quantum.toJSON(),\n // };\n // }\n}\n", "export { Grouping } from \"./containers/Grouping\";\nexport { LineComment } from \"./leaves/LineComment\";\nexport { Commutator } from \"./containers/Commutator\";\nexport { Conjugate } from \"./containers/Conjugate\";\nexport { Move, QuantumMove } from \"./leaves/Move\";\nexport { Newline } from \"./leaves/Newline\";\nexport { Pause } from \"./leaves/Pause\";\nexport type { Unit } from \"./Unit\";\n", "import type { Alg } from \"./Alg\";\nimport {\n Commutator,\n Conjugate,\n Grouping,\n LineComment,\n Move,\n Newline,\n Pause,\n} from \"./units\";\n\nexport function experimentalIs(\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n v: any,\n c:\n | typeof Alg\n | typeof Grouping\n | typeof LineComment\n | typeof Commutator\n | typeof Conjugate\n | typeof Move\n | typeof Newline\n | typeof Pause,\n): boolean {\n return v instanceof c;\n}\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function experimentalIsUnit(v: any): boolean {\n return (\n experimentalIs(v, Grouping) ||\n experimentalIs(v, LineComment) ||\n experimentalIs(v, Commutator) ||\n experimentalIs(v, Conjugate) ||\n experimentalIs(v, Move) ||\n experimentalIs(v, Newline) ||\n experimentalIs(v, Pause)\n );\n}\n", "import type { Alg } from \"./Alg\";\nimport { Grouping } from \"./units/containers/Grouping\";\nimport type { Comparable } from \"./common\";\nimport { Commutator } from \"./units/containers/Commutator\";\nimport { Move, QuantumMove } from \"./units/leaves/Move\";\nimport { Newline } from \"./units/leaves/Newline\";\nimport { Pause } from \"./units/leaves/Pause\";\nimport { Conjugate } from \"./units/containers/Conjugate\";\nimport { LineComment } from \"./units/leaves/LineComment\";\nimport type { Unit } from \"./units/Unit\";\n\nfunction dispatch<DataDown, DataAlgUp, DataUnitUp>(\n t: TraversalDownUp<DataDown, DataAlgUp, DataUnitUp>,\n unit: Unit,\n dataDown: DataDown,\n): DataUnitUp {\n // TODO: Can we turn this back into a `switch` or something more efficiently?\n if (unit.is(Grouping)) {\n return t.traverseGrouping(unit as Grouping, dataDown);\n }\n if (unit.is(Move)) {\n return t.traverseMove(unit as Move, dataDown);\n }\n if (unit.is(Commutator)) {\n return t.traverseCommutator(unit as Commutator, dataDown);\n }\n if (unit.is(Conjugate)) {\n return t.traverseConjugate(unit as Conjugate, dataDown);\n }\n if (unit.is(Pause)) {\n return t.traversePause(unit as Pause, dataDown);\n }\n if (unit.is(Newline)) {\n return t.traverseNewline(unit as Newline, dataDown);\n }\n if (unit.is(LineComment)) {\n return t.traverseLineComment(unit as LineComment, dataDown);\n }\n throw new Error(`unknown unit`);\n}\n\nfunction assertIsUnit(t: Comparable): Unit {\n if (\n t.is(Grouping) ||\n t.is(Move) ||\n t.is(Commutator) ||\n t.is(Conjugate) ||\n t.is(Pause) ||\n t.is(Newline) ||\n t.is(LineComment)\n ) {\n return t as Unit;\n }\n throw \"internal error: expected unit\"; // TODO: Make more helpful, add tests\n}\n\nexport abstract class TraversalDownUp<\n DataDown,\n DataAlgUp,\n DataUnitUp = DataAlgUp,\n> {\n // Immediate subclasses should overwrite this.\n public traverseUnit(unit: Unit, dataDown: DataDown): DataUnitUp {\n return dispatch(this, unit, dataDown);\n }\n\n public traverseIntoUnit(unit: Unit, dataDown: DataDown): Unit {\n return assertIsUnit(this.traverseUnit(unit, dataDown) as any);\n }\n\n public abstract traverseAlg(alg: Alg, dataDown: DataDown): DataAlgUp;\n\n public abstract traverseGrouping(\n grouping: Grouping,\n dataDown: DataDown,\n ): DataUnitUp;\n\n public abstract traverseMove(move: Move, dataDown: DataDown): DataUnitUp;\n\n public abstract traverseCommutator(\n commutator: Commutator,\n dataDown: DataDown,\n ): DataUnitUp;\n\n public abstract traverseConjugate(\n conjugate: Conjugate,\n dataDown: DataDown,\n ): DataUnitUp;\n\n public abstract traversePause(pause: Pause, dataDown: DataDown): DataUnitUp;\n public abstract traverseNewline(\n newline: Newline,\n dataDown: DataDown,\n ): DataUnitUp;\n\n public abstract traverseLineComment(\n comment: LineComment,\n dataDown: DataDown,\n ): DataUnitUp;\n}\n\nexport abstract class TraversalUp<\n DataAlgUp,\n DataUnitUp = DataAlgUp,\n> extends TraversalDownUp<undefined, DataAlgUp, DataUnitUp> {\n public traverseUnit(unit: Unit): DataUnitUp {\n return dispatch<unknown, DataAlgUp, DataUnitUp>(this, unit, undefined);\n }\n\n public traverseIntoUnit(unit: Unit): Unit {\n return assertIsUnit(this.traverseUnit(unit) as any);\n }\n\n public abstract traverseAlg(alg: Alg): DataAlgUp;\n public abstract traverseGrouping(grouping: Grouping): DataUnitUp;\n public abstract traverseMove(move: Move): DataUnitUp;\n public abstract traverseCommutator(commutator: Commutator): DataUnitUp;\n public abstract traverseConjugate(conjugate: Conjugate): DataUnitUp;\n public abstract traversePause(pause: Pause): DataUnitUp;\n public abstract traverseNewline(newline: Newline): DataUnitUp;\n public abstract traverseLineComment(comment: LineComment): DataUnitUp;\n}\n\nexport interface SimplifyOptions {\n collapseMoves?: boolean;\n quantumMoveOrder?: (quantumMove: QuantumMove) => number;\n depth?: number | null; // TODO: test\n}\n\n// TODO: Test that inverses are bijections.\nclass Simplify extends TraversalDownUp<SimplifyOptions, Generator<Unit>> {\n static #newAmount(\n move: Move,\n deltaAmount: number,\n options: SimplifyOptions,\n ): number {\n let newAmount = move.amount + deltaAmount;\n if (options?.quantumMoveOrder) {\n const order = options.quantumMoveOrder(move.quantum);\n // Examples:\n // \u2022 order 4 \u2192 min -1 (e.g. cube)\n // \u2022 order 5 \u2192 min -2 (e.g. Megaminx)\n // \u2022 order 3 \u2192 min -1 (e.g. Pyraminx)\n const min = Math.floor(order / 2) + 1 - order;\n newAmount = (((newAmount % order) + order - min) % order) + min; // TODO\n }\n return newAmount;\n }\n\n // TODO: Handle\n public *traverseAlg(alg: Alg, options: SimplifyOptions): Generator<Unit> {\n if (options.depth === 0) {\n yield* alg.units();\n return;\n }\n\n const newUnits: Unit[] = [];\n let lastUnit: Unit | null = null;\n const collapseMoves = options?.collapseMoves ?? true;\n function appendMoveWithNewAmount(move: Move, deltaAmount: number): boolean {\n const newAmount = Simplify.#newAmount(move, deltaAmount, options);\n if (newAmount === 0) {\n return false;\n }\n const newMove = new Move(move.quantum, newAmount);\n newUnits.push(newMove);\n lastUnit = newMove;\n return true;\n }\n function appendCollapsed(newUnit: Unit) {\n if (\n collapseMoves &&\n lastUnit?.is(Move) &&\n newUnit.is(Move) &&\n (lastUnit as Move).quantum.isIdentical((newUnit as Move).quantum)\n ) {\n newUnits.pop();\n if (\n !appendMoveWithNewAmount(lastUnit as Move, (newUnit as Move).amount)\n ) {\n lastUnit = newUnits.slice(-1)[0];\n }\n } else {\n if (newUnit.is(Move)) {\n appendMoveWithNewAmount(newUnit as Move, 0);\n } else {\n newUnits.push(newUnit);\n lastUnit = newUnit;\n }\n }\n }\n\n const newOptions = {\n depth: options.depth ? options.depth - 1 : null,\n }; // TODO: avoid allocations?\n for (const unit of alg.units()) {\n for (const ancestorUnit of this.traverseUnit(unit, newOptions)) {\n appendCollapsed(ancestorUnit);\n }\n }\n for (const unit of newUnits) {\n yield unit;\n }\n }\n\n public *traverseGrouping(\n grouping: Grouping,\n options: SimplifyOptions,\n ): Generator<Unit> {\n if (options.depth === 0) {\n yield grouping;\n return;\n }\n const newOptions = {\n depth: options.depth ? options.depth - 1 : null,\n }; // TODO: avoid allocations?\n yield new Grouping(this.traverseAlg(grouping.alg, newOptions));\n }\n\n public *traverseMove(move: Move, _options: SimplifyOptions): Generator<Unit> {\n yield move;\n }\n\n public *traverseCommutator(\n commutator: Commutator,\n options: SimplifyOptions,\n ): Generator<Unit> {\n if (options.depth === 0) {\n yield commutator;\n return;\n }\n const newOptions = {\n depth: options.depth ? options.depth - 1 : null,\n }; // TODO: avoid allocations?\n yield new Commutator(\n this.traverseAlg(commutator.A, newOptions),\n this.traverseAlg(commutator.B, newOptions),\n );\n }\n\n public *traverseConjugate(\n conjugate: Conjugate,\n options: SimplifyOptions,\n ): Generator<Unit> {\n if (options.depth === 0) {\n yield conjugate;\n return;\n }\n const newOptions = {\n depth: options.depth ? options.depth - 1 : null,\n }; // TODO: avoid allocations?\n yield new Conjugate(\n this.traverseAlg(conjugate.A, newOptions),\n this.traverseAlg(conjugate.B, newOptions),\n );\n }\n\n public *traversePause(\n pause: Pause,\n _options: SimplifyOptions,\n ): Generator<Unit> {\n yield pause;\n }\n\n public *traverseNewline(\n newline: Newline,\n _options: SimplifyOptions,\n ): Generator<Unit> {\n yield newline;\n }\n\n public *traverseLineComment(\n comment: LineComment,\n _options: SimplifyOptions,\n ): Generator<Unit> {\n yield comment;\n }\n}\n\nconst simplifyInstance = new Simplify();\nexport const simplify = simplifyInstance.traverseAlg.bind(simplifyInstance) as (\n alg: Alg,\n options: SimplifyOptions,\n) => Generator<Unit>;\n", "import { AlgCommon, Comparable } from \"./common\";\nimport { experimentalIs, experimentalIsUnit } from \"./is\";\nimport { direct, IterationDirection, reverse } from \"./iteration\";\nimport { parseAlg } from \"./parse\";\nimport { simplify, SimplifyOptions } from \"./traversal\";\nimport { LineComment } from \"./units/leaves/LineComment\";\nimport { Move } from \"./units/leaves/Move\";\nimport { Newline } from \"./units/leaves/Newline\";\nimport type { LeafUnit, Unit } from \"./units/Unit\";\nimport { warnOnce } from \"./warnOnce\";\n\nexport type FlexibleAlgSource = string | Iterable<Unit> | Alg;\n\n// TODO: validate\nfunction toIterable(input?: FlexibleAlgSource): Iterable<Unit> {\n if (!input) {\n return [];\n }\n\n if (experimentalIs(input, Alg)) {\n return (input as Alg).units();\n }\n\n if (typeof input === \"string\") {\n return parseAlg(input).units(); // TODO: something more direct?\n }\n\n // const seq = inputUnits as Sequence;\n // if (seq.type === \"sequence\" && seq.nestedUnits) {\n // throw new Error(\"unimplemented\");\n // // return seq.nestedUnits;\n // }\n\n const iter = input as Iterable<Unit>;\n if (typeof iter[Symbol.iterator] === \"function\") {\n return iter; // TODO: avoid allocations\n }\n\n throw \"Invalid unit\";\n}\n\n// Preserves the alg if it's already an `Alg`.\nexport function experimentalEnsureAlg(alg: FlexibleAlgSource): Alg {\n if (experimentalIs(alg, Alg)) {\n return alg as Alg;\n }\n return new Alg(alg);\n}\n\n/**\n * Alg is a class that encapsulated a structured alg. To create an alg from a string, use:\n *\n * new Alg(\"R U R'\"); // Convenient\n * Alg.fromString(dynamicString); // Recommended when handling dynamic input.\n *\n * Once you have an Alg, you can call methods to transform it:\n *\n * new Alg(\"[[R: U], R U R2']\").expand().simplify().invert();\n *\n * To convert an Alg to a string, use .toString():\n *\n * new Alg(\"R U F\").invert().toString();\n *\n * If you need to debug, you may also find it convenient to use .log():\n *\n * if (alg.isIdentical(alg.invert())) {\n * alg.log(\"A self-inverse!\")\n * }\n *\n * For more information, see: {@link https://js.cubing.net/cubing/alg/}\n *\n */\nexport class Alg extends AlgCommon<Alg> {\n // #debugString: string;\n #units: Iterable<Unit>; // TODO: freeze?\n constructor(alg?: FlexibleAlgSource) {\n super();\n this.#units = Array.from(toIterable(alg)); // TODO: can we avoid array-casting?\n // this.#debugString = this.toString();\n\n for (const unit of this.#units) {\n if (!experimentalIsUnit(unit)) {\n throw new Error(\"An alg can only contain units.\");\n }\n }\n }\n\n /**\n * Checks whether this Alg is structurally identical to another Alg. This\n * essentially means that they are written identically apart from whitespace.\n *\n * const alg1 = new Alg(\"R U L'\");\n * const alg2 = new Alg(\"L U' R'\").invert();\n * // true\n * alg1.isIdentical(alg2);\n *\n * // false\n * new Alg(\"[R, U]\").isIdentical(new Alg(\"R U R' U'\"));\n * // true\n * new Alg(\"[R, U]\").expand().isIdentical(new Alg(\"R U R' U'\"));\n *\n * Note that .isIdentical() efficiently compares algorithms, but mainly exists\n * to help optimize code when the structure of an algorithm hasn't changed.\n * There are many ways to write the \"same\" alg on most puzzles, but is\n * *highly* recommended to avoid expanding two Alg instances to compare them,\n * since that can easily slow your program to a crawl if someone inputs an alg\n * containing a large repetition. In general, you should use `cubing/kpuzzle`\n * to compare if two algs have the same effect on a puzzle.\n *\n * Also note that parser annotations are not take into account while comparing\n * algs:\n *\n * const alg = new Alg([new Move(\"R\"), new Move(\"U2\")]);\n * // true, even though one of the algs has parser annotations\n * alg.isIdentical(new Alg(\"R U2\"))\n *\n */\n isIdentical(other: Comparable): boolean {\n const otherAsAlg = other as Alg;\n if (!other.is(Alg)) {\n return false;\n }\n\n // TODO: avoid converting to array\n const l1 = Array.from(this.#units);\n const l2 = Array.from(otherAsAlg.#units);\n if (l1.length !== l2.length) {\n return false;\n }\n for (let i = 0; i < l1.length; i++) {\n if (!l1[i].isIdentical(l2[i])) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Returns the inverse of the given alg.\n *\n * Note that that this does not make any assumptions about what puzzle the alg\n * is for. For example, U2 is its own inverse on a cube, but U2' has the same\n * effect U3 (and not U2) on Megaminx:\n *\n * // Outputs: R U2' L'\n * new Alg(\"L U2 R'\").invert().log();\n */\n invert(): Alg {\n // TODO: Handle newLines and comments correctly\n // TODO: Make more efficient.\n return new Alg(reverse(Array.from(this.#units).map((u) => u.invert())));\n }\n\n /** @deprecated Use {@link Alg.expand} instead. */\n *experimentalExpand(\n iterDir: IterationDirection = IterationDirection.Forwards,\n depth?: number,\n ): Generator<LeafUnit> {\n depth ??= Infinity;\n for (const unit of direct(this.#units, iterDir)) {\n yield* unit.experimentalExpand(iterDir, depth);\n }\n }\n\n /**\n * Expands all Grouping, Commutator, and Conjugate parts nested inside the\n * alg.\n *\n * // F R U R' U' F'\n * new Alg(\"[F: [R, U]]\").expand().log();\n *\n * // F [R, U] F'\n * new Alg(\"[F: [R, U]]\").expand(({ depth: 1 }).log();\n *\n * Avoid calling this on a user-provided alg unless the user explicitly asks\n * to see the expanded alg. Otherwise, it's easy to make your program freeze\n * when someone passes in an alg like: (R U)10000000\n *\n * Generally, if you want to perform an operation on an entire alg, you'll\n * want to use something based on the `Traversal` mechanism, like countMoves()\n * from `cubing/notation`.\n */\n expand(options?: { depth?: number }): Alg {\n return new Alg(\n this.experimentalExpand(\n IterationDirection.Forwards,\n options?.depth ?? Infinity,\n ),\n );\n }\n\n /** @deprecated */\n *experimentalLeafMoves(): Generator<Move> {\n for (const leaf of this.experimentalExpand()) {\n if (leaf.is(Move)) {\n yield leaf as Move;\n }\n }\n }\n\n concat(input: FlexibleAlgSource): Alg {\n return new Alg(\n Array.from(this.#units).concat(Array.from(toIterable(input))),\n );\n }\n\n /** @deprecated */\n experimentalIsEmpty(): boolean {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const _ of this.#units) {\n return false;\n }\n return true;\n }\n\n static fromString(s: string): Alg {\n return parseAlg(s);\n }\n\n *units(): Generator<Unit> {\n for (const unit of this.#units) {\n yield unit;\n }\n }\n\n experimentalNumUnits(): number {\n return Array.from(this.#units).length;\n }\n\n /** @deprecated */\n get type(): string {\n warnOnce(\"deprecated: type\");\n return \"sequence\";\n }\n\n // toJSON(): AlgJSON {\n // return {\n // type: \"alg\",\n // units: Array.from(this.#units) as UnitJSON[],\n // };\n // }\n\n /**\n * Converts the Alg to a string:\n *\n * const alg = new Alg([new Move(\"R\"), new Move(\"U2\"), new Move(\"L\")])\n * // R U2 L\n * console.log(alg.toString())\n */\n toString(): string {\n let output = \"\";\n let previousUnit: Unit | null = null;\n for (const unit of this.#units) {\n if (previousUnit) {\n output += spaceBetween(previousUnit, unit);\n // console.log(\"l\", previousUnit.toString(), unit.toString(), output);\n }\n output += unit.toString();\n previousUnit = unit;\n }\n return output;\n }\n\n // *experimentalExpand(options: ExperimentalExpandOptions): Generator<Unit> {\n // // if (options.depth === 0) {\n // // yield* this.units();\n // // return;\n // // }\n // // const newOptions = {\n // // depth: options.depth ? options.depth - 1 : null,\n // // }; // TODO: avoid allocations?\n // // for (const unit of this.#units) {\n // // yield* unit.experimentalExpandIntoAlg(newOptions);\n // // }\n // }\n\n simplify(options?: SimplifyOptions): Alg {\n return new Alg(simplify(this, options ?? {}));\n }\n}\n\nfunction spaceBetween(u1: Unit, u2: Unit): string {\n if (u1.is(Newline) || u2.is(Newline)) {\n return \"\";\n }\n if (u1.is(LineComment) && !u2.is(Newline)) {\n return \"\\n\"; /// TODO\n }\n return \" \";\n}\n", "// tslint:disable-next-line no-namespace // TODO: nested module\n\nimport { Alg } from \"./Alg\";\nimport { Grouping } from \"./units\";\nimport { Commutator } from \"./units/containers/Commutator\";\nimport { Conjugate } from \"./units/containers/Conjugate\";\nimport { Move } from \"./units/leaves/Move\";\nimport { Pause } from \"./units/leaves/Pause\";\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport const Example = {\n Sune: new Alg([\n new Move(\"R\", 1),\n new Move(\"U\", 1),\n new Move(\"R\", -1),\n new Move(\"U\", 1),\n new Move(\"R\", 1),\n new Move(\"U\", -2),\n new Move(\"R\", -1),\n ]),\n\n AntiSune: new Alg([\n new Move(\"R\", 1),\n new Move(\"U\", 2),\n new Move(\"R\", -1),\n new Move(\"U\", -1),\n new Move(\"R\", 1),\n new Move(\"U\", -1),\n new Move(\"R\", -1),\n ]),\n\n SuneCommutator: new Alg([\n new Commutator(\n new Alg([new Move(\"R\", 1), new Move(\"U\", 1), new Move(\"R\", -2)]),\n new Alg([\n new Conjugate(new Alg([new Move(\"R\", 1)]), new Alg([new Move(\"U\", 1)])),\n ]),\n ),\n ]),\n\n Niklas: new Alg([\n new Move(\"R\", 1),\n new Move(\"U\", -1),\n new Move(\"L\", -1),\n new Move(\"U\", 1),\n new Move(\"R\", -1),\n new Move(\"U\", -1),\n new Move(\"L\", 1),\n new Move(\"U\", 1),\n ]),\n\n EPerm: new Alg([\n new Move(\"x\", -1),\n new Commutator(\n new Alg([\n new Conjugate(\n new Alg([new Move(\"R\", 1)]),\n new Alg([new Move(\"U\", -1)]),\n ),\n ]),\n new Alg([new Move(\"D\", 1)]),\n ),\n new Commutator(\n new Alg([\n new Conjugate(new Alg([new Move(\"R\", 1)]), new Alg([new Move(\"U\", 1)])),\n ]),\n new Alg([new Move(\"D\", 1)]),\n ),\n new Move(\"x\", 1),\n ]),\n\n FURURFCompact: new Alg([\n new Conjugate(\n new Alg([new Move(\"F\", 1)]),\n new Alg([\n new Commutator(\n new Alg([new Move(\"U\", 1)]),\n new Alg([new Move(\"R\", 1)]),\n ),\n ]),\n ),\n ]),\n\n APermCompact: new Alg([\n new Conjugate(\n new Alg([new Move(\"R\", 2)]),\n new Alg([\n new Commutator(\n new Alg([new Move(\"F\", 2)]),\n new Alg([new Move(\"R\", -1), new Move(\"B\", -1), new Move(\"R\", 1)]),\n ),\n ]),\n ),\n ]),\n\n FURURFMoves: new Alg([\n new Move(\"F\", 1),\n new Move(\"U\", 1),\n new Move(\"R\", 1),\n new Move(\"U\", -1),\n new Move(\"R\", -1),\n new Move(\"F\", -1),\n ]),\n\n TPerm: new Alg([\n new Move(\"R\", 1),\n new Move(\"U\", 1),\n new Move(\"R\", -1),\n new Move(\"U\", -1),\n new Move(\"R\", -1),\n new Move(\"F\", 1),\n new Move(\"R\", 2),\n new Move(\"U\", -1),\n new Move(\"R\", -1),\n new Move(\"U\", -1),\n new Move(\"R\", 1),\n new Move(\"U\", 1),\n new Move(\"R\", -1),\n new Move(\"F\", -1),\n ]),\n\n HeadlightSwaps: new Alg([\n new Conjugate(\n new Alg([new Move(\"F\", 1)]),\n new Alg([\n new Grouping(\n new Alg([\n new Commutator(\n new Alg([new Move(\"R\", 1)]),\n new Alg([new Move(\"U\", 1)]),\n ),\n ]),\n 3,\n ),\n ]),\n ),\n ]),\n\n TriplePause: new Alg([new Pause(), new Pause(), new Pause()]),\n\n // AllAlgParts: [\n // new Alg([new Move(\"R\", 1), new Move(\"U\", -1)]),\n // new Grouping(new Alg([new Move(\"F\", 1)]), 2),\n // // new Rotation(\"y\", -1),\n // new Move(\"R\", 2),\n // new Commutator(new Alg([new Move(\"R\", 2)]), new Alg([new Move(\"U\", 2)]), 2),\n // new Conjugate(new Alg([new Move(\"L\", 2)]), new Alg([new Move(\"D\", -1)]), 2),\n // new Pause(),\n // new Newline(),\n // new LineComment(\"line comment\"),\n // ],\n};\n", "import { Move } from \"./units/leaves/Move\";\n\nconst cubeKeyMapping: { [key: number]: Move } = {\n 73: new Move(\"R\"),\n 75: new Move(\"R'\"),\n 87: new Move(\"B\"),\n 79: new Move(\"B'\"),\n 83: new Move(\"D\"),\n 76: new Move(\"D'\"),\n 68: new Move(\"L\"),\n 69: new Move(\"L'\"),\n 74: new Move(\"U\"),\n 70: new Move(\"U'\"),\n 72: new Move(\"F\"),\n 71: new Move(\"F'\"),\n\n 78: new Move(\"x'\"),\n 67: new Move(\"l\"),\n 82: new Move(\"l'\"),\n 85: new Move(\"r\"),\n 77: new Move(\"r'\"),\n\n 88: new Move(\"d\"),\n 188: new Move(\"d'\"),\n\n 84: new Move(\"x\"),\n 89: new Move(\"x\"),\n 66: new Move(\"x'\"),\n 186: new Move(\"y\"),\n 59: new Move(\"y\"),\n 65: new Move(\"y'\"), // 186 is WebKit, 59 is Mozilla; see http://unixpapa.com/js/key.html\n 80: new Move(\"z\"),\n 81: new Move(\"z'\"),\n\n 90: new Move(\"M'\"),\n 190: new Move(\"M'\"),\n};\n\n// TODO: options about whether to ignore modifier keys (e.g. alt, ctrl).\n// TODO: Support different mappings.\n// TODO: Return BaseMove instead?\nexport function keyToMove(e: KeyboardEvent): Move | null {\n if (e.altKey || e.ctrlKey) {\n return null;\n }\n\n return cubeKeyMapping[e.keyCode] || null;\n}\n", "import type { Alg } from \"./Alg\";\n\n// This is not the most sophisticated scheme, but it has been used in production\n// at alg.cubing.net for years.\nfunction serializeURLParam(a: Alg): string {\n let escaped = a.toString();\n escaped = escaped.replace(/_/g, \"&#95;\").replace(/ /g, \"_\");\n escaped = escaped.replace(/\\+/g, \"&#2b;\");\n escaped = escaped.replace(/-/g, \"&#45;\").replace(/'/g, \"-\");\n return escaped;\n}\n\nexport interface AlgCubingNetOptions {\n alg?: Alg;\n setup?: Alg;\n title?: string;\n puzzle?:\n | \"1x1x1\"\n | \"2x2x2\"\n | \"3x3x3\"\n | \"4x4x4\"\n | \"5x5x5\"\n | \"6x6x6\"\n | \"7x7x7\"\n | \"8x8x8\"\n | \"9x9x9\"\n | \"10x10x10\"\n | \"11x11x11\"\n | \"12x12x12\"\n | \"13x13x13\"\n | \"14x14x14\"\n | \"16x16x16\"\n | \"17x17x17\";\n stage?:\n | \"full\"\n | \"cross\"\n | \"F2L\"\n | \"LL\"\n | \"OLL\"\n | \"PLL\"\n | \"CLS\"\n | \"ELS\"\n | \"L6E\"\n | \"CMLL\"\n | \"WV\"\n | \"ZBLL\"\n | \"void\";\n view?: \"editor\" | \"playback\" | \"fullscreen\";\n type?: \"moves\" | \"reconstruction\" | \"alg\" | \"reconstruction-end-with-setup\";\n}\n\n// TODO: runtime validation?\nexport function algCubingNetLink(options: AlgCubingNetOptions): string {\n const url = new URL(\"https://alg.cubing.net\");\n if (!options.alg) {\n throw new Error(\"An alg parameter is required.\");\n }\n url.searchParams.set(\"alg\", serializeURLParam(options.alg));\n\n if (options.setup) {\n url.searchParams.set(\"setup\", serializeURLParam(options.setup));\n }\n if (options.title) {\n url.searchParams.set(\"title\", options.title);\n }\n if (options.puzzle) {\n if (\n ![\n \"1x1x1\",\n \"2x2x2\",\n \"3x3x3\",\n \"4x4x4\",\n \"5x5x5\",\n \"6x6x6\",\n \"7x7x7\",\n \"8x8x8\",\n \"9x9x9\",\n \"10x10x10\",\n \"11x11x11\",\n \"12x12x12\",\n \"13x13x13\",\n \"14x14x14\",\n \"16x16x16\",\n \"17x17x17\",\n ].includes(options.puzzle)\n ) {\n throw new Error(`Invalid puzzle parameter: ${options.puzzle}`);\n }\n url.searchParams.set(\"puzzle\", options.puzzle);\n }\n if (options.stage) {\n if (\n ![\n \"full\",\n \"cross\",\n \"F2L\",\n \"LL\",\n \"OLL\",\n \"PLL\",\n \"CLS\",\n \"ELS\",\n \"L6E\",\n \"CMLL\",\n \"WV\",\n \"ZBLL\",\n \"void\",\n ].includes(options.stage)\n ) {\n throw new Error(`Invalid stage parameter: ${options.stage}`);\n }\n url.searchParams.set(\"stage\", options.stage);\n }\n if (options.view) {\n if (![\"editor\", \"playback\", \"fullscreen\"].includes(options.view)) {\n throw new Error(`Invalid view parameter: ${options.view}`);\n }\n url.searchParams.set(\"view\", options.view);\n }\n if (options.type) {\n if (\n ![\n \"moves\",\n \"reconstruction\",\n \"alg\",\n \"reconstruction-end-with-setup\",\n ].includes(options.type)\n ) {\n throw new Error(`Invalid type parameter: ${options.type}`);\n }\n url.searchParams.set(\"type\", options.type);\n }\n return url.toString();\n}\n", "import { Alg } from \"./Alg\";\nimport type { Move } from \"./units/leaves/Move\";\n\nexport function experimentalAppendMove(\n alg: Alg,\n newMove: Move,\n options?: {\n coalesce?: boolean; // defaults to false\n mod?: number;\n },\n): Alg {\n const oldUnits = Array.from(alg.units());\n const oldLastMove = oldUnits[oldUnits.length - 1] as Move | undefined;\n if (\n options?.coalesce &&\n oldLastMove &&\n oldLastMove.quantum &&\n oldLastMove.quantum.isIdentical(newMove.quantum)\n ) {\n const newUnits = oldUnits.slice(0, oldUnits.length - 1);\n let newAmount = oldLastMove.amount + newMove.amount;\n const mod = options?.mod;\n if (mod) {\n newAmount = ((newAmount % mod) + mod) % mod;\n if (newAmount * 2 > mod) {\n newAmount -= mod;\n }\n }\n if (newAmount !== 0) {\n newUnits.push(oldLastMove.modified({ amount: newAmount }));\n }\n return new Alg(newUnits);\n } else {\n return new Alg([...oldUnits, newMove]);\n }\n}\n", "export { Alg } from \"./Alg\";\nexport { AlgBuilder } from \"./AlgBuilder\";\nexport { TraversalDownUp, TraversalUp } from \"./traversal\";\nexport { Example } from \"./example\";\nexport { keyToMove } from \"./keyboard\";\nexport * from \"./units\";\nexport { MoveModifications } from \"./units/leaves/Move\";\n\nexport { algCubingNetLink } from \"./url\";\nexport type { AlgCubingNetOptions } from \"./url\";\n\nexport { experimentalAppendMove } from \"./operation\";\nexport { experimentalIs } from \"./is\";\nexport {\n directedGenerator as experimentalDirectedGenerator,\n direct as experimentalDirect,\n IterationDirection as ExperimentalIterationDirection,\n} from \"./iteration\";\n\n// TODO: Find a better way to track parsed algs.\nexport type { Parsed as ExperimentalParsed } from \"./parse\";\n", "import type {\n KPuzzleDefinition,\n OrbitTransformation,\n Transformation,\n} from \"./definition_types\";\n\n// this is the last identity orbit transformation we saw or looked at.\nlet lasto: OrbitTransformation | null;\n\nfunction isIdentity(omod: number, o: OrbitTransformation): boolean {\n if (o === lasto) {\n return true;\n }\n const perm = o.permutation;\n const n = perm.length;\n for (let idx = 0; idx < n; idx++) {\n if (perm[idx] !== idx) {\n return false;\n }\n }\n if (omod > 1) {\n const ori = o.orientation;\n for (let idx = 0; idx < n; idx++) {\n if (ori[idx] !== 0) {\n return false;\n }\n }\n }\n lasto = o;\n return true;\n}\n\nexport function combineTransformations(\n def: KPuzzleDefinition,\n t1: Transformation,\n t2: Transformation,\n): Transformation {\n const newTrans: Transformation = {} as Transformation;\n for (const orbitName in def.orbits) {\n const oDef = def.orbits[orbitName];\n const o1 = t1[orbitName];\n const o2 = t2[orbitName];\n if (isIdentity(oDef.orientations, o2)) {\n // common case for big cubes\n newTrans[orbitName] = o1;\n } else if (isIdentity(oDef.orientations, o1)) {\n newTrans[orbitName] = o2;\n } else {\n const newPerm = new Array(oDef.numPieces);\n if (oDef.orientations === 1) {\n for (let idx = 0; idx < oDef.numPieces; idx++) {\n newPerm[idx] = o1.permutation[o2.permutation[idx]];\n }\n newTrans[orbitName] = {\n permutation: newPerm,\n orientation: o1.orientation,\n };\n } else {\n const newOri = new Array(oDef.numPieces);\n for (let idx = 0; idx < oDef.numPieces; idx++) {\n newOri[idx] =\n (o1.orientation[o2.permutation[idx]] + o2.orientation[idx]) %\n oDef.orientations;\n newPerm[idx] = o1.permutation[o2.permutation[idx]];\n }\n newTrans[orbitName] = { permutation: newPerm, orientation: newOri };\n }\n }\n }\n return newTrans;\n}\n\nexport function multiplyTransformations(\n def: KPuzzleDefinition,\n t: Transformation,\n amount: number,\n): Transformation {\n if (amount < 0) {\n return multiplyTransformations(def, invertTransformation(def, t), -amount);\n }\n if (amount === 0) {\n return identityTransformation(def);\n }\n if (amount === 1) {\n return t;\n }\n let halfish = t;\n if (amount !== 2) {\n halfish = multiplyTransformations(def, t, Math.floor(amount / 2));\n }\n const twiceHalfish = combineTransformations(def, halfish, halfish);\n if (amount % 2 === 0) {\n return twiceHalfish;\n } else {\n return combineTransformations(def, t, twiceHalfish);\n }\n}\nexport function identityTransformation(\n definition: KPuzzleDefinition,\n): Transformation {\n const transformation = {} as Transformation;\n for (const orbitName in definition.orbits) {\n const orbitDefinition = definition.orbits[orbitName];\n if (!lasto || lasto.permutation.length !== orbitDefinition.numPieces) {\n const newPermutation = new Array(orbitDefinition.numPieces);\n const newOrientation = new Array(orbitDefinition.numPieces);\n for (let i = 0; i < orbitDefinition.numPieces; i++) {\n newPermutation[i] = i;\n newOrientation[i] = 0;\n }\n const orbitTransformation = {\n permutation: newPermutation,\n orientation: newOrientation,\n };\n lasto = orbitTransformation;\n // Object.freeze(newPermutation); // TODO\n // Object.freeze(newOrientation); // TODO\n }\n transformation[orbitName] = lasto;\n\n // Object.freeze(orbitDefinition); // TODO\n }\n // Object.freeze(transformation); // TODO\n return transformation;\n}\n\nexport function invertTransformation(\n def: KPuzzleDefinition,\n t: Transformation,\n): Transformation {\n const newTrans: Transformation = {} as Transformation;\n for (const orbitName in def.orbits) {\n const oDef = def.orbits[orbitName];\n const o = t[orbitName];\n if (isIdentity(oDef.orientations, o)) {\n newTrans[orbitName] = o;\n } else if (oDef.orientations === 1) {\n const newPerm = new Array(oDef.numPieces);\n for (let idx = 0; idx < oDef.numPieces; idx++) {\n newPerm[o.permutation[idx]] = idx;\n }\n newTrans[orbitName] = {\n permutation: newPerm,\n orientation: o.orientation,\n };\n } else {\n const newPerm = new Array(oDef.numPieces);\n const newOri = new Array(oDef.numPieces);\n for (let idx = 0; idx < oDef.numPieces; idx++) {\n const fromIdx = o.permutation[idx];\n newPerm[fromIdx] = idx;\n newOri[fromIdx] =\n (oDef.orientations - o.orientation[idx] + oDef.orientations) %\n oDef.orientations;\n }\n newTrans[orbitName] = { permutation: newPerm, orientation: newOri };\n }\n }\n return newTrans;\n}\n\nfunction gcd(a: number, b: number): number {\n if (b) {\n return gcd(b, a % b);\n }\n return a;\n}\n\n/* calculate the order of a particular transformation. */\nexport function transformationOrder(\n def: KPuzzleDefinition,\n t: Transformation,\n): number {\n let r: number = 1;\n for (const orbitName in def.orbits) {\n const oDef = def.orbits[orbitName];\n const o = t[orbitName];\n const d = new Array(oDef.numPieces);\n for (let idx = 0; idx < oDef.numPieces; idx++) {\n if (!d[idx]) {\n let w = idx;\n let om = 0;\n let pm = 0;\n for (;;) {\n d[w] = true;\n om = om + o.orientation[w];\n pm = pm + 1;\n w = o.permutation[w];\n if (w === idx) {\n break;\n }\n }\n if (om !== 0) {\n pm = (pm * oDef.orientations) / gcd(oDef.orientations, om);\n }\n r = (r * pm) / gcd(r, pm);\n }\n }\n }\n return r;\n}\n\nexport function areOrbitTransformationsEquivalent(\n def: KPuzzleDefinition,\n orbitName: string,\n t1: Transformation,\n t2: Transformation,\n options: {\n ignoreOrientation?: boolean;\n ignorePermutation?: boolean;\n } = {},\n): boolean {\n const oDef = def.orbits[orbitName];\n const o1 = t1[orbitName];\n const o2 = t2[orbitName];\n for (let idx = 0; idx < oDef.numPieces; idx++) {\n if (\n !options?.ignoreOrientation &&\n o1.orientation[idx] !== o2.orientation[idx]\n ) {\n return false;\n }\n if (\n !options?.ignorePermutation &&\n o1.permutation[idx] !== o2.permutation[idx]\n ) {\n return false;\n }\n }\n return true;\n}\n\nexport function areTransformationsEquivalent(\n def: KPuzzleDefinition,\n t1: Transformation,\n t2: Transformation,\n): boolean {\n for (const orbitName in def.orbits) {\n if (!areOrbitTransformationsEquivalent(def, orbitName, t1, t2)) {\n return false;\n }\n }\n return true;\n}\n\nexport function areStatesEquivalent(\n def: KPuzzleDefinition,\n t1: Transformation,\n t2: Transformation,\n): boolean {\n // Turn transformations into states.\n // This accounts for indistinguishable pieces.\n return areTransformationsEquivalent(\n def,\n combineTransformations(def, def.startPieces, t1),\n combineTransformations(def, def.startPieces, t2),\n );\n}\n", "import { Alg, Move } from \"../alg\";\nimport type { QuantumMove } from \"../alg/units/leaves/Move\";\nimport type { KPuzzleDefinition, Transformation } from \"./definition_types\";\nimport type { MoveNotation } from \"./move_notation\";\nimport {\n combineTransformations,\n identityTransformation,\n multiplyTransformations,\n} from \"./transformations\";\n\n// TODO: Move other helpers into the definition.\nexport function transformationForQuantumMove(\n def: KPuzzleDefinition,\n quantumMove: QuantumMove,\n): Transformation {\n const transformation = getNotationLayer(def).lookupMove(\n new Move(quantumMove), // TODO\n );\n if (!transformation) {\n throw new Error(\"Unknown move: \" + quantumMove.toString());\n }\n return transformation;\n}\n\n// TODO: Move other helpers into the definition.\nexport function transformationForMove(\n def: KPuzzleDefinition,\n move: Move,\n): Transformation {\n const transformation = getNotationLayer(def).lookupMove(move);\n if (!transformation) {\n throw new Error(\"Unknown move: \" + move.toString());\n }\n return transformation;\n}\n\nexport function getNotationLayer(def: KPuzzleDefinition): MoveNotation {\n if (!def.moveNotation) {\n def.moveNotation = new KPuzzleMoveNotation(def);\n }\n return def.moveNotation;\n}\n\nclass KPuzzleMoveNotation implements MoveNotation {\n private cache: { [key: string]: Transformation } = {};\n constructor(public def: KPuzzleDefinition) {}\n\n public lookupMove(move: Move): Transformation | undefined {\n const key = move.toString();\n let r: Transformation | undefined = this.cache[key];\n if (r) {\n return r;\n }\n const quantumKey = move.quantum.toString();\n r = this.def.moves[quantumKey];\n if (r) {\n r = multiplyTransformations(this.def, r, move.amount);\n this.cache[key] = r;\n } else {\n // Handle e.g. `y2` if `y2` is defined.\n // Note: this doesn't handle multiples.\n // TODO: Should this be defined in a special place in the KPuzzle def instead of mixed with normal moves?\n r = this.def.moves[move.toString()];\n if (r) {\n this.cache[key] = r;\n } else {\n // Handle e.g. `y2'` if `y2` is defined.\n // Note: this doesn't handle multiples.\n // TODO: Should this be defined in a special place in the KPuzzle def instead of mixed with normal moves?\n r = this.def.moves[move.invert().toString()];\n if (r) {\n r = multiplyTransformations(this.def, r, -1);\n this.cache[key] = r;\n }\n }\n }\n\n return r;\n }\n}\n\nexport class KPuzzle {\n public state: Transformation;\n constructor(public definition: KPuzzleDefinition) {\n this.state = identityTransformation(definition);\n }\n\n public reset(): void {\n this.state = identityTransformation(this.definition);\n }\n\n public serialize(): string {\n let output = \"\";\n for (const orbitName in this.definition.orbits) {\n output += orbitName + \"\\n\";\n output += this.state[orbitName].permutation.join(\" \") + \"\\n\";\n output += this.state[orbitName].orientation.join(\" \") + \"\\n\";\n }\n output = output.slice(0, output.length - 1); // Trim last newline.\n return output;\n }\n\n public applyMove(move: Move): void {\n this.state = combineTransformations(\n this.definition,\n this.state,\n transformationForMove(this.definition, move),\n );\n }\n\n public applyAlg(alg: Alg): void {\n // TODO: use indexer instead of full expansion.\n for (const move of alg.experimentalLeafMoves()) {\n this.applyMove(move);\n }\n }\n // TODO: Implement\n // parseState(): this {}\n\n // TODO: Alg parsing\n\n // TODO: Implement.\n // invert(): this {}\n}\n", "/**\n * This module manages canonical sequences. You can merge sequences\n * combining moves (fully respecting commuting moves), and you can\n * generate canonical sequences efficiently.\n */\nimport type { Alg, Move } from \"../alg\";\nimport type { KPuzzleDefinition, Transformation } from \"./definition_types\";\nimport {\n areTransformationsEquivalent,\n combineTransformations,\n identityTransformation,\n} from \"./transformations\";\n\nclass InternalMove {\n constructor(public base: number, public twist: number) {}\n public getTransformation(canon: Canonicalizer): Transformation {\n return canon.transforms[this.base][this.twist];\n }\n\n public asString(canon: Canonicalizer): string {\n const mod = canon.moveorder[this.base];\n let tw = this.twist % mod;\n while (tw + tw > mod) {\n tw -= mod;\n }\n while (tw + tw <= -mod) {\n tw += mod;\n }\n const nam = canon.movenames[this.base];\n if (tw === 1) {\n return nam;\n } else if (tw === -1) {\n return nam + \"'\";\n } else if (tw > 0) {\n return nam + tw;\n } else if (tw < 0) {\n return nam + -tw + \"'\";\n } else {\n throw new Error(\"Stringifying null move?\");\n }\n }\n}\n\n// represents puzzle move data and its commuting structure\nexport class Canonicalizer {\n public commutes: boolean[][] = [];\n public moveorder: number[] = [];\n public movenames: string[] = [];\n public transforms: Transformation[][] = [];\n public moveindex: { [key: string]: number } = {};\n public baseMoveCount: number;\n constructor(public def: KPuzzleDefinition) {\n const basemoves = def.moves;\n const id = identityTransformation(def);\n for (const mv1 in basemoves) {\n this.moveindex[mv1] = this.movenames.length;\n this.movenames.push(mv1);\n this.transforms.push([id, basemoves[mv1]]);\n }\n this.baseMoveCount = this.movenames.length;\n for (let i = 0; i < this.baseMoveCount; i++) {\n this.commutes.push([]);\n const t1 = this.transforms[i][1];\n for (let j = 0; j < this.baseMoveCount; j++) {\n const t2 = this.transforms[j][1];\n const ab = combineTransformations(def, t1, t2);\n const ba = combineTransformations(def, t2, t1);\n this.commutes[i][j] = areTransformationsEquivalent(def, ab, ba);\n }\n }\n for (let i = 0; i < this.baseMoveCount; i++) {\n const t1 = this.transforms[i][1];\n let ct = t1;\n let order = 1;\n for (let mult = 2; !areTransformationsEquivalent(def, id, ct); mult++) {\n order++;\n ct = combineTransformations(def, ct, t1);\n this.transforms[i].push(ct);\n }\n this.moveorder[i] = order;\n }\n }\n\n public blockMoveToInternalMove(move: Move): InternalMove {\n const quantumMoveStr = move.quantum.toString();\n if (!(quantumMoveStr in this.def.moves)) {\n throw new Error(\"! move \" + quantumMoveStr + \" not in def.\");\n }\n const ind = this.moveindex[quantumMoveStr];\n const mod = this.moveorder[ind];\n let tw = move.amount % mod; // TODO\n if (tw < 0) {\n tw = (tw + mod) % mod;\n }\n return new InternalMove(ind, tw);\n }\n\n // Sequence must be simple sequence of block moves\n // this one does not attempt to merge.\n public sequenceToSearchSequence(\n alg: Alg,\n tr?: Transformation,\n ): SearchSequence {\n const ss = new SearchSequence(this, tr);\n for (const move of alg.experimentalLeafMoves()) {\n ss.appendOneMove(this.blockMoveToInternalMove(move));\n }\n return ss;\n }\n\n // Sequence to simple sequence, with merging.\n public mergeSequenceToSearchSequence(\n alg: Alg,\n tr?: Transformation,\n ): SearchSequence {\n const ss = new SearchSequence(this, tr);\n for (const move of alg.experimentalLeafMoves()) {\n ss.mergeOneMove(this.blockMoveToInternalMove(move));\n }\n return ss;\n }\n}\n\n// represents a single sequence we are working on\n// this can be a search sequence, or it can be a\n// \"cooked\" sequence that we want to use efficiently.\nexport class SearchSequence {\n public moveseq: InternalMove[] = [];\n public trans: Transformation;\n constructor(private canon: Canonicalizer, tr?: Transformation) {\n if (tr) {\n this.trans = tr;\n } else {\n this.trans = identityTransformation(canon.def);\n }\n }\n\n /*\n * A common use for search sequences is to extend them, but\n * sometimes we shouldn't modify the returned one. This\n * method gives you a copy you can do whatever you want with.\n */\n public clone(): SearchSequence {\n const r = new SearchSequence(this.canon, this.trans);\n r.moveseq = [...this.moveseq];\n return r;\n }\n\n // returns 1 if the move is added, 0 if it is merged, -1 if it cancels a move\n public mergeOneMove(mv: InternalMove): number {\n const r = this.onlyMergeOneMove(mv);\n this.trans = combineTransformations(\n this.canon.def,\n this.trans,\n mv.getTransformation(this.canon),\n );\n return r;\n }\n\n // does not do merge work; just slaps the new move on\n public appendOneMove(mv: InternalMove): number {\n this.moveseq.push(mv);\n this.trans = combineTransformations(\n this.canon.def,\n this.trans,\n mv.getTransformation(this.canon),\n );\n return 1;\n }\n\n // pop a move off.\n public popMove(): number {\n const mv = this.moveseq.pop();\n if (!mv) {\n throw new Error(\"Can't pop an empty sequence\");\n }\n this.trans = combineTransformations(\n this.canon.def,\n this.trans,\n this.canon.transforms[mv.base][this.canon.moveorder[mv.base] - mv.twist],\n );\n return 1;\n }\n\n // do one more twist of the last move\n public oneMoreTwist(): number {\n const lastmv = this.moveseq[this.moveseq.length - 1];\n this.trans = combineTransformations(\n this.canon.def,\n this.trans,\n this.canon.transforms[lastmv.base][1],\n );\n this.moveseq[this.moveseq.length - 1] = new InternalMove(\n lastmv.base,\n lastmv.twist + 1,\n );\n return 0;\n }\n\n private onlyMergeOneMove(mv: InternalMove): number {\n let j = this.moveseq.length - 1;\n while (j >= 0) {\n if (mv.base === this.moveseq[j].base) {\n const mo = this.canon.moveorder[mv.base];\n let twist = (mv.twist + this.moveseq[j].twist) % mo;\n if (twist < 0) {\n twist = (twist + mo) % mo;\n }\n if (twist === 0) {\n // this splice should not be a performance problem because the\n // typical number of following moves should be small\n this.moveseq.splice(j, 1);\n return -1;\n } else {\n this.moveseq[j] = new InternalMove(mv.base, twist);\n return 0;\n }\n } else if (this.canon.commutes[mv.base][this.moveseq[j].base]) {\n j--;\n } else {\n break;\n }\n }\n this.moveseq.push(mv);\n return 1;\n }\n\n // returns the length of the merged sequence.\n public mergeSequence(seq: SearchSequence): number {\n let r = this.moveseq.length;\n for (let i = 0; i < seq.moveseq.length; i++) {\n const mv = seq.moveseq[i];\n const d = this.onlyMergeOneMove(mv);\n r += d;\n }\n this.trans = combineTransformations(this.canon.def, this.trans, seq.trans);\n return r;\n }\n\n public getSequenceAsString(): string {\n const r: string[] = [];\n for (const mv of this.moveseq) {\n r.push(mv.asString(this.canon));\n }\n return r.join(\" \");\n }\n}\n\n/*\n * Iterate through canonical sequences by length. This version\n * uses generators.\n */\nexport class CanonicalSequenceIterator {\n public ss: SearchSequence;\n public targetLength: number;\n constructor(public canon: Canonicalizer, state?: Transformation) {\n this.ss = new SearchSequence(canon, state);\n this.targetLength = 0;\n }\n\n public nextState(base: number, canonstate: number[]): null | number[] {\n const newstate: number[] = [];\n for (const prevbase of canonstate) {\n if (prevbase === base) {\n return null;\n } else if (!this.canon.commutes[prevbase][base]) {\n // don't do anything in this case\n } else if (base < prevbase) {\n return null;\n } else {\n newstate.push(prevbase);\n }\n }\n return newstate;\n }\n\n public *genSequence(\n togo: number,\n canonstate: number[],\n ): Generator<SearchSequence, null, void> {\n if (togo === 0) {\n yield this.ss;\n } else {\n for (let base = 0; base < this.canon.baseMoveCount; base++) {\n const newstate = this.nextState(base, canonstate);\n if (newstate) {\n newstate.push(base);\n for (let tw = 1; tw < this.canon.moveorder[base]; tw++) {\n this.ss.appendOneMove(new InternalMove(base, tw));\n yield* this.genSequence(togo - 1, newstate);\n this.ss.popMove();\n }\n }\n }\n }\n return null;\n }\n\n public *generator(): Generator<SearchSequence, SearchSequence, void> {\n for (let d = 0; ; d++) {\n yield* this.genSequence(d, []);\n }\n }\n\n public *genSequenceTree(\n canonstate: number[],\n ): Generator<SearchSequence, null, number> {\n const r = yield this.ss;\n if (r > 0) {\n return null;\n }\n for (let base = 0; base < this.canon.baseMoveCount; base++) {\n const newstate = this.nextState(base, canonstate);\n if (newstate) {\n newstate.push(base);\n for (let tw = 1; tw < this.canon.moveorder[base]; tw++) {\n this.ss.appendOneMove(new InternalMove(base, tw));\n yield* this.genSequenceTree(newstate);\n this.ss.popMove();\n }\n }\n }\n return null;\n }\n}\n", "// Generated by Peggy 1.1.0.\n//\n// https://peggyjs.org/\n\nfunction peg$subclass(child, parent) {\n function C() {\n this.constructor = child;\n }\n C.prototype = parent.prototype;\n child.prototype = new C();\n}\n\nfunction peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n}\n\npeg$subclass(peg$SyntaxError, Error);\n\npeg$SyntaxError.buildMessage = function (expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function (expectation) {\n return '\"' + literalEscape(expectation.text) + '\"';\n },\n\n class: function (expectation) {\n var escapedParts = expectation.parts.map(function (part) {\n return Array.isArray(part)\n ? classEscape(part[0]) + \"-\" + classEscape(part[1])\n : classEscape(part);\n });\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function () {\n return \"any character\";\n },\n\n end: function () {\n return \"end of input\";\n },\n\n other: function (expectation) {\n return expectation.description;\n },\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function (ch) {\n return \"\\\\x0\" + hex(ch);\n })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) {\n return \"\\\\x\" + hex(ch);\n });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\]/g, \"\\\\]\")\n .replace(/\\^/g, \"\\\\^\")\n .replace(/-/g, \"\\\\-\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function (ch) {\n return \"\\\\x0\" + hex(ch);\n })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) {\n return \"\\\\x\" + hex(ch);\n });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = expected.map(describeExpectation);\n var i, j;\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return (\n descriptions.slice(0, -1).join(\", \") +\n \", or \" +\n descriptions[descriptions.length - 1]\n );\n }\n }\n\n function describeFound(found) {\n return found ? '\"' + literalEscape(found) + '\"' : \"end of input\";\n }\n\n return (\n \"Expected \" +\n describeExpected(expected) +\n \" but \" +\n describeFound(found) +\n \" found.\"\n );\n};\n\nfunction peg$parse(input, options) {\n options = options !== undefined ? options : {};\n\n var peg$FAILED = {};\n\n var peg$startRuleFunctions = { start: peg$parsestart };\n var peg$startRuleFunction = peg$parsestart;\n\n var peg$c0 = function (def) {\n return fixMoves(def);\n };\n var peg$c1 = /^[A-Za-z0-9<>]/;\n var peg$c2 = peg$classExpectation(\n [[\"A\", \"Z\"], [\"a\", \"z\"], [\"0\", \"9\"], \"<\", \">\"],\n false,\n false,\n );\n var peg$c3 = function (characters) {\n return characters.join(\"\");\n };\n var peg$c4 = /^[A-Za-z]/;\n var peg$c5 = peg$classExpectation(\n [\n [\"A\", \"Z\"],\n [\"a\", \"z\"],\n ],\n false,\n false,\n );\n var peg$c6 = /^[A-Za-z0-9]/;\n var peg$c7 = peg$classExpectation(\n [\n [\"A\", \"Z\"],\n [\"a\", \"z\"],\n [\"0\", \"9\"],\n ],\n false,\n false,\n );\n var peg$c8 = function (first, rest) {\n return [first].concat(rest).join(\"\");\n };\n var peg$c9 = /^[0-9]/;\n var peg$c10 = peg$classExpectation([[\"0\", \"9\"]], false, false);\n var peg$c11 = function (characters) {\n return parseInt(characters.join(\"\"), 10);\n };\n var peg$c12 = \" \";\n var peg$c13 = peg$literalExpectation(\" \", false);\n var peg$c14 = \"Name\";\n var peg$c15 = peg$literalExpectation(\"Name\", false);\n var peg$c16 = function (identifier) {\n return identifier;\n };\n var peg$c17 = \"Set\";\n var peg$c18 = peg$literalExpectation(\"Set\", false);\n var peg$c19 = function (set_identifier, num_pieces, num_orientations) {\n return [\n set_identifier,\n { numPieces: num_pieces, orientations: num_orientations },\n ];\n };\n var peg$c20 = function (orbit, orbits) {\n orbits[orbit[0]] = orbit[1];\n return orbits;\n };\n var peg$c21 = function (orbit) {\n const orbits = {};\n orbits[orbit[0]] = orbit[1];\n return orbits;\n };\n var peg$c22 = \"\\n\";\n var peg$c23 = peg$literalExpectation(\"\\n\", false);\n var peg$c24 = function (num, nums) {\n return [num].concat(nums);\n };\n var peg$c25 = function (num) {\n return [num];\n };\n var peg$c26 = function (nums) {\n return fixPermutation(nums);\n };\n var peg$c27 = function (set_identifier, permutation, nums) {\n return [set_identifier, { permutation: permutation, orientation: nums }];\n };\n var peg$c28 = function (set_identifier, permutation) {\n return [\n set_identifier,\n {\n permutation: permutation,\n orientation: new Array(permutation.length).fill(0),\n },\n ];\n };\n var peg$c29 = function (definition, definitions) {\n definitions[definition[0]] = definition[1];\n return definitions;\n };\n var peg$c30 = function (definition) {\n const definitions = {};\n definitions[definition[0]] = definition[1];\n return definitions;\n };\n var peg$c31 = \"Solved\";\n var peg$c32 = peg$literalExpectation(\"Solved\", false);\n var peg$c33 = \"End\";\n var peg$c34 = peg$literalExpectation(\"End\", false);\n var peg$c35 = function (definitions) {\n return definitions;\n };\n var peg$c36 = \"Move\";\n var peg$c37 = peg$literalExpectation(\"Move\", false);\n var peg$c38 = function (identifier, definitions) {\n return [identifier, definitions];\n };\n var peg$c39 = function (move, moves) {\n moves[move[0]] = move[1];\n return moves;\n };\n var peg$c40 = function (move) {\n const moves = {};\n moves[move[0]] = move[1];\n return moves;\n };\n var peg$c41 = function (name, orbits, start_pieces, moves) {\n return {\n name: name,\n orbits: orbits,\n moves: moves,\n startPieces: start_pieces,\n };\n };\n\n var peg$currPos = 0;\n var peg$savedPos = 0;\n var peg$posDetailsCache = [{ line: 1, column: 1 }];\n var peg$maxFailPos = 0;\n var peg$maxFailExpected = [];\n var peg$silentFails = 0;\n\n var peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\n \"Can't start parsing from rule \\\"\" + options.startRule + '\".',\n );\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location =\n location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location,\n );\n }\n\n function error(message, location) {\n location =\n location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return {\n type: \"class\",\n parts: parts,\n inverted: inverted,\n ignoreCase: ignoreCase,\n };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos];\n var p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column,\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos);\n var endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column,\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column,\n },\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) {\n return;\n }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location,\n );\n }\n\n function peg$parsestart() {\n var s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parseDEFINITION_FILE();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseIDENTIFIER() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n if (peg$c1.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c2);\n }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c1.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c2);\n }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseSET_IDENTIFIER() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (peg$c4.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c5);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c6.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c6.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c8(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseNUMBER() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n if (peg$c9.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c10);\n }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c9.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c10);\n }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c11(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseSPACE() {\n var s0;\n\n if (input.charCodeAt(peg$currPos) === 32) {\n s0 = peg$c12;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c13);\n }\n }\n\n return s0;\n }\n\n function peg$parseNAME() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 4) === peg$c14) {\n s1 = peg$c14;\n peg$currPos += 4;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c15);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseSPACE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseIDENTIFIER();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseORBIT() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c17) {\n s1 = peg$c17;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c18);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseSPACE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseSET_IDENTIFIER();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseSPACE();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseNUMBER();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseSPACE();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseNUMBER();\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c19(s3, s5, s7);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseORBITS() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parseORBIT();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNEWLINE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseORBITS();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseORBIT();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c21(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseNEWLINE() {\n var s0;\n\n if (input.charCodeAt(peg$currPos) === 10) {\n s0 = peg$c22;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c23);\n }\n }\n\n return s0;\n }\n\n function peg$parseNEWLINES() {\n var s0, s1;\n\n s0 = [];\n if (input.charCodeAt(peg$currPos) === 10) {\n s1 = peg$c22;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c23);\n }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (input.charCodeAt(peg$currPos) === 10) {\n s1 = peg$c22;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c23);\n }\n }\n }\n } else {\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseOPTIONAL_NEWLINES() {\n var s0, s1;\n\n s0 = [];\n if (input.charCodeAt(peg$currPos) === 10) {\n s1 = peg$c22;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c23);\n }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (input.charCodeAt(peg$currPos) === 10) {\n s1 = peg$c22;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c23);\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseNUMBERS() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parseNUMBER();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseSPACE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseNUMBERS();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c24(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseNUMBER();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c25(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsePERMUTATION() {\n var s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parseNUMBERS();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c26(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseDEFINITION() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$parseSET_IDENTIFIER();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNEWLINE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsePERMUTATION();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseNEWLINE();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseNUMBERS();\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c27(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseSET_IDENTIFIER();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNEWLINE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsePERMUTATION();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c28(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseDEFINITIONS() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parseDEFINITION();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNEWLINE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseDEFINITIONS();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c29(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseDEFINITION();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c30(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseSTART_PIECES() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 6) === peg$c31) {\n s1 = peg$c31;\n peg$currPos += 6;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c32);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNEWLINE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseDEFINITIONS();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseNEWLINE();\n if (s4 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c33) {\n s5 = peg$c33;\n peg$currPos += 3;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c34);\n }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c35(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseMOVE() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 4) === peg$c36) {\n s1 = peg$c36;\n peg$currPos += 4;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c37);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseSPACE();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseIDENTIFIER();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseNEWLINE();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseDEFINITIONS();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseNEWLINE();\n if (s6 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c33) {\n s7 = peg$c33;\n peg$currPos += 3;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c34);\n }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c38(s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseMOVES() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parseMOVE();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNEWLINES();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseMOVES();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseMOVE();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c40(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseDEFINITION_FILE() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = peg$parseNAME();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNEWLINES();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseORBITS();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseNEWLINES();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseSTART_PIECES();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseNEWLINES();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseMOVES();\n if (s7 !== peg$FAILED) {\n s8 = peg$parseOPTIONAL_NEWLINES();\n if (s8 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c41(s1, s3, s5, s7);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function fixPermutation(permutation) {\n return permutation.map((x) => x - 1);\n }\n\n function fixMoves(def) {\n for (const moveName in def.moves) {\n const move = def.moves[moveName];\n for (const orbitName in def.orbits) {\n const moveOrbit = move[orbitName];\n const oldOrientation = moveOrbit.orientation;\n const perm = moveOrbit.permutation;\n const newOrientation = new Array(oldOrientation.length);\n for (let i = 0; i < perm.length; i++) {\n newOrientation[i] = oldOrientation[perm[i]];\n }\n moveOrbit.orientation = newOrientation;\n }\n }\n return def;\n }\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos),\n );\n }\n}\n\nexport { peg$SyntaxError as SyntaxError, peg$parse as parse };\n", "// Note: this file exists so that `parse` doesn't show up for autocompletion (by\n// avoiding a `parser-pegjs.d.ts` file that exports `parse`.)\n\nimport type { KPuzzleDefinition } from \"../definition_types\";\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { parse } from \"./parser-peggy\";\n\nconst pegParseKPuzzleDefinition: (s: string) => KPuzzleDefinition = parse;\n\nexport { pegParseKPuzzleDefinition };\n", "export { pegParseKPuzzleDefinition as parseKPuzzleDefinition } from \"./parser-shim\";\n", "import type {\n FaceletMeshAppearance,\n PuzzleAppearance,\n} from \"../puzzles/stickerings/appearance\"; // TODO\nimport type { KPuzzleDefinition, Transformation } from \"./definition_types\";\nimport type { KPuzzle } from \"./kpuzzle\";\n\nconst xmlns = \"http://www.w3.org/2000/svg\";\n\n// Unique ID mechanism to keep SVG gradient element IDs unique. TODO: Is there\n// something more performant, and that can't be broken by other elements of the\n// page? (And also doesn't break if this library is run in parallel.)\nlet svgCounter = 0;\nfunction nextSVGID(): string {\n svgCounter += 1;\n return \"svg\" + svgCounter.toString();\n}\n\n// TODO: This is hardcoded to 3x3x3 SVGs\nconst colorMaps: Partial<\n Record<FaceletMeshAppearance, Record<string, string>>\n> = {\n dim: {\n \"white\": \"#dddddd\",\n \"orange\": \"#884400\",\n \"limegreen\": \"#008800\",\n \"red\": \"#660000\",\n \"rgb(34, 102, 255)\": \"#000088\", // TODO\n \"yellow\": \"#888800\",\n },\n oriented: {\n \"white\": \"#ff88ff\",\n \"orange\": \"#ff88ff\",\n \"limegreen\": \"#ff88ff\",\n \"red\": \"#ff88ff\",\n \"rgb(34, 102, 255)\": \"#ff88ff\", // TODO\n \"yellow\": \"#ff88ff\",\n },\n ignored: {\n \"white\": \"#444444\",\n \"orange\": \"#444444\",\n \"limegreen\": \"#444444\",\n \"red\": \"#444444\",\n \"rgb(34, 102, 255)\": \"#444444\", // TODO\n \"yellow\": \"#444444\",\n },\n invisible: {\n \"white\": \"#00000000\",\n \"orange\": \"#00000000\",\n \"limegreen\": \"#00000000\",\n \"red\": \"#00000000\",\n \"rgb(34, 102, 255)\": \"#00000000\", // TODO\n \"yellow\": \"#00000000\",\n },\n};\n\nexport class KPuzzleSVGWrapper {\n public element: HTMLElement;\n public gradientDefs: SVGDefsElement;\n private originalColors: { [type: string]: string } = {};\n private gradients: { [type: string]: SVGGradientElement } = {};\n private svgID: string;\n constructor(\n public kPuzzleDefinition: KPuzzleDefinition,\n svgSource: string,\n experimentalAppearance?: PuzzleAppearance,\n ) {\n if (!svgSource) {\n throw new Error(\n `No SVG definition for puzzle type: ${kPuzzleDefinition.name}`,\n );\n }\n\n this.svgID = nextSVGID();\n\n this.element = document.createElement(\"div\");\n this.element.classList.add(\"svg-wrapper\");\n // TODO: Sanitization.\n this.element.innerHTML = svgSource;\n\n const svgElem = this.element.querySelector(\"svg\");\n if (!svgElem) {\n throw new Error(\"Could not get SVG element\");\n }\n if (xmlns !== svgElem.namespaceURI) {\n throw new Error(\"Unexpected XML namespace\");\n }\n svgElem.style.maxWidth = \"100%\";\n svgElem.style.maxHeight = \"100%\";\n this.gradientDefs = document.createElementNS(xmlns, \"defs\");\n svgElem.insertBefore(this.gradientDefs, svgElem.firstChild);\n\n for (const orbitName in kPuzzleDefinition.orbits) {\n const orbitDefinition = kPuzzleDefinition.orbits[orbitName];\n\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n for (\n let orientation = 0;\n orientation < orbitDefinition.orientations;\n orientation++\n ) {\n const id = this.elementID(orbitName, idx, orientation);\n const elem = this.elementByID(id);\n let originalColor: string = elem.style.fill;\n /// TODO: Allow setting appearance dynamically.\n if (experimentalAppearance) {\n (() => {\n // TODO: dedup with Cube3D,,factor out fallback calculations\n const a = experimentalAppearance.orbits;\n if (!a) {\n return;\n }\n const orbitAppearance = a[orbitName];\n if (!orbitAppearance) {\n return;\n }\n const pieceAppearance = orbitAppearance.pieces[idx];\n if (!pieceAppearance) {\n return;\n }\n const faceletAppearance = pieceAppearance.facelets[orientation];\n if (!faceletAppearance) {\n return;\n }\n const appearance =\n typeof faceletAppearance === \"string\"\n ? faceletAppearance\n : faceletAppearance?.appearance;\n const colorMap = colorMaps[appearance];\n if (colorMap) {\n originalColor = colorMap[originalColor];\n }\n })();\n } else {\n originalColor = elem.style.fill;\n }\n this.originalColors[id] = originalColor;\n this.gradients[id] = this.newGradient(id, originalColor);\n this.gradientDefs.appendChild(this.gradients[id]);\n elem.setAttribute(\"style\", `fill: url(#grad-${this.svgID}-${id})`);\n }\n }\n }\n }\n\n public drawKPuzzle(\n kpuzzle: KPuzzle,\n nextState?: Transformation,\n fraction?: number,\n ): void {\n this.draw(kpuzzle.definition, kpuzzle.state, nextState, fraction);\n }\n\n // TODO: save definition in the constructor?\n public draw(\n definition: KPuzzleDefinition,\n state: Transformation,\n nextState?: Transformation,\n fraction?: number,\n ): void {\n for (const orbitName in definition.orbits) {\n const orbitDefinition = definition.orbits[orbitName];\n\n const curOrbitState = state[orbitName];\n const nextOrbitState = nextState ? nextState[orbitName] : null;\n for (let idx = 0; idx < orbitDefinition.numPieces; idx++) {\n for (\n let orientation = 0;\n orientation < orbitDefinition.orientations;\n orientation++\n ) {\n const id = this.elementID(orbitName, idx, orientation);\n const fromCur = this.elementID(\n orbitName,\n curOrbitState.permutation[idx],\n (orbitDefinition.orientations -\n curOrbitState.orientation[idx] +\n orientation) %\n orbitDefinition.orientations,\n );\n let singleColor = false;\n if (nextOrbitState) {\n const fromNext = this.elementID(\n orbitName,\n nextOrbitState.permutation[idx],\n (orbitDefinition.orientations -\n nextOrbitState.orientation[idx] +\n orientation) %\n orbitDefinition.orientations,\n );\n if (fromCur === fromNext) {\n singleColor = true; // TODO: Avoid redundant work during move.\n }\n fraction = fraction || 0; // TODO Use the type system to tie this to nextState?\n const easedBackwardsPercent =\n 100 * (1 - fraction * fraction * (2 - fraction * fraction)); // TODO: Move easing up the stack.\n this.gradients[id].children[0].setAttribute(\n \"stop-color\",\n this.originalColors[fromCur],\n );\n this.gradients[id].children[1].setAttribute(\n \"stop-color\",\n this.originalColors[fromCur],\n );\n this.gradients[id].children[1].setAttribute(\n \"offset\",\n `${Math.max(easedBackwardsPercent - 5, 0)}%`,\n );\n this.gradients[id].children[2].setAttribute(\n \"offset\",\n `${Math.max(easedBackwardsPercent - 5, 0)}%`,\n );\n this.gradients[id].children[3].setAttribute(\n \"offset\",\n `${easedBackwardsPercent}%`,\n );\n this.gradients[id].children[4].setAttribute(\n \"offset\",\n `${easedBackwardsPercent}%`,\n );\n this.gradients[id].children[4].setAttribute(\n \"stop-color\",\n this.originalColors[fromNext],\n );\n this.gradients[id].children[5].setAttribute(\n \"stop-color\",\n this.originalColors[fromNext],\n );\n } else {\n singleColor = true; // TODO: Avoid redundant work during move.\n }\n if (singleColor) {\n this.gradients[id].children[0].setAttribute(\n \"stop-color\",\n this.originalColors[fromCur],\n );\n this.gradients[id].children[1].setAttribute(\n \"stop-color\",\n this.originalColors[fromCur],\n );\n this.gradients[id].children[1].setAttribute(\"offset\", `100%`);\n this.gradients[id].children[2].setAttribute(\"offset\", `100%`);\n this.gradients[id].children[3].setAttribute(\"offset\", `100%`);\n this.gradients[id].children[4].setAttribute(\"offset\", `100%`);\n }\n // this.gradients[id]\n // this.elementByID(id).style.fill = this.originalColors[from];\n }\n }\n }\n }\n\n private newGradient(id: string, originalColor: string): SVGGradientElement {\n const grad = document.createElementNS(\n xmlns,\n \"radialGradient\",\n ) as SVGGradientElement;\n grad.setAttribute(\"id\", `grad-${this.svgID}-${id}`);\n grad.setAttribute(\"r\", `70.7107%`); // TODO: Adapt to puzzle.\n const stopDefs = [\n { offset: 0, color: originalColor },\n { offset: 0, color: originalColor },\n { offset: 0, color: \"black\" },\n { offset: 0, color: \"black\" },\n { offset: 0, color: originalColor },\n { offset: 100, color: originalColor },\n ];\n for (const stopDef of stopDefs) {\n const stop = document.createElementNS(xmlns, \"stop\");\n stop.setAttribute(\"offset\", `${stopDef.offset}%`);\n stop.setAttribute(\"stop-color\", stopDef.color);\n stop.setAttribute(\"stop-opacity\", \"1\");\n grad.appendChild(stop);\n }\n return grad;\n }\n\n private elementID(\n orbitName: string,\n idx: number,\n orientation: number,\n ): string {\n return orbitName + \"-l\" + idx + \"-o\" + orientation;\n }\n\n private elementByID(id: string): HTMLElement {\n // TODO: Use classes and scope selector to SVG element.\n return this.element.querySelector(\"#\" + id) as HTMLElement;\n }\n}\n", "// TODO: This file is here to avoid dependency loops, but it should eventually\n// move back into `cubing/puzzles`. We currently have a few functions that are\n// hardcoded to require synchronous access to this definition, and we need to\n// find a better way to do that.\n\n// TODO: this would be a raw `.json` file, but Parcel runs into an error from\n\nimport type { KPuzzleDefinition } from \"..\";\n\n// using that as both a sync and async import. Probably https://github.com/parcel-bundler/parcel/issues/2546\nexport const cube3x3x3KPuzzle: KPuzzleDefinition = {\n name: \"3x3x3\",\n orbits: {\n EDGES: { numPieces: 12, orientations: 2 },\n CORNERS: { numPieces: 8, orientations: 3 },\n CENTERS: { numPieces: 6, orientations: 4 },\n },\n startPieces: {\n EDGES: {\n permutation: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [0, 1, 2, 3, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 1, 2, 3, 4, 5],\n orientation: [0, 0, 0, 0, 0, 0],\n },\n },\n moves: {\n U: {\n EDGES: {\n permutation: [1, 2, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [1, 2, 3, 0, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 1, 2, 3, 4, 5],\n orientation: [1, 0, 0, 0, 0, 0],\n },\n },\n y: {\n EDGES: {\n permutation: [1, 2, 3, 0, 5, 6, 7, 4, 10, 8, 11, 9],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],\n },\n CORNERS: {\n permutation: [1, 2, 3, 0, 7, 4, 5, 6],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 2, 3, 4, 1, 5],\n orientation: [1, 0, 0, 0, 0, 3],\n },\n },\n x: {\n EDGES: {\n permutation: [4, 8, 0, 9, 6, 10, 2, 11, 5, 7, 1, 3],\n orientation: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [4, 0, 3, 5, 7, 6, 2, 1],\n orientation: [2, 1, 2, 1, 1, 2, 1, 2],\n },\n CENTERS: {\n permutation: [2, 1, 5, 3, 0, 4],\n orientation: [0, 3, 0, 1, 2, 2],\n },\n },\n L: {\n EDGES: {\n permutation: [0, 1, 2, 11, 4, 5, 6, 9, 8, 3, 10, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [0, 1, 6, 2, 4, 3, 5, 7],\n orientation: [0, 0, 2, 1, 0, 2, 1, 0],\n },\n CENTERS: {\n permutation: [0, 1, 2, 3, 4, 5],\n orientation: [0, 1, 0, 0, 0, 0],\n },\n },\n F: {\n EDGES: {\n permutation: [9, 1, 2, 3, 8, 5, 6, 7, 0, 4, 10, 11],\n orientation: [1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0],\n },\n CORNERS: {\n permutation: [3, 1, 2, 5, 0, 4, 6, 7],\n orientation: [1, 0, 0, 2, 2, 1, 0, 0],\n },\n CENTERS: {\n permutation: [0, 1, 2, 3, 4, 5],\n orientation: [0, 0, 1, 0, 0, 0],\n },\n },\n R: {\n EDGES: {\n permutation: [0, 8, 2, 3, 4, 10, 6, 7, 5, 9, 1, 11],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [4, 0, 2, 3, 7, 5, 6, 1],\n orientation: [2, 1, 0, 0, 1, 0, 0, 2],\n },\n CENTERS: {\n permutation: [0, 1, 2, 3, 4, 5],\n orientation: [0, 0, 0, 1, 0, 0],\n },\n },\n B: {\n EDGES: {\n permutation: [0, 1, 10, 3, 4, 5, 11, 7, 8, 9, 6, 2],\n orientation: [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1],\n },\n CORNERS: {\n permutation: [0, 7, 1, 3, 4, 5, 2, 6],\n orientation: [0, 2, 1, 0, 0, 0, 2, 1],\n },\n CENTERS: {\n permutation: [0, 1, 2, 3, 4, 5],\n orientation: [0, 0, 0, 0, 1, 0],\n },\n },\n D: {\n EDGES: {\n permutation: [0, 1, 2, 3, 7, 4, 5, 6, 8, 9, 10, 11],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [0, 1, 2, 3, 5, 6, 7, 4],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 1, 2, 3, 4, 5],\n orientation: [0, 0, 0, 0, 0, 1],\n },\n },\n z: {\n EDGES: {\n permutation: [9, 3, 11, 7, 8, 1, 10, 5, 0, 4, 2, 6],\n orientation: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n },\n CORNERS: {\n permutation: [3, 2, 6, 5, 0, 4, 7, 1],\n orientation: [1, 2, 1, 2, 2, 1, 2, 1],\n },\n CENTERS: {\n permutation: [1, 5, 2, 0, 4, 3],\n orientation: [1, 1, 1, 1, 3, 1],\n },\n },\n M: {\n EDGES: {\n permutation: [2, 1, 6, 3, 0, 5, 4, 7, 8, 9, 10, 11],\n orientation: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [0, 1, 2, 3, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [4, 1, 0, 3, 5, 2],\n orientation: [2, 0, 0, 0, 2, 0],\n },\n },\n E: {\n EDGES: {\n permutation: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 8, 10],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],\n },\n CORNERS: {\n permutation: [0, 1, 2, 3, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 4, 1, 2, 3, 5],\n orientation: [0, 0, 0, 0, 0, 0],\n },\n },\n S: {\n EDGES: {\n permutation: [0, 3, 2, 7, 4, 1, 6, 5, 8, 9, 10, 11],\n orientation: [0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [0, 1, 2, 3, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [1, 5, 2, 0, 4, 3],\n orientation: [1, 1, 0, 1, 0, 1],\n },\n },\n u: {\n EDGES: {\n permutation: [1, 2, 3, 0, 4, 5, 6, 7, 10, 8, 11, 9],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],\n },\n CORNERS: {\n permutation: [1, 2, 3, 0, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 2, 3, 4, 1, 5],\n orientation: [1, 0, 0, 0, 0, 0],\n },\n },\n l: {\n EDGES: {\n permutation: [2, 1, 6, 11, 0, 5, 4, 9, 8, 3, 10, 7],\n orientation: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [0, 1, 6, 2, 4, 3, 5, 7],\n orientation: [0, 0, 2, 1, 0, 2, 1, 0],\n },\n CENTERS: {\n permutation: [4, 1, 0, 3, 5, 2],\n orientation: [2, 1, 0, 0, 2, 0],\n },\n },\n f: {\n EDGES: {\n permutation: [9, 3, 2, 7, 8, 1, 6, 5, 0, 4, 10, 11],\n orientation: [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0],\n },\n CORNERS: {\n permutation: [3, 1, 2, 5, 0, 4, 6, 7],\n orientation: [1, 0, 0, 2, 2, 1, 0, 0],\n },\n CENTERS: {\n permutation: [1, 5, 2, 0, 4, 3],\n orientation: [1, 1, 1, 1, 0, 1],\n },\n },\n r: {\n EDGES: {\n permutation: [4, 8, 0, 3, 6, 10, 2, 7, 5, 9, 1, 11],\n orientation: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [4, 0, 2, 3, 7, 5, 6, 1],\n orientation: [2, 1, 0, 0, 1, 0, 0, 2],\n },\n CENTERS: {\n permutation: [2, 1, 5, 3, 0, 4],\n orientation: [0, 0, 0, 1, 2, 2],\n },\n },\n b: {\n EDGES: {\n permutation: [0, 5, 10, 1, 4, 7, 11, 3, 8, 9, 6, 2],\n orientation: [0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1],\n },\n CORNERS: {\n permutation: [0, 7, 1, 3, 4, 5, 2, 6],\n orientation: [0, 2, 1, 0, 0, 0, 2, 1],\n },\n CENTERS: {\n permutation: [3, 0, 2, 5, 4, 1],\n orientation: [3, 3, 0, 3, 1, 3],\n },\n },\n d: {\n EDGES: {\n permutation: [0, 1, 2, 3, 7, 4, 5, 6, 9, 11, 8, 10],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],\n },\n CORNERS: {\n permutation: [0, 1, 2, 3, 5, 6, 7, 4],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 4, 1, 2, 3, 5],\n orientation: [0, 0, 0, 0, 0, 1],\n },\n },\n },\n};\n\ncube3x3x3KPuzzle.moves[\"Uw\"] = cube3x3x3KPuzzle.moves[\"u\"];\ncube3x3x3KPuzzle.moves[\"Lw\"] = cube3x3x3KPuzzle.moves[\"l\"];\ncube3x3x3KPuzzle.moves[\"Fw\"] = cube3x3x3KPuzzle.moves[\"f\"];\ncube3x3x3KPuzzle.moves[\"Rw\"] = cube3x3x3KPuzzle.moves[\"r\"];\ncube3x3x3KPuzzle.moves[\"Bw\"] = cube3x3x3KPuzzle.moves[\"b\"];\ncube3x3x3KPuzzle.moves[\"Dw\"] = cube3x3x3KPuzzle.moves[\"d\"];\n\ncube3x3x3KPuzzle.moves[\"Rv\"] = cube3x3x3KPuzzle.moves[\"x\"];\ncube3x3x3KPuzzle.moves[\"Uv\"] = cube3x3x3KPuzzle.moves[\"y\"];\ncube3x3x3KPuzzle.moves[\"Fv\"] = cube3x3x3KPuzzle.moves[\"z\"];\ncube3x3x3KPuzzle.moves[\"Lv\"] = {\n EDGES: {\n permutation: [2, 10, 6, 11, 0, 8, 4, 9, 1, 3, 5, 7],\n orientation: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0],\n },\n CORNERS: {\n permutation: [1, 7, 6, 2, 0, 3, 5, 4],\n orientation: [2, 1, 2, 1, 1, 2, 1, 2],\n },\n CENTERS: {\n permutation: [4, 1, 0, 3, 5, 2],\n orientation: [2, 1, 0, 3, 2, 0],\n },\n};\ncube3x3x3KPuzzle.moves[\"Dv\"] = {\n EDGES: {\n permutation: [3, 0, 1, 2, 7, 4, 5, 6, 9, 11, 8, 10],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],\n },\n CORNERS: {\n permutation: [3, 0, 1, 2, 5, 6, 7, 4],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n CENTERS: {\n permutation: [0, 4, 1, 2, 3, 5],\n orientation: [3, 0, 0, 0, 0, 1],\n },\n};\ncube3x3x3KPuzzle.moves[\"Bv\"] = {\n EDGES: {\n permutation: [8, 5, 10, 1, 9, 7, 11, 3, 4, 0, 6, 2],\n orientation: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n },\n CORNERS: {\n permutation: [4, 7, 1, 0, 5, 3, 2, 6],\n orientation: [1, 2, 1, 2, 2, 1, 2, 1],\n },\n CENTERS: {\n permutation: [3, 0, 2, 5, 4, 1],\n orientation: [3, 3, 3, 3, 1, 3],\n },\n};\n", "export function identityPermutation(numElems: number): number[] {\n const arr = new Array<number>(numElems);\n for (let i = 0; i < numElems; i++) {\n arr[i] = i;\n }\n return arr;\n}\n\n// Inclusive start, exclusive end (similar to `Array.prototype.slice`)\nexport function orientationsToMask(\n radix: number,\n orientations: number[],\n): number {\n let val = 0;\n for (const orientation of orientations) {\n val *= radix;\n val += orientation;\n }\n return val;\n}\n\n// Inclusive start, exclusive end (similar to `Array.prototype.slice`)\nexport function maskToOrientations(\n radix: number,\n numElems: number,\n mask: number,\n): number[] {\n const arr = [];\n while (mask > 0) {\n arr.push(mask % radix);\n mask = Math.floor(mask / radix);\n }\n return new Array<number>(numElems - arr.length).fill(0).concat(arr.reverse());\n}\n\n// From https://www.jaapsch.net/puzzles/compindx.htm#perm\nexport function permutationToLex(permutation: number[]): number {\n const n = permutation.length;\n let lexicographicIdx = 0;\n for (let i = 0; i < n - 1; i++) {\n lexicographicIdx = lexicographicIdx * (n - i);\n for (let j = i + 1; j < n; j++) {\n if (permutation[i] > permutation[j]) {\n lexicographicIdx += 1;\n }\n }\n }\n return lexicographicIdx;\n}\n\n// From https://www.jaapsch.net/puzzles/compindx.htm#perm\nexport function lexToPermutation(\n numPieces: number,\n lexicographicIdx: number,\n): number[] {\n const permutation: number[] = new Array(numPieces);\n permutation[numPieces - 1] = 0;\n for (let i = numPieces - 2; i >= 0; i--) {\n permutation[i] = lexicographicIdx % (numPieces - i);\n lexicographicIdx = Math.floor(lexicographicIdx / (numPieces - i));\n for (let j = i + 1; j < numPieces; j++) {\n if (permutation[j] >= permutation[i]) {\n permutation[j] = permutation[j] + 1;\n }\n }\n }\n return permutation;\n}\n", "import { Alg } from \"../../alg\";\nimport {\n combineTransformations,\n invertTransformation,\n KPuzzle,\n Transformation,\n} from \"../../kpuzzle\";\n// TODO: Should we expose this directly in the `puzzles` package for sync uses?\nimport { experimentalCube3x3x3KPuzzle as def } from \"../../kpuzzle\";\n\nexport function puzzleOrientationIdx(state: Transformation): [number, number] {\n const idxU = state[\"CENTERS\"].permutation[0];\n const idxD = state[\"CENTERS\"].permutation[5];\n const unadjustedIdxL = state[\"CENTERS\"].permutation[1];\n let idxL = unadjustedIdxL;\n if (idxU < unadjustedIdxL) {\n idxL--;\n }\n if (idxD < unadjustedIdxL) {\n idxL--;\n }\n return [idxU, idxL];\n}\n\nconst puzzleOrientationCache: Transformation[][] = new Array(6)\n .fill(0)\n .map(() => {\n return new Array<Transformation>(6);\n });\n\n// We use a new block to avoid keeping a reference to temporary vars.\n{\n const orientationKpuzzle = new KPuzzle(def);\n const uAlgs: Alg[] = [\"\", \"z\", \"x\", \"z'\", \"x'\", \"x2\"].map((s) =>\n Alg.fromString(s),\n );\n const yAlg = new Alg(\"y\");\n for (const uAlg of uAlgs) {\n orientationKpuzzle.reset();\n orientationKpuzzle.applyAlg(uAlg);\n for (let i = 0; i < 4; i++) {\n orientationKpuzzle.applyAlg(yAlg);\n const [idxU, idxL] = puzzleOrientationIdx(orientationKpuzzle.state);\n puzzleOrientationCache[idxU][idxL] = invertTransformation(\n def,\n orientationKpuzzle.state,\n );\n }\n }\n}\n\nexport function normalizePuzzleOrientation(s: Transformation): Transformation {\n const [idxU, idxL] = puzzleOrientationIdx(s);\n const orientationTransformation = puzzleOrientationCache[idxU][idxL];\n return combineTransformations(def, s, orientationTransformation);\n}\n\n// TODO: combine with `orientPuzzle`?\nexport function reorientPuzzle(\n s: Transformation,\n idxU: number,\n idxL: number,\n): Transformation {\n const orientationTransformation = invertTransformation(\n def,\n puzzleOrientationCache[idxU][idxL],\n );\n return combineTransformations(def, s, orientationTransformation);\n}\n", "import type { Transformation } from \"../../kpuzzle\";\nimport {\n identityPermutation,\n lexToPermutation,\n maskToOrientations,\n orientationsToMask,\n permutationToLex,\n} from \"./orbit-indexing\";\nimport {\n normalizePuzzleOrientation,\n puzzleOrientationIdx,\n reorientPuzzle,\n} from \"./puzzle-orientation\";\n\ntype Binary3x3x3State = ArrayBuffer;\n\n// Bit lengths of the encoded components, in order.\nconst BIT_LENGTHS = [29, 12, 16, 13, 3, 2, 1, 12];\n\n// These fields are sorted by the order in which they appear in the binary format.\nexport interface Binary3x3x3Components {\n epLex: number; // 29 bits, edge permutation\n eoMask: number; // 12 bits, edge orientation\n cpLex: number; // 16 bits, corner permutation\n coMask: number; // 13 bits, corner orientation\n poIdxU: number; // 3 bits, puzzle orientation (U face)\n poIdxL: number; // 2 bits, puzzle orientation (L face)\n moSupport: number; // 1 bit, center orientation support\n moMask: number; // 12 bits, center orientation\n}\n\n// There are various clever ways to do this, but this is simple and efficient.\nfunction arraySum(arr: number[]): number {\n let total = 0;\n for (const entry of arr) {\n total += entry;\n }\n return total;\n}\n\n// Due to limitations in JS bit operations, this is unsafe if any of the bit lengths span across the contents of more than 4 bytes.\n// - Safe: [8, 32]\n// - Unsafe: [4, 32, 4]\n// - Unsafe: [40, 4]\nfunction splitBinary(bitLengths: number[], buffy: ArrayBuffer): number[] {\n const u8buffy = new Uint8Array(buffy);\n let at = 0;\n let bits = 0;\n let accum = 0;\n const values: number[] = [];\n for (const bitLength of bitLengths) {\n while (bits < bitLength) {\n accum = (accum << 8) | u8buffy[at++];\n bits += 8;\n }\n values.push((accum >> (bits - bitLength)) & ((1 << bitLength) - 1));\n bits -= bitLength;\n }\n return values;\n}\n\n// See above for safety notes.\nfunction concatBinary(bitLengths: number[], values: number[]): ArrayBuffer {\n const buffy = new Uint8Array(Math.ceil(arraySum(bitLengths) / 8));\n let at = 0;\n let bits = 0;\n let accum = 0;\n for (let i = 0; i < bitLengths.length; i++) {\n accum = (accum << bitLengths[i]) | values[i];\n bits += bitLengths[i];\n while (bits >= 8) {\n buffy[at++] = accum >> (bits - 8);\n bits -= 8;\n }\n }\n if (bits > 0) {\n buffy[at++] = accum << (8 - bits);\n }\n return buffy;\n}\n\n// 0x111 (for idxU) means \"not supported\"\nfunction supportsPuzzleOrientation(components: Binary3x3x3Components): boolean {\n return components.poIdxU !== 7;\n}\n\nexport function reid3x3x3ToBinaryComponents(\n state: Transformation,\n): Binary3x3x3Components {\n const normedState = normalizePuzzleOrientation(state);\n\n const epLex = permutationToLex(normedState[\"EDGES\"].permutation);\n const eoMask = orientationsToMask(2, normedState[\"EDGES\"].orientation);\n const cpLex = permutationToLex(normedState[\"CORNERS\"].permutation);\n const coMask = orientationsToMask(3, normedState[\"CORNERS\"].orientation);\n const [poIdxU, poIdxL] = puzzleOrientationIdx(state);\n const moSupport = 1; // Required for now.\n const moMask = orientationsToMask(4, normedState[\"CENTERS\"].orientation);\n\n return {\n epLex,\n eoMask,\n cpLex,\n coMask,\n poIdxU,\n poIdxL,\n moSupport,\n moMask,\n };\n}\n\nexport function binaryComponentsToTwizzleBinary(\n components: Binary3x3x3Components,\n): Binary3x3x3State {\n const { epLex, eoMask, cpLex, coMask, poIdxU, poIdxL, moSupport, moMask } =\n components;\n\n return concatBinary(BIT_LENGTHS, [\n epLex,\n eoMask,\n cpLex,\n coMask,\n poIdxU,\n poIdxL,\n moSupport,\n moMask,\n ]);\n}\n\nexport function reid3x3x3ToTwizzleBinary(\n state: Transformation,\n): Binary3x3x3State {\n const components: Binary3x3x3Components = reid3x3x3ToBinaryComponents(state);\n return binaryComponentsToTwizzleBinary(components);\n}\n\nexport function twizzleBinaryToBinaryComponents(\n buffer: ArrayBuffer,\n): Binary3x3x3Components {\n const [epLex, eoMask, cpLex, coMask, poIdxU, poIdxL, moSupport, moMask] =\n splitBinary(BIT_LENGTHS, buffer);\n\n return {\n epLex,\n eoMask,\n cpLex,\n coMask,\n poIdxU,\n poIdxL,\n moSupport,\n moMask,\n };\n}\n\nexport function binaryComponentsToReid3x3x3(\n components: Binary3x3x3Components,\n): Transformation {\n if (components.moSupport !== 1) {\n throw new Error(\"Must support center orientation.\");\n }\n\n const normedState = {\n EDGES: {\n permutation: lexToPermutation(12, components.epLex),\n orientation: maskToOrientations(2, 12, components.eoMask),\n },\n CORNERS: {\n permutation: lexToPermutation(8, components.cpLex),\n orientation: maskToOrientations(3, 8, components.coMask),\n },\n CENTERS: {\n permutation: identityPermutation(6),\n orientation: maskToOrientations(4, 6, components.moMask),\n },\n };\n\n if (!supportsPuzzleOrientation(components)) {\n return normedState;\n }\n\n return reorientPuzzle(normedState, components.poIdxU, components.poIdxL);\n}\n\n// Returns a list of error string.\n// An empty list means validation success.\nfunction validateComponents(components: Binary3x3x3Components): string[] {\n const errors = [];\n if (components.epLex < 0 || components.epLex >= 479001600) {\n errors.push(`epLex (${components.epLex}) out of range`);\n }\n if (components.cpLex < 0 || components.cpLex >= 40320) {\n errors.push(`cpLex (${components.cpLex}) out of range`);\n }\n if (components.coMask < 0 || components.coMask >= 6561) {\n errors.push(`coMask (${components.coMask}) out of range`);\n }\n if (components.poIdxU < 0 || components.poIdxU >= 6) {\n // 0x111 (for idxU) means \"not supported\"\n if (supportsPuzzleOrientation(components)) {\n errors.push(`poIdxU (${components.poIdxU}) out of range`);\n }\n }\n // The following cannot be (f decoded from binary properl) out of rangey.\n if (components.eoMask < 0 || components.eoMask >= 4096) {\n errors.push(`eoMask (${components.eoMask}) out of range`);\n }\n if (components.moMask < 0 || components.moMask >= 4096) {\n errors.push(`moMask (${components.moMask}) out of range`);\n }\n if (components.poIdxL < 0 || components.poIdxL >= 4) {\n errors.push(`poIdxL (${components.poIdxL}) out of range`);\n }\n if (components.moSupport < 0 || components.moSupport >= 2) {\n errors.push(`moSupport (${components.moSupport}) out of range`);\n }\n return errors;\n}\n\nexport function twizzleBinaryToReid3x3x3(buffy: ArrayBuffer): Transformation {\n const components = twizzleBinaryToBinaryComponents(buffy);\n const errors = validateComponents(components);\n if (errors.length !== 0) {\n throw new Error(`Invalid binary state components: ${errors.join(\", \")}`);\n }\n return binaryComponentsToReid3x3x3(components);\n}\n", "export function bufferToSpacedHex(buffer: ArrayBuffer): string {\n // buffer is an ArrayBuffer\n return (\n Array.prototype.map.call(new Uint8Array(buffer), (x: number) =>\n (\"00\" + x.toString(16)).slice(-2),\n ) as string[]\n ).join(\" \");\n}\n\nexport function spacedHexToBuffer(hex: string): Uint8Array {\n return new Uint8Array(hex.split(\" \").map((c) => parseInt(c, 16)));\n}\n", "export {\n reid3x3x3ToTwizzleBinary,\n twizzleBinaryToReid3x3x3,\n} from \"./binary/binary3x3x3\";\nexport { bufferToSpacedHex, spacedHexToBuffer } from \"./binary/hex\";\n\nexport { normalizePuzzleOrientation as experimentalNormalizePuzzleOrientation } from \"./binary/puzzle-orientation\";\n\nexport {\n binaryComponentsToReid3x3x3 as experimentalBinaryComponentsToReid3x3x3,\n twizzleBinaryToBinaryComponents as experimentalTwizzleBinaryToBinaryComponents,\n} from \"./binary/binary3x3x3\";\n", "import { experimentalNormalizePuzzleOrientation as normalize3x3x3Orientation } from \"../protocol\";\nimport type { Transformation } from \"./definition_types\";\nimport { cube3x3x3KPuzzle as def } from \"./3x3x3/3x3x3.kpuzzle.json\";\nimport {\n areOrbitTransformationsEquivalent,\n areTransformationsEquivalent,\n} from \"./transformations\";\n\n// The `options` argument is required for now, because we haven't yet come up\n// with a general way to specify different kinds of solved for the same puzle.\nexport function experimentalIs3x3x3Solved(\n transformation: Transformation,\n options: { ignoreCenterOrientation: boolean },\n): boolean {\n const normalized = normalize3x3x3Orientation(transformation);\n if (options.ignoreCenterOrientation) {\n return (\n areOrbitTransformationsEquivalent(\n def,\n \"EDGES\",\n normalized,\n def.startPieces,\n ) &&\n areOrbitTransformationsEquivalent(\n def,\n \"CORNERS\",\n normalized,\n def.startPieces,\n )\n );\n } else {\n return areTransformationsEquivalent(def, normalized, def.startPieces);\n }\n}\n", "export type {\n KPuzzleDefinition,\n OrbitTransformation,\n Transformation,\n} from \"./definition_types\";\n\nexport { KPuzzle, transformationForMove } from \"./kpuzzle\";\n\nexport {\n Canonicalizer,\n SearchSequence,\n CanonicalSequenceIterator,\n} from \"./canonicalize\";\n\nexport {\n combineTransformations,\n multiplyTransformations,\n identityTransformation,\n invertTransformation,\n areTransformationsEquivalent,\n areOrbitTransformationsEquivalent,\n areStatesEquivalent,\n transformationOrder,\n} from \"./transformations\";\n\nexport { parseKPuzzleDefinition } from \"./parser\";\n\nexport { KPuzzleSVGWrapper } from \"./svg\";\n\nexport { cube3x3x3KPuzzle as experimentalCube3x3x3KPuzzle } from \"./3x3x3/3x3x3.kpuzzle.json\";\nexport { experimentalIs3x3x3Solved } from \"./puzzle-orientation\";\n\nexport { transformationForQuantumMove as experimentalTransformationForQuantumMove } from \"./kpuzzle\";\n", "// Manages a set of face names. Detects whether they are prefix-free.\n// Implements greedy splitting into face names and comparisons between\n// concatenated face names and grip names.\n\nexport class FaceNameSwizzler {\n public prefixFree: boolean = true;\n public gripnames: string[] = [];\n constructor(public facenames: string[], gripnames_arg?: string[]) {\n if (gripnames_arg) {\n this.gripnames = gripnames_arg;\n }\n for (let i = 0; this.prefixFree && i < facenames.length; i++) {\n for (let j = 0; this.prefixFree && j < facenames.length; j++) {\n if (i !== j && facenames[i].startsWith(facenames[j])) {\n this.prefixFree = false;\n }\n }\n }\n }\n\n public setGripNames(names: string[]): void {\n this.gripnames = names;\n }\n\n // split a string into face names and return a list of\n // indices.\n public splitByFaceNames(s: string): number[] {\n const r = [];\n let at = 0;\n while (at < s.length) {\n if (at > 0 && at < s.length && s[at] === \"_\") {\n at++;\n }\n let currentMatch = -1;\n for (let i = 0; i < this.facenames.length; i++) {\n if (\n s.substr(at).startsWith(this.facenames[i]) &&\n (currentMatch < 0 ||\n this.facenames[i].length > this.facenames[currentMatch].length)\n ) {\n currentMatch = i;\n }\n }\n if (currentMatch >= 0) {\n r.push(currentMatch);\n at += this.facenames[currentMatch].length;\n } else {\n throw new Error(\"Could not split \" + s + \" into face names.\");\n }\n }\n return r;\n }\n\n // cons a grip from an array of numbers.\n public joinByFaceIndices(list: number[]): string {\n let sep = \"\";\n const r = [];\n for (let i = 0; i < list.length; i++) {\n r.push(sep);\n r.push(this.facenames[list[i]]);\n if (!this.prefixFree) {\n sep = \"_\";\n }\n }\n return r.join(\"\");\n }\n\n /*\n * Try to match something the user gave us with some geometric\n * feature. We used to have strict requirements:\n *\n * a) The set of face names are prefix free\n * b) When specifying a corner, all coincident planes were\n * specified\n *\n * But, to allow megaminx to have more reasonable and\n * conventional names, and to permit shorter canonical\n * names, we are relaxing these requirements and adding\n * new syntax. Now:\n *\n * a) Face names need not be syntax free.\n * b) When parsing a geometric name, we use greedy\n * matching, so the longest name that matches the\n * user string at the current position is the one\n * assumed to match.\n * c) Underscores are permitted to separate face names\n * (both in user input and in geometric\n * descriptions).\n * d) Default names of corner moves where corners have\n * more than three corners, need only include three\n * of the corners.\n *\n * This code is not performance-sensitive so we can do it a\n * slow and simple way.\n */\n public spinmatch(userinput: string, longname: string): boolean {\n // are these the same rotationally?\n if (userinput === longname) {\n return true;\n }\n try {\n const e1 = this.splitByFaceNames(userinput);\n const e2 = this.splitByFaceNames(longname);\n // All elements of userinput need to be in the longname.\n // There should be no duplicate elements in the userinput.\n // if both have length 1 or length 2, the sets must be equal.\n // if both have length 3 or more, then the first set must be\n // a subset of the second. Order doesn't matter.\n if (e1.length !== e2.length && e1.length < 3) {\n return false;\n }\n for (let i = 0; i < e1.length; i++) {\n for (let j = 0; j < i; j++) {\n if (e1[i] === e1[j]) {\n return false;\n }\n }\n let found = false;\n for (let j = 0; j < e2.length; j++) {\n if (e1[i] === e2[j]) {\n found = true;\n break;\n }\n }\n if (!found) {\n return false;\n }\n }\n return true;\n } catch (e) {\n return false;\n }\n }\n\n public unswizzle(s: string): string {\n if ((s.endsWith(\"v\") || s.endsWith(\"w\")) && s[0] <= \"Z\") {\n s = s.slice(0, s.length - 1);\n }\n const upperCaseGrip = s.toUpperCase();\n for (let i = 0; i < this.gripnames.length; i++) {\n const g = this.gripnames[i];\n if (this.spinmatch(upperCaseGrip, g)) {\n return g;\n }\n }\n return s;\n }\n}\n", "import type { Move } from \"../../alg\";\nimport type { NotationMapper } from \"./NotationMapper\";\n\nexport class NullMapper implements NotationMapper {\n public notationToInternal(move: Move): Move | null {\n return move;\n }\n\n public notationToExternal(move: Move): Move | null {\n return move;\n }\n}\n", "import { Move, QuantumMove } from \"../../alg\";\nimport type { FaceNameSwizzler } from \"../FaceNameSwizzler\";\nimport type { NotationMapper } from \"./NotationMapper\";\n\nexport class FTONotationMapper implements NotationMapper {\n constructor(private child: NotationMapper, private sw: FaceNameSwizzler) {}\n\n public notationToInternal(move: Move): Move | null {\n if (\n move.family === \"T\" &&\n move.innerLayer === undefined &&\n move.outerLayer === undefined\n ) {\n return new Move(\n new QuantumMove(\"FLRv\", move.innerLayer, move.outerLayer),\n move.amount,\n );\n } else {\n const r = this.child.notationToInternal(move);\n return r;\n }\n }\n\n // we never rewrite click moves to these moves.\n public notationToExternal(move: Move): Move | null {\n let fam = move.family;\n if (fam.length > 0 && fam[fam.length - 1] === \"v\") {\n fam = fam.substring(0, fam.length - 1);\n }\n if (this.sw.spinmatch(fam, \"FLUR\")) {\n return new Move(\n new QuantumMove(\"T\", move.innerLayer, move.outerLayer),\n move.amount,\n );\n }\n return this.child.notationToExternal(move);\n }\n}\n", "// face renaming mapper. Accepts two face name remappers. We\n// work between the two.\n\nimport { Move, QuantumMove } from \"../../alg\";\nimport type { FaceNameSwizzler } from \"../FaceNameSwizzler\";\nimport type { NotationMapper } from \"./NotationMapper\";\n\nexport class FaceRenamingMapper implements NotationMapper {\n constructor(\n public internalNames: FaceNameSwizzler,\n public externalNames: FaceNameSwizzler,\n ) {}\n\n // TODO: consider putting a cache in front of this\n public convertString(\n grip: string,\n a: FaceNameSwizzler,\n b: FaceNameSwizzler,\n ): string {\n let suffix = \"\";\n if ((grip.endsWith(\"v\") || grip.endsWith(\"v\")) && grip <= \"_\") {\n suffix = grip.slice(grip.length - 1);\n grip = grip.slice(0, grip.length - 1);\n }\n const upper = grip.toUpperCase();\n let isLowerCase = false;\n if (grip !== upper) {\n isLowerCase = true;\n grip = upper;\n }\n grip = b.joinByFaceIndices(a.splitByFaceNames(grip));\n if (isLowerCase) {\n grip = grip.toLowerCase();\n }\n return grip + suffix;\n }\n\n public convert(move: Move, a: FaceNameSwizzler, b: FaceNameSwizzler): Move {\n const grip = move.family;\n const ngrip = this.convertString(grip, a, b);\n if (grip === ngrip) {\n return move;\n } else {\n return new Move(\n new QuantumMove(ngrip, move.innerLayer, move.outerLayer),\n move.amount,\n );\n }\n }\n\n public notationToInternal(move: Move): Move {\n const r = this.convert(move, this.externalNames, this.internalNames);\n return r;\n }\n\n public notationToExternal(move: Move): Move {\n return this.convert(move, this.internalNames, this.externalNames);\n }\n}\n", "// Sits on top of a (possibly null) notation mapper, and\n\nimport { Move, QuantumMove } from \"../../alg\";\nimport type { NotationMapper } from \"./NotationMapper\";\n\n// adds R++/R--/D++/D-- notation mapping.\nexport class MegaminxScramblingNotationMapper implements NotationMapper {\n constructor(private child: NotationMapper) {}\n\n public notationToInternal(move: Move): Move | null {\n if (move.innerLayer === undefined && move.outerLayer === undefined) {\n if (Math.abs(move.amount) === 1) {\n if (move.family === \"R++\") {\n return new Move(new QuantumMove(\"L\", 3, 2), -2 * move.amount);\n } else if (move.family === \"R--\") {\n return new Move(new QuantumMove(\"L\", 3, 2), 2 * move.amount);\n } else if (move.family === \"D++\") {\n return new Move(new QuantumMove(\"U\", 3, 2), -2 * move.amount);\n } else if (move.family === \"D--\") {\n return new Move(new QuantumMove(\"U\", 3, 2), 2 * move.amount);\n }\n\n // TODO: Figure out if `cubing/alg` should parse `R++` to a family of `R++`.\n if (move.family === \"R_PLUSPLUS_\") {\n return new Move(new QuantumMove(\"L\", 3, 2), -2 * move.amount);\n } else if (move.family === \"D_PLUSPLUS_\") {\n return new Move(new QuantumMove(\"U\", 3, 2), -2 * move.amount);\n }\n }\n if (move.family === \"y\") {\n return new Move(\"Uv\", move.amount);\n }\n }\n return this.child.notationToInternal(move);\n }\n\n // we never rewrite click moves to these moves.\n public notationToExternal(move: Move): Move | null {\n if (move.family === \"Uv\") {\n return new Move(\n new QuantumMove(\"y\", move.innerLayer, move.outerLayer),\n move.amount,\n );\n }\n if (move.family === \"Dv\") {\n return new Move(\"y\", -move.amount);\n }\n return this.child.notationToExternal(move);\n }\n}\n", "import { Move, QuantumMove } from \"../../alg\";\nimport type { NotationMapper } from \"./NotationMapper\";\n\nexport class NxNxNCubeMapper implements NotationMapper {\n constructor(public slices: number) {}\n\n public notationToInternal(move: Move): Move {\n const grip = move.family;\n if (!move.innerLayer && !move.outerLayer) {\n if (grip === \"x\") {\n move = new Move(\"Rv\", move.amount);\n } else if (grip === \"y\") {\n move = new Move(\"Uv\", move.amount);\n } else if (grip === \"z\") {\n move = new Move(\"Fv\", move.amount);\n }\n if ((this.slices & 1) === 1) {\n if (grip === \"E\") {\n move = new Move(\n new QuantumMove(\"D\", (this.slices + 1) / 2),\n move.amount,\n );\n } else if (grip === \"M\") {\n move = new Move(\n new QuantumMove(\"L\", (this.slices + 1) / 2),\n move.amount,\n );\n } else if (grip === \"S\") {\n move = new Move(\n new QuantumMove(\"F\", (this.slices + 1) / 2),\n move.amount,\n );\n }\n }\n if (this.slices > 2) {\n if (grip === \"e\") {\n move = new Move(\n new QuantumMove(\"D\", this.slices - 1, 2),\n move.amount,\n );\n } else if (grip === \"m\") {\n move = new Move(\n new QuantumMove(\"L\", this.slices - 1, 2),\n move.amount,\n );\n } else if (grip === \"s\") {\n move = new Move(\n new QuantumMove(\"F\", this.slices - 1, 2),\n move.amount,\n );\n }\n }\n }\n return move;\n }\n\n // do we want to map slice moves to E/M/S instead of 2U/etc.?\n public notationToExternal(move: Move): Move {\n const grip = move.family;\n if (!move.innerLayer && !move.outerLayer) {\n if (grip === \"Rv\") {\n return new Move(\"x\", move.amount);\n } else if (grip === \"Uv\") {\n return new Move(\"y\", move.amount);\n } else if (grip === \"Fv\") {\n return new Move(\"z\", move.amount);\n } else if (grip === \"Lv\") {\n return new Move(\"x\", -move.amount);\n } else if (grip === \"Dv\") {\n return new Move(\"y\", -move.amount);\n } else if (grip === \"Bv\") {\n return new Move(\"z\", -move.amount);\n }\n }\n return move;\n }\n}\n", "import { Move, QuantumMove } from \"../../alg\";\nimport type { FaceNameSwizzler } from \"../FaceNameSwizzler\";\nimport type { NotationMapper } from \"./NotationMapper\";\n\nconst pyraminxFamilyMap: Record<string, string> = {\n U: \"frl\",\n L: \"fld\",\n R: \"fdr\",\n B: \"dlr\",\n u: \"FRL\",\n l: \"FLD\",\n r: \"FDR\",\n b: \"DLR\",\n Uv: \"FRLv\",\n Lv: \"FLDv\",\n Rv: \"FDRv\",\n Bv: \"DLRv\",\n D: \"D\",\n F: \"F\",\n BL: \"L\",\n BR: \"R\",\n};\nconst tetraminxFamilyMap: Record<string, string> = {\n U: \"FRL\",\n L: \"FLD\",\n R: \"FDR\",\n B: \"DLR\",\n u: \"frl\",\n l: \"fld\",\n r: \"fdr\",\n b: \"dlr\",\n Uv: \"FRLv\",\n Lv: \"FLDv\",\n Rv: \"FDRv\",\n Bv: \"DLRv\",\n D: \"D\",\n F: \"F\",\n BL: \"L\",\n BR: \"R\",\n d: \"d\",\n f: \"f\",\n bl: \"l\",\n br: \"r\",\n};\n\nconst pyraminxFamilyMapWCA: Record<string, string> = {\n U: \"FRL\",\n L: \"FLD\",\n R: \"FDR\",\n B: \"DLR\",\n};\n\nconst pyraminxExternalQuantumY = new QuantumMove(\"y\");\nconst pyraminxInternalQuantumY = new QuantumMove(\"Dv\");\n\nexport class PyraminxNotationMapper implements NotationMapper {\n protected wcaHack: boolean = false;\n map: Record<string, string> = pyraminxFamilyMap;\n\n constructor(private child: FaceNameSwizzler) {}\n\n public notationToInternal(move: Move): Move | null {\n if (this.wcaHack && move.innerLayer === 2 && move.outerLayer === null) {\n const newFamilyWCA = pyraminxFamilyMapWCA[move.family];\n if (newFamilyWCA) {\n return new Move(\n new QuantumMove(newFamilyWCA, move.innerLayer, move.outerLayer),\n move.amount,\n );\n }\n }\n const newFamily = this.map[move.family];\n\n if (newFamily) {\n return new Move(\n new QuantumMove(newFamily, move.innerLayer, move.outerLayer),\n move.amount,\n );\n } else if (pyraminxExternalQuantumY.isIdentical(move.quantum)) {\n return new Move(pyraminxInternalQuantumY, -move.amount);\n } else {\n return null;\n }\n }\n\n // we never rewrite click moves to these moves.\n public notationToExternal(move: Move): Move | null {\n if (this.wcaHack && move.innerLayer === 2 && move.outerLayer === null) {\n for (const [external, internal] of Object.entries(pyraminxFamilyMapWCA)) {\n if (this.child.spinmatch(move.family, internal)) {\n return new Move(\n new QuantumMove(external, move.innerLayer, move.outerLayer),\n move.amount,\n );\n }\n }\n }\n for (const [external, internal] of Object.entries(this.map)) {\n if (this.child.spinmatch(move.family, internal)) {\n return new Move(\n new QuantumMove(external, move.innerLayer, move.outerLayer),\n move.amount,\n );\n }\n }\n if (pyraminxInternalQuantumY.isIdentical(move.quantum)) {\n return new Move(pyraminxExternalQuantumY, -move.amount);\n } else {\n return null;\n }\n }\n}\n\nexport class TetraminxNotationMapper extends PyraminxNotationMapper {\n protected wcaHack: true;\n\n constructor(child: FaceNameSwizzler) {\n super(child);\n this.map = tetraminxFamilyMap;\n }\n}\n", "import { Move, QuantumMove } from \"../../alg\";\nimport type { FaceNameSwizzler } from \"../FaceNameSwizzler\";\nimport type { NotationMapper } from \"./NotationMapper\";\n\nconst skewbFamilyMap: Record<string, string> = {\n U: \"UBL\",\n UL: \"ULF\",\n F: \"UFR\",\n UR: \"URB\",\n B: \"DBL\",\n D: \"DFR\",\n L: \"DLF\",\n R: \"DRB\",\n Uv: \"UBLv\",\n ULv: \"ULFv\",\n Fv: \"UFRv\",\n URv: \"URBv\",\n Bv: \"DBLv\",\n Dv: \"DFRv\",\n Lv: \"DLFv\",\n Rv: \"DRBv\",\n};\n\n// TODO: combine using a similar table.\nconst skewbExternalQuantumX = new QuantumMove(\"x\");\nconst skewbInternalQuantumX = new QuantumMove(\"Rv\");\nconst skewbExternalQuantumY = new QuantumMove(\"y\");\nconst skewbInternalQuantumY = new QuantumMove(\"Uv\");\nconst skewbExternalQuantumZ = new QuantumMove(\"z\");\nconst skewbInternalQuantumZ = new QuantumMove(\"Fv\");\n\nexport class SkewbNotationMapper implements NotationMapper {\n constructor(private child: FaceNameSwizzler) {}\n\n public notationToInternal(move: Move): Move | null {\n if (move.innerLayer || move.outerLayer) {\n return null;\n }\n const newFamily = skewbFamilyMap[move.family];\n if (newFamily) {\n return new Move(\n new QuantumMove(newFamily, move.outerLayer, move.innerLayer),\n move.amount,\n );\n }\n if (skewbExternalQuantumX.isIdentical(move.quantum)) {\n return new Move(skewbInternalQuantumX, move.amount);\n }\n if (skewbExternalQuantumY.isIdentical(move.quantum)) {\n return new Move(skewbInternalQuantumY, move.amount);\n }\n if (skewbExternalQuantumZ.isIdentical(move.quantum)) {\n return new Move(skewbInternalQuantumZ, move.amount);\n }\n return null;\n /*\n * (1) We are not including x/y/z in Skewb; they aren't WCA notation and\n * it's unclear anyone needs them for reconstructions.\n *\n } else if (move.family === \"x\") {\n return new BlockMove(move.outerLayer, move.innerLayer, \"Rv\", move.amount);\n } else if (move.family === \"y\") {\n return new BlockMove(move.outerLayer, move.innerLayer, \"Uv\", move.amount);\n } else if (move.family === \"z\") {\n return new BlockMove(move.outerLayer, move.innerLayer, \"Fv\", move.amount);\n */\n }\n\n // we never rewrite click moves to these moves.\n public notationToExternal(move: Move): Move | null {\n for (const [external, internal] of Object.entries(skewbFamilyMap)) {\n if (this.child.spinmatch(move.family, internal)) {\n return new Move(\n new QuantumMove(external, move.innerLayer, move.outerLayer),\n move.amount,\n );\n }\n }\n if (skewbInternalQuantumX.isIdentical(move.quantum)) {\n return new Move(skewbExternalQuantumX, move.amount);\n }\n if (skewbInternalQuantumY.isIdentical(move.quantum)) {\n return new Move(skewbExternalQuantumY, move.amount);\n }\n if (skewbInternalQuantumZ.isIdentical(move.quantum)) {\n return new Move(skewbExternalQuantumZ, move.amount);\n }\n return null;\n /*\n * See (1) above.\n *\n if (move.family === \"Rv\") {\n return new BlockMove(move.outerLayer, move.innerLayer, \"x\", move.amount);\n } else if (move.family === \"Uv\") {\n return new BlockMove(move.outerLayer, move.innerLayer, \"y\", move.amount);\n } else if (move.family === \"Fv\") {\n return new BlockMove(move.outerLayer, move.innerLayer, \"z\", move.amount);\n */\n // } else {\n // return null;\n // }\n }\n}\n", "export type { NotationMapper } from \"./NotationMapper\";\n\nexport { NullMapper } from \"./NullMapper\";\n\nexport { FTONotationMapper } from \"./FTONotationMapper\";\nexport { FaceRenamingMapper } from \"./FaceRenamingMapper\";\nexport { MegaminxScramblingNotationMapper } from \"./MegaminxScramblingNotationMapper\";\nexport { NxNxNCubeMapper } from \"./NxNxNCubeMapper\";\nexport {\n PyraminxNotationMapper,\n TetraminxNotationMapper,\n} from \"./PyraminxNotationMapper\";\nexport { SkewbNotationMapper } from \"./SkewbNotationMapper\";\n", "import { parsePuzzleDescription, PuzzleDescription } from \"./PuzzleGeometry\";\n\nexport function parseOptions(argv: string[]): {\n puzzleDescription: PuzzleDescription | null;\n options: PuzzleGeometryOptions;\n} {\n let argp = 0;\n const options: PuzzleGeometryOptions = {};\n while (argp < argv.length && argv[argp][0] === \"-\") {\n const option = argv[argp++];\n if (option === \"--rotations\") {\n options.addRotations = true;\n } else if (option === \"--allmoves\") {\n options.allMoves = true;\n } else if (option === \"--outerblockmoves\") {\n options.outerBlockMoves = true;\n } else if (option === \"--vertexmoves\") {\n options.vertexMoves = true;\n } else if (option === \"--nocorners\") {\n options.includeCornerOrbits = false;\n } else if (option === \"--noedges\") {\n options.includeEdgeOrbits = false;\n } else if (option === \"--noorientation\") {\n options.fixedOrientation = true;\n } else if (option === \"--nocenters\") {\n options.includeCenterOrbits = false;\n } else if (option === \"--omit\") {\n options.excludeOrbits = argv[argp].split(\",\");\n argp++;\n } else if (option === \"--moves\") {\n options.moveList = argv[argp].split(\",\");\n argp++;\n } else if (option === \"--optimize\") {\n options.optimizeOrbits = true;\n } else if (option === \"--scramble\") {\n options.scrambleAmount = 100;\n } else if (option === \"--fixcorner\") {\n options.fixedPieceType = \"v\";\n } else if (option === \"--fixedge\") {\n options.fixedPieceType = \"e\";\n } else if (option === \"--fixcenter\") {\n options.fixedPieceType = \"f\";\n } else if (option === \"--orientcenters\") {\n options.orientCenters = true;\n } else if (option === \"--puzzleorientation\") {\n options.puzzleOrientation = JSON.parse(argv[argp]); // TODO: Validate input.\n argp++;\n } else {\n throw new Error(\"Bad option: \" + option);\n }\n }\n const puzzleDescription = parsePuzzleDescription(argv.slice(argp).join(\" \"));\n return { puzzleDescription, options };\n}\n\ntype FaceName = string;\ntype OrientationDirection = [number, number, number];\nexport type FaceBasedOrientationDescription = [\n [FaceName, OrientationDirection],\n [FaceName, OrientationDirection],\n];\nexport type BaseFaceCount = 4 | 6 | 8 | 12 | 20;\nexport type FaceBasedOrientationDescriptionLookup = Record<\n BaseFaceCount,\n FaceBasedOrientationDescription\n>;\n\nfunction asstructured(v: any): any {\n if (typeof v === \"string\") {\n return JSON.parse(v);\n }\n return v;\n}\nfunction asboolean(v: any): boolean {\n if (typeof v === \"string\") {\n if (v === \"false\") {\n return false;\n }\n return true;\n } else {\n return v ? true : false;\n }\n}\n\nexport class PuzzleGeometryFullOptions {\n verbosity: number = 0; // verbosity (console.log)\n\n allMoves: boolean = false; // generate all slice moves in ksolve\n outerBlockMoves: boolean; // generate outer block moves\n vertexMoves: boolean = false; // generate vertex moves\n addRotations: boolean = false; // add symmetry information to ksolve output\n moveList: string[] | null = null; // move list to generate\n\n fixedOrientation: boolean = false; // eliminate any orientations\n fixedPieceType: null | \"e\" | \"v\" | \"f\" = null; // fix a piece?\n orientCenters: boolean = false; // orient centers?\n\n // TODO: Group these into a single object?\n includeCornerOrbits: boolean = true; // include corner orbits\n includeCenterOrbits: boolean = true; // include center orbits\n includeEdgeOrbits: boolean = true; // include edge orbits\n // Overrides the previous options.\n excludeOrbits: string[] = []; // exclude these orbits\n optimizeOrbits: boolean = false; // optimize PermOri\n\n grayCorners: boolean = false; // make corner sets gray\n grayCenters: boolean = false; // make center sets gray\n grayEdges: boolean = false; // make edge sets gray\n\n puzzleOrientation: FaceBasedOrientationDescription | null = null; // single puzzle orientation from options\n puzzleOrientations: FaceBasedOrientationDescriptionLookup | null = null; // puzzle orientation override object from options // TODO: is this needed?\n\n scrambleAmount: number = 0; // scramble?\n\n constructor(options: PuzzleGeometryOptions = {}) {\n Object.assign(this, options);\n }\n}\n\nexport type PuzzleGeometryOptions = Partial<PuzzleGeometryFullOptions>;\n\nexport function parsePGOptionList(optionlist?: any[]): PuzzleGeometryOptions {\n const options: PuzzleGeometryOptions = {};\n if (optionlist !== undefined) {\n if (optionlist.length % 2 !== 0) {\n throw new Error(\"Odd length in option list?\");\n }\n for (let i = 0; i < optionlist.length; i += 2) {\n if (optionlist[i] === \"verbose\") {\n options.verbosity = (options.verbosity ?? 0) + 1;\n } else if (optionlist[i] === \"quiet\") {\n options.verbosity = 0;\n } else if (optionlist[i] === \"allmoves\") {\n options.allMoves = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"outerblockmoves\") {\n options.outerBlockMoves = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"vertexmoves\") {\n options.vertexMoves = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"rotations\") {\n options.addRotations = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"cornersets\") {\n options.includeCornerOrbits = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"centersets\") {\n options.includeCenterOrbits = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"edgesets\") {\n options.includeEdgeOrbits = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"omit\") {\n options.excludeOrbits = optionlist[i + 1];\n } else if (optionlist[i] === \"graycorners\") {\n options.grayCorners = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"graycenters\") {\n options.grayCenters = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"grayedges\") {\n options.grayEdges = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"movelist\") {\n options.moveList = asstructured(optionlist[i + 1]);\n } else if (optionlist[i] === \"killorientation\") {\n options.fixedOrientation = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"optimize\") {\n options.optimizeOrbits = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"scramble\") {\n options.scrambleAmount = optionlist[i + 1];\n } else if (optionlist[i] === \"fix\") {\n options.fixedPieceType = optionlist[i + 1];\n } else if (optionlist[i] === \"orientcenters\") {\n options.orientCenters = asboolean(optionlist[i + 1]);\n } else if (optionlist[i] === \"puzzleorientation\") {\n options.puzzleOrientation = asstructured(optionlist[i + 1]);\n } else if (optionlist[i] === \"puzzleorientations\") {\n options.puzzleOrientations = asstructured(optionlist[i + 1]);\n } else {\n throw new Error(\n \"Bad option while processing option list \" + optionlist[i],\n );\n }\n }\n }\n return options;\n}\n", "const zeroCache: number[][] = [];\nconst iotaCache: number[][] = [];\n\nexport function zeros(n: number): number[] {\n if (!zeroCache[n]) {\n const c = Array(n);\n for (let i = 0; i < n; i++) {\n c[i] = 0;\n }\n zeroCache[n] = c;\n }\n return zeroCache[n];\n}\n\nexport function iota(n: number): number[] {\n if (!iotaCache[n]) {\n const c = Array(n);\n for (let i = 0; i < n; i++) {\n c[i] = i;\n }\n iotaCache[n] = c;\n }\n return iotaCache[n];\n}\n\nexport function identity(n: number): Perm {\n return new Perm(iota(n));\n}\n\nexport function random(n: number): Perm {\n // random\n const c = Array(n);\n for (let i = 0; i < n; i++) {\n c[i] = i;\n }\n for (let i = 0; i < n; i++) {\n const j = i + Math.floor((n - i) * Math.random());\n const t = c[i];\n c[i] = c[j];\n c[j] = t;\n }\n return new Perm(c);\n}\n\nexport function factorial(a: number): number {\n let r = 1;\n while (a > 1) {\n r *= a;\n a--;\n }\n return r;\n}\n\nfunction gcd(a: number, b: number): number {\n if (a > b) {\n const t = a;\n a = b;\n b = t;\n }\n while (a > 0) {\n const m = b % a;\n b = a;\n a = m;\n }\n return b;\n}\n\nexport function lcm(a: number, b: number): number {\n return (a / gcd(a, b)) * b;\n}\n\nexport class Perm {\n public n: number; // length\n public p: number[]; // The permutation itself\n constructor(a: number[]) {\n this.n = a.length;\n this.p = a;\n }\n\n public toString(): string {\n // stringify\n return \"Perm[\" + this.p.join(\" \") + \"]\";\n }\n\n public mul(p2: Perm): Perm {\n // multiply\n const c: number[] = Array(this.n);\n for (let i = 0; i < this.n; i++) {\n c[i] = p2.p[this.p[i]];\n }\n return new Perm(c);\n }\n\n public rmul(p2: Perm): Perm {\n // multiply the other way\n const c = Array(this.n);\n for (let i = 0; i < this.n; i++) {\n c[i] = this.p[p2.p[i]];\n }\n return new Perm(c);\n }\n\n public inv(): Perm {\n const c = Array(this.n);\n for (let i = 0; i < this.n; i++) {\n c[this.p[i]] = i;\n }\n return new Perm(c);\n }\n\n public compareTo(p2: Perm): number {\n // comparison\n for (let i = 0; i < this.n; i++) {\n if (this.p[i] !== p2.p[i]) {\n return this.p[i] - p2.p[i];\n }\n }\n return 0;\n }\n\n public toGap(): string {\n const cyc = new Array<string>();\n const seen = new Array<boolean>(this.n);\n for (let i = 0; i < this.p.length; i++) {\n if (seen[i] || this.p[i] === i) {\n continue;\n }\n const incyc = new Array<number>();\n for (let j = i; !seen[j]; j = this.p[j]) {\n incyc.push(1 + j);\n seen[j] = true;\n }\n cyc.push(\"(\" + incyc.join(\",\") + \")\");\n }\n return cyc.join(\"\");\n }\n\n public order(): number {\n let r = 1;\n const seen = new Array<boolean>(this.n);\n for (let i = 0; i < this.p.length; i++) {\n if (seen[i] || this.p[i] === i) {\n continue;\n }\n let cs = 0;\n for (let j = i; !seen[j]; j = this.p[j]) {\n cs++;\n seen[j] = true;\n }\n r = lcm(r, cs);\n }\n return r;\n }\n}\n", "import { Move } from \"../alg\";\nimport type {\n KPuzzleDefinition,\n Transformation as KTransformation,\n} from \"../kpuzzle\"; // TODO\nimport { NullMapper } from \"./notation-mapping\";\nimport type { NotationMapper } from \"./notation-mapping/NotationMapper\";\n/* tslint:disable no-bitwise */\n/* tslint:disable prefer-for-of */ import {\n factorial,\n iota,\n lcm,\n Perm,\n zeros,\n} from \"./Perm\";\nexport class PGOrbitDef {\n constructor(public size: number, public mod: number) {}\n public reassemblySize(): number {\n return factorial(this.size) * Math.pow(this.mod, this.size);\n }\n}\n\nexport function externalName(\n mapper: NotationMapper,\n moveString: string,\n): string {\n const mv = Move.fromString(moveString);\n const mv2 = mapper.notationToExternal(mv);\n if (mv2 === null || mv === mv2) {\n return moveString;\n }\n return mv2.toString();\n}\n\nexport class PGOrbitsDef {\n constructor(\n public orbitnames: string[],\n private orbitdefs: PGOrbitDef[],\n public solved: VisibleState,\n public movenames: string[],\n public moveops: PGTransform[],\n ) {}\n\n private transformToKPuzzle(t: PGTransform): any {\n const mp: { [orbitName: string]: any } = {};\n for (let j = 0; j < this.orbitnames.length; j++) {\n mp[this.orbitnames[j]] = t.orbits[j].toKPuzzle();\n }\n return mp;\n }\n\n public static transformToKPuzzle(\n orbitnames: string[],\n t: PGTransform,\n ): KTransformation {\n const mp: { [orbitName: string]: any } = {};\n for (let j = 0; j < orbitnames.length; j++) {\n mp[orbitnames[j]] = t.orbits[j].toKPuzzle();\n }\n return mp;\n }\n\n public toKsolve(\n name: string,\n mapper: NotationMapper = new NullMapper(),\n ): string[] {\n const result = [];\n result.push(\"Name \" + name);\n result.push(\"\");\n for (let i = 0; i < this.orbitnames.length; i++) {\n result.push(\n `Set ${this.orbitnames[i]} ${this.orbitdefs[i].size} ${this.orbitdefs[i].mod}`,\n );\n }\n result.push(\"\");\n result.push(\"Solved\");\n for (let i = 0; i < this.orbitnames.length; i++) {\n this.solved.orbits[i].appendDefinition(\n result,\n this.orbitnames[i],\n false,\n false,\n );\n }\n result.push(\"End\");\n for (let i = 0; i < this.movenames.length; i++) {\n result.push(\"\");\n let name = externalName(mapper, this.movenames[i]);\n let doinv = false;\n if (name[name.length - 1] === \"'\") {\n doinv = true;\n name = name.substring(0, name.length - 1);\n }\n result.push(\"Move \" + name);\n for (let j = 0; j < this.orbitnames.length; j++) {\n if (doinv) {\n this.moveops[i].orbits[j]\n .inv()\n .appendDefinition(result, this.orbitnames[j], true);\n } else {\n this.moveops[i].orbits[j].appendDefinition(\n result,\n this.orbitnames[j],\n true,\n );\n }\n }\n result.push(\"End\");\n }\n // extra blank line on end lets us use join(\"\\n\") to terminate all\n return result;\n }\n\n // TODO: return type.\n public toKPuzzle(includemoves: boolean): KPuzzleDefinition {\n const orbits: { [orbitName: string]: any } = {};\n const start: { [orbitName: string]: any } = {};\n for (let i = 0; i < this.orbitnames.length; i++) {\n orbits[this.orbitnames[i]] = {\n numPieces: this.orbitdefs[i].size,\n orientations: this.orbitdefs[i].mod,\n };\n start[this.orbitnames[i]] = this.solved.orbits[i].toKPuzzle();\n }\n const moves: { [moveName: string]: any } = {};\n if (includemoves) {\n for (let i = 0; i < this.movenames.length; i++) {\n moves[this.movenames[i]] = this.transformToKPuzzle(this.moveops[i]);\n }\n }\n return { name: \"PG3D\", orbits, startPieces: start, moves };\n }\n\n public optimize(): PGOrbitsDef {\n const neworbitnames: string[] = [];\n const neworbitdefs: PGOrbitDef[] = [];\n const newsolved: PGOrbit[] = [];\n const newmoveops: PGOrbit[][] = [];\n for (let j = 0; j < this.moveops.length; j++) {\n newmoveops.push([]);\n }\n for (let i = 0; i < this.orbitdefs.length; i++) {\n const om = this.orbitdefs[i].mod;\n const n = this.orbitdefs[i].size;\n const du = new DisjointUnion(n);\n const changed = new Array<boolean>(this.orbitdefs[i].size);\n for (let k = 0; k < n; k++) {\n changed[k] = false;\n }\n for (let j = 0; j < this.moveops.length; j++) {\n for (let k = 0; k < n; k++) {\n if (\n this.moveops[j].orbits[i].perm[k] !== k ||\n this.moveops[j].orbits[i].ori[k] !== 0\n ) {\n changed[k] = true;\n du.union(k, this.moveops[j].orbits[i].perm[k]);\n }\n }\n }\n let keepori = true;\n // right now we kill ori only if solved is unique and\n // if we can kill it completely. This is not all the optimization\n // we can perform.\n if (om > 1) {\n keepori = false;\n const duo = new DisjointUnion(this.orbitdefs[i].size * om);\n for (let j = 0; j < this.moveops.length; j++) {\n for (let k = 0; k < n; k++) {\n if (\n this.moveops[j].orbits[i].perm[k] !== k ||\n this.moveops[j].orbits[i].ori[k] !== 0\n ) {\n for (let o = 0; o < om; o++) {\n duo.union(\n k * om + o,\n this.moveops[j].orbits[i].perm[k] * om +\n ((o + this.moveops[j].orbits[i].ori[k]) % om),\n );\n }\n }\n }\n }\n for (let j = 0; !keepori && j < n; j++) {\n for (let o = 1; o < om; o++) {\n if (duo.find(j * om) === duo.find(j * om + o)) {\n keepori = true;\n }\n }\n }\n for (let j = 0; !keepori && j < n; j++) {\n for (let k = 0; k < j; k++) {\n if (\n this.solved.orbits[i].perm[j] === this.solved.orbits[i].perm[k]\n ) {\n keepori = true;\n }\n }\n }\n }\n // is there just one result set, or more than one?\n let nontriv = -1;\n let multiple = false;\n for (let j = 0; j < this.orbitdefs[i].size; j++) {\n if (changed[j]) {\n const h = du.find(j);\n if (nontriv < 0) {\n nontriv = h;\n } else if (nontriv !== h) {\n multiple = true;\n }\n }\n }\n for (let j = 0; j < this.orbitdefs[i].size; j++) {\n if (!changed[j]) {\n continue;\n }\n const h = du.find(j);\n if (h !== j) {\n continue;\n }\n const no: number[] = [];\n const on: number[] = [];\n let nv = 0;\n for (let k = 0; k < this.orbitdefs[i].size; k++) {\n if (du.find(k) === j) {\n no[nv] = k;\n on[k] = nv;\n nv++;\n }\n }\n if (multiple) {\n neworbitnames.push(`${this.orbitnames[i]}_p${j}`);\n } else {\n neworbitnames.push(this.orbitnames[i]);\n }\n if (keepori) {\n neworbitdefs.push(new PGOrbitDef(nv, this.orbitdefs[i].mod));\n newsolved.push(this.solved.orbits[i].remapVS(no, nv));\n for (let k = 0; k < this.moveops.length; k++) {\n newmoveops[k].push(this.moveops[k].orbits[i].remap(no, on, nv));\n }\n } else {\n neworbitdefs.push(new PGOrbitDef(nv, 1));\n newsolved.push(this.solved.orbits[i].remapVS(no, nv).killOri());\n for (let k = 0; k < this.moveops.length; k++) {\n newmoveops[k].push(\n this.moveops[k].orbits[i].remap(no, on, nv).killOri(),\n );\n }\n }\n }\n }\n return new PGOrbitsDef(\n neworbitnames,\n neworbitdefs,\n new VisibleState(newsolved),\n this.movenames,\n newmoveops.map((_) => new PGTransform(_)),\n );\n }\n\n // generate a new \"solved\" position based on scrambling\n // we use an algorithm that should be faster for large puzzles than\n // just picking random moves.\n public scramble(n: number): void {\n const pool: PGTransform[] = [];\n for (let i = 0; i < this.moveops.length; i++) {\n pool[i] = this.moveops[i];\n }\n for (let i = 0; i < pool.length; i++) {\n const j = Math.floor(Math.random() * pool.length);\n const t = pool[i];\n pool[i] = pool[j];\n pool[j] = t;\n }\n if (n < pool.length) {\n n = pool.length;\n }\n for (let i = 0; i < n; i++) {\n const ri = Math.floor(Math.random() * pool.length);\n const rj = Math.floor(Math.random() * pool.length);\n const rm = Math.floor(Math.random() * this.moveops.length);\n pool[ri] = pool[ri].mul(pool[rj]).mul(this.moveops[rm]);\n if (Math.random() < 0.1) {\n // break up parity\n pool[ri] = pool[ri].mul(this.moveops[rm]);\n }\n }\n let s = pool[0];\n for (let i = 1; i < pool.length; i++) {\n s = s.mul(pool[i]);\n }\n this.solved = this.solved.mul(s);\n }\n\n public reassemblySize(): number {\n let n = 1;\n for (let i = 0; i < this.orbitdefs.length; i++) {\n n *= this.orbitdefs[i].reassemblySize();\n }\n return n;\n }\n}\n\nexport class PGOrbit {\n private static kcache: Record<string, number[]>[] = [];\n\n public static e(n: number, mod: number): PGOrbit {\n return new PGOrbit(iota(n), zeros(n), mod);\n }\n\n constructor(\n public perm: number[],\n public ori: number[],\n public orimod: number,\n ) {}\n\n public mul(b: PGOrbit): PGOrbit {\n const n = this.perm.length;\n const newPerm = new Array<number>(n);\n if (this.orimod === 1) {\n for (let i = 0; i < n; i++) {\n newPerm[i] = this.perm[b.perm[i]];\n }\n return new PGOrbit(newPerm, this.ori, this.orimod);\n } else {\n const newOri = new Array<number>(n);\n for (let i = 0; i < n; i++) {\n newPerm[i] = this.perm[b.perm[i]];\n newOri[i] = (this.ori[b.perm[i]] + b.ori[i]) % this.orimod;\n }\n return new PGOrbit(newPerm, newOri, this.orimod);\n }\n }\n\n public inv(): PGOrbit {\n const n = this.perm.length;\n const newPerm = new Array<number>(n);\n const newOri = new Array<number>(n);\n for (let i = 0; i < n; i++) {\n newPerm[this.perm[i]] = i;\n newOri[this.perm[i]] = (this.orimod - this.ori[i]) % this.orimod;\n }\n return new PGOrbit(newPerm, newOri, this.orimod);\n }\n\n public equal(b: PGOrbit): boolean {\n const n = this.perm.length;\n for (let i = 0; i < n; i++) {\n if (this.perm[i] !== b.perm[i] || this.ori[i] !== b.ori[i]) {\n return false;\n }\n }\n return true;\n }\n\n // in-place mutator\n public killOri(): this {\n const n = this.perm.length;\n for (let i = 0; i < n; i++) {\n this.ori[i] = 0;\n }\n this.orimod = 1;\n return this;\n }\n\n public toPerm(): Perm {\n const o = this.orimod;\n if (o === 1) {\n return new Perm(this.perm);\n }\n const n = this.perm.length;\n const newPerm = new Array<number>(n * o);\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < o; j++) {\n newPerm[i * o + j] = o * this.perm[i] + ((this.ori[i] + j) % o);\n }\n }\n return new Perm(newPerm);\n }\n\n // returns tuple of sets of identical pieces in this orbit\n public identicalPieces(): number[][] {\n const done: boolean[] = [];\n const n = this.perm.length;\n const r: number[][] = [];\n for (let i = 0; i < n; i++) {\n const v = this.perm[i];\n if (done[v] === undefined) {\n const s: number[] = [i];\n done[v] = true;\n for (let j = i + 1; j < n; j++) {\n if (this.perm[j] === v) {\n s.push(j);\n }\n }\n r.push(s);\n }\n }\n return r;\n }\n\n public order(): number {\n // can be made more efficient\n return this.toPerm().order();\n }\n\n public isIdentity(): boolean {\n const n = this.perm.length;\n if (this.perm === iota(n) && this.ori === zeros(n)) {\n return true;\n }\n for (let i = 0; i < n; i++) {\n if (this.perm[i] !== i || this.ori[i] !== 0) {\n return false;\n }\n }\n return true;\n }\n\n private zeroOris(): boolean {\n const n = this.perm.length;\n if (this.ori === zeros(n)) {\n return true;\n }\n for (let i = 0; i < n; i++) {\n if (this.ori[i] !== 0) {\n return false;\n }\n }\n return true;\n }\n\n public remap(no: number[], on: number[], nv: number): PGOrbit {\n const newPerm = new Array<number>(nv);\n const newOri = new Array<number>(nv);\n for (let i = 0; i < nv; i++) {\n newPerm[i] = on[this.perm[no[i]]];\n newOri[i] = this.ori[no[i]];\n }\n return new PGOrbit(newPerm, newOri, this.orimod);\n }\n\n public remapVS(no: number[], nv: number): PGOrbit {\n const newPerm = new Array<number>(nv);\n const newOri = new Array<number>(nv);\n let nextNew = 0;\n const reassign = [];\n for (let i = 0; i < nv; i++) {\n const ov = this.perm[no[i]];\n if (reassign[ov] === undefined) {\n reassign[ov] = nextNew++;\n }\n newPerm[i] = reassign[ov];\n newOri[i] = this.ori[no[i]];\n }\n return new PGOrbit(newPerm, newOri, this.orimod);\n }\n\n public appendDefinition(\n result: string[],\n name: string,\n useVS: boolean,\n concise: boolean = true,\n ): void {\n if (concise && this.isIdentity()) {\n return;\n }\n result.push(name);\n result.push(this.perm.map((_: number) => _ + 1).join(\" \"));\n if (!this.zeroOris()) {\n if (useVS) {\n const newori = new Array<number>(this.ori.length);\n for (let i = 0; i < newori.length; i++) {\n newori[this.perm[i]] = this.ori[i];\n }\n result.push(newori.join(\" \"));\n } else {\n result.push(this.ori.join(\" \"));\n }\n }\n }\n\n // TODO: return type\n public toKPuzzle(): Record<string, number[]> {\n const n = this.perm.length;\n if (this.isIdentity()) {\n if (!PGOrbit.kcache[n]) {\n PGOrbit.kcache[n] = { permutation: iota(n), orientation: zeros(n) };\n }\n return PGOrbit.kcache[n];\n } else {\n return { permutation: this.perm, orientation: this.ori };\n }\n }\n}\nexport class PGTransformBase {\n constructor(public orbits: PGOrbit[]) {}\n public internalMul(b: PGTransformBase): PGOrbit[] {\n const newOrbits: PGOrbit[] = [];\n for (let i = 0; i < this.orbits.length; i++) {\n newOrbits.push(this.orbits[i].mul(b.orbits[i]));\n }\n return newOrbits;\n }\n\n protected internalInv(): PGOrbit[] {\n const newOrbits: PGOrbit[] = [];\n for (const orbit of this.orbits) {\n newOrbits.push(orbit.inv());\n }\n return newOrbits;\n }\n\n public equal(b: PGTransformBase): boolean {\n for (let i = 0; i < this.orbits.length; i++) {\n if (!this.orbits[i].equal(b.orbits[i])) {\n return false;\n }\n }\n return true;\n }\n\n protected killOri(): this {\n for (const orbit of this.orbits) {\n orbit.killOri();\n }\n return this;\n }\n\n public toPerm(): Perm {\n const perms = new Array<Perm>();\n let n = 0;\n for (const orbit of this.orbits) {\n const p = orbit.toPerm();\n perms.push(p);\n n += p.n;\n }\n const newPerm = new Array<number>(n);\n n = 0;\n for (const p of perms) {\n for (let j = 0; j < p.n; j++) {\n newPerm[n + j] = n + p.p[j];\n }\n n += p.n;\n }\n return new Perm(newPerm);\n }\n\n public identicalPieces(): number[][] {\n const r: number[][] = [];\n let n = 0;\n for (const orbit of this.orbits) {\n const o = orbit.orimod;\n const s = orbit.identicalPieces();\n for (let j = 0; j < s.length; j++) {\n r.push(s[j].map((_) => _ * o + n));\n }\n n += o * orbit.perm.length;\n }\n return r;\n }\n\n public order(): number {\n let r = 1;\n for (const orbit of this.orbits) {\n r = lcm(r, orbit.order());\n }\n return r;\n }\n}\nexport class PGTransform extends PGTransformBase {\n constructor(orbits: PGOrbit[]) {\n super(orbits);\n }\n\n public mul(b: PGTransform): PGTransform {\n return new PGTransform(this.internalMul(b));\n }\n\n public mulScalar(n: number): PGTransform {\n if (n === 0) {\n return this.e();\n }\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let t: PGTransform = this;\n if (n < 0) {\n t = t.inv();\n n = -n;\n }\n while ((n & 1) === 0) {\n t = t.mul(t);\n n >>= 1;\n }\n if (n === 1) {\n return t;\n }\n let s = t;\n let r = this.e();\n while (n > 0) {\n if (n & 1) {\n r = r.mul(s);\n }\n if (n > 1) {\n s = s.mul(s);\n }\n n >>= 1;\n }\n return r;\n }\n\n public inv(): PGTransform {\n return new PGTransform(this.internalInv());\n }\n\n public e(): PGTransform {\n return new PGTransform(\n this.orbits.map((_: PGOrbit) => PGOrbit.e(_.perm.length, _.orimod)),\n );\n }\n}\nexport class VisibleState extends PGTransformBase {\n constructor(orbits: PGOrbit[]) {\n super(orbits);\n }\n\n public mul(b: PGTransform): VisibleState {\n return new VisibleState(this.internalMul(b));\n }\n}\n// Disjoint set union implementation.\nclass DisjointUnion {\n private heads: number[];\n constructor(public n: number) {\n this.heads = new Array<number>(n);\n for (let i = 0; i < n; i++) {\n this.heads[i] = i;\n }\n }\n\n public find(v: number): number {\n let h = this.heads[v];\n if (this.heads[h] === h) {\n return h;\n }\n h = this.find(this.heads[h]);\n this.heads[v] = h;\n return h;\n }\n\n public union(a: number, b: number): void {\n const ah = this.find(a);\n const bh = this.find(b);\n if (ah < bh) {\n this.heads[bh] = ah;\n } else if (ah > bh) {\n this.heads[ah] = bh;\n }\n }\n}\nexport function showcanon(g: PGOrbitsDef, disp: (s: string) => void): void {\n // show information for canonical move derivation\n const n = g.moveops.length;\n if (n > 30) {\n throw new Error(\"Canon info too big for bitmask\");\n }\n const orders = [];\n const commutes = [];\n for (let i = 0; i < n; i++) {\n const permA = g.moveops[i];\n orders.push(permA.order());\n let bits = 0;\n for (let j = 0; j < n; j++) {\n if (j === i) {\n continue;\n }\n const permB = g.moveops[j];\n if (permA.mul(permB).equal(permB.mul(permA))) {\n bits |= 1 << j;\n }\n }\n commutes.push(bits);\n }\n let curlev: any = {};\n curlev[0] = 1;\n for (let d = 0; d < 100; d++) {\n let sum = 0;\n const nextlev: any = {};\n let uniq = 0;\n for (const sti in curlev) {\n const st = +sti; // string to number\n const cnt = curlev[st];\n sum += cnt;\n uniq++;\n for (let mv = 0; mv < orders.length; mv++) {\n if (\n ((st >> mv) & 1) === 0 &&\n (st & commutes[mv] & ((1 << mv) - 1)) === 0\n ) {\n const nst = (st & commutes[mv]) | (1 << mv);\n if (nextlev[nst] === undefined) {\n nextlev[nst] = 0;\n }\n nextlev[nst] += (orders[mv] - 1) * cnt;\n }\n }\n }\n disp(`${d}: canonseq ${sum} states ${uniq}`);\n curlev = nextlev;\n }\n}\n// This is a less effective canonicalization (that happens to work fine\n// for the 3x3x3). We include this only for comparison.\nexport function showcanon0(g: PGOrbitsDef, disp: (s: string) => void): void {\n // show information for canonical move derivation\n const n = g.moveops.length;\n if (n > 30) {\n throw new Error(\"Canon info too big for bitmask\");\n }\n const orders = [];\n const commutes = [];\n for (let i = 0; i < n; i++) {\n const permA = g.moveops[i];\n orders.push(permA.order());\n let bits = 0;\n for (let j = 0; j < n; j++) {\n if (j === i) {\n continue;\n }\n const permB = g.moveops[j];\n if (permA.mul(permB).equal(permB.mul(permA))) {\n bits |= 1 << j;\n }\n }\n commutes.push(bits);\n }\n let curlev: any = {};\n disp(\"0: canonseq 1\");\n for (let x = 0; x < orders.length; x++) {\n curlev[x] = orders[x] - 1;\n }\n for (let d = 1; d < 100; d++) {\n let sum = 0;\n const nextlev: any = {};\n let uniq = 0;\n for (const sti in curlev) {\n const st = +sti; // string to number\n const cnt = curlev[st];\n sum += cnt;\n uniq++;\n for (let mv = 0; mv < orders.length; mv++) {\n if (mv === st || (commutes[mv] & (1 << st) && mv < st)) {\n continue;\n }\n if (nextlev[mv] === undefined) {\n nextlev[mv] = 0;\n }\n nextlev[mv] += (orders[mv] - 1) * cnt;\n }\n }\n disp(`${d}\": canonseq ${sum} states ${uniq}`);\n curlev = nextlev;\n }\n}\n", "export type PuzzleDescriptionString = string;\n\nexport const PGPuzzles: { [name: string]: PuzzleDescriptionString } = {\n \"2x2x2\": \"c f 0\",\n \"3x3x3\": \"c f 0.333333333333333\",\n \"4x4x4\": \"c f 0.5 f 0\",\n \"5x5x5\": \"c f 0.6 f 0.2\",\n \"6x6x6\": \"c f 0.666666666666667 f 0.333333333333333 f 0\",\n \"7x7x7\": \"c f 0.714285714285714 f 0.428571428571429 f 0.142857142857143\",\n \"8x8x8\": \"c f 0.75 f 0.5 f 0.25 f 0\",\n \"9x9x9\":\n \"c f 0.777777777777778 f 0.555555555555556 f 0.333333333333333 f 0.111111111111111\",\n \"10x10x10\": \"c f 0.8 f 0.6 f 0.4 f 0.2 f 0\",\n \"11x11x11\":\n \"c f 0.818181818181818 f 0.636363636363636 f 0.454545454545455 f 0.272727272727273 f 0.0909090909090909\",\n \"12x12x12\":\n \"c f 0.833333333333333 f 0.666666666666667 f 0.5 f 0.333333333333333 f 0.166666666666667 f 0\",\n \"13x13x13\":\n \"c f 0.846153846153846 f 0.692307692307692 f 0.538461538461538 f 0.384615384615385 f 0.230769230769231 f 0.0769230769230769\",\n \"20x20x20\": \"c f 0 f .1 f .2 f .3 f .4 f .5 f .6 f .7 f .8 f .9\",\n \"30x30x30\":\n \"c f 0 f .066667 f .133333 f .2 f .266667 f .333333 f .4 f .466667 f .533333 f .6 f .666667 f .733333 f .8 f .866667 f .933333\",\n \"40x40x40\":\n \"c f 0 f .05 f .1 f .15 f .2 f .25 f .3 f .35 f .4 f .45 f .5 f .55 f .6 f .65 f .7 f .75 f .8 f .85 f .9 f .95\",\n \"skewb\": \"c v 0\",\n \"master skewb\": \"c v 0.275\",\n \"professor skewb\": \"c v 0 v 0.38\",\n \"compy cube\": \"c v 0.915641442663986\",\n \"helicopter\": \"c e 0.707106781186547\",\n \"curvy copter\": \"c e 0.83\",\n \"dino\": \"c v 0.577350269189626\",\n \"little chop\": \"c e 0\",\n \"pyramorphix\": \"t e 0\",\n \"mastermorphix\": \"t e 0.346184634065199\",\n \"pyraminx\": \"t v 0.333333333333333 v 1.66666666666667\",\n \"tetraminx\": \"t v 0.333333333333333\",\n \"master pyraminx\": \"t v 0 v 1 v 2\",\n \"master tetraminx\": \"t v 0 v 1\",\n \"professor pyraminx\": \"t v -0.2 v 0.6 v 1.4 v 2.2\",\n \"professor tetraminx\": \"t v -0.2 v 0.6 v 1.4\",\n \"Jing pyraminx\": \"t f 0\",\n \"master pyramorphix\": \"t e 0.866025403784437\",\n \"megaminx\": \"d f 0.7\",\n \"gigaminx\": \"d f 0.64 f 0.82\",\n \"teraminx\": \"d f 0.64 f 0.76 f 0.88\",\n \"petaminx\": \"d f 0.64 f 0.73 f 0.82 f 0.91\",\n \"examinx\": \"d f 0.64 f 0.712 f 0.784 f 0.856 f 0.928\",\n \"zetaminx\": \"d f 0.64 f 0.7 f 0.76 f 0.82 f 0.88 f 0.94\",\n \"yottaminx\": \"d f 0.64 f 0.6914 f 0.7429 f 0.7943 f 0.8457 f 0.8971 f 0.9486\",\n \"pentultimate\": \"d f 0\",\n \"master pentultimate\": \"d f 0.1\",\n \"elite pentultimate\": \"d f 0 f 0.145905\",\n // exact value for starminx is sqrt(5(5-2 sqrt(5))/3)\n \"starminx\": \"d v 0.937962370425399\",\n \"starminx 2\": \"d f 0.23606797749979\",\n \"pyraminx crystal\": \"d f 0.447213595499989\",\n \"chopasaurus\": \"d v 0\",\n \"big chop\": \"d e 0\",\n \"skewb diamond\": \"o f 0\",\n \"FTO\": \"o f 0.333333333333333\",\n \"master FTO\": \"o f 0.5 f 0\",\n \"Christopher's jewel\": \"o v 0.577350269189626\",\n \"octastar\": \"o e 0\",\n \"Trajber's octahedron\": \"o v 0.433012701892219\",\n \"radio chop\": \"i f 0\",\n \"icosamate\": \"i v 0\",\n \"icosahedron 2\": \"i v 0.18759247376021\",\n \"icosahedron 3\": \"i v 0.18759247376021 e 0\",\n \"icosahedron static faces\": \"i v 0.84\",\n \"icosahedron moving faces\": \"i v 0.73\",\n \"Eitan's star\": \"i f 0.61803398874989\",\n \"2x2x2 + dino\": \"c f 0 v 0.577350269189626\",\n \"2x2x2 + little chop\": \"c f 0 e 0\",\n \"dino + little chop\": \"c v 0.577350269189626 e 0\",\n \"2x2x2 + dino + little chop\": \"c f 0 v 0.577350269189626 e 0\",\n \"megaminx + chopasaurus\": \"d f 0.61803398875 v 0\",\n \"starminx combo\": \"d f 0.23606797749979 v 0.937962370425399\",\n};\n\nexport type PuzzleName = keyof typeof PGPuzzles;\n", "/* tslint:disable no-bitwise */\n/* tslint:disable prefer-for-of */ // TODO\n\n// We need a quaternion class. We use this to represent rotations,\n// planes, and points.\n\nconst eps = 1e-9; // TODO: Deduplicate with `PuzzleGeometry`?\n\nexport function centermassface(face: Quat[]): Quat {\n // calculate a center of a face by averaging points\n let s = new Quat(0, 0, 0, 0);\n for (let i = 0; i < face.length; i++) {\n s = s.sum(face[i]);\n }\n return s.smul(1.0 / face.length);\n}\n\nexport function solvethreeplanes(\n p1: number,\n p2: number,\n p3: number,\n planes: Quat[],\n): any {\n // find intersection of three planes but only if interior\n // Takes three indices into a plane array, and returns the point at the\n // intersection of all three, but only if it is internal to all planes.\n const p = planes[p1].intersect3(planes[p2], planes[p3]);\n if (!p) {\n return p;\n }\n for (let i = 0; i < planes.length; i++) {\n if (i !== p1 && i !== p2 && i !== p3) {\n const dt = planes[i].b * p.b + planes[i].c * p.c + planes[i].d * p.d;\n if (\n (planes[i].a > 0 && dt > planes[i].a) ||\n (planes[i].a < 0 && dt < planes[i].a)\n ) {\n return false;\n }\n }\n }\n return p;\n}\n\nexport class Quat {\n constructor(\n public a: number,\n public b: number,\n public c: number,\n public d: number,\n ) {}\n\n public mul(q: Quat): Quat {\n // Quaternion multiplication\n return new Quat(\n this.a * q.a - this.b * q.b - this.c * q.c - this.d * q.d,\n this.a * q.b + this.b * q.a + this.c * q.d - this.d * q.c,\n this.a * q.c - this.b * q.d + this.c * q.a + this.d * q.b,\n this.a * q.d + this.b * q.c - this.c * q.b + this.d * q.a,\n );\n }\n\n public toString(): string {\n return `Q[${this.a},${this.b},${this.c},${this.d}]`;\n }\n\n public dist(q: Quat): number {\n // Euclidean distance\n return Math.hypot(this.a - q.a, this.b - q.b, this.c - q.c, this.d - q.d);\n }\n\n public len(): number {\n // Euclidean length\n return Math.hypot(this.a, this.b, this.c, this.d);\n }\n\n public cross(q: Quat): Quat {\n // cross product\n return new Quat(\n 0,\n this.c * q.d - this.d * q.c,\n this.d * q.b - this.b * q.d,\n this.b * q.c - this.c * q.b,\n );\n }\n\n public dot(q: Quat): number {\n // dot product of two quaternions\n return this.b * q.b + this.c * q.c + this.d * q.d;\n }\n\n public normalize(): Quat {\n // make the magnitude be 1\n const d = Math.sqrt(this.dot(this));\n return new Quat(this.a / d, this.b / d, this.c / d, this.d / d);\n }\n\n public makenormal(): Quat {\n // make a normal vector from a plane or quat or point\n return new Quat(0, this.b, this.c, this.d).normalize();\n }\n\n public normalizeplane(): Quat {\n // normalize a plane\n const d = Math.hypot(this.b, this.c, this.d);\n return new Quat(this.a / d, this.b / d, this.c / d, this.d / d);\n }\n\n public smul(m: number): Quat {\n // scalar multiplication\n return new Quat(this.a * m, this.b * m, this.c * m, this.d * m);\n }\n\n public sum(q: Quat): Quat {\n // quaternion sum\n return new Quat(this.a + q.a, this.b + q.b, this.c + q.c, this.d + q.d);\n }\n\n public sub(q: Quat): Quat {\n // difference\n return new Quat(this.a - q.a, this.b - q.b, this.c - q.c, this.d - q.d);\n }\n\n public angle(): number {\n // quaternion angle\n return 2 * Math.acos(this.a);\n }\n\n public invrot(): Quat {\n // quaternion inverse rotation\n return new Quat(this.a, -this.b, -this.c, -this.d);\n }\n\n public det3x3(\n a00: number,\n a01: number,\n a02: number,\n a10: number,\n a11: number,\n a12: number,\n a20: number,\n a21: number,\n a22: number,\n ): number {\n // 3x3 determinant\n return (\n a00 * (a11 * a22 - a12 * a21) +\n a01 * (a12 * a20 - a10 * a22) +\n a02 * (a10 * a21 - a11 * a20)\n );\n }\n\n public rotateplane(q: Quat): Quat {\n // rotate a plane using a quaternion\n const t = q.mul(new Quat(0, this.b, this.c, this.d)).mul(q.invrot());\n t.a = this.a;\n return t;\n }\n\n // return any vector orthogonal to the given one. Find the smallest\n // component (in absolute value) and return the cross product of that\n // axis with the given vector.\n public orthogonal(): Quat {\n const ab = Math.abs(this.b);\n const ac = Math.abs(this.c);\n const ad = Math.abs(this.d);\n if (ab < ac && ab < ad) {\n return this.cross(new Quat(0, 1, 0, 0)).normalize();\n } else if (ac < ab && ac < ad) {\n return this.cross(new Quat(0, 0, 1, 0)).normalize();\n } else {\n return this.cross(new Quat(0, 0, 0, 1)).normalize();\n }\n }\n\n // return the Quaternion that will rotate the this vector\n // to the b vector through rotatepoint.\n public pointrotation(b: Quat): Quat {\n const a = this.normalize();\n b = b.normalize();\n if (a.sub(b).len() < eps) {\n return new Quat(1, 0, 0, 0);\n }\n let h = a.sum(b);\n if (h.len() < eps) {\n h = h.orthogonal();\n } else {\n h = h.normalize();\n }\n const r = a.cross(h);\n r.a = a.dot(h);\n return r;\n }\n\n // given two vectors, return the portion of the first that\n // is not in the direction of the second.\n public unproject(b: Quat): Quat {\n return this.sum(b.smul(-this.dot(b) / (this.len() * b.len())));\n }\n\n public rotatepoint(q: Quat): Quat {\n // rotate a point\n return q.mul(this).mul(q.invrot());\n }\n\n public rotateface(face: Quat[]): Quat[] {\n // rotate a face by this Q.\n return face.map((_: Quat) => _.rotatepoint(this));\n }\n\n public intersect3(p2: Quat, p3: Quat): Quat | false {\n // intersect three planes if there is one\n const det = this.det3x3(\n this.b,\n this.c,\n this.d,\n p2.b,\n p2.c,\n p2.d,\n p3.b,\n p3.c,\n p3.d,\n );\n if (Math.abs(det) < eps) {\n return false; // TODO: Change to `null` or `undefined`?\n }\n return new Quat(\n 0,\n this.det3x3(this.a, this.c, this.d, p2.a, p2.c, p2.d, p3.a, p3.c, p3.d) /\n det,\n this.det3x3(this.b, this.a, this.d, p2.b, p2.a, p2.d, p3.b, p3.a, p3.d) /\n det,\n this.det3x3(this.b, this.c, this.a, p2.b, p2.c, p2.a, p3.b, p3.c, p3.a) /\n det,\n );\n }\n\n public side(x: number): number {\n // is this point close to the origin, or on one or the other side?\n if (x > eps) {\n return 1;\n }\n if (x < -eps) {\n return -1;\n }\n return 0;\n }\n\n /**\n * Cuts a face by this plane, or returns null if there\n * is no intersection.\n * @param face The face to cut.\n */\n public cutface(face: Quat[]): Quat[][] | null {\n const d = this.a;\n let seen = 0;\n let r = null;\n for (let i = 0; i < face.length; i++) {\n seen |= 1 << (this.side(face[i].dot(this) - d) + 1);\n }\n if ((seen & 5) === 5) {\n r = [];\n // saw both sides\n const inout = face.map((_: Quat) => this.side(_.dot(this) - d));\n for (let s = -1; s <= 1; s += 2) {\n const nface = [];\n for (let k = 0; k < face.length; k++) {\n if (inout[k] === s || inout[k] === 0) {\n nface.push(face[k]);\n }\n const kk = (k + 1) % face.length;\n if (inout[k] + inout[kk] === 0 && inout[k] !== 0) {\n const vk = face[k].dot(this) - d;\n const vkk = face[kk].dot(this) - d;\n const r = vk / (vk - vkk);\n const pt = face[k].smul(1 - r).sum(face[kk].smul(r));\n nface.push(pt);\n }\n }\n r.push(nface);\n }\n }\n return r;\n }\n\n public cutfaces(faces: Quat[][]): Quat[][] {\n // Cut a set of faces by a plane and return new set\n const nfaces = [];\n for (let j = 0; j < faces.length; j++) {\n const face = faces[j];\n const t = this.cutface(face);\n if (t) {\n nfaces.push(t[0]);\n nfaces.push(t[1]);\n } else {\n nfaces.push(face);\n }\n }\n return nfaces;\n }\n\n public faceside(face: Quat[]): number {\n // which side of a plane is a face on?\n const d = this.a;\n for (let i = 0; i < face.length; i++) {\n const s = this.side(face[i].dot(this) - d);\n if (s !== 0) {\n return s;\n }\n }\n throw new Error(\"Could not determine side of plane in faceside\");\n }\n\n public sameplane(p: Quat): boolean {\n // are two planes the same?\n const a = this.normalize();\n const b = p.normalize();\n return a.dist(b) < eps || a.dist(b.smul(-1)) < eps;\n }\n\n public makecut(r: number): Quat {\n // make a cut from a normal vector\n return new Quat(r, this.b, this.c, this.d);\n }\n}\n", "/* tslint:disable prefer-for-of */ // TODO\n\nimport { Quat, solvethreeplanes } from \"./Quat\";\n\n// Next we define a class that yields quaternion generators for each of\n// the five platonic solids. The quaternion generators chosen are\n// chosen specifically so that the first quaternion doubles as a plane\n// description that yields the given Platonic solid (so for instance, the\n// cubical group and octahedral group are identical in math, but we\n// give distinct representations choosing the first quaternion so that\n// we get the desired figure.) Our convention is one vertex of the\n// shape points precisely down.\n\n// This class is static.\n\nconst eps = 1e-9; // TODO: Deduplicate with `PuzzleGeometry`?\n\nexport function cube(): Quat[] {\n const s5 = Math.sqrt(0.5);\n return [new Quat(s5, s5, 0, 0), new Quat(s5, 0, s5, 0)];\n}\n\nexport function tetrahedron(): Quat[] {\n return [new Quat(0.5, 0.5, 0.5, 0.5), new Quat(0.5, 0.5, 0.5, -0.5)];\n}\n\nexport function dodecahedron(): Quat[] {\n const d36 = (2 * Math.PI) / 10;\n let dx = 0.5 + 0.3 * Math.sqrt(5);\n let dy = 0.5 + 0.1 * Math.sqrt(5);\n const dd = Math.sqrt(dx * dx + dy * dy);\n dx /= dd;\n dy /= dd;\n return [\n new Quat(Math.cos(d36), dx * Math.sin(d36), dy * Math.sin(d36), 0),\n new Quat(0.5, 0.5, 0.5, 0.5),\n ];\n}\n\nexport function icosahedron(): Quat[] {\n let dx = 1 / 6 + Math.sqrt(5) / 6;\n let dy = 2 / 3 + Math.sqrt(5) / 3;\n const dd = Math.sqrt(dx * dx + dy * dy);\n dx /= dd;\n dy /= dd;\n const ang = (2 * Math.PI) / 6;\n return [\n new Quat(Math.cos(ang), dx * Math.sin(ang), dy * Math.sin(ang), 0),\n new Quat(Math.cos(ang), -dx * Math.sin(ang), dy * Math.sin(ang), 0),\n ];\n}\n\nexport function octahedron(): Quat[] {\n const s5 = Math.sqrt(0.5);\n return [new Quat(0.5, 0.5, 0.5, 0.5), new Quat(s5, 0, 0, s5)];\n}\n\nexport function closure(g: Quat[]): Quat[] {\n // compute the closure of a set of generators\n // This is quadratic in the result size. Also, it has no protection\n // against you providing a bogus set of generators that would generate\n // an infinite group.\n const q = [new Quat(1, 0, 0, 0)];\n for (let i = 0; i < q.length; i++) {\n for (let j = 0; j < g.length; j++) {\n const ns = g[j].mul(q[i]);\n const negns = ns.smul(-1);\n let wasseen = false;\n for (let k = 0; k < q.length; k++) {\n if (ns.dist(q[k]) < eps || negns.dist(q[k]) < eps) {\n wasseen = true;\n break;\n }\n }\n if (!wasseen) {\n q.push(ns);\n }\n }\n }\n return q;\n}\n\nexport function uniqueplanes(p: Quat, g: Quat[]): Quat[] {\n // compute unique plane rotations\n // given a rotation group and a plane, find the rotations that\n // generate unique planes. This is quadratic in the return size.\n const planes = [];\n const planerot = [];\n for (let i = 0; i < g.length; i++) {\n const p2 = p.rotateplane(g[i]);\n let wasseen = false;\n for (let j = 0; j < planes.length; j++) {\n if (p2.dist(planes[j]) < eps) {\n wasseen = true;\n break;\n }\n }\n if (!wasseen) {\n planes.push(p2);\n planerot.push(g[i]);\n }\n }\n return planerot;\n}\n\nexport function getface(planes: Quat[]): Quat[] {\n // compute a face given a set of planes\n // The face returned will be a set of points that lie in the first plane\n // in the given array, that are on the surface of the polytope defined\n // by all the planes, and will be returned in clockwise order.\n // This is O(planes^2 * return size + return_size^2).\n const face: Quat[] = [];\n for (let i = 1; i < planes.length; i++) {\n for (let j = i + 1; j < planes.length; j++) {\n const p = solvethreeplanes(0, i, j, planes);\n if (p) {\n let wasseen = false;\n for (let k = 0; k < face.length; k++) {\n if (p.dist(face[k]) < eps) {\n wasseen = true;\n break;\n }\n }\n if (!wasseen) {\n face.push(p);\n }\n }\n }\n }\n for (;;) {\n let changed = false;\n for (let i = 0; i < face.length; i++) {\n const j: number = (i + 1) % face.length;\n if (planes[0].dot(face[i].cross(face[j])) < 0) {\n const t: Quat = face[i];\n face[i] = face[j];\n face[j] = t;\n changed = true;\n }\n }\n if (!changed) {\n break;\n }\n }\n return face;\n}\n", "import { identity, Perm } from \"./Perm\";\n\nclass FactoredNumber {\n public mult: number[];\n constructor() {\n this.mult = [];\n }\n\n public multiply(n: number): void {\n for (let f = 2; f * f <= n; f++) {\n while (n % f === 0) {\n if (undefined !== this.mult[f]) {\n this.mult[f]++;\n } else {\n this.mult[f] = 1;\n }\n n /= f;\n }\n }\n if (n > 1) {\n if (undefined !== this.mult[n]) {\n this.mult[n]++;\n } else {\n this.mult[n] = 1;\n }\n }\n }\n\n public toString(): string {\n let r = \"\";\n for (let i = 0; i < this.mult.length; i++) {\n if (undefined !== this.mult[i]) {\n if (r !== \"\") {\n r += \"*\";\n }\n r += i;\n if (this.mult[i] > 1) {\n r += `^${this.mult[i]}`;\n }\n }\n }\n return r;\n }\n}\n\nexport function schreierSims(g: Perm[], disp: (s: string) => void): number {\n const n = g[0].p.length;\n const e = identity(n);\n let sgs: Perm[][] = [];\n let sgsi: Perm[][] = [];\n let sgslen: number[][] = [];\n let Tk: Perm[][] = [];\n let Tklen: number[][] = [];\n function resolve(p: Perm): boolean {\n for (let i = p.p.length - 1; i >= 0; i--) {\n const j = p.p[i];\n if (j !== i) {\n if (!sgs[i][j]) {\n return false;\n }\n p = p.mul(sgsi[i][j]);\n }\n }\n return true;\n }\n function knutha(k: number, p: Perm, len: number): void {\n Tk[k].push(p);\n Tklen[k].push(len);\n for (let i = 0; i < sgs[k].length; i++) {\n if (sgs[k][i]) {\n knuthb(k, sgs[k][i].mul(p), len + sgslen[k][i]);\n }\n }\n }\n function knuthb(k: number, p: Perm, len: number): void {\n const j = p.p[k];\n if (!sgs[k][j]) {\n sgs[k][j] = p;\n sgsi[k][j] = p.inv();\n sgslen[k][j] = len;\n for (let i = 0; i < Tk[k].length; i++) {\n knuthb(k, p.mul(Tk[k][i]), len + Tklen[k][i]);\n }\n return;\n }\n const p2 = p.mul(sgsi[k][j]);\n if (!resolve(p2)) {\n knutha(k - 1, p2, len + sgslen[k][j]);\n }\n }\n function getsgs(): number {\n sgs = [];\n sgsi = [];\n Tk = [];\n sgslen = [];\n Tklen = [];\n for (let i = 0; i < n; i++) {\n sgs.push([]);\n sgsi.push([]);\n sgslen.push([]);\n Tk.push([]);\n Tklen.push([]);\n sgs[i][i] = e;\n sgsi[i][i] = e;\n sgslen[i][i] = 0;\n }\n let none = 0;\n let sz = 1;\n for (let i = 0; i < g.length; i++) {\n knutha(n - 1, g[i], 1);\n sz = 1;\n let tks = 0;\n let sollen = 0;\n const avgs = [];\n const mults = new FactoredNumber();\n for (let j = 0; j < n; j++) {\n let cnt = 0;\n let lensum = 0;\n for (let k = 0; k < n; k++) {\n if (sgs[j][k]) {\n cnt++;\n lensum += sgslen[j][k];\n if (j !== k) {\n none++;\n }\n }\n }\n tks += Tk[j].length;\n sz *= cnt;\n if (cnt > 1) {\n mults.multiply(cnt);\n }\n const avg = lensum / cnt;\n avgs.push(avg);\n sollen += avg;\n }\n disp(\n `${i}: sz ${sz} T ${tks} sol ${sollen} none ${none} mults ${mults.toString()}`,\n );\n }\n return sz;\n }\n return getsgs();\n}\n", "import { Move, QuantumMove } from \"../alg\";\nimport { FaceNameSwizzler } from \"./FaceNameSwizzler\";\nimport type { MoveNotation } from \"./interfaces\";\nimport {\n FaceRenamingMapper,\n FTONotationMapper,\n MegaminxScramblingNotationMapper,\n NotationMapper,\n NullMapper,\n NxNxNCubeMapper,\n PyraminxNotationMapper,\n SkewbNotationMapper,\n TetraminxNotationMapper,\n} from \"./notation-mapping\";\nimport {\n BaseFaceCount,\n FaceBasedOrientationDescription,\n FaceBasedOrientationDescriptionLookup,\n PuzzleGeometryOptions,\n PuzzleGeometryFullOptions,\n} from \"./Options\";\nimport { iota, Perm, zeros } from \"./Perm\";\nimport {\n externalName,\n PGOrbit,\n PGOrbitDef,\n PGOrbitsDef,\n showcanon,\n PGTransform,\n VisibleState,\n} from \"./PermOriSet\";\nimport { PGPuzzles, PuzzleDescriptionString, PuzzleName } from \"./PGPuzzles\";\nimport {\n closure,\n cube,\n dodecahedron,\n getface,\n icosahedron,\n octahedron,\n tetrahedron,\n uniqueplanes,\n} from \"./PlatonicGenerator\";\nimport { centermassface, Quat } from \"./Quat\";\nimport { schreierSims } from \"./SchreierSims\";\nimport type {\n KPuzzleDefinition,\n Transformation as KTransformation,\n} from \"../kpuzzle\";\n\nexport interface TextureMapper {\n getuv(fn: number, threed: number[]): number[];\n}\n\nexport interface StickerDatSticker {\n coords: number[];\n color: string;\n orbit: string;\n ord: number;\n ori: number;\n face: number;\n isDup?: boolean;\n}\n\nexport interface StickerDatFace {\n coords: number[];\n name: string;\n}\n\nexport type StickerDatAxis = {\n coordinates: number[];\n quantumMove: Move;\n order: number;\n};\n\nexport interface StickerDat {\n stickers: StickerDatSticker[];\n faces: StickerDatFace[];\n axis: StickerDatAxis[];\n unswizzle(mv: Move): string;\n notationMapper: NotationMapper;\n textureMapper: TextureMapper;\n}\n\n// you can fill these in to help with timing if you want\nfunction tstart(s: string): string {\n return s;\n}\n\nfunction tend(_: string): void {}\n\nclass Face {\n private coords: number[];\n public length: number;\n constructor(q: Quat[]) {\n this.coords = new Array(q.length * 3);\n for (let i = 0; i < q.length; i++) {\n this.coords[3 * i] = q[i].b;\n this.coords[3 * i + 1] = q[i].c;\n this.coords[3 * i + 2] = q[i].d;\n }\n this.length = q.length;\n }\n\n get(off: number): Quat {\n return new Quat(\n 0,\n this.coords[3 * off],\n this.coords[3 * off + 1],\n this.coords[3 * off + 2],\n );\n }\n\n centermass(): Quat {\n let sx = 0;\n let sy = 0;\n let sz = 0;\n for (let i = 0; i < this.length; i++) {\n sx += this.coords[3 * i];\n sy += this.coords[3 * i + 1];\n sz += this.coords[3 * i + 2];\n }\n return new Quat(0, sx / this.length, sy / this.length, sz / this.length);\n }\n\n rotate(q: Quat): Face {\n const a = [];\n for (let i = 0; i < this.length; i++) {\n a.push(this.get(i).rotatepoint(q));\n }\n return new Face(a);\n }\n\n rotateforward(): Face {\n const a = [];\n for (let i = 1; i < this.length; i++) {\n a.push(this.get(i));\n }\n a.push(this.get(0));\n return new Face(a);\n }\n}\n\nexport class FaceTree {\n constructor(\n private face: Quat[],\n private left?: FaceTree,\n private right?: FaceTree,\n ) {}\n\n public split(q: Quat): FaceTree {\n const t = q.cutface(this.face);\n if (t !== null) {\n if (this.left === undefined) {\n this.left = new FaceTree(t[0]);\n this.right = new FaceTree(t[1]);\n } else {\n this.left = this.left?.split(q);\n this.right = this.right?.split(q);\n }\n }\n return this;\n }\n\n public collect(arr: Face[], leftfirst: boolean): Face[] {\n if (this.left === undefined) {\n arr.push(new Face(this.face));\n } else if (leftfirst) {\n this.left?.collect(arr, false);\n this.right?.collect(arr, true);\n } else {\n this.right?.collect(arr, false);\n this.left?.collect(arr, true);\n }\n return arr;\n }\n}\n\nexport function expandfaces(rots: Quat[], faces: Face[]): Face[] {\n // given a set of faces, expand by rotation set\n const nfaces = [];\n for (const rot of rots) {\n for (const face of faces) {\n nfaces.push(face.rotate(rot));\n }\n }\n return nfaces;\n}\n\n// Now we have a geometry class that does the 3D goemetry to calculate\n// individual sticker information from a Platonic solid and a set of\n// cuts. The cuts must have the same symmetry as the Platonic solid;\n// we even restrict them further to be either vertex-normal,\n// edge-normal, or face-parallel cuts. Right now our constructor takes\n// a character solid indicator (one of c(ube), o(ctahedron), i(cosahedron),\n// t(etradron), or d(odecahedron), followed by an array of cuts.\n// Each cut is a character normal indicator that is either f(ace),\n// e(dge), or v(ertex), followed by a floating point value that gives\n// the depth of the cut where 0 is the center and 1 is the outside\n// border of the shape in that direction.\n\n// This is a heavyweight class with lots of members and construction\n// is slow. Be gentle.\n\n// Everything except a very few methods should be considered private.\n\nconst eps: number = 1e-9;\nconst copyright = \"PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.\";\nconst permissivieMoveParsing = false;\n\n// This is a description of the nets and the external names we give each\n// face. The names should be a set of prefix-free upper-case alphabetics\n// so\n// we can easily also name and distinguish vertices and edges, but we\n// may change this in the future. The nets consist of a list of lists.\n// Each list gives the name of a face, and then the names of the\n// faces connected to that face (in the net) in clockwise order.\n// The length of each list should be one more than the number of\n// edges in the regular polygon for that face. All polygons must\n// have the same number of edges.\n// The first two faces in the first list must describe a horizontal edge\n// that is at the bottom of a regular polygon. The first two faces in\n// every subsequent list for a given polytope must describe a edge that\n// is directly connected in the net and has already been described (this\n// sets the location and orientation of the polygon for that face.\n// Any edge that is not directly connected in the net should be given\n// the empty string as the other face. All faces do not need to have\n// a list starting with that face; just enough to describe the full\n// connectivity of the net.\n//\n// TODO: change this back to a const JSON definition.\nfunction defaultnets(): any {\n return {\n // four faces: tetrahedron\n 4: [[\"F\", \"D\", \"L\", \"R\"]],\n // six faces: cube\n 6: [\n [\"F\", \"D\", \"L\", \"U\", \"R\"],\n [\"R\", \"F\", \"\", \"B\", \"\"],\n ],\n // eight faces: octahedron\n 8: [\n [\"F\", \"D\", \"L\", \"R\"],\n [\"D\", \"F\", \"BR\", \"\"],\n [\"BR\", \"D\", \"\", \"BB\"],\n [\"BB\", \"BR\", \"U\", \"BL\"],\n ],\n // twelve faces: dodecahedron; U/F/R/F/BL/BR from megaminx\n 12: [\n [\"U\", \"F\", \"\", \"\", \"\", \"\"],\n [\"F\", \"U\", \"R\", \"C\", \"A\", \"L\"],\n [\"R\", \"F\", \"\", \"\", \"E\", \"\"],\n [\"E\", \"R\", \"\", \"BF\", \"\", \"\"],\n [\"BF\", \"E\", \"BR\", \"BL\", \"I\", \"D\"],\n ],\n // twenty faces: icosahedron\n 20: [\n [\"R\", \"C\", \"F\", \"E\"],\n [\"F\", \"R\", \"L\", \"U\"],\n [\"L\", \"F\", \"A\", \"\"],\n [\"E\", \"R\", \"G\", \"I\"],\n [\"I\", \"E\", \"S\", \"H\"],\n [\"S\", \"I\", \"J\", \"B\"],\n [\"B\", \"S\", \"K\", \"D\"],\n [\"K\", \"B\", \"M\", \"O\"],\n [\"O\", \"K\", \"P\", \"N\"],\n [\"P\", \"O\", \"Q\", \"\"],\n ],\n };\n}\n\n// TODO: change this back to a const JSON definition.\nfunction defaultcolors(): any {\n return {\n // the colors should use the same naming convention as the nets, above.\n 4: { F: \"#00ff00\", D: \"#ffff00\", L: \"#ff0000\", R: \"#0000ff\" },\n 6: {\n U: \"#ffffff\",\n F: \"#00ff00\",\n R: \"#ff0000\",\n D: \"#ffff00\",\n B: \"#0000ff\",\n L: \"#ff8000\",\n },\n 8: {\n U: \"#ffffff\",\n F: \"#ff0000\",\n R: \"#00bb00\",\n D: \"#ffff00\",\n BB: \"#1122ff\",\n L: \"#9524c5\",\n BL: \"#ff8800\",\n BR: \"#aaaaaa\",\n },\n 12: {\n U: \"#ffffff\",\n F: \"#006633\",\n R: \"#ff0000\",\n C: \"#ffffd0\",\n A: \"#3399ff\",\n L: \"#660099\",\n E: \"#ff66cc\",\n BF: \"#99ff00\",\n BR: \"#0000ff\",\n BL: \"#ffff00\",\n I: \"#ff6633\",\n D: \"#999999\",\n },\n 20: {\n R: \"#db69f0\",\n C: \"#178fde\",\n F: \"#23238b\",\n E: \"#9cc726\",\n L: \"#2c212d\",\n U: \"#177fa7\",\n A: \"#e0de7f\",\n G: \"#2b57c0\",\n I: \"#41126b\",\n S: \"#4b8c28\",\n H: \"#7c098d\",\n J: \"#7fe7b4\",\n B: \"#85fb74\",\n K: \"#3f4bc3\",\n D: \"#0ff555\",\n M: \"#f1c2c8\",\n O: \"#58d340\",\n P: \"#c514f2\",\n N: \"#14494e\",\n Q: \"#8b1be1\",\n },\n };\n}\n\n// the default precedence of the faces is given here. This permits\n// the orientations to be reasonably predictable. There are tradeoffs;\n// some face precedence orders do better things to the edge orientations\n// than the corner orientations and some are the opposite.\n// TODO: change this back to a const JSON definition.\nfunction defaultfaceorders(): any {\n return {\n 4: [\"F\", \"D\", \"L\", \"R\"],\n 6: [\"U\", \"D\", \"F\", \"B\", \"L\", \"R\"],\n 8: [\"F\", \"BB\", \"D\", \"U\", \"BR\", \"L\", \"R\", \"BL\"],\n 12: [\"L\", \"E\", \"F\", \"BF\", \"R\", \"I\", \"U\", \"D\", \"BR\", \"A\", \"BL\", \"C\"],\n 20: [\n \"L\",\n \"S\",\n \"E\",\n \"O\",\n \"F\",\n \"B\",\n \"I\",\n \"P\",\n \"R\",\n \"K\",\n \"U\",\n \"D\",\n \"J\",\n \"A\",\n \"Q\",\n \"H\",\n \"G\",\n \"N\",\n \"M\",\n \"C\",\n ],\n };\n}\n\n/*\n * Default orientations for the puzzles in 3D space. Can be overridden\n * by puzzleOrientation or puzzleOrientations options.\n *\n * These are defined to have a strong intuitive vertical (y) direction\n * since 3D orbital controls need this. In comments, we list the\n * preferred initial camera orientation for each puzzle for twizzle;\n * this information is explicitly given in the twizzle app file.\n */\n// TODO: change this back to a const JSON definition.\nfunction defaultOrientations(): FaceBasedOrientationDescriptionLookup {\n return {\n 4: [\n [\"FLR\", [0, 1, 0]],\n [\"F\", [0, 0, 1]],\n ], // FLR towards viewer\n 6: [\n [\"U\", [0, 1, 0]],\n [\"F\", [0, 0, 1]],\n ], // URF towards viewer\n 8: [\n [\"U\", [0, 1, 0]],\n [\"F\", [0, 0, 1]],\n ], // FLUR towards viewer\n 12: [\n [\"U\", [0, 1, 0]],\n [\"F\", [0, 0, 1]],\n ], // F towards viewer\n 20: [\n [\"GUQMJ\", [0, 1, 0]],\n [\"F\", [0, 0, 1]],\n ], // F towards viewer\n };\n}\n\nfunction findelement(a: Quat[][], p: Quat): number {\n // find something in facenames, vertexnames, edgenames\n for (let i = 0; i < a.length; i++) {\n if (a[i][0].dist(p) < eps) {\n return i;\n }\n }\n throw new Error(\"Element not found\");\n}\n\nexport function getPG3DNamedPuzzles(): {\n [s: string]: PuzzleDescriptionString;\n} {\n // get some simple definitions of basic puzzles\n return PGPuzzles;\n}\n\nexport function getPuzzleDescriptionString(\n puzzleName: PuzzleName,\n): PuzzleDescriptionString {\n // get some simple definitions of basic puzzles\n return PGPuzzles[puzzleName];\n}\n\nexport type CutDescription = { cutType: string; distance: number };\nexport type PuzzleDescription = {\n shape: string;\n cuts: CutDescription[];\n};\n\nexport function parsePuzzleDescription(\n s: PuzzleDescriptionString,\n): PuzzleDescription | null {\n // parse a text description\n const a = s.split(/ /).filter(Boolean);\n if (a.length % 2 === 0) {\n return null;\n }\n const shape = a[0];\n if (\n shape !== \"o\" &&\n shape !== \"c\" &&\n shape !== \"i\" &&\n shape !== \"d\" &&\n shape !== \"t\"\n ) {\n return null;\n }\n const cuts: CutDescription[] = [];\n for (let i = 1; i < a.length; i += 2) {\n if (a[i] !== \"f\" && a[i] !== \"v\" && a[i] !== \"e\") {\n return null;\n }\n cuts.push({ cutType: a[i], distance: parseFloat(a[i + 1]) });\n }\n return { shape, cuts };\n}\n\nexport function getPuzzleGeometryByDesc(\n desc: string,\n options: PuzzleGeometryOptions = {},\n): PuzzleGeometry {\n const parsed = parsePuzzleDescription(desc);\n if (parsed === null) {\n throw new Error(\"Could not parse the puzzle description\");\n }\n const pg = new PuzzleGeometry(\n parsed,\n Object.assign({}, { allMoves: true } as PuzzleGeometryOptions, options),\n );\n pg.allstickers();\n pg.genperms();\n return pg;\n}\n\nexport function getPuzzleGeometryByName(\n puzzleName: PuzzleName,\n options?: PuzzleGeometryOptions,\n): PuzzleGeometry {\n return getPuzzleGeometryByDesc(PGPuzzles[puzzleName], options);\n}\n\nfunction getmovename(\n geo: any,\n bits: number[],\n slices: number,\n): [string, boolean] {\n // generate a move name based on bits, slice, and geo\n // if the move name is from the opposite face, say so.\n // find the face that's turned.\n let inverted = false;\n if (slices - bits[1] < bits[0]) {\n // flip if most of the move is on the other side\n geo = [geo[2], geo[3], geo[0], geo[1]];\n bits = [slices - bits[1], slices - bits[0]];\n inverted = true;\n }\n let movenameFamily = geo[0] as string;\n let movenamePrefix = \"\";\n if (bits[0] === 0 && bits[1] === slices) {\n movenameFamily = movenameFamily + \"v\";\n } else if (bits[0] === bits[1]) {\n if (bits[1] > 0) {\n movenamePrefix = String(bits[1] + 1);\n }\n } else if (bits[0] === 0) {\n movenameFamily = movenameFamily.toLowerCase();\n if (bits[1] > 1) {\n movenamePrefix = String(bits[1] + 1);\n }\n } else {\n throw `We only support slice and outer block moves right now. ${bits}`;\n }\n return [movenamePrefix + movenameFamily, inverted];\n}\n\n// split a geometrical element into face names. Do greedy match.\n// Permit underscores between names.\nfunction splitByFaceNames(s: string, facenames: [Quat[], string][]): string[] {\n const r: string[] = [];\n let at = 0;\n while (at < s.length) {\n if (at > 0 && at < s.length && s[at] === \"_\") {\n at++;\n }\n let currentMatch = \"\";\n for (const facename of facenames) {\n if (\n s.substr(at).startsWith(facename[1]) &&\n facename[1].length > currentMatch.length\n ) {\n currentMatch = facename[1];\n }\n }\n if (currentMatch !== \"\") {\n r.push(currentMatch);\n at += currentMatch.length;\n } else {\n throw new Error(\"Could not split \" + s + \" into face names.\");\n }\n }\n return r;\n}\n\nfunction toCoords(q: Quat, maxdist: number): number[] {\n return [q.b / maxdist, -q.c / maxdist, q.d / maxdist];\n}\n\nfunction toFaceCoords(q: Face, maxdist: number): number[] {\n const r = [];\n const n = q.length;\n for (let i = 0; i < n; i++) {\n const pt = toCoords(q.get(n - i - 1), maxdist);\n r[3 * i] = pt[0];\n r[3 * i + 1] = pt[1];\n r[3 * i + 2] = pt[2];\n }\n return r;\n}\n\nexport class PuzzleGeometry {\n private rotations: Quat[]; // all members of the rotation group\n public baseplanerot: Quat[]; // unique rotations of the baseplane\n private baseplanes: Quat[]; // planes, corresponding to faces\n private facenames: [Quat[], string][]; // face names\n private faceplanes: [Quat, string][]; // face planes\n private edgenames: [Quat, string][]; // edge names\n private vertexnames: [Quat, string][]; // vertexnames\n private geonormals: [Quat, string, string][]; // all geometric directions, with names and types\n private moveplanes: Quat[]; // the planes that split moves\n private moveplanes2: Quat[]; // the planes that split moves, filtered\n public moveplanesets: Quat[][]; // the move planes, in parallel sets\n private moveplanenormals: Quat[]; // one move plane\n public movesetorders: number[]; // the order of rotations for each move set\n public movesetgeos: [string, string, string, string, number][]; // geometric feature information for move sets\n private basefaces: Face[]; // polytope faces before cuts\n private faces: Face[]; // all the stickers\n private facecentermass: Quat[]; // center of mass of all faces\n private baseFaceCount: BaseFaceCount; // number of base faces\n public stickersperface: number; // number of stickers per face\n public shortedge: number; // number of stickers per face\n public cubies: number[][]; // the cubies\n private vertexdistance: number; // vertex distance\n private edgedistance: number; // edge distance\n private facetocubie: number[]; // map a face to a cubie index\n private facetoord: number[]; // map a face to a cubie ord\n private moverotations: Quat[][]; // move rotations\n private facelisthash: Map<string, number[]>; // face list by key\n private cubiesetnames: string[]; // cubie set names\n private cubieords: number[]; // the size of each orbit\n private cubiesetnums: number[];\n private cubieordnums: number[];\n private orbitoris: number[]; // the orientation size of each orbit\n private cubievaluemap: number[]; // the map for identical cubies\n private cubiesetcubies: number[][]; // cubies in each cubie set\n public cmovesbyslice: number[][][] = []; // cmoves as perms by slice\n public parsedmovelist: [\n string | undefined,\n number,\n number,\n number,\n boolean,\n number,\n ][]; // parsed move list\n\n private duplicatedFaces: number[] = []; // which faces are duplicated\n private duplicatedCubies: number[] = []; // which cubies are duplicated\n private fixedCubie: number = -1; // fixed cubie, if any\n private net: string[][] = [];\n private colors: any = [];\n private faceorder: string[] = [];\n private faceprecedence: number[] = [];\n private swizzler: FaceNameSwizzler;\n public notationMapper: NotationMapper = new NullMapper();\n private addNotationMapper: string = \"\";\n private setReidOrder: boolean = false;\n\n private options: PuzzleGeometryFullOptions;\n\n constructor(\n puzzleDescription: PuzzleDescription,\n options: PuzzleGeometryOptions,\n ) {\n const t1 = tstart(\"genperms\");\n this.options = new PuzzleGeometryFullOptions(options);\n if (this.options.verbosity > 0) {\n console.log(this.header(\"# \"));\n }\n this.create(puzzleDescription);\n tend(t1);\n }\n\n public create(puzzleDescription: PuzzleDescription): void {\n const { shape, cuts } = puzzleDescription;\n\n // create the shape, doing all the essential geometry\n // create only goes far enough to figure out how many stickers per\n // face, and what the short edge is. If the short edge is too short,\n // we probably don't want to display or manipulate this one. How\n // short is too short is hard to say.\n this.moveplanes = [];\n this.moveplanes2 = [];\n this.faces = [];\n this.cubies = [];\n let g = null;\n switch (shape) {\n case \"c\":\n g = cube();\n break;\n case \"o\":\n g = octahedron();\n break;\n case \"i\":\n g = icosahedron();\n break;\n case \"t\":\n g = tetrahedron();\n break;\n case \"d\":\n g = dodecahedron();\n break;\n default:\n throw new Error(\"Bad shape argument: \" + shape);\n }\n this.rotations = closure(g);\n if (this.options.verbosity) {\n console.log(\"# Rotations: \" + this.rotations.length);\n }\n const baseplane = g[0];\n this.baseplanerot = uniqueplanes(baseplane, this.rotations);\n const baseplanes = this.baseplanerot.map((_) => baseplane.rotateplane(_));\n this.baseplanes = baseplanes;\n this.baseFaceCount = baseplanes.length as BaseFaceCount;\n const net = defaultnets()[baseplanes.length];\n this.net = net;\n this.colors = defaultcolors()[baseplanes.length];\n this.faceorder = defaultfaceorders()[baseplanes.length];\n if (this.options.verbosity > 0) {\n console.log(\"# Base planes: \" + baseplanes.length);\n }\n const baseface = getface(baseplanes);\n const zero = new Quat(0, 0, 0, 0);\n if (this.options.verbosity > 0) {\n console.log(\"# Face vertices: \" + baseface.length);\n }\n const facenormal = baseplanes[0].makenormal();\n const edgenormal = baseface[0].sum(baseface[1]).makenormal();\n const vertexnormal = baseface[0].makenormal();\n const boundary = new Quat(1, facenormal.b, facenormal.c, facenormal.d);\n if (this.options.verbosity > 0) {\n console.log(\"# Boundary is \" + boundary);\n }\n const planerot = uniqueplanes(boundary, this.rotations);\n const planes = planerot.map((_) => boundary.rotateplane(_));\n const firstface = getface(planes);\n this.edgedistance = firstface[0].sum(firstface[1]).smul(0.5).dist(zero);\n this.vertexdistance = firstface[0].dist(zero);\n const cutplanes = [];\n const intersects = [];\n let sawface = false; // what cuts did we see?\n let sawedge = false;\n let sawvertex = false;\n for (const cut of cuts) {\n let normal = null;\n let distance = 0;\n switch (cut.cutType) {\n case \"f\":\n normal = facenormal;\n distance = 1;\n sawface = true;\n break;\n case \"v\":\n normal = vertexnormal;\n distance = this.vertexdistance;\n sawvertex = true;\n break;\n case \"e\":\n normal = edgenormal;\n distance = this.edgedistance;\n sawedge = true;\n break;\n default:\n throw new Error(\"Bad cut argument: \" + cut.cutType);\n }\n cutplanes.push(normal.makecut(cut.distance));\n intersects.push(cut.distance < distance);\n }\n if (this.options.addRotations) {\n if (!sawface) {\n cutplanes.push(facenormal.makecut(10));\n }\n if (!sawvertex) {\n cutplanes.push(vertexnormal.makecut(10));\n }\n if (!sawedge) {\n cutplanes.push(edgenormal.makecut(10));\n }\n }\n this.basefaces = [];\n for (const baseplanerot of this.baseplanerot) {\n const face = baseplanerot.rotateface(firstface);\n this.basefaces.push(new Face(face));\n }\n //\n // Determine names for edges, vertices, and planes. Planes are defined\n // by the plane normal/distance; edges are defined by the midpoint;\n // vertices are defined by actual point. In each case we define a name.\n // Note that edges have two potential names, and corners have n where\n // n planes meet at a vertex. We arbitrarily choose the one that is\n // alphabetically first (and we will probably want to change this).\n //\n const facenames: [Quat[], string][] = [];\n const faceplanes: [Quat, string][] = [];\n const vertexnames: any[] = [];\n const edgenames: any[] = [];\n const edgesperface = firstface.length;\n function searchaddelement(a: any[], p: Quat, name: any): void {\n for (const el of a) {\n if (el[0].dist(p) < eps) {\n el.push(name);\n return;\n }\n }\n a.push([p, name]);\n }\n for (let i = 0; i < this.baseplanerot.length; i++) {\n const face = this.baseplanerot[i].rotateface(firstface);\n for (let j = 0; j < face.length; j++) {\n const jj = (j + 1) % face.length;\n const midpoint = face[j].sum(face[jj]).smul(0.5);\n searchaddelement(edgenames, midpoint, i);\n }\n }\n const otherfaces = [];\n for (let i = 0; i < this.baseplanerot.length; i++) {\n const face = this.baseplanerot[i].rotateface(firstface);\n const facelist = [];\n for (let j = 0; j < face.length; j++) {\n const jj = (j + 1) % face.length;\n const midpoint = face[j].sum(face[jj]).smul(0.5);\n const el = edgenames[findelement(edgenames, midpoint)];\n if (i === el[1]) {\n facelist.push(el[2]);\n } else if (i === el[2]) {\n facelist.push(el[1]);\n } else {\n throw new Error(\"Could not find edge\");\n }\n }\n otherfaces.push(facelist);\n }\n const facenametoindex: any = {};\n const faceindextoname: string[] = [];\n faceindextoname.push(net[0][0]);\n facenametoindex[net[0][0]] = 0;\n faceindextoname[otherfaces[0][0]] = net[0][1];\n facenametoindex[net[0][1]] = otherfaces[0][0];\n for (const neti of net) {\n const f0 = neti[0];\n const fi = facenametoindex[f0];\n if (fi === undefined) {\n throw new Error(\"Bad edge description; first edge not connected\");\n }\n let ii = -1;\n for (let j = 0; j < otherfaces[fi].length; j++) {\n const fn2 = faceindextoname[otherfaces[fi][j]];\n if (fn2 !== undefined && fn2 === neti[1]) {\n ii = j;\n break;\n }\n }\n if (ii < 0) {\n throw new Error(\"First element of a net not known\");\n }\n for (let j = 2; j < neti.length; j++) {\n if (neti[j] === \"\") {\n continue;\n }\n const of = otherfaces[fi][(j + ii - 1) % edgesperface];\n const fn2 = faceindextoname[of];\n if (fn2 !== undefined && fn2 !== neti[j]) {\n throw new Error(\"Face mismatch in net\");\n }\n faceindextoname[of] = neti[j];\n facenametoindex[neti[j]] = of;\n }\n }\n for (let i = 0; i < faceindextoname.length; i++) {\n let found = false;\n for (let j = 0; j < this.faceorder.length; j++) {\n if (faceindextoname[i] === this.faceorder[j]) {\n this.faceprecedence[i] = j;\n found = true;\n break;\n }\n }\n if (!found) {\n throw new Error(\n \"Could not find face \" +\n faceindextoname[i] +\n \" in face order list \" +\n this.faceorder,\n );\n }\n }\n for (let i = 0; i < this.baseplanerot.length; i++) {\n const face = this.baseplanerot[i].rotateface(firstface);\n const faceplane = boundary.rotateplane(this.baseplanerot[i]);\n const facename = faceindextoname[i];\n facenames.push([face, facename]);\n faceplanes.push([faceplane, facename]);\n }\n for (let i = 0; i < this.baseplanerot.length; i++) {\n const face = this.baseplanerot[i].rotateface(firstface);\n const facename = faceindextoname[i];\n for (let j = 0; j < face.length; j++) {\n const jj = (j + 1) % face.length;\n const midpoint = face[j].sum(face[jj]).smul(0.5);\n const jjj = (j + 2) % face.length;\n const midpoint2 = face[jj].sum(face[jjj]).smul(0.5);\n const e1 = findelement(edgenames, midpoint);\n const e2 = findelement(edgenames, midpoint2);\n searchaddelement(vertexnames, face[jj], [facename, e2, e1]);\n }\n }\n this.swizzler = new FaceNameSwizzler(facenames.map((_) => _[1]));\n const sep = this.swizzler.prefixFree ? \"\" : \"_\";\n // fix the edge names; use face precedence order\n for (let i = 0; i < edgenames.length; i++) {\n if (edgenames[i].length !== 3) {\n throw new Error(\"Bad length in edge names \" + edgenames[i]);\n }\n let c1 = faceindextoname[edgenames[i][1]];\n const c2 = faceindextoname[edgenames[i][2]];\n if (\n this.faceprecedence[edgenames[i][1]] <\n this.faceprecedence[edgenames[i][2]]\n ) {\n c1 = c1 + sep + c2;\n } else {\n c1 = c2 + sep + c1;\n }\n edgenames[i] = [edgenames[i][0], c1];\n }\n // fix the vertex names; counterclockwise rotations; low face first.\n for (let i = 0; i < vertexnames.length; i++) {\n if (vertexnames[i].length < 4) {\n throw new Error(\"Bad length in vertex names\");\n }\n let st = 1;\n for (let j = 2; j < vertexnames[i].length; j++) {\n if (\n this.faceprecedence[facenametoindex[vertexnames[i][j][0]]] <\n this.faceprecedence[facenametoindex[vertexnames[i][st][0]]]\n ) {\n st = j;\n }\n }\n let r = \"\";\n for (let j = 1; j < vertexnames[i].length; j++) {\n if (j === 1) {\n r = vertexnames[i][st][0];\n } else {\n r = r + sep + vertexnames[i][st][0];\n }\n for (let k = 1; k < vertexnames[i].length; k++) {\n if (vertexnames[i][st][1] === vertexnames[i][k][2]) {\n st = k;\n break;\n }\n }\n }\n vertexnames[i] = [vertexnames[i][0], r];\n }\n if (this.options.verbosity > 1) {\n console.log(\"# Face precedence list: \" + this.faceorder.join(\" \"));\n console.log(\"# Face names: \" + facenames.map((_) => _[1]).join(\" \"));\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n console.log(\"# Edge names: \" + edgenames.map((_) => _[1]).join(\" \"));\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n console.log(\"# Vertex names: \" + vertexnames.map((_) => _[1]).join(\" \"));\n }\n const geonormals: [Quat, string, string][] = [];\n for (const faceplane of faceplanes) {\n geonormals.push([faceplane[0].makenormal(), faceplane[1], \"f\"]);\n }\n for (const edgename of edgenames) {\n geonormals.push([edgename[0].makenormal(), edgename[1], \"e\"]);\n }\n for (const vertexname of vertexnames) {\n geonormals.push([vertexname[0].makenormal(), vertexname[1], \"v\"]);\n }\n this.facenames = facenames;\n this.faceplanes = faceplanes;\n this.edgenames = edgenames;\n this.vertexnames = vertexnames;\n this.geonormals = geonormals;\n const geonormalnames = geonormals.map((_) => _[1]);\n this.swizzler.setGripNames(geonormalnames);\n if (this.options.verbosity > 0) {\n console.log(\n \"# Distances: face \" +\n 1 +\n \" edge \" +\n this.edgedistance +\n \" vertex \" +\n this.vertexdistance,\n );\n }\n // expand cutplanes by rotations. We only work with one face here.\n for (let c = 0; c < cutplanes.length; c++) {\n for (const rotation of this.rotations) {\n const q = cutplanes[c].rotateplane(rotation);\n let wasseen = false;\n for (const moveplane of this.moveplanes) {\n if (q.sameplane(moveplane)) {\n wasseen = true;\n break;\n }\n }\n if (!wasseen) {\n this.moveplanes.push(q);\n if (intersects[c]) {\n this.moveplanes2.push(q);\n }\n }\n }\n }\n let ft = new FaceTree(firstface);\n const tar = this.moveplanes2.slice();\n // we want to use Math.random() here but we can't, because when\n // we call multiple times we'll get different orbits/layouts.\n // to resolve this, we use a very simple linear congruential\n // generator. for our purposes, the numbers don't need to be\n // very random.\n let rval = 31;\n for (let i = 0; i < tar.length; i++) {\n const j = i + Math.floor((tar.length - i) * (rval / 65536.0));\n ft = ft.split(tar[j]);\n tar[j] = tar[i];\n rval = (rval * 1657 + 101) % 65536;\n }\n const faces = ft.collect([], true);\n this.faces = faces;\n if (this.options.verbosity > 0) {\n console.log(\"# Faces is now \" + faces.length);\n }\n this.stickersperface = faces.length;\n // the faces when rotated don't preserve the vertex order at this\n // point. to improve 3d rendering speed, we would like to preserve\n // vertex order on rotation. First, let's see what rotations preserve\n // the base face; these are the ones we want to work with.\n const simplerot: Quat[] = [];\n const cm = centermassface(firstface);\n for (const rotation of this.rotations) {\n const f = rotation.rotateface(firstface);\n if (cm.dist(centermassface(f)) < eps) {\n simplerot.push(rotation);\n }\n }\n const finished = new Array<boolean>(faces.length);\n const sortme: [number, Quat, number][] = [];\n for (let i = 0; i < faces.length; i++) {\n const cm2 = faces[i].centermass();\n sortme.push([cm.dist(cm2), cm2, i]);\n }\n sortme.sort((a, b) => a[0] - b[0]);\n for (let ii = 0; ii < faces.length; ii++) {\n const i = sortme[ii][2];\n if (!finished[i]) {\n finished[i] = true;\n for (const rot of simplerot) {\n const f2 = faces[i].rotate(rot);\n const cm = f2.centermass();\n for (let kk = ii + 1; kk < faces.length; kk++) {\n if (sortme[kk][0] - sortme[ii][0] > eps) {\n break;\n }\n const k = sortme[kk][2];\n if (!finished[k] && cm.dist(sortme[kk][1]) < eps) {\n finished[k] = true;\n faces[k] = f2;\n break;\n }\n }\n }\n }\n }\n // Find and report the shortest edge in any of the faces. If this\n // is small the puzzle is probably not practical or displayable.\n this.shortedge = 1e99;\n for (const face of faces) {\n for (let j = 0; j < face.length; j++) {\n const k = (j + 1) % face.length;\n const t = face.get(j).dist(face.get(k));\n if (t < this.shortedge) {\n this.shortedge = t;\n }\n }\n }\n if (this.options.verbosity > 0) {\n console.log(\"# Short edge is \" + this.shortedge);\n }\n // add nxnxn cube notation if it has cube face moves\n if (shape === \"c\" && sawface && !sawedge && !sawvertex) {\n // In this case the mapper adding is deferred until we\n // know the number of slices.\n this.addNotationMapper = \"NxNxNCubeMapper\";\n // try to set Reid order of the cubies within an orbit\n this.setReidOrder = true;\n }\n if (shape === \"c\" && sawvertex && !sawface && !sawedge) {\n this.addNotationMapper = \"SkewbMapper\";\n }\n if (shape === \"t\" && (sawvertex || sawface) && !sawedge) {\n this.addNotationMapper = \"PyraminxOrTetraminxMapper\";\n }\n if (shape === \"o\" && sawface) {\n this.notationMapper = new FaceRenamingMapper(\n this.swizzler,\n new FaceNameSwizzler([\"F\", \"D\", \"L\", \"BL\", \"R\", \"U\", \"BR\", \"B\"]),\n );\n if (!sawedge && !sawvertex) {\n this.addNotationMapper = \"FTOMapper\";\n }\n }\n if (shape === \"d\" && sawface) {\n this.addNotationMapper = \"MegaminxMapper\";\n this.notationMapper = new FaceRenamingMapper(\n this.swizzler,\n new FaceNameSwizzler([\n \"U\",\n \"F\",\n \"L\",\n \"BL\",\n \"BR\",\n \"R\",\n \"FR\",\n \"FL\",\n \"DL\",\n \"B\",\n \"DR\",\n \"D\",\n ]),\n );\n }\n }\n\n private keyface(face: Face): string {\n return this.keyface2(face.centermass());\n }\n\n private keyface2(cm: Quat): string {\n // take a face and figure out the sides of each move plane\n let s = \"\";\n const sfcc = String.fromCharCode;\n for (const moveplaneset of this.moveplanesets) {\n if (moveplaneset.length > 0) {\n const dv = cm.dot(moveplaneset[0]);\n let t = 0;\n let b = 1;\n while (b * 2 <= moveplaneset.length) {\n b *= 2;\n }\n for (; b > 0; b >>= 1) {\n if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {\n t += b;\n }\n }\n if (t < 47) {\n s = s + sfcc(33 + t);\n } else if (t < 47 + 47 * 47) {\n s = s + sfcc(33 + 47 + Math.floor(t / 47) - 1) + sfcc(33 + (t % 47));\n } else if (t < 47 + 47 * 47 + 47 * 47 * 47) {\n s =\n s +\n sfcc(33 + 47 + Math.floor((t - 47) / (47 * 47) - 1)) +\n sfcc(33 + 47 + (Math.floor((t - 47) / 47) % 47)) +\n sfcc(33 + (t % 47));\n } else {\n throw Error(\"Too many slices for cubie encoding\");\n }\n }\n }\n return s;\n }\n\n // same as above, but instead of returning an encoded string, return\n // an array with offsets.\n private keyface3(face: Face): number[] {\n const cm = face.centermass();\n // take a face and figure out the sides of each move plane\n const r = [];\n for (const moveplaneset of this.moveplanesets) {\n if (moveplaneset.length > 0) {\n const dv = cm.dot(moveplaneset[0]);\n let t = 0;\n let b = 1;\n while (b * 2 <= moveplaneset.length) {\n b *= 2;\n }\n for (; b > 0; b >>= 1) {\n if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {\n t += b;\n }\n }\n r.push(t);\n }\n }\n return r;\n }\n\n private findface(cm: Quat): number {\n const key = this.keyface2(cm);\n const arr = this.facelisthash.get(key)!;\n if (arr.length === 1) {\n return arr[0];\n }\n for (let i = 0; i + 1 < arr.length; i++) {\n const face2 = this.facelisthash.get(key)![i];\n if (Math.abs(cm.dist(this.facecentermass[face2])) < eps) {\n return face2;\n }\n }\n return arr[arr.length - 1];\n }\n\n private project2d(\n facen: number,\n edgen: number,\n targvec: Quat[],\n ): [Quat, Quat, Quat] {\n // calculate geometry to map a particular edge of a particular\n // face to a given 2D vector. The face is given as an index into the\n // facenames/baseplane arrays, and the edge is given as an offset into\n // the vertices.\n const face = this.facenames[facen][0];\n const edgen2 = (edgen + 1) % face.length;\n const plane = this.baseplanes[facen];\n let x0 = face[edgen2].sub(face[edgen]);\n const olen = x0.len();\n x0 = x0.normalize();\n const y0 = x0.cross(plane).normalize();\n let delta = targvec[1].sub(targvec[0]);\n const len = delta.len() / olen;\n delta = delta.normalize();\n const cosr = delta.b;\n const sinr = delta.c;\n const x1 = x0.smul(cosr).sub(y0.smul(sinr)).smul(len);\n const y1 = y0.smul(cosr).sum(x0.smul(sinr)).smul(len);\n const off = new Quat(\n 0,\n targvec[0].b - x1.dot(face[edgen]),\n targvec[0].c - y1.dot(face[edgen]),\n 0,\n );\n return [x1, y1, off];\n }\n\n public allstickers(): void {\n const t1 = tstart(\"allstickers\");\n // next step is to calculate all the stickers and orbits\n // We do enough work here to display the cube on the screen.\n // take our newly split base face and expand it by the rotation matrix.\n // this generates our full set of \"stickers\".\n this.faces = expandfaces(this.baseplanerot, this.faces);\n if (this.options.verbosity > 0) {\n console.log(\"# Total stickers is now \" + this.faces.length);\n }\n this.facecentermass = new Array(this.faces.length);\n for (let i = 0; i < this.faces.length; i++) {\n this.facecentermass[i] = this.faces[i].centermass();\n }\n // Split moveplanes into a list of parallel planes.\n const moveplanesets: Quat[][] = [];\n const moveplanenormals: Quat[] = [];\n // get the normals, first, from unfiltered moveplanes.\n for (const q of this.moveplanes) {\n const qnormal = q.makenormal();\n let wasseen = false;\n for (const moveplanenormal of moveplanenormals) {\n if (qnormal.sameplane(moveplanenormal.makenormal())) {\n wasseen = true;\n }\n }\n if (!wasseen) {\n moveplanenormals.push(qnormal);\n moveplanesets.push([]);\n }\n }\n for (const q of this.moveplanes2) {\n const qnormal = q.makenormal();\n for (let j = 0; j < moveplanenormals.length; j++) {\n if (qnormal.sameplane(moveplanenormals[j])) {\n moveplanesets[j].push(q);\n break;\n }\n }\n }\n // make the normals all face the same way in each set.\n for (let i = 0; i < moveplanesets.length; i++) {\n const q: Quat[] = moveplanesets[i].map((_) => _.normalizeplane());\n const goodnormal = moveplanenormals[i];\n for (let j = 0; j < q.length; j++) {\n if (q[j].makenormal().dist(goodnormal) > eps) {\n q[j] = q[j].smul(-1);\n }\n }\n q.sort((a, b) => a.a - b.a);\n moveplanesets[i] = q;\n }\n this.moveplanesets = moveplanesets;\n this.moveplanenormals = moveplanenormals;\n const sizes = moveplanesets.map((_) => _.length);\n if (this.options.verbosity > 0) {\n console.log(\"# Move plane sets: \" + sizes);\n }\n // for each of the move planes, find the rotations that are relevant\n const moverotations: Quat[][] = [];\n for (let i = 0; i < moveplanesets.length; i++) {\n moverotations.push([]);\n }\n for (const q of this.rotations) {\n if (Math.abs(Math.abs(q.a) - 1) < eps) {\n continue;\n }\n const qnormal = q.makenormal();\n for (let j = 0; j < moveplanesets.length; j++) {\n if (qnormal.sameplane(moveplanenormals[j])) {\n moverotations[j].push(q);\n break;\n }\n }\n }\n this.moverotations = moverotations;\n // Sort the rotations by the angle of rotation. A bit tricky because\n // while the norms should be the same, they need not be. So we start\n // by making the norms the same, and then sorting.\n for (let i = 0; i < moverotations.length; i++) {\n const r = moverotations[i];\n const goodnormal = r[0].makenormal();\n for (let j = 0; j < r.length; j++) {\n if (goodnormal.dist(r[j].makenormal()) > eps) {\n r[j] = r[j].smul(-1);\n }\n }\n r.sort((a, b) => a.angle() - b.angle());\n if (moverotations[i][0].dot(moveplanenormals[i]) < 0) {\n r.reverse();\n }\n }\n const sizes2 = moverotations.map((_) => 1 + _.length);\n this.movesetorders = sizes2;\n const movesetgeos: [string, string, string, string, number][] = [];\n let gtype = \"?\";\n for (let i = 0; i < moveplanesets.length; i++) {\n const p0 = moveplanenormals[i];\n let neg = null;\n let pos = null;\n for (const geonormal of this.geonormals) {\n const d = p0.dot(geonormal[0]);\n if (Math.abs(d - 1) < eps) {\n pos = [geonormal[1], geonormal[2]];\n gtype = geonormal[2];\n } else if (Math.abs(d + 1) < eps) {\n neg = [geonormal[1], geonormal[2]];\n gtype = geonormal[2];\n }\n }\n if (pos === null || neg === null) {\n throw new Error(\"Saw positive or negative sides as null\");\n }\n movesetgeos.push([\n pos[0],\n pos[1],\n neg[0],\n neg[1],\n 1 + moveplanesets[i].length,\n ]);\n if (this.addNotationMapper === \"NxNxNCubeMapper\" && gtype === \"f\") {\n this.notationMapper = new NxNxNCubeMapper(1 + moveplanesets[i].length);\n this.addNotationMapper = \"\";\n }\n if (\n this.addNotationMapper === \"SkewbMapper\" &&\n moveplanesets[0].length === 1\n ) {\n this.notationMapper = new SkewbNotationMapper(this.swizzler);\n this.addNotationMapper = \"\";\n }\n if (this.addNotationMapper === \"PyraminxOrTetraminxMapper\") {\n if (\n moveplanesets[0].length === 2 &&\n moveplanesets[0][0].a === 0.333333333333333 &&\n moveplanesets[0][1].a === 1.66666666666667\n ) {\n this.notationMapper = new PyraminxNotationMapper(this.swizzler);\n this.addNotationMapper = \"\";\n } else {\n this.notationMapper = new TetraminxNotationMapper(this.swizzler);\n this.addNotationMapper = \"\";\n }\n }\n if (this.addNotationMapper === \"MegaminxMapper\" && gtype === \"f\") {\n if (1 + moveplanesets[i].length === 3) {\n this.notationMapper = new MegaminxScramblingNotationMapper(\n this.notationMapper,\n );\n }\n this.addNotationMapper = \"\";\n }\n if (this.addNotationMapper === \"FTOMapper\" && gtype === \"f\") {\n if (1 + moveplanesets[i].length === 3) {\n this.notationMapper = new FTONotationMapper(\n this.notationMapper,\n this.swizzler,\n );\n }\n this.addNotationMapper = \"\";\n }\n }\n this.movesetgeos = movesetgeos;\n // Cubies are split by move plane sets. For each cubie we can\n // average its points to find a point on the interior of that\n // cubie. We can then check that point against all the move\n // planes and from that derive a coordinate for the cubie.\n // This also works for faces; no face should ever lie on a move\n // plane. This allows us to take a set of stickers and break\n // them up into cubie sets.\n const facelisthash = new Map();\n const faces = this.faces;\n for (let i = 0; i < faces.length; i++) {\n const face = faces[i];\n const s = this.keyface(face);\n if (!facelisthash.get(s)) {\n facelisthash.set(s, [i]);\n } else {\n const arr = facelisthash.get(s)!;\n arr.push(i);\n // If we find a core cubie, split it up into multiple cubies,\n // because ksolve doesn't handle orientations that are not\n // cyclic, and the rotation group of the core is not cyclic.\n if (arr.length === this.baseFaceCount) {\n if (this.options.verbosity > 0) {\n console.log(\"# Splitting core.\");\n }\n for (let suff = 0; suff < arr.length; suff++) {\n const s2 = s + \" \" + suff;\n facelisthash.set(s2, [arr[suff]]);\n }\n }\n }\n }\n this.facelisthash = facelisthash;\n if (this.options.verbosity > 0) {\n console.log(\"# Cubies: \" + facelisthash.size);\n }\n const cubies: number[][] = [];\n const facetocubie = [];\n const facetoord = [];\n for (const facelist of facelisthash.values()) {\n if (facelist.length === this.baseFaceCount) {\n // this is the original \"cubie\" of a split core; we ignore it.\n continue;\n }\n // Sort the faces around each corner so they are counterclockwise. Only\n // relevant for cubies that actually are corners (three or more\n // faces). In general cubies might have many faces; for icosohedrons\n // there are five faces on the corner cubies.\n if (facelist.length > 1) {\n const cm = facelist.map((_: number) => faces[_].centermass());\n const cmall = centermassface(cm);\n for (let looplimit = 0; facelist.length > 2; looplimit++) {\n let changed = false;\n for (let i = 0; i < facelist.length; i++) {\n const j = (i + 1) % facelist.length;\n // var ttt = cmall.dot(cm[i].cross(cm[j])) ; // TODO\n if (cmall.dot(cm[i].cross(cm[j])) < 0) {\n const u = cm[i];\n cm[i] = cm[j];\n cm[j] = u;\n const v = facelist[i];\n facelist[i] = facelist[j];\n facelist[j] = v;\n changed = true;\n }\n }\n if (!changed) {\n break;\n }\n if (looplimit > 1000) {\n throw new Error(\"Bad epsilon math; too close to border\");\n }\n }\n let mini = 0;\n let minf = facelist[mini];\n for (let i = 1; i < facelist.length; i++) {\n const temp = facelist[i];\n if (\n this.faceprecedence[this.getfaceindex(temp)] <\n this.faceprecedence[this.getfaceindex(minf)]\n ) {\n mini = i;\n minf = temp;\n }\n }\n if (mini !== 0) {\n const ofacelist = facelist.slice();\n for (let i = 0; i < facelist.length; i++) {\n facelist[i] = ofacelist[(mini + i) % facelist.length];\n }\n }\n }\n for (let j = 0; j < facelist.length; j++) {\n const k = facelist[j];\n facetocubie[k] = cubies.length;\n facetoord[k] = j;\n }\n cubies.push(facelist);\n }\n this.cubies = cubies;\n this.facetocubie = facetocubie;\n this.facetoord = facetoord;\n // Calculate the orbits of each cubie. Assumes we do all moves.\n // Also calculates which cubies are identical.\n const typenames = [\"?\", \"CENTERS\", \"EDGES\", \"CORNERS\", \"C4RNER\", \"C5RNER\"];\n const cubiesetnames = [];\n const cubietypecounts = [0, 0, 0, 0, 0, 0];\n const orbitoris = [];\n const seen = [];\n let cubiesetnum = 0;\n const cubiesetnums = [];\n const cubieordnums = [];\n const cubieords = [];\n const cubievaluemap = [];\n // Later we will make this smarter to use a get color for face function\n // so we support puzzles with multiple faces the same color\n const getcolorkey = (cubienum: number): string => {\n return cubies[cubienum].map((_) => this.getfaceindex(_)).join(\" \");\n };\n const cubiesetcubies: any = [];\n for (let i = 0; i < cubies.length; i++) {\n if (seen[i]) {\n continue;\n }\n const cubie = cubies[i];\n if (cubie.length === 0) {\n continue;\n }\n const cubiekeymap: any = {};\n let cubievalueid = 0;\n cubieords.push(0);\n cubiesetcubies.push([]);\n const facecnt = cubie.length;\n const typectr = cubietypecounts[facecnt]++;\n let typename = typenames[facecnt];\n if (typename === undefined || facecnt === this.baseFaceCount) {\n typename = \"CORE\";\n }\n typename = typename + (typectr === 0 ? \"\" : typectr + 1);\n cubiesetnames[cubiesetnum] = typename;\n orbitoris[cubiesetnum] = facecnt;\n const queue = [i];\n let qg = 0;\n seen[i] = true;\n while (qg < queue.length) {\n const cind = queue[qg++];\n const cubiecolorkey = getcolorkey(cind);\n if (cubie.length > 1 || cubiekeymap[cubiecolorkey] === undefined) {\n cubiekeymap[cubiecolorkey] = cubievalueid++;\n }\n cubievaluemap[cind] = cubiekeymap[cubiecolorkey];\n cubiesetnums[cind] = cubiesetnum;\n cubiesetcubies[cubiesetnum].push(cind);\n cubieordnums[cind] = cubieords[cubiesetnum]++;\n if (queue.length < this.rotations.length) {\n const cm = this.facecentermass[cubies[cind][0]];\n for (const moverotation of moverotations) {\n const tq =\n this.facetocubie[this.findface(cm.rotatepoint(moverotation[0]))];\n if (!seen[tq]) {\n queue.push(tq);\n seen[tq] = true;\n }\n }\n }\n }\n cubiesetnum++;\n }\n if (\n this.setReidOrder &&\n 4 <= this.stickersperface &&\n this.stickersperface <= 9\n ) {\n const reidorder = [\n [\n \"UF\",\n \"UR\",\n \"UB\",\n \"UL\",\n \"DF\",\n \"DR\",\n \"DB\",\n \"DL\",\n \"FR\",\n \"FL\",\n \"BR\",\n \"BL\",\n ],\n [\"UFR\", \"URB\", \"UBL\", \"ULF\", \"DRF\", \"DFL\", \"DLB\", \"DBR\"],\n [\"U\", \"L\", \"F\", \"R\", \"B\", \"D\"],\n ];\n const reidmap: { [key: number]: number } = {};\n for (const cubie of reidorder) {\n for (let j = 0; j < cubie.length; j++) {\n let mask = 0;\n for (let k = 0; k < cubie[j].length; k++) {\n mask |= 1 << (cubie[j].charCodeAt(k) - 65);\n }\n reidmap[mask] = j;\n }\n }\n for (const cubieset of cubiesetcubies) {\n for (const cubienum of cubieset) {\n let mask = 0;\n for (const cubie of cubies[cubienum]) {\n mask |=\n 1 <<\n (this.facenames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65);\n }\n cubieordnums[cubienum] = reidmap[mask];\n }\n }\n }\n this.cubiesetnums = cubiesetnums;\n this.cubieordnums = cubieordnums;\n this.cubiesetnames = cubiesetnames;\n this.cubieords = cubieords;\n this.orbitoris = orbitoris;\n this.cubievaluemap = cubievaluemap;\n this.cubiesetcubies = cubiesetcubies;\n // if we fix a cubie, find a cubie to fix\n if (this.options.fixedPieceType !== null) {\n for (let i = 0; i < cubies.length; i++) {\n if (\n (this.options.fixedPieceType === \"v\" && cubies[i].length > 2) ||\n (this.options.fixedPieceType === \"e\" && cubies[i].length === 2) ||\n (this.options.fixedPieceType === \"f\" && cubies[i].length === 1)\n ) {\n this.fixedCubie = i;\n break;\n }\n }\n if (this.fixedCubie < 0) {\n throw new Error(\n \"Could not find a cubie of type \" +\n this.options.fixedPieceType +\n \" to fix.\",\n );\n }\n }\n // show the orbits\n if (this.options.verbosity > 0) {\n console.log(\"# Cubie orbit sizes \" + cubieords);\n }\n tend(t1);\n }\n\n public unswizzle(mv: Move): string {\n const newmv = this.notationMapper.notationToInternal(mv);\n if (newmv === null) {\n return \"\";\n }\n return this.swizzler.unswizzle(newmv.family);\n }\n\n // We use an extremely permissive parse here; any character but\n // digits are allowed in a family name.\n private stringToBlockMove(mv: string): Move {\n // parse a move from the command line\n const re = RegExp(\"^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$\");\n const p = mv.match(re);\n if (p === null) {\n throw new Error(\"Bad move passed \" + mv);\n }\n const grip = p[4];\n let loslice = undefined;\n let hislice = undefined;\n if (p[2] !== undefined) {\n if (p[3] === undefined) {\n throw new Error(\"Missing second number in range\");\n }\n loslice = parseInt(p[2], 10);\n }\n if (p[3] !== undefined) {\n hislice = parseInt(p[3], 10);\n }\n let amountstr = \"1\";\n let amount = 1;\n if (p[5] !== undefined) {\n amountstr = p[5];\n if (amountstr[0] === \"'\") {\n amountstr = \"-\" + amountstr.substring(1);\n }\n amount = parseInt(amountstr, 10);\n }\n return new Move(new QuantumMove(grip, hislice, loslice), amount);\n }\n\n public parseMove(\n move: Move,\n ): [string | undefined, number, number, number, boolean, number] {\n const bm = this.notationMapper.notationToInternal(move); // pluggable notation\n if (bm === null) {\n throw new Error(\"Bad move \" + move.family);\n }\n move = bm;\n let grip = move.family;\n let fullrotation = false;\n if (grip.endsWith(\"v\") && grip[0] <= \"Z\") {\n if (move.innerLayer !== undefined || move.outerLayer !== undefined) {\n throw new Error(\"Cannot use a prefix with full cube rotations\");\n }\n grip = grip.slice(0, -1);\n fullrotation = true;\n }\n if (grip.endsWith(\"w\") && grip[0] <= \"Z\") {\n grip = grip.slice(0, -1).toLowerCase();\n }\n let geo;\n let msi = -1;\n const geoname = this.swizzler.unswizzle(grip);\n let firstgrip = false;\n for (let i = 0; i < this.movesetgeos.length; i++) {\n const g = this.movesetgeos[i];\n if (geoname === g[0]) {\n firstgrip = true;\n geo = g;\n msi = i;\n }\n if (geoname === g[2]) {\n firstgrip = false;\n geo = g;\n msi = i;\n }\n }\n let loslice = 1;\n let hislice = 1;\n if (grip.toUpperCase() !== grip) {\n hislice = 2;\n }\n if (geo === undefined) {\n throw new Error(\"Bad grip in move \" + move.family);\n }\n if (move.outerLayer !== undefined) {\n loslice = move.outerLayer;\n }\n if (move.innerLayer !== undefined) {\n if (move.outerLayer === undefined) {\n hislice = move.innerLayer;\n // big assumption here! if outerlayer not specified, but inner\n // layer is (like 2U), we use the case of the family (upper vs\n // lower) to decide if it should be a slice turn or a wide turn.\n if (grip <= \"Z\") {\n // uppercase; slice move\n loslice = hislice;\n } else {\n // lowercase; wide move\n loslice = 1;\n }\n } else {\n hislice = move.innerLayer;\n }\n }\n loslice--;\n hislice--;\n if (fullrotation) {\n loslice = 0;\n hislice = this.moveplanesets[msi].length;\n }\n if (\n loslice < 0 ||\n loslice > this.moveplanesets[msi].length ||\n hislice < 0 ||\n hislice > this.moveplanesets[msi].length\n ) {\n throw new Error(\n \"Bad slice spec \" +\n loslice +\n \" \" +\n hislice +\n \" vs \" +\n this.moveplanesets[msi].length,\n );\n }\n if (\n !permissivieMoveParsing &&\n loslice === 0 &&\n hislice === this.moveplanesets[msi].length &&\n !fullrotation\n ) {\n throw new Error(\n \"! full puzzle rotations must be specified with v suffix.\",\n );\n }\n return [undefined, msi, loslice, hislice, firstgrip, move.amount];\n }\n\n private parsemove(\n mv: string,\n ): [string | undefined, number, number, number, boolean, number] {\n const r = this.parseMove(this.stringToBlockMove(mv));\n r[0] = mv;\n return r;\n }\n\n public genperms(): void {\n const t1 = tstart(\"genperms\");\n // generate permutations for moves\n if (this.cmovesbyslice.length > 0) {\n // did this already?\n return;\n }\n const cmovesbyslice = [];\n // if orientCenters is set, we find all cubies that have only one\n // sticker and that sticker is in the center of a face, and we\n // introduce duplicate stickers so we can orient them properly.\n if (this.options.orientCenters) {\n for (let k = 0; k < this.cubies.length; k++) {\n if (this.cubies[k].length === 1) {\n const kk = this.cubies[k][0];\n const i = this.getfaceindex(kk);\n if (\n this.basefaces[i].centermass().dist(this.facecentermass[kk]) < eps\n ) {\n const o = this.basefaces[i].length;\n for (let m = 1; m < o; m++) {\n this.cubies[k].push(this.cubies[k][m - 1]);\n }\n this.duplicatedFaces[kk] = o;\n this.duplicatedCubies[k] = o;\n this.orbitoris[this.cubiesetnums[k]] = o;\n }\n }\n }\n }\n for (let k = 0; k < this.moveplanesets.length; k++) {\n const moveplaneset = this.moveplanesets[k];\n const slicenum = [];\n const slicecnts = [moveplaneset.length + 1, 0];\n let bhi = 1;\n while (bhi * 2 <= moveplaneset.length) {\n bhi *= 2;\n }\n for (let i = 0; i < this.faces.length; i++) {\n let t = 0;\n if (moveplaneset.length > 0) {\n const dv = this.facecentermass[i].dot(moveplaneset[0]);\n for (let b = bhi; b > 0; b >>= 1) {\n if (\n t + b <= moveplaneset.length &&\n dv > moveplaneset[t + b - 1].a\n ) {\n t += b;\n }\n }\n t = moveplaneset.length - t;\n }\n slicenum.push(t);\n while (slicecnts.length <= t) {\n slicecnts.push(0);\n }\n slicecnts[t]++;\n }\n const axiscmoves = new Array(slicecnts.length);\n for (let sc = 0; sc < slicecnts.length; sc++) {\n axiscmoves[sc] = [];\n }\n const cubiedone = [];\n for (let i = 0; i < this.faces.length; i++) {\n if (slicenum[i] < 0) {\n continue;\n }\n const b = [this.facetocubie[i], this.facetoord[i]];\n let cm = this.facecentermass[i];\n const ocm = cm;\n let fi2 = i;\n const sc = slicenum[fi2];\n for (;;) {\n slicenum[fi2] = -1;\n const cm2 = cm.rotatepoint(this.moverotations[k][0]);\n if (cm2.dist(ocm) < eps) {\n break;\n }\n fi2 = this.findface(cm2);\n b.push(this.facetocubie[fi2], this.facetoord[fi2]);\n cm = cm2;\n }\n // If an oriented center is moving, we need to figure out\n // the appropriate new orientation. Normally we use the cubie\n // sticker identity to locate, but this doesn't work here.\n // Instead we need to redo the geometry of the sticker itself\n // rotating and figure out how that maps to the destination\n // sticker.\n //\n // We only need to do this for central center stickers: those\n // where the face vertex goes through the center. The others\n // don't actually need orientation because they can only be\n // in one orientation by physical constraints. (You can't spin\n // a point or cross sticker on the 5x5x5, for example.)\n //\n // This also simplifies things because it means the actual\n // remapping has the same order as the moves themselves.\n //\n // The center may or may not have been duplicated at this point.\n //\n // The move moving the center might not be the same modulo as the\n // center itself.\n if (\n b.length > 2 &&\n this.options.orientCenters &&\n (this.cubies[b[0]].length === 1 || this.duplicatedCubies[b[0]] > 1)\n ) {\n // is this a real center cubie, around an axis?\n if (\n this.facecentermass[i].dist(\n this.basefaces[this.getfaceindex(i)].centermass(),\n ) < eps\n ) {\n // how does remapping of the face/point set map to the original?\n let face1 = this.faces[this.cubies[b[0]][0]];\n for (let ii = 0; ii < b.length; ii += 2) {\n const face0 = this.faces[this.cubies[b[ii]][0]];\n let o = -1;\n for (let jj = 0; jj < face1.length; jj++) {\n if (face0.get(jj).dist(face1.get(0)) < eps) {\n o = jj;\n break;\n }\n }\n if (o < 0) {\n throw new Error(\n \"Couldn't find rotation of center faces; ignoring for now.\",\n );\n } else {\n b[ii + 1] = o;\n face1 = face1.rotate(this.moverotations[k][0]);\n }\n }\n }\n }\n // b.length == 2 means a sticker is spinning in place.\n // in this case we add duplicate stickers\n // so that we can make it animate properly in a 3D world.\n if (b.length === 2 && this.options.orientCenters) {\n for (let ii = 1; ii < this.movesetorders[k]; ii++) {\n if (sc === 0) {\n b.push(b[0], ii);\n } else {\n b.push(\n b[0],\n (this.movesetorders[k] - ii) % this.movesetorders[k],\n );\n }\n }\n }\n if (b.length > 2 && !cubiedone[b[0]]) {\n if (b.length !== 2 * this.movesetorders[k]) {\n throw new Error(\"Bad length in perm gen\");\n }\n for (const v of b) {\n axiscmoves[sc].push(v);\n }\n }\n for (let j = 0; j < b.length; j += 2) {\n cubiedone[b[j]] = true;\n }\n }\n for (let kk = 0; kk < axiscmoves.length; kk++) {\n axiscmoves[kk] = axiscmoves[kk].slice();\n }\n cmovesbyslice.push(axiscmoves);\n }\n this.cmovesbyslice = cmovesbyslice;\n if (this.options.moveList) {\n const parsedmovelist: [\n string | undefined,\n number,\n number,\n number,\n boolean,\n number,\n ][] = [];\n // make sure the movelist makes sense based on the geos.\n for (const moveString of this.options.moveList) {\n parsedmovelist.push(this.parsemove(moveString));\n }\n this.parsedmovelist = parsedmovelist;\n }\n this.facelisthash.clear();\n this.facecentermass = [];\n tend(t1);\n }\n\n private getboundarygeometry(): any {\n // get the boundary geometry\n return {\n baseplanes: this.baseplanes,\n facenames: this.facenames,\n faceplanes: this.faceplanes,\n vertexnames: this.vertexnames,\n edgenames: this.edgenames,\n geonormals: this.geonormals,\n };\n }\n\n private getmovesets(k: number): any {\n // get the move sets we support based on slices\n // for even values we omit the middle \"slice\". This isn't perfect\n // but it is what we do for now.\n // if there was a move list specified, pull values from that\n const slices = this.moveplanesets[k].length;\n let r: any[] = [];\n if (this.parsedmovelist !== undefined) {\n for (const parsedmove of this.parsedmovelist) {\n if (parsedmove[1] !== k) {\n continue;\n }\n if (parsedmove[4]) {\n r.push([parsedmove[2], parsedmove[3]]);\n } else {\n r.push([slices - parsedmove[3], slices - parsedmove[2]]);\n }\n r.push(parsedmove[5]);\n }\n } else if (this.options.vertexMoves && !this.options.allMoves) {\n const msg = this.movesetgeos[k];\n if (msg[1] !== msg[3]) {\n for (let i = 0; i < slices; i++) {\n if (msg[1] !== \"v\") {\n if (this.options.outerBlockMoves) {\n r.push([i + 1, slices]);\n } else {\n r.push([i + 1]);\n }\n r.push(1);\n } else {\n if (this.options.outerBlockMoves) {\n r.push([0, i]);\n } else {\n r.push([i, i]);\n }\n r.push(1);\n }\n }\n }\n } else {\n for (let i = 0; i <= slices; i++) {\n if (!this.options.allMoves && i + i === slices) {\n continue;\n }\n if (this.options.outerBlockMoves) {\n if (i + i > slices) {\n r.push([i, slices]);\n } else {\n r.push([0, i]);\n }\n } else {\n r.push([i, i]);\n }\n r.push(1);\n }\n }\n if (this.fixedCubie >= 0) {\n const dep = this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[k];\n const newr = [];\n for (let i = 0; i < r.length; i += 2) {\n let o = r[i];\n if (dep >= o[0] && dep <= o[1]) {\n if (o[0] === 0) {\n o = [o[1] + 1, slices];\n } else if (slices === o[1]) {\n o = [0, o[0] - 1];\n } else {\n throw Error(\"fixed cubie option would disconnect move\");\n }\n }\n let found = false;\n for (let j = 0; j < newr.length; j += 2) {\n if (\n newr[j][0] === o[0] &&\n newr[j][1] === o[1] &&\n newr[j + 1] === r[i + 1]\n ) {\n found = true;\n break;\n }\n }\n if (!found) {\n newr.push(o);\n newr.push(r[i + 1]);\n }\n }\n r = newr;\n }\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return r;\n }\n\n private graybyori(cubie: number): boolean {\n let ori = this.cubies[cubie].length;\n if (this.duplicatedCubies[cubie]) {\n ori = 1;\n }\n return (\n (ori === 1 &&\n (this.options.grayCenters || !this.options.includeCenterOrbits)) ||\n (ori === 2 &&\n (this.options.grayEdges || !this.options.includeEdgeOrbits)) ||\n (ori > 2 &&\n (this.options.grayCorners || !this.options.includeCornerOrbits))\n );\n }\n\n private skipbyori(cubie: number): boolean {\n let ori = this.cubies[cubie].length;\n if (this.duplicatedCubies[cubie]) {\n ori = 1;\n }\n return (\n (ori === 1 && !this.options.includeCenterOrbits) ||\n (ori === 2 && !this.options.includeEdgeOrbits) ||\n (ori > 2 && !this.options.includeCornerOrbits)\n );\n }\n\n private skipcubie(fi: number): boolean {\n return this.skipbyori(fi);\n }\n\n private header(comment: string): string {\n return comment + copyright + \"\\n\" + comment + \"\\n\";\n }\n\n public writegap(): string {\n // write out a gap set of generators\n const os = this.getOrbitsDef(false);\n const r = [];\n const mvs = [];\n for (let i = 0; i < os.moveops.length; i++) {\n let movename = \"M_\" + externalName(this.notationMapper, os.movenames[i]);\n let doinv = false;\n if (movename[movename.length - 1] === \"'\") {\n movename = movename.substring(0, movename.length - 1);\n doinv = true;\n }\n // gap doesn't like angle brackets in IDs\n mvs.push(movename);\n if (doinv) {\n r.push(movename + \":=\" + os.moveops[i].toPerm().inv().toGap() + \";\");\n } else {\n r.push(movename + \":=\" + os.moveops[i].toPerm().toGap() + \";\");\n }\n }\n r.push(\"Gen:=[\");\n r.push(mvs.join(\",\"));\n r.push(\"];\");\n const ip = os.solved.identicalPieces();\n r.push(\n \"ip:=[\" +\n ip.map((_) => \"[\" + _.map((__) => __ + 1).join(\",\") + \"]\").join(\",\") +\n \"];\",\n );\n r.push(\"# Size(Group(Gen));\");\n r.push(\"# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));\");\n r.push(\"\");\n return this.header(\"# \") + r.join(\"\\n\");\n }\n\n public writeksolve(name: string = \"PuzzleGeometryPuzzle\"): string {\n const od = this.getOrbitsDef(false);\n return (\n this.header(\"# \") + od.toKsolve(name, this.notationMapper).join(\"\\n\")\n );\n }\n\n public writekpuzzle(\n fortwisty: boolean = true,\n includemoves: boolean = true,\n ): KPuzzleDefinition {\n const od = this.getOrbitsDef(fortwisty, includemoves);\n const r = od.toKPuzzle(includemoves);\n if (!r) {\n throw new Error(\"Missing definition!\");\n }\n r.moveNotation = new PGNotation(this, od);\n return r;\n }\n\n public getMoveFromBits(\n moverange: number[],\n amount: number,\n inverted: boolean,\n axiscmoves: number[][],\n setmoves: number[] | undefined,\n movesetorder: number,\n ): PGTransform {\n const moveorbits: PGOrbit[] = [];\n const perms = [];\n const oris = [];\n for (const len of this.cubieords) {\n perms.push(iota(len));\n oris.push(zeros(len));\n }\n for (let m = moverange[0]; m <= moverange[1]; m++) {\n const slicecmoves = axiscmoves[m];\n for (let j = 0; j < slicecmoves.length; j += 2 * movesetorder) {\n const mperm = slicecmoves.slice(j, j + 2 * movesetorder);\n const setnum = this.cubiesetnums[mperm[0]];\n for (let ii = 0; ii < mperm.length; ii += 2) {\n mperm[ii] = this.cubieordnums[mperm[ii]];\n }\n let inc = 2;\n let oinc = 3;\n if (inverted) {\n inc = mperm.length - 2;\n oinc = mperm.length - 1;\n }\n if (perms[setnum] === iota(this.cubieords[setnum])) {\n perms[setnum] = perms[setnum].slice();\n if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {\n oris[setnum] = oris[setnum].slice();\n }\n }\n for (let ii = 0; ii < mperm.length; ii += 2) {\n perms[setnum][mperm[(ii + inc) % mperm.length]] = mperm[ii];\n if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {\n oris[setnum][mperm[ii]] =\n (mperm[(ii + oinc) % mperm.length] -\n mperm[(ii + 1) % mperm.length] +\n 2 * this.orbitoris[setnum]) %\n this.orbitoris[setnum];\n }\n }\n }\n }\n let lastId = new PGOrbit(iota(24), zeros(24), 1);\n for (let ii = 0; ii < this.cubiesetnames.length; ii++) {\n if (setmoves && !setmoves[ii]) {\n continue;\n }\n if (this.orbitoris[ii] === 1 || this.options.fixedOrientation) {\n if (perms[ii] === iota(lastId.perm.length)) {\n if (perms[ii] !== lastId.perm) {\n lastId = new PGOrbit(perms[ii], oris[ii], 1);\n }\n moveorbits.push(lastId);\n } else {\n moveorbits.push(new PGOrbit(perms[ii], oris[ii], 1));\n }\n } else {\n const no = new Array<number>(oris[ii].length);\n // convert ksolve oris to our internal ori rep\n for (let jj = 0; jj < perms[ii].length; jj++) {\n no[jj] = oris[ii][perms[ii][jj]];\n }\n moveorbits.push(new PGOrbit(perms[ii], no, this.orbitoris[ii]));\n }\n }\n let mv = new PGTransform(moveorbits);\n if (amount !== 1) {\n mv = mv.mulScalar(amount);\n }\n return mv;\n }\n\n private omitSet(name: string): boolean {\n for (const excludedSet of this.options.excludeOrbits) {\n if (excludedSet === name) {\n return true;\n }\n }\n return false;\n }\n\n private diffmvsets(a: any[], b: any[], slices: number, neg: boolean) {\n for (let i = 0; i < a.length; i += 2) {\n let found = false;\n for (let j = 0; !found && j < b.length; j += 2) {\n if (neg) {\n if (\n a[i][0] + b[j][1] === slices &&\n a[i][1] + b[j][0] === slices &&\n a[i + 1] === b[j + 1]\n ) {\n found = true;\n }\n } else {\n if (\n a[i][0] === b[j][0] &&\n a[i][1] === b[j][1] &&\n a[i + 1] === b[j + 1]\n ) {\n found = true;\n }\n }\n }\n if (!found) {\n return true;\n }\n }\n return false;\n }\n\n // TODO: This is only public for testing; can we make it private again?\n public getOrbitsDef(\n fortwisty: boolean,\n includemoves: boolean = true,\n ): PGOrbitsDef {\n // generate a representation of the puzzle\n const setmoves = [];\n if (fortwisty) {\n for (let i = 0; i < this.cubiesetnames.length; i++) {\n setmoves.push(1);\n }\n }\n const setnames: string[] = [];\n const setdefs: PGOrbitDef[] = [];\n // if both a movelist and rotations are needed, eliminate rotations\n // that do not preserve the movelist.\n const mps = [];\n const addrot = [];\n for (let k = 0; k < this.moveplanesets.length; k++) {\n const moveset = this.getmovesets(k);\n mps.push(moveset);\n if (this.options.addRotations) {\n addrot.push(1);\n } else {\n addrot.push(0);\n }\n }\n if (this.options.moveList && this.options.addRotations) {\n for (let i = 0; i < this.moverotations.length; i++) {\n addrot[i] = 0;\n }\n for (let k = 0; k < this.moveplanesets.length; k++) {\n // does a rotation around k preserve the move set?\n for (let i = 0; i < this.moverotations.length; i++) {\n let nn = this.moveplanenormals[k];\n for (let ii = 1; ii * 2 <= this.movesetorders[i]; ii++) {\n nn = nn.rotatepoint(this.moverotations[i][0]);\n if (addrot[i] & ii) {\n continue;\n }\n let found = -1;\n let neg = false;\n for (let j = 0; j < this.moveplanenormals.length; j++) {\n if (nn.dist(this.moveplanenormals[j]) < eps) {\n found = j;\n break;\n } else if (nn.dist(this.moveplanenormals[j].smul(-1)) < eps) {\n found = j;\n neg = true;\n break;\n }\n }\n if (found < 0) {\n throw new Error(\"Could not find rotation\");\n }\n const cmp = mps[found];\n if (\n cmp.length !== mps[k].length ||\n this.moveplanesets[k].length !==\n this.moveplanesets[found].length ||\n this.diffmvsets(\n cmp,\n mps[k],\n this.moveplanesets[found].length,\n neg,\n )\n ) {\n addrot[i] |= ii;\n }\n }\n }\n }\n for (let i = 0; i < this.moverotations.length; i++) {\n if (addrot[i] === 0) {\n addrot[i] = 1;\n } else if (addrot[i] === 1) {\n if (this.movesetorders[i] > 3) {\n addrot[i] = 2;\n } else {\n addrot[i] = 0;\n }\n } else if (addrot[i] === 3) {\n addrot[i] = 0;\n } else {\n throw new Error(\"Impossible addrot val\");\n }\n }\n }\n for (let k = 0; k < this.moveplanesets.length; k++) {\n if (addrot[k] !== 0) {\n mps[k].push([0, this.moveplanesets[k].length]);\n mps[k].push(addrot[k]);\n }\n }\n for (let k = 0; k < this.moveplanesets.length; k++) {\n const moveset = mps[k];\n const movesetorder = this.movesetorders[k];\n // check there's no redundancy in moveset.\n for (let i = 0; i < moveset.length; i += 2) {\n for (let j = 0; j < i; j += 2) {\n if (moveset[i] === moveset[j] && moveset[i + 1] === moveset[j + 1]) {\n throw new Error(\"Redundant moves in moveset.\");\n }\n }\n }\n const allbits = [];\n for (let i = 0; i < moveset.length; i += 2) {\n for (let j = moveset[i][0]; j <= moveset[i][1]; j++) {\n allbits[j] = 1;\n }\n }\n const axiscmoves = this.cmovesbyslice[k];\n for (let i = 0; i < axiscmoves.length; i++) {\n if (allbits[i] !== 1) {\n continue;\n }\n const slicecmoves = axiscmoves[i];\n for (let j = 0; j < slicecmoves.length; j += 2 * movesetorder) {\n if (this.skipcubie(slicecmoves[j])) {\n continue;\n }\n const ind = this.cubiesetnums[slicecmoves[j]];\n setmoves[ind] = 1;\n }\n }\n }\n for (let i = 0; i < this.cubiesetnames.length; i++) {\n if (!setmoves[i]) {\n continue;\n }\n if (this.omitSet(this.cubiesetnames[i])) {\n setmoves[i] = 0;\n continue;\n }\n setnames.push(this.cubiesetnames[i]);\n setdefs.push(\n new PGOrbitDef(\n this.cubieords[i],\n this.options.fixedOrientation ? 1 : this.orbitoris[i],\n ),\n );\n }\n const solved: PGOrbit[] = [];\n for (let i = 0; i < this.cubiesetnames.length; i++) {\n if (!setmoves[i]) {\n continue;\n }\n if (this.omitSet(this.cubiesetnames[i])) {\n continue;\n }\n const p = [];\n const o = [];\n for (let j = 0; j < this.cubieords[i]; j++) {\n if (fortwisty) {\n p.push(j);\n } else {\n const cubie = this.cubiesetcubies[i][j];\n p.push(this.cubievaluemap[cubie]);\n }\n o.push(0);\n }\n solved.push(\n new PGOrbit(\n p,\n o,\n this.options.fixedOrientation ? 1 : this.orbitoris[i],\n ),\n );\n }\n const movenames: string[] = [];\n const moves: PGTransform[] = [];\n if (includemoves) {\n for (let k = 0; k < this.moveplanesets.length; k++) {\n const moveplaneset = this.moveplanesets[k];\n const slices = moveplaneset.length;\n const moveset = mps[k];\n const movesetgeo = this.movesetgeos[k];\n for (let i = 0; i < moveset.length; i += 2) {\n const movebits = moveset[i];\n const mna = getmovename(movesetgeo, movebits, slices);\n const movename = mna[0];\n const inverted = mna[1];\n if (moveset[i + 1] === 1) {\n movenames.push(movename);\n } else {\n movenames.push(movename + moveset[i + 1]);\n }\n const mv = this.getMoveFromBits(\n movebits,\n moveset[i + 1],\n inverted,\n this.cmovesbyslice[k],\n setmoves,\n this.movesetorders[k],\n );\n moves.push(mv);\n }\n }\n }\n let r = new PGOrbitsDef(\n setnames,\n setdefs,\n new VisibleState(solved),\n movenames,\n moves,\n );\n if (this.options.optimizeOrbits) {\n r = r.optimize();\n }\n if (this.options.scrambleAmount !== 0) {\n r.scramble(this.options.scrambleAmount);\n }\n return r;\n }\n\n public getMovesAsPerms(): Perm[] {\n return this.getOrbitsDef(false).moveops.map((_) => _.toPerm());\n }\n\n public showcanon(disp: (s: string) => void): void {\n // show information for canonical move derivation\n showcanon(this.getOrbitsDef(false), disp);\n }\n\n public getsolved(): Perm {\n // get a solved position\n const r = [];\n for (let i = 0; i < this.baseFaceCount; i++) {\n for (let j = 0; j < this.stickersperface; j++) {\n r.push(i);\n }\n }\n return new Perm(r);\n }\n\n // Given a rotation description that says to align feature1\n // with a given vector, and then as much as possible feature2\n // with another given vector, return a Quaternion that\n // performs this rotation.\n private getOrientationRotation(desiredRotation: any[]): Quat {\n const [feature1name, [x1, y1, z1]] = desiredRotation[0];\n const direction1 = new Quat(0, x1, -y1, z1);\n\n const [feature2name, [x2, y2, z2]] = desiredRotation[1];\n const direction2 = new Quat(0, x2, -y2, z2);\n let feature1: Quat | null = null;\n let feature2: Quat | null = null;\n const feature1geoname = this.swizzler.unswizzle(feature1name);\n const feature2geoname = this.swizzler.unswizzle(feature2name);\n for (const gn of this.geonormals) {\n if (feature1geoname === gn[1]) {\n feature1 = gn[0];\n }\n if (feature2geoname === gn[1]) {\n feature2 = gn[0];\n }\n }\n if (!feature1) {\n throw new Error(\"Could not find feature \" + feature1name);\n }\n if (!feature2) {\n throw new Error(\"Could not find feature \" + feature2name);\n }\n const r1 = feature1.pointrotation(direction1);\n const feature2rot = feature2.rotatepoint(r1);\n const r2 = feature2rot\n .unproject(direction1)\n .pointrotation(direction2.unproject(direction1));\n return r2.mul(r1);\n }\n\n private getInitial3DRotation(): Quat {\n const basefacecount = this.baseFaceCount;\n let orientationDescription: FaceBasedOrientationDescription | null = null;\n if (this.options.puzzleOrientation) {\n orientationDescription = this.options.puzzleOrientation;\n } else if (this.options.puzzleOrientations) {\n orientationDescription = this.options.puzzleOrientations[basefacecount];\n }\n // either no option specified or no matching key in\n // puzzleOrientations.\n if (!orientationDescription) {\n orientationDescription = defaultOrientations()[basefacecount];\n }\n if (!orientationDescription) {\n throw new Error(\"No default orientation?\");\n }\n return this.getOrientationRotation(orientationDescription);\n }\n\n private generate2dmapping(\n w: number = 800,\n h: number = 500,\n trim: number = 10,\n threed: boolean = false,\n twodshrink: number = 0.92,\n ): (fn: number, q: Quat) => number[] {\n // generate a mapping to use for 2D for textures, svg\n w -= 2 * trim;\n h -= 2 * trim;\n function extendedges(a: number[][], n: number): void {\n let dx = a[1][0] - a[0][0];\n let dy = a[1][1] - a[0][1];\n const ang = (2 * Math.PI) / n;\n const cosa = Math.cos(ang);\n const sina = Math.sin(ang);\n for (let i = 2; i < n; i++) {\n const ndx = dx * cosa + dy * sina;\n dy = dy * cosa - dx * sina;\n dx = ndx;\n a.push([a[i - 1][0] + dx, a[i - 1][1] + dy]);\n }\n }\n // Find a net from a given face count. Walk it, assuming we locate\n // the first edge from (0,0) to (1,1) and compute the minimum and\n // maximum vertex locations from this. Then do a second walk, and\n // assign the actual geometry.\n this.genperms();\n const boundarygeo = this.getboundarygeometry();\n const face0 = boundarygeo.facenames[0][0];\n const polyn = face0.length; // number of vertices; 3, 4, or 5\n const net = this.net;\n if (net === null) {\n throw new Error(\"No net?\");\n }\n const edges: any = {};\n let minx = 0;\n let miny = 0;\n let maxx = 1;\n let maxy = 0;\n edges[net[0][0]] = [\n [1, 0],\n [0, 0],\n ];\n extendedges(edges[net[0][0]], polyn);\n for (const neti of net) {\n const f0 = neti[0];\n if (!edges[f0]) {\n throw new Error(\"Bad edge description; first edge not connected.\");\n }\n for (let j = 1; j < neti.length; j++) {\n const f1 = neti[j];\n if (f1 === \"\" || edges[f1]) {\n continue;\n }\n edges[f1] = [edges[f0][j % polyn], edges[f0][(j + polyn - 1) % polyn]];\n extendedges(edges[f1], polyn);\n }\n }\n for (const f in edges) {\n const es = edges[f];\n for (const esi of es) {\n minx = Math.min(minx, esi[0]);\n maxx = Math.max(maxx, esi[0]);\n miny = Math.min(miny, esi[1]);\n maxy = Math.max(maxy, esi[1]);\n }\n }\n const sc = Math.min(w / (maxx - minx), h / (maxy - miny));\n const xoff = 0.5 * (w - sc * (maxx + minx));\n const yoff = 0.5 * (h - sc * (maxy + miny));\n const geos: Record<string, Quat[]> = {};\n const bg = this.getboundarygeometry();\n const edges2: any = {};\n const initv = [\n [sc + xoff, yoff],\n [xoff, yoff],\n ];\n edges2[net[0][0]] = initv;\n extendedges(edges2[net[0][0]], polyn);\n geos[this.facenames[0][1]] = this.project2d(0, 0, [\n new Quat(0, initv[0][0], initv[0][1], 0),\n new Quat(0, initv[1][0], initv[1][1], 0),\n ]);\n const connectat = [];\n connectat[0] = 0;\n for (const neti of net) {\n const f0 = neti[0];\n if (!edges2[f0]) {\n throw new Error(\"Bad edge description; first edge not connected.\");\n }\n let gfi = -1;\n for (let j = 0; j < bg.facenames.length; j++) {\n if (f0 === bg.facenames[j][1]) {\n gfi = j;\n break;\n }\n }\n if (gfi < 0) {\n throw new Error(\"Could not find first face name \" + f0);\n }\n const thisface = bg.facenames[gfi][0];\n for (let j = 1; j < neti.length; j++) {\n const f1 = neti[j];\n if (f1 === \"\" || edges2[f1]) {\n continue;\n }\n edges2[f1] = [\n edges2[f0][j % polyn],\n edges2[f0][(j + polyn - 1) % polyn],\n ];\n extendedges(edges2[f1], polyn);\n // what edge are we at?\n const caf0 = connectat[gfi];\n const mp = thisface[(caf0 + j) % polyn]\n .sum(thisface[(caf0 + j + polyn - 1) % polyn])\n .smul(0.5);\n const epi = findelement(bg.edgenames, mp);\n const edgename = bg.edgenames[epi][1];\n const el = splitByFaceNames(edgename, this.facenames);\n const gf1 = el[f0 === el[0] ? 1 : 0];\n let gf1i = -1;\n for (let k = 0; k < bg.facenames.length; k++) {\n if (gf1 === bg.facenames[k][1]) {\n gf1i = k;\n break;\n }\n }\n if (gf1i < 0) {\n throw new Error(\"Could not find second face name\");\n }\n const otherface = bg.facenames[gf1i][0];\n for (let k = 0; k < otherface.length; k++) {\n const mp2 = otherface[k].sum(otherface[(k + 1) % polyn]).smul(0.5);\n if (mp2.dist(mp) <= eps) {\n const p1 = edges2[f0][(j + polyn - 1) % polyn];\n const p2 = edges2[f0][j % polyn];\n connectat[gf1i] = k;\n geos[gf1] = this.project2d(gf1i, k, [\n new Quat(0, p2[0], p2[1], 0),\n new Quat(0, p1[0], p1[1], 0),\n ]);\n break;\n }\n }\n }\n }\n let hix = 0;\n let hiy = 0;\n const rot = this.getInitial3DRotation();\n for (let face of this.faces) {\n if (threed) {\n face = face.rotate(rot);\n }\n for (let j = 0; j < face.length; j++) {\n hix = Math.max(hix, Math.abs(face.get(j).b));\n hiy = Math.max(hiy, Math.abs(face.get(j).c));\n }\n }\n const sc2 = Math.min(h / hiy / 2, (w - trim) / hix / 4);\n const mappt2d = (fn: number, q: Quat): number[] => {\n if (threed) {\n q = q.rotatepoint(rot);\n const xoff2 = 0.5 * trim + 0.25 * w;\n const xmul = this.baseplanes[fn].rotateplane(rot).d < 0 ? 1 : -1;\n return [\n trim + w * 0.5 + xmul * (xoff2 - q.b * sc2),\n trim + h * 0.5 + q.c * sc2,\n ];\n } else {\n const g = geos[this.facenames[fn][1]];\n return [\n trim + twodshrink * q.dot(g[0]) + g[2].b,\n trim + h - twodshrink * q.dot(g[1]) - g[2].c,\n ];\n }\n };\n return mappt2d;\n }\n\n public generatesvg(\n w: number = 800,\n h: number = 500,\n trim: number = 10,\n threed: boolean = false,\n ): string {\n const mappt2d = this.generate2dmapping(w, h, trim, threed);\n function drawedges(id: string, pts: number[][], color: string): string {\n return (\n '<polygon id=\"' +\n id +\n '\" class=\"sticker\" style=\"fill: ' +\n color +\n '\" points=\"' +\n pts.map((p) => p[0] + \" \" + p[1]).join(\" \") +\n '\"/>\\n'\n );\n }\n // Let's build arrays for faster rendering. We want to map from geo\n // base face number to color, and we want to map from geo face number\n // to 2D geometry. These can be reused as long as the puzzle overall\n // orientation and canvas size remains unchanged.\n const pos = this.getsolved();\n const colormap = [];\n const facegeo = [];\n for (let i = 0; i < this.baseFaceCount; i++) {\n colormap[i] = this.colors[this.facenames[i][1]];\n }\n for (let i = 0; i < this.faces.length; i++) {\n const face = this.faces[i];\n const facenum = Math.floor(i / this.stickersperface);\n const fg = [];\n for (let j = 0; j < face.length; j++) {\n fg.push(mappt2d(facenum, face.get(j)));\n }\n facegeo.push(fg);\n }\n const svg = [];\n // group each base face so we can add a hover element\n for (let j = 0; j < this.baseFaceCount; j++) {\n svg.push(\"<g>\");\n svg.push(\"<title>\" + this.facenames[j][1] + \"</title>\\n\");\n for (let ii = 0; ii < this.stickersperface; ii++) {\n const i = j * this.stickersperface + ii;\n const cubie = this.facetocubie[i];\n const cubieori = this.facetoord[i];\n const cubiesetnum = this.cubiesetnums[cubie];\n const cubieord = this.cubieordnums[cubie];\n const color = this.graybyori(cubie) ? \"#808080\" : colormap[pos.p[i]];\n let id =\n this.cubiesetnames[cubiesetnum] + \"-l\" + cubieord + \"-o\" + cubieori;\n svg.push(drawedges(id, facegeo[i], color));\n if (this.duplicatedFaces[i]) {\n for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {\n id = this.cubiesetnames[cubiesetnum] + \"-l\" + cubieord + \"-o\" + jj;\n svg.push(drawedges(id, facegeo[i], color));\n }\n }\n }\n svg.push(\"</g>\");\n }\n const html =\n '<svg id=\"svg\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 800 500\">\\n' +\n '<style type=\"text/css\"><![CDATA[' +\n \".sticker { stroke: #000000; stroke-width: 1px; }\" +\n \"]]></style>\\n\" +\n svg.join(\"\") +\n \"</svg>\";\n return html;\n }\n\n // The colorfrac parameter says how much of the face should be\n // colored (vs dividing lines); we default to 0.77 which seems\n // to work pretty well. It should be a number between probably\n // 0.4 and 0.9.\n public get3d(options?: { stickerColors?: string[] }): StickerDat {\n const stickers = [];\n const rot = this.getInitial3DRotation();\n const faces = [];\n const maxdist: number = 0.52 * this.basefaces[0].get(0).len();\n for (let i = 0; i < this.basefaces.length; i++) {\n const coords = this.basefaces[i].rotate(rot);\n const name = this.facenames[i][1];\n faces.push({ coords: toFaceCoords(coords, maxdist), name });\n }\n for (let i = 0; i < this.faces.length; i++) {\n const facenum = Math.floor(i / this.stickersperface);\n const cubie = this.facetocubie[i];\n const cubieori = this.facetoord[i];\n const cubiesetnum = this.cubiesetnums[cubie];\n const cubieord = this.cubieordnums[cubie];\n let color = this.graybyori(cubie)\n ? \"#808080\"\n : this.colors[this.facenames[facenum][1]];\n if (options?.stickerColors) {\n color = options.stickerColors[i];\n }\n const coords = this.faces[i].rotate(rot);\n stickers.push({\n coords: toFaceCoords(coords, maxdist),\n color,\n orbit: this.cubiesetnames[cubiesetnum],\n ord: cubieord,\n ori: cubieori,\n face: facenum,\n });\n let fcoords = coords;\n if (this.duplicatedFaces[i]) {\n const rotdist = fcoords.length / this.duplicatedFaces[i];\n for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {\n for (let k = 0; k < rotdist; k++) {\n fcoords = fcoords.rotateforward();\n }\n stickers.push({\n coords: toFaceCoords(fcoords, maxdist),\n color,\n orbit: this.cubiesetnames[cubiesetnum],\n ord: cubieord,\n ori: jj,\n face: facenum,\n isDup: true,\n });\n }\n }\n }\n const grips: StickerDatAxis[] = [];\n for (let i = 0; i < this.movesetgeos.length; i++) {\n const msg = this.movesetgeos[i];\n const order = this.movesetorders[i];\n for (const gn of this.geonormals) {\n if (msg[0] === gn[1] && msg[1] === gn[2]) {\n grips.push({\n coordinates: toCoords(gn[0].rotatepoint(rot), 1),\n quantumMove: new Move(msg[0]),\n order,\n });\n grips.push({\n coordinates: toCoords(gn[0].rotatepoint(rot).smul(-1), 1),\n quantumMove: new Move(msg[2]),\n order,\n });\n }\n }\n }\n const twodmapper = this.generate2dmapping(2880, 2160, 0, false, 1.0);\n const g = (function () {\n const irot = rot.invrot();\n return function (facenum: number, coords: number[]): number[] {\n let q = new Quat(\n 0,\n coords[0] * maxdist,\n -coords[1] * maxdist,\n coords[2] * maxdist,\n );\n q = q.rotatepoint(irot);\n const x = twodmapper(facenum, q);\n x[0] /= 2880;\n x[1] = 1 - x[1] / 2160;\n return x;\n };\n })().bind(this);\n return {\n stickers,\n faces,\n axis: grips,\n unswizzle: this.unswizzle.bind(this),\n notationMapper: this.notationMapper,\n textureMapper: { getuv: g },\n };\n }\n\n // From the name of a geometric element (face, vertex, edge), get a\n // normal vector respecting the default orientation. This is useful\n // to define the initial position of the camera in a 3D scene. The\n // return value is normalized, so multiply it by the camera distance.\n // Returns undefined if no such geometric element.\n public getGeoNormal(geoname: string): number[] | undefined {\n const rot = this.getInitial3DRotation();\n const grip = this.swizzler.unswizzle(geoname);\n for (const gn of this.geonormals) {\n if (grip === gn[1]) {\n const r = toCoords(gn[0].rotatepoint(rot), 1);\n // This routine is intended to use for the camera location.\n // If the camera location is vertical, and we give some\n // near-zero values for x and z, then the rotation in the\n // X/Z plane will be somewhat arbitrary. So we clean up the\n // returned vector here. We give a very slight positive\n // z value.\n if (Math.abs(r[0]) < eps && Math.abs(r[2]) < eps) {\n r[0] = 0.0;\n r[2] = 1e-6;\n }\n return r;\n }\n }\n return undefined;\n }\n\n private getfaceindex(facenum: number): number {\n const divid = this.stickersperface;\n return Math.floor(facenum / divid);\n }\n\n public textForTwizzleExplorer(): string {\n return `Faces ${this.baseplanerot.length}\nStickers per face ${this.stickersperface}\nShort edge ${this.shortedge}\nCubies ${this.cubies.length}\nEdge distance ${this.edgedistance}\nVertex distance ${this.vertexdistance}`;\n }\n\n writeSchreierSims(tw: (s: string) => void) {\n const os = this.getOrbitsDef(false);\n const as = os.reassemblySize();\n tw(`Reassembly size is ${as}`);\n const ss = schreierSims(this.getMovesAsPerms(), tw);\n const r = as / ss;\n tw(`Ratio is ${r}`);\n }\n}\n\nclass PGNotation implements MoveNotation {\n private cache: { [key: string]: KTransformation } = {};\n private orbitNames: string[];\n constructor(private pg: PuzzleGeometry, od: PGOrbitsDef) {\n this.orbitNames = od.orbitnames;\n }\n\n public lookupMove(move: Move): KTransformation | undefined {\n const key = this.moveToKeyString(move);\n if (key in this.cache) {\n return this.cache[key];\n }\n const mv = this.pg.parseMove(move);\n // if a move list subset is defined, don't return moves outside the subset.\n if (this.pg.parsedmovelist) {\n let found = false;\n for (const parsedmove of this.pg.parsedmovelist) {\n if (\n parsedmove[1] === mv[1] &&\n parsedmove[2] === mv[2] &&\n parsedmove[3] === mv[3] &&\n parsedmove[4] === mv[4]\n ) {\n found = true;\n }\n }\n if (!found) {\n return undefined;\n }\n }\n let bits = [mv[2], mv[3]];\n if (!mv[4]) {\n const slices = this.pg.moveplanesets[mv[1]].length;\n bits = [slices - mv[3], slices - mv[2]];\n }\n const pgmv = this.pg.getMoveFromBits(\n bits,\n mv[5],\n !mv[4],\n this.pg.cmovesbyslice[mv[1]],\n undefined,\n this.pg.movesetorders[mv[1]],\n );\n const r = PGOrbitsDef.transformToKPuzzle(this.orbitNames, pgmv);\n this.cache[key] = r;\n return r;\n }\n\n // This is only used to construct keys, so does not need to be beautiful.\n private moveToKeyString(move: Move): string {\n let r = \"\";\n if (move.outerLayer) {\n r = r + move.outerLayer + \",\";\n }\n if (move.innerLayer) {\n r = r + move.innerLayer + \",\";\n }\n r = r + move.family + \",\" + move.amount;\n return r;\n }\n}\n", "export {\n getPuzzleDescriptionString,\n getPuzzleGeometryByDesc,\n getPuzzleGeometryByName,\n getPG3DNamedPuzzles,\n parsePuzzleDescription,\n PuzzleGeometry,\n} from \"./PuzzleGeometry\";\nexport type {\n StickerDat,\n StickerDatAxis,\n StickerDatFace,\n StickerDatSticker,\n} from \"./PuzzleGeometry\";\nexport { parseOptions } from \"./Options\";\nexport { Quat } from \"./Quat\";\nexport { schreierSims } from \"./SchreierSims\";\n", "// TODO: Pick a much better name.\nexport class PromiseFreshener<T> {\n #latestAssignedIdx = 0;\n #latestResolvedIdx = 0;\n\n // TODO: reject instead? Drop?\n async queue(\n p: Promise<T>,\n ): Promise<{ fresh: false } | { fresh: true; result: T }> {\n const idx = ++this.#latestAssignedIdx;\n const result = await p;\n if (idx > this.#latestResolvedIdx) {\n this.#latestResolvedIdx = idx;\n return {\n fresh: true,\n result: result,\n };\n } else {\n return { fresh: false };\n }\n }\n}\n\n// This will silenty drop a queued Promise (i.e. not resolve it) if a\n// newer queued one already resolved first. This is useful for classes that want\n// to know the \"latest\" state of something without jumping back to an older\n// value by accident.\n// TODO: Remove this because it's too easy to misuse?\nexport class StaleDropper<T> {\n #latestAssignedIdx = 0;\n #latestResolvedIdx = 0;\n\n queue(p: Promise<T>): Promise<T> {\n // This is a very rare case where we *do* want to drop a Promise sometimes.\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n try {\n const idx = ++this.#latestAssignedIdx;\n const result = await p;\n if (idx > this.#latestResolvedIdx) {\n this.#latestResolvedIdx = idx;\n resolve(result);\n }\n } catch (e) {\n reject(e);\n }\n });\n }\n}\n", "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n\n// TODO: Use private class fields when ESLint support it.\n\nexport class PLazy<T> extends Promise<T> {\n constructor(executor) {\n super((resolve) => {\n resolve();\n });\n\n this._executor = executor;\n }\n\n static from(function_) {\n return new PLazy((resolve) => {\n resolve(function_());\n });\n }\n\n static resolve(value) {\n return new PLazy((resolve) => {\n resolve(value);\n });\n }\n\n static reject(error) {\n return new PLazy((_resolve, reject) => {\n reject(error);\n });\n }\n\n then(onFulfilled, onRejected) {\n this._promise = this._promise || new Promise(this._executor);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this._promise.then(onFulfilled, onRejected);\n }\n\n catch(onRejected) {\n this._promise = this._promise || new Promise(this._executor);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this._promise.catch(onRejected);\n }\n}\n\nexport function from<T>(function_): Promise<T> {\n return new PLazy((resolve) => {\n resolve(function_());\n });\n}\n", "import { from } from \"../../../vendor/p-lazy/p-lazy\";\nimport { StaleDropper } from \"../PromiseFreshener\";\nimport type { UserVisibleErrorTracker } from \"../UserVisibleErrorTracker\";\n\n/*eslint @typescript-eslint/ban-types:off */\ntype InputRecord = {};\n\nexport type InputProps<T extends InputRecord> = {\n [s in keyof T]: TwistyPropParent<T[s]>;\n};\n\ntype InputPromises<T extends InputRecord> = {\n [s in keyof T]: Promise<T[s]>;\n};\n\ninterface SourceEventDetail<OutputType> {\n sourceProp: TwistyPropSource<OutputType, any>;\n value: Promise<OutputType>; // TODO: remove?\n generation: number;\n}\n\ntype SourceEvent<T> = CustomEvent<SourceEventDetail<T>>;\n\ntype PromiseOrValue<T> = T | Promise<T>;\n\n// Values of T must be immutable.\nlet globalSourceGeneration = 0; // This is incremented before being used, so 1 will be the first active value.\nexport abstract class TwistyPropParent<T> {\n public abstract get(): Promise<T>;\n\n // Don't overwrite this. Overwrite `canReuseValue` instead.\n canReuse(v1: T, v2: T): boolean {\n return v1 === v2 || this.canReuseValue(v1, v2);\n }\n\n // Overwrite with a cheap semantic comparison when possible.\n // Note that this is not called if `v1 === v2` (in which case the value is automatically reused).\n canReuseValue(_v1: T, _v2: T): boolean {\n return false;\n }\n\n debugGetChildren(): Array<TwistyPropDerived<any, any>> {\n return Array.from(this.#children.values());\n }\n\n // Propagation\n\n #children: Set<TwistyPropDerived<any, any>> = new Set();\n protected addChild(child: TwistyPropDerived<any, any>): void {\n this.#children.add(child);\n }\n\n protected removeChild(child: TwistyPropDerived<any, any>): void {\n this.#children.delete(child);\n }\n\n protected lastSourceGeneration: number = 0;\n // Synchronously marks all descendants as stale. This doesn't actually\n // literally mark as stale, but it updates the last source generation, which\n // is used to tell if a cahced result is stale.\n protected markStale(sourceEvent: SourceEvent<any>): void {\n if (sourceEvent.detail.generation !== globalSourceGeneration) {\n // The full stale propagation is synchronous, so there should not be a new one yet.\n throw new Error(\"A TwistyProp was marked stale too late!\");\n }\n if (this.lastSourceGeneration === sourceEvent.detail.generation) {\n // Already propagated.\n return;\n }\n this.lastSourceGeneration = sourceEvent.detail.generation;\n for (const child of this.#children) {\n child.markStale(sourceEvent);\n }\n // We schedule sending out events *after* the (synchronous) propagation has happened, in\n // case one of the listeners updates a source again.\n this.#scheduleRawDispatch();\n }\n\n #rawListeners: Set<() => void> = new Set();\n /** @deprecated */\n addRawListener(listener: () => void, options?: { initial: boolean }): void {\n this.#rawListeners.add(listener);\n if (options?.initial) {\n listener(); // TODO: wrap in a try?\n }\n }\n\n /** @deprecated */\n removeRawListener(listener: () => void): void {\n this.#rawListeners.delete(listener);\n }\n\n /** @deprecated */\n #scheduleRawDispatch(): void {\n if (!this.#rawDispatchPending) {\n this.#rawDispatchPending = true;\n setTimeout(() => this.#dispatchRawListeners(), 0);\n }\n }\n\n #rawDispatchPending: boolean = false;\n #dispatchRawListeners(): void {\n if (!this.#rawDispatchPending) {\n throw new Error(\"Invalid dispatch state!\");\n }\n for (const listener of this.#rawListeners) {\n listener(); // TODO: wrap in a try?\n }\n this.#rawDispatchPending = false;\n }\n\n #freshListeners: Map<(value: T) => void, () => void> = new Map();\n // TODO: Pick a better name.\n addFreshListener(listener: (value: T) => void): void {\n const staleDropper: StaleDropper<T> = new StaleDropper<T>();\n let lastResult: T | null = null;\n const callback = async () => {\n const result = await staleDropper.queue(this.get());\n if (lastResult !== null && this.canReuse(lastResult, result)) {\n return;\n }\n lastResult = result;\n listener(result);\n };\n this.#freshListeners.set(listener, callback);\n this.addRawListener(callback, { initial: true });\n }\n\n removeFreshListener(listener: (value: T) => void): void {\n this.removeRawListener(this.#freshListeners.get(listener)!); // TODO: throw a custom error?\n this.#freshListeners.delete(listener);\n }\n}\n\nexport abstract class TwistyPropSource<\n OutputType,\n InputType = OutputType,\n> extends TwistyPropParent<OutputType> {\n #value: Promise<OutputType>;\n\n public abstract getDefaultValue(): PromiseOrValue<OutputType>;\n\n constructor(initialValue?: PromiseOrValue<InputType>) {\n super();\n this.#value = from(() => this.getDefaultValue());\n if (initialValue) {\n this.#value = this.deriveFromPromiseOrValue(initialValue, this.#value);\n }\n }\n\n set(input: PromiseOrValue<InputType>): void {\n this.#value = this.deriveFromPromiseOrValue(input, this.#value);\n\n const sourceEventDetail: SourceEventDetail<OutputType> = {\n sourceProp: this,\n value: this.#value,\n generation: ++globalSourceGeneration,\n };\n this.markStale(\n new CustomEvent<SourceEventDetail<OutputType>>(\"stale\", {\n detail: sourceEventDetail,\n }),\n );\n }\n\n async get(): Promise<OutputType> {\n return this.#value;\n }\n\n async deriveFromPromiseOrValue(\n input: PromiseOrValue<InputType>,\n oldValuePromise: Promise<OutputType>,\n ): Promise<OutputType> {\n return this.derive(await input, oldValuePromise);\n }\n\n // TODO: add an indirect layer to cache the derivation?\n protected abstract derive(\n input: InputType,\n oldValuePromise: Promise<OutputType>,\n ): PromiseOrValue<OutputType>;\n}\n\nexport abstract class SimpleTwistyPropSource<\n SimpleType,\n> extends TwistyPropSource<SimpleType> {\n derive(input: SimpleType): PromiseOrValue<SimpleType> {\n return input;\n }\n}\n\n// TODO: Can we support `null` as a valid output value without loosening type\n// safety?\nexport const NO_VALUE = Symbol(\"no value\");\nexport type NoValueType = typeof NO_VALUE;\n\nexport abstract class TwistyPropDerived<\n InputTypes extends InputRecord,\n OutputType,\n> extends TwistyPropParent<OutputType> {\n // cachedInputs:\n #parents: InputProps<InputTypes>;\n\n constructor(\n parents: InputProps<InputTypes>,\n protected userVisibleErrorTracker?: UserVisibleErrorTracker,\n ) {\n super();\n this.#parents = parents;\n for (const parent of Object.values(parents)) {\n (\n parent as TwistyPropDerived<InputProps<InputTypes>, OutputType>\n ).addChild(this);\n }\n }\n\n #cachedLastSuccessfulCalculation: {\n inputs: InputTypes;\n output: Promise<OutputType>;\n generation: number;\n } | null = null;\n\n #cachedLatestGenerationCalculation: {\n output: Promise<OutputType>;\n generation: number;\n } | null = null;\n\n public async get(): Promise<OutputType> {\n const generation = this.lastSourceGeneration;\n\n if (this.#cachedLatestGenerationCalculation?.generation === generation) {\n return this.#cachedLatestGenerationCalculation.output;\n }\n\n const latestGenerationCalculation = {\n generation,\n output: this.#cacheDerive(\n this.#getParents(),\n generation,\n this.#cachedLastSuccessfulCalculation,\n ),\n };\n this.#cachedLatestGenerationCalculation = latestGenerationCalculation;\n\n this.userVisibleErrorTracker?.reset();\n return latestGenerationCalculation.output;\n }\n\n async #getParents(): Promise<InputTypes> {\n const inputValuePromises: InputPromises<InputRecord> = {} as any; // TODO\n for (const [key, parent] of Object.entries(this.#parents)) {\n (inputValuePromises as Record<string, Promise<unknown>>)[key] = (\n parent as TwistyPropParent<unknown>\n ).get();\n }\n\n const inputs: InputTypes = {} as any; // TODO\n for (const key in this.#parents) {\n inputs[key] = (await (\n inputValuePromises as Record<string, Promise<unknown>>\n )[key]) as any;\n }\n return inputs;\n }\n\n async #cacheDerive(\n inputsPromise: PromiseOrValue<InputTypes>,\n generation: number,\n cachedLatestGenerationCalculation: {\n inputs: InputTypes;\n output: Promise<OutputType>;\n generation: number;\n } | null = null,\n ): Promise<OutputType> {\n const inputs = await inputsPromise;\n\n const cache = (output: OutputType): OutputType => {\n this.#cachedLastSuccessfulCalculation = {\n inputs,\n output: Promise.resolve(output),\n generation,\n };\n return output;\n };\n\n if (!cachedLatestGenerationCalculation) {\n return cache(await this.derive(inputs));\n }\n\n const cachedInputs = cachedLatestGenerationCalculation.inputs;\n for (const key in this.#parents) {\n const parent = this.#parents[key];\n if (!parent.canReuse(inputs[key], cachedInputs[key])) {\n return cache(await this.derive(inputs));\n }\n }\n\n return cachedLatestGenerationCalculation.output;\n }\n\n protected abstract derive(input: InputTypes): PromiseOrValue<OutputType>;\n}\n\nexport class FreshListenerManager {\n #disconnectionFunctions: (() => void)[] = [];\n\n addListener<T>(\n prop: TwistyPropParent<T>,\n listener: (value: T) => void,\n ): void {\n let disconnected = false;\n const wrappedListener = (value: T) => {\n if (disconnected) {\n // TODO\n // console.warn(\"Should be disconnected!\");\n return;\n }\n listener(value);\n };\n\n prop.addFreshListener(wrappedListener);\n\n this.#disconnectionFunctions.push(() => {\n prop.removeFreshListener(wrappedListener);\n disconnected = true;\n });\n }\n\n addMultiListener<U, V>(\n props: [TwistyPropParent<U>, TwistyPropParent<V>],\n listener: (values: [U, V]) => void,\n ) {\n let disconnected = false;\n const wrappedListener = async (_: any) => {\n if (disconnected) {\n // TODO\n // console.warn(\"Should be disconnected!\");\n return;\n }\n // We rely on `TwistyProp` caching to give us the full set of latest\n // values efficiently.\n const promises = (props as TwistyPropParent<any>[]).map((prop) =>\n prop.get(),\n );\n const values = await Promise.all(promises);\n listener(values as any); // TODO: fix up types\n };\n\n for (const prop of props) {\n prop.addFreshListener(wrappedListener);\n }\n\n this.#disconnectionFunctions.push(() => {\n for (const prop of props) {\n prop.removeFreshListener(wrappedListener);\n }\n disconnected = true;\n });\n }\n\n disconnect(): void {\n for (const disconnectionFunction of this.#disconnectionFunctions) {\n disconnectionFunction();\n }\n }\n}\n", "import type { KPuzzleDefinition } from \"../kpuzzle\";\nimport type { PuzzleGeometry } from \"../puzzle-geometry\";\nimport type { PuzzleDescriptionString } from \"../puzzle-geometry/PGPuzzles\";\nimport type { PuzzleLoader } from \"./PuzzleLoader\";\n\n// TODO: modify this to handle TwistyPlayer options\nexport async function descAsyncGetPuzzleGeometry(\n desc: PuzzleDescriptionString,\n): Promise<PuzzleGeometry> {\n const puzzleGeometry = await import(\"../puzzle-geometry\");\n return puzzleGeometry.getPuzzleGeometryByDesc(desc, {\n allMoves: true,\n orientCenters: true,\n addRotations: true,\n });\n}\n\n// TODO: can we cache the puzzleGeometry to avoid duplicate calls, without\n// wasting memory? Maybe just save the latest one for successive calls about the\n// same puzzle?\nexport async function dsecAsyncGetDef(\n desc: PuzzleDescriptionString,\n): Promise<KPuzzleDefinition> {\n return (await descAsyncGetPuzzleGeometry(desc)).writekpuzzle(true);\n}\n\n// TODO: Can we avoid relying on IDs to deduplicate work at higher levels?\nlet nextCustomID = 1;\n\nexport function customPGPuzzleLoader(\n desc: PuzzleDescriptionString,\n info?: {\n fullName?: string;\n inventedBy?: string[];\n inventionYear?: number;\n },\n): PuzzleLoader {\n const customID = nextCustomID++;\n const puzzleLoader: PuzzleLoader = {\n id: `custom-${customID}`,\n fullName: info?.fullName ?? `Custom Puzzle (instance #${customID})`,\n def: async () => {\n return dsecAsyncGetDef(desc);\n },\n svg: async () => {\n const pg = await descAsyncGetPuzzleGeometry(desc);\n return pg.generatesvg();\n },\n pg: async () => {\n return descAsyncGetPuzzleGeometry(desc);\n },\n };\n if (info?.inventedBy) {\n puzzleLoader.inventedBy = info.inventedBy;\n }\n if (info?.inventionYear) {\n puzzleLoader.inventionYear = info.inventionYear;\n }\n return puzzleLoader;\n}\n", "// TODO: figure out where to house this permanently.\n\nimport { Move } from \"../../alg\";\nimport { experimentalIs } from \"../../alg\";\nimport { KPuzzleDefinition, transformationForMove } from \"../../kpuzzle\";\n\nexport type FaceletMeshAppearance =\n | \"regular\"\n | \"dim\"\n | \"oriented\"\n | \"ignored\"\n | \"invisible\";\n\nexport type FaceletAppearance = {\n appearance: FaceletMeshAppearance;\n hintAppearance?: FaceletMeshAppearance;\n};\n\nexport type PieceAppearance = {\n // TODO: foundation?\n facelets: (FaceletMeshAppearance | FaceletAppearance | null)[];\n};\n\nexport type OrbitAppearance = {\n pieces: (PieceAppearance | null)[];\n};\n\nexport type PuzzleAppearance = {\n name?: string; // TODO\n orbits: Record<string, OrbitAppearance>;\n};\n\nexport function getFaceletAppearance(\n appearance: PuzzleAppearance,\n orbitName: string,\n pieceIdx: number,\n faceletIdx: number,\n hint: boolean,\n): FaceletMeshAppearance {\n const orbitAppearance = appearance.orbits[orbitName];\n const pieceAppearance: PieceAppearance | null =\n orbitAppearance.pieces[pieceIdx];\n if (pieceAppearance === null) {\n return regular;\n }\n const faceletAppearance: FaceletMeshAppearance | FaceletAppearance | null =\n pieceAppearance.facelets[faceletIdx];\n if (faceletAppearance === null) {\n return regular;\n }\n if (typeof faceletAppearance === \"string\") {\n return faceletAppearance;\n }\n if (hint) {\n return faceletAppearance.hintAppearance ?? faceletAppearance.appearance;\n }\n return faceletAppearance.appearance;\n}\n\n// TODO: Revert this to a normal enum, or write a standard to codify the names?\nexport enum PieceStickering {\n Regular = \"Regular\",\n Dim = \"Dim\",\n Ignored = \"Ignored\",\n OrientationStickers = \"OrientationStickers\",\n Invisible = \"Invisible\",\n Ignoriented = \"Ignoriented\",\n IgnoreNonPrimary = \"IgnoreNonPrimary\",\n PermuteNonPrimary = \"PermuteNonPrimary\",\n OrientationWithoutPermutation = \"OrientationWithoutPermutation\",\n}\n\nexport class PieceAnnotation<T> {\n stickerings: Map<string, T[]> = new Map();\n constructor(def: KPuzzleDefinition, defaultValue: T) {\n for (const [orbitName, orbitDef] of Object.entries(def.orbits)) {\n this.stickerings.set(\n orbitName,\n new Array(orbitDef.numPieces).fill(defaultValue),\n );\n }\n }\n}\n\nconst regular = \"regular\";\nconst ignored = \"ignored\";\nconst oriented = \"oriented\";\nconst invisible = \"invisible\";\nconst dim = \"dim\";\n\n// regular\nconst r: PieceAppearance = {\n facelets: [regular, regular, regular, regular, regular],\n};\n\n// ignored\nconst i: PieceAppearance = {\n facelets: [ignored, ignored, ignored, ignored, ignored],\n};\n\n// oriented stickers\nconst o: PieceAppearance = {\n facelets: [oriented, oriented, oriented, oriented, oriented],\n};\n\n// invisible\nconst invisiblePiece: PieceAppearance = {\n facelets: [invisible, invisible, invisible, invisible], // TODO: 4th entry is for void cube. Should be handled properly for all stickerings.\n};\n\n// \"OLL\"\nconst riiii: PieceAppearance = {\n facelets: [regular, ignored, ignored, ignored, ignored],\n};\n\n// \"PLL\"\nconst drrrr: PieceAppearance = {\n facelets: [dim, regular, regular, regular, regular],\n};\n\n// ignored\nconst d: PieceAppearance = {\n facelets: [dim, dim, dim, dim, dim],\n};\n\n// \"OLL\"\nconst diiii: PieceAppearance = {\n facelets: [dim, ignored, ignored, ignored, ignored],\n};\n\n// oriented\nconst oiiii: PieceAppearance = {\n facelets: [oriented, ignored, ignored, ignored, ignored],\n};\n\nexport function getPieceAppearance(\n pieceStickering: PieceStickering,\n): PieceAppearance {\n switch (pieceStickering) {\n case PieceStickering.Regular:\n return r;\n case PieceStickering.Dim:\n return d;\n case PieceStickering.Ignored:\n return i;\n case PieceStickering.OrientationStickers: // TODO: Hack for centers. This shouldn't be needed.\n return o;\n case PieceStickering.Invisible: // TODO: Hack for centers. This shouldn't be needed.\n return invisiblePiece;\n case PieceStickering.IgnoreNonPrimary:\n return riiii;\n case PieceStickering.PermuteNonPrimary:\n return drrrr;\n case PieceStickering.Ignoriented:\n return diiii;\n case PieceStickering.OrientationWithoutPermutation:\n return oiiii;\n }\n}\n\nexport class PuzzleStickering extends PieceAnnotation<PieceStickering> {\n constructor(def: KPuzzleDefinition) {\n super(def, PieceStickering.Regular);\n }\n\n set(pieceSet: PieceSet, pieceStickering: PieceStickering): PuzzleStickering {\n for (const [orbitName, pieces] of this.stickerings.entries()) {\n for (let i = 0; i < pieces.length; i++) {\n if (pieceSet.stickerings.get(orbitName)![i]) {\n pieces[i] = pieceStickering;\n }\n }\n }\n return this;\n }\n\n toAppearance(): PuzzleAppearance {\n const appearance: PuzzleAppearance = { orbits: {} };\n for (const [orbitName, pieceStickerings] of this.stickerings.entries()) {\n const pieces: PieceAppearance[] = [];\n const orbitAppearance: OrbitAppearance = {\n pieces,\n };\n appearance.orbits[orbitName] = orbitAppearance;\n for (const pieceStickering of pieceStickerings) {\n pieces.push(getPieceAppearance(pieceStickering));\n }\n }\n return appearance;\n }\n}\n\nexport type PieceSet = PieceAnnotation<boolean>;\n\nexport class StickeringManager {\n constructor(private def: KPuzzleDefinition) {}\n\n and(pieceSets: PieceSet[]): PieceSet {\n const newPieceSet = new PieceAnnotation<boolean>(this.def, false);\n for (const [orbitName, orbitDef] of Object.entries(this.def.orbits)) {\n pieceLoop: for (let i = 0; i < orbitDef.numPieces; i++) {\n newPieceSet.stickerings.get(orbitName)![i] = true;\n for (const pieceSet of pieceSets) {\n if (!pieceSet.stickerings.get(orbitName)![i]) {\n newPieceSet.stickerings.get(orbitName)![i] = false;\n continue pieceLoop;\n }\n }\n }\n }\n return newPieceSet;\n }\n\n or(pieceSets: PieceSet[]): PieceSet {\n // TODO: unify impl with and?\n const newPieceSet = new PieceAnnotation<boolean>(this.def, false);\n for (const [orbitName, orbitDef] of Object.entries(this.def.orbits)) {\n pieceLoop: for (let i = 0; i < orbitDef.numPieces; i++) {\n newPieceSet.stickerings.get(orbitName)![i] = false;\n for (const pieceSet of pieceSets) {\n if (pieceSet.stickerings.get(orbitName)![i]) {\n newPieceSet.stickerings.get(orbitName)![i] = true;\n continue pieceLoop;\n }\n }\n }\n }\n return newPieceSet;\n }\n\n not(pieceSet: PieceSet): PieceSet {\n const newPieceSet = new PieceAnnotation<boolean>(this.def, false);\n for (const [orbitName, orbitDef] of Object.entries(this.def.orbits)) {\n for (let i = 0; i < orbitDef.numPieces; i++) {\n newPieceSet.stickerings.get(orbitName)![i] =\n !pieceSet.stickerings.get(orbitName)![i];\n }\n }\n return newPieceSet;\n }\n\n all(): PieceSet {\n return this.and(this.moves([])); // TODO: are the degenerate cases for and/or the wrong way around\n }\n\n move(moveSource: Move | string): PieceSet {\n const transformation = transformationForMove(\n this.def,\n experimentalIs(moveSource, Move)\n ? (moveSource as Move)\n : Move.fromString(moveSource as string),\n );\n const newPieceSet = new PieceAnnotation<boolean>(this.def, false);\n for (const [orbitName, orbitDef] of Object.entries(this.def.orbits)) {\n for (let i = 0; i < orbitDef.numPieces; i++) {\n if (\n transformation[orbitName].permutation[i] !== i ||\n transformation[orbitName].orientation[i] !== 0\n ) {\n newPieceSet.stickerings.get(orbitName)![i] = true;\n }\n }\n }\n return newPieceSet;\n }\n\n moves(moveSources: (Move | string)[]): PieceSet[] {\n return moveSources.map((moveSource) => this.move(moveSource));\n }\n\n // orbits(orbitNames: string[]): PieceSet {\n // const pieceSet = new PieceAnnotation<boolean>(this.def, false);\n // for (const orbitName of orbitNames) {\n // pieceSet.stickerings.get(orbitName)!.fill(true);\n // }\n // return pieceSet;\n // }\n\n // trueCounts(pieceSet: PieceSet): Record<string, number> {\n // const counts: Record<string, number> = {};\n // for (const [orbitName, orbitDef] of Object.entries(this.def.orbits)) {\n // let count = 0;\n // for (let i = 0; i < orbitDef.numPieces; i++) {\n // if (pieceSet.stickerings.get(orbitName)![i]) {\n // count++;\n // }\n // }\n // counts[orbitName] = count;\n // }\n // return counts;\n // }\n}\n", "import type { TwistyPlayer } from \"../../twisty\";\nimport {\n PieceStickering,\n PuzzleStickering,\n StickeringManager,\n} from \"./appearance\";\n\ntype Stickerer = (\n puzzleStickering: PuzzleStickering,\n m: StickeringManager,\n) => void;\n\nlet globalCustomStickerer: Stickerer = () => {};\n\nfunction setGlobalCustomStickerer(stickerer: Stickerer): void {\n (async () => {\n globalCustomStickerer = stickerer;\n\n const players: TwistyPlayer[] = Array.from(\n document.body.querySelectorAll(\"twisty-player\"),\n );\n console.log(`Setting the custom stickering for ${players.length} players!`);\n const successPromises = [];\n for (const player of players) {\n successPromises.push(\n (async () => {\n const stickering =\n await player.experimentalModel.stickeringProp.get();\n player.experimentalStickering =\n stickering === \"experimental-global-custom-1\"\n ? \"experimental-global-custom-2\"\n : \"experimental-global-custom-1\";\n })(),\n );\n }\n await Promise.all(successPromises);\n console.log(\"Success!\");\n })();\n}\n\nexport function useGlobalCustomStickerer(\n puzzleStickering: PuzzleStickering,\n m: StickeringManager,\n): void {\n globalCustomStickerer(puzzleStickering, m);\n}\n\nif (\n globalThis.location &&\n new URL(location.href).searchParams.get(\"global-custom-stickerer\") === \"true\"\n) {\n (window as any).setGlobalCustomStickerer = setGlobalCustomStickerer;\n (window as any).PieceStickering = PieceStickering;\n console.log(\n \"Global custom stickerer enabled! (using: global-custom-stickerer=true)\",\n );\n console.log(\n \"Look here for inspiration:\",\n \"https://github.com/cubing/cubing.js/blob/81b5cab3e27d8defb39dd1e0a10bc9e8ba894d26/src/cubing/puzzles/stickerings/cube-stickerings.ts#L67\",\n );\n}\n", "import type { ExperimentalStickering } from \"../../twisty\";\nimport type { PuzzleLoader } from \"../PuzzleLoader\";\nimport {\n PuzzleAppearance,\n PuzzleStickering,\n StickeringManager,\n PieceSet,\n PieceStickering,\n} from \"./appearance\";\nimport { useGlobalCustomStickerer } from \"./global-custom-stickering-hack\";\n\n// TODO: cache calculations?\nexport async function cubeAppearance(\n puzzleLoader: PuzzleLoader,\n stickering: ExperimentalStickering,\n): Promise<PuzzleAppearance> {\n const def = await puzzleLoader.def();\n const puzzleStickering = new PuzzleStickering(def);\n const m = new StickeringManager(def);\n\n const LL = (): PieceSet => m.move(\"U\");\n const orUD = (): PieceSet => m.or(m.moves([\"U\", \"D\"]));\n const E = (): PieceSet => m.not(orUD());\n const orLR = (): PieceSet => m.or(m.moves([\"L\", \"R\"]));\n const M = (): PieceSet => m.not(orLR());\n const orFB = (): PieceSet => m.or(m.moves([\"F\", \"B\"]));\n const S = (): PieceSet => m.not(orFB());\n\n const F2L = (): PieceSet => m.not(LL());\n\n const centerU = (): PieceSet => m.and([LL(), M(), S()]);\n\n const edgeFR = (): PieceSet =>\n m.and([m.and(m.moves([\"F\", \"R\"])), m.not(orUD())]);\n const cornerDFR = (): PieceSet => m.and(m.moves([\"D\", \"R\", \"F\"]));\n const slotFR = (): PieceSet => m.or([cornerDFR(), edgeFR()]);\n\n const CENTERS = (): PieceSet =>\n m.or([m.and([M(), E()]), m.and([M(), S()]), m.and([E(), S()])]);\n const EDGES = (): PieceSet =>\n m.or([\n m.and([M(), orUD(), orFB()]),\n m.and([E(), orLR(), orFB()]),\n m.and([S(), orUD(), orLR()]),\n ]);\n const CORNERS = (): PieceSet => m.not(m.or([CENTERS(), EDGES()]));\n const L6E = (): PieceSet => m.or([M(), m.and([LL(), EDGES()])]);\n\n function dimF2L(): void {\n puzzleStickering.set(F2L(), PieceStickering.Dim);\n }\n\n function setPLL(): void {\n puzzleStickering.set(LL(), PieceStickering.PermuteNonPrimary);\n puzzleStickering.set(centerU(), PieceStickering.Dim); // TODO: why is this needed?\n }\n\n function setOLL(): void {\n puzzleStickering.set(LL(), PieceStickering.IgnoreNonPrimary);\n puzzleStickering.set(centerU(), PieceStickering.Regular); // TODO: why is this needed?\n }\n\n function dimOLL(): void {\n puzzleStickering.set(LL(), PieceStickering.Ignoriented);\n puzzleStickering.set(centerU(), PieceStickering.Dim); // TODO: why is this needed?\n }\n\n switch (stickering) {\n case \"full\":\n break;\n case \"PLL\":\n dimF2L();\n setPLL();\n break;\n case \"CLS\":\n dimF2L();\n puzzleStickering.set(\n m.and(m.moves([\"D\", \"R\", \"F\"])),\n PieceStickering.Regular,\n );\n puzzleStickering.set(LL(), PieceStickering.Ignoriented);\n puzzleStickering.set(\n m.and([LL(), CORNERS()]),\n PieceStickering.IgnoreNonPrimary,\n );\n break;\n case \"OLL\":\n dimF2L();\n setOLL();\n break;\n case \"COLL\":\n dimF2L();\n setPLL();\n puzzleStickering.set(m.and([LL(), CORNERS()]), PieceStickering.Regular);\n break;\n case \"OCLL\":\n dimF2L();\n dimOLL();\n puzzleStickering.set(\n m.and([LL(), CORNERS()]),\n PieceStickering.IgnoreNonPrimary,\n );\n break;\n case \"CLL\":\n dimF2L();\n puzzleStickering.set(\n m.not(m.and([CORNERS(), LL()])),\n PieceStickering.Dim,\n );\n break;\n case \"ELL\":\n dimF2L();\n puzzleStickering.set(LL(), PieceStickering.Dim);\n puzzleStickering.set(m.and([LL(), EDGES()]), PieceStickering.Regular);\n break;\n case \"ELS\":\n dimF2L();\n setOLL();\n puzzleStickering.set(m.and([LL(), CORNERS()]), PieceStickering.Ignored);\n puzzleStickering.set(edgeFR(), PieceStickering.Regular);\n puzzleStickering.set(cornerDFR(), PieceStickering.Ignored);\n break;\n case \"LL\":\n dimF2L();\n break;\n case \"F2L\":\n puzzleStickering.set(LL(), PieceStickering.Ignored);\n break;\n case \"ZBLL\":\n dimF2L();\n puzzleStickering.set(LL(), PieceStickering.PermuteNonPrimary);\n puzzleStickering.set(centerU(), PieceStickering.Dim); // why is this needed?\n puzzleStickering.set(m.and([LL(), CORNERS()]), PieceStickering.Regular);\n break;\n case \"ZBLS\":\n dimF2L();\n puzzleStickering.set(slotFR(), PieceStickering.Regular);\n setOLL();\n puzzleStickering.set(m.and([LL(), CORNERS()]), PieceStickering.Ignored);\n break;\n case \"WVLS\":\n // fallthrough\n case \"VLS\":\n dimF2L();\n puzzleStickering.set(slotFR(), PieceStickering.Regular);\n setOLL();\n break;\n case \"LS\":\n dimF2L();\n puzzleStickering.set(slotFR(), PieceStickering.Regular);\n puzzleStickering.set(LL(), PieceStickering.Ignored);\n puzzleStickering.set(centerU(), PieceStickering.Dim);\n break;\n case \"EO\":\n puzzleStickering.set(CORNERS(), PieceStickering.Ignored);\n puzzleStickering.set(\n EDGES(),\n PieceStickering.OrientationWithoutPermutation,\n );\n break;\n case \"EOline\":\n puzzleStickering.set(CORNERS(), PieceStickering.Ignored);\n puzzleStickering.set(\n EDGES(),\n PieceStickering.OrientationWithoutPermutation,\n );\n puzzleStickering.set(m.and(m.moves([\"D\", \"M\"])), PieceStickering.Regular);\n break;\n case \"EOcross\":\n puzzleStickering.set(\n EDGES(),\n PieceStickering.OrientationWithoutPermutation,\n );\n puzzleStickering.set(m.move(\"D\"), PieceStickering.Regular);\n puzzleStickering.set(CORNERS(), PieceStickering.Ignored);\n break;\n case \"CMLL\":\n puzzleStickering.set(F2L(), PieceStickering.Dim);\n puzzleStickering.set(L6E(), PieceStickering.Ignored);\n puzzleStickering.set(m.and([LL(), CORNERS()]), PieceStickering.Regular);\n break;\n case \"L6E\":\n puzzleStickering.set(m.not(L6E()), PieceStickering.Dim);\n break;\n case \"L6EO\":\n puzzleStickering.set(m.not(L6E()), PieceStickering.Dim);\n puzzleStickering.set(\n L6E(),\n PieceStickering.OrientationWithoutPermutation,\n );\n puzzleStickering.set(\n m.and([CENTERS(), orUD()]),\n PieceStickering.OrientationStickers,\n ); // TODO: why is this needed?\n break;\n case \"Daisy\":\n puzzleStickering.set(m.all(), PieceStickering.Ignored);\n puzzleStickering.set(CENTERS(), PieceStickering.Dim);\n puzzleStickering.set(\n m.and([m.move(\"D\"), CENTERS()]),\n PieceStickering.Regular,\n );\n puzzleStickering.set(\n m.and([m.move(\"U\"), EDGES()]),\n PieceStickering.IgnoreNonPrimary,\n );\n break;\n case \"Cross\":\n puzzleStickering.set(m.all(), PieceStickering.Ignored);\n puzzleStickering.set(CENTERS(), PieceStickering.Dim);\n puzzleStickering.set(\n m.and([m.move(\"D\"), CENTERS()]),\n PieceStickering.Regular,\n );\n puzzleStickering.set(\n m.and([m.move(\"D\"), EDGES()]),\n PieceStickering.Regular,\n );\n break;\n case \"2x2x2\":\n puzzleStickering.set(\n m.or(m.moves([\"U\", \"F\", \"R\"])),\n PieceStickering.Ignored,\n );\n puzzleStickering.set(\n m.and([m.or(m.moves([\"U\", \"F\", \"R\"])), CENTERS()]),\n PieceStickering.Dim,\n );\n break;\n case \"2x2x3\":\n puzzleStickering.set(m.all(), PieceStickering.Dim);\n puzzleStickering.set(\n m.or(m.moves([\"U\", \"F\", \"R\"])),\n PieceStickering.Ignored,\n );\n puzzleStickering.set(\n m.and([m.or(m.moves([\"U\", \"F\", \"R\"])), CENTERS()]),\n PieceStickering.Dim,\n );\n puzzleStickering.set(\n m.and([m.move(\"F\"), m.not(m.or(m.moves([\"U\", \"R\"])))]),\n PieceStickering.Regular,\n );\n break;\n case \"Void Cube\":\n puzzleStickering.set(CENTERS(), PieceStickering.Invisible);\n break;\n case \"picture\":\n // fallthrough\n case \"invisible\":\n puzzleStickering.set(m.all(), PieceStickering.Invisible);\n break;\n case \"centers-only\":\n puzzleStickering.set(m.not(CENTERS()), PieceStickering.Ignored);\n break;\n case \"experimental-global-custom-1\":\n // fallthrough\n case \"experimental-global-custom-2\":\n useGlobalCustomStickerer(puzzleStickering, m);\n break;\n default:\n console.warn(\n `Unsupported stickering for ${puzzleLoader.id}: ${stickering}. Setting all pieces to dim.`,\n );\n puzzleStickering.set(m.and(m.moves([])), PieceStickering.Dim);\n }\n return puzzleStickering.toAppearance();\n}\n\nexport async function cubeStickerings(): Promise<ExperimentalStickering[]> {\n return [\n \"full\",\n \"PLL\",\n \"CLS\",\n \"OLL\",\n \"COLL\",\n \"OCLL\",\n \"ELL\",\n \"ELS\",\n \"LL\",\n \"F2L\",\n \"ZBLL\",\n \"ZBLS\",\n \"WVLS\",\n \"VLS\",\n \"LS\",\n \"EO\",\n \"EOline\",\n \"EOcross\",\n \"CMLL\",\n \"L6E\",\n \"L6EO\",\n \"Daisy\",\n \"Cross\",\n \"2x2x2\",\n \"2x2x3\",\n \"Void Cube\",\n \"picture\",\n \"invisible\",\n \"centers-only\",\n \"experimental-global-custom-1\",\n \"experimental-global-custom-2\",\n ];\n}\n", "import type { KPuzzleDefinition } from \"../../kpuzzle\";\nimport type { PuzzleGeometry } from \"../../puzzle-geometry\";\nimport type { PuzzleLoader } from \"../PuzzleLoader\";\nimport {\n cubeAppearance,\n cubeStickerings,\n} from \"../stickerings/cube-stickerings\";\n\n// TODO: modify this to handle TwistyPlayer options\nexport async function asyncGetPuzzleGeometry(\n puzzleName: string,\n): Promise<PuzzleGeometry> {\n const puzzleGeometry = await import(\"../../puzzle-geometry\");\n return puzzleGeometry.getPuzzleGeometryByName(puzzleName, {\n allMoves: true,\n orientCenters: true,\n addRotations: true,\n });\n}\n\n// TODO: can we cache the puzzleGeometry to avoid duplicate calls, without\n// wasting memory? Maybe just save the latest one for successive calls about the\n// same puzzle?\nexport async function asyncGetDef(\n puzzleName: string,\n): Promise<KPuzzleDefinition> {\n return (await asyncGetPuzzleGeometry(puzzleName)).writekpuzzle(true);\n}\n\nexport function genericPGPuzzleLoader(\n id: string,\n fullName: string,\n info?: {\n inventedBy?: string[];\n inventionYear?: number;\n },\n): PuzzleLoader {\n const puzzleLoader: PuzzleLoader = {\n id: id,\n fullName: fullName,\n def: async () => {\n return asyncGetDef(id);\n },\n svg: async () => {\n const pg = await asyncGetPuzzleGeometry(id);\n return pg.generatesvg();\n },\n pg: async () => {\n return asyncGetPuzzleGeometry(id);\n },\n };\n if (info?.inventedBy) {\n puzzleLoader.inventedBy = info.inventedBy;\n }\n if (info?.inventionYear) {\n puzzleLoader.inventionYear = info.inventionYear;\n }\n return puzzleLoader;\n}\n\nexport function cubePGPuzzleLoader(\n id: string,\n fullName: string,\n info?: {\n inventedBy?: string[];\n inventionYear?: number;\n },\n): PuzzleLoader {\n const puzzleLoader: PuzzleLoader = genericPGPuzzleLoader(id, fullName, info);\n puzzleLoader.appearance = cubeAppearance.bind(cubeAppearance, puzzleLoader);\n puzzleLoader.stickerings = cubeStickerings;\n return puzzleLoader;\n}\n", "import type { KPuzzleDefinition } from \"../../../kpuzzle\";\n\nexport const cube2x2x2KPuzzle: KPuzzleDefinition = {\n name: \"2x2x2\",\n orbits: {\n CORNERS: { numPieces: 8, orientations: 3 },\n },\n startPieces: {\n CORNERS: {\n permutation: [0, 1, 2, 3, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n },\n moves: {\n U: {\n CORNERS: {\n permutation: [1, 2, 3, 0, 4, 5, 6, 7],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n },\n y: {\n CORNERS: {\n permutation: [1, 2, 3, 0, 7, 4, 5, 6],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n },\n x: {\n CORNERS: {\n permutation: [4, 0, 3, 5, 7, 6, 2, 1],\n orientation: [2, 1, 2, 1, 1, 2, 1, 2],\n },\n },\n L: {\n CORNERS: {\n permutation: [0, 1, 6, 2, 4, 3, 5, 7],\n orientation: [0, 0, 2, 1, 0, 2, 1, 0],\n },\n },\n F: {\n CORNERS: {\n permutation: [3, 1, 2, 5, 0, 4, 6, 7],\n orientation: [1, 0, 0, 2, 2, 1, 0, 0],\n },\n },\n R: {\n CORNERS: {\n permutation: [4, 0, 2, 3, 7, 5, 6, 1],\n orientation: [2, 1, 0, 0, 1, 0, 0, 2],\n },\n },\n B: {\n CORNERS: {\n permutation: [0, 7, 1, 3, 4, 5, 2, 6],\n orientation: [0, 2, 1, 0, 0, 0, 2, 1],\n },\n },\n D: {\n CORNERS: {\n permutation: [0, 1, 2, 3, 5, 6, 7, 4],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n },\n z: {\n CORNERS: {\n permutation: [3, 2, 6, 5, 0, 4, 7, 1],\n orientation: [1, 2, 1, 2, 2, 1, 2, 1],\n },\n },\n },\n};\n\ncube2x2x2KPuzzle.moves[\"Rv\"] = cube2x2x2KPuzzle.moves[\"x\"];\ncube2x2x2KPuzzle.moves[\"Uv\"] = cube2x2x2KPuzzle.moves[\"y\"];\ncube2x2x2KPuzzle.moves[\"Fv\"] = cube2x2x2KPuzzle.moves[\"z\"];\ncube2x2x2KPuzzle.moves[\"Lv\"] = {\n CORNERS: {\n permutation: [1, 7, 6, 2, 0, 3, 5, 4],\n orientation: [2, 1, 2, 1, 1, 2, 1, 2],\n },\n};\ncube2x2x2KPuzzle.moves[\"Dv\"] = {\n CORNERS: {\n permutation: [3, 0, 1, 2, 5, 6, 7, 4],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0],\n },\n};\ncube2x2x2KPuzzle.moves[\"Bv\"] = {\n CORNERS: {\n permutation: [4, 7, 1, 0, 5, 3, 2, 6],\n orientation: [1, 2, 1, 2, 2, 1, 2, 1],\n },\n};\n", "export default `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n \"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 520 394\" preserveAspectRatio=\"xMidYMid meet\">\n <title>2x2x2</title>\n <defs>\n <g id=\"sticker\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" stroke=\"black\" stroke-width=\"0.04px\" />\n </g>\n </defs>\n <g id=\"puzzle\" transform=\"translate(5, 5) scale(60)\">\n <use id=\"CORNERS-l0-o0\" xlink:href=\"#sticker\" transform=\"translate(3.2, 1)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l0-o1\" xlink:href=\"#sticker\" transform=\"translate(4.4, 2.2)\" style=\"fill: red\"/>\n <use id=\"CORNERS-l0-o2\" xlink:href=\"#sticker\" transform=\"translate(3.2, 2.2)\" style=\"fill: limegreen\"/>\n\n <use id=\"CORNERS-l1-o0\" xlink:href=\"#sticker\" transform=\"translate(3.2, 0)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l1-o1\" xlink:href=\"#sticker\" transform=\"translate(6.6, 2.2)\" style=\"fill: #26f\"/>\n <use id=\"CORNERS-l1-o2\" xlink:href=\"#sticker\" transform=\"translate(5.4, 2.2)\" style=\"fill: red\"/>\n\n <use id=\"CORNERS-l2-o0\" xlink:href=\"#sticker\" transform=\"translate(2.2, 0)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l2-o1\" xlink:href=\"#sticker\" transform=\"translate(0, 2.2)\" style=\"fill: orange\"/>\n <use id=\"CORNERS-l2-o2\" xlink:href=\"#sticker\" transform=\"translate(7.6, 2.2)\" style=\"fill: #26f\"/>\n\n <use id=\"CORNERS-l3-o0\" xlink:href=\"#sticker\" transform=\"translate(2.2, 1)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l3-o1\" xlink:href=\"#sticker\" transform=\"translate(2.2, 2.2)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l3-o2\" xlink:href=\"#sticker\" transform=\"translate(1, 2.2)\" style=\"fill: orange\"/>\n\n <use id=\"CORNERS-l4-o0\" xlink:href=\"#sticker\" transform=\"translate(3.2, 4.4)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l4-o1\" xlink:href=\"#sticker\" transform=\"translate(3.2, 3.2)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l4-o2\" xlink:href=\"#sticker\" transform=\"translate(4.4, 3.2)\" style=\"fill: red\"/>\n\n <use id=\"CORNERS-l5-o0\" xlink:href=\"#sticker\" transform=\"translate(2.2, 4.4)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l5-o1\" xlink:href=\"#sticker\" transform=\"translate(1, 3.2)\" style=\"fill: orange\"/>\n <use id=\"CORNERS-l5-o2\" xlink:href=\"#sticker\" transform=\"translate(2.2, 3.2)\" style=\"fill: limegreen\"/>\n\n <use id=\"CORNERS-l6-o0\" xlink:href=\"#sticker\" transform=\"translate(2.2, 5.4)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l6-o1\" xlink:href=\"#sticker\" transform=\"translate(7.6, 3.2)\" style=\"fill: #26f\"/>\n <use id=\"CORNERS-l6-o2\" xlink:href=\"#sticker\" transform=\"translate(0, 3.2)\" style=\"fill: orange\"/>\n\n <use id=\"CORNERS-l7-o0\" xlink:href=\"#sticker\" transform=\"translate(3.2, 5.4)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l7-o1\" xlink:href=\"#sticker\" transform=\"translate(5.4, 3.2)\" style=\"fill: red\"/>\n <use id=\"CORNERS-l7-o2\" xlink:href=\"#sticker\" transform=\"translate(6.6, 3.2)\" style=\"fill: #26f\"/>\n </g>\n\n</svg>`;\n", "import type { ExperimentalStickering } from \"../../../twisty\";\nimport { asyncGetPuzzleGeometry } from \"../../async/async-pg3d\";\nimport type { PuzzleLoader } from \"../../PuzzleLoader\";\nimport type { PuzzleAppearance } from \"../../stickerings/appearance\";\nimport {\n cubeAppearance,\n cubeStickerings,\n} from \"../../stickerings/cube-stickerings\";\n\nexport const cube2x2x2: PuzzleLoader = {\n id: \"2x2x2\",\n fullName: \"2\u00D72\u00D72 Cube\",\n def: async () => {\n return (await import(\"./2x2x2.kpuzzle.json\")).cube2x2x2KPuzzle;\n },\n svg: async () => {\n return (await import(\"./2x2x2.kpuzzle.svg\")).default;\n },\n pg: async () => {\n return asyncGetPuzzleGeometry(\"2x2x2\");\n },\n appearance: (stickering: ExperimentalStickering): Promise<PuzzleAppearance> =>\n cubeAppearance(cube2x2x2, stickering),\n stickerings: cubeStickerings,\n};\n", "export default `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n \"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 518 392\" preserveAspectRatio=\"xMidYMid meet\">\n <title>3x3x3</title>\n <defs>\n <g id=\"sticker\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" stroke=\"black\" stroke-width=\"0.04px\" />\n </g>\n </defs>\n\n<!-- 0 1 2 3 4 5 6 7 8 9 10 11 -->\n<!-- | | | | | | | | | | | |<- -->\n<!-- 0 - . . . -->\n<!-- 1 - . . . -->\n<!-- 2 - . . . -->\n<!-- 3 - . . . . . . . . . . . . -->\n<!-- 4 - . . . . . . . . . . . . -->\n<!-- 5 - . . . . . . . . . . . . -->\n<!-- 6 - . . . -->\n<!-- 7 - . . . -->\n<!-- 8 - . . . -->\n\n <g id=\"puzzle\" transform=\"translate(5,5) scale(40)\">\n <!-- CORNERS -->\n <use id=\"CORNERS-l0-o0\" xlink:href=\"#sticker\" transform=\"translate(5.3,2.1)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l0-o1\" xlink:href=\"#sticker\" transform=\"translate(6.5,3.3)\" style=\"fill: red\"/>\n <use id=\"CORNERS-l0-o2\" xlink:href=\"#sticker\" transform=\"translate(5.3,3.3)\" style=\"fill: limegreen\"/>\n\n <use id=\"CORNERS-l1-o0\" xlink:href=\"#sticker\" transform=\"translate(5.3,0.1)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l1-o1\" xlink:href=\"#sticker\" transform=\"translate(9.7,3.3)\" style=\"fill: #26f\"/>\n <use id=\"CORNERS-l1-o2\" xlink:href=\"#sticker\" transform=\"translate(8.5,3.3)\" style=\"fill: red\"/>\n\n <use id=\"CORNERS-l2-o0\" xlink:href=\"#sticker\" transform=\"translate(3.3,0.1)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l2-o1\" xlink:href=\"#sticker\" transform=\"translate(0.1,3.3)\" style=\"fill: orange\"/>\n <use id=\"CORNERS-l2-o2\" xlink:href=\"#sticker\" transform=\"translate(11.7,3.3)\" style=\"fill: #26f\"/>\n\n <use id=\"CORNERS-l3-o0\" xlink:href=\"#sticker\" transform=\"translate(3.3,2.1)\" style=\"fill: white\"/>\n <use id=\"CORNERS-l3-o1\" xlink:href=\"#sticker\" transform=\"translate(3.3,3.3)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l3-o2\" xlink:href=\"#sticker\" transform=\"translate(2.1,3.3)\" style=\"fill: orange\"/>\n\n <use id=\"CORNERS-l4-o0\" xlink:href=\"#sticker\" transform=\"translate(5.3,6.5)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l4-o1\" xlink:href=\"#sticker\" transform=\"translate(5.3,5.3)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l4-o2\" xlink:href=\"#sticker\" transform=\"translate(6.5,5.3)\" style=\"fill: red\"/>\n\n <use id=\"CORNERS-l5-o0\" xlink:href=\"#sticker\" transform=\"translate(3.3,6.5)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l5-o1\" xlink:href=\"#sticker\" transform=\"translate(2.1,5.3)\" style=\"fill: orange\"/>\n <use id=\"CORNERS-l5-o2\" xlink:href=\"#sticker\" transform=\"translate(3.3,5.3)\" style=\"fill: limegreen\"/>\n\n <use id=\"CORNERS-l6-o0\" xlink:href=\"#sticker\" transform=\"translate(3.3,8.5)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l6-o1\" xlink:href=\"#sticker\" transform=\"translate(11.7,5.3)\" style=\"fill: #26f\"/>\n <use id=\"CORNERS-l6-o2\" xlink:href=\"#sticker\" transform=\"translate(0.1,5.3)\" style=\"fill: orange\"/>\n\n <use id=\"CORNERS-l7-o0\" xlink:href=\"#sticker\" transform=\"translate(5.3,8.5)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l7-o1\" xlink:href=\"#sticker\" transform=\"translate(8.5,5.3)\" style=\"fill: red\"/>\n <use id=\"CORNERS-l7-o2\" xlink:href=\"#sticker\" transform=\"translate(9.7,5.3)\" style=\"fill: #26f\"/>\n\n <!-- EDGES -->\n <use id=\"EDGES-l0-o0\" xlink:href=\"#sticker\" transform=\"translate(4.3,2.1)\" style=\"fill: white\"/>\n <use id=\"EDGES-l0-o1\" xlink:href=\"#sticker\" transform=\"translate(4.3,3.3)\" style=\"fill: limegreen\"/>\n\n <use id=\"EDGES-l1-o0\" xlink:href=\"#sticker\" transform=\"translate(5.3,1.1)\" style=\"fill: white\"/>\n <use id=\"EDGES-l1-o1\" xlink:href=\"#sticker\" transform=\"translate(7.5,3.3)\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l2-o0\" xlink:href=\"#sticker\" transform=\"translate(4.3,0.1)\" style=\"fill: white\"/>\n <use id=\"EDGES-l2-o1\" xlink:href=\"#sticker\" transform=\"translate(10.7,3.3)\" style=\"fill: #26f\"/>\n\n <use id=\"EDGES-l3-o0\" xlink:href=\"#sticker\" transform=\"translate(3.3,1.1)\" style=\"fill: white\"/>\n <use id=\"EDGES-l3-o1\" xlink:href=\"#sticker\" transform=\"translate(1.1,3.3)\" style=\"fill: orange\"/>\n\n <use id=\"EDGES-l4-o0\" xlink:href=\"#sticker\" transform=\"translate(4.3,6.5)\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l4-o1\" xlink:href=\"#sticker\" transform=\"translate(4.3,5.3)\" style=\"fill: limegreen\"/>\n\n <use id=\"EDGES-l5-o0\" xlink:href=\"#sticker\" transform=\"translate(5.3,7.5)\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l5-o1\" xlink:href=\"#sticker\" transform=\"translate(7.5,5.3)\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l6-o0\" xlink:href=\"#sticker\" transform=\"translate(4.3,8.5)\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l6-o1\" xlink:href=\"#sticker\" transform=\"translate(10.7,5.3)\" style=\"fill: #26f\"/>\n\n <use id=\"EDGES-l7-o0\" xlink:href=\"#sticker\" transform=\"translate(3.3,7.5)\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l7-o1\" xlink:href=\"#sticker\" transform=\"translate(1.1,5.3)\" style=\"fill: orange\"/>\n\n <use id=\"EDGES-l8-o0\" xlink:href=\"#sticker\" transform=\"translate(5.3,4.3)\" style=\"fill: limegreen\"/>\n <use id=\"EDGES-l8-o1\" xlink:href=\"#sticker\" transform=\"translate(6.5,4.3)\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l9-o0\" xlink:href=\"#sticker\" transform=\"translate(3.3,4.3)\" style=\"fill: limegreen\"/>\n <use id=\"EDGES-l9-o1\" xlink:href=\"#sticker\" transform=\"translate(2.1,4.3)\" style=\"fill: orange\"/>\n\n <use id=\"EDGES-l10-o0\" xlink:href=\"#sticker\" transform=\"translate(9.7,4.3)\" style=\"fill: #26f\"/>\n <use id=\"EDGES-l10-o1\" xlink:href=\"#sticker\" transform=\"translate(8.5,4.3)\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l11-o0\" xlink:href=\"#sticker\" transform=\"translate(11.7,4.3)\" style=\"fill: #26f\"/>\n <use id=\"EDGES-l11-o1\" xlink:href=\"#sticker\" transform=\"translate(0.1,4.3)\" style=\"fill: orange\"/>\n\n <!-- CENTERS -->\n <!-- TODO: Allow the same sticker to be reused for multiple orientations -->\n <use id=\"CENTERS-l0-o0\" xlink:href=\"#sticker\" transform=\"translate(4.3,1.1)\" style=\"fill: white\"/>\n <use id=\"CENTERS-l0-o1\" xlink:href=\"#sticker\" transform=\"translate(4.3,1.1)\" style=\"fill: white\"/>\n <use id=\"CENTERS-l0-o2\" xlink:href=\"#sticker\" transform=\"translate(4.3,1.1)\" style=\"fill: white\"/>\n <use id=\"CENTERS-l0-o3\" xlink:href=\"#sticker\" transform=\"translate(4.3,1.1)\" style=\"fill: white\"/>\n\n <use id=\"CENTERS-l1-o0\" xlink:href=\"#sticker\" transform=\"translate(1.1,4.3)\" style=\"fill: orange\"/>\n <use id=\"CENTERS-l1-o1\" xlink:href=\"#sticker\" transform=\"translate(1.1,4.3)\" style=\"fill: orange\"/>\n <use id=\"CENTERS-l1-o2\" xlink:href=\"#sticker\" transform=\"translate(1.1,4.3)\" style=\"fill: orange\"/>\n <use id=\"CENTERS-l1-o3\" xlink:href=\"#sticker\" transform=\"translate(1.1,4.3)\" style=\"fill: orange\"/>\n\n <use id=\"CENTERS-l2-o0\" xlink:href=\"#sticker\" transform=\"translate(4.3,4.3)\" style=\"fill: limegreen\"/>\n <use id=\"CENTERS-l2-o1\" xlink:href=\"#sticker\" transform=\"translate(4.3,4.3)\" style=\"fill: limegreen\"/>\n <use id=\"CENTERS-l2-o2\" xlink:href=\"#sticker\" transform=\"translate(4.3,4.3)\" style=\"fill: limegreen\"/>\n <use id=\"CENTERS-l2-o3\" xlink:href=\"#sticker\" transform=\"translate(4.3,4.3)\" style=\"fill: limegreen\"/>\n\n <use id=\"CENTERS-l3-o0\" xlink:href=\"#sticker\" transform=\"translate(7.5,4.3)\" style=\"fill: red\"/>\n <use id=\"CENTERS-l3-o1\" xlink:href=\"#sticker\" transform=\"translate(7.5,4.3)\" style=\"fill: red\"/>\n <use id=\"CENTERS-l3-o2\" xlink:href=\"#sticker\" transform=\"translate(7.5,4.3)\" style=\"fill: red\"/>\n <use id=\"CENTERS-l3-o3\" xlink:href=\"#sticker\" transform=\"translate(7.5,4.3)\" style=\"fill: red\"/>\n\n <use id=\"CENTERS-l4-o0\" xlink:href=\"#sticker\" transform=\"translate(10.7,4.3)\" style=\"fill: #26f\"/>\n <use id=\"CENTERS-l4-o1\" xlink:href=\"#sticker\" transform=\"translate(10.7,4.3)\" style=\"fill: #26f\"/>\n <use id=\"CENTERS-l4-o2\" xlink:href=\"#sticker\" transform=\"translate(10.7,4.3)\" style=\"fill: #26f\"/>\n <use id=\"CENTERS-l4-o3\" xlink:href=\"#sticker\" transform=\"translate(10.7,4.3)\" style=\"fill: #26f\"/>\n\n <use id=\"CENTERS-l5-o0\" xlink:href=\"#sticker\" transform=\"translate(4.3,7.5)\" style=\"fill: yellow\"/>\n <use id=\"CENTERS-l5-o1\" xlink:href=\"#sticker\" transform=\"translate(4.3,7.5)\" style=\"fill: yellow\"/>\n <use id=\"CENTERS-l5-o2\" xlink:href=\"#sticker\" transform=\"translate(4.3,7.5)\" style=\"fill: yellow\"/>\n <use id=\"CENTERS-l5-o3\" xlink:href=\"#sticker\" transform=\"translate(4.3,7.5)\" style=\"fill: yellow\"/>\n </g>\n\n</svg>`;\n", "export default `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"288px\" height=\"288px\" viewBox=\"-16 -16 288 288\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <title>3x3x3 LL</title>\n <defs>\n <g id=\"sticker\">\n <rect x=\"-10\" y=\"-10\" width=\"1\" height=\"1\" stroke=\"black\" stroke-width=\"0.04px\" />\n </g>\n </defs>\n <g id=\"3x3x3-LL\" stroke=\"none\" stroke-width=\"4\" style=\"none\" stroke-linejoin=\"round\">\n <rect id=\"CENTERS-l0-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"96\" y=\"96\" width=\"64\" height=\"64\"></rect>\n <rect id=\"CENTERS-l0-o1\" stroke=\"#000000\" style=\"fill: white\" x=\"96\" y=\"96\" width=\"64\" height=\"64\"></rect>\n <rect id=\"CENTERS-l0-o2\" stroke=\"#000000\" style=\"fill: white\" x=\"96\" y=\"96\" width=\"64\" height=\"64\"></rect>\n <rect id=\"CENTERS-l0-o3\" stroke=\"#000000\" style=\"fill: white\" x=\"96\" y=\"96\" width=\"64\" height=\"64\"></rect>\n\n <rect id=\"CORNERS-l0-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"160\" y=\"160\" width=\"64\" height=\"64\"></rect>\n <polygon id=\"CORNERS-l0-o1\" stroke=\"#000000\" style=\"fill: red\" points=\"224 160 252 160 252 252 224 224\"></polygon>\n <polygon id=\"CORNERS-l0-o2\" stroke=\"#000000\" style=\"fill: limegreen\" transform=\"translate(206, 238) scale(1, -1) rotate(-90) translate(-206, -238) \" points=\"192 192 220 192 220 284 192 256\"></polygon>\n <rect id=\"CORNERS-l1-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"160\" y=\"32\" width=\"64\" height=\"64\"></rect>\n <polygon id=\"CORNERS-l1-o1\" stroke=\"#000000\" style=\"fill: #26f\" transform=\"translate(206, 18) rotate(-90) translate(-206, -18) \" points=\"192 -28 220 -28 220 64 192 36\"></polygon>\n <polygon id=\"CORNERS-l1-o2\" stroke=\"#000000\" style=\"fill: red\" transform=\"translate(238, 50) scale(1, -1) translate(-238, -50) \" points=\"224 4 252 4 252 96 224 68\"></polygon>\n <rect id=\"CORNERS-l2-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"32\" y=\"32\" width=\"64\" height=\"64\"></rect>\n <polygon id=\"CORNERS-l2-o1\" stroke=\"#000000\" style=\"fill: orange\" transform=\"translate(18, 50) scale(-1, -1) translate(-18, -50) \" points=\"4 4 32 4 32 96 4 68\"></polygon>\n <polygon id=\"CORNERS-l2-o2\" stroke=\"#000000\" style=\"fill: #26f\" transform=\"translate(50, 18) scale(1, -1) rotate(90) translate(-50, -18) \" points=\"36 -28 64 -28 64 64 36 36\"></polygon>\n <rect id=\"CORNERS-l3-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"32\" y=\"160\" width=\"64\" height=\"64\"></rect>\n <polygon id=\"CORNERS-l3-o1\" stroke=\"#000000\" style=\"fill: limegreen\" transform=\"translate(50, 238) rotate(90) translate(-50, -238) \" points=\"36 192 64 192 64 284 36 256\"></polygon>\n <polygon id=\"CORNERS-l3-o2\" stroke=\"#000000\" style=\"fill: orange\" transform=\"translate(18, 206) scale(-1, 1) translate(-18, -206) \" points=\"4 160 32 160 32 252 4 224\"></polygon>\n\n <rect id=\"EDGES-l0-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"96\" y=\"160\" width=\"64\" height=\"64\"></rect>\n <rect id=\"EDGES-l0-o1\" stroke=\"#000000\" style=\"fill: limegreen\" transform=\"translate(128, 238) scale(1, -1) rotate(90) translate(-128, -238) \" x=\"114\" y=\"206\" width=\"28\" height=\"64\"></rect>\n <rect id=\"EDGES-l1-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"160\" y=\"96\" width=\"64\" height=\"64\"></rect>\n <rect id=\"EDGES-l1-o1\" stroke=\"#000000\" style=\"fill: red\" x=\"224\" y=\"96\" width=\"28\" height=\"64\"></rect>\n <rect id=\"EDGES-l2-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"96\" y=\"32\" width=\"64\" height=\"64\"></rect>\n <rect id=\"EDGES-l2-o1\" stroke=\"#000000\" style=\"fill: #26f\" transform=\"translate(128, 18) scale(1, -1) rotate(90) translate(-128, -18) \" x=\"114\" y=\"-14\" width=\"28\" height=\"64\"></rect>\n <rect id=\"EDGES-l3-o0\" stroke=\"#000000\" style=\"fill: white\" x=\"32\" y=\"96\" width=\"64\" height=\"64\"></rect>\n <rect id=\"EDGES-l3-o1\" stroke=\"#000000\" style=\"fill: orange\" x=\"4\" y=\"96\" width=\"28\" height=\"64\"></rect>\n\n </g>\n <g style=\"opacity: 0\">\n <!-- CORNERS -->\n <use id=\"CORNERS-l4-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l4-o1\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l4-o2\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n\n <use id=\"CORNERS-l5-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l5-o1\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n <use id=\"CORNERS-l5-o2\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n\n <use id=\"CORNERS-l6-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l6-o1\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n <use id=\"CORNERS-l6-o2\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n\n <use id=\"CORNERS-l7-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l7-o1\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n <use id=\"CORNERS-l7-o2\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n\n <!-- EDGES -->\n <use id=\"EDGES-l4-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l4-o1\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n\n <use id=\"EDGES-l5-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l5-o1\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l6-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l6-o1\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n\n <use id=\"EDGES-l7-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l7-o1\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n\n <use id=\"EDGES-l8-o0\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n <use id=\"EDGES-l8-o1\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l9-o0\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n <use id=\"EDGES-l9-o1\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n\n <use id=\"EDGES-l10-o0\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n <use id=\"EDGES-l10-o1\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l11-o0\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n <use id=\"EDGES-l11-o1\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n\n <!-- CENTERS -->\n <!-- TODO: Allow the same sticker to be reused for multiple orientations -->\n <use id=\"CENTERS-l1-o0\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n <use id=\"CENTERS-l1-o1\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n <use id=\"CENTERS-l1-o2\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n <use id=\"CENTERS-l1-o3\" xlink:href=\"#sticker\" style=\"fill: orange\"/>\n\n <use id=\"CENTERS-l2-o0\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n <use id=\"CENTERS-l2-o1\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n <use id=\"CENTERS-l2-o2\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n <use id=\"CENTERS-l2-o3\" xlink:href=\"#sticker\" style=\"fill: limegreen\"/>\n\n <use id=\"CENTERS-l3-o0\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n <use id=\"CENTERS-l3-o1\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n <use id=\"CENTERS-l3-o2\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n <use id=\"CENTERS-l3-o3\" xlink:href=\"#sticker\" style=\"fill: red\"/>\n\n <use id=\"CENTERS-l4-o0\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n <use id=\"CENTERS-l4-o1\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n <use id=\"CENTERS-l4-o2\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n <use id=\"CENTERS-l4-o3\" xlink:href=\"#sticker\" style=\"fill: #26f\"/>\n\n <use id=\"CENTERS-l5-o0\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"CENTERS-l5-o1\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"CENTERS-l5-o2\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n <use id=\"CENTERS-l5-o3\" xlink:href=\"#sticker\" style=\"fill: yellow\"/>\n </g>\n</svg>`;\n", "// Include 3x3x3 in the main bundle for better performance.\nimport { experimentalCube3x3x3KPuzzle as cube3x3x3KPuzzle } from \"../../../kpuzzle\";\nimport type { ExperimentalStickering } from \"../../../twisty\";\nimport { asyncGetPuzzleGeometry } from \"../../async/async-pg3d\";\nimport type { PuzzleLoader } from \"../../PuzzleLoader\";\nimport type { PuzzleAppearance } from \"../../stickerings/appearance\";\nimport {\n cubeAppearance,\n cubeStickerings,\n} from \"../../stickerings/cube-stickerings\";\n\nexport const cube3x3x3: PuzzleLoader = {\n id: \"3x3x3\",\n fullName: \"3\u00D73\u00D73 Cube\",\n inventedBy: [\"Ern\u0151 Rubik\"],\n inventionYear: 1974, // https://en.wikipedia.org/wiki/Rubik%27s_Cube#Conception_and_development\n def: async () => {\n // return await import(\"./3x3x3.kpuzzle.json\");\n return cube3x3x3KPuzzle;\n },\n svg: async () => {\n return (await import(\"./3x3x3.kpuzzle.svg\")).default;\n },\n llSVG: async () => {\n return (await import(\"./3x3x3-ll.kpuzzle.svg\")).default;\n },\n pg: async () => {\n return asyncGetPuzzleGeometry(\"3x3x3\");\n },\n appearance: (stickering: ExperimentalStickering): Promise<PuzzleAppearance> =>\n cubeAppearance(cube3x3x3, stickering),\n stickerings: cubeStickerings,\n};\n", "import type { KPuzzleDefinition } from \"../../../kpuzzle\";\n\nexport const clockKPuzzle: KPuzzleDefinition = {\n name: \"Clock\",\n orbits: {\n DIALS: { numPieces: 18, orientations: 12 },\n FACES: { numPieces: 18, orientations: 1 },\n FRAME: { numPieces: 1, orientations: 2 },\n },\n startPieces: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n moves: {\n UR_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 1, 1, 0, 1, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n DR_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n DL_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n UL_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n U_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [1, 1, 1, 1, 1, 1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n R_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 1, 1, 0, 1, 1, 0, 1, 1, -1, 0, 0, 0, 0, 0, -1, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n D_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, -1, 0, -1],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n L_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n ALL_PLUS_: {\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 0, -1, 0, 0, 0, -1, 0, -1],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n y2: {\n DIALS: {\n permutation: [\n 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [1] },\n },\n UL: {\n // TODO: define \"pin up\" as something other than a normal move.\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n UR: {\n // TODO: define \"pin up\" as something other than a normal move.\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n DL: {\n // TODO: define \"pin up\" as something other than a normal move.\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n DR: {\n // TODO: define \"pin up\" as something other than a normal move.\n DIALS: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FACES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n ],\n orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n },\n FRAME: { permutation: [0], orientation: [0] },\n },\n },\n};\n", "export default `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 480 240\" preserveAspectRatio=\"xMidYMid meet\">\n <title>clock</title>\n <defs>\n <g id=\"hand\" transform=\"translate(-20, -20)\">\n <path d=\"M19.9995197,2.22079449 L23.8791657,19.0203611 C23.9580836,19.3338406 24,19.6620253 24,20 C24,22.209139 22.209139,24 20,24 C17.790861,24 16,22.209139 16,20 C16,19.6620253 16.0419164,19.3338406 16.1208343,19.0203611 L19.9995197,2.22079449 Z\"></path>\n </g>\n <g id=\"cardinal_hours\" style=\"fill: #FFFFFF\">\n <circle cx=\"0\" cy=\"24\" r=\"2\"></circle>\n <circle cx=\"-24\" cy=\"0\" r=\"2\"></circle>\n <circle cx=\"24\" cy=\"0\" r=\"2\"></circle>\n <circle cx=\"0\" cy=\"-24\" r=\"2\"></circle>\n </g>\n <g id=\"face_hours\">\n <g>\n <use xlink:href=\"#cardinal_hours\"/>\n </g>\n <g transform=\"rotate(30)\">\n <use xlink:href=\"#cardinal_hours\"/>\n </g>\n <g transform=\"rotate(60)\">\n <use xlink:href=\"#cardinal_hours\"/>\n </g>\n </g>\n <g id=\"pegs\" stroke=\"#000000\" style=\"fill: #FFD000\">\n <circle id=\"PEG4\" cx=\"90\" cy=\"90\" r=\"10\"></circle>\n <circle id=\"PEG3\" cx=\"30\" cy=\"90\" r=\"10\"></circle>\n <circle id=\"PEG2\" cx=\"90\" cy=\"30\" r=\"10\"></circle>\n <circle id=\"PEG1\" cx=\"30\" cy=\"30\" r=\"10\"></circle>\n </g>\n <g id=\"frame\" transform=\"translate(-24, -24)\">\n <path stroke=\"#000000\" d=\"M120,20 C137.495665,20 153.941932,24.4930026 168.247913,32.3881183 C171.855881,30.8514056 175.828512,30 180,30 C196.568542,30 210,43.4314575 210,60 C210,64.1714878 209.148594,68.1441192 207.610077,71.7536009 C215.506997,86.0580678 220,102.504335 220,120 C220,137.495665 215.506997,153.941932 207.611882,168.247913 C209.148594,171.855881 210,175.828512 210,180 C210,196.568542 196.568542,210 180,210 C175.828512,210 171.855881,209.148594 168.246399,207.610077 C153.941932,215.506997 137.495665,220 120,220 C102.504335,220 86.0580678,215.506997 71.7520869,207.611882 C68.1441192,209.148594 64.1714878,210 60,210 C43.4314575,210 30,196.568542 30,180 C30,175.828512 30.8514056,171.855881 32.3899234,168.246399 C24.4930026,153.941932 20,137.495665 20,120 C20,102.504335 24.4930026,86.0580678 32.3881183,71.7520869 C30.8514056,68.1441192 30,64.1714878 30,60 C30,43.4314575 43.4314575,30 60,30 C64.1714878,30 68.1441192,30.8514056 71.7536009,32.3899234 C86.0580678,24.4930026 102.504335,20 120,20 Z\"></path>\n </g>\n </defs>\n <g>\n <g transform=\"translate(24, 24)\">\n <use xlink:href=\"#frame\" id=\"FRAME-l0-o0\" style=\"fill: #0C5093\"/>\n <use xlink:href=\"#pegs\" transform=\"translate(36, 36)\"/>\n <g transform=\"translate(36, 36)\">\n <circle id=\"FACES-l0-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l0-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l0-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l0-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(96, 36)\">\n <circle id=\"FACES-l1-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l1-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l1-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l1-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(156, 36)\">\n <circle id=\"FACES-l2-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l2-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l2-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l2-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(36, 96)\">\n <circle id=\"FACES-l3-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l3-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l3-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l3-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(96, 96)\">\n <circle id=\"FACES-l4-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l4-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l4-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l4-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(156, 96)\">\n <circle id=\"FACES-l5-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l5-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l5-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l5-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(36, 156)\">\n <circle id=\"FACES-l6-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l6-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l6-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l6-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(96, 156)\">\n <circle id=\"FACES-l7-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l7-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l7-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l7-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(156, 156)\">\n <circle id=\"FACES-l8-o0\" stroke=\"#000000\" style=\"fill: #90B8DF\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l8-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l8-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l8-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n </g>\n <g transform=\"translate(264, 24)\">\n <use xlink:href=\"#frame\" id=\"FRAME-l0-o1\" style=\"fill: #90B8DF\"/>\n <use xlink:href=\"#pegs\" transform=\"translate(36, 36)\"/>\n <g transform=\"translate(36, 36)\">\n <circle id=\"FACES-l9-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l9-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l9-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l9-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(96, 36)\">\n <circle id=\"FACES-l10-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l10-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l10-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l10-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(156, 36)\">\n <circle id=\"FACES-l11-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l11-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l11-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l11-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(36, 96)\">\n <circle id=\"FACES-l12-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l12-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l12-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l12-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(96, 96)\">\n <circle id=\"FACES-l13-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l13-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l13-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l13-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(156, 96)\">\n <circle id=\"FACES-l14-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l14-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l14-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l14-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(36, 156)\">\n <circle id=\"FACES-l15-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l15-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l15-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l15-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(96, 156)\">\n <circle id=\"FACES-l16-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l16-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l16-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l16-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n <g transform=\"translate(156, 156)\">\n <circle id=\"FACES-l17-o0\" stroke=\"#000000\" style=\"fill: #0C5093\" r=\"20\"></circle>\n <use xlink:href=\"#face_hours\"/>\n <g>\n <use id=\"DIALS-l17-o0\" xlink:href=\"#hand\" transform=\"rotate(0)\" style=\"fill: #FFD000\"/>\n <use id=\"DIALS-l17-o1\" xlink:href=\"#hand\" transform=\"rotate(30)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o2\" xlink:href=\"#hand\" transform=\"rotate(60)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o3\" xlink:href=\"#hand\" transform=\"rotate(90)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o4\" xlink:href=\"#hand\" transform=\"rotate(120)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o5\" xlink:href=\"#hand\" transform=\"rotate(150)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o6\" xlink:href=\"#hand\" transform=\"rotate(180)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o7\" xlink:href=\"#hand\" transform=\"rotate(210)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o8\" xlink:href=\"#hand\" transform=\"rotate(240)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o9\" xlink:href=\"#hand\" transform=\"rotate(270)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o10\" xlink:href=\"#hand\" transform=\"rotate(300)\" style=\"fill: #0000\"/>\n <use id=\"DIALS-l17-o11\" xlink:href=\"#hand\" transform=\"rotate(330)\" style=\"fill: #0000\"/>\n </g>\n </g>\n </g>\n </g>\n</svg>`;\n", "import type { PuzzleLoader } from \"../../PuzzleLoader\";\n\nexport const clock: PuzzleLoader = {\n id: \"clock\",\n fullName: \"Clock\",\n inventedBy: [\"Christopher C. Wiggs\", \"Christopher J. Taylor\"],\n inventionYear: 1988, // Patent application year: https://www.jaapsch.net/puzzles/patents/us4869506.pdf\n def: async () => {\n return (await import(\"./clock.kpuzzle.json\")).clockKPuzzle;\n },\n svg: async () => {\n return (await import(\"./clock.kpuzzle.svg\")).default;\n },\n};\n", "import type { ExperimentalStickering } from \"../../twisty\";\nimport type { PuzzleLoader } from \"../PuzzleLoader\";\nimport {\n PuzzleAppearance,\n PuzzleStickering,\n StickeringManager,\n PieceSet,\n PieceStickering,\n} from \"./appearance\";\n\nexport async function ftoStickering(\n puzzleLoader: PuzzleLoader,\n stickering: ExperimentalStickering,\n): Promise<PuzzleAppearance> {\n const def = await puzzleLoader.def();\n const puzzleStickering = new PuzzleStickering(def);\n const m = new StickeringManager(def);\n\n const experimentalFTO_FC = (): PieceSet =>\n m.and([m.move(\"U\"), m.not(m.or(m.moves([\"F\", \"BL\", \"BR\"])))]);\n const experimentalFTO_F2T = (): PieceSet =>\n m.and([m.move(\"U\"), m.not(m.move(\"F\"))]);\n const experimentalFTO_SC = (): PieceSet =>\n m.or([\n experimentalFTO_F2T(),\n m.and([m.move(\"F\"), m.not(m.or(m.moves([\"U\", \"BL\", \"BR\"])))]),\n ]);\n const experimentalFTO_L2C = (): PieceSet =>\n m.not(\n m.or([\n m.and([m.move(\"U\"), m.move(\"F\")]),\n m.and([m.move(\"F\"), m.move(\"BL\")]),\n m.and([m.move(\"F\"), m.move(\"BR\")]),\n m.and([m.move(\"BL\"), m.move(\"BR\")]),\n ]),\n );\n const experimentalFTO_LBT = (): PieceSet =>\n m.not(\n m.or([\n m.and([m.move(\"F\"), m.move(\"BL\")]),\n m.and([m.move(\"F\"), m.move(\"BR\")]),\n m.and([m.move(\"BL\"), m.move(\"BR\")]),\n ]),\n );\n\n switch (stickering) {\n case \"full\":\n break;\n case \"experimental-fto-fc\":\n puzzleStickering.set(\n m.not(experimentalFTO_FC()),\n PieceStickering.Ignored,\n );\n break;\n case \"experimental-fto-f2t\":\n puzzleStickering.set(\n m.not(experimentalFTO_F2T()),\n PieceStickering.Ignored,\n );\n puzzleStickering.set(experimentalFTO_FC(), PieceStickering.Dim);\n break;\n case \"experimental-fto-sc\":\n puzzleStickering.set(\n m.not(experimentalFTO_SC()),\n PieceStickering.Ignored,\n );\n puzzleStickering.set(experimentalFTO_F2T(), PieceStickering.Dim);\n break;\n case \"experimental-fto-l2c\":\n puzzleStickering.set(\n m.not(experimentalFTO_L2C()),\n PieceStickering.Ignored,\n );\n puzzleStickering.set(experimentalFTO_SC(), PieceStickering.Dim);\n break;\n case \"experimental-fto-lbt\":\n puzzleStickering.set(\n m.not(experimentalFTO_LBT()),\n PieceStickering.Ignored,\n );\n puzzleStickering.set(experimentalFTO_L2C(), PieceStickering.Dim);\n break;\n case \"experimental-fto-l3t\":\n puzzleStickering.set(experimentalFTO_LBT(), PieceStickering.Dim);\n break;\n default:\n console.warn(\n `Unsupported stickering for ${puzzleLoader.id}: ${stickering}. Setting all pieces to dim.`,\n );\n puzzleStickering.set(m.and(m.moves([])), PieceStickering.Dim);\n }\n return puzzleStickering.toAppearance();\n}\n\nexport async function ftoStickerings(): Promise<ExperimentalStickering[]> {\n return [\n \"full\",\n \"experimental-fto-fc\",\n \"experimental-fto-f2t\",\n \"experimental-fto-sc\",\n \"experimental-fto-l2c\",\n \"experimental-fto-lbt\",\n \"experimental-fto-l3t\",\n ];\n}\n", "import type { PuzzleLoader } from \"../..\";\nimport type { ExperimentalStickering } from \"../../../twisty\";\nimport { asyncGetDef, asyncGetPuzzleGeometry } from \"../../async/async-pg3d\";\nimport type { PuzzleAppearance } from \"../../stickerings/appearance\";\nimport {\n ftoStickering,\n ftoStickerings,\n} from \"../../stickerings/fto-stickerings\";\n\nexport const fto: PuzzleLoader = {\n id: \"fto\",\n fullName: \"Face-Turning Octahedron\",\n inventedBy: [\"Karl Rohrbach\", \"David Pitcher\"], // http://twistypuzzles.com/cgi-bin/puzzle.cgi?pkey=1663\n inventionYear: 1983, // http://twistypuzzles.com/cgi-bin/puzzle.cgi?pkey=1663\n def: async () => {\n return asyncGetDef(\"FTO\");\n },\n svg: async () => {\n const pg = await asyncGetPuzzleGeometry(\"FTO\");\n return pg.generatesvg();\n },\n pg: async () => {\n return asyncGetPuzzleGeometry(\"FTO\");\n },\n appearance: (stickering: ExperimentalStickering): Promise<PuzzleAppearance> =>\n ftoStickering(fto, stickering),\n stickerings: ftoStickerings,\n};\n", "import type { ExperimentalStickering } from \"../../twisty\";\nimport type { PuzzleLoader } from \"../PuzzleLoader\";\nimport type { PuzzleAppearance } from \"./appearance\";\nimport { cubeAppearance } from \"./cube-stickerings\";\n\n// TODO: cache calculations?\nexport async function megaminxAppearance(\n puzzleLoader: PuzzleLoader,\n stickering: ExperimentalStickering,\n): Promise<PuzzleAppearance> {\n switch (stickering) {\n case \"full\":\n case \"F2L\":\n case \"LL\":\n return cubeAppearance(puzzleLoader, stickering);\n default:\n console.warn(\n `Unsupported stickering for ${puzzleLoader.id}: ${stickering}. Setting all pieces to dim.`,\n );\n }\n return cubeAppearance(puzzleLoader, \"full\");\n}\n\nexport async function megaminxStickerings(): Promise<ExperimentalStickering[]> {\n return [\"full\", \"F2L\", \"LL\"];\n}\n", "import type { ExperimentalStickering } from \"../../../twisty\";\nimport { genericPGPuzzleLoader } from \"../../async/async-pg3d\";\nimport type { PuzzleAppearance } from \"../../stickerings/appearance\";\nimport {\n megaminxAppearance,\n megaminxStickerings,\n} from \"../../stickerings/megaminx-stickerings\";\n\nconst megaminx = genericPGPuzzleLoader(\"megaminx\", \"Megaminx\", {\n // Too many simultaneous inventors to name.\n inventionYear: 1981, // Earliest date from https://www.jaapsch.net/puzzles/megaminx.htm\n});\n\n// TODO: loading the stickering code async.\nmegaminx.appearance = (\n stickering: ExperimentalStickering,\n): Promise<PuzzleAppearance> => megaminxAppearance(megaminx, stickering);\nmegaminx.stickerings = megaminxStickerings;\n\nexport { megaminx };\n", "export default `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n \"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"-20 -20 546 480\" preserveAspectRatio=\"xMidYMid meet\">\n <defs>\n </defs>\n <title>pyraminx</title>\n <defs>\n <g id=\"stickerA\" transform=\"scale(1, 0.577350269)\">\n <path\n d=\"m 0,1.732050808 1,-1.732050808 1,1.732050808 z\"\n stroke=\"black\" stroke-width=\"0.04px\" stroke-linecap=\"butt\" stroke-linejoin=\"round\"\n />\n </g>\n <g id=\"stickerV\" transform=\"scale(1, 0.577350269)\">\n <path\n d=\"m 0,0 1,1.732050808 1,-1.732050808 z\"\n stroke=\"black\" stroke-width=\"0.04px\" stroke-linecap=\"butt\" stroke-linejoin=\"round\"\n />\n </g>\n </defs>\n\n<!-- 0 1 2 3 4 5 6 7 8 9 10 -->\n<!-- | | | | | | | | | | | -->\n<!-- 0 - L L L L L F R R R R R -->\n<!-- 1 - L L L F F F R R R -->\n<!-- 2 - L F F F F F R -->\n<!-- 3 - D D D D D -->\n<!-- 4 - D D D -->\n<!-- 5 - D -->\n\n <g id=\"puzzle\" transform=\"translate(5, 5) scale(40, 69.28203232)\">\n <!-- CORNERS -->\n <use id=\"CORNERS-l0-o0\" xlink:href=\"#stickerV\" transform=\"translate(5.2, 1.066666667)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l0-o1\" xlink:href=\"#stickerA\" transform=\"translate(3, 0)\" style=\"fill: red\"/>\n <use id=\"CORNERS-l0-o2\" xlink:href=\"#stickerA\" transform=\"translate(7.4, 0)\" style=\"fill: blue\"/>\n\n <use id=\"CORNERS-l3-o0\" xlink:href=\"#stickerV\" transform=\"translate(4.2, 2.066666667)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l3-o1\" xlink:href=\"#stickerA\" transform=\"translate(4.2, 3.2)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS-l3-o2\" xlink:href=\"#stickerA\" transform=\"translate(2, 1)\" style=\"fill: red\"/>\n\n <use id=\"CORNERS-l2-o0\" xlink:href=\"#stickerV\" transform=\"translate(6.2, 2.066666667)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS-l2-o1\" xlink:href=\"#stickerA\" transform=\"translate(8.4, 1)\" style=\"fill: blue\"/>\n <use id=\"CORNERS-l2-o2\" xlink:href=\"#stickerA\" transform=\"translate(6.2, 3.2)\" style=\"fill: yellow\"/>\n\n <use id=\"CORNERS-l1-o1\" xlink:href=\"#stickerA\" transform=\"translate(9.4, 0)\" style=\"fill: blue\"/>\n <use id=\"CORNERS-l1-o2\" xlink:href=\"#stickerA\" transform=\"translate(1, 0)\" style=\"fill: red\"/>\n <use id=\"CORNERS-l1-o0\" xlink:href=\"#stickerA\" transform=\"translate(5.2, 4.2)\" style=\"fill: yellow\"/>\n\n <!-- \"TIPS\" -->\n <!-- CORNERS2 -->\n <use id=\"CORNERS2-l0-o0\" xlink:href=\"#stickerA\" transform=\"translate(5.2, 0.066666667)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS2-l0-o1\" xlink:href=\"#stickerV\" transform=\"translate(4, 0)\" style=\"fill: red\"/>\n <use id=\"CORNERS2-l0-o2\" xlink:href=\"#stickerV\" transform=\"translate(6.4, 0)\" style=\"fill: blue\"/>\n\n <use id=\"CORNERS2-l3-o0\" xlink:href=\"#stickerA\" transform=\"translate(3.2, 2.066666667)\" style=\"fill: limegreen\"/>\n <use id=\"CORNERS2-l3-o1\" xlink:href=\"#stickerV\" transform=\"translate(3.2, 3.2)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS2-l3-o2\" xlink:href=\"#stickerV\" transform=\"translate(2, 2)\" style=\"fill: red\"/>\n\n <use id=\"CORNERS2-l2-o1\" xlink:href=\"#stickerV\" transform=\"translate(8.4, 2)\" style=\"fill: blue\"/>\n <use id=\"CORNERS2-l2-o2\" xlink:href=\"#stickerV\" transform=\"translate(7.2, 3.2)\" style=\"fill: yellow\"/>\n <use id=\"CORNERS2-l2-o0\" xlink:href=\"#stickerA\" transform=\"translate(7.2, 2.066666667)\" style=\"fill: limegreen\"/>\n\n <use id=\"CORNERS2-l1-o1\" xlink:href=\"#stickerV\" transform=\"translate(10.4,0)\" style=\"fill: blue\"/>\n <use id=\"CORNERS2-l1-o2\" xlink:href=\"#stickerV\" transform=\"translate(0, 0)\" style=\"fill: red\"/>\n <use id=\"CORNERS2-l1-o0\" xlink:href=\"#stickerV\" transform=\"translate(5.2, 5.2)\" style=\"fill: yellow\"/>\n\n <!-- EDGES -->\n <use id=\"EDGES-l0-o0\" xlink:href=\"#stickerA\" transform=\"translate(4.2, 1.066666667)\" style=\"fill: limegreen\"/>\n <use id=\"EDGES-l0-o1\" xlink:href=\"#stickerV\" transform=\"translate(3, 1)\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l5-o0\" xlink:href=\"#stickerA\" transform=\"translate(6.2, 1.066666667)\" style=\"fill: limegreen\"/>\n <use id=\"EDGES-l5-o1\" xlink:href=\"#stickerV\" transform=\"translate(7.4, 1)\" style=\"fill: blue\"/>\n\n <use id=\"EDGES-l1-o1\" xlink:href=\"#stickerV\" transform=\"translate(8.4, 0)\" style=\"fill: blue\"/>\n <use id=\"EDGES-l1-o0\" xlink:href=\"#stickerV\" transform=\"translate(2, 0)\" style=\"fill: red\"/>\n\n <use id=\"EDGES-l2-o1\" xlink:href=\"#stickerV\" transform=\"translate(5.2, 3.2)\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l2-o0\" xlink:href=\"#stickerA\" transform=\"translate(5.2, 2.066666667)\" style=\"fill: limegreen\"/>\n\n <use id=\"EDGES-l3-o0\" xlink:href=\"#stickerV\" transform=\"translate(6.2, 4.2)\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l3-o1\" xlink:href=\"#stickerV\" transform=\"translate(9.4, 1)\" style=\"fill: blue\"/>\n\n <use id=\"EDGES-l4-o0\" xlink:href=\"#stickerV\" transform=\"translate(4.2, 4.2)\" style=\"fill: yellow\"/>\n <use id=\"EDGES-l4-o1\" xlink:href=\"#stickerV\" transform=\"translate(1, 1)\" style=\"fill: red\"/>\n </g>\n\n</svg>`;\n", "import { asyncGetDef, asyncGetPuzzleGeometry } from \"../../async/async-pg3d\";\nimport type { PuzzleLoader } from \"../../PuzzleLoader\";\n\nexport const pyraminx: PuzzleLoader = {\n id: \"pyraminx\",\n fullName: \"Pyraminx\",\n inventedBy: [\"Uwe Meffert\"],\n inventionYear: 1970, // https://en.wikipedia.org/wiki/Pyraminx#Description\n def: async () => {\n return asyncGetDef(\"pyraminx\");\n },\n svg: async () => {\n return (await import(\"./pyraminx.kpuzzle.svg\")).default;\n },\n pg: async () => {\n return asyncGetPuzzleGeometry(\"pyraminx\");\n },\n};\n", "import type { KPuzzleDefinition } from \"../../../kpuzzle\";\n\nexport const sq1HyperOrbitKPuzzle: KPuzzleDefinition = {\n name: \"Square-1\",\n orbits: {\n WEDGES: { numPieces: 24, orientations: 9 },\n EQUATOR: { numPieces: 2, orientations: 6 },\n },\n startPieces: {\n WEDGES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\n 20, 21, 22, 23,\n ],\n orientation: [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n ],\n },\n EQUATOR: { permutation: [0, 1], orientation: [0, 0] },\n },\n moves: {\n U_SQ_: {\n WEDGES: {\n permutation: [\n 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19,\n 20, 21, 22, 23,\n ],\n orientation: [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0,\n ],\n },\n EQUATOR: { permutation: [0, 1], orientation: [0, 0] },\n },\n D_SQ_: {\n WEDGES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 23, 12, 13, 14, 15, 16, 17, 18,\n 19, 20, 21, 22,\n ],\n orientation: [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0,\n ],\n },\n EQUATOR: { permutation: [0, 1], orientation: [0, 0] },\n },\n _SLASH_: {\n WEDGES: {\n permutation: [\n 0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16, 17, 6, 7, 8, 9, 10, 11, 18, 19,\n 20, 21, 22, 23,\n ],\n orientation: [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0,\n ],\n },\n EQUATOR: { permutation: [0, 1], orientation: [0, 3] },\n },\n },\n};\n", "export default `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"360px\" height=\"552px\" viewBox=\"0 0 360 552\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->\n <title>sq1-fancy</title>\n <desc>Created with Sketch.</desc>\n <!-- stroke=\"none\" -->\n <g id=\"sq1-fancy\" stroke=\"#888\" stroke-width=\"0.25\" fill=\"none\" fill-rule=\"evenodd\">\n <g id=\"EQUATOR\" transform=\"translate(24.000000, 264.000000)\">\n <rect id=\"EQUATOR-l1-o3\" style=\"fill: red\" x=\"168\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l1-o4\" style=\"fill: red\" x=\"192\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l1-o5\" style=\"fill: limegreen\" x=\"216\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l1-o2\" style=\"fill: limegreen\" x=\"240\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l1-o1\" style=\"fill: limegreen\" x=\"264\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l1-o0\" style=\"fill: orange\" x=\"288\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l0-o3\" style=\"fill: orange\" x=\"0\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l0-o4\" style=\"fill: orange\" x=\"24\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l0-o5\" style=\"fill: limegreen\" x=\"48\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l0-o2\" style=\"fill: limegreen\" x=\"72\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l0-o1\" style=\"fill: limegreen\" x=\"96\" y=\"0\" width=\"24\" height=\"24\"></rect>\n <rect id=\"EQUATOR-l0-o0\" style=\"fill: red\" x=\"120\" y=\"0\" width=\"24\" height=\"24\"></rect>\n </g>\n <g id=\"BOTTOM\" transform=\"translate(41.000000, 257.000000)\" stroke-linejoin=\"round\">\n <g id=\"WEDGES-23\" transform=\"translate(130.000000, 88.588457) rotate(120.000000) translate(-130.000000, -88.588457) translate(82.000000, 22.588457)\">\n <polygon id=\"WEDGES-l23-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l23-o7\" style=\"fill: red\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l23-o6\" style=\"fill: red\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l23-o5\" style=\"fill: red\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l23-o4\" style=\"fill: red\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l23-o3\" style=\"fill: white\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l23-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l23-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l23-o0\" style=\"fill: red\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-22\" transform=\"translate(97.157677, 115.157677) rotate(90.000000) translate(-97.157677, -115.157677) translate(49.157677, 49.157677)\">\n <polygon id=\"WEDGES-l22-o8\" style=\"fill: blue\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l22-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l22-o6\" style=\"fill: blue\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l22-o5\" style=\"fill: blue\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l22-o4\" style=\"fill: white\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l22-o3\" style=\"fill: blue\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l22-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l22-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l22-o0\" style=\"fill: blue\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-21\" transform=\"translate(82.000000, 154.588457) rotate(60.000000) translate(-82.000000, -154.588457) translate(34.000000, 88.588457)\">\n <polygon id=\"WEDGES-l21-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l21-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l21-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l21-o5\" style=\"fill: blue\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l21-o4\" style=\"fill: blue\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l21-o3\" style=\"fill: blue\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l21-o2\" style=\"fill: blue\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l21-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l21-o0\" style=\"fill: blue\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-20\" transform=\"translate(88.588457, 196.315353) rotate(30.000000) translate(-88.588457, -196.315353) translate(40.588457, 130.315353)\">\n <polygon id=\"WEDGES-l20-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l20-o7\" style=\"fill: blue\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l20-o6\" style=\"fill: blue\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l20-o5\" style=\"fill: blue\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l20-o4\" style=\"fill: blue\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l20-o3\" style=\"fill: white\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l20-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l20-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l20-o0\" style=\"fill: blue\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-19\" transform=\"translate(67.157677, 163.157677)\">\n <polygon id=\"WEDGES-l19-o8\" style=\"fill: orange\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l19-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l19-o6\" style=\"fill: orange\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l19-o5\" style=\"fill: orange\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l19-o4\" style=\"fill: white\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l19-o3\" style=\"fill: orange\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l19-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l19-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l19-o0\" style=\"fill: orange\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-18\" transform=\"translate(154.588457, 244.315353) scale(-1, -1) rotate(150.000000) translate(-154.588457, -244.315353) translate(106.588457, 178.315353)\">\n <polygon id=\"WEDGES-l18-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l18-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l18-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l18-o5\" style=\"fill: orange\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l18-o4\" style=\"fill: orange\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l18-o3\" style=\"fill: orange\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l18-o2\" style=\"fill: orange\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l18-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l18-o0\" style=\"fill: orange\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-17\" transform=\"translate(196.315353, 237.726896) scale(-1, -1) rotate(120.000000) translate(-196.315353, -237.726896) translate(148.315353, 171.726896)\">\n <polygon id=\"WEDGES-l17-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l17-o7\" style=\"fill: orange\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l17-o6\" style=\"fill: orange\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l17-o5\" style=\"fill: orange\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l17-o4\" style=\"fill: orange\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l17-o3\" style=\"fill: white\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l17-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l17-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l17-o0\" style=\"fill: orange\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-16\" transform=\"translate(229.157677, 211.157677) scale(-1, -1) rotate(90.000000) translate(-229.157677, -211.157677) translate(181.157677, 145.157677)\">\n <polygon id=\"WEDGES-l16-o8\" style=\"fill: limegreen\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l16-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l16-o6\" style=\"fill: limegreen\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l16-o5\" style=\"fill: limegreen\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l16-o4\" style=\"fill: white\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l16-o3\" style=\"fill: limegreen\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l16-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l16-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l16-o0\" style=\"fill: limegreen\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-15\" transform=\"translate(244.315353, 171.726896) scale(-1, -1) rotate(60.000000) translate(-244.315353, -171.726896) translate(196.315353, 105.726896)\">\n <polygon id=\"WEDGES-l15-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l15-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l15-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l15-o5\" style=\"fill: limegreen\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l15-o4\" style=\"fill: limegreen\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l15-o3\" style=\"fill: limegreen\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l15-o2\" style=\"fill: limegreen\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l15-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l15-o0\" style=\"fill: limegreen\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-14\" transform=\"translate(237.726896, 130.000000) scale(-1, -1) rotate(30.000000) translate(-237.726896, -130.000000) translate(189.726896, 64.000000)\">\n <polygon id=\"WEDGES-l14-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l14-o7\" style=\"fill: limegreen\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l14-o6\" style=\"fill: limegreen\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l14-o5\" style=\"fill: limegreen\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l14-o4\" style=\"fill: limegreen\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l14-o3\" style=\"fill: white\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l14-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l14-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l14-o0\" style=\"fill: limegreen\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-13\" transform=\"translate(211.157677, 97.157677) scale(-1, -1) translate(-211.157677, -97.157677) translate(163.157677, 31.157677)\">\n <polygon id=\"WEDGES-l13-o8\" style=\"fill: red\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l13-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l13-o6\" style=\"fill: red\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l13-o5\" style=\"fill: red\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l13-o4\" style=\"fill: white\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l13-o3\" style=\"fill: red\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l13-o2\" style=\"fill: white\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l13-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l13-o0\" style=\"fill: red\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-12\" transform=\"translate(171.726896, 82.000000) rotate(150.000000) translate(-171.726896, -82.000000) translate(123.726896, 16.000000)\">\n <polygon id=\"WEDGES-l12-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l12-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l12-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l12-o5\" style=\"fill: red\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l12-o4\" style=\"fill: red\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l12-o3\" style=\"fill: red\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l12-o2\" style=\"fill: red\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l12-o1\" style=\"fill: white\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l12-o0\" style=\"fill: red\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n </g>\n <g id=\"TOP\" transform=\"translate(41.000000, -31.000000)\" stroke-linejoin=\"round\">\n <g id=\"WEDGES-11\" transform=\"translate(154.588457, 244.315353) scale(-1, -1) rotate(150.000000) translate(-154.588457, -244.315353) translate(106.588457, 178.315353)\">\n <polygon id=\"WEDGES-l11-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l11-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l11-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l11-o5\" style=\"fill: red\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l11-o4\" style=\"fill: red\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l11-o3\" style=\"fill: red\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l11-o2\" style=\"fill: red\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l11-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l11-o0\" style=\"fill: red\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-10\" transform=\"translate(196.315353, 237.726896) scale(-1, -1) rotate(120.000000) translate(-196.315353, -237.726896) translate(148.315353, 171.726896)\">\n <polygon id=\"WEDGES-l10-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l10-o7\" style=\"fill: red\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l10-o6\" style=\"fill: red\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l10-o5\" style=\"fill: red\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l10-o4\" style=\"fill: red\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l10-o3\" style=\"fill: yellow\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l10-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l10-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l10-o0\" style=\"fill: red\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-9\" transform=\"translate(229.157677, 211.157677) scale(-1, -1) rotate(90.000000) translate(-229.157677, -211.157677) translate(181.157677, 145.157677)\">\n <polygon id=\"WEDGES-l9-o8\" style=\"fill: limegreen\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l9-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l9-o6\" style=\"fill: limegreen\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l9-o5\" style=\"fill: limegreen\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l9-o4\" style=\"fill: yellow\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l9-o3\" style=\"fill: limegreen\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l9-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l9-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l9-o0\" style=\"fill: limegreen\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-8\" transform=\"translate(244.315353, 171.726896) scale(-1, -1) rotate(60.000000) translate(-244.315353, -171.726896) translate(196.315353, 105.726896)\">\n <polygon id=\"WEDGES-l8-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l8-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l8-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l8-o5\" style=\"fill: limegreen\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l8-o4\" style=\"fill: limegreen\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l8-o3\" style=\"fill: limegreen\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l8-o2\" style=\"fill: limegreen\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l8-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l8-o0\" style=\"fill: limegreen\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-7\" transform=\"translate(237.726896, 130.000000) scale(-1, -1) rotate(30.000000) translate(-237.726896, -130.000000) translate(189.726896, 64.000000)\">\n <polygon id=\"WEDGES-l7-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l7-o7\" style=\"fill: limegreen\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l7-o6\" style=\"fill: limegreen\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l7-o5\" style=\"fill: limegreen\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l7-o4\" style=\"fill: limegreen\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l7-o3\" style=\"fill: yellow\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l7-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l7-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l7-o0\" style=\"fill: limegreen\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-6\" transform=\"translate(211.157677, 97.157677) scale(-1, -1) translate(-211.157677, -97.157677) translate(163.157677, 31.157677)\">\n <polygon id=\"WEDGES-l6-o8\" style=\"fill: orange\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l6-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l6-o6\" style=\"fill: orange\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l6-o5\" style=\"fill: orange\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l6-o4\" style=\"fill: yellow\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l6-o3\" style=\"fill: orange\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l6-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l6-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l6-o0\" style=\"fill: orange\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-5\" transform=\"translate(171.726896, 82.000000) rotate(150.000000) translate(-171.726896, -82.000000) translate(123.726896, 16.000000)\">\n <polygon id=\"WEDGES-l5-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l5-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l5-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l5-o5\" style=\"fill: orange\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l5-o4\" style=\"fill: orange\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l5-o3\" style=\"fill: orange\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l5-o2\" style=\"fill: orange\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l5-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l5-o0\" style=\"fill: orange\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-4\" transform=\"translate(130.000000, 88.588457) rotate(120.000000) translate(-130.000000, -88.588457) translate(82.000000, 22.588457)\">\n <polygon id=\"WEDGES-l4-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l4-o7\" style=\"fill: orange\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l4-o6\" style=\"fill: orange\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l4-o5\" style=\"fill: orange\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l4-o4\" style=\"fill: orange\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l4-o3\" style=\"fill: yellow\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l4-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l4-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l4-o0\" style=\"fill: orange\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-3\" transform=\"translate(97.157677, 115.157677) rotate(90.000000) translate(-97.157677, -115.157677) translate(49.157677, 49.157677)\">\n <polygon id=\"WEDGES-l3-o8\" style=\"fill: blue\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l3-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l3-o6\" style=\"fill: blue\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l3-o5\" style=\"fill: blue\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l3-o4\" style=\"fill: yellow\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l3-o3\" style=\"fill: blue\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l3-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l3-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l3-o0\" style=\"fill: blue\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-2\" transform=\"translate(82.000000, 154.588457) rotate(60.000000) translate(-82.000000, -154.588457) translate(34.000000, 88.588457)\">\n <polygon id=\"WEDGES-l2-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l2-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l2-o6\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l2-o5\" style=\"fill: blue\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l2-o4\" style=\"fill: blue\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l2-o3\" style=\"fill: blue\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l2-o2\" style=\"fill: blue\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l2-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l2-o0\" style=\"fill: blue\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-1\" transform=\"translate(88.588457, 196.315353) rotate(30.000000) translate(-88.588457, -196.315353) translate(40.588457, 130.315353)\">\n <polygon id=\"WEDGES-l1-o8\" style=\"fill: #D8D8D8\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l1-o7\" style=\"fill: blue\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l1-o6\" style=\"fill: blue\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l1-o5\" style=\"fill: blue\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l1-o4\" style=\"fill: blue\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l1-o3\" style=\"fill: yellow\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l1-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l1-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l1-o0\" style=\"fill: blue\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n <g id=\"WEDGES-0\" transform=\"translate(67.157677, 163.157677)\">\n <polygon id=\"WEDGES-l0-o8\" style=\"fill: red\" points=\"25.723 70.277 40.574 95.999 -2.27373675e-13 96\"></polygon>\n <polygon id=\"WEDGES-l0-o7\" style=\"fill: #D8D8D8\" points=\"70.2768775 96 60.8615612 131.138439 40.5741225 95.9988775\"></polygon>\n <polygon id=\"WEDGES-l0-o6\" style=\"fill: red\" points=\"70.2768775 96 40.574 95.999 25.7231225 70.2768775\"></polygon>\n <polygon id=\"WEDGES-l0-o5\" style=\"fill: red\" points=\"48.0001225 47.9995 68.287 47.9995 78.4307806 65.5692194\"></polygon>\n <polygon id=\"WEDGES-l0-o4\" style=\"fill: yellow\" points=\"60.8615 35.1385 68.287 47.9995 48 48\"></polygon>\n <polygon id=\"WEDGES-l0-o3\" style=\"fill: red\" points=\"83.1384388 48 78.4307806 65.5692194 68.2870612 47.9994388\"></polygon>\n <polygon id=\"WEDGES-l0-o2\" style=\"fill: yellow\" points=\"83.1384388 48 68.287 47.9995 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l0-o1\" style=\"fill: yellow\" points=\"96 0 83.1384388 48 60.8615612 35.1384388\"></polygon>\n <polygon id=\"WEDGES-l0-o0\" style=\"fill: red\" points=\"70.2768775 96 25.7231225 70.2768775 48.0001225 47.9995 78.4307806 65.5692194\"></polygon>\n </g>\n </g>\n <g id=\"DIAGONALS\" transform=\"translate(168.861561, 1.019238)\" stroke=\"#000000\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\n <line x1=\"0\" y1=\"287.842323\" x2=\"70.2768775\" y2=\"550.119201\" id=\"BOTTOM\"></line>\n <line x1=\"0.15767665\" y1=\"262.276878\" x2=\"70.4345542\" y2=\"2.27488928e-16\" id=\"TOP\"></line>\n </g>\n </g>\n</svg>`;\n", "import type { PuzzleLoader } from \"../../PuzzleLoader\";\n\nexport const square1: PuzzleLoader = {\n id: \"square1\",\n fullName: \"Square-1\",\n inventedBy: [\"Karel Hr\u0161el\", \"Vojtech Kopsk\u00FD\"],\n inventionYear: 1990, // Czech patent application year: http://spisy.upv.cz/Patents/FullDocuments/277/277266.pdf\n def: async () => {\n return (await import(\"./sq1-hyperorbit.kpuzzle.json\")).sq1HyperOrbitKPuzzle;\n },\n svg: async () => {\n return (await import(\"./sq1-hyperorbit.kpuzzle.svg\")).default;\n },\n};\n", "export { customPGPuzzleLoader as experimentalCustomPGPuzzleLoader } from \"./customPGPuzzleLoader\";\nexport { experimentalCube3x3x3KPuzzle as experimentalCube3x3x3KPuzzle } from \"../kpuzzle\";\n\nexport { cubeAppearance as experimentalCubeAppearance } from \"./stickerings/cube-stickerings\";\n\nimport type { PuzzleID } from \"../twisty\";\nimport { cubePGPuzzleLoader, genericPGPuzzleLoader } from \"./async/async-pg3d\";\nimport { cube2x2x2 } from \"./implementations/2x2x2\";\nimport { cube3x3x3 } from \"./implementations/3x3x3\";\nimport { clock } from \"./implementations/clock\";\nimport { fto } from \"./implementations/fto\";\nimport { megaminx } from \"./implementations/megaminx\";\nimport { pyraminx } from \"./implementations/pyraminx\";\nimport { square1 } from \"./implementations/square1\";\nimport type { PuzzleLoader } from \"./PuzzleLoader\";\n\nexport type { PuzzleLoader };\n\nexport const puzzles: Record<string, PuzzleLoader> = {\n /******** Start of WCA Puzzles *******/\n \"3x3x3\": cube3x3x3,\n \"2x2x2\": cube2x2x2,\n \"4x4x4\": cubePGPuzzleLoader(\"4x4x4\", \"4\u00D74\u00D74 Cube\"),\n \"5x5x5\": cubePGPuzzleLoader(\"5x5x5\", \"5\u00D75\u00D75 Cube\"),\n \"6x6x6\": cubePGPuzzleLoader(\"6x6x6\", \"6\u00D76\u00D76 Cube\"),\n \"7x7x7\": cubePGPuzzleLoader(\"7x7x7\", \"7\u00D77\u00D77 Cube\"),\n \"40x40x40\": cubePGPuzzleLoader(\"40x40x40\", \"40\u00D740\u00D740 Cube\"),\n // 3x3x3 Blindfolded\n // 3x3x3 Fewest Moves\n // 3x3x3 One-Handed\n clock,\n \"megaminx\": megaminx,\n pyraminx,\n \"skewb\": genericPGPuzzleLoader(\"skewb\", \"Skewb\", {\n inventedBy: [\"Tony Durham\"], // https://www.jaapsch.net/puzzles/skewb.htm\n // inventionYear: 1982, // 1982 is actually the year of Hofstadter's column.\n }),\n square1,\n // 4x4x4 Blindfolded\n // 5x5x5 Blindfolded\n /******** End of WCA puzzles ********/\n \"fto\": fto,\n \"gigaminx\": genericPGPuzzleLoader(\"gigaminx\", \"Gigaminx\", {\n inventedBy: [\"Tyler Fox\"],\n inventionYear: 2006, // Earliest date from https://www.twistypuzzles.com/cgi-bin/puzzle.cgi?pkey=1475\n }),\n \"master_tetraminx\": genericPGPuzzleLoader(\n \"master tetraminx\",\n \"Master Tetraminx\",\n {\n inventedBy: [\"Katsuhiko Okamoto\"], // Using master pyraminx: https://twistypuzzles.com/cgi-bin/puzzle.cgi?pkey=1352\n inventionYear: 2002, // Using master pyraminx: https://twistypuzzles.com/cgi-bin/puzzle.cgi?pkey=1352\n },\n ),\n};\n\nexport { cube2x2x2, cube3x3x3 };\n\nexport { getFaceletAppearance as experimentalGetFaceletAppearance } from \"./stickerings/appearance\";\nexport type {\n FaceletMeshAppearance as ExperimentalFaceletMeshAppearance,\n PuzzleAppearance as ExperimentalPuzzleAppearance,\n} from \"./stickerings/appearance\";\n\ninterface WCAEventInfo {\n puzzleID: PuzzleID;\n eventName: string;\n}\n\nconst wcaEvents: Record<string, WCAEventInfo> = {\n \"333\": { puzzleID: \"3x3x3\", eventName: \"3x3x3 Cube\" },\n \"222\": { puzzleID: \"2x2x2\", eventName: \"2x2x2 Cube\" },\n \"444\": { puzzleID: \"4x4x4\", eventName: \"4x4x4 Cube\" },\n \"555\": { puzzleID: \"5x5x5\", eventName: \"5x5x5 Cube\" },\n \"666\": { puzzleID: \"6x6x6\", eventName: \"6x6x6 Cube\" },\n \"777\": { puzzleID: \"7x7x7\", eventName: \"7x7x7 Cube\" },\n \"333bf\": { puzzleID: \"3x3x3\", eventName: \"3x3x3 Blindfolded\" },\n \"333fm\": { puzzleID: \"3x3x3\", eventName: \"3x3x3 Fewest Moves\" },\n \"333oh\": { puzzleID: \"3x3x3\", eventName: \"3x3x3 One-Handed\" },\n \"clock\": { puzzleID: \"clock\", eventName: \"Clock\" },\n \"minx\": { puzzleID: \"megaminx\", eventName: \"Megaminx\" },\n \"pyram\": { puzzleID: \"pyraminx\", eventName: \"Pyraminx\" },\n \"skewb\": { puzzleID: \"skewb\", eventName: \"Skewb\" },\n \"sq1\": { puzzleID: \"square1\", eventName: \"Square-1\" },\n \"444bf\": { puzzleID: \"4x4x4\", eventName: \"4x4x4 Blindfolded\" },\n \"555bf\": { puzzleID: \"5x5x5\", eventName: \"5x5x5 Blindfolded\" },\n \"333mb\": { puzzleID: \"3x3x3\", eventName: \" 3x3x3 Multi-Blind\" },\n};\n\nexport function wcaEventInfo(event: string): WCAEventInfo | null {\n return wcaEvents[event] ?? null;\n}\n", "import { SimpleTwistyPropSource } from \"../../TwistyProp\";\n\n// TODO: turn these maps into lists?\nexport const hintFaceletStyles = {\n floating: true, // default\n none: true,\n};\nexport type HintFaceletStyle = keyof typeof hintFaceletStyles;\nexport type HintFaceletStyleWithAuto = HintFaceletStyle | \"auto\";\n\nexport class HintFaceletProp extends SimpleTwistyPropSource<HintFaceletStyleWithAuto> {\n getDefaultValue(): HintFaceletStyleWithAuto {\n return \"auto\";\n }\n}\n", "import { SimpleTwistyPropSource } from \"../../TwistyProp\";\n\n// TODO: turn these maps into lists?\n// TODO: alg.cubing.net parity\nexport const experimentalStickerings = {\n \"full\": true, // default\n \"centers-only\": true, // TODO\n \"PLL\": true,\n \"CLS\": true,\n \"OLL\": true,\n \"COLL\": true,\n \"OCLL\": true,\n \"CLL\": true,\n \"ELL\": true,\n \"ELS\": true,\n \"LL\": true,\n \"F2L\": true,\n \"ZBLL\": true,\n \"ZBLS\": true,\n \"WVLS\": true,\n \"VLS\": true,\n \"LS\": true,\n \"EO\": true,\n \"EOline\": true,\n \"EOcross\": true,\n \"CMLL\": true,\n \"L6E\": true,\n \"L6EO\": true,\n \"Daisy\": true,\n \"Cross\": true,\n \"2x2x2\": true,\n \"2x2x3\": true,\n \"Void Cube\": true,\n \"invisible\": true,\n \"picture\": true,\n \"experimental-centers-U\": true,\n \"experimental-centers-U-D\": true,\n \"experimental-centers-U-L-D\": true,\n \"experimental-centers-U-L-B-D\": true,\n \"experimental-centers\": true,\n \"experimental-fto-fc\": true,\n \"experimental-fto-f2t\": true,\n \"experimental-fto-sc\": true,\n \"experimental-fto-l2c\": true,\n \"experimental-fto-lbt\": true,\n \"experimental-fto-l3t\": true,\n \"experimental-global-custom-1\": true,\n \"experimental-global-custom-2\": true,\n};\nexport type ExperimentalStickering = keyof typeof experimentalStickerings;\n\nexport class StickeringProp extends SimpleTwistyPropSource<ExperimentalStickering> {\n getDefaultValue(): ExperimentalStickering {\n return \"full\"; // TODO: auto\n }\n}\n", "export function smootherStep(x: number): number {\n return x * x * x * (10 - x * (15 - 6 * x));\n}\n", "export const TAU = Math.PI * 2;\nexport const DEGREES_PER_RADIAN = 360 / TAU;\n", "import {\n BackSide,\n BoxGeometry,\n BufferAttribute,\n BufferGeometry,\n DoubleSide,\n Euler,\n Group,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Quaternion,\n Texture,\n TextureLoader,\n Vector2,\n Vector3,\n} from \"three\";\nimport type { ExperimentalStickering } from \"../../..\";\nimport type { KPuzzleDefinition } from \"../../../../kpuzzle\";\nimport { puzzles } from \"../../../../puzzles\";\nimport type {\n FaceletMeshAppearance,\n PuzzleAppearance,\n} from \"../../../../puzzles/stickerings/appearance\";\nimport {\n HintFaceletStyle,\n hintFaceletStyles,\n} from \"../../../model/props/puzzle/display/HintFaceletProp\";\nimport { experimentalStickerings } from \"../../../model/props/puzzle/display/StickeringProp\";\nimport type { PuzzlePosition } from \"../../../controllers/AnimationTypes\";\nimport { smootherStep } from \"../../../controllers/easing\";\nimport { TAU } from \"../TAU\";\nimport type { Twisty3DPuzzle } from \"./Twisty3DPuzzle\";\n\nconst svgLoader = new TextureLoader();\n\nconst ignoredMaterial = new MeshBasicMaterial({\n color: 0x444444,\n side: DoubleSide,\n});\n\nconst ignoredMaterialHint = new MeshBasicMaterial({\n color: 0xcccccc,\n side: BackSide,\n transparent: true,\n opacity: 0.75,\n});\n\nconst invisibleMaterial = new MeshBasicMaterial({\n visible: false,\n});\n\nconst orientedMaterial = new MeshBasicMaterial({\n color: 0xff88ff,\n});\n\nconst orientedMaterialHint = new MeshBasicMaterial({\n color: 0xff88ff,\n side: BackSide,\n transparent: true,\n opacity: 0.5,\n});\n\ninterface MaterialMap extends Record<FaceletMeshAppearance, MeshBasicMaterial> {\n regular: MeshBasicMaterial;\n dim: MeshBasicMaterial;\n ignored: MeshBasicMaterial;\n invisible: MeshBasicMaterial;\n}\n\nclass AxisInfo {\n public stickerMaterial: MaterialMap;\n public hintStickerMaterial: MaterialMap;\n constructor(\n public vector: Vector3,\n public fromZ: Euler,\n public color: number,\n public dimColor: number,\n public hintOpacityScale: number, // TODO: make this work better across bright *and* dark backgrounds. Maybe tweak sticker compositing settings?\n options?: { hintColor?: number; hintDimColor?: number },\n ) {\n // TODO: Make sticker material single-sided when cubie foundation is opaque?\n this.stickerMaterial = {\n regular: new MeshBasicMaterial({\n color,\n side: DoubleSide,\n }),\n dim: new MeshBasicMaterial({\n color: dimColor,\n side: DoubleSide,\n }),\n oriented: orientedMaterial,\n ignored: ignoredMaterial,\n invisible: invisibleMaterial,\n };\n this.hintStickerMaterial = {\n regular: new MeshBasicMaterial({\n color: options?.hintColor ?? color,\n side: BackSide,\n transparent: true,\n opacity: 0.5 * hintOpacityScale,\n }),\n dim: new MeshBasicMaterial({\n color: options?.hintDimColor ?? color,\n side: BackSide,\n transparent: true,\n opacity: 0.5 * hintOpacityScale,\n }),\n oriented: orientedMaterialHint,\n ignored: ignoredMaterialHint,\n invisible: invisibleMaterial,\n };\n }\n}\n\nconst axesInfo: AxisInfo[] = [\n new AxisInfo(\n new Vector3(0, 1, 0),\n new Euler(-TAU / 4, 0, 0),\n 0xffffff,\n 0xdddddd,\n 1.25,\n ),\n new AxisInfo(\n new Vector3(-1, 0, 0),\n new Euler(0, -TAU / 4, 0),\n 0xff8800,\n 0x884400,\n 1,\n ),\n new AxisInfo(new Vector3(0, 0, 1), new Euler(0, 0, 0), 0x00ff00, 0x008800, 1),\n new AxisInfo(\n new Vector3(1, 0, 0),\n new Euler(0, TAU / 4, 0),\n 0xff0000,\n 0x660000,\n 1,\n ),\n new AxisInfo(\n new Vector3(0, 0, -1),\n new Euler(0, TAU / 2, 0),\n 0x0000ff,\n 0x000088,\n 0.75,\n { hintColor: 0x0044ff, hintDimColor: 0x002288 },\n ),\n new AxisInfo(\n new Vector3(0, -1, 0),\n new Euler(TAU / 4, 0, 0),\n 0xffff00,\n 0x888800,\n 1.25,\n ),\n];\n\nconst face: { [s: string]: number } = {\n U: 0,\n L: 1,\n F: 2,\n R: 3,\n B: 4,\n D: 5,\n};\n\nconst familyToAxis: { [s: string]: number } = {\n U: face.U,\n u: face.U,\n Uw: face.U,\n Uv: face.U,\n y: face.U,\n L: face.L,\n l: face.L,\n Lw: face.L,\n Lv: face.L,\n M: face.L,\n F: face.F,\n f: face.F,\n Fw: face.F,\n Fv: face.F,\n S: face.F,\n z: face.F,\n R: face.R,\n r: face.R,\n Rw: face.R,\n Rv: face.R,\n x: face.R,\n B: face.B,\n b: face.B,\n Bw: face.B,\n Bv: face.B,\n D: face.D,\n d: face.D,\n Dw: face.D,\n Dv: face.D,\n E: face.D,\n};\n\nconst cubieDimensions = {\n stickerWidth: 0.85,\n stickerElevation: 0.503,\n foundationWidth: 1,\n hintStickerElevation: 1.45,\n};\nconst EXPERIMENTAL_PICTURE_CUBE_HINT_ELEVATION = 2;\n\n/** @deprecated */\nexport function experimentalSetDefaultStickerElevation(\n stickerElevation: number,\n): void {\n cubieDimensions.stickerElevation = stickerElevation;\n}\n\nexport interface Cube3DOptions {\n showMainStickers?: boolean;\n hintFacelets?: HintFaceletStyle;\n showFoundation?: boolean; // TODO: better name\n experimentalStickering?: ExperimentalStickering;\n foundationSprite?: Texture | null;\n hintSprite?: Texture | null;\n}\n\nconst cube3DOptionsDefaults: Cube3DOptions = {\n showMainStickers: true,\n hintFacelets: \"floating\",\n showFoundation: true,\n experimentalStickering: \"full\",\n foundationSprite: null,\n hintSprite: null,\n};\n\n// TODO: Make internal foundation faces one-sided, facing to the outside of the cube.\nconst blackMesh = new MeshBasicMaterial({\n color: 0x000000,\n opacity: 1,\n transparent: true,\n});\n\nconst blackTranslucentMesh = new MeshBasicMaterial({\n color: 0x000000,\n opacity: 0.3,\n transparent: true,\n});\n\nclass CubieDef {\n public matrix: Matrix4;\n public stickerFaces: number[];\n // stickerFaceNames can be e.g. [\"U\", \"F\", \"R\"], \"UFR\" if every face is a single letter.\n constructor(\n public orbit: string,\n stickerFaceNames: string[] | string,\n q: Quaternion,\n ) {\n const individualStickerFaceNames =\n typeof stickerFaceNames === \"string\"\n ? stickerFaceNames.split(\"\")\n : stickerFaceNames;\n this.stickerFaces = individualStickerFaceNames.map((s) => face[s]);\n this.matrix = new Matrix4();\n this.matrix.setPosition(firstPiecePosition[orbit]);\n this.matrix.premultiply(new Matrix4().makeRotationFromQuaternion(q));\n }\n}\n\nfunction t(v: Vector3, t4: number): Quaternion {\n return new Quaternion().setFromAxisAngle(v, (TAU * t4) / 4);\n}\n\nconst r = {\n O: new Vector3(0, 0, 0),\n U: new Vector3(0, -1, 0),\n L: new Vector3(1, 0, 0),\n F: new Vector3(0, 0, -1),\n R: new Vector3(-1, 0, 0),\n B: new Vector3(0, 0, 1),\n D: new Vector3(0, 1, 0),\n};\n\ninterface OrbitIndexed<T> {\n [s: string]: T;\n}\ntype PieceIndexed<T> = OrbitIndexed<T[]>;\n\nconst firstPiecePosition: OrbitIndexed<Vector3> = {\n EDGES: new Vector3(0, 1, 1),\n CORNERS: new Vector3(1, 1, 1),\n CENTERS: new Vector3(0, 1, 0),\n};\nconst orientationRotation: OrbitIndexed<Matrix4[]> = {\n EDGES: [0, 1].map((i) =>\n new Matrix4().makeRotationAxis(\n firstPiecePosition.EDGES.clone().normalize(),\n (-i * TAU) / 2,\n ),\n ),\n CORNERS: [0, 1, 2].map((i) =>\n new Matrix4().makeRotationAxis(\n firstPiecePosition.CORNERS.clone().normalize(),\n (-i * TAU) / 3,\n ),\n ),\n CENTERS: [0, 1, 2, 3].map((i) =>\n new Matrix4().makeRotationAxis(\n firstPiecePosition.CENTERS.clone().normalize(),\n (-i * TAU) / 4,\n ),\n ),\n};\nconst cubieStickerOrder = [face.U, face.F, face.R];\n\nconst pieceDefs: PieceIndexed<CubieDef> = {\n EDGES: [\n new CubieDef(\"EDGES\", \"UF\", t(r.O, 0)),\n new CubieDef(\"EDGES\", \"UR\", t(r.U, 3)),\n new CubieDef(\"EDGES\", \"UB\", t(r.U, 2)),\n new CubieDef(\"EDGES\", \"UL\", t(r.U, 1)),\n new CubieDef(\"EDGES\", \"DF\", t(r.F, 2)),\n new CubieDef(\"EDGES\", \"DR\", t(r.F, 2).premultiply(t(r.D, 1))),\n new CubieDef(\"EDGES\", \"DB\", t(r.F, 2).premultiply(t(r.D, 2))),\n new CubieDef(\"EDGES\", \"DL\", t(r.F, 2).premultiply(t(r.D, 3))),\n new CubieDef(\"EDGES\", \"FR\", t(r.U, 3).premultiply(t(r.R, 3))),\n new CubieDef(\"EDGES\", \"FL\", t(r.U, 1).premultiply(t(r.R, 3))),\n new CubieDef(\"EDGES\", \"BR\", t(r.U, 3).premultiply(t(r.R, 1))),\n new CubieDef(\"EDGES\", \"BL\", t(r.U, 1).premultiply(t(r.R, 1))),\n ],\n CORNERS: [\n new CubieDef(\"CORNERS\", \"UFR\", t(r.O, 0)),\n new CubieDef(\"CORNERS\", \"URB\", t(r.U, 3)),\n new CubieDef(\"CORNERS\", \"UBL\", t(r.U, 2)),\n new CubieDef(\"CORNERS\", \"ULF\", t(r.U, 1)),\n new CubieDef(\"CORNERS\", \"DRF\", t(r.F, 2).premultiply(t(r.D, 1))),\n new CubieDef(\"CORNERS\", \"DFL\", t(r.F, 2).premultiply(t(r.D, 0))),\n new CubieDef(\"CORNERS\", \"DLB\", t(r.F, 2).premultiply(t(r.D, 3))),\n new CubieDef(\"CORNERS\", \"DBR\", t(r.F, 2).premultiply(t(r.D, 2))),\n ],\n CENTERS: [\n new CubieDef(\"CENTERS\", \"U\", t(r.O, 0)),\n new CubieDef(\"CENTERS\", \"L\", t(r.R, 3).premultiply(t(r.U, 1))),\n new CubieDef(\"CENTERS\", \"F\", t(r.R, 3)),\n new CubieDef(\"CENTERS\", \"R\", t(r.R, 3).premultiply(t(r.D, 1))),\n new CubieDef(\"CENTERS\", \"B\", t(r.R, 3).premultiply(t(r.D, 2))),\n new CubieDef(\"CENTERS\", \"D\", t(r.R, 2)),\n ],\n};\n\nconst CUBE_SCALE = 1 / 3;\n\ninterface FaceletInfo {\n faceIdx: number;\n facelet: Mesh;\n hintFacelet?: Mesh;\n}\n\n// TODO: Compatibility with Randelshofer or standard net layout? Offer a\n// conversion function?\nconst pictureStickerCoords: Record<string, number[][][]> = {\n EDGES: [\n [\n [0, 4, 6],\n [0, 4, 5],\n ],\n [\n [3, 5, 7],\n [0, 7, 5],\n ],\n [\n [2, 4, 8],\n [0, 10, 5],\n ],\n [\n [1, 3, 7],\n [0, 1, 5],\n ],\n [\n [2, 4, 2],\n [2, 4, 3],\n ],\n [\n [3, 5, 1],\n [2, 7, 3],\n ],\n [\n [0, 4, 0],\n [2, 10, 3],\n ],\n [\n [1, 3, 1],\n [2, 1, 3],\n ],\n [\n [3, 5, 4],\n [3, 6, 4],\n ],\n [\n [1, 3, 4],\n [1, 2, 4],\n ],\n [\n [1, 9, 4],\n [1, 8, 4],\n ],\n [\n [3, 11, 4],\n [3, 0, 4],\n ],\n ],\n CORNERS: [\n [\n [0, 5, 6],\n [0, 5, 5],\n [0, 6, 5],\n ],\n [\n [3, 5, 8],\n [0, 8, 5],\n [0, 9, 5],\n ],\n [\n [2, 3, 8],\n [0, 11, 5],\n [0, 0, 5],\n ],\n [\n [1, 3, 6],\n [0, 2, 5],\n [0, 3, 5],\n ],\n [\n [3, 5, 2],\n [2, 6, 3],\n [2, 5, 3],\n ],\n [\n [2, 3, 2],\n [2, 3, 3],\n [2, 2, 3],\n ],\n [\n [1, 3, 0],\n [2, 0, 3],\n [2, 11, 3],\n ],\n [\n [0, 5, 0],\n [2, 9, 3],\n [2, 8, 3],\n ],\n ],\n CENTERS: [\n [[0, 4, 7]],\n [[0, 1, 4]],\n [[0, 4, 4]],\n [[0, 7, 4]],\n [[0, 10, 4]],\n [[0, 4, 1]],\n ],\n};\n\nlet sharedCubieFoundationGeometryCache: BoxGeometry | null = null;\nfunction sharedCubieFoundationGeometry(): BoxGeometry {\n return (\n sharedCubieFoundationGeometryCache ??\n (sharedCubieFoundationGeometryCache = new BoxGeometry(\n cubieDimensions.foundationWidth,\n cubieDimensions.foundationWidth,\n cubieDimensions.foundationWidth,\n ))\n );\n}\n\nfunction newStickerGeometry(): BufferGeometry {\n const r = new BufferGeometry();\n const half = 0.5 * cubieDimensions.stickerWidth;\n r.setAttribute(\n \"position\",\n new BufferAttribute(\n new Float32Array([\n half,\n half,\n 0,\n -half,\n half,\n 0,\n half,\n -half,\n 0,\n -half,\n half,\n 0,\n -half,\n -half,\n 0,\n half,\n -half,\n 0,\n ]),\n 3,\n ),\n );\n r.setAttribute(\n \"uv\",\n new BufferAttribute(\n new Float32Array([\n 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1,\n ]),\n 2,\n ),\n );\n // r.setAttribute('normals', new BufferAttribute(new Float32Array([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]), 3));\n return r;\n}\n\nlet sharedStickerGeometryCache: BufferGeometry | null = null;\nfunction sharedStickerGeometry(): BufferGeometry {\n return (\n sharedStickerGeometryCache ??\n (sharedStickerGeometryCache = newStickerGeometry())\n );\n}\n\n// TODO: Split into \"scene model\" and \"view\".\nexport class Cube3D extends Object3D implements Twisty3DPuzzle {\n kpuzzleFaceletInfo: Record<string, FaceletInfo[][]>;\n private pieces: PieceIndexed<Object3D> = {};\n private options: Cube3DOptions;\n // TODO: Keep track of option-based meshes better.\n private experimentalHintStickerMeshes: Mesh[] = [];\n private experimentalFoundationMeshes: Mesh[] = [];\n\n private setSpriteURL: (url: string) => void;\n private sprite: Texture | Promise<Texture> = new Promise((resolve) => {\n this.setSpriteURL = (url: string): void => {\n svgLoader.load(url, resolve);\n };\n });\n\n // TODO: Don't overwrite the static function.\n // TODO: This doesn't work dynamically yet.\n setSprite(texture: Texture): void {\n this.sprite = texture;\n }\n\n private setHintSpriteURL: (url: string) => void;\n private hintSprite: Texture | Promise<Texture> = new Promise((resolve) => {\n this.setHintSpriteURL = (url: string): void => {\n svgLoader.load(url, resolve);\n };\n });\n\n // TODO: Don't overwrite the static function.\n // TODO: This doesn't work dynamically yet.\n setHintSprite(texture: Texture): void {\n this.hintSprite = texture;\n }\n\n constructor(\n private def: KPuzzleDefinition,\n private scheduleRenderCallback?: () => void,\n options: Cube3DOptions = {},\n ) {\n super();\n\n this.options = { ...cube3DOptionsDefaults };\n Object.assign(this.options, options); // TODO: check if this works\n\n if (this.def.name !== \"3x3x3\") {\n throw new Error(\n `Invalid puzzle for this Cube3D implementation: ${this.def.name}`,\n );\n }\n\n if (options.foundationSprite) {\n this.setSprite(options.foundationSprite);\n }\n if (options.hintSprite) {\n this.setHintSprite(options.hintSprite);\n }\n\n this.kpuzzleFaceletInfo = {};\n for (const orbit in pieceDefs) {\n const orbitFaceletInfo: FaceletInfo[][] = [];\n this.kpuzzleFaceletInfo[orbit] = orbitFaceletInfo;\n this.pieces[orbit] = pieceDefs[orbit].map(\n this.createCubie.bind(this, orbit, orbitFaceletInfo),\n );\n }\n this.scale.set(CUBE_SCALE, CUBE_SCALE, CUBE_SCALE);\n\n // TODO: Can we construct this directly instead of applying it later? Would that be more code-efficient?\n if (this.options.experimentalStickering) {\n this.setStickering(this.options.experimentalStickering);\n }\n }\n\n // Can only be called once.\n /** @deprecated */\n experimentalSetStickerSpriteURL(stickerSpriteURL: string): void {\n this.setSpriteURL(stickerSpriteURL);\n }\n\n // Can only be called once.\n /** @deprecated */\n experimentalSetHintStickerSpriteURL(hintStickerSpriteURL: string): void {\n this.setHintSpriteURL(hintStickerSpriteURL);\n }\n\n setStickering(stickering: ExperimentalStickering): void {\n // TODO\n (async () => {\n // TODO\n const appearance = await puzzles[\"3x3x3\"].appearance!(\n stickering ?? \"full\",\n );\n this.setAppearance(\n appearance ?? (await puzzles[\"3x3x3\"].appearance!(\"full\")),\n );\n })();\n }\n\n setAppearance(appearance: PuzzleAppearance): void {\n for (const [orbitName, orbitAppearance] of Object.entries(\n appearance.orbits,\n )) {\n for (\n let pieceIdx = 0;\n pieceIdx < orbitAppearance.pieces.length;\n pieceIdx++\n ) {\n const pieceAppearance = orbitAppearance.pieces[pieceIdx];\n if (pieceAppearance) {\n const pieceInfo = this.kpuzzleFaceletInfo[orbitName][pieceIdx];\n for (\n let faceletIdx = 0;\n faceletIdx < pieceInfo.length;\n faceletIdx++\n ) {\n const faceletAppearance = pieceAppearance.facelets[faceletIdx];\n if (faceletAppearance) {\n const faceletInfo = pieceInfo[faceletIdx];\n\n const appearance =\n typeof faceletAppearance === \"string\"\n ? faceletAppearance\n : faceletAppearance?.appearance;\n\n faceletInfo.facelet.material =\n axesInfo[faceletInfo.faceIdx].stickerMaterial[appearance];\n // TODO\n const hintAppearance =\n typeof faceletAppearance === \"string\"\n ? appearance\n : faceletAppearance.hintAppearance ?? appearance;\n if (faceletInfo.hintFacelet) {\n faceletInfo.hintFacelet.material =\n axesInfo[faceletInfo.faceIdx].hintStickerMaterial[\n hintAppearance\n ];\n }\n }\n }\n }\n }\n }\n if (this.scheduleRenderCallback) {\n this.scheduleRenderCallback();\n }\n }\n\n /** @deprecated */\n public experimentalUpdateOptions(options: Cube3DOptions): void {\n if (\"showMainStickers\" in options) {\n throw new Error(\"Unimplemented\");\n }\n\n const showFoundation = options.showFoundation;\n if (\n typeof showFoundation !== \"undefined\" &&\n this.options.showFoundation !== showFoundation\n ) {\n this.options.showFoundation = showFoundation;\n for (const foundation of this.experimentalFoundationMeshes) {\n foundation.visible = showFoundation;\n }\n }\n\n const hintFacelets = options.hintFacelets;\n if (\n typeof hintFacelets !== \"undefined\" &&\n this.options.hintFacelets !== hintFacelets &&\n hintFaceletStyles[hintFacelets] // TODO: test this\n ) {\n this.options.hintFacelets = hintFacelets;\n for (const hintSticker of this.experimentalHintStickerMeshes) {\n hintSticker.visible = hintFacelets === \"floating\";\n }\n this.scheduleRenderCallback!(); // TODO\n }\n\n const experimentalStickering = options.experimentalStickering;\n if (\n typeof experimentalStickering !== \"undefined\" &&\n this.options.experimentalStickering !== experimentalStickering &&\n experimentalStickerings[experimentalStickering] // TODO: test this\n ) {\n this.options.experimentalStickering = experimentalStickering;\n // TODO\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.setStickering(experimentalStickering);\n this.scheduleRenderCallback!(); // TODO\n }\n }\n\n public onPositionChange(p: PuzzlePosition): void {\n const reid333 = p.state;\n for (const orbit in pieceDefs) {\n const pieces = pieceDefs[orbit];\n for (let i = 0; i < pieces.length; i++) {\n const j = reid333[orbit].permutation[i];\n this.pieces[orbit][j].matrix.copy(pieceDefs[orbit][i].matrix);\n this.pieces[orbit][j].matrix.multiply(\n orientationRotation[orbit][reid333[orbit].orientation[i]],\n );\n }\n for (const moveProgress of p.movesInProgress) {\n const move = moveProgress.move;\n const turnNormal = axesInfo[familyToAxis[move.family]].vector;\n const moveMatrix = new Matrix4().makeRotationAxis(\n turnNormal,\n (-this.ease(moveProgress.fraction) *\n moveProgress.direction *\n move.amount *\n TAU) /\n 4,\n );\n for (let i = 0; i < pieces.length; i++) {\n const k = this.def.moves[move.family][orbit].permutation[i];\n if (\n i !== k ||\n this.def.moves[move.family][orbit].orientation[i] !== 0\n ) {\n const j = reid333[orbit].permutation[i];\n this.pieces[orbit][j].matrix.premultiply(moveMatrix);\n }\n }\n }\n }\n this.scheduleRenderCallback!();\n }\n\n // TODO: Always create (but sometimes hide parts) so we can show them later,\n // or (better) support creating puzzle parts on demand.\n private createCubie(\n orbit: string,\n orbitFacelets: FaceletInfo[][],\n piece: CubieDef,\n orbitPieceIdx: number,\n ): Object3D {\n const cubieFaceletInfo: FaceletInfo[] = [];\n orbitFacelets.push(cubieFaceletInfo);\n const cubie = new Group();\n if (this.options.showFoundation) {\n const foundation = this.createCubieFoundation();\n cubie.add(foundation);\n this.experimentalFoundationMeshes.push(foundation);\n }\n for (let i = 0; i < piece.stickerFaces.length; i++) {\n const sticker = this.createSticker(\n axesInfo[cubieStickerOrder[i]],\n axesInfo[piece.stickerFaces[i]],\n false,\n );\n const faceletInfo: FaceletInfo = {\n faceIdx: piece.stickerFaces[i],\n facelet: sticker,\n };\n cubie.add(sticker);\n if (this.options.hintFacelets === \"floating\") {\n const hintSticker = this.createSticker(\n axesInfo[cubieStickerOrder[i]],\n axesInfo[piece.stickerFaces[i]],\n true,\n );\n cubie.add(hintSticker);\n faceletInfo.hintFacelet = hintSticker;\n this.experimentalHintStickerMeshes.push(hintSticker);\n }\n\n if (\n this.options.experimentalStickering === \"picture\" &&\n pictureStickerCoords[orbit] &&\n pictureStickerCoords[orbit][orbitPieceIdx] &&\n pictureStickerCoords[orbit][orbitPieceIdx][i]\n ) {\n const [rotate, offsetX, offsetY] =\n pictureStickerCoords[orbit][orbitPieceIdx][i];\n (async () => {\n const addImageSticker = async (hint: boolean) => {\n const texture: Texture = await (hint\n ? this.hintSprite\n : this.sprite);\n\n const mesh = this.createSticker(\n axesInfo[cubieStickerOrder[i]],\n axesInfo[piece.stickerFaces[i]],\n hint,\n );\n mesh.material = new MeshBasicMaterial({\n map: texture,\n side: hint ? BackSide : DoubleSide,\n transparent: true,\n });\n\n const x1 = offsetX / 12;\n const x2 = (offsetX + 1) / 12;\n const y1 = offsetY / 9;\n const y2 = (offsetY + 1) / 9;\n\n let v1 = new Vector2(x1, y1);\n let v2 = new Vector2(x1, y2);\n let v3 = new Vector2(x2, y2);\n let v4 = new Vector2(x2, y1);\n\n switch (rotate) {\n case 1:\n [v1, v2, v3, v4] = [v2, v3, v4, v1];\n break;\n case 2:\n [v1, v2, v3, v4] = [v3, v4, v1, v2];\n break;\n case 3:\n [v1, v2, v3, v4] = [v4, v1, v2, v3];\n break;\n }\n mesh.geometry.setAttribute(\n \"uv\",\n new BufferAttribute(\n new Float32Array([\n v3.x,\n v3.y,\n v2.x,\n v2.y,\n v4.x,\n v4.y,\n v2.x,\n v2.y,\n v1.x,\n v1.y,\n v4.x,\n v4.y,\n ]),\n 2,\n ),\n );\n cubie.add(mesh);\n };\n // const delay: number = ({\n // CENTERS: 1000,\n // EDGES: 2000,\n // CORNERS: 3500,\n // } as Record<string, number>)[orbit];\n // if (orbit === \"CENTERS\" && orbitPieceIdx === 5) {\n addImageSticker(true);\n addImageSticker(false);\n // } else {\n // await this.sprite;\n // await this.hintSprite;\n // setTimeout(\n // () => addImageSticker(true),\n // delay + orbitPieceIdx * 100,\n // );\n // setTimeout(\n // () => addImageSticker(false),\n // delay + orbitPieceIdx * 100,\n // );\n // }\n })();\n }\n\n cubieFaceletInfo.push(faceletInfo);\n }\n cubie.matrix.copy(piece.matrix);\n cubie.matrixAutoUpdate = false;\n this.add(cubie);\n return cubie;\n }\n\n // TODO: Support creating only the outward-facing parts?\n private createCubieFoundation(): Mesh {\n const box = sharedCubieFoundationGeometry();\n return new Mesh(\n box,\n this.options.experimentalStickering === \"picture\"\n ? blackMesh\n : blackTranslucentMesh,\n );\n }\n\n private createSticker(\n posAxisInfo: AxisInfo,\n materialAxisInfo: AxisInfo,\n isHint: boolean,\n ): Mesh {\n const geo =\n this.options.experimentalStickering === \"picture\"\n ? newStickerGeometry()\n : sharedStickerGeometry();\n const stickerMesh = new Mesh(\n geo,\n isHint\n ? materialAxisInfo.hintStickerMaterial.regular\n : materialAxisInfo.stickerMaterial.regular,\n );\n stickerMesh.setRotationFromEuler(posAxisInfo.fromZ);\n stickerMesh.position.copy(posAxisInfo.vector);\n stickerMesh.position.multiplyScalar(\n isHint\n ? this.options.experimentalStickering === \"picture\"\n ? EXPERIMENTAL_PICTURE_CUBE_HINT_ELEVATION\n : cubieDimensions.hintStickerElevation\n : cubieDimensions.stickerElevation,\n );\n return stickerMesh;\n }\n\n /** @deprecated */\n experimentalSetFoundationOpacity(opacity: number): void {\n (\n this.experimentalFoundationMeshes[0].material as MeshBasicMaterial\n ).opacity = opacity;\n }\n\n /** @deprecated */\n experimentalSetStickerWidth(width: number): void {\n for (const orbitInfo of Object.values(this.kpuzzleFaceletInfo)) {\n for (const pieceInfo of orbitInfo) {\n for (const faceletInfo of pieceInfo) {\n faceletInfo.facelet.scale.setScalar(\n width / cubieDimensions.stickerWidth,\n );\n // faceletInfo.facelet.setRotationFromAxisAngle(new Vector3(0, 1, 0), 0);\n // faceletInfo.facelet.rotateOnAxis(new Vector3(1, 0, 1), TAU / 6);\n }\n }\n }\n }\n\n /** @deprecated */\n experimentalSetCenterStickerWidth(width: number): void {\n for (const orbitInfo of [this.kpuzzleFaceletInfo[\"CENTERS\"]]) {\n for (const pieceInfo of orbitInfo) {\n for (const faceletInfo of pieceInfo) {\n faceletInfo.facelet.scale.setScalar(\n width / cubieDimensions.stickerWidth,\n );\n // faceletInfo.facelet.setRotationFromAxisAngle(new Vector3(0, 1, 0), 0);\n // faceletInfo.facelet.rotateOnAxis(new Vector3(1, 0, 1), TAU / 6);\n }\n }\n }\n }\n\n private ease(fraction: number): number {\n return smootherStep(fraction);\n }\n}\n", "import {\n BufferAttribute,\n BufferGeometry,\n Color,\n DoubleSide,\n Euler,\n FrontSide,\n Group,\n Material,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Texture,\n Vector3,\n} from \"three\";\nimport { Move } from \"../../../../alg\";\nimport {\n areTransformationsEquivalent,\n KPuzzle,\n KPuzzleDefinition,\n Transformation,\n transformationOrder,\n} from \"../../../../kpuzzle\";\nimport { experimentalTransformationForQuantumMove } from \"../../../../kpuzzle\";\nimport type {\n StickerDat,\n StickerDatSticker,\n StickerDatAxis,\n} from \"../../../../puzzle-geometry\";\nimport type { TextureMapper } from \"../../../../puzzle-geometry/PuzzleGeometry\";\nimport {\n ExperimentalFaceletMeshAppearance,\n experimentalGetFaceletAppearance,\n ExperimentalPuzzleAppearance,\n} from \"../../../../puzzles\";\nimport type { HintFaceletStyle } from \"../../../model/props/puzzle/display/HintFaceletProp\";\nimport type { PuzzlePosition } from \"../../../controllers/AnimationTypes\";\nimport { smootherStep } from \"../../../controllers/easing\";\nimport { TAU } from \"../TAU\";\n\nimport type { Twisty3DPuzzle } from \"./Twisty3DPuzzle\";\n\nconst foundationMaterial = new MeshBasicMaterial({\n side: DoubleSide,\n color: 0x000000,\n});\nconst invisMaterial = new MeshBasicMaterial({\n visible: false,\n});\nconst basicStickerMaterial = new MeshBasicMaterial({\n vertexColors: true,\n});\n\nfunction dist(coords: number[], a: number, b: number): number {\n return Math.hypot(\n coords[3 * a] - coords[3 * b],\n coords[3 * a + 1] - coords[3 * b + 1],\n coords[3 * a + 2] - coords[3 * b + 2],\n );\n}\n\nfunction triarea(coords: number[], a: number, b: number, c: number): number {\n const ab = dist(coords, a, b);\n const bc = dist(coords, b, c);\n const ac = dist(coords, a, c);\n const p = (ab + bc + ac) / 2;\n return Math.sqrt(p * (p - ab) * (p - bc) * (p - ac));\n}\n\nfunction polyarea(coords: number[]): number {\n let sum = 0;\n for (let i = 2; 3 * i < coords.length; i++) {\n sum += triarea(coords, 0, 1, i);\n }\n return sum;\n}\n\nfunction normalize(r: number[]): number[] {\n const m = Math.hypot(r[0], r[1], r[2]);\n r[0] /= m;\n r[1] /= m;\n r[2] /= m;\n return r;\n}\n\nfunction cross(a: number[], b: number[]): number[] {\n const r = new Array<number>(3);\n r[0] = a[1] * b[2] - a[2] * b[1];\n r[1] = a[2] * b[0] - a[0] * b[2];\n r[2] = a[0] * b[1] - a[1] * b[0];\n return r;\n}\n\nfunction normal(c: number[]): number[] {\n const a: number[] = [c[3] - c[0], c[4] - c[1], c[5] - c[2]];\n const b: number[] = [c[6] - c[3], c[7] - c[4], c[8] - c[5]];\n const r = cross(a, b);\n return normalize(r);\n}\n\nfunction trimEdges(face: number[], tr: number): number[] {\n const r: number[] = [];\n const A: number[] = new Array(3);\n const B: number[] = new Array(3);\n for (let iter = 1; iter < 10; iter++) {\n for (let i = 0; i < face.length; i += 3) {\n const pi = (i + face.length - 3) % face.length;\n const ni = (i + 3) % face.length;\n for (let k = 0; k < 3; k++) {\n A[k] = face[pi + k] - face[i + k];\n B[k] = face[ni + k] - face[i + k];\n }\n const alen = Math.hypot(A[0], A[1], A[2]);\n const blen = Math.hypot(B[0], B[1], B[2]);\n for (let k = 0; k < 3; k++) {\n A[k] /= alen;\n B[k] /= blen;\n }\n const d = A[0] * B[0] + A[1] * B[1] + A[2] * B[2];\n const m = tr / Math.sqrt(1 - d * d);\n for (let k = 0; k < 3; k++) {\n r[i + k] = face[i + k] + (A[k] + B[k]) * m;\n }\n }\n let good = true;\n for (let i = 0; good && i < r.length; i += 3) {\n const ni = (i + 3) % face.length;\n let t = 0;\n for (let k = 0; k < 3; k++) {\n const a = face[ni + k] - face[i + k];\n const b = r[ni + k] - r[i + k];\n t += a * b;\n }\n if (t <= 0) {\n good = false;\n }\n }\n if (good) {\n return r;\n }\n tr /= 2;\n }\n return face;\n}\n\nclass Filler {\n pos: number;\n ipos: number;\n vertices: Float32Array;\n colors: Uint8Array;\n uvs?: Float32Array;\n ind: Uint8Array;\n constructor(public sz: number, public tm: TextureMapper) {\n this.vertices = new Float32Array(9 * sz);\n this.uvs = undefined;\n this.colors = new Uint8Array(18 * sz);\n this.ind = new Uint8Array(sz);\n this.pos = 0;\n this.ipos = 0;\n }\n\n add(pt: number[], i: number, c: number) {\n this.vertices[this.pos] = pt[3 * i + 0];\n this.vertices[this.pos + 1] = pt[3 * i + 1];\n this.vertices[this.pos + 2] = pt[3 * i + 2];\n this.colors[this.pos] = c >> 16;\n this.colors[this.pos + 1] = (c >> 8) & 255;\n this.colors[this.pos + 2] = c & 255;\n this.pos += 3;\n }\n\n addUncolored(pt: number[], i: number) {\n this.vertices[this.pos] = pt[3 * i + 0];\n this.vertices[this.pos + 1] = pt[3 * i + 1];\n this.vertices[this.pos + 2] = pt[3 * i + 2];\n this.pos += 3;\n }\n\n setind(i: number) {\n this.ind[this.ipos++] = i;\n }\n\n makePoly(coords: number[], color: number, ind: number): void {\n const ncoords: number[] = coords;\n for (let g = 1; 3 * (g + 1) < ncoords.length; g++) {\n this.add(ncoords, 0, color);\n this.add(ncoords, g, color);\n this.add(ncoords, g + 1, color);\n this.setind(ind);\n }\n }\n\n setAttributes(geo: BufferGeometry) {\n geo.setAttribute(\"position\", new BufferAttribute(this.vertices, 3));\n // the geometry only needs the first half of the array\n const sa2 = this.colors.subarray(0, 9 * this.sz);\n geo.setAttribute(\"color\", new BufferAttribute(sa2, 3, true));\n }\n\n makeGroups(geo: BufferGeometry) {\n geo.clearGroups();\n for (let i = 0; i < this.ipos; ) {\n const si = i++;\n const iv = this.ind[si];\n while (this.ind[i] === iv) {\n i++;\n }\n geo.addGroup(3 * si, 3 * (i - si), iv);\n }\n }\n\n saveOriginalColors() {\n this.colors.copyWithin(this.pos, 0, this.pos);\n }\n}\n\nclass StickerDef {\n private origColor: number;\n private origColorAppearance: number;\n private faceColor: number;\n private texturePtr?: StickerDef = undefined;\n public twistVal: number = -1;\n public stickerStart: number;\n public stickerEnd: number;\n public hintStart: number;\n public hintEnd: number;\n public foundationStart: number;\n public foundationEnd: number;\n private isDup: boolean;\n private faceNum: number;\n constructor(\n filler: Filler,\n stickerDat: StickerDatSticker,\n trim: number,\n options?: {\n appearance?: ExperimentalFaceletMeshAppearance;\n },\n ) {\n this.isDup = !!stickerDat.isDup;\n this.faceNum = stickerDat.face;\n this.stickerStart = filler.ipos;\n const sdColor = new Color(stickerDat.color).getHex();\n this.origColor = sdColor;\n this.origColorAppearance = sdColor;\n if (options?.appearance) {\n this.setAppearance(filler, options.appearance);\n }\n this.faceColor = sdColor;\n const coords = this.stickerCoords(stickerDat.coords, trim);\n filler.makePoly(coords, this.faceColor, this.isDup ? 4 : 0);\n this.stickerEnd = filler.ipos;\n }\n\n private stickerCoords(coords: number[], trim: number): number[] {\n return trimEdges(coords.slice(), trim);\n }\n\n private hintCoords(\n coords: number[],\n hintStickerHeightScale: number,\n trim: number,\n normal: number[],\n ): number[] {\n coords = this.stickerCoords(coords, trim); // pick up trim from stickers\n normal = normal.slice();\n for (let i = 0; i < 3; i++) {\n normal[i] *= 0.5 * hintStickerHeightScale;\n }\n const hCoords = new Array<number>(coords.length);\n for (let i = 0; 3 * i < coords.length; i++) {\n const j = coords.length / 3 - 1 - i;\n hCoords[3 * i] = coords[3 * j] + normal[0];\n hCoords[3 * i + 1] = coords[3 * j + 1] + normal[1];\n hCoords[3 * i + 2] = coords[3 * j + 2] + normal[2];\n }\n return hCoords;\n }\n\n private foundationCoords(coords: number[]): number[] {\n const ncoords = coords.slice();\n for (let i = 0; i < coords.length; i++) {\n ncoords[i] = coords[i] * 0.999;\n }\n return ncoords;\n }\n\n addHint(\n filler: Filler,\n stickerDat: StickerDatSticker,\n hintStickers: boolean,\n hintStickerHeightScale: number,\n trim: number,\n normal: number[],\n ): void {\n this.hintStart = filler.ipos;\n const coords = this.hintCoords(\n stickerDat.coords,\n hintStickerHeightScale,\n trim,\n normal,\n );\n filler.makePoly(\n coords,\n this.faceColor,\n hintStickers && !this.isDup ? 2 : 4,\n );\n this.hintEnd = filler.ipos;\n }\n\n public addFoundation(\n filler: Filler,\n stickerDat: StickerDatSticker,\n black: number,\n ) {\n this.foundationStart = filler.ipos;\n const coords = this.foundationCoords(stickerDat.coords);\n filler.makePoly(coords, black, this.isDup ? 4 : 6);\n this.foundationEnd = filler.ipos;\n }\n\n private setHintStickers(filler: Filler, hintStickers: boolean): void {\n const indv = this.isDup || !hintStickers ? 4 : 2;\n for (let i = this.hintStart; i < this.hintEnd; i++) {\n filler.ind[i] = indv | (filler.ind[i] & 1);\n }\n }\n\n public setAppearance(\n filler: Filler,\n faceletMeshAppearance: ExperimentalFaceletMeshAppearance,\n ): void {\n let c = 0;\n switch (faceletMeshAppearance) {\n case \"regular\":\n c = this.origColor;\n break;\n case \"dim\":\n if (this.origColor === 0xffffff) {\n c = 0xdddddd;\n } else {\n c = new Color(this.origColor).multiplyScalar(0.5).getHex();\n }\n break;\n case \"oriented\":\n c = 0xff88ff;\n break;\n case \"ignored\":\n c = 0x444444;\n break;\n case \"invisible\":\n c = this.origColor;\n }\n this.origColorAppearance = c;\n for (let i = 9 * this.stickerStart; i < 9 * this.stickerEnd; i += 3) {\n filler.colors[filler.pos + i] = c >> 16;\n filler.colors[filler.pos + i + 1] = (c >> 8) & 255;\n filler.colors[filler.pos + i + 2] = c & 255;\n }\n for (let i = 9 * this.hintStart; i < 9 * this.hintEnd; i += 3) {\n filler.colors[filler.pos + i] = c >> 16;\n filler.colors[filler.pos + i + 1] = (c >> 8) & 255;\n filler.colors[filler.pos + i + 2] = c & 255;\n }\n this.setHintStickers(\n filler,\n faceletMeshAppearance !== \"invisible\" && !this.isDup,\n );\n }\n\n public addUVs(filler: Filler): void {\n const uvs = filler.uvs!;\n const vert = filler.vertices;\n const coords = new Array(3);\n for (let i = 3 * this.stickerStart; i < 3 * this.stickerEnd; i++) {\n coords[0] = vert[3 * i];\n coords[1] = vert[3 * i + 1];\n coords[2] = vert[3 * i + 2];\n const uv = filler.tm.getuv(this.faceNum, coords);\n uvs[2 * i] = uv[0];\n uvs[2 * i + 1] = uv[1];\n }\n for (let i = 3 * this.hintStart; i < 3 * this.hintEnd; i++) {\n coords[0] = vert[3 * i];\n coords[1] = vert[3 * i + 1];\n coords[2] = vert[3 * i + 2];\n const uv = filler.tm.getuv(this.faceNum, coords);\n uvs[2 * i] = uv[0];\n uvs[2 * i + 1] = uv[1];\n }\n }\n\n public setTexture(filler: Filler, sd: StickerDef): number {\n if (this.texturePtr === sd) {\n return 0;\n }\n this.texturePtr = sd;\n const sz = 6 * filler.sz;\n filler.uvs!.copyWithin(\n 6 * this.stickerStart,\n 6 * sd.stickerStart + sz,\n 6 * sd.stickerEnd + sz,\n );\n filler.uvs!.copyWithin(\n 6 * this.hintStart,\n 6 * sd.hintStart + sz,\n 6 * sd.hintEnd + sz,\n );\n return 1;\n }\n\n public setColor(filler: Filler, sd: StickerDef): number {\n const c = sd.origColorAppearance;\n if (this.faceColor !== c) {\n this.faceColor = c;\n const sz = filler.pos;\n filler.colors.copyWithin(\n 9 * this.stickerStart,\n 9 * sd.stickerStart + sz,\n 9 * sd.stickerEnd + sz,\n );\n filler.colors.copyWithin(\n 9 * this.hintStart,\n 9 * sd.hintStart + sz,\n 9 * sd.hintEnd + sz,\n );\n return 1;\n } else {\n return 0;\n }\n }\n}\n\nclass HitPlaneDef {\n public cubie: Group;\n private geo: BufferGeometry;\n constructor(hitface: any, tm: TextureMapper, stickerDat: StickerDat) {\n this.cubie = new Group();\n const coords = hitface.coords as number[];\n const filler = new Filler(coords.length / 3 - 2, tm);\n for (let g = 1; 3 * g + 3 < coords.length; g++) {\n filler.addUncolored(coords, 0);\n filler.addUncolored(coords, g);\n filler.addUncolored(coords, g + 1);\n }\n this.geo = new BufferGeometry();\n filler.setAttributes(this.geo);\n const obj = new Mesh(this.geo, invisMaterial);\n obj.userData.quantumMove = stickerDat.notationMapper.notationToExternal(\n new Move(hitface.name),\n );\n this.cubie.scale.setScalar(0.99);\n this.cubie.add(obj);\n }\n}\n\nclass AxisInfo {\n public axis: Vector3;\n public order: number;\n constructor(axisDat: StickerDatAxis) {\n const vec = axisDat.coordinates;\n this.axis = new Vector3(vec[0], vec[1], vec[2]);\n this.order = axisDat.order;\n }\n}\n\nexport interface PG3DOptions {\n appearance?: ExperimentalPuzzleAppearance;\n}\n\nconst DEFAULT_COLOR_FRACTION = 0.71;\nconst PG_SCALE = 0.5;\n\n// TODO: Split into \"scene model\" and \"view\".\n/*\n * PG3D uses a single geometry for the puzzle, with all the faces for\n * each sticker (including the foundation stickers) in a single\n * geometry. We use the materialIndex in the face to point to a\n * specific entry, which is either a colored sticker, invisible, or\n * black (foundation).\n *\n * To support general twisting of a subset of the puzzle, we then\n * instantiate this same geometry in two different meshes with two\n * distinct material arrays. One, the fixed mesh, has the material\n * array set up like: [colored, invisible, black, invisible].\n * The twisting mesh has the material array set up as\n * [invisible, colored, invislble, black]. When not twisted, the\n * two meshes are directly coincident, and the (shared) materialIndex\n * in each face points to a non-invisible material in exactly one of\n * the two meshes. When we decide to twist some cubies, we make\n * the cubies that move point to visible materials in the moving\n * mesh (which makes them point to invisible materials in the static\n * mesh). This way, we only need to rotate the moving mesh as a\n * single object---this should be very fast, and occur entirely in\n * the GPU. Unfortunately this doesn't quite work as fast as we'd\n * like because three.js makes a draw call every time we have a change\n * in the material index. By moving the foundation triangles separate\n * from the sticker triangles, we enhance the probability that many\n * triangles can be rendered in one call speeding up the render.\n * We also get some assistance from puzzleGeometry to try to keep\n * nearby stickers close to each other.\n */\nexport class PG3D extends Object3D implements Twisty3DPuzzle {\n private stickers: { [key: string]: StickerDef[][] };\n private axesInfo: { [key: string]: AxisInfo };\n\n private stickerTargets: Object3D[] = [];\n private controlTargets: Object3D[] = [];\n\n private movingObj: Object3D;\n private filler: Filler;\n private foundationBound: number; // before this: colored; after: black\n private fixedGeo: BufferGeometry;\n private lastPos: PuzzlePosition;\n private lastMove: Transformation;\n private hintMaterial: Material;\n private stickerMaterial: Material;\n private materialArray1: Material[];\n private materialArray2: Material[];\n private textured: boolean = false;\n private showHintStickers: boolean = false;\n private showFoundations: boolean = false;\n private hintMaterialDisposable: boolean;\n private stickerMaterialDisposable: boolean;\n\n #pendingStickeringUpdate: boolean = false;\n\n constructor(\n private scheduleRenderCallback: () => void,\n private definition: KPuzzleDefinition,\n private stickerDat: StickerDat,\n enableFoundationOpt: boolean = false,\n enableHintStickersOpt: boolean = false,\n hintStickerHeightScale: number = 1,\n private params: PG3DOptions = {},\n ) {\n super();\n if (stickerDat.stickers.length === 0) {\n throw Error(\"Reuse of stickerdat from pg; please don't do that.\");\n }\n this.hintMaterial = new MeshBasicMaterial({\n vertexColors: true,\n transparent: true,\n opacity: 0.5,\n });\n this.hintMaterialDisposable = true;\n this.stickerMaterial = basicStickerMaterial;\n this.stickerMaterialDisposable = false;\n this.axesInfo = {};\n const axesDef = this.stickerDat.axis;\n for (const axis of axesDef) {\n this.axesInfo[axis.quantumMove.family] = new AxisInfo(axis);\n }\n const stickers = this.stickerDat.stickers as any[];\n this.stickers = {};\n this.materialArray1 = new Array(8);\n this.materialArray2 = new Array(8);\n // TODO: the argument enableFoundationOpt really means, do we ever want to display\n // foundations. But it is presently *used* to mean, show foundations initially\n // (and maybe experimentalSetAppearance changes this). So for now we set up the\n // show flag from the enable flag, and turn on the enable flag so later when it's\n // used we will get the foundations. What this means is the geometry always \"pays\"\n // for foundations, even if they aren't displayed.\n this.showFoundation(enableFoundationOpt);\n enableFoundationOpt = true;\n let triangleCount = 0;\n const multiplier = 3;\n for (const sticker of stickers) {\n const sides = sticker.coords.length / 3;\n triangleCount += multiplier * (sides - 2);\n }\n const filler = new Filler(triangleCount, stickerDat.textureMapper);\n const black = 0;\n const normals: number[][] = [];\n let totArea = 0;\n for (const f of stickerDat.faces) {\n normals.push(normal(f.coords));\n totArea += polyarea(f.coords);\n }\n const colorfrac = DEFAULT_COLOR_FRACTION;\n let nonDupStickers = 0;\n for (const sticker of stickers) {\n if (!sticker.isDup) {\n nonDupStickers++;\n }\n }\n const trim =\n (Math.sqrt(totArea / nonDupStickers) * (1 - Math.sqrt(colorfrac))) / 2;\n for (const sticker of stickers) {\n const orbit = sticker.orbit;\n const ord = sticker.ord;\n const ori = sticker.ori;\n if (!this.stickers[orbit]) {\n this.stickers[orbit] = [];\n }\n if (!this.stickers[orbit][ori]) {\n this.stickers[orbit][ori] = [];\n }\n const options: { appearance?: ExperimentalFaceletMeshAppearance } = {};\n if (params.appearance) {\n options.appearance = experimentalGetFaceletAppearance(\n params.appearance,\n orbit,\n ord,\n ori,\n false,\n );\n }\n const stickerdef = new StickerDef(filler, sticker, trim, options);\n this.stickers[orbit][ori][ord] = stickerdef;\n }\n // TODO: the argument enableHintStickersOpt really means, do we ever want to display\n // hint stickers. But it is presently *used* to mean, show hint stickers initially\n // (and maybe experimentalSetAppearance changes this). So for now we set up the\n // show flag from the enable flag, and turn on the enable flag so later when it's\n // used we will get the hint stickers. What this means is the geometry always \"pays\"\n // for hint stickers, even if they aren't displayed.\n this.showHintStickers = enableHintStickersOpt;\n enableHintStickersOpt = true;\n for (const sticker of stickers) {\n const orbit = sticker.orbit;\n const ord = sticker.ord;\n const ori = sticker.ori;\n this.stickers[orbit][ori][ord].addHint(\n filler,\n sticker,\n enableHintStickersOpt,\n hintStickerHeightScale,\n trim,\n normals[sticker.face],\n );\n }\n this.foundationBound = filler.ipos;\n for (const sticker of stickers) {\n const orbit = sticker.orbit;\n const ord = sticker.ord;\n const ori = sticker.ori;\n if (enableFoundationOpt) {\n this.stickers[orbit][ori][ord].addFoundation(filler, sticker, black);\n }\n }\n const fixedGeo = new BufferGeometry();\n filler.setAttributes(fixedGeo);\n filler.makeGroups(fixedGeo);\n const obj = new Mesh(fixedGeo, this.materialArray1);\n obj.scale.set(PG_SCALE, PG_SCALE, PG_SCALE);\n this.add(obj);\n const obj2 = new Mesh(fixedGeo, this.materialArray2);\n obj2.scale.set(PG_SCALE, PG_SCALE, PG_SCALE);\n this.add(obj2);\n const hitfaces = this.stickerDat.faces as any[];\n this.movingObj = obj2;\n this.fixedGeo = fixedGeo;\n this.filler = filler;\n for (const hitface of hitfaces) {\n const facedef = new HitPlaneDef(\n hitface,\n stickerDat.textureMapper,\n this.stickerDat,\n );\n facedef.cubie.scale.set(PG_SCALE, PG_SCALE, PG_SCALE);\n this.add(facedef.cubie);\n this.controlTargets.push(facedef.cubie.children[0]);\n }\n filler.saveOriginalColors();\n stickerDat.stickers = []; // don't need these anymore\n this.updateMaterialArrays();\n /*\n this.experimentalUpdateTexture(\n true,\n new TextureLoader().load(\n \"/experiments.cubing.net/cubing.js/twisty/mkbhd-sprite-red.png\",\n ),\n new TextureLoader().load(\n \"/experiments.cubing.net/cubing.js/twisty/mkbhd-sprite-red-hint.png\",\n ),\n );\n */\n }\n\n public dispose(): void {\n if (this.fixedGeo) {\n this.fixedGeo.dispose();\n }\n if (this.stickerMaterialDisposable) {\n this.stickerMaterial.dispose();\n this.stickerMaterial = basicStickerMaterial;\n this.stickerMaterialDisposable = false;\n }\n if (this.hintMaterialDisposable) {\n this.hintMaterial.dispose();\n this.hintMaterial = basicStickerMaterial;\n this.hintMaterialDisposable = false;\n }\n }\n\n public experimentalGetStickerTargets(): Object3D[] {\n return this.stickerTargets;\n }\n\n public experimentalGetControlTargets(): Object3D[] {\n return this.controlTargets;\n }\n\n #cachedKPuzzle: KPuzzle | null;\n get #kpuzzle() {\n return (this.#cachedKPuzzle ??= new KPuzzle(this.definition));\n }\n #isValidMove(move: Move): boolean {\n try {\n this.#kpuzzle.applyMove(move);\n return true;\n } catch (_) {\n return false;\n }\n }\n\n getClosestMoveToAxis(\n point: Vector3,\n transformations: {\n invert: boolean;\n depth?: \"secondSlice\" | \"rotation\" | \"none\";\n },\n ): { move: Move; order: number } | null {\n let closestMove: Move | null = null;\n let closestMoveDotProduct: number = 0;\n\n let modify: (move: Move) => Move = (m) => m;\n switch (transformations.depth) {\n case \"secondSlice\":\n modify = (m: Move) => m.modified({ innerLayer: 2 });\n break;\n case \"rotation\":\n modify = (m: Move) => m.modified({ family: m.family + \"v\" });\n break;\n }\n\n for (const axis of this.stickerDat.axis) {\n const product = point.dot(new Vector3(...axis.coordinates));\n if (product > closestMoveDotProduct) {\n const modified = this.stickerDat.notationMapper.notationToExternal(\n modify(axis.quantumMove),\n );\n if (!modified) {\n continue;\n }\n if (this.#isValidMove(modified)) {\n closestMoveDotProduct = product;\n closestMove = modified;\n }\n }\n }\n\n if (!closestMove) {\n return null;\n }\n\n if (transformations.invert) {\n closestMove = closestMove.invert();\n }\n // TODO: cache order or make this lookup more efficient.\n this.#kpuzzle.reset();\n this.#kpuzzle.applyMove(closestMove);\n const order = transformationOrder(this.definition, this.#kpuzzle.state);\n return { move: closestMove, order }; // TODO: push this down\n }\n\n experimentalSetAppearance(appearance: ExperimentalPuzzleAppearance): void {\n this.params.appearance = appearance;\n for (const orbitName in this.definition.orbits) {\n const { numPieces, orientations } = this.definition.orbits[orbitName];\n for (let pieceIdx = 0; pieceIdx < numPieces; pieceIdx++) {\n for (let faceletIdx = 0; faceletIdx < orientations; faceletIdx++) {\n const faceletAppearance = experimentalGetFaceletAppearance(\n appearance,\n orbitName,\n pieceIdx,\n faceletIdx,\n false,\n );\n const stickerDef = this.stickers[orbitName][faceletIdx][pieceIdx];\n stickerDef.setAppearance(this.filler, faceletAppearance);\n }\n }\n }\n if (this.scheduleRenderCallback) {\n this.#pendingStickeringUpdate = true;\n if (this.lastPos) {\n this.onPositionChange(this.lastPos);\n }\n this.scheduleRenderCallback();\n }\n }\n\n public onPositionChange(p: PuzzlePosition): void {\n const state = p.state;\n const noRotation = new Euler();\n this.movingObj.rotation.copy(noRotation);\n let colormods = 0;\n const filler = this.filler;\n const ind = filler.ind;\n if (\n !this.lastPos ||\n this.#pendingStickeringUpdate ||\n !areTransformationsEquivalent(this.definition, this.lastPos.state, state)\n ) {\n for (const orbit in this.stickers) {\n const pieces = this.stickers[orbit];\n const pos2 = state[orbit];\n const orin = pieces.length;\n if (orin === 1) {\n const pieces2 = pieces[0];\n for (let i = 0; i < pieces2.length; i++) {\n const ni = pos2.permutation[i];\n if (this.textured) {\n colormods += pieces2[i].setTexture(filler, pieces2[ni]);\n } else {\n colormods += pieces2[i].setColor(filler, pieces2[ni]);\n }\n }\n } else {\n for (let ori = 0; ori < orin; ori++) {\n const pieces2 = pieces[ori];\n for (let i = 0; i < pieces2.length; i++) {\n const nori = (ori + orin - pos2.orientation[i]) % orin;\n const ni = pos2.permutation[i];\n if (this.textured) {\n colormods += pieces2[i].setTexture(filler, pieces[nori][ni]);\n } else {\n colormods += pieces2[i].setColor(filler, pieces[nori][ni]);\n }\n }\n }\n }\n }\n this.lastPos = p;\n this.#pendingStickeringUpdate = false;\n }\n let vismods = 0;\n for (const moveProgress of p.movesInProgress) {\n const externalMove = moveProgress.move;\n // TODO: unswizzle goes external to internal, and so does the call after that\n // and so does the stateForBlockMove call\n const unswizzled = this.stickerDat.unswizzle(externalMove);\n const move =\n this.stickerDat.notationMapper.notationToInternal(externalMove);\n if (move === null) {\n throw Error(\"Bad blockmove \" + externalMove.family);\n }\n const quantumTransformation = experimentalTransformationForQuantumMove(\n this.definition,\n externalMove.quantum,\n );\n const ax = this.axesInfo[unswizzled];\n const turnNormal = ax.axis;\n const angle =\n (-this.ease(moveProgress.fraction) *\n moveProgress.direction *\n move.amount *\n TAU) /\n ax.order;\n this.movingObj.rotateOnAxis(turnNormal, angle);\n if (this.lastMove !== quantumTransformation) {\n for (const orbit in this.stickers) {\n const pieces = this.stickers[orbit];\n const orin = pieces.length;\n const bmv = quantumTransformation[orbit];\n for (let ori = 0; ori < orin; ori++) {\n const pieces2 = pieces[ori];\n for (let i = 0; i < pieces2.length; i++) {\n const p2 = pieces2[i];\n const ni = bmv.permutation[i];\n let tv = 0;\n if (ni !== i || bmv.orientation[i] !== 0) {\n tv = 1;\n }\n if (tv !== p2.twistVal) {\n if (tv) {\n for (let j = p2.stickerStart; j < p2.stickerEnd; j++) {\n ind[j] |= 1;\n }\n for (let j = p2.hintStart; j < p2.hintEnd; j++) {\n ind[j] |= 1;\n }\n for (let j = p2.foundationStart; j < p2.foundationEnd; j++) {\n ind[j] |= 1;\n }\n } else {\n for (let j = p2.stickerStart; j < p2.stickerEnd; j++) {\n ind[j] &= ~1;\n }\n for (let j = p2.hintStart; j < p2.hintEnd; j++) {\n ind[j] &= ~1;\n }\n for (let j = p2.foundationStart; j < p2.foundationEnd; j++) {\n ind[j] &= ~1;\n }\n }\n p2.twistVal = tv;\n vismods++;\n }\n }\n }\n }\n this.lastMove = quantumTransformation;\n }\n }\n if (vismods) {\n this.filler.makeGroups(this.fixedGeo);\n }\n if (colormods) {\n if (this.textured) {\n (this.fixedGeo.getAttribute(\"uv\") as BufferAttribute).updateRange = {\n offset: 0,\n count: 6 * this.foundationBound,\n };\n (this.fixedGeo.getAttribute(\"uv\") as BufferAttribute).needsUpdate =\n true;\n } else {\n (this.fixedGeo.getAttribute(\"color\") as BufferAttribute).updateRange = {\n offset: 0,\n count: 9 * this.foundationBound,\n };\n (this.fixedGeo.getAttribute(\"color\") as BufferAttribute).needsUpdate =\n true;\n }\n }\n this.scheduleRenderCallback();\n }\n\n private ease(fraction: number): number {\n return smootherStep(fraction);\n }\n\n private showHintFacelets(v: boolean) {\n this.showHintStickers = v;\n }\n\n private updateMaterialArrays() {\n for (let i = 0; i < 8; i++) {\n this.materialArray1[i] = invisMaterial;\n this.materialArray2[i] = invisMaterial;\n }\n this.materialArray1[0] = this.stickerMaterial;\n this.materialArray2[1] = this.stickerMaterial;\n if (this.showHintStickers) {\n this.materialArray1[2] = this.hintMaterial;\n this.materialArray2[3] = this.hintMaterial;\n } else {\n this.materialArray1[2] = invisMaterial;\n this.materialArray2[3] = invisMaterial;\n }\n if (this.showFoundations) {\n this.materialArray1[6] = foundationMaterial;\n this.materialArray2[7] = foundationMaterial;\n } else {\n this.materialArray1[6] = invisMaterial;\n this.materialArray2[7] = invisMaterial;\n }\n }\n\n private showFoundation(v: boolean) {\n this.showFoundations = v;\n }\n\n private setHintStickerOpacity(v: number): void {\n if (this.hintMaterialDisposable) {\n this.hintMaterial.dispose();\n this.hintMaterialDisposable = false;\n }\n console.log(\"hint sticker opacity \" + v);\n if (v === 0) {\n this.hintMaterial = invisMaterial;\n } else if (v === 1) {\n this.hintMaterial = this.stickerMaterial;\n } else {\n this.hintMaterial = new MeshBasicMaterial({\n vertexColors: true,\n transparent: true,\n opacity: 0.5,\n });\n this.hintMaterialDisposable = true;\n }\n }\n\n public experimentalUpdateOptions(options: {\n showMainStickers?: boolean;\n hintFacelets?: HintFaceletStyle;\n showFoundation?: boolean; // TODO: better name\n hintStickerOpacity?: number;\n }): void {\n if (options.hintFacelets !== undefined) {\n this.showHintFacelets(options.hintFacelets !== \"none\");\n }\n if (options.showFoundation !== undefined) {\n this.showFoundation(options.showFoundation);\n }\n if (options.hintStickerOpacity !== undefined) {\n this.setHintStickerOpacity(options.hintStickerOpacity);\n }\n this.#pendingStickeringUpdate = true;\n if (this.lastPos) {\n this.onPositionChange(this.lastPos);\n }\n this.updateMaterialArrays();\n this.scheduleRenderCallback();\n }\n\n private adduvs() {\n const filler = this.filler;\n if (filler.uvs) {\n return;\n }\n this.filler.uvs = new Float32Array(12 * filler.sz);\n for (const orbit in this.stickers) {\n const pieces = this.stickers[orbit];\n const orin = pieces.length;\n for (let ori = 0; ori < orin; ori++) {\n const pieces2 = pieces[ori];\n for (const piece2 of pieces2) {\n piece2.addUVs(this.filler);\n }\n }\n }\n filler.uvs!.copyWithin(6 * filler.sz, 0, 6 * filler.sz);\n const sa1 = filler.uvs!.subarray(0, 6 * filler.sz);\n this.fixedGeo.setAttribute(\"uv\", new BufferAttribute(sa1, 2, true));\n }\n\n public experimentalUpdateTexture(\n enabled: boolean,\n stickerTexture?: Texture | null,\n hintTexture?: Texture | null,\n ) {\n if (!stickerTexture) {\n enabled = false;\n } else if (!hintTexture) {\n hintTexture = stickerTexture;\n }\n if (enabled && !this.filler.uvs) {\n this.adduvs();\n }\n this.textured = enabled;\n if (this.stickerMaterialDisposable) {\n this.stickerMaterial.dispose();\n this.stickerMaterialDisposable = false;\n }\n if (enabled) {\n this.stickerMaterial = new MeshBasicMaterial({\n map: stickerTexture,\n side: FrontSide,\n transparent: false,\n });\n this.stickerMaterialDisposable = true;\n } else {\n this.stickerMaterial = basicStickerMaterial;\n }\n if (this.hintMaterialDisposable) {\n this.hintMaterial.dispose();\n this.hintMaterialDisposable = false;\n }\n if (enabled) {\n this.hintMaterial = new MeshBasicMaterial({\n map: hintTexture,\n side: FrontSide,\n transparent: false,\n });\n this.hintMaterialDisposable = true;\n } else {\n this.hintMaterial = basicStickerMaterial;\n }\n this.updateMaterialArrays();\n this.#pendingStickeringUpdate = true;\n if (this.lastPos) {\n this.onPositionChange(this.lastPos);\n }\n this.scheduleRenderCallback();\n }\n}\n", "import { Scene as ThreeScene } from \"three\";\nimport type { Twisty3DPuzzle } from \"./puzzles/Twisty3DPuzzle\";\nimport type { Twisty3DRenderTarget } from \"./Twisty3DRenderTarget\";\n\nexport class Twisty3DScene extends ThreeScene implements Twisty3DRenderTarget {\n private renderTargets: Set<Twisty3DRenderTarget> = new Set();\n public twisty3Ds: Set<Twisty3DPuzzle> = new Set();\n\n constructor() {\n super();\n }\n\n addRenderTarget(renderTarget: Twisty3DRenderTarget): void {\n this.renderTargets.add(renderTarget);\n }\n\n scheduleRender(): void {\n for (const renderTarget of this.renderTargets) {\n renderTarget.scheduleRender();\n }\n }\n\n addTwisty3DPuzzle(twisty3DPuzzle: Twisty3DPuzzle): void {\n this.twisty3Ds.add(twisty3DPuzzle);\n this.add(twisty3DPuzzle);\n // TODO: scheduleRender?\n }\n\n removeTwisty3DPuzzle(twisty3DPuzzle: Twisty3DPuzzle): void {\n this.twisty3Ds.delete(twisty3DPuzzle);\n this.remove(twisty3DPuzzle);\n // TODO: scheduleRender?\n }\n\n clearPuzzles(): void {\n for (const puz of this.twisty3Ds) {\n this.remove(puz);\n }\n this.twisty3Ds.clear();\n // TODO: scheduleRender?\n }\n}\n", "import { cube3x3x3, PuzzleLoader } from \"../../../puzzles\";\nimport type { HintFaceletStyle } from \"../../model/props/puzzle/display/HintFaceletProp\";\nimport { Cube3D, Cube3DOptions } from \"../../views/3D/puzzles/Cube3D\";\nimport { PG3D } from \"../../views/3D/puzzles/PG3D\";\n\n// Mangled to avoid autocompleting.\n// This must not be imported directly.\nexport * as T3I from \"three\";\nexport { Cube3D } from \"../../views/3D/puzzles/Cube3D\";\nexport { PG3D } from \"../../views/3D/puzzles/PG3D\";\nexport { Twisty3DScene } from \"../../views/3D/Twisty3DScene\";\n\nexport async function cube3DShim(options?: Cube3DOptions): Promise<Cube3D> {\n const renderCallbackShim = () => {};\n return new Cube3D(await cube3x3x3.def(), renderCallbackShim, options);\n}\n\n// TODO: take loader?\nexport async function pg3dShim(\n puzzleLoader: PuzzleLoader,\n hintFacelets: HintFaceletStyle,\n): Promise<PG3D> {\n const renderCallbackShim = () => {};\n return new PG3D(\n renderCallbackShim,\n await puzzleLoader.def(),\n (await puzzleLoader.pg!()).get3d(),\n true,\n hintFacelets === \"floating\",\n );\n}\n", "/* eslint-disable @typescript-eslint/no-var-requires */\n\nimport { Alg } from \"../cubing/alg\";\nimport { transformationOrder } from \"../cubing/kpuzzle\";\nimport { getPuzzleGeometryByName } from \"../cubing/puzzle-geometry\";\nimport { KSolvePuzzle, TreeAlgIndexer } from \"../cubing/twisty\";\n\n/*\n * Given a puzzle name and an algorithm, calculate the order of that\n * algorithm (how many repetitions are needed for the algorithm to be\n * the no-op).\n */\n\nconst puzname = process.argv[2];\nconst algo = process.argv[3];\n\n/*\n * Turn a name into a geometry.\n */\nconst pg = getPuzzleGeometryByName(puzname, { allMoves: true });\n/*\n * Turn the puzzle geometry into a KPuzzleDefinition.\n */\nconst puzzle = pg.writekpuzzle();\n/*\n * From the operable puzzle, make a twisty. The twisty gives us\n * access to an algorithm indexer. This is a good way to get\n * support for repetitions and conjugates in the algorithm.\n */\nconst ksp = new KSolvePuzzle(puzzle);\n/*\n * We parse the algorithm and get an indexer.\n */\nconst parsedAlgo = new Alg(algo);\nconst tai = new TreeAlgIndexer(ksp, parsedAlgo);\n/*\n * Then, we get the transform (not the state!) at the end of the\n * algorithm.\n */\nconst tr = tai.transformAtIndex(tai.numAnimatedLeaves());\n/*\n * We calculate its order and display it.\n */\nconst o = transformationOrder(puzzle, tr as any);\nconsole.log(o);\n", "import type { Move } from \"../../alg\";\nimport type { Transformation as KPuzzleState } from \"../../kpuzzle\";\n\nexport type MillisecondTimestamp = number;\n\n// TODO: unify duration/timstamp types\nexport type Duration = MillisecondTimestamp; // Duration in milliseconds\n// TODO: Extend `number`, introduce MoveSequenceTimestamp vs. EpochTimestamp,\n// force Duration to be a difference.\nexport type Timestamp = MillisecondTimestamp; // Duration since a particular epoch.\n\nexport type Fraction = number; // Value from 0 to 1.\n\n// 1, 0, -1 are used as scalars for `directionScalar` below.\nexport enum Direction {\n Forwards = 1,\n Paused = 0,\n Backwards = -1,\n}\n\nexport function directionScalar(direction: Direction): MillisecondTimestamp {\n return direction;\n}\n\nexport interface MoveInProgress {\n move: Move;\n direction: Direction;\n fraction: number;\n}\n\nexport type PuzzlePosition = {\n state: KPuzzleState;\n movesInProgress: MoveInProgress[];\n};\n\nexport enum BoundaryType {\n Move = \"move\",\n EntireTimeline = \"entire-timeline\",\n}\n\nexport interface TimeRange {\n start: MillisecondTimestamp;\n end: MillisecondTimestamp;\n}\n\n// export type DurationForAmount = (amount: number) => Duration;\n\nexport interface PositionListener {\n onPositionChange(position: PuzzlePosition): void;\n}\n", "// Debounces `requestAnimationFrame()`.\nexport class RenderScheduler {\n private animFrameID: number | null = null;\n private animFrame = this.animFrameWrapper.bind(this);\n constructor(private callback: (timestamp: DOMHighResTimeStamp) => void) {}\n requestAnimFrame(): void {\n if (!this.animFrameID) {\n this.animFrameID = requestAnimationFrame(this.animFrame);\n }\n }\n\n cancelAnimFrame(): void {\n if (this.animFrameID) {\n cancelAnimationFrame(this.animFrameID);\n this.animFrameID = 0;\n }\n }\n\n private animFrameWrapper(timestamp: DOMHighResTimeStamp): void {\n this.animFrameID = 0;\n this.callback(timestamp);\n }\n}\n\n// An interface for classes to use to expose their scheduling.\nexport interface Schedulable {\n scheduleRender(): void;\n}\n", "import {\n BoundaryType,\n Direction,\n directionScalar,\n MillisecondTimestamp,\n TimeRange,\n} from \"./AnimationTypes\";\nimport { RenderScheduler } from \"./RenderScheduler\";\nimport type {\n PlayingInfo,\n SimpleDirection,\n} from \"../model/props/timeline/PlayingInfoProp\";\nimport type { TwistyPlayerModel } from \"../model/TwistyPlayerModel\";\nimport { StaleDropper } from \"../model/PromiseFreshener\";\nimport type { CurrentMoveInfo } from \"./indexer/AlgIndexer\";\nimport type { TimestampRequest } from \"../model/props/timeline/TimestampRequestProp\";\nimport { modIntoRange } from \"../model/helpers\";\nimport type { CatchUpMove } from \"../model/props/puzzle/state/CatchUpMoveProp\";\n\n// TODO: Figure out a better way for the controller to instruct the player.\nexport interface TwistyAnimationControllerDelegate {\n flash(): void;\n}\n\n// We use a separate helper to separate the anim frame callbacks (and their cancellations).\n// TODO: fold this into the main controller\nclass CatchUpHelper {\n catchingUp: boolean = false;\n pendingFrame = false;\n\n constructor(private model: TwistyPlayerModel) {}\n\n private scheduler: RenderScheduler = new RenderScheduler(\n this.animFrame.bind(this),\n );\n\n start(): void {\n if (!this.catchingUp) {\n this.lastTimestamp = performance.now();\n }\n this.catchingUp = true;\n this.pendingFrame = true;\n this.scheduler.requestAnimFrame();\n }\n\n stop(): void {\n this.catchingUp = false;\n this.scheduler.cancelAnimFrame();\n }\n\n catchUpMs = 500;\n lastTimestamp = 0;\n animFrame(timestamp: MillisecondTimestamp): void {\n this.scheduler.requestAnimFrame();\n const delta = (timestamp - this.lastTimestamp) / this.catchUpMs;\n this.lastTimestamp = timestamp;\n\n this.model.catchUpMoveProp.set(\n (async () => {\n const previousCatchUpMove = await this.model.catchUpMoveProp.get();\n if (previousCatchUpMove.move === null) {\n return previousCatchUpMove;\n }\n\n const amount = previousCatchUpMove.amount + delta; // TODO: use tempo scale?\n if (amount >= 1) {\n this.pendingFrame = true;\n this.stop();\n this.model.timestampRequestProp.set(\"end\");\n return {\n move: null,\n amount: 0,\n };\n }\n this.pendingFrame = false;\n return {\n move: previousCatchUpMove.move,\n amount: amount,\n };\n })(),\n );\n }\n}\n\n// This controls the logic for animation, so that the main controller can focus on the right API abstractions.\nexport class TwistyAnimationController {\n // TODO: #private?\n private playing: boolean = false;\n private direction: Direction = Direction.Forwards;\n\n private catchUpHelper: CatchUpHelper;\n\n private model: TwistyPlayerModel;\n\n private lastDatestamp: MillisecondTimestamp = 0;\n private lastTimestampPromise: Promise<MillisecondTimestamp>;\n\n private scheduler: RenderScheduler = new RenderScheduler(\n this.animFrame.bind(this),\n );\n\n constructor(\n model: TwistyPlayerModel,\n private delegate: TwistyAnimationControllerDelegate,\n ) {\n this.model = model;\n this.lastTimestampPromise = this.#effectiveTimestampMilliseconds();\n\n this.model.playingInfoProp.addFreshListener(this.onPlayingProp.bind(this)); // TODO\n\n this.catchUpHelper = new CatchUpHelper(this.model);\n this.model.catchUpMoveProp.addFreshListener(\n this.onCatchUpMoveProp.bind(this),\n ); // TODO\n }\n\n // TODO: Do we need this?\n async onPlayingProp(playingInfo: PlayingInfo): Promise<void> {\n if (playingInfo.playing !== this.playing) {\n playingInfo.playing ? this.play(playingInfo) : this.pause();\n }\n }\n\n // TODO: Do we need this?\n async onCatchUpMoveProp(catchUpMove: CatchUpMove): Promise<void> {\n const catchingUp = catchUpMove.move !== null;\n if (catchingUp !== this.catchUpHelper.catchingUp) {\n catchingUp ? this.catchUpHelper.start() : this.catchUpHelper.stop();\n }\n this.scheduler.requestAnimFrame();\n }\n\n async #effectiveTimestampMilliseconds(): Promise<MillisecondTimestamp> {\n return (await this.model.detailedTimelineInfoProp.get()).timestamp;\n }\n\n // TODO: Return the animation we've switched to.\n jumpToStart(options?: { flash: boolean }): void {\n this.model.timestampRequestProp.set(\"start\");\n this.pause();\n if (options?.flash) {\n this.delegate.flash();\n }\n }\n\n // TODO: Return the animation we've switched to.\n jumpToEnd(options?: { flash: boolean }): void {\n this.model.timestampRequestProp.set(\"end\");\n this.pause();\n if (options?.flash) {\n this.delegate.flash();\n }\n }\n\n // TODO: Return the playing info we've switched to.\n playPause(): void {\n if (this.playing) {\n this.pause();\n } else {\n this.play(); // TODO: Resume direction and looping behaviour?\n }\n }\n\n // TODO: bundle playing direction, and boundary into `toggle`.\n async play(options?: {\n direction?: SimpleDirection;\n untilBoundary?: BoundaryType;\n autoSkipToOtherEndIfStartingAtBoundary?: boolean; // TODO What's a good short name that doesn't imply a more general looping concept?\n loop?: boolean;\n }): Promise<void> {\n // TODO: We might need to cache all playing info?\n // Or maybe we don't have to worry about short-circuiting, since this is idempotent?\n // if (this.playing) {\n // return;\n // }\n\n const direction = options?.direction ?? Direction.Forwards;\n\n const coarseTimelineInfo = await this.model.coarseTimelineInfoProp.get(); // TODO: Why do we need to read this if we don't use it?\n if (options?.autoSkipToOtherEndIfStartingAtBoundary ?? true) {\n if (direction === Direction.Forwards && coarseTimelineInfo.atEnd) {\n this.model.timestampRequestProp.set(\"start\");\n this.delegate.flash();\n }\n if (direction === Direction.Backwards && coarseTimelineInfo.atStart) {\n this.model.timestampRequestProp.set(\"end\");\n this.delegate.flash();\n }\n }\n this.model.playingInfoProp.set({\n playing: true,\n direction,\n untilBoundary: options?.untilBoundary ?? BoundaryType.EntireTimeline,\n loop: options?.loop ?? false,\n });\n\n this.playing = true;\n this.lastDatestamp = performance.now(); // TODO: Take from event.\n this.lastTimestampPromise = this.#effectiveTimestampMilliseconds();\n\n // TODO: Save timestamp from model?\n this.scheduler.requestAnimFrame();\n }\n\n pause(): void {\n this.playing = false;\n this.scheduler.cancelAnimFrame();\n this.model.playingInfoProp.set({\n playing: false,\n untilBoundary: BoundaryType.EntireTimeline,\n });\n }\n\n #animFrameEffectiveTimestampStaleDropper: StaleDropper<\n [PlayingInfo, MillisecondTimestamp, TimeRange, number, CurrentMoveInfo]\n > = new StaleDropper<\n [PlayingInfo, MillisecondTimestamp, TimeRange, number, CurrentMoveInfo]\n >();\n\n async animFrame(frameDatestamp: MillisecondTimestamp): Promise<void> {\n if (this.playing) {\n this.scheduler.requestAnimFrame();\n }\n\n const lastDatestamp = this.lastDatestamp;\n const freshenerResult =\n await this.#animFrameEffectiveTimestampStaleDropper.queue(\n Promise.all([\n this.model.playingInfoProp.get(),\n this.lastTimestampPromise,\n this.model.timeRangeProp.get(),\n this.model.tempoScaleProp.get(),\n this.model.currentLeavesProp.get(),\n ]),\n );\n\n const [playingInfo, lastTimestamp, timeRange, tempoScale, currentMoveInfo] =\n freshenerResult;\n\n // TODO: Get this without wasting time on the others?\n if (!playingInfo.playing) {\n this.playing = false;\n // TODO: Ideally we'd cancel the anim frame from the top of this method.\n // But `this.scheduler.cancelAnimFrame();` might accidentally cancel a\n // legit freshly scheduled frame. We should modify `RenderScheduler` to\n // either have individually cancellable requests, or to have something\n // like a \"default\" anim frame re-request that can be canceled separately.\n //\n // Note that we can't wait until here to call\n // `this.scheduler.requestAnimFrame();`, because that would slow down the\n // frame rate.\n return;\n }\n\n let end = currentMoveInfo.earliestEnd; // timeRange.end\n if (\n currentMoveInfo.currentMoves.length === 0 ||\n playingInfo.untilBoundary === BoundaryType.EntireTimeline\n ) {\n end = timeRange.end;\n }\n\n let start = currentMoveInfo.latestStart; // timeRange.end\n if (\n currentMoveInfo.currentMoves.length === 0 ||\n playingInfo.untilBoundary === BoundaryType.EntireTimeline\n ) {\n start = timeRange.start;\n }\n // const start = currentMoveInfo.latestStart; // timeRange.start // TODO\n\n let delta =\n (frameDatestamp - lastDatestamp) *\n directionScalar(this.direction) *\n tempoScale;\n delta = Math.max(delta, 1); // TODO: This guards against the timestamp going in the wrong direction by accident. Can we avoid it?\n delta *= playingInfo.direction;\n let newTimestamp = lastTimestamp + delta; // TODO: Pre-emptively clamp.\n let newSmartTimestampRequest: Exclude<TimestampRequest, number> | null =\n null;\n\n if (newTimestamp >= end) {\n if (playingInfo.loop) {\n newTimestamp = modIntoRange(\n newTimestamp,\n timeRange.start,\n timeRange.end,\n );\n } else {\n if (newTimestamp === timeRange.end) {\n newSmartTimestampRequest = \"end\";\n } else {\n newTimestamp = end;\n }\n this.playing = false;\n this.model.playingInfoProp.set({\n playing: false,\n });\n }\n } else if (newTimestamp <= start) {\n if (playingInfo.loop) {\n newTimestamp = modIntoRange(\n newTimestamp,\n timeRange.start,\n timeRange.end,\n );\n } else {\n if (newTimestamp === timeRange.start) {\n newSmartTimestampRequest = \"start\";\n } else {\n newTimestamp = start;\n }\n this.playing = false;\n this.model.playingInfoProp.set({\n playing: false,\n });\n }\n }\n this.lastDatestamp = frameDatestamp;\n this.lastTimestampPromise = Promise.resolve(newTimestamp); // TODO: Save this earlier? / Do we need to worry about the effecitve timestamp disagreeing?\n this.model.timestampRequestProp.set(\n newSmartTimestampRequest ?? newTimestamp,\n );\n }\n}\n", "export function arrayEquals<T>(a: readonly T[], b: readonly T[]): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nexport function arrayEqualsCompare<T>(\n a: readonly T[],\n b: readonly T[],\n compare: (a: T, b: T) => boolean,\n): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!compare(a[i], b[i])) {\n return false;\n }\n }\n return true;\n}\n\n// Assumes `offset > 0`. Will produce invalid values if not!\n// We don't check for that, since this can be a hot path.\nexport function mod(v: number, m: number, offset = 0): number {\n return (((v % m) + m + offset) % m) - offset;\n}\n\nexport function modIntoRange(\n v: number,\n rangeMin: number,\n rangeMax: number,\n): number {\n return mod(v - rangeMin, rangeMax - rangeMin) + rangeMin;\n}\n", "import type { TwistyPlayerModel } from \"../model/TwistyPlayerModel\";\nimport {\n TwistyAnimationController,\n TwistyAnimationControllerDelegate,\n} from \"./TwistyAnimationController\";\n\nexport class TwistyPlayerController {\n animationController: TwistyAnimationController;\n\n constructor(\n private model: TwistyPlayerModel,\n delegate: TwistyAnimationControllerDelegate,\n ) {\n this.animationController = new TwistyAnimationController(model, delegate);\n }\n\n jumpToStart(options?: { flash: boolean }): void {\n this.animationController.jumpToStart(options);\n }\n\n jumpToEnd(options?: { flash: boolean }): void {\n this.animationController.jumpToEnd(options);\n }\n\n togglePlay(play?: boolean) {\n if (typeof play === \"undefined\") {\n this.animationController.playPause();\n }\n play ? this.animationController.play() : this.animationController.pause();\n }\n\n public async visitTwizzleLink(): Promise<void> {\n const a = document.createElement(\"a\");\n a.href = await this.model.twizzleLink();\n a.target = \"_blank\";\n a.click();\n }\n}\n", "import { SimpleTwistyPropSource } from \"../TwistyProp\";\n\nexport const controlsLocations = {\n \"bottom-row\": true, // default\n \"none\": true,\n};\nexport type ControlsLocation = keyof typeof controlsLocations;\nexport type ControlPanelThemeWithAuto = ControlsLocation | \"auto\";\n\nexport class ControlPanelProp extends SimpleTwistyPropSource<ControlPanelThemeWithAuto> {\n getDefaultValue(): ControlPanelThemeWithAuto {\n return \"auto\";\n }\n}\n", "import type { ManagedCustomElement } from \"./ManagedCustomElement\";\n\nexport class ClassListManager<SuffixType extends string> {\n #currentClassName: string | null = null;\n // The prefix should ideally end in a dash.\n constructor(\n private elem: ManagedCustomElement,\n private prefix: string,\n private validSuffixes: SuffixType[],\n ) {}\n\n // Does nothing if there was no value.\n clearValue(): void {\n if (this.#currentClassName) {\n this.elem.contentWrapper.classList.remove(this.#currentClassName);\n }\n this.#currentClassName = null; // TODO: add test for this behaviour.\n }\n\n // Returns if the value changed\n setValue(suffix: SuffixType): boolean {\n if (!this.validSuffixes.includes(suffix)) {\n throw new Error(`Invalid suffix: ${suffix}`);\n }\n const newClassName = `${this.prefix}${suffix}`;\n const changed = this.#currentClassName !== newClassName;\n if (changed) {\n this.clearValue();\n this.elem.contentWrapper.classList.add(newClassName);\n this.#currentClassName = newClassName;\n }\n return changed;\n }\n}\n", "// Workarounds for `node`.\n// TODO: figure out how to remove this.\n\n// This stub does not need to be callable, just constructable to satisfy the `node` loader.\nclass HTMLElementStub {}\n\nlet HTMLElementShim: typeof HTMLElement;\nif (globalThis.HTMLElement) {\n HTMLElementShim = HTMLElement;\n} else {\n HTMLElementShim = HTMLElementStub as any;\n}\n\nexport { HTMLElementShim };\n\nclass CustomElementsStub {\n define(): void {\n // nothing\n }\n}\n\nlet customElementsShim: typeof customElements;\n\nif (globalThis.customElements) {\n customElementsShim = customElements;\n} else {\n customElementsShim = new CustomElementsStub() as any;\n}\n\nexport { customElementsShim };\n", "import {\n HTMLElementShim,\n customElementsShim,\n} from \"./node-custom-element-shims\";\n\nexport class CSSSource {\n constructor(private sourceText: string) {\n // TODO: Replace with adopted style sheets some day if we can.\n // const blob = new Blob([sourceText], {\n // type: \"text/utf8\",\n // });\n // this.url = URL.createObjectURL(blob);\n }\n\n getAsString(): string {\n return this.sourceText;\n }\n}\n\n// - Wrapped element\n// - Shadow root\n// - Content wrapper\nexport class ManagedCustomElement extends HTMLElementShim {\n public readonly shadow: ShadowRoot; // TODO: hide this\n public readonly contentWrapper: HTMLDivElement; // TODO: can we get rid of this wrapper?\n\n #cssSourceMap: Map<CSSSource, HTMLStyleElement> = new Map();\n constructor(options?: { mode: \"open\" | \"closed\" }) {\n super();\n this.shadow = this.attachShadow({ mode: options?.mode ?? \"closed\" });\n\n this.contentWrapper = document.createElement(\"div\");\n this.contentWrapper.classList.add(\"wrapper\");\n this.shadow.appendChild(this.contentWrapper);\n }\n\n // Add the source, if not already added.\n public addCSS(cssSource: CSSSource): void {\n if (this.#cssSourceMap.get(cssSource)) {\n return;\n }\n\n const cssElem: HTMLStyleElement = document.createElement(\"style\");\n cssElem.textContent = cssSource.getAsString();\n\n this.#cssSourceMap.set(cssSource, cssElem);\n this.shadow.appendChild(cssElem);\n }\n\n // Remove the source, if it's currently added.\n public removeCSS(cssSource: CSSSource): void {\n const cssElem = this.#cssSourceMap.get(cssSource);\n if (!cssElem) {\n return;\n }\n this.shadow.removeChild(cssElem);\n this.#cssSourceMap.delete(cssSource);\n }\n\n public addElement<T extends Node>(element: T): T {\n return this.contentWrapper.appendChild(element);\n }\n\n public prependElement<T extends Node>(element: T): void {\n this.contentWrapper.prepend(element);\n }\n\n public removeElement<T extends Node>(element: T): T {\n return this.contentWrapper.removeChild(element);\n }\n}\n\ncustomElementsShim.define(\n \"twisty-managed-custom-element\",\n ManagedCustomElement,\n);\n", "import { CSSSource } from \"./ManagedCustomElement\";\n\n// TODO: figure out why `:host(twisty-player):fullscreen { background-color: white }` doesn't work.\nexport const twistyPlayerCSS = new CSSSource(`\n:host {\n width: 384px;\n height: 256px;\n display: grid;\n\n -webkit-user-select: none;\n user-select: none;\n}\n\n.wrapper {\n display: grid;\n overflow: hidden;\n grid-template-rows: 7fr 1em 1fr;\n}\n\n.wrapper > * {\n width: inherit;\n height: inherit;\n overflow: hidden;\n}\n\n.wrapper.controls-none {\n grid-template-rows: 7fr;\n}\n\n.wrapper.controls-none twisty-scrubber,\n.wrapper.controls-none twisty-control-button-panel ,\n.wrapper.controls-none twisty-scrubber-v2,\n.wrapper.controls-none twisty-buttons-v2 {\n display: none;\n}\n\ntwisty-scrubber {\n background: rgba(196, 196, 196, 0.5);\n}\n\n.wrapper.checkered {\n background-color: #EAEAEA;\n background-image: linear-gradient(45deg, #DDD 25%, transparent 25%, transparent 75%, #DDD 75%, #DDD),\n linear-gradient(45deg, #DDD 25%, transparent 25%, transparent 75%, #DDD 75%, #DDD);\n background-size: 32px 32px;\n background-position: 0 0, 16px 16px;\n}\n\n.visualization-wrapper > * {\n width: 100%;\n height: 100%;\n}\n\n.error-elem {\n width: 100%;\n height: 100%;\n display: none;\n place-content: center;\n font-family: sans-serif;\n box-shadow: inset 0 0 2em rgb(255, 0, 0);\n color: red;\n text-shadow: 0 0 0.2em white;\n background: rgba(255, 255, 255, 0.25);\n}\n\n.wrapper.error .visualization-wrapper {\n display: none;\n}\n\n.wrapper.error .error-elem {\n display: grid;\n}\n`);\n", "import { from } from \"../../vendor/p-lazy/p-lazy\";\n\n// TODO can we remove the cached proxy?\n\n// In theory we can, but we've run into situations where imports are not properly cached.\nlet cachedConstructorProxy: Promise<\n typeof import(\"./dynamic-entries/3d\")\n> | null = null;\n\nexport async function proxy3D(): Promise<\n typeof import(\"./dynamic-entries/3d\")\n> {\n return (cachedConstructorProxy ??= import(\"./dynamic-entries/3d\"));\n}\n\nexport const THREEJS: Promise<typeof import(\"three\")> = from(\n async () => (await proxy3D()).T3I,\n);\n", "import type { Scene as ThreeScene } from \"three\";\nimport type { PuzzleLoader } from \"../../../puzzles\";\nimport { THREEJS } from \"../../heavy-code-imports/3d\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport { FreshListenerManager } from \"../../model/props/TwistyProp\";\nimport type { Schedulable } from \"../../controllers/RenderScheduler\";\nimport { ManagedCustomElement } from \"../ManagedCustomElement\";\nimport { customElementsShim } from \"../node-custom-element-shims\";\nimport { twistyViewerWrapperCSS } from \"../TwistyViewerWrapper.css\";\nimport { Twisty2DPuzzleWrapper } from \"./Twisty2DPuzzleWrapper\";\n\nexport class Twisty2DSceneWrapper\n extends ManagedCustomElement\n implements Schedulable\n{\n #freshListenerManager = new FreshListenerManager();\n disconnect(): void {\n this.#freshListenerManager.disconnect();\n }\n\n constructor(\n public model?: TwistyPlayerModel,\n private effectiveVisualization?: \"2D\" | \"experimental-2D-LL\",\n ) {\n super();\n }\n\n async connectedCallback(): Promise<void> {\n this.addCSS(twistyViewerWrapperCSS);\n if (this.model) {\n this.#freshListenerManager.addListener(\n this.model.puzzleLoaderProp,\n this.onPuzzleLoader.bind(this),\n );\n }\n }\n\n #cachedScene: Promise<ThreeScene> | null;\n async scene(): Promise<ThreeScene> {\n return (this.#cachedScene ??= (async () => new (await THREEJS).Scene())());\n }\n\n scheduleRender(): void {\n this.#currentTwisty2DPuzzleWrapper?.scheduleRender();\n }\n\n #currentTwisty2DPuzzleWrapper: Twisty2DPuzzleWrapper | null = null;\n currentTwisty2DPuzzleWrapper(): Twisty2DPuzzleWrapper | null {\n return this.#currentTwisty2DPuzzleWrapper;\n }\n\n // #oldTwisty3DPuzzleWrappers: Twisty3DPuzzleWrapper[] = []; // TODO: Animate these out.\n async setCurrentTwisty2DPuzzleWrapper(\n twisty2DPuzzleWrapper: Twisty2DPuzzleWrapper,\n ): Promise<void> {\n const old = this.#currentTwisty2DPuzzleWrapper;\n this.#currentTwisty2DPuzzleWrapper = twisty2DPuzzleWrapper;\n old?.disconnect(); // TODO: Disconnect properly.\n const twisty2DPuzzlePromise = twisty2DPuzzleWrapper.twisty2DPuzzle();\n this.contentWrapper.textContent = \"\"; // Clear existing ones.\n this.addElement(await twisty2DPuzzlePromise);\n }\n\n async onPuzzleLoader(puzzleLoader: PuzzleLoader): Promise<void> {\n this.#currentTwisty2DPuzzleWrapper?.disconnect();\n const twisty2DPuzzleWrapper = new Twisty2DPuzzleWrapper(\n this.model!,\n this,\n puzzleLoader,\n this.effectiveVisualization!,\n );\n\n this.setCurrentTwisty2DPuzzleWrapper(twisty2DPuzzleWrapper);\n }\n}\n\ncustomElementsShim.define(\"twisty-2d-scene-wrapper\", Twisty2DSceneWrapper);\n", "import { CSSSource } from \"./ManagedCustomElement\";\n\nexport const twistyViewerWrapperCSS = new CSSSource(`\n:host {\n width: 384px;\n height: 256px;\n display: grid;\n}\n\n.wrapper {\n width: 100%;\n height: 100%;\n display: grid;\n overflow: hidden;\n}\n\n.wrapper > * {\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.wrapper.back-view-side-by-side {\n grid-template-columns: 1fr 1fr;\n}\n\n.wrapper.back-view-top-right {\n grid-template-columns: 3fr 1fr;\n grid-template-rows: 1fr 3fr;\n}\n\n.wrapper.back-view-top-right > :nth-child(1) {\n grid-row: 1 / 3;\n grid-column: 1 / 3;\n}\n\n.wrapper.back-view-top-right > :nth-child(2) {\n grid-row: 1 / 2;\n grid-column: 2 / 3;\n}\n`);\n", "import type { PuzzleLoader } from \"../../../puzzles\";\nimport type { ExperimentalStickering } from \"../../../twisty\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport { FreshListenerManager } from \"../../model/props/TwistyProp\";\nimport type { Schedulable } from \"../../controllers/RenderScheduler\";\nimport { Twisty2DPuzzle } from \"./Twisty2DPuzzle\";\n\nexport class Twisty2DPuzzleWrapper implements Schedulable {\n constructor(\n private model: TwistyPlayerModel,\n public schedulable: Schedulable,\n private puzzleLoader: PuzzleLoader,\n private effectiveVisualization: \"2D\" | \"experimental-2D-LL\",\n ) {\n this.twisty2DPuzzle(); // Start constructing.\n\n this.#freshListenerManager.addListener(\n this.model.stickeringProp,\n async (stickering: ExperimentalStickering) => {\n (await this.twisty2DPuzzle()).experimentalSetStickering(stickering);\n },\n );\n }\n\n #freshListenerManager = new FreshListenerManager();\n disconnect(): void {\n this.#freshListenerManager.disconnect();\n }\n\n // TODO: Hook this up nicely.\n scheduleRender(): void {\n // Nothing\n }\n\n #cachedTwisty2DPuzzle: Promise<Twisty2DPuzzle> | null = null;\n // TODO: Stale dropper?\n async twisty2DPuzzle(): Promise<Twisty2DPuzzle> {\n return (this.#cachedTwisty2DPuzzle ??= (async () => {\n const svgPromise =\n this.effectiveVisualization === \"experimental-2D-LL\"\n ? this.puzzleLoader.llSVG!()\n : this.puzzleLoader.svg();\n return new Twisty2DPuzzle(\n this.model,\n await this.puzzleLoader.def(),\n await svgPromise,\n {},\n this.puzzleLoader,\n );\n })());\n }\n}\n", "import {\n combineTransformations,\n KPuzzleDefinition,\n KPuzzleSVGWrapper,\n transformationForMove,\n} from \"../../../kpuzzle\";\nimport type { PuzzleLoader } from \"../../../puzzles/PuzzleLoader\";\nimport type { PuzzleAppearance } from \"../../../puzzles/stickerings/appearance\";\nimport {\n Direction,\n PositionListener,\n PuzzlePosition,\n} from \"../../controllers/AnimationTypes\";\nimport { RenderScheduler } from \"../../controllers/RenderScheduler\";\nimport { ManagedCustomElement } from \"../ManagedCustomElement\";\nimport { customElementsShim } from \"../node-custom-element-shims\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport { FreshListenerManager } from \"../../model/props/TwistyProp\";\nimport { twisty2DSVGCSS } from \"./Twisty2DPuzzle.css\";\nimport type { ExperimentalStickering, PuzzleID } from \"../..\";\n\nexport interface Twisty2DPuzzleOptions {\n experimentalStickering?: ExperimentalStickering;\n}\n\n// <twisty-2d-svg>\nexport class Twisty2DPuzzle\n extends ManagedCustomElement\n implements PositionListener\n{\n private definition: KPuzzleDefinition;\n public svg: KPuzzleSVGWrapper;\n private scheduler = new RenderScheduler(this.render.bind(this));\n #cachedPosition: PuzzlePosition | null = null; // TODO: pull when needed.\n constructor(\n private model?: TwistyPlayerModel,\n def?: KPuzzleDefinition,\n private svgSource?: string,\n private options?: Twisty2DPuzzleOptions,\n private puzzleLoader?: PuzzleLoader,\n ) {\n super();\n this.addCSS(twisty2DSVGCSS);\n\n this.definition = def!;\n this.resetSVG(); // TODO: do this in `connectedCallback()`?\n\n this.#freshListenerManager.addListener(\n this.model!.puzzleIDProp,\n (puzzleID: PuzzleID) => {\n if (puzzleLoader?.id !== puzzleID) {\n this.disconnect();\n }\n },\n );\n\n this.#freshListenerManager.addListener(\n this.model!.legacyPositionProp,\n this.onPositionChange.bind(this),\n );\n\n if (this.options?.experimentalStickering) {\n this.experimentalSetStickering(this.options.experimentalStickering);\n }\n }\n\n #freshListenerManager = new FreshListenerManager();\n disconnect(): void {\n this.#freshListenerManager.disconnect();\n }\n\n onPositionChange(position: PuzzlePosition): void {\n try {\n if (position.movesInProgress.length > 0) {\n const move = position.movesInProgress[0].move;\n\n const def = this.definition;\n let partialMove = move;\n if (position.movesInProgress[0].direction === Direction.Backwards) {\n partialMove = move.invert();\n }\n const newState = combineTransformations(\n def,\n position.state,\n transformationForMove(def, partialMove),\n );\n // TODO: move to render()\n this.svg.draw(\n this.definition,\n position.state,\n newState,\n position.movesInProgress[0].fraction,\n );\n } else {\n this.svg.draw(this.definition, position.state);\n this.#cachedPosition = position;\n }\n } catch (e) {\n console.warn(\n \"Bad position (this doesn't necessarily mean something is wrong). Pre-emptively disconnecting:\",\n this.puzzleLoader?.id,\n e,\n );\n this.disconnect();\n }\n }\n\n scheduleRender(): void {\n this.scheduler.requestAnimFrame();\n }\n\n experimentalSetStickering(stickering: ExperimentalStickering): void {\n (async () => {\n if (!this.puzzleLoader?.appearance) {\n return;\n }\n const appearance = await this.puzzleLoader.appearance(stickering);\n this.resetSVG(appearance);\n })();\n }\n\n // TODO: do this without constructing a new SVG.\n private resetSVG(appearance?: PuzzleAppearance): void {\n if (this.svg) {\n this.removeElement(this.svg.element);\n }\n if (!this.definition) {\n return; // TODO\n }\n this.svg = new KPuzzleSVGWrapper(\n this.definition,\n this.svgSource!,\n appearance,\n ); // TODO\n this.addElement(this.svg.element);\n if (this.#cachedPosition) {\n this.onPositionChange(this.#cachedPosition);\n }\n }\n\n private render(): void {\n /*...*/\n }\n}\n\ncustomElementsShim.define(\"twisty-2d-puzzle\", Twisty2DPuzzle);\n", "import { CSSSource } from \"../ManagedCustomElement\";\n\n// TODO: Can we do this without so much nesting, and styling all the nested elems?\nexport const twisty2DSVGCSS = new CSSSource(`\n:host {\n width: 384px;\n height: 256px;\n display: grid;\n}\n\n.wrapper {\n width: 100%;\n height: 100%;\n display: grid;\n overflow: hidden;\n}\n\n.svg-wrapper,\ntwisty-2d-svg,\nsvg {\n width: 100%;\n height: 100%;\n display: grid;\n min-height: 0;\n}\n`);\n", "import { PerspectiveCamera, Scene as ThreeScene, Vector2 } from \"three\";\nimport type { PuzzleLoader } from \"../../../puzzles\";\nimport { THREEJS } from \"../../heavy-code-imports/3d\";\nimport { StaleDropper } from \"../../model/PromiseFreshener\";\nimport { FreshListenerManager } from \"../../model/props/TwistyProp\";\nimport type {\n BackViewLayout,\n BackViewLayoutWithAuto,\n} from \"../../model/props/viewer/BackViewProp\";\nimport type { VisualizationStrategy } from \"../../model/props/viewer/VisualizationStrategyProp\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport type { Schedulable } from \"../../controllers/RenderScheduler\";\nimport { ClassListManager } from \"../ClassListManager\";\nimport { ManagedCustomElement } from \"../ManagedCustomElement\";\nimport { customElementsShim } from \"../node-custom-element-shims\";\nimport { twistyViewerWrapperCSS } from \"../TwistyViewerWrapper.css\";\nimport type { PressInfo } from \"./DragTracker\";\nimport { Twisty3DPuzzleWrapper } from \"./Twisty3DPuzzleWrapper\";\nimport { Twisty3DVantage } from \"./Twisty3DVantage\";\n\nexport class Twisty3DSceneWrapper\n extends ManagedCustomElement\n implements Schedulable\n{\n #backViewClassListManager: ClassListManager<BackViewLayoutWithAuto> =\n new ClassListManager(this, \"back-view-\", [\n \"auto\",\n \"none\",\n \"side-by-side\",\n \"top-right\",\n ]);\n\n #freshListenerManager = new FreshListenerManager();\n disconnect(): void {\n this.#freshListenerManager.disconnect();\n }\n\n constructor(public model?: TwistyPlayerModel) {\n super();\n }\n\n async connectedCallback(): Promise<void> {\n this.addCSS(twistyViewerWrapperCSS);\n const vantage = new Twisty3DVantage(this.model, this);\n this.addVantage(vantage);\n if (this.model) {\n this.#freshListenerManager.addMultiListener(\n [this.model.puzzleLoaderProp, this.model.visualizationStrategyProp],\n this.onPuzzle.bind(this),\n );\n this.#freshListenerManager.addListener(\n this.model.backViewProp,\n this.onBackView.bind(this),\n );\n }\n this.scheduleRender();\n }\n\n #backViewVantage: Twisty3DVantage | null = null;\n setBackView(backView: BackViewLayout): void {\n const shouldHaveBackView = [\"side-by-side\", \"top-right\"].includes(backView);\n const hasBackView = this.#backViewVantage !== null;\n\n this.#backViewClassListManager.setValue(backView);\n if (shouldHaveBackView) {\n if (!hasBackView) {\n this.#backViewVantage = new Twisty3DVantage(this.model, this, {\n backView: true,\n });\n this.addVantage(this.#backViewVantage);\n this.scheduleRender();\n }\n } else {\n if (this.#backViewVantage) {\n this.removeVantage(this.#backViewVantage);\n this.#backViewVantage = null;\n }\n }\n }\n\n onBackView(backView: BackViewLayout): void {\n this.setBackView(backView);\n }\n\n async onPress(\n e: CustomEvent<{\n pressInfo: PressInfo;\n cameraPromise: Promise<PerspectiveCamera>;\n }>,\n ): Promise<void> {\n const twisty3DPuzzleWrapper = this.#currentTwisty3DPuzzleWrapper;\n if (!twisty3DPuzzleWrapper) {\n console.info(\"no wrapper; skipping scene wrapper press!\");\n return;\n }\n\n const raycasterPromise = (async () => {\n const [camera, three] = await Promise.all([\n e.detail.cameraPromise,\n THREEJS,\n ]);\n\n const raycaster = new three.Raycaster();\n const mouse = new Vector2(\n e.detail.pressInfo.normalizedX,\n e.detail.pressInfo.normalizedY,\n );\n raycaster.setFromCamera(mouse, camera);\n return raycaster;\n })();\n\n twisty3DPuzzleWrapper.raycastMove(raycasterPromise, {\n invert: !e.detail.pressInfo.rightClick,\n depth: e.detail.pressInfo.keys.ctrlOrMetaKey\n ? \"rotation\"\n : e.detail.pressInfo.keys.shiftKey\n ? \"secondSlice\"\n : \"none\",\n });\n }\n\n #cachedScene: Promise<ThreeScene> | null;\n async scene(): Promise<ThreeScene> {\n return (this.#cachedScene ??= (async () => new (await THREEJS).Scene())());\n }\n\n #vantages: Set<Twisty3DVantage> = new Set();\n addVantage(vantage: Twisty3DVantage) {\n vantage.addEventListener(\"press\", this.onPress.bind(this));\n this.#vantages.add(vantage);\n this.contentWrapper.appendChild(vantage);\n }\n\n removeVantage(vantage: Twisty3DVantage) {\n this.#vantages.delete(vantage);\n vantage.remove();\n vantage.disconnect();\n this.#currentTwisty3DPuzzleWrapper?.disconnect();\n }\n\n experimentalVantages(): Iterable<Twisty3DVantage> {\n return this.#vantages.values();\n }\n\n scheduleRender(): void {\n for (const vantage of this.#vantages) {\n vantage.scheduleRender();\n }\n }\n\n #currentTwisty3DPuzzleWrapper: Twisty3DPuzzleWrapper | null = null;\n // #oldTwisty3DPuzzleWrappers: Twisty3DPuzzleWrapper[] = []; // TODO: Animate these out.\n async setCurrentTwisty3DPuzzleWrapper(\n scene: ThreeScene,\n twisty3DPuzzleWrapper: Twisty3DPuzzleWrapper,\n ): Promise<void> {\n const old = this.#currentTwisty3DPuzzleWrapper;\n this.#currentTwisty3DPuzzleWrapper = twisty3DPuzzleWrapper;\n old?.disconnect();\n scene.add(await twisty3DPuzzleWrapper.twisty3DPuzzle());\n if (old) {\n // We wait for the new puzzle to be in place before removing the old one.\n scene.remove(await old.twisty3DPuzzle());\n }\n }\n\n #twisty3DStaleDropper: StaleDropper<[ThreeScene, Twisty3DPuzzleWrapper]> =\n new StaleDropper<[ThreeScene, Twisty3DPuzzleWrapper]>();\n\n async onPuzzle(\n inputs: [\n puzzleLoader: PuzzleLoader,\n visualizationStrategy: VisualizationStrategy,\n ],\n ): Promise<void> {\n this.#currentTwisty3DPuzzleWrapper?.disconnect();\n const [scene, twisty3DPuzzleWrapper] =\n await this.#twisty3DStaleDropper.queue(\n Promise.all([\n this.scene(),\n new Twisty3DPuzzleWrapper(this.model!, this, inputs[0], inputs[1]), // TODO\n ]),\n );\n\n this.setCurrentTwisty3DPuzzleWrapper(scene, twisty3DPuzzleWrapper);\n }\n}\n\ncustomElementsShim.define(\"twisty-3d-scene-wrapper\", Twisty3DSceneWrapper);\n", "import type { Raycaster, Texture as ThreeTexture } from \"three\";\nimport { experimentalCubeAppearance, PuzzleLoader } from \"../../../puzzles\";\nimport type { ExperimentalStickering } from \"../../../twisty\";\nimport { proxy3D } from \"../../heavy-code-imports/3d\";\nimport { Cube3D, PG3D } from \"../../heavy-code-imports/dynamic-entries/3d\";\nimport type { FoundationDisplay } from \"../../model/props/puzzle/display/FoundationDisplayProp\";\nimport type { HintFaceletStyleWithAuto } from \"../../model/props/puzzle/display/HintFaceletProp\";\nimport { FreshListenerManager } from \"../../model/props/TwistyProp\";\nimport type { VisualizationStrategy } from \"../../model/props/viewer/VisualizationStrategyProp\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport type { PuzzlePosition } from \"../../controllers/AnimationTypes\";\nimport type { Schedulable } from \"../../controllers/RenderScheduler\";\nimport type { Twisty3DPuzzle } from \"./puzzles/Twisty3DPuzzle\";\n\nexport class Twisty3DPuzzleWrapper implements Schedulable {\n constructor(\n private model: TwistyPlayerModel,\n public schedulable: Schedulable,\n private puzzleLoader: PuzzleLoader,\n private visualizationStrategy: VisualizationStrategy,\n ) {\n this.twisty3DPuzzle(); // Start constructing.\n\n // TODO: Hook up listeners before loading the heavy code in the async constructor, so we get any intermediate updates?\n // Repro: Switch to 40x40x40 a fraction of a second before animation finishes. When it's loaded the itmeline is at the end, but the 40x40x40 is rendered with an earlier position.\n\n this.#freshListenerManager.addListener(\n this.model.puzzleLoaderProp,\n (puzzleLoader: PuzzleLoader) => {\n if (this.puzzleLoader.id !== puzzleLoader.id) {\n this.disconnect();\n }\n },\n );\n this.#freshListenerManager.addListener(\n this.model.legacyPositionProp,\n async (position: PuzzlePosition) => {\n try {\n (await this.twisty3DPuzzle()).onPositionChange(position);\n this.scheduleRender();\n } catch (e) {\n // TODO\n // console.warn(\n // \"Bad position (this doesn't necessarily mean something is wrong). Pre-emptively disconnecting:\",\n // this.puzzleLoader.id,\n // e,\n // );\n this.disconnect();\n }\n },\n );\n\n this.#freshListenerManager.addListener(\n this.model.hintFaceletProp,\n async (hintFaceletStyle: HintFaceletStyleWithAuto) => {\n (\n (await this.twisty3DPuzzle()) as Cube3D | PG3D\n ).experimentalUpdateOptions({\n hintFacelets:\n hintFaceletStyle === \"auto\" ? \"floating\" : hintFaceletStyle,\n });\n this.scheduleRender();\n },\n );\n this.#freshListenerManager.addListener(\n this.model.foundationDisplayProp,\n async (foundationDisplay: FoundationDisplay) => {\n (\n (await this.twisty3DPuzzle()) as Cube3D | PG3D\n ).experimentalUpdateOptions({\n showFoundation: foundationDisplay !== \"none\",\n });\n this.scheduleRender();\n },\n );\n this.#freshListenerManager.addListener(\n this.model.stickeringProp,\n async (stickering: ExperimentalStickering) => {\n if (\"setStickering\" in (await this.twisty3DPuzzle())) {\n ((await this.twisty3DPuzzle()) as Cube3D).setStickering(stickering);\n this.scheduleRender();\n } else {\n if (\n [\n \"experimental-global-custom-1\",\n \"experimental-global-custom-2\",\n ].includes(stickering)\n ) {\n const [twisty3D] = await Promise.all([this.twisty3DPuzzle()]);\n (twisty3D as PG3D).experimentalSetAppearance(\n await experimentalCubeAppearance(this.puzzleLoader, stickering),\n );\n this.scheduleRender();\n return;\n }\n\n // TODO: create a prop to handle this.\n if (\"appearance\" in this.puzzleLoader) {\n const [twisty3D, appearancePromise] = await Promise.all([\n this.twisty3DPuzzle(),\n this.puzzleLoader.appearance!(stickering ?? \"full\"),\n ]);\n (twisty3D as PG3D).experimentalSetAppearance(appearancePromise);\n this.scheduleRender();\n }\n }\n },\n );\n\n this.#freshListenerManager.addMultiListener(\n [this.model.foundationStickerSprite, this.model.hintStickerSprite],\n async (\n inputs: [\n foundationSprite: ThreeTexture | null,\n hintSprite: ThreeTexture | null,\n ],\n ) => {\n if (\"experimentalUpdateTexture\" in (await this.twisty3DPuzzle())) {\n ((await this.twisty3DPuzzle()) as PG3D).experimentalUpdateTexture(\n true,\n ...inputs,\n );\n this.scheduleRender();\n }\n },\n );\n }\n\n #freshListenerManager = new FreshListenerManager();\n disconnect(): void {\n this.#freshListenerManager.disconnect();\n }\n\n scheduleRender(): void {\n this.schedulable.scheduleRender();\n }\n\n #cachedTwisty3DPuzzle: Promise<Twisty3DPuzzle> | null = null;\n async twisty3DPuzzle(): Promise<Twisty3DPuzzle> {\n return (this.#cachedTwisty3DPuzzle ??= (async () => {\n const proxyPromise = proxy3D();\n if (\n this.puzzleLoader.id === \"3x3x3\" &&\n this.visualizationStrategy === \"Cube3D\"\n ) {\n // TODO: synchronize\n const [foundationSprite, hintSprite, experimentalStickering] =\n await Promise.all([\n this.model.foundationStickerSprite.get(),\n this.model.hintStickerSprite.get(),\n this.model.stickeringProp.get(),\n ]);\n return (await proxyPromise).cube3DShim({\n foundationSprite,\n hintSprite,\n experimentalStickering,\n });\n } else {\n const [hintFacelets, foundationSprite, hintSprite] = await Promise.all([\n this.model.hintFaceletProp.get(),\n this.model.foundationStickerSprite.get(),\n this.model.hintStickerSprite.get(),\n ]);\n const pg3d = (await proxyPromise).pg3dShim(\n this.puzzleLoader,\n hintFacelets === \"auto\" ? \"floating\" : hintFacelets,\n );\n // TODO: Figure out how to do this in one place using the listener.\n pg3d.then((p) =>\n p.experimentalUpdateTexture(\n true,\n foundationSprite ?? undefined,\n hintSprite ?? undefined,\n ),\n );\n return pg3d;\n }\n })());\n }\n\n async raycastMove(\n raycasterPromise: Promise<Raycaster>,\n transformations: {\n invert: boolean;\n depth?: \"secondSlice\" | \"rotation\" | \"none\";\n },\n ): Promise<void> {\n const puzzle = await this.twisty3DPuzzle();\n // TODO: check this differently.\n if (!(puzzle instanceof PG3D)) {\n console.info(\"not PG3D! skipping raycast\");\n return;\n }\n\n const targets = puzzle.experimentalGetControlTargets(); // TODO: sticker targets\n const [raycaster] = await Promise.all([raycasterPromise]);\n\n const intersects = raycaster.intersectObjects(targets);\n if (intersects.length > 0) {\n const closestMove = puzzle.getClosestMoveToAxis(\n intersects[0].point,\n transformations,\n );\n if (closestMove) {\n this.model.experimentalAddMove(closestMove.move, {\n coalesce: true,\n mod: closestMove.order,\n });\n } else {\n console.info(\"Skipping move!\");\n }\n }\n }\n}\n", "/**\n * @author mrdoob / http://mrdoob.com/\n * ESM conversion by Lucas Garron, 2021-12-21\n */\n\nconst performance:\n | null\n | (Performance & {\n memory?: {\n usedJSHeapSize: number;\n jsHeapSizeLimit: number;\n };\n }) = globalThis.performance;\n\nexport class Stats {\n mode = 0;\n\n dom = document.createElement(\"div\");\n\n constructor() {\n this.dom.style.cssText =\n \"position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000\";\n this.dom.addEventListener(\n \"click\",\n (event) => {\n event.preventDefault();\n this.showPanel(++this.mode % this.dom.children.length);\n },\n false,\n );\n\n this.showPanel(0);\n }\n\n addPanel(panel: StatsPanel): StatsPanel {\n this.dom.appendChild(panel.dom);\n return panel;\n }\n\n showPanel(id: number): void {\n for (let i = 0; i < this.dom.children.length; i++) {\n (this.dom.children[i] as HTMLElement).style.display =\n i === id ? \"block\" : \"none\";\n }\n\n this.mode = id;\n }\n\n beginTime = (performance || Date).now();\n prevTime = this.beginTime;\n frames = 0;\n\n fpsPanel = this.addPanel(new StatsPanel(\"FPS\", \"#0ff\", \"#002\"));\n msPanel = this.addPanel(new StatsPanel(\"MS\", \"#0f0\", \"#020\"));\n memPanel = performance?.memory\n ? this.addPanel(new StatsPanel(\"MB\", \"#f08\", \"#201\"))\n : null;\n REVISION = 16;\n\n begin() {\n this.beginTime = (performance || Date).now();\n }\n\n end() {\n this.frames++;\n\n const time = (performance || Date).now();\n\n this.msPanel.update(time - this.beginTime, 200);\n\n if (time >= this.prevTime + 1000) {\n this.fpsPanel.update((this.frames * 1000) / (time - this.prevTime), 100);\n\n this.prevTime = time;\n this.frames = 0;\n\n if (this.memPanel) {\n const memory = performance!.memory!;\n this.memPanel.update(\n memory.usedJSHeapSize / 1048576,\n memory.jsHeapSizeLimit / 1048576,\n );\n }\n }\n\n return time;\n }\n\n update() {\n this.beginTime = this.end();\n }\n}\n\nconst PR = Math.round(globalThis?.window?.devicePixelRatio ?? 1);\n\nconst WIDTH = 80 * PR,\n HEIGHT = 48 * PR,\n TEXT_X = 3 * PR,\n TEXT_Y = 2 * PR,\n GRAPH_X = 3 * PR,\n GRAPH_Y = 15 * PR,\n GRAPH_WIDTH = 74 * PR,\n GRAPH_HEIGHT = 30 * PR;\n\nexport class StatsPanel {\n min = Infinity;\n max = 0;\n dom = document.createElement(\"canvas\");\n context = this.dom.getContext(\"2d\")!;\n constructor(private name: string, private fg: string, private bg: string) {\n this.dom.width = WIDTH;\n this.dom.height = HEIGHT;\n this.dom.style.cssText = \"width:80px;height:48px\";\n\n this.context.font = `bold ${9 * PR}px Helvetica,Arial,sans-serif`;\n this.context.textBaseline = \"top\";\n\n this.context.fillStyle = bg;\n this.context.fillRect(0, 0, WIDTH, HEIGHT);\n\n this.context.fillStyle = fg;\n this.context.fillText(name, TEXT_X, TEXT_Y);\n this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);\n\n this.context.fillStyle = bg;\n this.context.globalAlpha = 0.9;\n this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);\n }\n\n update(value: number, maxValue: number) {\n this.min = Math.min(this.min, value);\n this.max = Math.max(this.max, value);\n\n this.context.fillStyle = this.bg;\n this.context.globalAlpha = 1;\n this.context.fillRect(0, 0, WIDTH, GRAPH_Y);\n this.context.fillStyle = this.fg;\n this.context.fillText(\n Math.round(value) +\n \" \" +\n this.name +\n \" (\" +\n Math.round(this.min) +\n \"-\" +\n Math.round(this.max) +\n \")\",\n TEXT_X,\n TEXT_Y,\n );\n\n this.context.drawImage(\n this.dom,\n GRAPH_X + PR,\n GRAPH_Y,\n GRAPH_WIDTH - PR,\n GRAPH_HEIGHT,\n GRAPH_X,\n GRAPH_Y,\n GRAPH_WIDTH - PR,\n GRAPH_HEIGHT,\n );\n\n this.context.fillRect(\n GRAPH_X + GRAPH_WIDTH - PR,\n GRAPH_Y,\n PR,\n GRAPH_HEIGHT,\n );\n\n this.context.fillStyle = this.bg;\n this.context.globalAlpha = 0.9;\n this.context.fillRect(\n GRAPH_X + GRAPH_WIDTH - PR,\n GRAPH_Y,\n PR,\n Math.round((1 - value / maxValue) * GRAPH_HEIGHT),\n );\n }\n}\n", "import type { PerspectiveCamera, WebGLRenderer } from \"three\";\nimport { Stats } from \"../../../vendor/three/examples/jsm/libs/stats.modified.module\";\nimport { THREEJS } from \"../../heavy-code-imports/3d\";\nimport { StaleDropper } from \"../../model/PromiseFreshener\";\nimport type { TwistyPropParent } from \"../../model/props/TwistyProp\";\nimport type { OrbitCoordinates } from \"../../model/props/viewer/OrbitCoordinatesRequestProp\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport { RenderScheduler } from \"../../controllers/RenderScheduler\";\nimport { ManagedCustomElement } from \"../ManagedCustomElement\";\nimport { customElementsShim } from \"../node-custom-element-shims\";\nimport { pixelRatio } from \"../canvas\";\nimport { twisty3DVantageCSS } from \"./Twisty3DVantage.css\";\nimport { DragTracker, PressInfo } from \"./DragTracker\";\nimport { newRenderer, renderPooled } from \"./RendererPool\";\nimport { DEGREES_PER_RADIAN } from \"./TAU\";\nimport type { Twisty3DSceneWrapper } from \"./Twisty3DSceneWrapper\";\nimport { TwistyOrbitControls } from \"./TwistyOrbitControls\";\n\nlet SHOW_STATS = false;\nexport function debugShowRenderStats(enable: boolean): void {\n SHOW_STATS = enable;\n}\n\nexport async function setCameraFromOrbitCoordinates(\n camera: PerspectiveCamera,\n orbitCoordinates: OrbitCoordinates,\n backView: boolean = false,\n): Promise<void> {\n const spherical = new (await THREEJS).Spherical(\n orbitCoordinates.distance,\n (90 - (backView ? -1 : 1) * orbitCoordinates.latitude) / DEGREES_PER_RADIAN,\n ((backView ? 180 : 0) + orbitCoordinates.longitude) / DEGREES_PER_RADIAN,\n );\n spherical.makeSafe();\n camera.position.setFromSpherical(spherical);\n camera.lookAt(0, 0, 0);\n}\n\nlet shareAllNewRenderers: boolean | null = null;\n\n// WARNING: The current shared renderer implementation is not every efficient.\n// Avoid using for players that are likely to have dimensions approaching 1 megapixel or higher.\n// TODO: use a dedicated renderer while fullscreen?\n// - true: Force all new (i.e. constructed in the future) renderers to be shared\n// - false: Force all new (i.e. constructed in the future) renderers to be dedicated\n// - null: Reset to the default heuristics.\nexport function experimentalForceNewRendererSharing(\n share: boolean | null,\n): void {\n shareAllNewRenderers = share;\n}\n\nlet dedicatedRenderersSoFar = 0;\nconst DEFAULT_MAX_DEDICATED_RENDERERS = 2; // This allows for a front view and a back view (or two separate front views).\nfunction shareRenderer(): boolean {\n if (shareAllNewRenderers !== null) {\n if (!shareAllNewRenderers) {\n dedicatedRenderersSoFar++;\n }\n return shareAllNewRenderers;\n }\n if (dedicatedRenderersSoFar < DEFAULT_MAX_DEDICATED_RENDERERS) {\n dedicatedRenderersSoFar++;\n return false;\n } else {\n return true;\n }\n}\n\nexport class Twisty3DVantage extends ManagedCustomElement {\n scene: Twisty3DSceneWrapper | null = null;\n\n stats: Stats | null = null;\n\n private rendererIsShared: boolean = shareRenderer();\n\n constructor(\n private model?: TwistyPlayerModel,\n scene?: Twisty3DSceneWrapper,\n private options?: { backView?: boolean },\n ) {\n super();\n this.scene = scene ?? null;\n\n if (SHOW_STATS) {\n this.stats = new Stats();\n this.stats.dom.style.position = \"absolute\";\n this.contentWrapper.appendChild(this.stats.dom);\n }\n }\n\n async connectedCallback(): Promise<void> {\n this.addCSS(twisty3DVantageCSS);\n this.addElement((await this.canvasInfo()).canvas);\n\n this.#onResize();\n const observer = new ResizeObserver(this.#onResize.bind(this));\n observer.observe(this.contentWrapper);\n this.orbitControls(); // TODO\n this.#setupBasicPresses();\n\n this.scheduleRender();\n }\n\n async #setupBasicPresses(): Promise<void> {\n const dragTracker = await this.#dragTracker();\n dragTracker.addEventListener(\"press\", async (e: CustomEvent<PressInfo>) => {\n const movePressInput = await this.model!.movePressInputProp.get();\n if (movePressInput !== \"basic\") {\n return;\n }\n this.dispatchEvent(\n new CustomEvent(\"press\", {\n detail: {\n pressInfo: e.detail,\n cameraPromise: this.camera(),\n },\n }),\n );\n });\n }\n\n #onResizeStaleDropper = new StaleDropper<PerspectiveCamera>();\n\n async clearCanvas(): Promise<void> {\n if (this.rendererIsShared) {\n const canvasInfo = await this.canvasInfo();\n canvasInfo.context.clearRect(\n 0,\n 0,\n canvasInfo.canvas.width,\n canvasInfo.canvas.height,\n );\n } else {\n const renderer = await this.renderer();\n const context = renderer.getContext();\n context.clear(context.COLOR_BUFFER_BIT);\n }\n }\n\n // TODO: Why doesn't this work for the top-right back view height?\n #width: number = 0;\n #height: number = 0;\n async #onResize(): Promise<void> {\n const camera = await this.#onResizeStaleDropper.queue(this.camera());\n\n const w = this.contentWrapper.clientWidth;\n const h = this.contentWrapper.clientHeight;\n this.#width = w;\n this.#height = h;\n const off = 0;\n let yoff = 0;\n let excess = 0;\n if (h > w) {\n excess = h - w;\n yoff = -Math.floor(0.5 * excess);\n }\n camera.aspect = w / h;\n camera.setViewOffset(w, h - excess, off, yoff, w, h);\n camera.updateProjectionMatrix(); // TODO\n\n this.clearCanvas();\n if (this.rendererIsShared) {\n const canvasInfo = await this.canvasInfo();\n\n canvasInfo.canvas.width = w * pixelRatio();\n canvasInfo.canvas.height = h * pixelRatio();\n canvasInfo.canvas.style.width = w.toString();\n canvasInfo.canvas.style.height = w.toString();\n } else {\n const renderer = await this.renderer();\n renderer.setSize(w, h, true);\n }\n\n this.scheduleRender();\n }\n\n #cachedRenderer: Promise<WebGLRenderer> | null = null;\n async renderer(): Promise<WebGLRenderer> {\n if (this.rendererIsShared) {\n throw new Error(\"renderer expected to be shared.\");\n }\n return (this.#cachedRenderer ??= newRenderer());\n }\n\n #cachedCanvas: Promise<{\n canvas: HTMLCanvasElement;\n context: CanvasRenderingContext2D;\n }> | null = null;\n async canvasInfo(): Promise<{\n canvas: HTMLCanvasElement;\n context: CanvasRenderingContext2D;\n }> {\n return (this.#cachedCanvas ??= (async () => {\n let canvas: HTMLCanvasElement;\n if (this.rendererIsShared) {\n canvas = this.addElement(document.createElement(\"canvas\"));\n } else {\n const renderer = await this.renderer();\n canvas = this.addElement(renderer.domElement);\n }\n const context = canvas.getContext(\"2d\")!;\n return { canvas, context };\n })());\n }\n\n #cachedDragTracker: Promise<DragTracker> | null = null;\n async #dragTracker(): Promise<DragTracker> {\n return (this.#cachedDragTracker ??= (async () => {\n return new DragTracker((await this.canvasInfo()).canvas);\n })());\n }\n\n #cachedCamera: Promise<PerspectiveCamera> | null = null;\n async camera(): Promise<PerspectiveCamera> {\n return (this.#cachedCamera ??= (async () => {\n const camera = new (await THREEJS).PerspectiveCamera(\n 20,\n 1, // We rely on the resize logic to handle this.\n 0.1,\n 20,\n );\n camera.position.copy(\n new (await THREEJS).Vector3(2, 4, 4).multiplyScalar(\n this.options?.backView ? -1 : 1,\n ),\n );\n camera.lookAt(0, 0, 0);\n // TODO: `TwistyOrbitControls` breaks isolateion\n return camera;\n })());\n }\n\n #cachedOrbitControls: Promise<TwistyOrbitControls> | null = null;\n async orbitControls(): Promise<TwistyOrbitControls> {\n return (this.#cachedOrbitControls ??= (async () => {\n const orbitControls = new TwistyOrbitControls(\n this.model!,\n !!this.options?.backView,\n (await this.canvasInfo()).canvas,\n await this.#dragTracker(),\n );\n\n if (this.model) {\n this.addListener(\n this.model.orbitCoordinatesProp,\n async (orbitCoordinates: OrbitCoordinates) => {\n const camera = await this.camera();\n setCameraFromOrbitCoordinates(\n camera,\n orbitCoordinates,\n this.options?.backView,\n );\n // TODO: Wrap in StaleDropper?\n\n this.scheduleRender();\n },\n );\n }\n\n return orbitControls;\n })());\n }\n\n addListener<T>(\n prop: TwistyPropParent<T>,\n listener: (value: T) => void,\n ): void {\n prop.addFreshListener(listener);\n this.#disconnectionFunctions.push(() => {\n prop.removeFreshListener(listener);\n // disconnected = true; // TODO\n });\n }\n\n #disconnectionFunctions: (() => void)[] = [];\n disconnect(): void {\n for (const fn of this.#disconnectionFunctions) {\n fn();\n }\n this.#disconnectionFunctions = []; // TODO: Encapsulate this.\n }\n\n async render(): Promise<void> {\n if (!this.scene) {\n throw new Error(\"Attempted to render without a scene\");\n }\n\n this.stats?.begin();\n\n const [scene, camera, canvas] = await Promise.all([\n this.scene.scene(),\n this.camera(),\n this.canvasInfo(),\n ]);\n if (this.rendererIsShared) {\n renderPooled(this.#width, this.#height, canvas.canvas, scene, camera);\n } else {\n (await this.renderer()).render(scene, camera);\n }\n\n this.stats?.end();\n }\n\n #scheduler = new RenderScheduler(this.render.bind(this));\n scheduleRender(): void {\n // console.log(\"scheduling\", this);\n this.#scheduler.requestAnimFrame();\n }\n}\n\ncustomElementsShim.define(\"twisty-3d-vantage\", Twisty3DVantage);\n", "let globalPixelRatioOverride: number | null = null;\nexport function setGlobalPixelRatioOverride(override: number | null): void {\n globalPixelRatioOverride = override;\n}\n\n// TODO: Handle if you move across screens?\nexport function pixelRatio(): number {\n return globalPixelRatioOverride ?? (devicePixelRatio || 1);\n}\n", "import { CSSSource } from \"../ManagedCustomElement\";\n\n// The `position` values are a hack for a bug in Safari where the canvas either\n// grows infinitely, or takes up the full `fr` of any encompassing grid (making\n// the contents of that element e.g. over 100% of its height). `contain:\n// content` is a good fix for this, but there is no indication that Safari will\n// support it soon. https://developer.mozilla.org/en-US/docs/Web/CSS/contain\n\nexport const twisty3DVantageCSS = new CSSSource(`\n:host {\n width: 384px;\n height: 256px;\n display: grid;\n}\n\n.wrapper {\n width: 100%;\n height: 100%;\n display: grid;\n overflow: hidden;\n}\n\n/* TODO: This is due to stats hack. Replace with \\`canvas\\`. */\n.wrapper > canvas {\n max-width: 100%;\n max-height: 100%;\n}\n\n.wrapper.invisible {\n opacity: 0;\n}\n`);\n", "// export class Drag() {\n\n// }\n\ninterface DragInfo {\n attachedInfo: Record<any, any>;\n hasMoved: boolean;\n lastClientX: number;\n lastClientY: number;\n lastTimeStamp: number;\n}\n\ntype PointerID = number;\n\nexport interface DragMovementInfo {\n attachedInfo: Record<any, any>;\n movementX: number;\n movementY: number;\n elapsedMs: number;\n}\n\nexport interface UpInfo {\n attachedInfo: Record<any, any>;\n}\n\nexport interface PressInfo {\n normalizedX: number;\n normalizedY: number;\n rightClick: boolean;\n keys: {\n // TODO: group these\n altKey: boolean;\n ctrlOrMetaKey: boolean;\n shiftKey: boolean;\n };\n}\n\n// Chrome can report movements as low as `0.0000152587890625` even if the cursor did not move at all. So we need a treshold insteadl.\nconst MOVEMENT_EPSILON = 0.1; // px\n\nexport class DragTracker extends EventTarget {\n #dragInfoMap: Map<PointerID, DragInfo> = new Map();\n\n constructor(public readonly target: HTMLElement) {\n super();\n target.addEventListener(\"pointerdown\", this.onPointerDown.bind(this));\n // Prevent right-click on desktop (only tested on macOS Chrome/Safari/Firefox) so we can detect right-click moves.\n // TODO: Can we do this selectively, e.g. only on the puzzle? That way we could allow right-click to download the canvas. Unfortunately, it would probably require a sync calculation.\n this.target.addEventListener(\"contextmenu\", (e) => {\n if (e.buttons & 2) {\n e.preventDefault();\n }\n });\n // Prevent touch scrolling (preventing default on `pointermove` doesn't work).\n this.target.addEventListener(\"touchmove\", (e) => e.preventDefault());\n // Prevent zooming on double-tap (iOS).\n // This is because `dblclick` works to zoom in, but does *not* work to zoom out. So the user can get stuck zoomed into the player without a way to zoom out.\n this.target.addEventListener(\"dblclick\", (e) => e.preventDefault());\n }\n\n // This allows us to avoid getting a callback every time the pointer moves over the canvas, until we have a down event.\n // TODO: Ideally we'd also support unregistering when we're certain there are no more active touches. But this means we need to properly handle every way a pointer \"click\" can end, which is tricky across environments (due to e.g. mouse vs. touch vs. stylues, canvas/viewport/window/scroll boundaries, right-click and other ways of losing focus, etc.), so we conservatively leave the listeners on.\n #lazyListenersRegistered: boolean = false;\n #registerLazyListeners(): void {\n if (this.#lazyListenersRegistered) {\n return;\n }\n this.target.addEventListener(\"pointermove\", this.onPointerMove.bind(this)); // TODO: only register this after pointer down.\n this.target.addEventListener(\"pointerup\", this.onPointerUp.bind(this));\n this.#lazyListenersRegistered = true;\n }\n\n #clear(e: PointerEvent): void {\n this.#dragInfoMap.delete(e.pointerId);\n }\n\n // `null`: means: ignore this result (no movement, or not\n #trackDrag(e: PointerEvent): {\n movementInfo: DragMovementInfo | null;\n hasMoved: boolean;\n } {\n // TODO: Find a way to detect if this is an active press, in a way that works cross-platform.\n // if (e.buttons === 0) {\n // return { movementInfo: null, hasMoved: false };\n // }\n const existing = this.#dragInfoMap.get(e.pointerId);\n if (!existing) {\n return { movementInfo: null, hasMoved: false };\n }\n // We would try to use `e.movementX`/`e.movementY`, except Safari:\n // - Does not have those values on i[Pad]OS.\n // - Will always report `0` for these values on macOS.\n // https://bugs.webkit.org/show_bug.cgi?id=220194\n //\n // The following are all insufficiently powerful for detecting the Safari `0` bug:\n // - `\"movementX\" in e`\n // - `e.movementX !== \"undefined\"`\n // - `e.hasOwnProperty(\"movementX\")`\n\n let movementInfo: DragMovementInfo;\n if ((e.movementX ?? 0) !== 0 || (e.movementY ?? 0) !== 0) {\n // We optimistically try to catch sub-pixel movements in Chrome.\n movementInfo = {\n attachedInfo: existing.attachedInfo,\n movementX: e.movementX,\n movementY: e.movementY,\n elapsedMs: e.timeStamp - existing.lastTimeStamp,\n };\n } else {\n movementInfo = {\n attachedInfo: existing.attachedInfo,\n movementX: e.clientX - existing.lastClientX,\n movementY: e.clientY - existing.lastClientY,\n elapsedMs: e.timeStamp - existing.lastTimeStamp,\n };\n }\n existing.lastClientX = e.clientX;\n existing.lastClientY = e.clientY;\n existing.lastTimeStamp = e.timeStamp;\n if (\n Math.abs(movementInfo.movementX) < MOVEMENT_EPSILON &&\n Math.abs(movementInfo.movementY) < MOVEMENT_EPSILON\n ) {\n return { movementInfo: null, hasMoved: existing.hasMoved };\n } else {\n existing.hasMoved = true;\n return { movementInfo, hasMoved: existing.hasMoved };\n }\n }\n\n private onPointerDown(e: PointerEvent) {\n this.#registerLazyListeners();\n const newDragInfo: DragInfo = {\n attachedInfo: {},\n hasMoved: false,\n lastClientX: e.clientX,\n lastClientY: e.clientY,\n lastTimeStamp: e.timeStamp,\n };\n this.#dragInfoMap.set(e.pointerId, newDragInfo);\n this.target.setPointerCapture(e.pointerId);\n }\n\n private onPointerMove(e: PointerEvent) {\n const movementInfo = this.#trackDrag(e).movementInfo;\n if (movementInfo) {\n e.preventDefault();\n this.dispatchEvent(\n new CustomEvent(\"move\", {\n detail: movementInfo,\n }),\n );\n }\n }\n\n private onPointerUp(e: PointerEvent) {\n const trackDragResult = this.#trackDrag(e);\n const existing = this.#dragInfoMap.get(e.pointerId)!; // TODO\n this.#clear(e);\n this.target.releasePointerCapture(e.pointerId); // TODO: unnecessary?\n let event: CustomEvent;\n if (trackDragResult.hasMoved) {\n // TODO: send proper movement/momentum since last move event.\n event = new CustomEvent<UpInfo>(\"up\", {\n detail: { attachedInfo: existing.attachedInfo },\n });\n } else {\n const { altKey, ctrlKey, metaKey, shiftKey } = e;\n event = new CustomEvent<PressInfo>(\"press\", {\n detail: {\n normalizedX: (e.offsetX / this.target.offsetWidth) * 2 - 1,\n normalizedY: 1 - (e.offsetY / this.target.offsetHeight) * 2,\n rightClick: !!(e.button & 2),\n keys: {\n altKey,\n ctrlOrMetaKey: ctrlKey || metaKey,\n shiftKey,\n },\n },\n });\n }\n this.dispatchEvent(event);\n }\n}\n", "// TODO: https://stackoverflow.com/a/40443642\n\n// let shareAllNewRenderers: boolean = false;\n\n// // WARNING: The current shared renderer implementation is not every efficient.\n// // Avoid using for players that are likely to have dimensions approaching 1 megapixel or higher.\n// // TODO: use a dedicated renderer while fullscreen?\n// export function experimentalSetShareAllNewRenderers(share: boolean): void {\n// shareAllNewRenderers = share;\n// }\n\n// const sharedRenderer: WebGLRenderer | null = null;\n\nimport { THREEJS } from \"../../heavy-code-imports/3d\";\nimport type { Camera, Scene, WebGLRenderer } from \"three\";\nimport { pixelRatio } from \"../canvas\";\n\nconst renderers: Promise<WebGLRenderer>[] = [];\n\n// let haveSet = false;\nexport async function renderPooled(\n width: number,\n height: number,\n canvas: HTMLCanvasElement,\n scene: Scene,\n camera: Camera,\n): Promise<void> {\n if (width === 0 || height === 0) {\n return;\n }\n // At most one in the pool for now.\n if (renderers.length === 0) {\n renderers.push(newRenderer());\n }\n const renderer = await renderers[0];\n // TODO: scissoring\n renderer.setSize(width, height); // TODO: is it faster if we cache values and only call this when necessary?\n renderer.render(scene, camera);\n\n // TODO: Should we cache this? Seems to take about 0.0001ms to get.\n const context = canvas.getContext(\"2d\")!;\n context.clearRect(0, 0, canvas.width, canvas.height);\n context.drawImage(renderer.domElement, 0, 0);\n}\n\nexport async function newRenderer(): Promise<WebGLRenderer> {\n const rendererConstructor = (await THREEJS).WebGLRenderer;\n const renderer = new rendererConstructor({\n antialias: true,\n alpha: true,\n });\n renderer.setPixelRatio(pixelRatio());\n return renderer;\n}\n", "import { Spherical, Vector3 } from \"three\";\nimport type { OrbitCoordinates } from \"../../model/props/viewer/OrbitCoordinatesRequestProp\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport { RenderScheduler } from \"../../controllers/RenderScheduler\";\nimport type { DragMovementInfo, DragTracker } from \"./DragTracker\";\nimport { DEGREES_PER_RADIAN } from \"./TAU\";\n\nconst INERTIA_DEFAULT: boolean = true;\n\nconst INERTIA_DURATION_MS = 500;\n// If the first inertial render is this long after the last move, we assume the\n// user has halted the cursor and we consider inertia to have \"timed out\". We\n// never begin animating the inertia.\nconst INERTIA_TIMEOUT_MS = 50;\n\nconst VERTICAL_MOVEMENT_BASE_SCALE = 0.75;\n\n// progress is from 0 to 1.\nfunction momentumScale(progress: number) {\n // This is the exponential curve flipped so that\n // - The slope at progress = 0 is 1 (this corresponds to \"x = 1\" on the normal\n // curve).\n // - The scale exponentially \"decays\" until progress = 1.\n // This means the scale at the end will be about 0.418\n return (Math.exp(1 - progress) - (1 - progress)) / (1 - Math.E) + 1;\n}\n\nclass Inertia {\n private scheduler = new RenderScheduler(this.render.bind(this));\n private lastTimestamp: number;\n constructor(\n private startTimestamp: number,\n private momentumX: number,\n private momentumY: number,\n private callback: (movementX: number, movementY: number) => void,\n ) {\n this.scheduler.requestAnimFrame();\n this.lastTimestamp = startTimestamp;\n }\n\n private render(now: DOMHighResTimeStamp) {\n const progressBefore =\n (this.lastTimestamp - this.startTimestamp) / INERTIA_DURATION_MS;\n const progressAfter = Math.min(\n 1,\n (now - this.startTimestamp) / INERTIA_DURATION_MS,\n );\n\n if (\n progressBefore === 0 &&\n progressAfter > INERTIA_TIMEOUT_MS / INERTIA_DURATION_MS\n ) {\n // The user has already paused for a while. Don't start any inertia.\n return;\n }\n\n const delta = momentumScale(progressAfter) - momentumScale(progressBefore);\n\n // TODO: For now, we only carry horizontal momentum. If this should stay, we\n // can remove the plumbing for the Y dimension.\n this.callback(this.momentumX * delta * 1000, this.momentumY * delta * 1000);\n\n if (progressAfter < 1) {\n this.scheduler.requestAnimFrame();\n }\n this.lastTimestamp = now;\n }\n}\n\nexport function positionToOrbitCoordinates(\n position: Vector3,\n): OrbitCoordinates {\n const spherical = new Spherical();\n spherical.setFromVector3(position);\n return {\n latitude: 90 - spherical.phi * DEGREES_PER_RADIAN,\n longitude: spherical.theta * DEGREES_PER_RADIAN,\n distance: spherical.radius,\n };\n}\n\ninterface TwistyOrbitControlsDragAttachedInfo {\n lastTemperedX: number;\n lastTemperedY: number;\n timestamp: number;\n}\n\n// TODO: change mouse cursor while moving.\nexport class TwistyOrbitControls {\n /** @deprecated */\n experimentalInertia: boolean = INERTIA_DEFAULT;\n private onMovementBound = this.onMovement.bind(this);\n public experimentalHasBeenMoved: boolean = false;\n constructor(\n private model: TwistyPlayerModel,\n private mirror: boolean,\n private canvas: HTMLCanvasElement,\n private dragTracker: DragTracker,\n ) {\n this.dragTracker.addEventListener(\"move\", this.onMove.bind(this));\n this.dragTracker.addEventListener(\"up\", this.onUp.bind(this));\n }\n\n // f is the fraction of the canvas traversed per ms.\n temperMovement(f: number): number {\n // This is scaled to be linear for small values, but to reduce large values\n // by a significant factor.\n return (Math.sign(f) * Math.log(Math.abs(f * 10) + 1)) / 6;\n }\n\n onMove(e: CustomEvent<DragMovementInfo>): void {\n e.detail.attachedInfo ??= {};\n\n const { temperedX, temperedY } = this.onMovement(\n e.detail.movementX,\n e.detail.movementY,\n );\n const attachedInfo = e.detail\n .attachedInfo as TwistyOrbitControlsDragAttachedInfo;\n attachedInfo.lastTemperedX = temperedX * 10;\n attachedInfo.lastTemperedY = temperedY * 10;\n attachedInfo.timestamp = e.timeStamp; // TODO\n }\n\n onMovement(\n movementX: number,\n movementY: number,\n ): {\n temperedX: number;\n temperedY: number;\n } {\n const scale = this.mirror ? -1 : 1;\n\n // TODO: refactor\n const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);\n\n const temperedX = this.temperMovement(movementX / minDim);\n const temperedY = this.temperMovement(\n (movementY / minDim) * VERTICAL_MOVEMENT_BASE_SCALE,\n );\n this.model.orbitCoordinatesRequestProp.set(\n (async () => {\n const prevCoords = await this.model.orbitCoordinatesProp.get();\n\n const newCoords = {\n latitude:\n prevCoords.latitude + 2 * temperedY * DEGREES_PER_RADIAN * scale,\n longitude: prevCoords.longitude - 2 * temperedX * DEGREES_PER_RADIAN,\n };\n return newCoords;\n })(),\n );\n return { temperedX, temperedY };\n }\n\n onUp(e: CustomEvent<DragMovementInfo>): void {\n e.preventDefault();\n if (\n \"lastTemperedX\" in e.detail.attachedInfo &&\n \"lastTemperedY\" in e.detail.attachedInfo &&\n \"timestamp\" in e.detail.attachedInfo &&\n e.timeStamp - e.detail.attachedInfo.timestamp < 60 // TODO\n ) {\n new Inertia(\n e.timeStamp, // TODO\n (\n e.detail.attachedInfo as TwistyOrbitControlsDragAttachedInfo\n ).lastTemperedX,\n (\n e.detail.attachedInfo as TwistyOrbitControlsDragAttachedInfo\n ).lastTemperedY,\n this.onMovementBound,\n ); // TODO: cancel inertia\n }\n }\n}\n", "import { CSSSource } from \"../ManagedCustomElement\";\n\nexport const buttonGridCSS = new CSSSource(`\n:host {\n width: 384px;\n height: 24px;\n display: grid;\n}\n\n.wrapper {\n width: 100%;\n height: 100%;\n display: grid;\n overflow: hidden;\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n}\n\n.wrapper {\n grid-auto-flow: column;\n}\n\n.viewer-link-none .twizzle-link-button {\n display: none;\n}\n\n.wrapper twisty-button-v2,\n.wrapper twisty-control-button {\n width: inherit;\n height: inherit;\n}\n`);\n\nexport const buttonCSS = new CSSSource(`\n:host:not([hidden]) {\n display: grid;\n}\n\n:host {\n width: 48px;\n height: 24px;\n}\n\n.wrapper {\n width: 100%;\n height: 100%;\n}\n\nbutton {\n width: 100%;\n height: 100%;\n border: none;\n \n background-position: center;\n background-repeat: no-repeat;\n background-size: contain;\n\n background-color: rgba(196, 196, 196, 0.75);\n}\n\nbutton:enabled {\n background-color: rgba(196, 196, 196, 0.75)\n}\n\nbutton:disabled {\n background-color: rgba(0, 0, 0, 0.4);\n opacity: 0.25;\n pointer-events: none;\n}\n\nbutton:enabled:hover {\n background-color: rgba(255, 255, 255, 0.75);\n box-shadow: 0 0 1em rgba(0, 0, 0, 0.25);\n cursor: pointer;\n}\n\n/* TODO: fullscreen icons have too much padding?? */\n.svg-skip-to-start button,\nbutton.svg-skip-to-start {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNTg0IiBoZWlnaHQ9IjM1ODQiIHZpZXdCb3g9IjAgMCAzNTg0IDM1ODQiPjxwYXRoIGQ9Ik0yNjQzIDEwMzdxMTktMTkgMzItMTN0MTMgMzJ2MTQ3MnEwIDI2LTEzIDMydC0zMi0xM2wtNzEwLTcxMHEtOS05LTEzLTE5djcxMHEwIDI2LTEzIDMydC0zMi0xM2wtNzEwLTcxMHEtOS05LTEzLTE5djY3OHEwIDI2LTE5IDQ1dC00NSAxOUg5NjBxLTI2IDAtNDUtMTl0LTE5LTQ1VjEwODhxMC0yNiAxOS00NXQ0NS0xOWgxMjhxMjYgMCA0NSAxOXQxOSA0NXY2NzhxNC0xMSAxMy0xOWw3MTAtNzEwcTE5LTE5IDMyLTEzdDEzIDMydjcxMHE0LTExIDEzLTE5eiIvPjwvc3ZnPg==\");\n}\n\n.svg-skip-to-end button,\nbutton.svg-skip-to-end {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNTg0IiBoZWlnaHQ9IjM1ODQiIHZpZXdCb3g9IjAgMCAzNTg0IDM1ODQiPjxwYXRoIGQ9Ik05NDEgMjU0N3EtMTkgMTktMzIgMTN0LTEzLTMyVjEwNTZxMC0yNiAxMy0zMnQzMiAxM2w3MTAgNzEwcTggOCAxMyAxOXYtNzEwcTAtMjYgMTMtMzJ0MzIgMTNsNzEwIDcxMHE4IDggMTMgMTl2LTY3OHEwLTI2IDE5LTQ1dDQ1LTE5aDEyOHEyNiAwIDQ1IDE5dDE5IDQ1djE0MDhxMCAyNi0xOSA0NXQtNDUgMTloLTEyOHEtMjYgMC00NS0xOXQtMTktNDV2LTY3OHEtNSAxMC0xMyAxOWwtNzEwIDcxMHEtMTkgMTktMzIgMTN0LTEzLTMydi03MTBxLTUgMTAtMTMgMTl6Ii8+PC9zdmc+\");\n}\n\n.svg-step-forward button,\nbutton.svg-step-forward {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNTg0IiBoZWlnaHQ9IjM1ODQiIHZpZXdCb3g9IjAgMCAzNTg0IDM1ODQiPjxwYXRoIGQ9Ik0yNjg4IDE1NjhxMCAyNi0xOSA0NWwtNTEyIDUxMnEtMTkgMTktNDUgMTl0LTQ1LTE5cS0xOS0xOS0xOS00NXYtMjU2aC0yMjRxLTk4IDAtMTc1LjUgNnQtMTU0IDIxLjVxLTc2LjUgMTUuNS0xMzMgNDIuNXQtMTA1LjUgNjkuNXEtNDkgNDIuNS04MCAxMDF0LTQ4LjUgMTM4LjVxLTE3LjUgODAtMTcuNSAxODEgMCA1NSA1IDEyMyAwIDYgMi41IDIzLjV0Mi41IDI2LjVxMCAxNS04LjUgMjV0LTIzLjUgMTBxLTE2IDAtMjgtMTctNy05LTEzLTIydC0xMy41LTMwcS03LjUtMTctMTAuNS0yNC0xMjctMjg1LTEyNy00NTEgMC0xOTkgNTMtMzMzIDE2Mi00MDMgODc1LTQwM2gyMjR2LTI1NnEwLTI2IDE5LTQ1dDQ1LTE5cTI2IDAgNDUgMTlsNTEyIDUxMnExOSAxOSAxOSA0NXoiLz48L3N2Zz4=\");\n}\n\n.svg-step-backward button,\nbutton.svg-step-backward {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNTg0IiBoZWlnaHQ9IjM1ODQiIHZpZXdCb3g9IjAgMCAzNTg0IDM1ODQiPjxwYXRoIGQ9Ik0yNjg4IDIwNDhxMCAxNjYtMTI3IDQ1MS0zIDctMTAuNSAyNHQtMTMuNSAzMHEtNiAxMy0xMyAyMi0xMiAxNy0yOCAxNy0xNSAwLTIzLjUtMTB0LTguNS0yNXEwLTkgMi41LTI2LjV0Mi41LTIzLjVxNS02OCA1LTEyMyAwLTEwMS0xNy41LTE4MXQtNDguNS0xMzguNXEtMzEtNTguNS04MC0xMDF0LTEwNS41LTY5LjVxLTU2LjUtMjctMTMzLTQyLjV0LTE1NC0yMS41cS03Ny41LTYtMTc1LjUtNmgtMjI0djI1NnEwIDI2LTE5IDQ1dC00NSAxOXEtMjYgMC00NS0xOWwtNTEyLTUxMnEtMTktMTktMTktNDV0MTktNDVsNTEyLTUxMnExOS0xOSA0NS0xOXQ0NSAxOXExOSAxOSAxOSA0NXYyNTZoMjI0cTcxMyAwIDg3NSA0MDMgNTMgMTM0IDUzIDMzM3oiLz48L3N2Zz4=\");\n}\n\n.svg-pause button,\nbutton.svg-pause {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNTg0IiBoZWlnaHQ9IjM1ODQiIHZpZXdCb3g9IjAgMCAzNTg0IDM1ODQiPjxwYXRoIGQ9Ik0yNTYwIDEwODh2MTQwOHEwIDI2LTE5IDQ1dC00NSAxOWgtNTEycS0yNiAwLTQ1LTE5dC0xOS00NVYxMDg4cTAtMjYgMTktNDV0NDUtMTloNTEycTI2IDAgNDUgMTl0MTkgNDV6bS04OTYgMHYxNDA4cTAgMjYtMTkgNDV0LTQ1IDE5aC01MTJxLTI2IDAtNDUtMTl0LTE5LTQ1VjEwODhxMC0yNiAxOS00NXQ0NS0xOWg1MTJxMjYgMCA0NSAxOXQxOSA0NXoiLz48L3N2Zz4=\");\n}\n\n.svg-play button,\nbutton.svg-play {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNTg0IiBoZWlnaHQ9IjM1ODQiIHZpZXdCb3g9IjAgMCAzNTg0IDM1ODQiPjxwYXRoIGQ9Ik0yNDcyLjUgMTgyM2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNlYxMDU2cTAtMjYgMTYuNS0zNnQzOS41IDNsMTMyOCA3MzhxMjMgMTMgMjMgMzF0LTIzIDMxeiIvPjwvc3ZnPg==\");\n}\n\n.svg-enter-fullscreen button,\nbutton.svg-enter-fullscreen {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjgiIHZpZXdCb3g9IjAgMCAyOCAyOCIgd2lkdGg9IjI4Ij48cGF0aCBkPSJNMiAyaDI0djI0SDJ6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTkgMTZIN3Y1aDV2LTJIOXYtM3ptLTItNGgyVjloM1Y3SDd2NXptMTIgN2gtM3YyaDV2LTVoLTJ2M3pNMTYgN3YyaDN2M2gyVjdoLTV6Ii8+PC9zdmc+\");\n}\n\n.svg-exit-fullscreen button,\nbutton.svg-exit-fullscreen {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjgiIHZpZXdCb3g9IjAgMCAyOCAyOCIgd2lkdGg9IjI4Ij48cGF0aCBkPSJNMiAyaDI0djI0SDJ6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTcgMThoM3YzaDJ2LTVIN3Yyem0zLThIN3YyaDVWN2gtMnYzem02IDExaDJ2LTNoM3YtMmgtNXY1em0yLTExVjdoLTJ2NWg1di0yaC0zeiIvPjwvc3ZnPg==\");\n}\n\n.svg-twizzle-tw button,\nbutton.svg-twizzle-tw {\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODY0IiBoZWlnaHQ9IjYwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnL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iAyNTc5LjQxMiAwIDAxLTIwLjM4OCA2NC44MWgtNDkuNzg3Yy00LjY4Mi0xMC45MjYtOS43Mi0yMy43NDMtMTUuMTEtMzguNDUxbC0xLjYyOS00LjQ3Yy01LjI1OC0xNC41MjEtMTAuNjgtMzAuMTkyLTE2LjI2Ni00Ny4wMTRsLTIuNDA0LTcuMjhjLTYuNDM4LTE5LjYtMTMuMDItNDAuMzQ0LTE5Ljc0My02Mi4yMzRhMjk4OC43MDcgMjk4OC43MDcgMCAwMS0xOS41MjktNjYuMzExaDY3LjM4NXoiIGZpbGw9IiM0Mjg1RjQiIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvc3ZnPg==\");\n// }\n", "// Use like this:\n// const enabled = globalSafeDocument?.fullscreenEnabled;\nexport const globalSafeDocument: Document | null =\n typeof document === \"undefined\" ? null : document;\n", "// Ponyfills for prefixing in Safari.\n\nimport { globalSafeDocument } from \"../document\";\n\ndeclare global {\n interface Document {\n webkitFullscreenEnabled?: boolean;\n webkitExitFullscreen?: () => Promise<void>;\n webkitFullscreenElement?: Element | null;\n }\n\n interface Element {\n webkitRequestFullscreen: () => Promise<void>;\n }\n}\n\n// TODO: Can `webkitFullscreenEnabled` change after it's cached at page load?\nexport const fullscreenEnabled: boolean =\n globalSafeDocument?.fullscreenEnabled ||\n !!globalSafeDocument?.webkitFullscreenEnabled;\n\nexport function documentExitFullscreen(): Promise<void> {\n if (document.exitFullscreen) {\n return document.exitFullscreen();\n } else {\n return document.webkitExitFullscreen!(); // YOLO\n }\n}\n\nexport function documentFullscreenElement(): Element | null {\n if (document.fullscreenElement) {\n return document.fullscreenElement;\n } else {\n return document.webkitFullscreenElement ?? null;\n }\n}\n\nexport function requestFullscreen(element: Element): Promise<void> {\n if (element.requestFullscreen) {\n return element.requestFullscreen();\n } else {\n return element.webkitRequestFullscreen();\n }\n}\n", "import type { ButtonCommand } from \"../../../views/control-panel/TwistyButtonsV2\";\nimport { fullscreenEnabled } from \"../../../views/control-panel/webkit-fullscreen\";\nimport type { ViewerLinkPageWithAuto } from \"./ViewerLinkProp\";\nimport type { CoarseTimelineInfo as CoarseTimelineInfo } from \"../timeline/CoarseTimelineInfoProp\";\nimport { TwistyPropDerived } from \"../TwistyProp\";\n\nexport const buttonIcons = [\n \"skip-to-start\",\n \"skip-to-end\",\n \"step-forward\",\n \"step-backward\",\n \"pause\",\n \"play\",\n \"enter-fullscreen\",\n \"exit-fullscreen\",\n \"twizzle-tw\",\n];\nexport type ButtonIcon = typeof buttonIcons[number];\n\ninterface ButtonAppearance {\n enabled: boolean;\n icon: ButtonIcon;\n title: string;\n hidden?: boolean;\n}\nexport type ButtonAppearances = Record<ButtonCommand, ButtonAppearance>;\n\n// TODO: reduce inputs to avoid unnecessary updates.\ninterface ButtonAppearancePropInputs {\n coarseTimelineInfo: CoarseTimelineInfo;\n viewerLink: ViewerLinkPageWithAuto;\n}\n\nexport class ButtonAppearanceProp extends TwistyPropDerived<\n ButtonAppearancePropInputs,\n ButtonAppearances\n> {\n // TODO: This still seems to fire twice for play/pause?\n derive(inputs: ButtonAppearancePropInputs): ButtonAppearances {\n const buttonAppearances = {\n \"fullscreen\": {\n // TODO: Cache?// TODO: Cache?\n enabled: fullscreenEnabled,\n icon:\n // TODO: Check against the expected element?\n // TODO: This will *not* update when we enter/leave fullscreen. We need to work more closely with the controller.\n document.fullscreenElement === null\n ? \"enter-fullscreen\"\n : \"exit-fullscreen\",\n title: \"Enter fullscreen\",\n },\n \"jump-to-start\": {\n enabled: !inputs.coarseTimelineInfo.atStart,\n icon: \"skip-to-start\",\n title: \"Restart\",\n },\n \"play-step-backwards\": {\n enabled: !inputs.coarseTimelineInfo.atStart,\n icon: \"step-backward\",\n title: \"Step backward\",\n },\n \"play-pause\": {\n enabled: true,\n icon: inputs.coarseTimelineInfo.playing ? \"pause\" : \"play\",\n title: inputs.coarseTimelineInfo.playing ? \"Pause\" : \"Play\",\n },\n \"play-step\": {\n enabled: !inputs.coarseTimelineInfo.atEnd,\n icon: \"step-forward\",\n title: \"Step forward\",\n },\n \"jump-to-end\": {\n enabled: !inputs.coarseTimelineInfo.atEnd,\n icon: \"skip-to-end\",\n title: \"Skip to End\",\n },\n \"twizzle-link\": {\n enabled: true,\n icon: \"twizzle-tw\",\n title: \"View at Twizzle\",\n hidden: inputs.viewerLink === \"none\",\n },\n };\n return buttonAppearances;\n }\n}\n", "import { BoundaryType, Direction } from \"../../controllers/AnimationTypes\";\nimport { buttonCSS, buttonGridCSS } from \"./TwistyButtonsV2.css\";\nimport { ClassListManager } from \"../ClassListManager\";\nimport { ManagedCustomElement } from \"../ManagedCustomElement\";\nimport { customElementsShim } from \"../node-custom-element-shims\";\nimport {\n ButtonAppearances,\n ButtonIcon,\n buttonIcons,\n} from \"../../model/props/viewer/ButtonAppearanceProp\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport type { TwistyPlayerController } from \"../../controllers/TwistyPlayerController\";\nimport {\n documentExitFullscreen,\n documentFullscreenElement,\n requestFullscreen,\n} from \"./webkit-fullscreen\";\n\nconst buttonCommands = {\n \"fullscreen\": true,\n \"jump-to-start\": true,\n \"play-step-backwards\": true,\n \"play-pause\": true,\n \"play-step\": true,\n \"jump-to-end\": true,\n \"twizzle-link\": true,\n};\n\nexport type ButtonCommand = keyof typeof buttonCommands;\n\nexport class TwistyButtonsV2 extends ManagedCustomElement {\n buttons: Record<ButtonCommand, TwistyButtonV2> | null = null;\n\n // TODO: Privacy\n constructor(\n public model?: TwistyPlayerModel,\n public controller?: TwistyPlayerController,\n private fullscreenElement?: HTMLElement,\n ) {\n super();\n }\n\n connectedCallback(): void {\n this.addCSS(buttonGridCSS);\n const buttons: Partial<Record<ButtonCommand, TwistyButtonV2>> = {};\n for (const command in buttonCommands) {\n const button = new TwistyButtonV2();\n buttons[command as ButtonCommand] = button;\n // Why does this still fire with the `disabled` attribute?\n button.addEventListener(\"click\", () =>\n this.#onCommand(command as ButtonCommand),\n );\n this.addElement(button);\n }\n this.buttons = buttons as Record<ButtonCommand, TwistyButtonV2>;\n\n this.model?.buttonAppearanceProp.addFreshListener(this.update.bind(this));\n }\n\n #onCommand(command: ButtonCommand) {\n switch (command) {\n case \"fullscreen\":\n this.onFullscreenButton();\n break;\n case \"jump-to-start\":\n this.controller?.jumpToStart({ flash: true });\n break;\n case \"play-step-backwards\":\n this.controller?.animationController.play({\n direction: Direction.Backwards,\n untilBoundary: BoundaryType.Move,\n });\n break;\n case \"play-pause\":\n this.controller?.togglePlay();\n break;\n case \"play-step\":\n this.controller?.animationController.play({\n direction: Direction.Forwards,\n untilBoundary: BoundaryType.Move,\n });\n break;\n case \"jump-to-end\":\n this.controller?.jumpToEnd({ flash: true });\n break;\n case \"twizzle-link\":\n this.controller?.visitTwizzleLink();\n break;\n default:\n throw new Error(\"Missing command\");\n }\n }\n\n // TODO: Should we have a prop, or a way to query if we're fullscreen?\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen\n async onFullscreenButton(): Promise<void> {\n if (!this.fullscreenElement) {\n throw new Error(\"Attempted to go fullscreen without an element.\");\n }\n\n if (documentFullscreenElement() === this.fullscreenElement) {\n documentExitFullscreen();\n } else {\n // TODO: Propagate button info to `ButtonAppearanceProp`.\n this.buttons?.fullscreen.setIcon(\"exit-fullscreen\");\n\n requestFullscreen(this.fullscreenElement);\n\n const onFullscreen = (): void => {\n if (documentFullscreenElement() !== this.fullscreenElement) {\n this.buttons?.fullscreen.setIcon(\"enter-fullscreen\");\n window.removeEventListener(\"fullscreenchange\", onFullscreen);\n }\n };\n window.addEventListener(\"fullscreenchange\", onFullscreen);\n }\n }\n\n async update(buttonAppearances: ButtonAppearances): Promise<void> {\n // TODO: Check that we have every command?\n for (const command in buttonCommands) {\n // TODO: Why doesn't `command` have the type `ButtonCommand`?\n const button = this.buttons![command as ButtonCommand];\n // TODO: track individual changes?\n const info = buttonAppearances[command as ButtonCommand];\n button.button.disabled = !info.enabled;\n button.button.title = info.title;\n button.setIcon(info.icon);\n button.hidden = !!info.hidden;\n // button.textContent = info.icon;\n }\n }\n}\n\ncustomElementsShim.define(\"twisty-buttons-v2\", TwistyButtonsV2);\n\nclass TwistyButtonV2 extends ManagedCustomElement {\n button: HTMLButtonElement = document.createElement(\"button\"); // TODO: async?\n\n connectedCallback() {\n this.addCSS(buttonCSS);\n this.addElement(this.button);\n }\n\n #iconManager: ClassListManager<ButtonIcon> = new ClassListManager(\n this,\n \"svg-\",\n buttonIcons,\n );\n\n setIcon(iconName: ButtonIcon): void {\n this.#iconManager.setValue(iconName);\n }\n}\n\ncustomElementsShim.define(\"twisty-button-v2\", TwistyButtonV2);\n", "import { CSSSource } from \"../ManagedCustomElement\";\n\nexport const twistyScrubberCSS = new CSSSource(`\n:host {\n width: 384px;\n height: 16px;\n display: grid;\n}\n\n.wrapper {\n width: 100%;\n height: 100%;\n display: grid;\n overflow: hidden;\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n}\n\ninput {\n margin: 0; width: 100%;\n}\n\ninput {\n background: none;\n}\n\n::-moz-range-track {\n background: rgba(0, 0, 0, 0.25);\n height: 50%;\n border: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n::-webkit-slider-runnable-track {\n background: rgba(0, 0, 0, 0.05);\n}\n\n::-moz-range-progress {\n background: #3273F6;\n height: 50%;\n border: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n::-ms-fill-lower {\n background: #3273F6;\n height: 50%;\n border: 1px solid rgba(0, 0, 0, 0.1);\n}\n`);\n", "import { twistyScrubberCSS } from \"./TwistyScrubber.css\";\nimport { ManagedCustomElement } from \"../ManagedCustomElement\";\nimport { customElementsShim } from \"../node-custom-element-shims\";\nimport type { DetailedTimelineInfo } from \"../../model/props/timeline/DetailedTimelineInfoProp\";\nimport type { TwistyPlayerModel } from \"../../model/TwistyPlayerModel\";\nimport { globalSafeDocument } from \"../document\";\n\nconst SLOW_DOWN_SCRUBBING = false;\n\nlet isMouseDown = false;\n\nglobalSafeDocument?.addEventListener(\n \"mousedown\",\n function (event) {\n if (event.which) isMouseDown = true;\n },\n true,\n);\n\nglobalSafeDocument?.addEventListener(\n \"mouseup\",\n function (event) {\n if (event.which) isMouseDown = false;\n },\n true,\n);\n\n// var x = 0;\nlet y = 0;\nlet clickNum = 0;\n\nglobalSafeDocument?.addEventListener(\n \"mousedown\",\n () => {\n clickNum++;\n },\n false,\n);\n\nglobalSafeDocument?.addEventListener(\"mousemove\", onMouseUpdate, false);\nglobalSafeDocument?.addEventListener(\"mouseenter\", onMouseUpdate, false);\n\nfunction onMouseUpdate(e: MouseEvent) {\n // x = e.pageX;\n y = e.pageY;\n // console.log(x, y);\n}\n\nconst lastVal = 0;\nlet lastPreval = 0;\nlet scaling: boolean = false;\nlet currentClickNum = 0;\n\n// Values are integers.\nexport class TwistyScrubberV2 extends ManagedCustomElement {\n constructor(public model?: TwistyPlayerModel) {\n super();\n }\n\n async onDetailedTimelineInfo(\n detailedTimelineInfo: DetailedTimelineInfo,\n ): Promise<void> {\n // TODO: is this efficient enough?\n const inputElem = await this.inputElem();\n inputElem.min = detailedTimelineInfo.timeRange.start.toString();\n inputElem.max = detailedTimelineInfo.timeRange.end.toString();\n inputElem.value = detailedTimelineInfo.timestamp.toString();\n }\n\n async connectedCallback(): Promise<void> {\n this.addCSS(twistyScrubberCSS);\n this.addElement(await this.inputElem());\n }\n\n #inputElem: Promise<HTMLInputElement> | null = null;\n async inputElem(): Promise<HTMLInputElement> {\n // console.log(\"inputElem\", this.#inputElem);\n return (this.#inputElem ??= (async () => {\n const elem = document.createElement(\"input\");\n elem.type = \"range\";\n\n // console.log(\"1\");\n this.model?.detailedTimelineInfoProp.addFreshListener(\n this.onDetailedTimelineInfo.bind(this),\n );\n // console.log(\"3\");\n elem.addEventListener(\"input\", this.onInput.bind(this));\n\n return elem;\n })());\n }\n\n async onInput(e: Event): Promise<void> {\n if (scaling) {\n return; // TODO\n }\n const inputElem = await this.inputElem();\n await this.slowDown(e, inputElem); // TODO\n\n const value = parseInt(inputElem.value);\n // console.log(\"on input\", value);\n this.model?.playingInfoProp.set({ playing: false });\n this.model?.timestampRequestProp.set(value);\n }\n\n async slowDown(e: Event, inputElem: HTMLInputElement): Promise<void> {\n if (!SLOW_DOWN_SCRUBBING) {\n return; // TODO\n }\n\n if (isMouseDown) {\n const rect = inputElem.getBoundingClientRect();\n const sliderY = rect.top + rect.height / 2;\n console.log(sliderY, e, y, isMouseDown);\n\n const yDist = Math.abs(sliderY - y);\n let scale = 1;\n if (yDist > 64) {\n scale = Math.max(Math.pow(2, -(yDist - 64) / 64), 1 / 32);\n }\n const preVal = parseInt(inputElem.value);\n console.log(\"cl\", currentClickNum, clickNum, preVal);\n if (currentClickNum === clickNum) {\n const delta = (preVal - lastPreval) * scale;\n console.log(\"delta\", delta, yDist);\n scaling = true;\n let newVal = preVal;\n newVal =\n lastVal +\n delta * scale +\n (preVal - lastVal) *\n Math.min(1, Math.pow(1 / 2, (yDist * yDist) / 64));\n inputElem.value = newVal.toString();\n console.log(scale);\n scaling = false;\n this.contentWrapper.style.opacity = scale.toString();\n } else {\n currentClickNum = clickNum;\n }\n lastPreval = preVal;\n }\n }\n}\n\ncustomElementsShim.define(\"twisty-scrubber-v2\", TwistyScrubberV2);\n", "import { PerspectiveCamera, WebGLRenderer } from \"three\";\nimport { THREEJS } from \"../heavy-code-imports/3d\";\nimport type { TwistyPlayerModel } from \"../model/TwistyPlayerModel\";\nimport { Twisty3DPuzzleWrapper } from \"./3D/Twisty3DPuzzleWrapper\";\nimport { setCameraFromOrbitCoordinates } from \"./3D/Twisty3DVantage\";\n\nexport interface TwistyPlayerScreenshot {\n dataURL: string;\n download: (filename?: string) => Promise<void>;\n}\n\n// TODO: cache\nlet cachedCamera: PerspectiveCamera | null = null;\nexport async function screenshot(\n model: TwistyPlayerModel,\n options?: { width: number; height: number },\n): Promise<TwistyPlayerScreenshot> {\n // TODO: improve async caching\n\n const width = options?.width ?? 2048;\n const height = options?.height ?? 2048;\n const aspectRatio = width / height;\n const camera = (cachedCamera ??= await (async () => {\n return new (await THREEJS).PerspectiveCamera(20, aspectRatio, 0.1, 20);\n })());\n\n const scene = new (await THREEJS).Scene();\n\n const twisty3DWrapper = new Twisty3DPuzzleWrapper(\n model,\n { scheduleRender: () => {} },\n await model.puzzleLoaderProp.get(),\n await model.visualizationStrategyProp.get(),\n );\n\n // TODO: Pass the stickering to the constructor so we don't have to wait..\n await model.stickeringProp.get();\n await new Promise((resolve) => setTimeout(resolve, 1000));\n\n // TODO: Find a more robust way to do this.\n await model.legacyPositionProp.get(); // Force the 3D puzzle listeners for the state to fire.\n\n scene.add(await twisty3DWrapper.twisty3DPuzzle());\n\n const orbitCoordinates = await model.orbitCoordinatesProp.get();\n await setCameraFromOrbitCoordinates(camera, orbitCoordinates);\n\n const renderer = new WebGLRenderer({\n antialias: true,\n alpha: true,\n });\n renderer.setSize(width, height);\n\n renderer.render(scene, camera);\n const dataURL = renderer.domElement.toDataURL();\n\n const defaultFilename = await getDefaultFilename(model);\n\n return {\n dataURL,\n download: async (filename?: string) => {\n downloadURL(dataURL, filename ?? defaultFilename);\n },\n };\n}\n\nexport async function getDefaultFilename(\n model: TwistyPlayerModel,\n): Promise<string> {\n const [puzzleID, algWithIssues] = await Promise.all([\n model.puzzleIDProp.get(),\n model.algProp.get(),\n ]);\n return `[${puzzleID}]${\n algWithIssues.alg.experimentalNumUnits() === 0\n ? \"\"\n : \" \" + algWithIssues.alg.toString()\n }`;\n}\n\nexport function downloadURL(\n url: string,\n name: string,\n extension: string = \"png\",\n): void {\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = `${name}.${extension}`;\n a.click();\n}\n", "import { Alg } from \"../../../../../alg\";\nimport { arrayEquals } from \"../../../helpers\";\nimport { TwistyPropSource } from \"../../TwistyProp\";\n\nexport class AlgIssues {\n // TODO: (string | Error)[]\n\n readonly warnings: readonly string[];\n readonly errors: readonly string[];\n\n constructor(issues?: { warnings?: string[]; errors?: string[] }) {\n // TODO: clone inputs?\n this.warnings = Object.freeze(issues?.warnings ?? []);\n this.errors = Object.freeze(issues?.errors ?? []);\n Object.freeze(this);\n }\n\n add(issues?: { warnings?: string[]; errors?: string[] }) {\n return new AlgIssues({\n warnings: this.warnings.concat(issues?.warnings ?? []),\n errors: this.errors.concat(issues?.errors ?? []),\n });\n }\n\n /** @deprecated */\n log() {\n if (this.errors.length > 0) {\n console.error(`\uD83D\uDEA8 ${this.errors[0]}`);\n } else if (this.warnings.length > 0) {\n console.warn(`\u26A0\uFE0F ${this.warnings[0]}`);\n } else {\n console.info(\"\uD83D\uDE0E No issues!\");\n }\n }\n}\n\nexport interface AlgWithIssues {\n alg: Alg;\n issues: AlgIssues;\n}\n\nexport function algWithIssuesFromString(s: string): AlgWithIssues {\n try {\n const alg = Alg.fromString(s); // TODO: is this safe?\n const warnings = [];\n if (alg.toString() !== s) {\n // TODO: Push this check into the parser and return semantic info (so they can be e.g. highlighted).\n warnings.push(`Alg is non-canonical!`);\n }\n return {\n alg,\n issues: new AlgIssues({ warnings }),\n };\n } catch (e) {\n return {\n alg: new Alg(),\n issues: new AlgIssues({\n errors: [`Malformed alg: ${(e as Error).toString()}`],\n }),\n };\n }\n}\n\nfunction algWithIssuesEquals(a1: AlgWithIssues, a2: AlgWithIssues): boolean {\n return (\n a1.alg.isIdentical(a2.alg) &&\n arrayEquals(a1.issues.warnings, a2.issues.warnings) &&\n arrayEquals(a1.issues.errors, a2.issues.errors)\n );\n}\n\nexport class AlgProp extends TwistyPropSource<AlgWithIssues, Alg | string> {\n getDefaultValue(): AlgWithIssues {\n return { alg: new Alg(), issues: new AlgIssues() };\n }\n\n canReuseValue(v1: AlgWithIssues, v2: AlgWithIssues) {\n return algWithIssuesEquals(v1, v2);\n }\n\n async derive(newAlg: Alg | string): Promise<AlgWithIssues> {\n if (typeof newAlg === \"string\") {\n return algWithIssuesFromString(newAlg);\n } else {\n return {\n alg: newAlg,\n issues: new AlgIssues(),\n };\n }\n }\n}\n", "import { SimpleTwistyPropSource } from \"../TwistyProp\";\n\nexport const backgroundThemes = {\n checkered: true, // default\n none: true,\n};\nexport type BackgroundTheme = keyof typeof backgroundThemes;\n\nexport type BackgroundThemeWithAuto = BackgroundTheme | \"auto\";\n\nexport class BackgroundProp extends SimpleTwistyPropSource<BackgroundThemeWithAuto> {\n getDefaultValue(): BackgroundThemeWithAuto {\n return \"auto\";\n }\n}\n", "import { SimpleTwistyPropSource } from \"../TwistyProp\";\n\nexport const backViewLayouts = {\n \"none\": true, // default\n \"side-by-side\": true,\n \"top-right\": true,\n};\nexport type BackViewLayout = keyof typeof backViewLayouts;\n\nexport type BackViewLayoutWithAuto = BackViewLayout | \"auto\";\n\nexport class BackViewProp extends SimpleTwistyPropSource<BackViewLayoutWithAuto> {\n getDefaultValue(): BackViewLayoutWithAuto {\n return \"auto\";\n }\n}\n", "import { AlgProp } from \"./props/puzzle/state/AlgProp\";\nimport { BackgroundProp } from \"./props/viewer/BackgroundProp\";\nimport { BackViewProp } from \"./props/viewer/BackViewProp\";\nimport { ControlPanelProp } from \"./props/viewer/ControlPanelProp\";\nimport { HintFaceletProp } from \"./props/puzzle/display/HintFaceletProp\";\nimport { IndexerConstructorRequestProp } from \"./props/puzzle/state/IndexerConstructorRequestProp\";\nimport { LatitudeLimitProp } from \"./props/viewer/LatitudeLimit\";\nimport { OrbitCoordinatesRequestProp } from \"./props/viewer/OrbitCoordinatesRequestProp\";\nimport { PlayingInfoProp } from \"./props/timeline/PlayingInfoProp\";\nimport { PGPuzzleDescriptionStringProp } from \"./props/puzzle/structure/PuzzleDescriptionProp\";\nimport { PuzzleIDRequestProp } from \"./props/puzzle/structure/PuzzleIDRequestProp\";\nimport { PuzzleLoaderProp } from \"./props/puzzle/structure/PuzzleLoaderProp\";\nimport { SetupAnchorProp } from \"./props/puzzle/state/SetupAnchorProp\";\nimport { StickeringProp } from \"./props/puzzle/display/StickeringProp\";\nimport { TempoScaleProp } from \"./props/timeline/TempoScaleProp\";\nimport { TimestampRequestProp } from \"./props/timeline/TimestampRequestProp\";\nimport { URLProp } from \"./props/general/URLProp\";\nimport { ViewerLinkProp } from \"./props/viewer/ViewerLinkProp\";\nimport { VisualizationFormatProp } from \"./props/viewer/VisualizationProp\";\nimport { OrbitCoordinatesProp } from \"./props/viewer/OrbitCoordinatesProp\";\nimport { PuzzleIDProp } from \"./props/puzzle/structure/PuzzleIDProp\";\nimport { SpriteProp } from \"./props/puzzle/display/SpriteProp\";\nimport { VisualizationStrategyProp } from \"./props/viewer/VisualizationStrategyProp\";\nimport { IndexerConstructorProp } from \"./props/puzzle/state/IndexerConstructorProp\";\nimport { PuzzleAlgProp } from \"./props/puzzle/state/PuzzleAlgProp\";\nimport { AlgTransformationProp } from \"./props/puzzle/state/AlgTransformationProp\";\nimport { IndexerProp } from \"./props/puzzle/state/IndexerProp\";\nimport { AnchoredStartProp } from \"./props/puzzle/state/AnchoredStartProp\";\nimport { TimeRangeProp } from \"./props/viewer/TimeRangeProp\";\nimport { DetailedTimelineInfoProp } from \"./props/timeline/DetailedTimelineInfoProp\";\nimport { CoarseTimelineInfoProp } from \"./props/timeline/CoarseTimelineInfoProp\";\nimport { CurrentLeavesProp } from \"./props/puzzle/state/CurrentLeavesProp\";\nimport { ButtonAppearanceProp } from \"./props/viewer/ButtonAppearanceProp\";\nimport { CurrentLeavesSimplifiedProp } from \"./props/puzzle/state/CurrentLeavesSimplified\";\nimport { CurrentTransformationProp } from \"./props/puzzle/state/CurrentTransformationProp\";\nimport { LegacyPositionProp } from \"./props/puzzle/state/LegacyPositionProp\";\nimport { PuzzleDefProp } from \"./props/puzzle/structure/PuzzleDefProp\";\nimport { UserVisibleErrorTracker } from \"./UserVisibleErrorTracker\";\nimport { CatchUpMoveProp } from \"./props/puzzle/state/CatchUpMoveProp\";\nimport { experimentalAppendMove, Move } from \"../../alg\";\nimport { NaiveMoveCountProp } from \"./props/puzzle/state/NaiveMoveCountProp\";\nimport { MovePressInputProp } from \"./props/puzzle/state/MovePressInputProp\";\nimport { FoundationDisplayProp } from \"./props/puzzle/display/FoundationDisplayProp\";\n\nexport class TwistyPlayerModel {\n // TODO: incorporate error handling into the entire prop graph.\n // TODO: Make this something that can't get confused with normal props?\n userVisibleErrorTracker = new UserVisibleErrorTracker();\n\n // TODO: Redistribute and group props with controllers.\n\n // Depth 0\n algProp = new AlgProp();\n backgroundProp = new BackgroundProp();\n backViewProp = new BackViewProp();\n controlPanelProp = new ControlPanelProp();\n catchUpMoveProp = new CatchUpMoveProp();\n foundationDisplayProp = new FoundationDisplayProp();\n foundationStickerSpriteURL = new URLProp();\n hintFaceletProp = new HintFaceletProp();\n hintStickerSpriteURL = new URLProp();\n indexerConstructorRequestProp = new IndexerConstructorRequestProp();\n latitudeLimitProp = new LatitudeLimitProp();\n movePressInputProp = new MovePressInputProp();\n orbitCoordinatesRequestProp: OrbitCoordinatesRequestProp =\n new OrbitCoordinatesRequestProp();\n playingInfoProp = new PlayingInfoProp();\n puzzleDescriptionRequestProp = new PGPuzzleDescriptionStringProp();\n puzzleIDRequestProp = new PuzzleIDRequestProp();\n setupAnchorProp = new SetupAnchorProp();\n setupProp = new AlgProp();\n stickeringProp = new StickeringProp();\n tempoScaleProp = new TempoScaleProp();\n timestampRequestProp = new TimestampRequestProp();\n viewerLinkProp = new ViewerLinkProp();\n visualizationFormatProp = new VisualizationFormatProp();\n\n // Depth 1\n foundationStickerSprite = new SpriteProp({\n spriteURL: this.foundationStickerSpriteURL,\n });\n\n hintStickerSprite = new SpriteProp({\n spriteURL: this.hintStickerSpriteURL,\n });\n\n puzzleLoaderProp = new PuzzleLoaderProp(\n {\n puzzleIDRequest: this.puzzleIDRequestProp,\n puzzleDescriptionRequest: this.puzzleDescriptionRequestProp,\n },\n this.userVisibleErrorTracker,\n );\n\n // Depth 2\n puzzleDefProp = new PuzzleDefProp({ puzzleLoader: this.puzzleLoaderProp });\n\n puzzleIDProp = new PuzzleIDProp({ puzzleLoader: this.puzzleLoaderProp });\n\n // Depth 3\n\n puzzleAlgProp = new PuzzleAlgProp({\n algWithIssues: this.algProp,\n puzzleDef: this.puzzleDefProp,\n });\n\n puzzleSetupProp = new PuzzleAlgProp({\n algWithIssues: this.setupProp,\n puzzleDef: this.puzzleDefProp,\n });\n\n visualizationStrategyProp = new VisualizationStrategyProp({\n visualizationRequest: this.visualizationFormatProp,\n puzzleID: this.puzzleIDProp,\n });\n\n // Depth 4\n indexerConstructorProp = new IndexerConstructorProp({\n alg: this.algProp,\n puzzle: this.puzzleIDProp,\n visualizationStrategy: this.visualizationStrategyProp,\n indexerConstructorRequest: this.indexerConstructorRequestProp,\n });\n\n moveCountProp = new NaiveMoveCountProp({ alg: this.puzzleAlgProp });\n\n orbitCoordinatesProp = new OrbitCoordinatesProp({\n orbitCoordinatesRequest: this.orbitCoordinatesRequestProp,\n latitudeLimit: this.latitudeLimitProp,\n puzzleID: this.puzzleIDProp,\n strategy: this.visualizationStrategyProp,\n });\n\n setupTransformationProp = new AlgTransformationProp({\n alg: this.puzzleSetupProp,\n def: this.puzzleDefProp,\n });\n\n // Depth 5\n indexerProp = new IndexerProp({\n indexerConstructor: this.indexerConstructorProp,\n algWithIssues: this.puzzleAlgProp,\n def: this.puzzleDefProp,\n });\n\n // Depth 6\n anchoredStartProp = new AnchoredStartProp({\n setupAnchor: this.setupAnchorProp,\n setupTransformation: this.setupTransformationProp,\n indexer: this.indexerProp,\n def: this.puzzleDefProp,\n });\n\n timeRangeProp = new TimeRangeProp({\n indexer: this.indexerProp,\n });\n\n // Depth 7\n detailedTimelineInfoProp: DetailedTimelineInfoProp =\n new DetailedTimelineInfoProp({\n timestampRequest: this.timestampRequestProp,\n timeRange: this.timeRangeProp,\n setupAnchor: this.setupAnchorProp,\n });\n\n // Depth 8\n coarseTimelineInfoProp = new CoarseTimelineInfoProp({\n detailedTimelineInfo: this.detailedTimelineInfoProp,\n playingInfo: this.playingInfoProp,\n });\n\n currentLeavesProp = new CurrentLeavesProp({\n indexer: this.indexerProp,\n detailedTimelineInfo: this.detailedTimelineInfoProp,\n catchUpMove: this.catchUpMoveProp,\n });\n\n // Depth 9\n // TODO: Inline Twisty3D management.\n buttonAppearanceProp = new ButtonAppearanceProp({\n coarseTimelineInfo: this.coarseTimelineInfoProp,\n viewerLink: this.viewerLinkProp,\n });\n\n currentLeavesSimplifiedProp = new CurrentLeavesSimplifiedProp({\n currentMoveInfo: this.currentLeavesProp,\n });\n\n // Depth 10\n currentTransformationProp = new CurrentTransformationProp({\n anchoredStart: this.anchoredStartProp,\n currentLeavesSimplified: this.currentLeavesSimplifiedProp,\n indexer: this.indexerProp,\n def: this.puzzleDefProp,\n });\n\n // Depth 11\n legacyPositionProp = new LegacyPositionProp({\n currentMoveInfo: this.currentLeavesProp,\n transformation: this.currentTransformationProp,\n });\n\n public async twizzleLink(): Promise<string> {\n const url = new URL(\"https://alpha.twizzle.net/edit/\");\n\n const [puzzle, alg, setup, anchor, experimentalStickering] = await Promise.all([\n this.puzzleIDProp.get(),\n this.algProp.get(),\n this.setupProp.get(),\n this.setupAnchorProp.get(),\n this.stickeringProp.get(),\n ]);\n\n if (!alg.alg.experimentalIsEmpty()) {\n url.searchParams.set(\"alg\", alg.alg.toString());\n }\n if (!setup.alg.experimentalIsEmpty()) {\n url.searchParams.set(\"setup-alg\", setup.alg.toString());\n }\n if (anchor !== \"start\") {\n url.searchParams.set(\"setup-anchor\", anchor);\n }\n if (experimentalStickering !== \"full\") {\n url.searchParams.set(\n \"experimental-stickering\",\n experimentalStickering,\n );\n }\n if (puzzle !== \"3x3x3\") {\n url.searchParams.set(\"puzzle\", puzzle);\n }\n return url.toString();\n }\n\n // TODO: Animate the new move.\n experimentalAddMove(\n flexibleMove: Move | string,\n options: { coalesce?: boolean; mod?: number } = {},\n ): void {\n const move =\n typeof flexibleMove === \"string\" ? new Move(flexibleMove) : flexibleMove;\n (async () => {\n const alg = (await this.algProp.get()).alg;\n const newAlg = experimentalAppendMove(alg, move, {\n coalesce: options?.coalesce,\n mod: options?.mod,\n });\n this.algProp.set(newAlg);\n this.timestampRequestProp.set(\"end\");\n this.catchUpMoveProp.set({\n move: move,\n amount: 0,\n });\n })();\n }\n}\n", "import { SimpleTwistyPropSource } from \"../../TwistyProp\";\n\nexport const indexerStrategyNames = {\n auto: true,\n simple: true,\n tree: true,\n simultaneous: true,\n};\nexport type IndexerStrategyName = keyof typeof indexerStrategyNames;\n\nexport class IndexerConstructorRequestProp extends SimpleTwistyPropSource<IndexerStrategyName> {\n getDefaultValue(): IndexerStrategyName {\n return \"auto\";\n }\n}\n", "import { SimpleTwistyPropSource } from \"../TwistyProp\";\nimport type { CoordinateDegrees } from \"./OrbitCoordinatesRequestProp\";\n\n// Similar to https://alg.cubing.net/\nconst DEFAULT_LATITUDE_LIMIT = 35;\n\nexport class LatitudeLimitProp extends SimpleTwistyPropSource<CoordinateDegrees> {\n getDefaultValue(): CoordinateDegrees {\n return DEFAULT_LATITUDE_LIMIT;\n }\n}\n", "import { mod } from \"../../helpers\";\nimport { TwistyPropSource } from \"../TwistyProp\";\n\nexport type CoordinateDegrees = number;\n\nexport interface OrbitCoordinates {\n latitude: CoordinateDegrees;\n longitude: CoordinateDegrees;\n distance: number;\n}\n\nexport function orbitCoordinatesEqual(\n c1: OrbitCoordinates,\n c2: OrbitCoordinates,\n): boolean {\n return (\n c1.latitude === c2.latitude &&\n c1.longitude === c2.longitude &&\n c1.distance === c2.distance\n );\n}\n\n// TOOD: Check if freezing affects perf.\n// const DEFAULT_COORDINATES = Object.freeze({\n// latitude: 35,\n// longitude: 30,\n// distance: 6,\n// });\n\nexport type OrbitCoordinatesRequest = Partial<OrbitCoordinates> | \"auto\";\n\n// TODO: Put the \"auto\" calculations in a separate place.\nexport class OrbitCoordinatesRequestProp extends TwistyPropSource<\n OrbitCoordinatesRequest,\n Partial<OrbitCoordinates> | \"auto\"\n> {\n getDefaultValue(): OrbitCoordinatesRequest {\n return \"auto\";\n }\n\n canReuseValue(v1: OrbitCoordinates, v2: OrbitCoordinates) {\n return v1 === v2 || orbitCoordinatesEqual(v1, v2);\n }\n\n async derive(\n newCoordinates: Partial<OrbitCoordinates> | \"auto\",\n oldValuePromise: Promise<OrbitCoordinatesRequest>,\n ): Promise<OrbitCoordinatesRequest> {\n if (newCoordinates === \"auto\") {\n return \"auto\";\n }\n\n let oldValue = await oldValuePromise;\n if (oldValue === \"auto\") {\n oldValue = {};\n }\n\n const newValue: Partial<OrbitCoordinates> = Object.assign({}, oldValue);\n Object.assign(newValue, newCoordinates);\n\n if (typeof newValue.latitude !== \"undefined\") {\n newValue.latitude = Math.min(Math.max(newValue.latitude, -90), 90);\n }\n if (typeof newValue.longitude !== \"undefined\") {\n newValue.longitude = mod(newValue.longitude, 360, 180);\n }\n return newValue;\n }\n}\n", "import { BoundaryType, Direction } from \"../../../controllers/AnimationTypes\";\nimport { TwistyPropSource } from \"../TwistyProp\";\n\nexport type SimpleDirection = Direction.Forwards | Direction.Backwards;\n\nexport interface PlayingInfo {\n playing: boolean;\n direction: SimpleDirection;\n untilBoundary: BoundaryType; // TODO: allows this to be optional in the setter?\n // TODO: Is `loop` responsible to add at this point? Maybe we should wait until we've figured out autoplay?\n // TODO: Combine `loop` into something with BoundaryType?\n loop: boolean;\n}\n\n// TODO: direction,\nexport class PlayingInfoProp extends TwistyPropSource<\n PlayingInfo,\n Partial<PlayingInfo>\n> {\n async getDefaultValue(): Promise<PlayingInfo> {\n return {\n direction: Direction.Forwards,\n playing: false,\n untilBoundary: BoundaryType.EntireTimeline,\n loop: false,\n };\n }\n\n async derive(\n newInfo: Partial<PlayingInfo>,\n oldValuePromise: Promise<PlayingInfo>,\n ): Promise<PlayingInfo> {\n const oldValue = await oldValuePromise;\n\n const newValue: PlayingInfo = Object.assign({}, oldValue);\n Object.assign(newValue, newInfo);\n return newValue;\n }\n\n canReuseValue(v1: PlayingInfo, v2: PlayingInfo) {\n return (\n v1.direction === v2.direction &&\n v1.playing === v2.playing &&\n v1.untilBoundary === v2.untilBoundary &&\n v1.loop === v2.loop\n );\n }\n}\n", "import type { PuzzleDescriptionString } from \"../../../../../puzzle-geometry/PGPuzzles\";\nimport {\n NoValueType,\n NO_VALUE,\n SimpleTwistyPropSource,\n} from \"../../TwistyProp\";\n\nexport class PGPuzzleDescriptionStringProp extends SimpleTwistyPropSource<\n PuzzleDescriptionString | NoValueType\n> {\n getDefaultValue(): PuzzleDescriptionString | NoValueType {\n return NO_VALUE;\n }\n}\n", "import {\n NoValueType,\n NO_VALUE,\n SimpleTwistyPropSource,\n} from \"../../TwistyProp\";\n\nexport const puzzleIDs = {\n \"3x3x3\": true, // default\n \"custom\": true,\n \"2x2x2\": true,\n \"4x4x4\": true,\n \"5x5x5\": true,\n \"6x6x6\": true,\n \"7x7x7\": true,\n \"40x40x40\": true,\n \"megaminx\": true,\n \"pyraminx\": true,\n \"square1\": true,\n \"clock\": true,\n \"skewb\": true,\n \"fto\": true,\n \"gigaminx\": true,\n \"master_tetraminx\": true,\n};\nexport type PuzzleID = keyof typeof puzzleIDs;\n\n// TODO: Ideally we'd use `null` to mean \"no value\", but `null` has a special meaning\n// for `TwistyProp` and might mess with caching.\n// https://github.com/cubing/cubing.js/blob/63b0a55b83963f68410bb117a2e481052a07e086/src/cubing/twisty/model/TwistyProp.ts#L189-L189\nexport class PuzzleIDRequestProp extends SimpleTwistyPropSource<\n PuzzleID | NoValueType\n> {\n getDefaultValue(): PuzzleID | NoValueType {\n return NO_VALUE;\n }\n}\n", "import type { PuzzleDescriptionString } from \"../../../../../puzzle-geometry/PGPuzzles\";\nimport {\n cube3x3x3,\n experimentalCustomPGPuzzleLoader,\n PuzzleLoader,\n puzzles,\n} from \"../../../../../puzzles\";\nimport { NoValueType, NO_VALUE, TwistyPropDerived } from \"../../TwistyProp\";\nimport type { PuzzleID } from \"./PuzzleIDRequestProp\";\n8;\ninterface PuzzleLoaderPropInputs {\n puzzleIDRequest: PuzzleID | NoValueType;\n puzzleDescriptionRequest: PuzzleDescriptionString | NoValueType;\n}\n\nexport class PuzzleLoaderProp extends TwistyPropDerived<\n PuzzleLoaderPropInputs,\n PuzzleLoader\n> {\n derive(inputs: PuzzleLoaderPropInputs): PuzzleLoader {\n if (inputs.puzzleIDRequest && inputs.puzzleIDRequest !== NO_VALUE) {\n const puzzleLoader = puzzles[inputs.puzzleIDRequest];\n if (!puzzleLoader) {\n this.userVisibleErrorTracker!.set({\n errors: [`Invalid puzzle ID: ${inputs.puzzleIDRequest}`],\n });\n }\n return puzzleLoader;\n }\n if (\n inputs.puzzleDescriptionRequest &&\n inputs.puzzleDescriptionRequest !== NO_VALUE\n ) {\n return experimentalCustomPGPuzzleLoader(inputs.puzzleDescriptionRequest);\n }\n return cube3x3x3;\n }\n}\n", "import { SimpleTwistyPropSource } from \"../../TwistyProp\";\n\n// TODO: turn these maps into lists?\nexport const setupToLocations = {\n start: true, // default // TODO: \"beginning\"\n end: true,\n};\nexport type SetupToLocation = keyof typeof setupToLocations;\n\nexport class SetupAnchorProp extends SimpleTwistyPropSource<SetupToLocation> {\n getDefaultValue(): SetupToLocation {\n return \"start\";\n }\n}\n", "import { TwistyPropSource } from \"../TwistyProp\";\n\n// TODO: Pick a better name. `speed` is probably good, although that could mean\n// something else (e.g. shorter, faster moves but still with the same spacing).\nexport class TempoScaleProp extends TwistyPropSource<number, number> {\n getDefaultValue(): number {\n return 1;\n }\n\n derive(v: number): number {\n return v < 0 ? 1 : v;\n }\n}\n", "import type { MillisecondTimestamp } from \"../../../controllers/AnimationTypes\";\nimport { SimpleTwistyPropSource } from \"../TwistyProp\";\n\nconst smartTimestamps = {\n \"start\": true,\n \"end\": true,\n \"anchor\": true,\n \"opposite-anchor\": true,\n};\n\nexport type TimestampRequest =\n | MillisecondTimestamp\n | keyof typeof smartTimestamps;\n\nexport class TimestampRequestProp extends SimpleTwistyPropSource<TimestampRequest> {\n getDefaultValue(): TimestampRequest {\n return \"opposite-anchor\";\n }\n\n // TODO: Support `Promise`\n set(v: TimestampRequest) {\n if (!this.validInput(v)) {\n // TODO: Generalize this to more props. How do we surface this? Throw an error and catch it from sync setters that call into this?\n return;\n }\n super.set(v);\n }\n\n validInput(v: TimestampRequest): boolean {\n if (typeof v === \"number\") {\n return true;\n }\n if (smartTimestamps[v]) {\n return true;\n }\n return false;\n }\n}\n", "import { TwistyPropSource } from \"../TwistyProp\";\n\nexport class URLProp extends TwistyPropSource<URL | null, URL | string | null> {\n getDefaultValue(): URL | null {\n return null;\n }\n\n derive(input: URL | string | null): URL | null {\n if (typeof input === \"string\") {\n return new URL(input, location.href); // TODO\n }\n return input;\n }\n}\n", "import { SimpleTwistyPropSource } from \"../TwistyProp\";\n\nexport const viewerLinkPages = {\n twizzle: true, // default\n none: true,\n};\nexport type ViewerLinkPage = keyof typeof viewerLinkPages;\nexport type ViewerLinkPageWithAuto = ViewerLinkPage | \"auto\";\n\nexport class ViewerLinkProp extends SimpleTwistyPropSource<ViewerLinkPageWithAuto> {\n getDefaultValue(): ViewerLinkPageWithAuto {\n return \"auto\";\n }\n}\n", "import { SimpleTwistyPropSource } from \"../TwistyProp\";\n\n// TODO: turn these maps into lists?\nexport const visualizationFormats = {\n \"3D\": true, // default\n \"2D\": true,\n \"experimental-2D-LL\": true, // TODO\n \"PG3D\": true,\n};\nexport type VisualizationFormat = keyof typeof visualizationFormats;\nexport type VisualizationFormatWithAuto = VisualizationFormat | \"auto\";\n\nexport class VisualizationFormatProp extends SimpleTwistyPropSource<VisualizationFormatWithAuto> {\n getDefaultValue(): VisualizationFormatWithAuto {\n return \"auto\";\n }\n}\n", "import { DEGREES_PER_RADIAN } from \"../../../views/3D/TAU\";\nimport type { PuzzleID } from \"../puzzle/structure/PuzzleIDRequestProp\";\nimport { TwistyPropDerived } from \"../TwistyProp\";\nimport {\n CoordinateDegrees,\n OrbitCoordinates,\n orbitCoordinatesEqual,\n OrbitCoordinatesRequest,\n} from \"./OrbitCoordinatesRequestProp\";\nimport type { VisualizationStrategy } from \"./VisualizationStrategyProp\";\n\ninterface OrbitCoordinatesPropInputs {\n orbitCoordinatesRequest: OrbitCoordinatesRequest;\n latitudeLimit: CoordinateDegrees;\n puzzleID: PuzzleID;\n strategy: VisualizationStrategy;\n}\n\nexport class OrbitCoordinatesProp extends TwistyPropDerived<\n OrbitCoordinatesPropInputs,\n OrbitCoordinates\n> {\n canReuseValue(v1: OrbitCoordinates, v2: OrbitCoordinates) {\n return orbitCoordinatesEqual(v1, v2);\n }\n\n async derive(inputs: OrbitCoordinatesPropInputs): Promise<OrbitCoordinates> {\n if (inputs.orbitCoordinatesRequest === \"auto\") {\n return defaultCameraOrbitCoordinates(inputs.puzzleID, inputs.strategy);\n }\n\n const req: OrbitCoordinates = Object.assign(\n Object.assign(\n {},\n defaultCameraOrbitCoordinates(inputs.puzzleID, inputs.strategy),\n inputs.orbitCoordinatesRequest,\n ),\n );\n\n if (Math.abs(req.latitude) <= inputs.latitudeLimit) {\n return req;\n } else {\n const { latitude, longitude, distance } = req;\n // TODO: Should we re-normalize the request, so we don't depend on normalization in the input?\n return {\n latitude: inputs.latitudeLimit * Math.sign(latitude),\n longitude,\n distance,\n };\n }\n }\n}\n\n// const DEFAULT_CAMERA_Z = 5;\n// // Golden ratio is perfect for FTO and Megaminx.\n// const DEFAULT_CAMERA_Y = DEFAULT_CAMERA_Z * (2 / (1 + Math.sqrt(5)));\nexport const centeredCameraOrbitCoordinates: OrbitCoordinates = {\n latitude: 31.717474411461005,\n longitude: 0,\n distance: 5.877852522924731,\n};\n\n// This is tuned so that the hint facelets for 3x3x3 always fit in the canvas.\nexport const cubeCube3DCameraOrbitCoordinates: OrbitCoordinates = {\n latitude: 35,\n longitude: 30,\n distance: 6,\n};\n\n// This is tuned so that the hint facelets always fit in the canvas.\nexport const cubePG3DCameraOrbitCoordinates: OrbitCoordinates = {\n latitude: 35,\n longitude: 30,\n distance: 6.25,\n};\n\nexport const megaminxCameraOrbitCoordinates: OrbitCoordinates = {\n latitude: Math.atan(1 / 2) * DEGREES_PER_RADIAN,\n longitude: 0,\n distance: 6.7,\n};\n\nexport const pyraminxCameraOrbitCoordinates: OrbitCoordinates = {\n latitude: 26.56505117707799,\n longitude: 0,\n distance: 6,\n};\n\nexport const cornerCameraOrbitCoordinates: OrbitCoordinates = {\n latitude: 35.264389682754654,\n longitude: 45,\n distance: 6.928203230275509,\n};\n\n// TODO\nexport function defaultCameraOrbitCoordinates(\n puzzleID: PuzzleID,\n strategy: VisualizationStrategy,\n): OrbitCoordinates {\n if (puzzleID[1] === \"x\") {\n if (strategy === \"Cube3D\") {\n return cubeCube3DCameraOrbitCoordinates;\n } else {\n return cubePG3DCameraOrbitCoordinates;\n }\n } else {\n switch (puzzleID) {\n case \"megaminx\":\n case \"gigaminx\":\n return megaminxCameraOrbitCoordinates;\n case \"pyraminx\":\n case \"master_tetraminx\":\n return pyraminxCameraOrbitCoordinates;\n case \"skewb\":\n return cubePG3DCameraOrbitCoordinates;\n default:\n return centeredCameraOrbitCoordinates;\n }\n }\n}\n// TODO: templatize\nexport interface ManagedAttribute<K> {\n string: string;\n value: K;\n setString(s: string): boolean;\n setValue(v: K): boolean;\n}\n", "import type { PuzzleLoader } from \"../../../../../puzzles\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\nimport type { PuzzleID } from \"./PuzzleIDRequestProp\";\n\nexport class PuzzleIDProp extends TwistyPropDerived<\n { puzzleLoader: PuzzleLoader },\n PuzzleID\n> {\n async derive(inputs: { puzzleLoader: PuzzleLoader }): Promise<PuzzleID> {\n return inputs.puzzleLoader.id as PuzzleID;\n }\n}\n", "import type { Texture, TextureLoader } from \"three\";\nimport { THREEJS } from \"../../../../heavy-code-imports/3d\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\n\nlet cachedLoader: TextureLoader | null = null;\nasync function loader(): Promise<TextureLoader> {\n return (cachedLoader ??= new (await THREEJS).TextureLoader());\n}\n\ntype SpritePropInputs = {\n spriteURL: URL | null;\n};\n\n// TODO: Find a way to make the 3D elements own this, instead of the main `TwistyPlayerModel`.\nexport class SpriteProp extends TwistyPropDerived<\n SpritePropInputs,\n Texture | null\n> {\n async derive(inputs: SpritePropInputs): Promise<Texture | null> {\n const { spriteURL: textureURL } = inputs;\n if (textureURL === null) {\n return null;\n }\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, _reject) => {\n const onLoadingError = (): void => {\n console.warn(\"Could not load sprite:\", textureURL.toString());\n resolve(null);\n };\n // TODO: provide a way to listen for errors?\n try {\n (await loader()).load(\n textureURL.toString(),\n resolve,\n onLoadingError,\n onLoadingError,\n );\n } catch (e) {\n onLoadingError();\n }\n });\n }\n}\n", "import type { VisualizationFormatWithAuto } from \"./VisualizationProp\";\nimport { TwistyPropDerived } from \"../TwistyProp\";\nimport type { PuzzleID } from \"../../..\";\n\ntype VisualizationStrategyPropInputs = {\n visualizationRequest: VisualizationFormatWithAuto;\n puzzleID: PuzzleID;\n};\n\nexport type VisualizationStrategy =\n | \"Cube3D\"\n | \"2D\"\n | \"experimental-2D-LL\"\n | \"PG3D\";\n\nexport class VisualizationStrategyProp extends TwistyPropDerived<\n VisualizationStrategyPropInputs,\n VisualizationStrategy\n> {\n derive(inputs: VisualizationStrategyPropInputs): VisualizationStrategy {\n switch (inputs.puzzleID) {\n case \"clock\":\n case \"square1\":\n return \"2D\";\n case \"3x3x3\":\n switch (inputs.visualizationRequest) {\n case \"auto\":\n case \"3D\":\n return \"Cube3D\";\n default:\n return inputs.visualizationRequest;\n }\n default:\n switch (inputs.visualizationRequest) {\n case \"auto\":\n case \"3D\":\n return \"PG3D\";\n case \"experimental-2D-LL\":\n return \"2D\";\n default:\n return inputs.visualizationRequest;\n }\n }\n }\n}\n", "// TODO: move this file somewhere permanent.\nimport {\n Alg,\n Grouping,\n LineComment,\n Commutator,\n Conjugate,\n Move,\n Newline,\n Pause,\n TraversalUp,\n} from \"../alg\";\n\n/*\n * For movecount, that understands puzzle rotations. This code\n * should be moved to the alg class, probably.\n */\nclass CountMoves extends TraversalUp<number> {\n constructor(private metric: (move: Move) => number) {\n super();\n }\n\n public traverseAlg(alg: Alg): number {\n let r = 0;\n for (const unit of alg.units()) {\n r += this.traverseUnit(unit);\n }\n return r;\n }\n\n public traverseGrouping(grouping: Grouping): number {\n // const unit: Unit = Alg.fromString(\"SDf\");\n // console.log(unit);\n const alg: Alg = grouping.alg;\n return this.traverseAlg(alg) * Math.abs(grouping.amount);\n }\n\n public traverseMove(move: Move): number {\n return this.metric(move);\n }\n\n public traverseCommutator(commutator: Commutator): number {\n return (\n 2 * (this.traverseAlg(commutator.A) + this.traverseAlg(commutator.B))\n );\n }\n\n public traverseConjugate(conjugate: Conjugate): number {\n return 2 * this.traverseAlg(conjugate.A) + this.traverseAlg(conjugate.B);\n }\n\n // TODO: Remove spaces between repeated pauses (in traverseSequence)\n public traversePause(_pause: Pause): number {\n return 0;\n }\n\n public traverseNewline(_newLine: Newline): number {\n return 0;\n }\n\n // TODO: Enforce being followed by a newline (or the end of the alg)?\n public traverseLineComment(_comment: LineComment): number {\n return 0;\n }\n}\n\nfunction isCharUppercase(c: string): boolean {\n return \"A\" <= c && c <= \"Z\";\n}\n\n// TODO: Implement a puzzle-specific way to calculate this.\nfunction baseMetric(move: Move): number {\n const fam = move.family;\n if (\n (isCharUppercase(fam[0]) && fam[fam.length - 1] === \"v\") ||\n fam === \"x\" ||\n fam === \"y\" ||\n fam === \"z\" ||\n fam === \"T\"\n ) {\n return 0;\n } else {\n return 1;\n }\n}\n\nconst countMovesInstance = new CountMoves(baseMetric);\nexport const countMoves: (alg: Alg) => number =\n countMovesInstance.traverseAlg.bind(countMovesInstance);\n", "import {\n Alg,\n Commutator,\n Conjugate,\n Grouping,\n LineComment,\n Move,\n Newline,\n Pause,\n TraversalUp,\n} from \"../alg\";\n\n// TODO: Include Pause, include amounts\nclass CountAnimatedLeaves extends TraversalUp<number, number> {\n public traverseAlg(alg: Alg): number {\n let total = 0;\n for (const part of alg.units()) {\n total += this.traverseUnit(part);\n }\n return total;\n }\n\n public traverseGrouping(grouping: Grouping): number {\n return this.traverseAlg(grouping.alg) * Math.abs(grouping.amount);\n }\n\n public traverseMove(_move: Move): number {\n return 1;\n }\n\n public traverseCommutator(commutator: Commutator): number {\n return (\n 2 * (this.traverseAlg(commutator.A) + this.traverseAlg(commutator.B))\n );\n }\n\n public traverseConjugate(conjugate: Conjugate): number {\n return 2 * this.traverseAlg(conjugate.A) + this.traverseAlg(conjugate.B);\n }\n\n public traversePause(_pause: Pause): number {\n return 1;\n }\n\n public traverseNewline(_newline: Newline): number {\n return 0;\n }\n\n public traverseLineComment(_comment: LineComment): number {\n return 0;\n }\n}\n\nconst countAnimatedLeavesInstance = new CountAnimatedLeaves();\nexport const countAnimatedLeaves: (alg: Alg) => number =\n countAnimatedLeavesInstance.traverseAlg.bind(countAnimatedLeavesInstance);\n", "import { Alg, Move, TraversalUp } from \"../../../alg\";\nimport { countAnimatedLeaves } from \"../../../notation\";\nimport type {\n PuzzleWrapper,\n State,\n} from \"../../views/3D/puzzles/KPuzzleWrapper\";\nimport type { Duration, Timestamp } from \"../AnimationTypes\";\nimport { AlgDuration, defaultDurationForAmount } from \"./AlgDuration\";\nimport type { AlgIndexer } from \"./AlgIndexer\";\n\nexport class SimpleAlgIndexer<P extends PuzzleWrapper>\n implements AlgIndexer<P>\n{\n private moves: Alg;\n // TODO: Allow custom `durationFn`.\n private durationFn: TraversalUp<Duration> = new AlgDuration(\n defaultDurationForAmount,\n );\n\n constructor(private puzzle: P, alg: Alg) {\n // TODO: Avoid assuming all base moves are block moves.\n this.moves = new Alg(alg.experimentalExpand());\n }\n\n public getAnimLeaf(index: number): Move {\n return Array.from(this.moves.units())[index] as Move; // TODO: perf\n }\n\n public indexToMoveStartTimestamp(index: number): Timestamp {\n const alg = new Alg(Array.from(this.moves.units()).slice(0, index)); // TODO\n return this.durationFn.traverseAlg(alg);\n }\n\n public timestampToIndex(timestamp: Timestamp): number {\n let cumulativeTime = 0;\n let i;\n for (i = 0; i < this.numAnimatedLeaves(); i++) {\n cumulativeTime += this.durationFn.traverseMove(this.getAnimLeaf(i));\n if (cumulativeTime >= timestamp) {\n return i;\n }\n }\n return i;\n }\n\n public stateAtIndex(index: number): State<P> {\n return this.puzzle.combine(\n this.puzzle.startState(),\n this.transformAtIndex(index),\n );\n }\n\n public transformAtIndex(index: number): State<P> {\n let state = this.puzzle.identity();\n for (const move of Array.from(this.moves.units()).slice(0, index)) {\n state = this.puzzle.combine(\n state,\n this.puzzle.stateFromMove(move as Move),\n );\n }\n return state;\n }\n\n public algDuration(): Duration {\n return this.durationFn.traverseAlg(this.moves);\n }\n\n public numAnimatedLeaves(): number {\n // TODO: Cache internally once performance matters.\n return countAnimatedLeaves(this.moves);\n }\n\n public moveDuration(index: number): number {\n return this.durationFn.traverseMove(this.getAnimLeaf(index));\n }\n}\n", "import {\n Alg,\n Grouping,\n LineComment,\n Commutator,\n Conjugate,\n Move,\n Newline,\n Pause,\n TraversalUp,\n} from \"../../../alg\";\nimport type { Duration } from \"../AnimationTypes\";\n\nexport function constantDurationForAmount(_amount: number): Duration {\n return 1000;\n}\n\nexport function defaultDurationForAmount(amount: number): Duration {\n switch (Math.abs(amount)) {\n case 0:\n return 0;\n case 1:\n return 1000;\n case 2:\n return 1500;\n default:\n return 2000;\n }\n}\n// eslint-disable-next-line no-inner-declarations\nexport function ExperimentalScaledDefaultDurationForAmount(\n scale: number,\n amount: number,\n): Duration {\n switch (Math.abs(amount)) {\n case 0:\n return 0;\n case 1:\n return scale * 1000;\n case 2:\n return scale * 1500;\n default:\n return scale * 2000;\n }\n}\n\nexport class AlgDuration extends TraversalUp<Duration> {\n // TODO: Pass durationForAmount as Down type instead?\n constructor(\n public durationForAmount: (\n amount: number,\n ) => Duration = defaultDurationForAmount,\n ) {\n super();\n }\n\n public traverseAlg(alg: Alg): Duration {\n let total = 0;\n for (const unit of alg.units()) {\n total += this.traverseUnit(unit);\n }\n return total;\n }\n\n public traverseGrouping(grouping: Grouping): Duration {\n return grouping.amount * this.traverseAlg(grouping.alg);\n }\n\n public traverseMove(move: Move): Duration {\n return this.durationForAmount(move.amount);\n }\n\n public traverseCommutator(commutator: Commutator): Duration {\n return (\n 2 * (this.traverseAlg(commutator.A) + this.traverseAlg(commutator.B))\n );\n }\n\n public traverseConjugate(conjugate: Conjugate): Duration {\n return 2 * this.traverseAlg(conjugate.A) + this.traverseAlg(conjugate.B);\n }\n\n public traversePause(_pause: Pause): Duration {\n return this.durationForAmount(1);\n }\n\n public traverseNewline(_newline: Newline): Duration {\n return this.durationForAmount(1);\n }\n\n public traverseLineComment(_comment: LineComment): Duration {\n return this.durationForAmount(0);\n }\n}\n", "import { Alg, Move } from \"../../../../alg\";\nimport type {\n PuzzleWrapper,\n State,\n} from \"../../../views/3D/puzzles/KPuzzleWrapper\";\nimport {\n Direction,\n Duration,\n PuzzlePosition,\n Timestamp,\n} from \"../../AnimationTypes\";\nimport type { AlgIndexer, CurrentMove, CurrentMoveInfo } from \"../AlgIndexer\";\nimport { AnimatedLeafUnit, AnimLeafWithRange, simulMoves } from \"./simul-moves\";\n\nconst demos: Record<string, AnimLeafWithRange[]> = {\n \"y' y' U' E D R2 r2 F2 B2 U E D' R2 L2' z2 S2 U U D D S2 F2' B2\": [\n { animLeaf: new Move(\"y\", -1), start: 0, end: 1000 },\n { animLeaf: new Move(\"y\", -1), start: 1000, end: 2000 },\n { animLeaf: new Move(\"U\", -1), start: 1000, end: 1600 },\n { animLeaf: new Move(\"E\", 1), start: 1200, end: 1800 },\n { animLeaf: new Move(\"D\"), start: 1400, end: 2000 },\n { animLeaf: new Move(\"R\", 2), start: 2000, end: 3500 },\n { animLeaf: new Move(\"r\", 2), start: 2000, end: 3500 },\n { animLeaf: new Move(\"F\", 2), start: 3500, end: 4200 },\n { animLeaf: new Move(\"B\", 2), start: 3800, end: 4500 },\n { animLeaf: new Move(\"U\", 1), start: 4500, end: 5500 },\n { animLeaf: new Move(\"E\", 1), start: 4500, end: 5500 },\n { animLeaf: new Move(\"D\", -1), start: 4500, end: 5500 },\n { animLeaf: new Move(\"R\", 2), start: 5500, end: 6500 },\n { animLeaf: new Move(\"L\", -2), start: 5500, end: 6500 },\n { animLeaf: new Move(\"z\", 2), start: 5500, end: 6500 },\n { animLeaf: new Move(\"S\", 2), start: 6500, end: 7500 },\n { animLeaf: new Move(\"U\"), start: 7500, end: 8000 },\n { animLeaf: new Move(\"D\"), start: 7750, end: 8250 },\n { animLeaf: new Move(\"U\"), start: 8000, end: 8500 },\n { animLeaf: new Move(\"D\"), start: 8250, end: 8750 },\n { animLeaf: new Move(\"S\", 2), start: 8750, end: 9250 },\n { animLeaf: new Move(\"F\", -2), start: 8750, end: 10000 },\n { animLeaf: new Move(\"B\", 2), start: 8750, end: 10000 },\n ],\n \"M' R' U' D' M R\": [\n { animLeaf: new Move(\"M\", -1), start: 0, end: 1000 },\n { animLeaf: new Move(\"R\", -1), start: 0, end: 1000 },\n { animLeaf: new Move(\"U\", -1), start: 1000, end: 2000 },\n { animLeaf: new Move(\"D\", -1), start: 1000, end: 2000 },\n { animLeaf: new Move(\"M\"), start: 2000, end: 3000 },\n { animLeaf: new Move(\"R\"), start: 2000, end: 3000 },\n ],\n \"U' E' r E r2' E r U E\": [\n { animLeaf: new Move(\"U\", -1), start: 0, end: 1000 },\n { animLeaf: new Move(\"E\", -1), start: 0, end: 1000 },\n { animLeaf: new Move(\"r\"), start: 1000, end: 2500 },\n { animLeaf: new Move(\"E\"), start: 2500, end: 3500 },\n { animLeaf: new Move(\"r\", -2), start: 3500, end: 5000 },\n { animLeaf: new Move(\"E\"), start: 5000, end: 6000 },\n { animLeaf: new Move(\"r\"), start: 6000, end: 7000 },\n { animLeaf: new Move(\"U\"), start: 7000, end: 8000 },\n { animLeaf: new Move(\"E\"), start: 7000, end: 8000 },\n ],\n};\n\nexport class SimultaneousMoveIndexerV2<P extends PuzzleWrapper>\n implements AlgIndexer<P>\n{\n private animLeaves: AnimLeafWithRange[];\n // TODO: Allow custom `durationFn`.\n\n constructor(private puzzle: P, alg: Alg) {\n this.animLeaves = demos[alg.toString()] ?? simulMoves(alg);\n // TODO: Avoid assuming all base moves are block moves.\n }\n\n public getAnimLeaf(index: number): AnimatedLeafUnit | null {\n return (\n this.animLeaves[Math.min(index, this.animLeaves.length - 1)]?.animLeaf ??\n null\n );\n }\n\n private getAnimLeafWithRange(index: number): AnimLeafWithRange {\n return this.animLeaves[Math.min(index, this.animLeaves.length - 1)];\n }\n\n public indexToMoveStartTimestamp(index: number): Timestamp {\n let start = 0;\n if (this.animLeaves.length > 0) {\n start =\n this.animLeaves[Math.min(index, this.animLeaves.length - 1)].start;\n }\n return start;\n }\n\n public timestampToIndex(timestamp: Timestamp): number {\n let i = 0;\n for (i = 0; i < this.animLeaves.length; i++) {\n if (this.animLeaves[i].start >= timestamp) {\n return Math.max(0, i - 1);\n }\n }\n return Math.max(0, i - 1);\n }\n\n public timestampToPosition(\n timestamp: Timestamp,\n startTransformation?: State<P>,\n ): PuzzlePosition {\n const currentMoveInfo = this.currentMoveInfo(timestamp);\n\n let state = startTransformation ?? this.puzzle.identity();\n for (const leafWithRange of this.animLeaves.slice(\n 0,\n currentMoveInfo.stateIndex,\n )) {\n const move = leafWithRange.animLeaf.as(Move);\n if (move !== null) {\n state = this.puzzle.combine(state, this.puzzle.stateFromMove(move));\n }\n }\n\n return {\n state: state as any,\n movesInProgress: currentMoveInfo.currentMoves,\n };\n }\n\n // TODO: Caching\n public currentMoveInfo(timestamp: Timestamp): CurrentMoveInfo {\n // The starting timestamp of the earliest active move.\n let windowEarliestTimestamp = Infinity;\n for (const leafWithRange of this.animLeaves) {\n if (leafWithRange.start <= timestamp && leafWithRange.end >= timestamp) {\n windowEarliestTimestamp = Math.min(\n windowEarliestTimestamp,\n leafWithRange.start,\n );\n } else if (leafWithRange.start > timestamp) {\n break;\n }\n }\n\n const currentMoves: CurrentMove[] = [];\n const movesStarting: CurrentMove[] = [];\n const movesFinishing: CurrentMove[] = [];\n const movesFinished: CurrentMove[] = [];\n let latestStart: number = -Infinity; // TODO: is there a better way to accumulate this?\n let earliestEnd: number = Infinity; // TODO: is there a better way to accumulate this?\n\n let stateIndex: number = 0;\n for (const leafWithRange of this.animLeaves) {\n if (leafWithRange.end <= windowEarliestTimestamp) {\n stateIndex++;\n } else if (leafWithRange.start > timestamp) {\n break;\n } else {\n const move = leafWithRange.animLeaf.as(Move);\n if (move !== null) {\n let fraction =\n (timestamp - leafWithRange.start) /\n (leafWithRange.end - leafWithRange.start);\n let moveFinished = false;\n if (fraction > 1) {\n fraction = 1;\n moveFinished = true;\n }\n const currentMove = {\n move: move,\n direction: Direction.Forwards,\n fraction: fraction,\n startTimestamp: leafWithRange.start,\n endTimestamp: leafWithRange.end,\n };\n switch (fraction) {\n case 0:\n movesStarting.push(currentMove);\n break;\n case 1:\n // Generalize this to avoid reordering commuting moves.\n if (moveFinished) {\n movesFinished.push(currentMove);\n } else {\n movesFinishing.push(currentMove);\n }\n break;\n default:\n currentMoves.push(currentMove);\n latestStart = Math.max(latestStart, leafWithRange.start);\n earliestEnd = Math.min(earliestEnd, leafWithRange.end);\n }\n }\n }\n }\n return {\n stateIndex,\n currentMoves,\n latestStart,\n earliestEnd,\n movesStarting,\n movesFinishing,\n movesFinished,\n };\n }\n\n public stateAtIndex(index: number, startTransformation?: State<P>): State<P> {\n let state = startTransformation ?? this.puzzle.startState();\n for (let i = 0; i < this.animLeaves.length && i < index; i++) {\n const leafWithRange = this.animLeaves[i];\n const move = leafWithRange.animLeaf.as(Move);\n if (move !== null) {\n state = this.puzzle.combine(state, this.puzzle.stateFromMove(move));\n }\n }\n return state;\n }\n\n public transformAtIndex(index: number): State<P> {\n let state = this.puzzle.identity();\n for (const leafWithRange of this.animLeaves.slice(0, index)) {\n const move = leafWithRange.animLeaf.as(Move);\n if (move !== null) {\n state = this.puzzle.combine(state, this.puzzle.stateFromMove(move));\n }\n }\n return state;\n }\n\n public algDuration(): Duration {\n let max = 0;\n for (const leafWithRange of this.animLeaves) {\n max = Math.max(max, leafWithRange.end);\n }\n return max;\n }\n\n public numAnimatedLeaves(): number {\n // TODO: Cache internally once performance matters.\n return this.animLeaves.length;\n }\n\n public moveDuration(index: number): number {\n const move = this.getAnimLeafWithRange(index);\n return move.end - move.start;\n }\n}\n", "import {\n LineComment,\n Commutator,\n Conjugate,\n Pause,\n TraversalUp,\n Move,\n Alg,\n Grouping,\n Newline,\n} from \"../../../../alg\";\nimport type { MillisecondTimestamp } from \"../../AnimationTypes\";\nimport { defaultDurationForAmount } from \"../AlgDuration\";\n\nexport type AnimatedLeafUnit = Move | Pause;\nexport interface LocalAnimLeavesWithRange {\n animLeafUnit: AnimatedLeafUnit;\n msUntilNext: MillisecondTimestamp;\n duration: MillisecondTimestamp;\n}\n\nexport interface AnimLeafWithRange {\n animLeaf: AnimatedLeafUnit;\n start: MillisecondTimestamp;\n end: MillisecondTimestamp;\n}\n\nconst axisLookup: Record<string, \"x\" | \"y\" | \"z\"> = {\n u: \"y\",\n l: \"x\",\n f: \"z\",\n r: \"x\",\n b: \"z\",\n d: \"y\",\n m: \"x\",\n e: \"y\",\n s: \"z\",\n x: \"x\",\n y: \"y\",\n z: \"z\",\n};\n\nfunction isSameAxis(move1: Move, move2: Move): boolean {\n return (\n axisLookup[move1.family[0].toLowerCase()] ===\n axisLookup[move2.family[0].toLowerCase()]\n );\n}\n\n// TODO: Replace this with an optimized implementation.\n// TODO: Consider `(x U)` and `(U x F)` to be simultaneous.\nexport class LocalSimulMoves extends TraversalUp<LocalAnimLeavesWithRange[]> {\n public traverseAlg(alg: Alg): LocalAnimLeavesWithRange[] {\n const processed: LocalAnimLeavesWithRange[][] = [];\n for (const nestedUnit of alg.units()) {\n processed.push(this.traverseUnit(nestedUnit));\n }\n return Array.prototype.concat(...processed) as LocalAnimLeavesWithRange[];\n }\n\n public traverseGroupingOnce(alg: Alg): LocalAnimLeavesWithRange[] {\n if (alg.experimentalIsEmpty()) {\n return [];\n }\n\n for (const unit of alg.units()) {\n if (!unit.is(Move))\n // TODO: define the type statically on the class?\n return this.traverseAlg(alg);\n }\n\n const moves = Array.from(alg.units()) as Move[];\n let maxSimulDur = defaultDurationForAmount(moves[0].amount);\n for (let i = 0; i < moves.length - 1; i++) {\n for (let j = 1; j < moves.length; j++) {\n if (!isSameAxis(moves[i], moves[j])) {\n return this.traverseAlg(alg);\n }\n }\n maxSimulDur = Math.max(\n maxSimulDur,\n defaultDurationForAmount(moves[i].amount),\n );\n }\n\n const localMovesWithRange: LocalAnimLeavesWithRange[] = moves.map(\n (blockMove): LocalAnimLeavesWithRange => {\n return {\n animLeafUnit: blockMove,\n msUntilNext: 0,\n duration: maxSimulDur,\n };\n },\n );\n localMovesWithRange[localMovesWithRange.length - 1].msUntilNext =\n maxSimulDur;\n return localMovesWithRange;\n }\n\n public traverseGrouping(grouping: Grouping): LocalAnimLeavesWithRange[] {\n const processed: LocalAnimLeavesWithRange[][] = [];\n\n const segmentOnce: Alg =\n grouping.amount > 0 ? grouping.alg : grouping.alg.invert();\n for (let i = 0; i < Math.abs(grouping.amount); i++) {\n processed.push(this.traverseGroupingOnce(segmentOnce));\n }\n return Array.prototype.concat(...processed) as LocalAnimLeavesWithRange[];\n }\n\n public traverseMove(move: Move): LocalAnimLeavesWithRange[] {\n const duration = defaultDurationForAmount(move.amount);\n return [\n {\n animLeafUnit: move,\n msUntilNext: duration,\n duration,\n },\n ];\n }\n\n public traverseCommutator(\n commutator: Commutator,\n ): LocalAnimLeavesWithRange[] {\n const processed: LocalAnimLeavesWithRange[][] = [];\n const segmentsOnce: Alg[] = [\n commutator.A,\n commutator.B,\n commutator.A.invert(),\n commutator.B.invert(),\n ];\n for (const segment of segmentsOnce) {\n processed.push(this.traverseGroupingOnce(segment));\n }\n return Array.prototype.concat(...processed) as LocalAnimLeavesWithRange[];\n }\n\n public traverseConjugate(conjugate: Conjugate): LocalAnimLeavesWithRange[] {\n const processed: LocalAnimLeavesWithRange[][] = [];\n const segmentsOnce: Alg[] = [\n conjugate.A,\n conjugate.B,\n conjugate.A.invert(),\n ];\n for (const segment of segmentsOnce) {\n processed.push(this.traverseGroupingOnce(segment));\n }\n return Array.prototype.concat(...processed) as LocalAnimLeavesWithRange[];\n }\n\n public traversePause(pause: Pause): LocalAnimLeavesWithRange[] {\n const duration = defaultDurationForAmount(1);\n return [\n {\n animLeafUnit: pause,\n msUntilNext: duration, // TODO\n duration,\n },\n ];\n }\n\n public traverseNewline(_newline: Newline): LocalAnimLeavesWithRange[] {\n return [];\n }\n\n public traverseLineComment(\n _comment: LineComment,\n ): LocalAnimLeavesWithRange[] {\n return [];\n }\n}\n\nconst localSimulMovesInstance = new LocalSimulMoves();\n\nconst localSimulMoves = localSimulMovesInstance.traverseAlg.bind(\n localSimulMovesInstance,\n) as (a: Alg) => LocalAnimLeavesWithRange[];\n\nexport function simulMoves(a: Alg): AnimLeafWithRange[] {\n let timestamp = 0;\n const l = localSimulMoves(a).map(\n (localSimulMove: LocalAnimLeavesWithRange): AnimLeafWithRange => {\n const leafWithRange = {\n animLeaf: localSimulMove.animLeafUnit,\n start: timestamp,\n end: timestamp + localSimulMove.duration,\n };\n timestamp += localSimulMove.msUntilNext;\n return leafWithRange;\n },\n );\n return l;\n}\n", "import {\n Alg,\n Commutator,\n Conjugate,\n Grouping,\n LineComment,\n Move,\n Newline,\n Pause,\n TraversalUp,\n Unit,\n} from \"../../../../alg\";\nimport { AlgBuilder } from \"../../../../alg\";\n\nconst MIN_CHUNKING_THRESHOLD = 16;\n\nfunction chunkifyAlg(alg: Alg, chunkMaxLength: number): Alg {\n const mainAlgBuilder = new AlgBuilder();\n const chunkAlgBuilder = new AlgBuilder();\n for (const unit of alg.units()) {\n chunkAlgBuilder.push(unit);\n if (chunkAlgBuilder.experimentalNumUnits() >= chunkMaxLength) {\n mainAlgBuilder.push(new Grouping(chunkAlgBuilder.toAlg()));\n chunkAlgBuilder.reset();\n }\n }\n mainAlgBuilder.push(new Grouping(chunkAlgBuilder.toAlg()));\n return mainAlgBuilder.toAlg();\n}\n\nclass ChunkAlgs extends TraversalUp<Alg, Unit> {\n traverseAlg(alg: Alg): Alg {\n const algLength = alg.experimentalNumUnits();\n if (algLength < MIN_CHUNKING_THRESHOLD) {\n return alg;\n }\n return chunkifyAlg(alg, Math.ceil(Math.sqrt(algLength)));\n }\n\n traverseGrouping(grouping: Grouping): Unit {\n return new Grouping(\n this.traverseAlg(grouping.alg),\n grouping.amount, // TODO\n );\n }\n\n traverseMove(move: Move): Unit {\n return move;\n }\n\n traverseCommutator(commutator: Commutator): Unit {\n return new Conjugate(\n this.traverseAlg(commutator.A),\n this.traverseAlg(commutator.B),\n );\n }\n\n traverseConjugate(conjugate: Conjugate): Unit {\n return new Conjugate(\n this.traverseAlg(conjugate.A),\n this.traverseAlg(conjugate.B),\n );\n }\n\n traversePause(pause: Pause): Unit {\n return pause;\n }\n\n traverseNewline(newline: Newline): Unit {\n return newline;\n }\n\n traverseLineComment(comment: LineComment): Unit {\n return comment;\n }\n}\n\nconst chunkAlgsInstance = new ChunkAlgs();\nexport const chunkAlgs = chunkAlgsInstance.traverseAlg.bind(\n chunkAlgsInstance,\n) as (alg: Alg) => Alg;\n", "import {\n Alg,\n Grouping,\n LineComment,\n Commutator,\n Conjugate,\n Move,\n Newline,\n Pause,\n TraversalDownUp,\n TraversalUp,\n Unit,\n} from \"../../../../alg\";\nimport {\n experimentalDirectedGenerator,\n ExperimentalIterationDirection,\n} from \"../../../../alg\";\nimport type {\n PuzzleWrapper,\n State,\n} from \"../../../views/3D/puzzles/KPuzzleWrapper\";\nimport type { Duration } from \"../../AnimationTypes\";\nimport { AlgDuration, defaultDurationForAmount } from \"../AlgDuration\";\n\nexport class AlgPartDecoration<P extends PuzzleWrapper> {\n constructor(\n _puz: PuzzleWrapper,\n public moveCount: number,\n public duration: number,\n public forward: State<P>,\n public backward: State<P>,\n public children: Array<AlgPartDecoration<P>> = [],\n ) {}\n}\nexport class DecoratorConstructor<P extends PuzzleWrapper> extends TraversalUp<\n AlgPartDecoration<P>\n> {\n private identity: State<P>;\n private dummyLeaf: AlgPartDecoration<P>;\n private durationFn: TraversalUp<Duration> = new AlgDuration(\n defaultDurationForAmount,\n );\n\n private cache: { [key: string]: AlgPartDecoration<P> } = {};\n\n constructor(private puz: PuzzleWrapper) {\n super();\n this.identity = puz.identity();\n this.dummyLeaf = new AlgPartDecoration<P>(\n puz,\n 0,\n 0,\n this.identity,\n this.identity,\n [],\n );\n }\n\n public traverseAlg(alg: Alg): AlgPartDecoration<P> {\n let moveCount = 0;\n let duration = 0;\n let state = this.identity;\n const child: Array<AlgPartDecoration<P>> = [];\n for (const unit of alg.units()) {\n const apd = this.traverseUnit(unit);\n moveCount += apd.moveCount;\n duration += apd.duration;\n if (state === this.identity) {\n state = apd.forward;\n } else {\n state = this.puz.combine(state, apd.forward);\n }\n child.push(apd);\n }\n return new AlgPartDecoration<P>(\n this.puz,\n moveCount,\n duration,\n state,\n this.puz.invert(state),\n child,\n );\n }\n\n public traverseGrouping(grouping: Grouping): AlgPartDecoration<P> {\n const dec = this.traverseAlg(grouping.alg);\n return this.mult(dec, grouping.amount, [dec]);\n }\n\n public traverseMove(move: Move): AlgPartDecoration<P> {\n const key = move.toString();\n let r: AlgPartDecoration<P> | undefined = this.cache[key];\n if (r) {\n return r;\n }\n r = new AlgPartDecoration<P>(\n this.puz,\n 1,\n this.durationFn.traverseUnit(move),\n this.puz.stateFromMove(move),\n this.puz.stateFromMove(move.invert()),\n );\n this.cache[key] = r;\n return r;\n }\n\n public traverseCommutator(commutator: Commutator): AlgPartDecoration<P> {\n const decA = this.traverseAlg(commutator.A);\n const decB = this.traverseAlg(commutator.B);\n const AB = this.puz.combine(decA.forward, decB.forward);\n const ApBp = this.puz.combine(decA.backward, decB.backward);\n const ABApBp = this.puz.combine(AB, ApBp);\n const dec = new AlgPartDecoration<P>(\n this.puz,\n 2 * (decA.moveCount + decB.moveCount),\n 2 * (decA.duration + decB.duration),\n ABApBp,\n this.puz.invert(ABApBp),\n [decA, decB],\n );\n return this.mult(dec, 1, [dec, decA, decB]);\n }\n\n public traverseConjugate(conjugate: Conjugate): AlgPartDecoration<P> {\n const decA = this.traverseAlg(conjugate.A);\n const decB = this.traverseAlg(conjugate.B);\n const AB = this.puz.combine(decA.forward, decB.forward);\n const ABAp = this.puz.combine(AB, decA.backward);\n const dec = new AlgPartDecoration<P>(\n this.puz,\n 2 * decA.moveCount + decB.moveCount,\n 2 * decA.duration + decB.duration,\n ABAp,\n this.puz.invert(ABAp),\n [decA, decB],\n );\n return this.mult(dec, 1, [dec, decA, decB]);\n }\n\n public traversePause(pause: Pause): AlgPartDecoration<P> {\n return new AlgPartDecoration<P>(\n this.puz,\n 1,\n this.durationFn.traverseUnit(pause),\n this.identity,\n this.identity,\n );\n }\n\n public traverseNewline(_newline: Newline): AlgPartDecoration<P> {\n return this.dummyLeaf;\n }\n\n public traverseLineComment(_comment: LineComment): AlgPartDecoration<P> {\n return this.dummyLeaf;\n }\n\n private mult(\n apd: AlgPartDecoration<P>,\n n: number,\n child: Array<AlgPartDecoration<P>>,\n ): AlgPartDecoration<P> {\n const absn = Math.abs(n);\n const st = this.puz.multiply(apd.forward, n);\n return new AlgPartDecoration<P>(\n this.puz,\n apd.moveCount * absn,\n apd.duration * absn,\n st,\n this.puz.invert(st),\n child,\n );\n }\n}\nclass WalkerDown<P extends PuzzleWrapper> {\n constructor(public apd: AlgPartDecoration<P>, public back: boolean) {\n /**/\n }\n}\nexport class AlgWalker<P extends PuzzleWrapper> extends TraversalDownUp<\n WalkerDown<P>,\n boolean\n> {\n public move?: Unit;\n public moveDuration: number;\n public back: boolean;\n public st: State<P>;\n public root: WalkerDown<P>;\n public i: number;\n public dur: number;\n private goali: number;\n private goaldur: number;\n constructor(\n public puz: P,\n public algOrUnit: Alg | Unit, // TODO: can we keep these separate?\n public apd: AlgPartDecoration<P>,\n ) {\n super();\n this.i = -1;\n this.dur = -1;\n this.goali = -1;\n this.goaldur = -1;\n this.move = undefined;\n this.back = false;\n this.moveDuration = 0;\n this.st = this.puz.identity();\n this.root = new WalkerDown(this.apd, false);\n }\n\n public moveByIndex(loc: number): boolean {\n if (this.i >= 0 && this.i === loc) {\n return this.move !== undefined;\n }\n return this.dosearch(loc, Infinity);\n }\n\n public moveByDuration(dur: number): boolean {\n if (\n this.dur >= 0 &&\n this.dur < dur &&\n this.dur + this.moveDuration >= dur\n ) {\n return this.move !== undefined;\n }\n return this.dosearch(Infinity, dur);\n }\n\n public dosearch(loc: number, dur: number): boolean {\n this.goali = loc;\n this.goaldur = dur;\n this.i = 0;\n this.dur = 0;\n this.move = undefined;\n this.moveDuration = 0;\n this.back = false;\n this.st = this.puz.identity();\n const r = this.algOrUnit.is(Alg)\n ? this.traverseAlg(this.algOrUnit as Alg, this.root)\n : this.traverseUnit(this.algOrUnit as Unit, this.root); // TODO\n return r;\n }\n\n public traverseAlg(alg: Alg, wd: WalkerDown<P>): boolean {\n if (!this.firstcheck(wd)) {\n return false;\n }\n let i = wd.back ? alg.experimentalNumUnits() - 1 : 0;\n for (const unit of experimentalDirectedGenerator(\n alg.units(),\n wd.back\n ? ExperimentalIterationDirection.Backwards\n : ExperimentalIterationDirection.Forwards,\n )) {\n if (\n this.traverseUnit(unit, new WalkerDown(wd.apd.children[i], wd.back))\n ) {\n return true;\n }\n i += wd.back ? -1 : 1;\n }\n return false;\n }\n\n public traverseGrouping(grouping: Grouping, wd: WalkerDown<P>): boolean {\n if (!this.firstcheck(wd)) {\n return false;\n }\n const back = this.domult(wd, grouping.amount);\n return this.traverseAlg(\n grouping.alg,\n new WalkerDown(wd.apd.children[0], back),\n );\n }\n\n public traverseMove(move: Move, wd: WalkerDown<P>): boolean {\n if (!this.firstcheck(wd)) {\n return false;\n }\n this.move = move;\n this.moveDuration = wd.apd.duration;\n this.back = wd.back;\n return true;\n }\n\n public traverseCommutator(\n commutator: Commutator,\n wd: WalkerDown<P>,\n ): boolean {\n if (!this.firstcheck(wd)) {\n return false;\n }\n const back = this.domult(wd, 1);\n if (back) {\n return (\n this.traverseAlg(\n commutator.B,\n new WalkerDown(wd.apd.children[2], !back),\n ) ||\n this.traverseAlg(\n commutator.A,\n new WalkerDown(wd.apd.children[1], !back),\n ) ||\n this.traverseAlg(\n commutator.B,\n new WalkerDown(wd.apd.children[2], back),\n ) ||\n this.traverseAlg(commutator.A, new WalkerDown(wd.apd.children[1], back))\n );\n } else {\n return (\n this.traverseAlg(\n commutator.A,\n new WalkerDown(wd.apd.children[1], back),\n ) ||\n this.traverseAlg(\n commutator.B,\n new WalkerDown(wd.apd.children[2], back),\n ) ||\n this.traverseAlg(\n commutator.A,\n new WalkerDown(wd.apd.children[1], !back),\n ) ||\n this.traverseAlg(\n commutator.B,\n new WalkerDown(wd.apd.children[2], !back),\n )\n );\n }\n }\n\n public traverseConjugate(conjugate: Conjugate, wd: WalkerDown<P>): boolean {\n if (!this.firstcheck(wd)) {\n return false;\n }\n const back = this.domult(wd, 1);\n if (back) {\n return (\n this.traverseAlg(\n conjugate.A,\n new WalkerDown(wd.apd.children[1], !back),\n ) ||\n this.traverseAlg(\n conjugate.B,\n new WalkerDown(wd.apd.children[2], back),\n ) ||\n this.traverseAlg(conjugate.A, new WalkerDown(wd.apd.children[1], back))\n );\n } else {\n return (\n this.traverseAlg(\n conjugate.A,\n new WalkerDown(wd.apd.children[1], back),\n ) ||\n this.traverseAlg(\n conjugate.B,\n new WalkerDown(wd.apd.children[2], back),\n ) ||\n this.traverseAlg(conjugate.A, new WalkerDown(wd.apd.children[1], !back))\n );\n }\n }\n\n public traversePause(pause: Pause, wd: WalkerDown<P>): boolean {\n if (!this.firstcheck(wd)) {\n return false;\n }\n this.move = pause;\n this.moveDuration = wd.apd.duration;\n this.back = wd.back;\n return true;\n }\n\n public traverseNewline(_newline: Newline, _wd: WalkerDown<P>): boolean {\n return false;\n }\n\n public traverseLineComment(\n _lineComment: LineComment,\n _wd: WalkerDown<P>,\n ): boolean {\n return false;\n }\n\n private firstcheck(wd: WalkerDown<P>): boolean {\n if (\n wd.apd.moveCount + this.i <= this.goali &&\n wd.apd.duration + this.dur < this.goaldur\n ) {\n return this.keepgoing(wd);\n }\n return true;\n }\n\n private domult(wd: WalkerDown<P>, amount: number): boolean {\n let back = wd.back;\n if (amount === 0) {\n // I don't believe this will ever happen\n return back;\n }\n if (amount < 0) {\n back = !back;\n amount = -amount;\n }\n const base = wd.apd.children[0];\n const full = Math.min(\n Math.floor((this.goali - this.i) / base.moveCount),\n Math.ceil((this.goaldur - this.dur) / base.duration - 1),\n );\n if (full > 0) {\n this.keepgoing(new WalkerDown<P>(base, back), full);\n }\n return back;\n }\n\n private keepgoing(wd: WalkerDown<P>, mul: number = 1): boolean {\n this.i += mul * wd.apd.moveCount;\n this.dur += mul * wd.apd.duration;\n if (mul !== 1) {\n if (wd.back) {\n this.st = this.puz.combine(\n this.st,\n this.puz.multiply(wd.apd.backward, mul),\n );\n } else {\n this.st = this.puz.combine(\n this.st,\n this.puz.multiply(wd.apd.forward, mul),\n );\n }\n } else {\n if (wd.back) {\n this.st = this.puz.combine(this.st, wd.apd.backward);\n } else {\n this.st = this.puz.combine(this.st, wd.apd.forward);\n }\n }\n return false;\n }\n}\n", "import type { Alg, Move } from \"../../../../alg\";\nimport type {\n PuzzleWrapper,\n State,\n} from \"../../../views/3D/puzzles/KPuzzleWrapper\";\nimport type { Duration, Timestamp } from \"../../AnimationTypes\";\nimport type { AlgIndexer } from \"../AlgIndexer\";\nimport { chunkAlgs } from \"./chunkAlgs\";\nimport {\n AlgPartDecoration,\n AlgWalker,\n DecoratorConstructor,\n} from \"./AlgWalker\";\n\nexport class TreeAlgIndexer implements AlgIndexer<PuzzleWrapper> {\n private decoration: AlgPartDecoration<PuzzleWrapper>;\n private walker: AlgWalker<PuzzleWrapper>;\n constructor(private puzzle: PuzzleWrapper, alg: Alg) {\n const deccon = new DecoratorConstructor<PuzzleWrapper>(this.puzzle);\n\n const chunkedAlg = chunkAlgs(alg);\n\n this.decoration = deccon.traverseAlg(chunkedAlg);\n this.walker = new AlgWalker<PuzzleWrapper>(\n this.puzzle,\n chunkedAlg,\n this.decoration,\n );\n }\n\n public getAnimLeaf(index: number): Move | null {\n // FIXME need to support Pause\n if (this.walker.moveByIndex(index)) {\n if (!this.walker.move) {\n throw new Error(\"`this.walker.mv` missing\");\n }\n const move = this.walker.move as Move;\n // TODO: this type of negation needs to be in alg\n if (this.walker.back) {\n return move.invert();\n }\n return move;\n }\n return null;\n }\n\n public indexToMoveStartTimestamp(index: number): Timestamp {\n if (this.walker.moveByIndex(index) || this.walker.i === index) {\n return this.walker.dur;\n }\n throw new Error(`Out of algorithm: index ${index}`);\n }\n\n public indexToMovesInProgress(index: number): Timestamp {\n if (this.walker.moveByIndex(index) || this.walker.i === index) {\n return this.walker.dur;\n }\n throw new Error(`Out of algorithm: index ${index}`);\n }\n\n public stateAtIndex(\n index: number,\n startTransformation?: State<PuzzleWrapper>,\n ): State<PuzzleWrapper> {\n this.walker.moveByIndex(index);\n return this.puzzle.combine(\n startTransformation ?? this.puzzle.startState(),\n this.walker.st,\n );\n }\n\n // TransformAtIndex does not reflect the start state; it only reflects\n // the change from the start state to the current move index. If you\n // want the actual state, use stateAtIndex.\n public transformAtIndex(index: number): State<PuzzleWrapper> {\n this.walker.moveByIndex(index);\n return this.walker.st;\n }\n\n public numAnimatedLeaves(): number {\n return this.decoration.moveCount;\n }\n\n public timestampToIndex(timestamp: Timestamp): number {\n this.walker.moveByDuration(timestamp);\n return this.walker.i;\n }\n\n public algDuration(): Duration {\n return this.decoration.duration;\n }\n\n public moveDuration(index: number): number {\n this.walker.moveByIndex(index);\n return this.walker.moveDuration;\n }\n}\n", "import { countMoves } from \"../../../../../notation\";\nimport { SimpleAlgIndexer } from \"../../../../controllers/indexer/SimpleAlgIndexer\";\nimport { SimultaneousMoveIndexerV2 } from \"../../../../controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2\";\nimport { TreeAlgIndexer } from \"../../../../controllers/indexer/tree/TreeAlgIndexer\";\nimport type { AlgWithIssues } from \"./AlgProp\";\nimport type { IndexerStrategyName } from \"./IndexerConstructorRequestProp\";\nimport type { VisualizationStrategy } from \"../../viewer/VisualizationStrategyProp\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\nimport type { PuzzleID } from \"../structure/PuzzleIDRequestProp\";\nimport type { KPuzzleWrapper } from \"../../../../views/3D/puzzles/KPuzzleWrapper\";\nimport type { Alg } from \"../../../../../alg\";\nimport type { AlgIndexer } from \"../../../..\";\n\nexport type IndexerConstructor = new (\n puzzle: KPuzzleWrapper,\n alg: Alg,\n) => AlgIndexer<KPuzzleWrapper>;\n\ninterface IndexerConstructorPropInputs {\n puzzle: PuzzleID;\n alg: AlgWithIssues;\n visualizationStrategy: VisualizationStrategy;\n indexerConstructorRequest: IndexerStrategyName;\n}\n\n// TODO: Also handle PG3D vs. 3D\nexport class IndexerConstructorProp extends TwistyPropDerived<\n IndexerConstructorPropInputs,\n IndexerConstructor\n> {\n derive(inputs: IndexerConstructorPropInputs): IndexerConstructor {\n switch (inputs.indexerConstructorRequest) {\n case \"auto\":\n if (\n countMoves(inputs.alg.alg) < 100 &&\n inputs.puzzle === \"3x3x3\" &&\n inputs.visualizationStrategy === \"Cube3D\"\n ) {\n return SimultaneousMoveIndexerV2;\n } else {\n return TreeAlgIndexer;\n }\n case \"tree\":\n return TreeAlgIndexer;\n case \"simple\":\n return SimpleAlgIndexer;\n case \"simultaneous\":\n return SimultaneousMoveIndexerV2;\n default:\n throw new Error(\"Invalid indexer request!\");\n }\n }\n}\n", "import { Alg } from \"../../../../../alg\";\nimport { KPuzzle, KPuzzleDefinition } from \"../../../../../kpuzzle\";\nimport { AlgIssues, AlgWithIssues } from \"./AlgProp\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\n\nexport class PuzzleAlgProp extends TwistyPropDerived<\n { algWithIssues: AlgWithIssues; puzzleDef: KPuzzleDefinition },\n AlgWithIssues\n> {\n async derive(inputs: {\n algWithIssues: AlgWithIssues;\n puzzleDef: KPuzzleDefinition;\n }): Promise<AlgWithIssues> {\n try {\n const kpuzzle = new KPuzzle(inputs.puzzleDef);\n kpuzzle.applyAlg(inputs.algWithIssues.alg);\n // Looks like we could apply the alg!\n return inputs.algWithIssues;\n } catch (e) {\n return {\n alg: new Alg(),\n issues: new AlgIssues({\n errors: [`Invalid alg for puzzle: ${(e as Error).toString()}`],\n }),\n };\n }\n }\n}\n", "import type { Move } from \"../../../../alg\";\nimport {\n combineTransformations,\n areStatesEquivalent,\n identityTransformation,\n invertTransformation,\n KPuzzleDefinition,\n transformationForMove,\n Transformation,\n} from \"../../../../kpuzzle\";\nimport { puzzles } from \"../../../../puzzles\";\n\nexport type MoveName = string;\n\nexport interface MoveProgress {\n move: Move;\n fraction: number;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars\nexport interface State<T extends PuzzleWrapper> {}\n\nexport abstract class PuzzleWrapper {\n public abstract startState(): State<PuzzleWrapper>;\n public abstract invert(state: State<PuzzleWrapper>): State<PuzzleWrapper>;\n public abstract combine(\n s1: State<PuzzleWrapper>,\n s2: State<PuzzleWrapper>,\n ): State<PuzzleWrapper>;\n\n public multiply(\n state: State<PuzzleWrapper>,\n amount: number,\n ): State<PuzzleWrapper> {\n if (amount < 0) {\n return this.invert(this.multiply(state, -amount));\n }\n if (amount === 0) {\n return this.identity();\n }\n while (amount % 2 === 0) {\n amount = amount / 2;\n state = this.combine(state, state);\n }\n let newState = state;\n amount--;\n while (amount > 0) {\n if (amount % 2 === 1) {\n newState = this.combine(newState, state);\n }\n amount = Math.floor(amount / 2);\n if (amount > 0) {\n state = this.combine(state, state);\n }\n }\n return newState;\n }\n\n public abstract stateFromMove(move: Move): State<PuzzleWrapper>;\n public abstract identity(): State<PuzzleWrapper>;\n public abstract equivalent(\n s1: State<PuzzleWrapper>,\n s2: State<PuzzleWrapper>,\n ): boolean;\n}\n\nexport interface KSolvePuzzleState\n extends Transformation,\n State<KPuzzleWrapper> {}\n\nexport class KPuzzleWrapper extends PuzzleWrapper {\n // don't work the underlying kdefinition/multiply so hard\n public static async fromID(id: string): Promise<KPuzzleWrapper> {\n return new KPuzzleWrapper(await puzzles[id].def());\n }\n\n public moveCache: { [key: string]: Transformation } = {};\n constructor(private definition: KPuzzleDefinition) {\n super();\n }\n\n public startState(): KSolvePuzzleState {\n return this.definition.startPieces;\n }\n\n public invert(state: KSolvePuzzleState): KSolvePuzzleState {\n return invertTransformation(this.definition, state);\n }\n\n public combine(\n s1: KSolvePuzzleState,\n s2: KSolvePuzzleState,\n ): KSolvePuzzleState {\n return combineTransformations(this.definition, s1, s2);\n }\n\n public stateFromMove(move: Move): KSolvePuzzleState {\n const key = move.toString();\n if (!this.moveCache[key]) {\n this.moveCache[key] = transformationForMove(this.definition, move);\n }\n return this.moveCache[key];\n }\n\n public identity(): KSolvePuzzleState {\n return identityTransformation(this.definition);\n }\n\n public equivalent(s1: KSolvePuzzleState, s2: KSolvePuzzleState): boolean {\n return areStatesEquivalent(this.definition, s1, s2);\n }\n}\n\nclass QTMCounterState implements State<QTMCounterPuzzle> {\n constructor(public value: number) {}\n}\n\nexport class QTMCounterPuzzle extends PuzzleWrapper {\n public startState(): QTMCounterState {\n return new QTMCounterState(0);\n }\n\n public invert(state: QTMCounterState): QTMCounterState {\n return new QTMCounterState(-state.value);\n }\n\n public combine(s1: QTMCounterState, s2: QTMCounterState): QTMCounterState {\n return new QTMCounterState(s1.value + s2.value);\n }\n\n public stateFromMove(move: Move): QTMCounterState {\n return new QTMCounterState(Math.abs(move.amount));\n }\n\n public identity(): QTMCounterState {\n return new QTMCounterState(0);\n }\n\n public equivalent(s1: QTMCounterState, s2: QTMCounterState): boolean {\n return s1.value === s2.value;\n }\n}\n", "import type { Alg } from \"../../../../../alg\";\nimport type { KPuzzleDefinition, Transformation } from \"../../../../../kpuzzle\";\nimport { KPuzzleWrapper } from \"../../../../views/3D/puzzles/KPuzzleWrapper\";\nimport { TreeAlgIndexer } from \"../../../../controllers/indexer/tree/TreeAlgIndexer\";\nimport type { AlgWithIssues } from \"./AlgProp\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\n\ntype AlgTransformationPropInputs = {\n alg: AlgWithIssues;\n def: KPuzzleDefinition;\n};\n\nexport class AlgTransformationProp extends TwistyPropDerived<\n AlgTransformationPropInputs,\n Transformation\n> {\n derive(input: AlgTransformationPropInputs): Transformation {\n return this.applyAlg(input.def, input.alg.alg);\n }\n\n applyAlg(def: KPuzzleDefinition, alg: Alg): Transformation {\n const kpuzzleWrapper = new KPuzzleWrapper(def); // TODO: Remove this layer.\n const indexer = new TreeAlgIndexer(kpuzzleWrapper, alg); // TODO: Use a direct efficient traversal in `cubing/kpuzzle` instead of instantiating a whole indexer.\n return indexer.transformAtIndex(\n indexer.numAnimatedLeaves(),\n ) as Transformation;\n }\n}\n", "import type { KPuzzleDefinition } from \"../../../../../kpuzzle\";\nimport { KPuzzleWrapper } from \"../../../../views/3D/puzzles/KPuzzleWrapper\";\nimport type { AlgIndexer } from \"../../../../controllers/indexer/AlgIndexer\";\nimport type { AlgWithIssues } from \"./AlgProp\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\nimport type { IndexerConstructor } from \"./IndexerConstructorProp\";\n\ntype IndexerPropInputs = {\n indexerConstructor: IndexerConstructor;\n algWithIssues: AlgWithIssues;\n def: KPuzzleDefinition;\n};\nexport class IndexerProp extends TwistyPropDerived<\n IndexerPropInputs,\n AlgIndexer<any>\n> {\n derive(input: IndexerPropInputs): AlgIndexer<any> {\n const kpuzzleWrapper = new KPuzzleWrapper(input.def); // TODO: Remove this layer.\n return new input.indexerConstructor(\n kpuzzleWrapper,\n input.algWithIssues.alg,\n );\n }\n}\n", "import {\n combineTransformations,\n invertTransformation,\n KPuzzleDefinition,\n Transformation,\n} from \"../../../../../kpuzzle\";\nimport type { AlgIndexer } from \"../../../../controllers/indexer/AlgIndexer\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\nimport type { SetupToLocation } from \"./SetupAnchorProp\";\n\ninterface AnchoredStartPropInputs {\n setupAnchor: SetupToLocation;\n setupTransformation: Transformation;\n indexer: AlgIndexer<any>;\n def: KPuzzleDefinition;\n}\n\nexport class AnchoredStartProp extends TwistyPropDerived<\n AnchoredStartPropInputs,\n Transformation\n> {\n derive(inputs: AnchoredStartPropInputs): Transformation {\n switch (inputs.setupAnchor) {\n case \"start\":\n return inputs.setupTransformation;\n case \"end\": {\n const algTransformation = inputs.indexer.transformAtIndex(\n inputs.indexer.numAnimatedLeaves(),\n ) as Transformation;\n const inverseAlgTransformation = invertTransformation(\n inputs.def,\n algTransformation,\n );\n return combineTransformations(\n inputs.def,\n inputs.setupTransformation,\n inverseAlgTransformation,\n );\n }\n default:\n throw new Error(\"Unimplemented!\");\n }\n }\n}\n", "import type { TimeRange } from \"../../../controllers/AnimationTypes\";\nimport type { AlgIndexer } from \"../../../controllers/indexer/AlgIndexer\";\nimport { TwistyPropDerived } from \"../TwistyProp\";\n\nexport class TimeRangeProp extends TwistyPropDerived<\n { indexer: AlgIndexer<any> },\n TimeRange\n> {\n derive(inputs: { indexer: AlgIndexer<any> }): TimeRange {\n return {\n start: 0,\n end: inputs.indexer.algDuration(),\n };\n }\n}\n", "import type {\n MillisecondTimestamp,\n TimeRange,\n} from \"../../../controllers/AnimationTypes\";\nimport type { TimestampRequest } from \"./TimestampRequestProp\";\nimport { TwistyPropDerived } from \"../TwistyProp\";\nimport type { SetupToLocation } from \"../puzzle/state/SetupAnchorProp\";\n\ninterface DetailedTimelineInfoInputs {\n timestampRequest: TimestampRequest;\n timeRange: TimeRange;\n setupAnchor: SetupToLocation;\n}\n\nexport interface DetailedTimelineInfo {\n timestamp: MillisecondTimestamp;\n timeRange: TimeRange; // TODO: Don't incluede this, and let fresh listeners listen to multiple inputs?\n // Note: `atStart` and `atEnd` can both be true. This is the case with the\n // default (empty) alg, which has a duration of 0 ms.\n atStart: boolean;\n atEnd: boolean;\n}\n\nexport class DetailedTimelineInfoProp extends TwistyPropDerived<\n DetailedTimelineInfoInputs,\n DetailedTimelineInfo\n> {\n derive(inputs: DetailedTimelineInfoInputs): DetailedTimelineInfo {\n let timestamp = this.#requestedTimestampToMilliseconds(inputs);\n let atStart: boolean = false;\n let atEnd: boolean = false;\n if (timestamp >= inputs.timeRange.end) {\n atEnd = true;\n timestamp = Math.min(inputs.timeRange.end, timestamp);\n }\n if (timestamp <= inputs.timeRange.start) {\n atStart = true;\n timestamp = Math.max(inputs.timeRange.start, timestamp);\n }\n return {\n timestamp,\n timeRange: inputs.timeRange,\n atStart,\n atEnd,\n };\n }\n\n #requestedTimestampToMilliseconds(\n inputs: DetailedTimelineInfoInputs,\n ): MillisecondTimestamp {\n switch (inputs.timestampRequest) {\n case \"start\":\n return inputs.timeRange.start;\n case \"end\":\n return inputs.timeRange.end;\n case \"anchor\":\n return inputs.setupAnchor === \"start\"\n ? inputs.timeRange.start\n : inputs.timeRange.end;\n case \"opposite-anchor\":\n return inputs.setupAnchor === \"start\"\n ? inputs.timeRange.end\n : inputs.timeRange.start;\n default:\n return inputs.timestampRequest;\n }\n }\n\n canReuse(v1: DetailedTimelineInfo, v2: DetailedTimelineInfo) {\n return (\n v1.timestamp === v2.timestamp &&\n v1.timeRange.start === v2.timeRange.start &&\n v1.timeRange.end === v2.timeRange.end &&\n v1.atStart === v2.atStart &&\n v1.atEnd === v2.atEnd\n );\n }\n}\n", "import type { ButtonCommand } from \"../../../views/control-panel/TwistyButtonsV2\";\nimport type { PlayingInfo } from \"./PlayingInfoProp\";\nimport type { DetailedTimelineInfo } from \"./DetailedTimelineInfoProp\";\nimport { TwistyPropDerived } from \"../TwistyProp\";\n\ninterface ButtonAppearance {\n enabled: boolean;\n icon: string;\n title: string;\n}\nexport type ButtonAppearances = Record<ButtonCommand, ButtonAppearance>;\n\ninterface CoarseTimelineInfoInputs {\n playingInfo: PlayingInfo;\n detailedTimelineInfo: DetailedTimelineInfo;\n}\n\nexport interface CoarseTimelineInfo {\n playing: boolean;\n atStart: boolean;\n atEnd: boolean;\n}\n\n// This started as a version of `EffectiveTimestamp` without the actual\n// timestamp, to enable easier caching.\nexport class CoarseTimelineInfoProp extends TwistyPropDerived<\n CoarseTimelineInfoInputs,\n CoarseTimelineInfo\n> {\n derive(inputs: CoarseTimelineInfoInputs): CoarseTimelineInfo {\n return {\n playing: inputs.playingInfo.playing,\n atStart: inputs.detailedTimelineInfo.atStart,\n atEnd: inputs.detailedTimelineInfo.atEnd,\n };\n }\n\n canReuseValue(v1: CoarseTimelineInfo, v2: CoarseTimelineInfo): boolean {\n return (\n v1.playing === v2.playing &&\n v1.atStart === v2.atStart &&\n v1.atEnd === v2.atEnd\n );\n }\n}\n", "import { Move } from \"../../../../../alg\";\nimport { Direction } from \"../../../../controllers/AnimationTypes\";\nimport type {\n AlgIndexer,\n CurrentMoveInfo,\n} from \"../../../../controllers/indexer/AlgIndexer\";\nimport type { DetailedTimelineInfo } from \"../../timeline/DetailedTimelineInfoProp\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\nimport type { CatchUpMove } from \"./CatchUpMoveProp\";\n\ninterface PositionPropInputs {\n indexer: AlgIndexer<any>;\n detailedTimelineInfo: DetailedTimelineInfo;\n catchUpMove: CatchUpMove;\n}\n\n// TODO: Rename \"current\" (implies a single one) to \"active\"?\nexport class CurrentLeavesProp extends TwistyPropDerived<\n PositionPropInputs,\n CurrentMoveInfo\n> {\n derive(inputs: PositionPropInputs): CurrentMoveInfo {\n function addCatchUpMove(currentMoveInfo: CurrentMoveInfo): CurrentMoveInfo {\n if (\n inputs.detailedTimelineInfo.atEnd &&\n inputs.catchUpMove.move !== null\n ) {\n currentMoveInfo.currentMoves.push({\n move: inputs.catchUpMove.move,\n direction: Direction.Backwards,\n fraction: 1 - inputs.catchUpMove.amount,\n startTimestamp: -1, // TODO\n endTimestamp: -1, // TODO\n });\n }\n return currentMoveInfo;\n }\n\n // Copied from AlgCursor\n if (inputs.indexer.currentMoveInfo) {\n return addCatchUpMove(\n inputs.indexer.currentMoveInfo(inputs.detailedTimelineInfo.timestamp),\n );\n } else {\n const idx = inputs.indexer.timestampToIndex(\n inputs.detailedTimelineInfo.timestamp,\n );\n const currentMoveInfo: CurrentMoveInfo = {\n stateIndex: idx,\n currentMoves: [],\n movesFinishing: [],\n movesFinished: [],\n movesStarting: [],\n latestStart: -Infinity,\n earliestEnd: Infinity,\n };\n\n if (inputs.indexer.numAnimatedLeaves() > 0) {\n const move = inputs.indexer.getAnimLeaf(idx)?.as(Move);\n if (!move) {\n return addCatchUpMove(currentMoveInfo);\n }\n const start = inputs.indexer.indexToMoveStartTimestamp(idx);\n const duration = inputs.indexer.moveDuration(idx);\n const fraction =\n (inputs.detailedTimelineInfo.timestamp - start) / duration;\n const end = start + duration;\n const currentMove = {\n move,\n direction: Direction.Forwards,\n fraction,\n startTimestamp: start,\n endTimestamp: end,\n };\n if (fraction === 0) {\n currentMoveInfo.movesStarting.push(currentMove);\n // // TODO: push this into the indexer\n // position.state = combineTransformations(\n // inputs.def,\n // state,\n // transformationForMove(inputs.def, move),\n // ) as Transformation;\n } else if (fraction === 1) {\n currentMoveInfo.movesFinishing.push(currentMove);\n // // TODO: push this into the indexer\n // position.state = combineTransformations(\n // inputs.def,\n // state,\n // transformationForMove(inputs.def, move),\n // ) as Transformation;\n } else {\n // TODO\n currentMoveInfo.currentMoves.push(currentMove);\n currentMoveInfo.latestStart = Math.max(\n currentMoveInfo.latestStart,\n start,\n );\n currentMoveInfo.earliestEnd = Math.min(\n currentMoveInfo.earliestEnd,\n end,\n );\n }\n // }\n // }\n }\n return addCatchUpMove(currentMoveInfo);\n }\n }\n}\n", "import type { Move } from \"../../../../../alg\";\nimport type { CurrentMoveInfo } from \"../../../../controllers/indexer/AlgIndexer\";\nimport { arrayEqualsCompare } from \"../../../helpers\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\n\ninterface CurrentLeavesSimplifiedPropInputs {\n currentMoveInfo: CurrentMoveInfo;\n}\n\nexport interface CurrentLeavesSimplified {\n stateIndex: number;\n movesFinishing: Move[];\n movesFinished: Move[];\n}\n\n// This started as a version of `CurrentLeaves` without highly timestamp-sensitive info like fractions, to enable easier caching.\nexport class CurrentLeavesSimplifiedProp extends TwistyPropDerived<\n CurrentLeavesSimplifiedPropInputs,\n CurrentLeavesSimplified\n> {\n derive(inputs: CurrentLeavesSimplifiedPropInputs): CurrentLeavesSimplified {\n return {\n stateIndex: inputs.currentMoveInfo.stateIndex,\n movesFinishing: inputs.currentMoveInfo.movesFinishing.map(\n (currentMoveInfo) => currentMoveInfo.move,\n ),\n movesFinished: inputs.currentMoveInfo.movesFinished.map(\n (currentMoveInfo) => currentMoveInfo.move,\n ),\n };\n }\n\n canReuse(v1: CurrentLeavesSimplified, v2: CurrentLeavesSimplified): boolean {\n return (\n v1.stateIndex === v2.stateIndex &&\n arrayEqualsCompare(\n v1.movesFinishing,\n v2.movesFinishing,\n (m1: Move, m2: Move) => m1.isIdentical(m2),\n ) &&\n arrayEqualsCompare(\n v1.movesFinished,\n v2.movesFinished,\n (m1: Move, m2: Move) => m1.isIdentical(m2),\n )\n );\n }\n}\n", "import { KSolvePuzzle } from \"../../../..\";\nimport {\n combineTransformations,\n KPuzzleDefinition,\n Transformation,\n} from \"../../../../../kpuzzle\";\nimport type { AlgIndexer } from \"../../../../controllers/indexer/AlgIndexer\";\nimport type { CurrentLeavesSimplified } from \"./CurrentLeavesSimplified\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\n\ninterface CurrentTransformationPropInputs {\n anchoredStart: Transformation;\n currentLeavesSimplified: CurrentLeavesSimplified;\n indexer: AlgIndexer<any>;\n def: KPuzzleDefinition;\n}\n\n// TODO: Make this so we don't have to handle the finishing moves?\nexport class CurrentTransformationProp extends TwistyPropDerived<\n CurrentTransformationPropInputs,\n Transformation\n> {\n derive(inputs: CurrentTransformationPropInputs): Transformation {\n let state: Transformation = inputs.indexer.transformAtIndex(\n inputs.currentLeavesSimplified.stateIndex,\n ) as any;\n state = combineTransformations(inputs.def, inputs.anchoredStart, state);\n const ksolvePuzzle = new KSolvePuzzle(inputs.def); // TODO: put this elsewhere.\n // TODO: handle non-commutative finished/finishing/current moves.\n for (const finishingMove of inputs.currentLeavesSimplified.movesFinishing) {\n state = combineTransformations(\n inputs.def,\n state,\n ksolvePuzzle.stateFromMove(finishingMove),\n );\n }\n for (const finishedMove of inputs.currentLeavesSimplified.movesFinished) {\n state = combineTransformations(\n inputs.def,\n state,\n ksolvePuzzle.stateFromMove(finishedMove),\n );\n }\n return state;\n }\n}\n", "import type { Transformation } from \"../../../../../kpuzzle\";\nimport type { PuzzlePosition } from \"../../../../controllers/AnimationTypes\";\nimport type { CurrentMoveInfo } from \"../../../../controllers/indexer/AlgIndexer\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\n\nexport interface LegacyPositionPropInputs {\n currentMoveInfo: CurrentMoveInfo;\n transformation: Transformation;\n}\n\n// TODO: This exist as a convenience for old `Twisty3D` implementations. Get rid of this.\nexport class LegacyPositionProp extends TwistyPropDerived<\n LegacyPositionPropInputs,\n PuzzlePosition\n> {\n derive(inputs: LegacyPositionPropInputs): PuzzlePosition {\n return {\n state: inputs.transformation,\n movesInProgress: inputs.currentMoveInfo.currentMoves,\n };\n }\n}\n", "import type { KPuzzleDefinition } from \"../../../../../kpuzzle\";\nimport type { PuzzleLoader } from \"../../../../../puzzles\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\n\nexport class PuzzleDefProp extends TwistyPropDerived<\n { puzzleLoader: PuzzleLoader },\n KPuzzleDefinition\n> {\n async derive(inputs: {\n puzzleLoader: PuzzleLoader;\n }): Promise<KPuzzleDefinition> {\n return inputs.puzzleLoader.def();\n }\n}\n", "import { arrayEquals } from \"./helpers\";\nimport { SimpleTwistyPropSource } from \"./props/TwistyProp\";\n\ninterface UserVisibleError {\n errors: string[];\n}\n\nconst EMPTY_ERRORS = { errors: [] };\n\nexport class UserVisibleErrorTracker extends SimpleTwistyPropSource<UserVisibleError> {\n override getDefaultValue(): UserVisibleError {\n return EMPTY_ERRORS;\n }\n\n reset() {\n this.set(this.getDefaultValue());\n }\n\n canReuseValue(_v1: UserVisibleError, _v2: UserVisibleError): boolean {\n return arrayEquals(_v1.errors, _v2.errors);\n }\n}\n", "import type { Move } from \"../../../../../alg\";\nimport { SimpleTwistyPropSource } from \"../../TwistyProp\";\n\nexport interface CatchUpMove {\n move: Move | null;\n amount: number;\n}\n\nexport class CatchUpMoveProp extends SimpleTwistyPropSource<CatchUpMove> {\n getDefaultValue(): CatchUpMove {\n return { move: null, amount: 0 };\n }\n\n canReuseValue(v1: CatchUpMove, v2: CatchUpMove) {\n return v1.move === v2.move && v1.amount === v2.amount;\n }\n}\n", "import { countMoves } from \"../../../../../notation\";\nimport { TwistyPropDerived } from \"../../TwistyProp\";\nimport type { AlgWithIssues } from \"./AlgProp\";\n\ninterface NaiveMoveCountPropInputs {\n alg: AlgWithIssues;\n}\n\n// TODO: handle metrics\nexport class NaiveMoveCountProp extends TwistyPropDerived<\n NaiveMoveCountPropInputs,\n number | null\n> {\n derive(inputs: NaiveMoveCountPropInputs): number | null {\n if (inputs.alg.issues.errors.length > 0) {\n return null;\n }\n return countMoves(inputs.alg.alg);\n }\n}\n", "import { SimpleTwistyPropSource } from \"../../TwistyProp\";\n\nexport const movePressInputNames = {\n auto: true,\n none: true,\n basic: true,\n};\nexport type MovePressInput = keyof typeof movePressInputNames;\n\nexport class MovePressInputProp extends SimpleTwistyPropSource<MovePressInput> {\n getDefaultValue(): MovePressInput {\n return \"auto\";\n }\n}\n", "import { SimpleTwistyPropSource } from \"../../TwistyProp\";\n\nexport type FoundationDisplay = \"auto\" | \"opaque\" | \"none\";\n\nexport class FoundationDisplayProp extends SimpleTwistyPropSource<FoundationDisplay> {\n getDefaultValue(): FoundationDisplay {\n return \"auto\";\n }\n}\n", "import type { Alg } from \"../../alg\";\nimport type { PuzzleDescriptionString } from \"../../puzzle-geometry/PGPuzzles\";\nimport type { ExperimentalStickering, PuzzleID } from \"../../twisty\";\nimport type { BackgroundThemeWithAuto } from \"../model/props/viewer/BackgroundProp\";\nimport type { BackViewLayoutWithAuto } from \"../model/props/viewer/BackViewProp\";\nimport type { ControlPanelThemeWithAuto } from \"../model/props/viewer/ControlPanelProp\";\nimport type { HintFaceletStyleWithAuto } from \"../model/props/puzzle/display/HintFaceletProp\";\nimport type { IndexerStrategyName } from \"../model/props/puzzle/state/IndexerConstructorRequestProp\";\nimport type { TimestampRequest } from \"../model/props/timeline/TimestampRequestProp\";\nimport type { ViewerLinkPageWithAuto } from \"../model/props/viewer/ViewerLinkProp\";\nimport type { VisualizationFormatWithAuto } from \"../model/props/viewer/VisualizationProp\";\nimport { TwistyPlayerModel } from \"../model/TwistyPlayerModel\";\nimport type { MillisecondTimestamp } from \"../controllers/AnimationTypes\";\nimport { ManagedCustomElement } from \"./ManagedCustomElement\";\nimport type { MovePressInput } from \"../model/props/puzzle/state/MovePressInputProp\";\nimport type { SetupToLocation } from \"../model/props/puzzle/state/SetupAnchorProp\";\n\nfunction err(propName: string): Error {\n return new Error(\n `Cannot get \\`.${propName}\\` directly from a \\`TwistyPlayer\\`.`,\n );\n}\n\n// prettier-ignore\nexport abstract class TwistyPlayerSettable extends ManagedCustomElement {\n experimentalModel: TwistyPlayerModel = new TwistyPlayerModel();\n\n set alg(newAlg: Alg | string) { this.experimentalModel.algProp.set(newAlg); }\n get alg(): never { throw err(\"alg\"); }\n\n set experimentalSetupAlg(newSetup: Alg | string) { this.experimentalModel.setupProp.set(newSetup); }\n get experimentalSetupAlg(): never { throw err(\"setup\"); }\n\n set experimentalSetupAnchor(anchor: SetupToLocation) { this.experimentalModel.setupAnchorProp.set(anchor); }\n get experimentalSetupAnchor(): never { throw err(\"anchor\"); }\n\n set puzzle(puzzleID: PuzzleID) { this.experimentalModel.puzzleIDRequestProp.set(puzzleID); }\n get puzzle(): never { throw err(\"puzzle\"); }\n\n set experimentalPuzzleDescription(puzzleDescription: PuzzleDescriptionString) { this.experimentalModel.puzzleDescriptionRequestProp.set(puzzleDescription); }\n get experimentalPuzzleDescription(): never { throw err(\"experimentalPuzzleDescription\"); }\n\n set timestamp(timestamp: TimestampRequest) { this.experimentalModel.timestampRequestProp.set(timestamp); }\n get timestamp(): never { throw err(\"timestamp\"); }\n\n set hintFacelets(hintFaceletStyle: HintFaceletStyleWithAuto) { this.experimentalModel.hintFaceletProp.set(hintFaceletStyle); }\n get hintFacelets(): never { throw err(\"hintFacelets\"); }\n\n set experimentalStickering(stickering: ExperimentalStickering) { this.experimentalModel.stickeringProp.set(stickering); }\n get experimentalStickering(): never { throw err(\"stickering\"); }\n\n set backView(backView: BackViewLayoutWithAuto) { this.experimentalModel.backViewProp.set(backView); }\n get backView(): never { throw err(\"backView\"); }\n\n set background(backgroundTheme: BackgroundThemeWithAuto) { this.experimentalModel.backgroundProp.set(backgroundTheme); }\n get background(): never { throw err(\"background\"); }\n\n set controlPanel(newControlPanel: ControlPanelThemeWithAuto) { this.experimentalModel.controlPanelProp.set(newControlPanel); }\n get controlPanel(): never { throw err(\"controlPanel\"); }\n\n set visualization(visualizationFormat: VisualizationFormatWithAuto) { this.experimentalModel.visualizationFormatProp.set(visualizationFormat); }\n get visualization(): never { throw err(\"visualization\"); }\n\n set viewerLink(viewerLinkPage: ViewerLinkPageWithAuto) { this.experimentalModel.viewerLinkProp.set(viewerLinkPage); }\n get viewerLink(): never { throw err(\"viewerLink\"); }\n\n set experimentalMovePressInput(movePressInput: MovePressInput) { this.experimentalModel.movePressInputProp.set(movePressInput); }\n get experimentalMovePressInput(): never { throw err(\"experimentalMovePressInput\"); }\n\n set cameraLatitude(latitude: number) { this.experimentalModel.orbitCoordinatesRequestProp.set({ latitude }); }\n get cameraLatitude(): never { throw err(\"cameraLatitude\"); }\n\n set cameraLongitude(longitude: number) { this.experimentalModel.orbitCoordinatesRequestProp.set({ longitude }); }\n get cameraLongitude(): never { throw err(\"cameraLongitude\"); }\n\n set cameraDistance(distance: number) { this.experimentalModel.orbitCoordinatesRequestProp.set({ distance }); }\n get cameraDistance(): never { throw err(\"cameraDistance\"); }\n\n set cameraLatitudeLimit(latitudeLimit: number) { this.experimentalModel.latitudeLimitProp.set(latitudeLimit); }\n get cameraLatitudeLimit(): never { throw err(\"cameraLatitudeLimit\"); }\n\n set indexer(indexer: IndexerStrategyName) { this.experimentalModel.indexerConstructorRequestProp.set(indexer); }\n get indexer(): never { throw err(\"indexer\"); }\n\n set tempoScale(newTempoScale: number) { this.experimentalModel.tempoScaleProp.set(newTempoScale); }\n get tempoScale(): never { throw err(\"tempoScale\"); }\n\n set experimentalSprite(url: string | URL) { this.experimentalModel.foundationStickerSpriteURL.set(url); }\n get experimentalSprite(): never { throw err(\"experimentalSprite\"); }\n\n set experimentalHintSprite(url: string | URL) { this.experimentalModel.hintStickerSpriteURL.set(url); }\n get experimentalHintSprite(): never { throw err(\"experimentalHintSprite\"); }\n\n experimentalGet = new ExperimentalGetters(this.experimentalModel)\n}\n\nclass ExperimentalGetters {\n constructor(private model: TwistyPlayerModel) {}\n\n async alg(): Promise<Alg> {\n return (await this.model.algProp.get()).alg;\n }\n\n async setupAlg(): Promise<Alg> {\n return (await this.model.setupProp.get()).alg;\n }\n\n puzzleID(): Promise<PuzzleID> {\n return this.model.puzzleIDProp.get();\n }\n\n async timestamp(): Promise<MillisecondTimestamp> {\n return (await this.model.detailedTimelineInfoProp.get()).timestamp;\n }\n}\n", "import type { ExperimentalStickering, PG3D } from \"..\";\nimport type { Alg, Move } from \"../../alg\";\nimport type { PuzzleDescriptionString } from \"../../puzzle-geometry/PGPuzzles\";\nimport type { TwistyAnimationControllerDelegate } from \"../controllers/TwistyAnimationController\";\nimport { TwistyPlayerController } from \"../controllers/TwistyPlayerController\";\nimport type { HintFaceletStyleWithAuto } from \"../model/props/puzzle/display/HintFaceletProp\";\nimport type { MovePressInput } from \"../model/props/puzzle/state/MovePressInputProp\";\nimport type { SetupToLocation } from \"../model/props/puzzle/state/SetupAnchorProp\";\nimport type { PuzzleID } from \"../model/props/puzzle/structure/PuzzleIDRequestProp\";\nimport type { BackgroundThemeWithAuto } from \"../model/props/viewer/BackgroundProp\";\nimport type { BackViewLayoutWithAuto } from \"../model/props/viewer/BackViewProp\";\nimport {\n ControlPanelThemeWithAuto,\n controlsLocations,\n} from \"../model/props/viewer/ControlPanelProp\";\nimport type { ViewerLinkPageWithAuto } from \"../model/props/viewer/ViewerLinkProp\";\nimport type { VisualizationFormatWithAuto } from \"../model/props/viewer/VisualizationProp\";\nimport type { VisualizationStrategy } from \"../model/props/viewer/VisualizationStrategyProp\";\nimport { ClassListManager } from \"./ClassListManager\";\nimport { customElementsShim } from \"./node-custom-element-shims\";\nimport { twistyPlayerCSS } from \"./TwistyPlayer.css\";\n\nimport { Twisty2DSceneWrapper } from \"./2D/Twisty2DSceneWrapper\";\nimport { Twisty3DSceneWrapper } from \"./3D/Twisty3DSceneWrapper\";\nimport { TwistyButtonsV2 } from \"./control-panel/TwistyButtonsV2\";\nimport { TwistyScrubberV2 } from \"./control-panel/TwistyScrubberV2\";\nimport { downloadURL, getDefaultFilename, screenshot } from \"./screenshot\";\nimport { TwistyPlayerSettable } from \"./TwistyPlayerSettable\";\n\n// TODO: I couldn't figure out how to use use more specific types. Ideally, we'd\n// enforce consistency with the model.\nexport const twistyPlayerAttributeMap = {\n // TODO: We assume each of these can be set using a string or will be automatically converted by JS (e.g. numbers). Can we enforce\n // that with types? Do we need to add a translation mechanism for things we\n // don't want to leave settable as strings?\n // TODO: Enum validation.\n\n // Alg\n \"alg\": \"alg\",\n \"experimental-setup-alg\": \"experimentalSetupAlg\",\n\n // String-based\n \"experimental-setup-anchor\": \"experimentalSetupAnchor\",\n \"puzzle\": \"puzzle\",\n \"experimental-puzzle-description\": \"experimentalPuzzleDescription\",\n \"visualization\": \"visualization\",\n \"hint-facelets\": \"hintFacelets\",\n \"experimental-stickering\": \"experimentalStickering\",\n \"background\": \"background\",\n \"control-panel\": \"controlPanel\",\n \"back-view\": \"backView\",\n // \"indexer\": \"indexer\",\n \"viewer-link\": \"viewerLink\",\n \"experimental-move-press-input\": \"experimentalMovePressInput\",\n\n // Number-based\n \"camera-latitude\": \"cameraLatitude\",\n \"camera-longitude\": \"cameraLongitude\",\n \"camera-distance\": \"cameraDistance\",\n \"camera-latitude-limit\": \"cameraLatitudeLimit\",\n \"tempo-scale\": \"tempoScale\",\n\n // URL-based\n \"experimental-sprite\": \"experimentalSprite\",\n \"experimental-hint-sprite\": \"experimentalHintSprite\",\n};\n\nexport type TwistyPlayerAttribute = keyof typeof twistyPlayerAttributeMap;\n\nconst configKeys: Record<TwistyPlayerAttribute, true> = Object.fromEntries(\n Object.values(twistyPlayerAttributeMap).map((s) => [s, true]),\n) as any;\n\n// TODO: Find a way to share this def with `attributeMap`.\nexport interface TwistyPlayerConfig {\n // Alg\n alg?: Alg | string;\n experimentalSetupAlg?: Alg | string;\n\n // String-based\n experimentalSetupAnchor?: SetupToLocation; // TODO: \"auto\"\n puzzle?: PuzzleID;\n experimentalPuzzleDescription?: PuzzleDescriptionString;\n visualization?: VisualizationFormatWithAuto;\n hintFacelets?: HintFaceletStyleWithAuto;\n experimentalStickering?: ExperimentalStickering;\n background?: BackViewLayoutWithAuto;\n controlPanel?: ControlPanelThemeWithAuto;\n backView?: BackViewLayoutWithAuto;\n // \"indexer\"?: \"indexer\";\n viewerLink?: ViewerLinkPageWithAuto;\n experimentalMovePressInput?: MovePressInput;\n\n // Number-based\n cameraLatitude?: number;\n cameraLongitude?: number;\n cameraDistance?: number;\n cameraLatitudeLimit?: number;\n tempoScale?: number;\n\n // URL-based\n experimentalSprite?: string | null;\n experimentalHintSprite?: string | null;\n}\n\n/**\n * TwistyPlayer is the heart of `cubing.js`. It can be used to display a puzzle on a web page like this:\n *\n * <script src=\"path/to/cubing/twisty\" type=\"module\"></script>\n * <twisty-player alg=\"R U R'\"></twisty-player>\n *\n * You can also construct it directly in JavaScript:\n *\n * import { TwistyPlayer } from \"cubing/twisty\";\n * const twistyPlayer = new TwistyPlayer({alg: \"R U R'\"});\n * // Once the page has loaded, you can do this:\n * document.body.appendChild(twistyPlayer);\n *\n * See {@link https://js.cubing.net/cubing/} for more examples.\n */\nexport class TwistyPlayer\n extends TwistyPlayerSettable\n implements TwistyAnimationControllerDelegate\n{\n controller: TwistyPlayerController = new TwistyPlayerController(\n this.experimentalModel,\n this,\n );\n\n buttons: TwistyButtonsV2;\n\n experimentalCanvasClickCallback: (...args: any) => void = () => {};\n // #onCanvasClick() {\n\n // }\n\n constructor(config: TwistyPlayerConfig = {}) {\n super();\n\n // TODO: double-check that these are all getting set sync without causing extra work.\n for (const [propName, value] of Object.entries(config)) {\n if (!configKeys[propName as TwistyPlayerAttribute]) {\n console.warn(`Invalid config passed to TwistyPlayer: ${propName}`);\n break;\n }\n (this as any)[propName] = value;\n }\n }\n\n #controlsManager: ClassListManager<ControlPanelThemeWithAuto> =\n new ClassListManager<ControlPanelThemeWithAuto>(\n this,\n \"controls-\",\n ([\"auto\"] as ControlPanelThemeWithAuto[]).concat(\n Object.keys(controlsLocations) as ControlPanelThemeWithAuto[],\n ),\n );\n\n #visualizationWrapperElem = document.createElement(\"div\"); // TODO: Better pattern.\n #errorElem = document.createElement(\"div\"); // TODO: Better pattern.\n #alreadyConnected = false; // TODO: support resetting\n async connectedCallback(): Promise<void> {\n if (this.#alreadyConnected) {\n return;\n }\n this.#alreadyConnected = true;\n this.addCSS(twistyPlayerCSS);\n\n this.addElement(this.#visualizationWrapperElem).classList.add(\n \"visualization-wrapper\",\n );\n this.addElement(this.#errorElem).classList.add(\"error-elem\");\n this.#errorElem.textContent = \"Error\";\n this.experimentalModel.userVisibleErrorTracker.addFreshListener(\n (userVisibleError) => {\n const errorString: string | null = userVisibleError.errors[0] ?? null;\n this.contentWrapper.classList.toggle(\"error\", !!errorString);\n if (errorString) {\n this.#errorElem.textContent = errorString;\n }\n },\n );\n\n const scrubber = new TwistyScrubberV2(this.experimentalModel);\n this.contentWrapper.appendChild(scrubber);\n\n this.buttons = new TwistyButtonsV2(\n this.experimentalModel,\n this.controller,\n this,\n );\n this.contentWrapper.appendChild(this.buttons);\n\n this.experimentalModel.backgroundProp.addFreshListener(\n (backgroundTheme: BackgroundThemeWithAuto) => {\n this.contentWrapper.classList.toggle(\n \"checkered\",\n backgroundTheme !== \"none\",\n );\n },\n );\n\n this.experimentalModel.controlPanelProp.addFreshListener(\n (controlPanel: ControlPanelThemeWithAuto) => {\n this.#controlsManager.setValue(controlPanel);\n },\n );\n\n this.experimentalModel.visualizationStrategyProp.addFreshListener(\n this.#setVisualizationWrapper.bind(this),\n );\n\n this.experimentalModel.puzzleIDProp.addFreshListener(this.flash.bind(this));\n }\n\n flash() {\n this.#visualizationWrapper?.animate([{ opacity: 0.25 }, { opacity: 1 }], {\n duration: 250,\n });\n }\n\n #visualizationWrapper: Twisty2DSceneWrapper | Twisty3DSceneWrapper | null =\n null;\n\n #visualizationStrategy: VisualizationStrategy | null = null;\n #setVisualizationWrapper(strategy: VisualizationStrategy): void {\n if (strategy !== this.#visualizationStrategy) {\n this.#visualizationWrapper?.remove();\n this.#visualizationWrapper?.disconnect();\n let newWrapper: Twisty2DSceneWrapper | Twisty3DSceneWrapper;\n switch (strategy) {\n case \"2D\":\n case \"experimental-2D-LL\":\n newWrapper = new Twisty2DSceneWrapper(\n this.experimentalModel,\n strategy,\n );\n break;\n case \"Cube3D\":\n case \"PG3D\":\n // TODO: Properly wire this up so we can set PG3D for the cube.\n newWrapper = new Twisty3DSceneWrapper(this.experimentalModel);\n break;\n default:\n throw new Error(\"Invalid visualization\");\n }\n this.#visualizationWrapperElem.appendChild(newWrapper);\n this.#visualizationWrapper = newWrapper;\n this.#visualizationStrategy = strategy;\n }\n }\n\n async experimentalCurrentCanvases(): Promise<HTMLCanvasElement[]> {\n this.connectedCallback();\n const wrapper = this.#visualizationWrapper;\n const canvases: HTMLCanvasElement[] = [];\n if (wrapper instanceof Twisty3DSceneWrapper) {\n const vantages = wrapper.experimentalVantages();\n for (const vantage of vantages) {\n canvases.push((await vantage.canvasInfo()).canvas);\n }\n }\n return canvases;\n }\n\n async experimentalPG3D(): Promise<PG3D | null> {\n this.connectedCallback();\n const wrapper = this.#visualizationWrapper;\n if (wrapper instanceof Twisty3DSceneWrapper) {\n wrapper;\n }\n return null;\n }\n\n jumpToStart(options?: { flash: boolean }): void {\n this.controller.jumpToStart(options);\n }\n\n jumpToEnd(options?: { flash: boolean }): void {\n this.controller.jumpToEnd(options);\n }\n\n play(): void {\n this.controller.togglePlay(true);\n }\n\n pause(): void {\n this.controller.togglePlay(false);\n }\n\n // Inspiration:\n // - https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute (`force` argument)\n // - https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle (`force` argument)\n // We still provide `play()` and `pause()` individually for convenience, though.\n togglePlay(play?: boolean): void {\n this.controller.togglePlay(play);\n }\n\n // TODO: Animate the new move.\n experimentalAddMove(\n flexibleMove: Move | string,\n options: { coalesce?: boolean } = {},\n ): void {\n this.experimentalModel.experimentalAddMove(flexibleMove, options);\n }\n\n static get observedAttributes(): string[] {\n return Object.keys(twistyPlayerAttributeMap);\n }\n\n attributeChangedCallback(\n attributeName: string,\n _oldValue: string,\n newValue: string,\n ): void {\n const setterName =\n twistyPlayerAttributeMap[attributeName as TwistyPlayerAttribute];\n if (!setterName) {\n return;\n }\n\n (this as any)[setterName] = newValue;\n }\n\n // TODO: Make this more ergonomic and flexible.\n // TODO: dimensions.\n async experimentalScreenshot(options?: {\n width: number;\n height: number;\n }): Promise<string> {\n return (await screenshot(this.experimentalModel, options)).dataURL;\n }\n\n // TODO: Make this more ergonomic and flexible.\n // TODO: dimensions.\n async experimentalDownloadScreenshot(filename?: string): Promise<void> {\n if (\n [\"2D\", \"experimental-2D-LL\"].includes(\n await this.experimentalModel.visualizationStrategyProp.get(),\n )\n ) {\n // TODO: This has lots of async issues. It should also go into the screenshot impl file.\n const wrapper2D = this.#visualizationWrapper as Twisty2DSceneWrapper;\n const twisty2DPuzzle = await wrapper2D\n .currentTwisty2DPuzzleWrapper()!\n .twisty2DPuzzle();\n const str = new XMLSerializer().serializeToString(\n twisty2DPuzzle.svg.element,\n );\n const url = URL.createObjectURL(new Blob([str]));\n downloadURL(\n url,\n filename ?? (await getDefaultFilename(this.experimentalModel)),\n \"svg\",\n );\n } else {\n await (await screenshot(this.experimentalModel)).download(filename);\n }\n }\n}\n\ncustomElementsShim.define(\"twisty-player\", TwistyPlayer);\n", "import {\n Alg,\n Commutator,\n Conjugate,\n experimentalDirect,\n ExperimentalIterationDirection,\n Grouping,\n LineComment,\n Move,\n Newline,\n Pause,\n TraversalDownUp,\n Unit,\n} from \"../../alg\";\nimport type { Parsed } from \"../../alg/parse\";\nimport type { AlgWithIssues } from \"../model/props/puzzle/state/AlgProp\";\nimport type { DetailedTimelineInfo } from \"../model/props/timeline/DetailedTimelineInfoProp\";\nimport type { MillisecondTimestamp } from \"../controllers/AnimationTypes\";\nimport type { CurrentMoveInfo } from \"../controllers/indexer/AlgIndexer\";\nimport { ManagedCustomElement } from \"./ManagedCustomElement\";\nimport {\n customElementsShim,\n HTMLElementShim,\n} from \"./node-custom-element-shims\";\nimport { twistyAlgViewerCSS } from \"./TwistyAlgViewer.css\";\nimport { TwistyPlayer } from \"./TwistyPlayer\";\n\nconst DEFAULT_OFFSET_MS = 250; // TODO: make this a fraction?\n\nclass DataDown {\n earliestMoveIndex: number;\n twistyAlgViewer: TwistyAlgViewer;\n direction: ExperimentalIterationDirection;\n}\n\nclass DataUp {\n moveCount: number;\n element: TwistyAlgWrapperElem | TwistyAlgLeafElem;\n}\n\nclass TwistyAlgLeafElem extends ManagedCustomElement {\n constructor(\n className: string,\n text: string,\n dataDown: DataDown,\n public algOrUnit: Alg | Unit,\n offsetIntoMove: boolean,\n clickable: boolean,\n ) {\n super({ mode: \"open\" });\n this.classList.add(className);\n\n this.addCSS(twistyAlgViewerCSS);\n if (clickable) {\n const anchor = this.contentWrapper.appendChild(\n document.createElement(\"a\"),\n );\n anchor.href = \"#\";\n anchor.textContent = text;\n\n anchor.addEventListener(\"click\", (e) => {\n e.preventDefault();\n dataDown.twistyAlgViewer.jumpToIndex(\n dataDown.earliestMoveIndex,\n offsetIntoMove,\n );\n });\n } else {\n this.contentWrapper.appendChild(\n document.createElement(\"span\"),\n ).textContent = text;\n }\n }\n\n pathToIndex(_index: number): (TwistyAlgWrapperElem | TwistyAlgLeafElem)[] {\n return [];\n }\n\n setCurrentMove(current: boolean) {\n this.contentWrapper.classList.toggle(\"current-move\", current);\n }\n}\n\ncustomElementsShim.define(\"twisty-alg-leaf-elem\", TwistyAlgLeafElem);\n\nclass TwistyAlgWrapperElem extends HTMLElementShim {\n private queue: (Element | Text)[] = [];\n\n constructor(className: string, public algOrUnit: Alg | Unit) {\n super();\n this.classList.add(className);\n }\n\n addString(str: string) {\n this.queue.push(document.createTextNode(str));\n }\n\n addElem(dataUp: DataUp): number {\n this.queue.push(dataUp.element);\n return dataUp.moveCount;\n }\n\n flushQueue(\n direction: ExperimentalIterationDirection = ExperimentalIterationDirection.Forwards,\n ): void {\n for (const node of maybeReverseList(this.queue, direction)) {\n this.append(node);\n }\n this.queue = [];\n }\n\n pathToIndex(_index: number): (TwistyAlgWrapperElem | TwistyAlgLeafElem)[] {\n return [];\n }\n}\n\ncustomElementsShim.define(\"twisty-alg-wrapper-elem\", TwistyAlgWrapperElem);\n\nfunction oppositeDirection(\n direction: ExperimentalIterationDirection,\n): ExperimentalIterationDirection {\n return direction === ExperimentalIterationDirection.Forwards\n ? ExperimentalIterationDirection.Backwards\n : ExperimentalIterationDirection.Forwards;\n}\n\nfunction updateDirectionByAmount(\n currentDirection: ExperimentalIterationDirection,\n amount: number,\n): ExperimentalIterationDirection {\n return amount < 0 ? oppositeDirection(currentDirection) : currentDirection;\n}\n\nfunction maybeReverseList<T>(\n l: T[],\n direction: ExperimentalIterationDirection,\n): T[] {\n if (direction === ExperimentalIterationDirection.Forwards) {\n return l;\n }\n // console.log(\"rev\", Array.from(l).reverse());\n // return Array.from(l).reverse();\n const copy = Array.from(l);\n copy.reverse();\n return copy;\n}\n\nclass AlgToDOMTree extends TraversalDownUp<DataDown, DataUp, DataUp> {\n public traverseAlg(alg: Alg, dataDown: DataDown): DataUp {\n let moveCount = 0;\n const element = new TwistyAlgWrapperElem(\"twisty-alg-alg\", alg); // TODO: pick a better class name.\n let first = true;\n for (const unit of experimentalDirect(alg.units(), dataDown.direction)) {\n if (!first) {\n element.addString(\" \");\n }\n first = false;\n moveCount += element.addElem(\n this.traverseUnit(unit, {\n earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,\n twistyAlgViewer: dataDown.twistyAlgViewer,\n direction: dataDown.direction,\n }),\n );\n }\n element.flushQueue(dataDown.direction);\n return {\n moveCount: moveCount,\n element,\n };\n }\n\n public traverseGrouping(grouping: Grouping, dataDown: DataDown): DataUp {\n const square1Tuple = grouping.experimentalAsSquare1Tuple();\n // if (square1Tuplle) {\n\n // }\n\n const direction = updateDirectionByAmount(\n dataDown.direction,\n grouping.amount,\n );\n let moveCount = 0;\n const element = new TwistyAlgWrapperElem(\"twisty-alg-grouping\", grouping);\n element.addString(\"(\");\n\n if (square1Tuple) {\n moveCount += element.addElem({\n moveCount: 1,\n element: new TwistyAlgLeafElem(\n \"twisty-alg-move\", // TODO: Mark the tuple with a special class?\n square1Tuple[0].amount.toString(),\n dataDown,\n square1Tuple[0],\n true,\n true,\n ),\n });\n element.addString(\", \");\n moveCount += element.addElem({\n moveCount: 1,\n element: new TwistyAlgLeafElem(\n \"twisty-alg-move\", // TODO: Mark the tuple with a special class?\n square1Tuple[1].amount.toString(),\n dataDown,\n square1Tuple[1],\n true,\n true,\n ),\n });\n } else {\n moveCount += element.addElem(\n this.traverseAlg(grouping.alg, {\n earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,\n twistyAlgViewer: dataDown.twistyAlgViewer,\n direction,\n }),\n );\n }\n\n element.addString(\")\" + grouping.experimentalRepetitionSuffix);\n element.flushQueue();\n return {\n moveCount: moveCount * Math.abs(grouping.amount),\n element,\n };\n }\n\n public traverseMove(move: Move, dataDown: DataDown): DataUp {\n const element = new TwistyAlgLeafElem(\n \"twisty-alg-move\",\n move.toString(),\n dataDown,\n move,\n true,\n true,\n );\n dataDown.twistyAlgViewer.highlighter.addMove(\n (move as Parsed<Move>).startCharIndex,\n element,\n );\n return {\n moveCount: 1,\n element,\n };\n }\n\n public traverseCommutator(\n commutator: Commutator,\n dataDown: DataDown,\n ): DataUp {\n let moveCount = 0;\n const element = new TwistyAlgWrapperElem(\n \"twisty-alg-commutator\",\n commutator,\n );\n element.addString(\"[\");\n element.flushQueue();\n const [first, second]: Alg[] = maybeReverseList(\n [commutator.A, commutator.B],\n dataDown.direction,\n );\n moveCount += element.addElem(\n this.traverseAlg(first, {\n earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,\n twistyAlgViewer: dataDown.twistyAlgViewer,\n direction: dataDown.direction,\n }),\n );\n element.addString(\", \");\n moveCount += element.addElem(\n this.traverseAlg(second, {\n earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,\n twistyAlgViewer: dataDown.twistyAlgViewer,\n direction: dataDown.direction,\n }),\n );\n element.flushQueue(dataDown.direction);\n element.addString(\"]\");\n element.flushQueue();\n return {\n moveCount: moveCount * 2,\n element,\n };\n }\n\n public traverseConjugate(conjugate: Conjugate, dataDown: DataDown): DataUp {\n let moveCount = 0;\n const element = new TwistyAlgWrapperElem(\"twisty-alg-conjugate\", conjugate);\n element.addString(\"[\");\n const aLen = element.addElem(\n this.traverseAlg(conjugate.A, {\n earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,\n twistyAlgViewer: dataDown.twistyAlgViewer,\n direction: dataDown.direction,\n }),\n );\n moveCount += aLen;\n element.addString(\": \");\n moveCount += element.addElem(\n this.traverseAlg(conjugate.B, {\n earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,\n twistyAlgViewer: dataDown.twistyAlgViewer,\n direction: dataDown.direction,\n }),\n );\n element.addString(\"]\");\n element.flushQueue();\n return {\n moveCount: moveCount + aLen,\n element,\n };\n }\n\n public traversePause(pause: Pause, dataDown: DataDown): DataUp {\n return {\n moveCount: 1,\n element: new TwistyAlgLeafElem(\n \"twisty-alg-pause\",\n \".\",\n dataDown,\n pause,\n true,\n true,\n ),\n };\n }\n\n public traverseNewline(newline: Newline, _dataDown: DataDown): DataUp {\n const element = new TwistyAlgWrapperElem(\"twisty-alg-newline\", newline);\n element.append(document.createElement(\"br\"));\n return {\n moveCount: 0,\n element,\n };\n }\n\n public traverseLineComment(\n lineComment: LineComment,\n dataDown: DataDown,\n ): DataUp {\n return {\n moveCount: 0,\n element: new TwistyAlgLeafElem(\n \"twisty-alg-line-comment\",\n `//${lineComment.text}`,\n dataDown,\n lineComment,\n false,\n false,\n ),\n };\n }\n}\n\nconst algToDOMTreeInstance = new AlgToDOMTree();\nconst algToDOMTree = algToDOMTreeInstance.traverseAlg.bind(\n algToDOMTreeInstance,\n) as (alg: Alg, dataDown: DataDown) => DataUp;\n\nclass MoveHighlighter {\n moveCharIndexMap: Map<number, TwistyAlgLeafElem> = new Map();\n currentElem: TwistyAlgLeafElem | null = null;\n\n addMove(charIndex: number, elem: TwistyAlgLeafElem): void {\n this.moveCharIndexMap.set(charIndex, elem);\n }\n\n set(move: Parsed<Move> | null): void {\n const newElem = move\n ? this.moveCharIndexMap.get(move.startCharIndex) ?? null\n : null;\n if (this.currentElem === newElem) {\n return;\n }\n this.currentElem?.classList.remove(\"twisty-alg-current-move\");\n this.currentElem?.setCurrentMove(false);\n newElem?.classList.add(\"twisty-alg-current-move\");\n newElem?.setCurrentMove(true);\n this.currentElem = newElem;\n }\n}\n\nexport class TwistyAlgViewer extends HTMLElementShim {\n highlighter: MoveHighlighter = new MoveHighlighter();\n #domTree: TwistyAlgWrapperElem | TwistyAlgLeafElem;\n twistyPlayer: TwistyPlayer | null = null;\n lastClickTimestamp: number | null = null;\n constructor(options?: { twistyPlayer?: TwistyPlayer }) {\n super();\n if (options?.twistyPlayer) {\n this.setTwistyPlayer(options?.twistyPlayer);\n }\n }\n\n protected connectedCallback(): void {\n // nothing to do?\n }\n\n private setAlg(alg: Alg): void {\n this.#domTree = algToDOMTree(alg, {\n earliestMoveIndex: 0,\n twistyAlgViewer: this,\n direction: ExperimentalIterationDirection.Forwards,\n }).element;\n this.textContent = \"\";\n this.appendChild(this.#domTree);\n }\n\n async setTwistyPlayer(twistyPlayer: TwistyPlayer): Promise<void> {\n if (this.twistyPlayer) {\n console.warn(\"twisty-player reassignment is not supported\");\n return;\n }\n this.twistyPlayer = twistyPlayer;\n\n this.twistyPlayer.experimentalModel.algProp.addFreshListener(\n (algWithIssues: AlgWithIssues) => {\n this.setAlg(algWithIssues.alg);\n },\n );\n\n const sourceAlg = (await this.twistyPlayer.experimentalModel.algProp.get())\n .alg;\n // TODO: Use proper architecture instead of a heuristic to ensure we have a parsed alg annotated with char indices.\n const parsedAlg =\n \"startCharIndex\" in (sourceAlg as Partial<Parsed<Alg>>)\n ? sourceAlg\n : Alg.fromString(sourceAlg.toString());\n this.setAlg(parsedAlg);\n\n twistyPlayer.experimentalModel.currentLeavesProp.addFreshListener(\n (currentMoveInfo: CurrentMoveInfo) => {\n let moveInfo = currentMoveInfo.currentMoves[0];\n moveInfo ??= currentMoveInfo.movesStarting[0];\n moveInfo ??= currentMoveInfo.movesFinishing[0];\n if (!moveInfo) {\n this.highlighter.set(null);\n } else {\n const mainCurrentMove = moveInfo.move; // TODO\n this.highlighter.set(mainCurrentMove as Parsed<Move>);\n }\n },\n );\n\n twistyPlayer.experimentalModel.detailedTimelineInfoProp.addFreshListener(\n (detailedTimelineInfo: DetailedTimelineInfo) => {\n if (detailedTimelineInfo.timestamp !== this.lastClickTimestamp) {\n this.lastClickTimestamp = null;\n }\n },\n );\n }\n\n async jumpToIndex(index: number, offsetIntoMove: boolean): Promise<void> {\n // TODO: Fix async issues.\n const twistyPlayer = this.twistyPlayer;\n if (twistyPlayer) {\n twistyPlayer.pause();\n const timestampPromise = (async (): Promise<MillisecondTimestamp> => {\n const indexer = await twistyPlayer.experimentalModel.indexerProp.get();\n const offset = offsetIntoMove ? DEFAULT_OFFSET_MS : 0;\n return (indexer.indexToMoveStartTimestamp(index) ?? -offset) + offset;\n })();\n twistyPlayer.experimentalModel.timestampRequestProp.set(\n await timestampPromise, // TODO\n );\n if (this.lastClickTimestamp === (await timestampPromise)) {\n twistyPlayer.play();\n this.lastClickTimestamp = null;\n } else {\n this.lastClickTimestamp = await timestampPromise;\n }\n }\n }\n\n protected async attributeChangedCallback(\n attributeName: string,\n _oldValue: string,\n newValue: string,\n ): Promise<void> {\n if (attributeName === \"for\") {\n const elem = document.getElementById(newValue);\n if (!elem) {\n console.warn(\"for= elem does not exist\");\n return;\n }\n await customElements.whenDefined(\"twisty-player\");\n if (!(elem instanceof TwistyPlayer)) {\n console.warn(\"for= elem is not a twisty-player\");\n return;\n }\n this.setTwistyPlayer(elem);\n }\n }\n\n static get observedAttributes(): string[] {\n return [\"for\"];\n }\n}\n\ncustomElementsShim.define(\"twisty-alg-viewer\", TwistyAlgViewer);\n", "import { CSSSource } from \"./ManagedCustomElement\";\n\nexport const twistyAlgViewerCSS = new CSSSource(`\n:host {\n display: inline-grid;\n}\n\na:not(:hover) {\n color: inherit;\n text-decoration: none;\n}\n\ntwisty-alg-leaf-elem.twisty-alg-comment {\n color: rgba(0, 0, 0, 0.4);\n}\n\n.wrapper.current-move {\n background: rgba(66, 133, 244, 0.3);\n margin-left: -0.1em;\n margin-right: -0.1em;\n padding-left: 0.1em;\n padding-right: 0.1em;\n border-radius: 0.1em;\n}\n`);\n", "/**\n * Warning: the current implementation of <twisty-alg-editor> is *not good*,\n * but it is *good enough*. The important parts is that:\n *\n * - The editor can be used in apps without much effort.\n * - The editor handles alg validation and move highlighting *okay* when not\n * connected to a `<twisty-player>`.\n * - The editor stays in sync if it's connected to a `<twisty-player>`.\n *\n * The current implementation still has some race conditions and edge cases. A\n * proper rewrite with a better model would be very welcome.\n */\n\nimport type { ExperimentalParsed } from \"../../../alg\";\nimport { Alg, Move, Pause } from \"../../../alg\";\nimport type { Parsed } from \"../../../alg/parse\";\nimport type {\n AlgProp,\n AlgWithIssues,\n} from \"../../model/props/puzzle/state/AlgProp\";\nimport type { CurrentLeavesSimplified } from \"../../model/props/puzzle/state/CurrentLeavesSimplified\";\nimport { ClassListManager } from \"../ClassListManager\";\nimport { ManagedCustomElement } from \"../ManagedCustomElement\";\nimport { customElementsShim } from \"../node-custom-element-shims\";\nimport { TwistyPlayer } from \"../TwistyPlayer\";\nimport { HighlightInfo, TwistyAlgEditorModel } from \"./model\";\nimport { twistyAlgEditorCSS } from \"./TwistyAlgEditor.css\";\n\nconst ATTRIBUTE_FOR_TWISTY_PLAYER = \"for-twisty-player\";\nconst ATTRIBUTE_PLACEHOLDER = \"placeholder\";\nconst ATTRIBUTE_TWISTY_PLAYER_PROP = \"twisty-player-prop\";\n\ntype TwistyPlayerAlgProp = \"algProp\" | \"setupProp\";\n\nexport class TwistyAlgEditor extends ManagedCustomElement {\n model = new TwistyAlgEditorModel();\n\n // #alg: Alg = new Alg();\n #textarea: HTMLTextAreaElement = document.createElement(\"textarea\");\n #carbonCopy: HTMLDivElement = document.createElement(\"div\");\n #carbonCopyPrefix: HTMLSpanElement = document.createElement(\"span\");\n #carbonCopyHighlight: HTMLSpanElement = document.createElement(\"span\");\n #carbonCopySuffix: HTMLSpanElement = document.createElement(\"span\");\n\n // #textareaClassListManager: ClassListManager<\"none\" | \"warning\" | \"error\"> =\n // new ClassListManager(this, \"issue-\", [\"none\", \"warning\", \"error\"]);\n\n #textareaClassListValidForPuzzleManager: ClassListManager<\n \"none\" | \"warning\" | \"error\"\n > = new ClassListManager(this, \"valid-for-puzzle-\", [\n \"none\",\n \"warning\",\n \"error\",\n ]);\n\n #twistyPlayer: TwistyPlayer | null = null;\n #twistyPlayerProp: TwistyPlayerAlgProp;\n get #algProp(): AlgProp | null {\n if (this.#twistyPlayer === null) {\n return null;\n } else {\n return this.#twistyPlayer.experimentalModel[this.#twistyPlayerProp];\n }\n }\n\n // Temporary Workaround for Twizzle Explorer\n debugNeverRequestTimestamp: boolean = false;\n\n constructor(options?: {\n twistyPlayer?: TwistyPlayer;\n twistyPlayerProp?: TwistyPlayerAlgProp;\n }) {\n super();\n this.#carbonCopy.classList.add(\"carbon-copy\");\n this.addElement(this.#carbonCopy);\n this.#textarea.rows = 1;\n this.addElement(this.#textarea);\n this.#carbonCopyPrefix.classList.add(\"prefix\");\n this.#carbonCopy.appendChild(this.#carbonCopyPrefix);\n this.#carbonCopyHighlight.classList.add(\"highlight\");\n this.#carbonCopy.appendChild(this.#carbonCopyHighlight);\n this.#carbonCopySuffix.classList.add(\"suffix\");\n this.#carbonCopy.appendChild(this.#carbonCopySuffix);\n\n this.#textarea.placeholder = \"Alg\";\n // Prevent iOS from defaulting to smart quotes.\n this.#textarea.setAttribute(\"spellcheck\", \"false\");\n\n this.addCSS(twistyAlgEditorCSS);\n\n // TODO: What set of events should we register? `change`? `keydown`?\n this.#textarea.addEventListener(\"input\", () => {\n this.#onInputHasFired = true;\n this.onInput();\n });\n this.#textarea.addEventListener(\"blur\", () => this.onBlur());\n document.addEventListener(\"selectionchange\", () =>\n this.onSelectionChange(),\n );\n\n if (options?.twistyPlayer) {\n this.twistyPlayer = options.twistyPlayer;\n }\n this.#twistyPlayerProp = options?.twistyPlayerProp ?? \"algProp\";\n\n if (options?.twistyPlayerProp === \"algProp\") {\n this.model.leafToHighlight.addFreshListener(\n (highlightInfo: HighlightInfo | null) => {\n if (highlightInfo) {\n this.highlightLeaf(highlightInfo.leafInfo.leaf);\n }\n },\n );\n }\n }\n\n // TODO\n set algString(s: string) {\n this.#textarea.value = s;\n this.onInput();\n }\n\n // TODO: remove?\n get algString(): string {\n return this.#textarea.value;\n }\n\n // To we need a getter?\n set placeholder(placeholderText: string) {\n this.#textarea.placeholder = placeholderText;\n }\n\n #onInputHasFired = false;\n onInput(): void {\n this.#carbonCopyHighlight.hidden = true;\n this.highlightLeaf(null);\n\n // TODO: This is a hack so that the you don't get a warning when the cursor\n // is after the space while typing `R U`. It would be nice to have something\n // cursor-aware that can also ignore whitespace warnings (or other syntax\n // errors due to normal input) adjacent to the cursor when it's in the\n // middle, but this is suffuciently useful for now.\n const endTrimmed = this.#textarea.value.trimEnd();\n this.model.valueProp.set(endTrimmed);\n this.#algProp?.set(endTrimmed);\n }\n\n async onSelectionChange(): Promise<void> {\n if (\n document.activeElement !== this ||\n this.shadow.activeElement !== this.#textarea\n ) {\n return;\n }\n if (this.#twistyPlayerProp !== \"algProp\") {\n return;\n }\n\n const { selectionStart, selectionEnd } = this.#textarea;\n this.model.selectionProp.set({\n selectionStart,\n selectionEnd,\n });\n }\n\n async onBlur(): Promise<void> {\n // TODO: Figure out how not to make the cursor jump.\n // const parsed = Alg.fromString(this.algString);\n // this.algString = parsed.toString();\n // const [currentLeavesSimplified, indexer] = await Promise.all([\n // this.#twistyPlayer!.model.currentLeavesSimplifiedProp.get(),\n // this.#twistyPlayer!.model.indexerProp.get(),\n // ]);\n // const leaf = indexer.getAnimLeaf(currentLeavesSimplified.stateIndex);\n // this.highlightLeaf(leaf as Parsed<Move | Pause> | null);\n }\n\n setAlgIssueClassForPuzzle(issues: \"none\" | \"warning\" | \"error\") {\n this.#textareaClassListValidForPuzzleManager.setValue(issues);\n }\n\n // `white-space: pre;` mostly matches the formatting of the `<textarea>`, *except* when we end with a newline.\n // So we add an space to ensure that there is a character on the final line (that is very unlikely to trigger extra line wrapping).\n #padSuffix(s: string): string {\n return s.endsWith(\"\\n\") ? s + \" \" : s;\n }\n\n #highlightedLeaf: ExperimentalParsed<Move | Pause> | null = null;\n // TODO: support a primary highlighted move and secondary ones.\n highlightLeaf(leaf: ExperimentalParsed<Move | Pause> | null): void {\n if (this.#twistyPlayerProp !== \"algProp\") {\n return;\n }\n if (leaf === null) {\n this.#carbonCopyPrefix.textContent = \"\";\n this.#carbonCopyHighlight.textContent = \"\";\n this.#carbonCopySuffix.textContent = this.#padSuffix(\n this.#textarea.value,\n );\n return;\n }\n if (leaf === this.#highlightedLeaf) {\n return;\n }\n this.#highlightedLeaf = leaf;\n this.#carbonCopyPrefix.textContent = this.#textarea.value.slice(\n 0,\n leaf.startCharIndex,\n );\n this.#carbonCopyHighlight.textContent = this.#textarea.value.slice(\n leaf.startCharIndex,\n leaf.endCharIndex,\n );\n this.#carbonCopySuffix.textContent = this.#padSuffix(\n this.#textarea.value.slice(leaf.endCharIndex),\n );\n this.#carbonCopyHighlight.hidden = false;\n }\n\n get twistyPlayer(): TwistyPlayer | null {\n return this.#twistyPlayer;\n }\n\n // TODO: spread out this impl over private methods instead of self-listeners.\n set twistyPlayer(twistyPlayer: TwistyPlayer | null) {\n if (this.#twistyPlayer) {\n // TODO: support reassigment/clearing\n console.warn(\"twisty-player reassignment/clearing is not supported\");\n return;\n }\n this.#twistyPlayer = twistyPlayer;\n if (!twistyPlayer) {\n return;\n }\n (async () => {\n this.algString = this.#algProp\n ? (await this.#algProp.get()).alg.toString()\n : \"\";\n })();\n\n if (this.#twistyPlayerProp === \"algProp\") {\n // this.model.leafToHighlight.addFreshListener(\n // this.highlightLeaf.bind(this),\n // );\n\n // TODO: listen to puzzle prop?\n this.#twistyPlayer?.experimentalModel.puzzleAlgProp.addFreshListener(\n (algWithIssues: AlgWithIssues) => {\n // console.log(JSON.stringify(algWithIssues));\n if (algWithIssues.issues.errors.length === 0) {\n this.setAlgIssueClassForPuzzle(\n // TODO: Allow trailing spaces.\n algWithIssues.issues.warnings.length === 0 ? \"none\" : \"warning\",\n );\n const newAlg = algWithIssues.alg;\n const oldAlg = Alg.fromString(this.algString);\n if (!newAlg.isIdentical(oldAlg)) {\n this.algString = newAlg.toString();\n this.onInput();\n } else {\n // this.model.algInputProp.set(oldAlg);\n }\n } else {\n this.setAlgIssueClassForPuzzle(\"error\");\n }\n },\n );\n\n this.model.leafToHighlight.addFreshListener(\n async (highlightInfo: HighlightInfo | null) => {\n if (highlightInfo === null) {\n return;\n }\n // TODO: This indexer can be out of date!\n const [indexer, timestampRequest] = await Promise.all([\n await twistyPlayer.experimentalModel.indexerProp.get(),\n await twistyPlayer.experimentalModel.timestampRequestProp.get(),\n ]);\n if (\n timestampRequest === \"opposite-anchor\" &&\n !this.#onInputHasFired\n ) {\n return;\n }\n const moveStartTimestamp = indexer.indexToMoveStartTimestamp(\n highlightInfo.leafInfo.idx,\n );\n const duration = indexer.moveDuration(highlightInfo.leafInfo.idx);\n\n let newTimestamp: number;\n switch (highlightInfo.where) {\n case \"before\":\n newTimestamp = moveStartTimestamp;\n break;\n case \"start\":\n case \"inside\":\n newTimestamp = moveStartTimestamp + duration / 4;\n break;\n case \"end\":\n case \"after\":\n newTimestamp = moveStartTimestamp + duration;\n break;\n default:\n console.log(\"invalid where\");\n throw new Error(\"Invalid where!\");\n }\n if (!this.debugNeverRequestTimestamp) {\n twistyPlayer.experimentalModel.timestampRequestProp.set(\n newTimestamp,\n );\n }\n },\n );\n\n twistyPlayer.experimentalModel.currentLeavesSimplifiedProp.addFreshListener(\n async (currentLeavesSimplified: CurrentLeavesSimplified) => {\n const indexer =\n await twistyPlayer.experimentalModel.indexerProp.get();\n const leaf = indexer.getAnimLeaf(currentLeavesSimplified.stateIndex);\n this.highlightLeaf(leaf as Parsed<Move | Pause> | null);\n },\n );\n }\n }\n\n protected attributeChangedCallback(\n attributeName: string,\n _oldValue: string,\n newValue: string,\n ): void {\n switch (attributeName) {\n case ATTRIBUTE_FOR_TWISTY_PLAYER: {\n const elem = document.getElementById(newValue);\n if (!elem) {\n console.warn(`${ATTRIBUTE_FOR_TWISTY_PLAYER}= elem does not exist`);\n return;\n }\n if (!(elem instanceof TwistyPlayer)) {\n // TODO: avoid assuming single instance of lib?\n console.warn(`${ATTRIBUTE_FOR_TWISTY_PLAYER}=is not a twisty-player`);\n return;\n }\n this.twistyPlayer = elem;\n return;\n }\n case ATTRIBUTE_PLACEHOLDER:\n this.placeholder = newValue;\n return;\n case ATTRIBUTE_TWISTY_PLAYER_PROP:\n if (this.#twistyPlayer) {\n console.log(\"cannot set prop\");\n throw new Error(\"cannot set prop after twisty player\");\n }\n this.#twistyPlayerProp = newValue as TwistyPlayerAlgProp;\n return;\n }\n }\n\n static get observedAttributes(): string[] {\n return [\n ATTRIBUTE_FOR_TWISTY_PLAYER,\n ATTRIBUTE_PLACEHOLDER,\n ATTRIBUTE_TWISTY_PLAYER_PROP,\n ];\n }\n}\n\ncustomElementsShim.define(\"twisty-alg-editor\", TwistyAlgEditor);\n", "// TODO: Move this?\n\nimport type { Alg } from \"../../../alg\";\nimport type { Parsed } from \"../../../alg/parse\";\nimport {\n AlgWithIssues,\n algWithIssuesFromString,\n} from \"../../model/props/puzzle/state/AlgProp\";\nimport {\n SimpleTwistyPropSource,\n TwistyPropDerived,\n TwistyPropSource,\n} from \"../../model/props/TwistyProp\";\nimport {\n AnimatedLeafUnitInfo,\n leafTokens,\n OrderedLeafTokens,\n} from \"./LeafTokens\";\n\nexport class TwistyAlgEditorValueProp extends SimpleTwistyPropSource<string> {\n getDefaultValue(): string {\n return \"\";\n }\n}\n\ninterface AlgEditorAlgWithIssuesPropInput {\n value: string;\n}\nclass AlgEditorAlgWithIssuesProp extends TwistyPropDerived<\n AlgEditorAlgWithIssuesPropInput,\n AlgWithIssues\n> {\n derive(input: AlgEditorAlgWithIssuesPropInput): AlgWithIssues {\n return algWithIssuesFromString(input.value);\n }\n\n // TODO: canReuse needs to take the source string into account.\n}\n\ninterface SelectionInfoPropInput {\n selectionStart: number;\n selectionEnd: number;\n}\ninterface SelectionInfo extends SelectionInfoPropInput {\n endChangedMostRecently: boolean;\n}\nexport class TwistyAlgEditorSelectionProp extends TwistyPropSource<\n SelectionInfo,\n SelectionInfoPropInput\n> {\n getDefaultValue() {\n return {\n selectionStart: 0,\n selectionEnd: 0,\n endChangedMostRecently: false,\n };\n }\n\n async derive(\n input: SelectionInfoPropInput,\n oldValue: Promise<SelectionInfo>,\n ): Promise<SelectionInfo> {\n const { selectionStart, selectionEnd } = input;\n const lastResult = await oldValue;\n const endChangedMostRecently =\n input.selectionStart === lastResult.selectionStart &&\n input.selectionEnd !== (await oldValue).selectionEnd;\n return {\n selectionStart,\n selectionEnd,\n endChangedMostRecently,\n };\n }\n}\n\ninterface TargetCharPropInputs {\n selectionInfo: SelectionInfo;\n}\n\nexport class TargetCharProp extends TwistyPropDerived<\n TargetCharPropInputs,\n number\n> {\n derive(inputs: TargetCharPropInputs) {\n return inputs.selectionInfo.endChangedMostRecently\n ? inputs.selectionInfo.selectionEnd\n : inputs.selectionInfo.selectionStart;\n }\n}\n\ninterface LeafTokensPropInputs {\n algWithIssues: AlgWithIssues;\n}\nclass LeafTokensProp extends TwistyPropDerived<\n LeafTokensPropInputs,\n OrderedLeafTokens\n> {\n derive(inputs: LeafTokensPropInputs): OrderedLeafTokens {\n return leafTokens(inputs.algWithIssues.alg as Parsed<Alg>, {\n numMovesSofar: 0,\n }).tokens;\n }\n}\n\ninterface LeafToHighlightPropInputs {\n targetChar: number;\n leafTokens: OrderedLeafTokens;\n}\ntype HighlightWhere = \"before\" | \"start\" | \"inside\" | \"end\" | \"after\";\nexport interface HighlightInfo {\n leafInfo: AnimatedLeafUnitInfo;\n where: HighlightWhere;\n}\nclass LeafToHighlightProp extends TwistyPropDerived<\n LeafToHighlightPropInputs,\n HighlightInfo | null\n> {\n derive(inputs: LeafToHighlightPropInputs): HighlightInfo | null {\n function withWhere(\n leafInfo: AnimatedLeafUnitInfo | null,\n ): HighlightInfo | null {\n if (leafInfo === null) {\n return null;\n }\n let where: HighlightWhere;\n if (inputs.targetChar < leafInfo.leaf.startCharIndex) {\n where = \"before\";\n } else if (inputs.targetChar === leafInfo.leaf.startCharIndex) {\n where = \"start\";\n } else if (inputs.targetChar < leafInfo.leaf.endCharIndex) {\n where = \"inside\";\n } else if (inputs.targetChar === leafInfo.leaf.endCharIndex) {\n where = \"end\";\n } else {\n where = \"after\";\n }\n return {\n leafInfo,\n where,\n };\n }\n\n let lastLeafInfo: AnimatedLeafUnitInfo | null = null;\n // TODO: binary search\n for (const leafInfo of inputs.leafTokens) {\n if (\n inputs.targetChar < leafInfo.leaf.startCharIndex &&\n lastLeafInfo !== null\n ) {\n return withWhere(lastLeafInfo);\n }\n if (inputs.targetChar <= leafInfo.leaf.endCharIndex) {\n return withWhere(leafInfo);\n }\n lastLeafInfo = leafInfo;\n }\n\n return withWhere(lastLeafInfo);\n }\n}\n\nexport class TwistyAlgEditorModel {\n valueProp = new TwistyAlgEditorValueProp();\n selectionProp = new TwistyAlgEditorSelectionProp();\n targetCharProp = new TargetCharProp({ selectionInfo: this.selectionProp });\n\n algEditorAlgWithIssues = new AlgEditorAlgWithIssuesProp({\n value: this.valueProp,\n });\n\n leafTokensProp = new LeafTokensProp({\n algWithIssues: this.algEditorAlgWithIssues,\n });\n\n leafToHighlight = new LeafToHighlightProp({\n leafTokens: this.leafTokensProp,\n targetChar: this.targetCharProp,\n });\n}\n", "import {\n Alg,\n Commutator,\n Conjugate,\n Grouping,\n LineComment,\n Move,\n Newline,\n Pause,\n TraversalDownUp,\n} from \"../../../alg\";\nimport type { Parsed } from \"../../../alg/parse\";\nimport type { AnimatedLeafUnit } from \"../../controllers/indexer/simultaneous-moves/simul-moves\";\n\nexport type AnimatedLeafUnitInfo = {\n leaf: Parsed<AnimatedLeafUnit>;\n idx: number;\n};\nexport type OrderedLeafTokens = AnimatedLeafUnitInfo[];\n\ninterface DataUp {\n tokens: OrderedLeafTokens;\n numLeavesInside: number;\n}\n\ninterface DataDown {\n numMovesSofar: number;\n}\n\nclass LeafTokens extends TraversalDownUp<DataDown, DataUp> {\n public traverseAlg(alg: Alg, dataDown: DataDown): DataUp {\n const unitArrays: OrderedLeafTokens[] = [];\n let numMovesInside = 0;\n for (const unit of alg.units()) {\n const dataUp = this.traverseUnit(unit, {\n numMovesSofar: dataDown.numMovesSofar + numMovesInside,\n });\n unitArrays.push(dataUp.tokens);\n numMovesInside += dataUp.numLeavesInside;\n }\n return {\n tokens: Array.prototype.concat(...unitArrays),\n numLeavesInside: numMovesInside,\n };\n }\n\n public traverseGrouping(grouping: Grouping, dataDown: DataDown): DataUp {\n const dataUp = this.traverseAlg(grouping.alg, dataDown);\n return {\n tokens: dataUp.tokens,\n numLeavesInside: dataUp.numLeavesInside * grouping.amount,\n };\n }\n\n public traverseMove(move: Move, dataDown: DataDown): DataUp {\n return {\n tokens: [{ leaf: move as Parsed<Move>, idx: dataDown.numMovesSofar }],\n numLeavesInside: 1,\n }; // TODO: What if not parsed?\n }\n\n public traverseCommutator(\n commutator: Commutator,\n dataDown: DataDown,\n ): DataUp {\n const dataUpA = this.traverseAlg(commutator.A, dataDown);\n const dataUpB = this.traverseAlg(commutator.B, {\n numMovesSofar: dataDown.numMovesSofar + dataUpA.numLeavesInside,\n });\n return {\n tokens: dataUpA.tokens.concat(dataUpB.tokens),\n numLeavesInside: dataUpA.numLeavesInside * 2 + dataUpB.numLeavesInside,\n };\n }\n\n public traverseConjugate(conjugate: Conjugate, dataDown: DataDown): DataUp {\n const dataUpA = this.traverseAlg(conjugate.A, dataDown);\n const dataUpB = this.traverseAlg(conjugate.B, {\n numMovesSofar: dataDown.numMovesSofar + dataUpA.numLeavesInside,\n });\n return {\n tokens: dataUpA.tokens.concat(dataUpB.tokens),\n numLeavesInside:\n dataUpA.numLeavesInside * 2 + dataUpB.numLeavesInside * 2,\n };\n }\n\n public traversePause(pause: Pause, dataDown: DataDown): DataUp {\n return {\n tokens: [{ leaf: pause as Parsed<Pause>, idx: dataDown.numMovesSofar }],\n numLeavesInside: 1,\n }; // TODO: What if not parsed?\n }\n\n public traverseNewline(_newline: Newline, _dataDown: DataDown): DataUp {\n return {\n tokens: [],\n numLeavesInside: 0,\n };\n }\n\n public traverseLineComment(\n _comment: LineComment,\n _dataDown: DataDown,\n ): DataUp {\n return {\n tokens: [],\n numLeavesInside: 0,\n };\n }\n}\n\nconst leafTokensInstance = new LeafTokens();\nexport const leafTokens = leafTokensInstance.traverseAlg.bind(\n leafTokensInstance,\n) as (alg: Parsed<Alg>, dataDown: DataDown) => DataUp;\n", "import { CSSSource } from \"../ManagedCustomElement\";\n\nexport const twistyAlgEditorCSS = new CSSSource(`\n:host {\n width: 384px;\n display: grid;\n}\n\n.wrapper {\n /*overflow: hidden;\n resize: horizontal;*/\n\n background: var(--background, none);\n display: grid;\n}\n\ntextarea, .carbon-copy {\n grid-area: 1 / 1 / 2 / 2;\n\n width: 100%;\n font-family: sans-serif;\n line-height: 1.2em;\n\n font-size: var(--font-size, inherit);\n font-family: var(--font-family, sans-serif);\n\n box-sizing: border-box;\n\n padding: var(--padding, 0.5em);\n /* Prevent horizontal growth. */\n overflow-x: hidden;\n}\n\ntextarea {\n resize: none;\n background: none;\n z-index: 2;\n overflow: hidden;\n border: 1px solid var(--border-color, rgba(0, 0, 0, 0.25));\n}\n\n.carbon-copy {\n white-space: pre-wrap;\n word-wrap: break-word;\n color: transparent;\n user-select: none;\n pointer-events: none;\n\n z-index: 1;\n}\n\n.carbon-copy .highlight {\n background: var(--highlight-color, rgba(255, 128, 0, 0.5));\n padding: 0.1em 0.2em;\n margin: -0.1em -0.2em;\n border-radius: 0.2em;\n}\n\n.wrapper.issue-warning textarea,\n.wrapper.valid-for-puzzle-warning textarea {\n outline: none;\n border: 1px solid rgba(200, 200, 0, 0.5);\n background: rgba(255, 255, 0, 0.1);\n}\n\n.wrapper.issue-error textarea,\n.wrapper.valid-for-puzzle-error textarea {\n outline: none;\n border: 1px solid red;\n background: rgba(255, 0, 0, 0.1);\n}\n`);\n", "export { TwistyPlayer } from \"./views/TwistyPlayer\";\nexport { TwistyAlgViewer } from \"./views/TwistyAlgViewer\";\nexport { TwistyAlgEditor } from \"./views/TwistyAlgEditor/TwistyAlgEditor\";\nexport type { TwistyPlayerConfig } from \"./views/TwistyPlayer\";\nexport { experimentalForceNewRendererSharing } from \"./views/3D/Twisty3DVantage\";\n\nexport { NO_VALUE as EXPERIMENTAL_PROP_NO_VALUE } from \"./model/props/TwistyProp\";\nexport { ExperimentalStickering } from \"./model/props/puzzle/display/StickeringProp\";\nexport {\n BackViewLayout,\n backViewLayouts,\n} from \"./model/props/viewer/BackViewProp\";\nexport type { PuzzleID } from \"./model/props/puzzle/structure/PuzzleIDRequestProp\";\nexport { VisualizationFormat } from \"./model/props/viewer/VisualizationProp\";\n\nexport { debugShowRenderStats as experimentalDebugShowRenderStats } from \"./views/3D/Twisty3DVantage\";\n\n// Older\nexport { Cube3D } from \"./views/3D/puzzles/Cube3D\";\nexport { PG3D } from \"./views/3D/puzzles/PG3D\";\nexport type { AlgIndexer } from \"./controllers/indexer/AlgIndexer\";\nexport { SimpleAlgIndexer } from \"./controllers/indexer/SimpleAlgIndexer\";\nexport { TreeAlgIndexer } from \"./controllers/indexer/tree/TreeAlgIndexer\";\nexport { KPuzzleWrapper as KSolvePuzzle } from \"./views/3D/puzzles/KPuzzleWrapper\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAII,oBAKG,YAqBA;AA9BP;AAAA;AAIA,IAAI,qBAAqB;AAKlB,uBAA0B;AAAA,MAE/B,GAAG,GAAiB;AAClB,eAAO,gBAAgB;AAAA;AAAA,MAGzB,GAAM,GAAsC;AAC1C,eAAO,gBAAgB,IAAI,OAAO;AAAA;AAAA;AAc/B,8BACG,WAEV;AAAA,MACE,cAAc;AACZ;AACA,YAAI,oBAAoB;AACtB,iBAAO,eAAe,MAAM,aAAa;AAAA,YACvC,KAAK,MAAM;AACT,qBAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,UAMhB,MAA+B;AAGjC,eAAO,QAAQ,IAAI,KAAK,SAAS,MAAM,KAAK;AAAA;AAAA;AAAA;AAAA;;;AC3CzC,yBACL,oBACA,OAAgB,MACI;AACpB,MAAI,CAAC,MAAM;AACT,WAAO;AAAA;AAET,UAAQ;AAAA,SACD;AACH,aAAO;AAAA,SACJ;AACH,aAAO;AAAA;AAAA;AAIN,gBACL,GACA,SACa;AACb,SAAO,YAAY,KAA+B,MAAM,KAAK,GAAG,YAAY;AAAA;AAGvE,iBAAoB,GAA6B;AACtD,SAAO,MAAM,KAAK,G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