cubing 0.24.0-pre4 → 0.24.2

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 (71) hide show
  1. package/dist/esm/{2x2x2.sgs.json-5IQQFXW7.js → 2x2x2.sgs.json-5MCXGXA6.js} +3 -3
  2. package/dist/esm/{2x2x2.sgs.json-5IQQFXW7.js.map → 2x2x2.sgs.json-5MCXGXA6.js.map} +0 -0
  3. package/dist/esm/{3d-dynamic-inside-OGANXBOW.js → 3d-dynamic-inside-XYXXTULQ.js} +4 -4
  4. package/dist/esm/{3d-dynamic-inside-OGANXBOW.js.map → 3d-dynamic-inside-XYXXTULQ.js.map} +0 -0
  5. package/dist/esm/bluetooth/index.js +3 -3
  6. package/dist/esm/{chunk-2IHGN4YF.js → chunk-2CGRUO5X.js} +120 -96
  7. package/dist/esm/chunk-2CGRUO5X.js.map +7 -0
  8. package/dist/esm/{chunk-NMODRU23.js → chunk-2I3MTSRM.js} +3 -3
  9. package/dist/esm/{chunk-NMODRU23.js.map → chunk-2I3MTSRM.js.map} +0 -0
  10. package/dist/esm/{chunk-Z36TNZT2.js → chunk-B27E6KTE.js} +9 -4
  11. package/dist/esm/chunk-B27E6KTE.js.map +7 -0
  12. package/dist/esm/{chunk-QBSUFYNB.js → chunk-BBEJTW6Z.js} +2 -2
  13. package/dist/esm/{chunk-QBSUFYNB.js.map → chunk-BBEJTW6Z.js.map} +0 -0
  14. package/dist/esm/{chunk-VSR6KPDV.js → chunk-GBIDMAJS.js} +2 -2
  15. package/dist/esm/{chunk-VSR6KPDV.js.map → chunk-GBIDMAJS.js.map} +0 -0
  16. package/dist/esm/{chunk-5HKJRHTE.js → chunk-HU55EGD6.js} +2 -2
  17. package/dist/esm/{chunk-5HKJRHTE.js.map → chunk-HU55EGD6.js.map} +0 -0
  18. package/dist/esm/{chunk-WOZD7WE6.js → chunk-LR6VCMD2.js} +2 -2
  19. package/dist/esm/{chunk-WOZD7WE6.js.map → chunk-LR6VCMD2.js.map} +0 -0
  20. package/dist/esm/{chunk-UYT3253Q.js → chunk-TOPMNZ57.js} +2 -2
  21. package/dist/esm/{chunk-UYT3253Q.js.map → chunk-TOPMNZ57.js.map} +0 -0
  22. package/dist/esm/{chunk-Z7Z3EXTF.js → chunk-UZTY6GHM.js} +3 -3
  23. package/dist/esm/chunk-UZTY6GHM.js.map +7 -0
  24. package/dist/esm/{entry-JFJRMSLA.js → entry-FOASJVBZ.js} +14 -14
  25. package/dist/esm/{entry-JFJRMSLA.js.map → entry-FOASJVBZ.js.map} +0 -0
  26. package/dist/esm/{fto.sgs.json-7I3SDUV5.js → fto.sgs.json-USK5JCKN.js} +3 -3
  27. package/dist/esm/{fto.sgs.json-7I3SDUV5.js.map → fto.sgs.json-USK5JCKN.js.map} +0 -0
  28. package/dist/esm/kpuzzle/index.js +3 -1
  29. package/dist/esm/{megaminx.sgs.json-H4UHRFJ6.js → megaminx.sgs.json-3UELYHNZ.js} +3 -3
  30. package/dist/esm/{megaminx.sgs.json-H4UHRFJ6.js.map → megaminx.sgs.json-3UELYHNZ.js.map} +0 -0
  31. package/dist/esm/{module-entry-4JHVVJZL.js → module-entry-DBPFVUZH.js} +2 -2
  32. package/dist/esm/{module-entry-4JHVVJZL.js.map → module-entry-DBPFVUZH.js.map} +0 -0
  33. package/dist/esm/protocol/index.js +2 -2
  34. package/dist/esm/puzzles/index.js +2 -2
  35. package/dist/esm/{pyraminx.sgs.json-ADZX6JEQ.js → pyraminx.sgs.json-ARYGZ7E4.js} +4 -4
  36. package/dist/esm/{pyraminx.sgs.json-ADZX6JEQ.js.map → pyraminx.sgs.json-ARYGZ7E4.js.map} +0 -0
  37. package/dist/esm/scramble/index.js +4 -4
  38. package/dist/esm/{scramble_444-QWIUGTEG.js → scramble_444-HZ7HJLTT.js} +6 -5
  39. package/dist/esm/scramble_444-HZ7HJLTT.js.map +7 -0
  40. package/dist/esm/search/index.js +4 -4
  41. package/dist/esm/{skewb.sgs.json-KZUPZ744.js → skewb.sgs.json-QVGBEYZV.js} +3 -3
  42. package/dist/esm/{skewb.sgs.json-KZUPZ744.js.map → skewb.sgs.json-QVGBEYZV.js.map} +0 -0
  43. package/dist/esm/twisty/index.js +404 -205
  44. package/dist/esm/twisty/index.js.map +3 -3
  45. package/dist/esm/{worker-inside-generated-string-MFGRIFCG.js → worker-inside-generated-string-OWBTRAXR.js} +21 -21
  46. package/dist/esm/worker-inside-generated-string-OWBTRAXR.js.map +7 -0
  47. package/dist/types/kpuzzle/index.d.ts +2 -2
  48. package/dist/types/puzzles/async/async-pg3d.d.ts +23 -6
  49. package/dist/types/puzzles/async/lazy-cached.d.ts +1 -0
  50. package/dist/types/puzzles/implementations/fto/index.d.ts +11 -2
  51. package/dist/types/puzzles/implementations/megaminx/index.d.ts +11 -2
  52. package/dist/types/puzzles/implementations/pyraminx/index.d.ts +7 -2
  53. package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
  54. package/dist/types/twisty/index.d.ts +1 -0
  55. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +44 -42
  56. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts +1 -1
  57. package/dist/types/twisty/model/props/puzzle/state/{AnchoredStartProp.d.ts → AnchorTransformationProp.d.ts} +3 -3
  58. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts +1 -0
  59. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +1 -0
  60. package/dist/types/twisty/views/ManagedCustomElement.d.ts +1 -1
  61. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +1 -1
  62. package/dist/types/twisty/views/twizzle/TwizzleLink.css.d.ts +2 -0
  63. package/dist/types/twisty/views/twizzle/TwizzleLink.d.ts +11 -0
  64. package/dist/types/twisty/views/twizzle/url-params.d.ts +18 -0
  65. package/package.json +2 -1
  66. package/dist/esm/chunk-2IHGN4YF.js.map +0 -7
  67. package/dist/esm/chunk-Z36TNZT2.js.map +0 -7
  68. package/dist/esm/chunk-Z7Z3EXTF.js.map +0 -7
  69. package/dist/esm/scramble_444-QWIUGTEG.js.map +0 -7
  70. package/dist/esm/worker-inside-generated-string-MFGRIFCG.js.map +0 -7
  71. package/dist/types/puzzles/async/lazy-cached-kpuzzle.d.ts +0 -2
@@ -10,7 +10,7 @@ import {
10
10
  TwistyPropDerived,
11
11
  TwistyPropSource,
12
12
  proxy3D
13
- } from "../chunk-UYT3253Q.js";
13
+ } from "../chunk-TOPMNZ57.js";
14
14
  import {
15
15
  countAnimatedLeaves,
16
16
  countMoves
@@ -20,8 +20,8 @@ import {
20
20
  cubeAppearance,
21
21
  customPGPuzzleLoader,
22
22
  puzzles
23
- } from "../chunk-2IHGN4YF.js";
24
- import "../chunk-Z36TNZT2.js";
23
+ } from "../chunk-2CGRUO5X.js";
24
+ import "../chunk-B27E6KTE.js";
25
25
  import {
26
26
  Alg,
27
27
  AlgBuilder,
@@ -144,8 +144,8 @@ var CatchUpHelper = class {
144
144
  this.scheduler.requestAnimFrame();
145
145
  const delta = (timestamp - this.lastTimestamp) / this.catchUpMs;
146
146
  this.lastTimestamp = timestamp;
147
- this.model.catchUpMoveProp.set((async () => {
148
- const previousCatchUpMove = await this.model.catchUpMoveProp.get();
147
+ this.model.catchUpMove.set((async () => {
148
+ const previousCatchUpMove = await this.model.catchUpMove.get();
149
149
  if (previousCatchUpMove.move === null) {
150
150
  return previousCatchUpMove;
151
151
  }
@@ -153,7 +153,7 @@ var CatchUpHelper = class {
153
153
  if (amount >= 1) {
154
154
  this.pendingFrame = true;
155
155
  this.stop();
156
- this.model.timestampRequestProp.set("end");
156
+ this.model.timestampRequest.set("end");
157
157
  return {
158
158
  move: null,
159
159
  amount: 0
@@ -179,9 +179,9 @@ var TwistyAnimationController = class {
179
179
  __privateAdd(this, _animFrameEffectiveTimestampStaleDropper, new StaleDropper());
180
180
  this.model = model;
181
181
  this.lastTimestampPromise = __privateMethod(this, _effectiveTimestampMilliseconds, effectiveTimestampMilliseconds_fn).call(this);
182
- this.model.playingInfoProp.addFreshListener(this.onPlayingProp.bind(this));
182
+ this.model.playingInfo.addFreshListener(this.onPlayingProp.bind(this));
183
183
  this.catchUpHelper = new CatchUpHelper(this.model);
184
- this.model.catchUpMoveProp.addFreshListener(this.onCatchUpMoveProp.bind(this));
184
+ this.model.catchUpMove.addFreshListener(this.onCatchUpMoveProp.bind(this));
185
185
  }
186
186
  async onPlayingProp(playingInfo) {
187
187
  if (playingInfo.playing !== this.playing) {
@@ -196,14 +196,14 @@ var TwistyAnimationController = class {
196
196
  this.scheduler.requestAnimFrame();
197
197
  }
198
198
  jumpToStart(options) {
199
- this.model.timestampRequestProp.set("start");
199
+ this.model.timestampRequest.set("start");
200
200
  this.pause();
201
201
  if (options?.flash) {
202
202
  this.delegate.flash();
203
203
  }
204
204
  }
205
205
  jumpToEnd(options) {
206
- this.model.timestampRequestProp.set("end");
206
+ this.model.timestampRequest.set("end");
207
207
  this.pause();
208
208
  if (options?.flash) {
209
209
  this.delegate.flash();
@@ -218,18 +218,18 @@ var TwistyAnimationController = class {
218
218
  }
219
219
  async play(options) {
220
220
  const direction = options?.direction ?? Direction.Forwards;
221
- const coarseTimelineInfo = await this.model.coarseTimelineInfoProp.get();
221
+ const coarseTimelineInfo = await this.model.coarseTimelineInfo.get();
222
222
  if (options?.autoSkipToOtherEndIfStartingAtBoundary ?? true) {
223
223
  if (direction === Direction.Forwards && coarseTimelineInfo.atEnd) {
224
- this.model.timestampRequestProp.set("start");
224
+ this.model.timestampRequest.set("start");
225
225
  this.delegate.flash();
226
226
  }
227
227
  if (direction === Direction.Backwards && coarseTimelineInfo.atStart) {
228
- this.model.timestampRequestProp.set("end");
228
+ this.model.timestampRequest.set("end");
229
229
  this.delegate.flash();
230
230
  }
231
231
  }
232
- this.model.playingInfoProp.set({
232
+ this.model.playingInfo.set({
233
233
  playing: true,
234
234
  direction,
235
235
  untilBoundary: options?.untilBoundary ?? BoundaryType.EntireTimeline,
@@ -243,7 +243,7 @@ var TwistyAnimationController = class {
243
243
  pause() {
244
244
  this.playing = false;
245
245
  this.scheduler.cancelAnimFrame();
246
- this.model.playingInfoProp.set({
246
+ this.model.playingInfo.set({
247
247
  playing: false,
248
248
  untilBoundary: BoundaryType.EntireTimeline
249
249
  });
@@ -254,11 +254,11 @@ var TwistyAnimationController = class {
254
254
  }
255
255
  const lastDatestamp = this.lastDatestamp;
256
256
  const freshenerResult = await __privateGet(this, _animFrameEffectiveTimestampStaleDropper).queue(Promise.all([
257
- this.model.playingInfoProp.get(),
257
+ this.model.playingInfo.get(),
258
258
  this.lastTimestampPromise,
259
- this.model.timeRangeProp.get(),
260
- this.model.tempoScaleProp.get(),
261
- this.model.currentMoveInfoProp.get()
259
+ this.model.timeRange.get(),
260
+ this.model.tempoScale.get(),
261
+ this.model.currentMoveInfo.get()
262
262
  ]));
263
263
  const [playingInfo, lastTimestamp, timeRange, tempoScale, currentMoveInfo] = freshenerResult;
264
264
  if (!playingInfo.playing) {
@@ -288,7 +288,7 @@ var TwistyAnimationController = class {
288
288
  newTimestamp = end;
289
289
  }
290
290
  this.playing = false;
291
- this.model.playingInfoProp.set({
291
+ this.model.playingInfo.set({
292
292
  playing: false
293
293
  });
294
294
  }
@@ -302,19 +302,19 @@ var TwistyAnimationController = class {
302
302
  newTimestamp = start;
303
303
  }
304
304
  this.playing = false;
305
- this.model.playingInfoProp.set({
305
+ this.model.playingInfo.set({
306
306
  playing: false
307
307
  });
308
308
  }
309
309
  }
310
310
  this.lastDatestamp = frameDatestamp;
311
311
  this.lastTimestampPromise = Promise.resolve(newTimestamp);
312
- this.model.timestampRequestProp.set(newSmartTimestampRequest ?? newTimestamp);
312
+ this.model.timestampRequest.set(newSmartTimestampRequest ?? newTimestamp);
313
313
  }
314
314
  };
315
315
  _effectiveTimestampMilliseconds = new WeakSet();
316
316
  effectiveTimestampMilliseconds_fn = async function() {
317
- return (await this.model.detailedTimelineInfoProp.get()).timestamp;
317
+ return (await this.model.detailedTimelineInfo.get()).timestamp;
318
318
  };
319
319
  _animFrameEffectiveTimestampStaleDropper = new WeakMap();
320
320
 
@@ -395,13 +395,15 @@ var ManagedCustomElement = class extends HTMLElementShim {
395
395
  this.shadow.appendChild(this.contentWrapper);
396
396
  }
397
397
  addCSS(cssSource) {
398
- if (__privateGet(this, _cssSourceMap).get(cssSource)) {
399
- return;
398
+ const existing = __privateGet(this, _cssSourceMap).get(cssSource);
399
+ if (existing) {
400
+ return existing;
400
401
  }
401
402
  const cssElem = document.createElement("style");
402
403
  cssElem.textContent = cssSource.getAsString();
403
404
  __privateGet(this, _cssSourceMap).set(cssSource, cssElem);
404
405
  this.shadow.appendChild(cssElem);
406
+ return cssElem;
405
407
  }
406
408
  removeCSS(cssSource) {
407
409
  const cssElem = __privateGet(this, _cssSourceMap).get(cssSource);
@@ -688,12 +690,12 @@ var Twisty2DPuzzle = class extends ManagedCustomElement {
688
690
  __privateAdd(this, _freshListenerManager, new FreshListenerManager());
689
691
  this.addCSS(twisty2DSVGCSS);
690
692
  this.resetSVG();
691
- __privateGet(this, _freshListenerManager).addListener(this.model.puzzleIDProp, (puzzleID) => {
693
+ __privateGet(this, _freshListenerManager).addListener(this.model.puzzleID, (puzzleID) => {
692
694
  if (puzzleLoader?.id !== puzzleID) {
693
695
  this.disconnect();
694
696
  }
695
697
  });
696
- __privateGet(this, _freshListenerManager).addListener(this.model.legacyPositionProp, this.onPositionChange.bind(this));
698
+ __privateGet(this, _freshListenerManager).addListener(this.model.legacyPosition, this.onPositionChange.bind(this));
697
699
  if (this.options?.experimentalStickering) {
698
700
  this.experimentalSetStickering(this.options.experimentalStickering);
699
701
  }
@@ -763,7 +765,7 @@ var Twisty2DPuzzleWrapper = class {
763
765
  __privateAdd(this, _freshListenerManager2, new FreshListenerManager());
764
766
  __privateAdd(this, _cachedTwisty2DPuzzle, null);
765
767
  this.twisty2DPuzzle();
766
- __privateGet(this, _freshListenerManager2).addListener(this.model.stickeringProp, async (stickering) => {
768
+ __privateGet(this, _freshListenerManager2).addListener(this.model.stickering, async (stickering) => {
767
769
  (await this.twisty2DPuzzle()).experimentalSetStickering(stickering);
768
770
  });
769
771
  }
@@ -799,7 +801,7 @@ var Twisty2DSceneWrapper = class extends ManagedCustomElement {
799
801
  async connectedCallback() {
800
802
  this.addCSS(twistyViewerWrapperCSS);
801
803
  if (this.model) {
802
- __privateGet(this, _freshListenerManager3).addListener(this.model.puzzleLoaderProp, this.onPuzzleLoader.bind(this));
804
+ __privateGet(this, _freshListenerManager3).addListener(this.model.puzzleLoader, this.onPuzzleLoader.bind(this));
803
805
  }
804
806
  }
805
807
  async scene() {
@@ -872,12 +874,12 @@ var Twisty3DPuzzleWrapper = class {
872
874
  __privateAdd(this, _freshListenerManager4, new FreshListenerManager());
873
875
  __privateAdd(this, _cachedTwisty3DPuzzle, null);
874
876
  this.twisty3DPuzzle();
875
- __privateGet(this, _freshListenerManager4).addListener(this.model.puzzleLoaderProp, (puzzleLoader2) => {
877
+ __privateGet(this, _freshListenerManager4).addListener(this.model.puzzleLoader, (puzzleLoader2) => {
876
878
  if (this.puzzleLoader.id !== puzzleLoader2.id) {
877
879
  this.disconnect();
878
880
  }
879
881
  });
880
- __privateGet(this, _freshListenerManager4).addListener(this.model.legacyPositionProp, async (position) => {
882
+ __privateGet(this, _freshListenerManager4).addListener(this.model.legacyPosition, async (position) => {
881
883
  try {
882
884
  (await this.twisty3DPuzzle()).onPositionChange(position);
883
885
  this.scheduleRender();
@@ -885,19 +887,19 @@ var Twisty3DPuzzleWrapper = class {
885
887
  this.disconnect();
886
888
  }
887
889
  });
888
- __privateGet(this, _freshListenerManager4).addListener(this.model.hintFaceletProp, async (hintFaceletStyle) => {
890
+ __privateGet(this, _freshListenerManager4).addListener(this.model.hintFacelet, async (hintFaceletStyle) => {
889
891
  (await this.twisty3DPuzzle()).experimentalUpdateOptions({
890
892
  hintFacelets: hintFaceletStyle === "auto" ? "floating" : hintFaceletStyle
891
893
  });
892
894
  this.scheduleRender();
893
895
  });
894
- __privateGet(this, _freshListenerManager4).addListener(this.model.foundationDisplayProp, async (foundationDisplay) => {
896
+ __privateGet(this, _freshListenerManager4).addListener(this.model.foundationDisplay, async (foundationDisplay) => {
895
897
  (await this.twisty3DPuzzle()).experimentalUpdateOptions({
896
898
  showFoundation: foundationDisplay !== "none"
897
899
  });
898
900
  this.scheduleRender();
899
901
  });
900
- __privateGet(this, _freshListenerManager4).addListener(this.model.stickeringProp, async (stickering) => {
902
+ __privateGet(this, _freshListenerManager4).addListener(this.model.stickering, async (stickering) => {
901
903
  if ("setStickering" in await this.twisty3DPuzzle()) {
902
904
  (await this.twisty3DPuzzle()).setStickering(stickering);
903
905
  this.scheduleRender();
@@ -941,7 +943,7 @@ var Twisty3DPuzzleWrapper = class {
941
943
  const [foundationSprite, hintSprite, experimentalStickering] = await Promise.all([
942
944
  this.model.foundationStickerSprite.get(),
943
945
  this.model.hintStickerSprite.get(),
944
- this.model.stickeringProp.get()
946
+ this.model.stickering.get()
945
947
  ]);
946
948
  return (await proxyPromise).cube3DShim({
947
949
  foundationSprite,
@@ -950,7 +952,7 @@ var Twisty3DPuzzleWrapper = class {
950
952
  });
951
953
  } else {
952
954
  const [hintFacelets, foundationSprite, hintSprite] = await Promise.all([
953
- this.model.hintFaceletProp.get(),
955
+ this.model.hintFacelet.get(),
954
956
  this.model.foundationStickerSprite.get(),
955
957
  this.model.hintStickerSprite.get()
956
958
  ]);
@@ -1322,8 +1324,8 @@ var TwistyOrbitControls = class {
1322
1324
  const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
1323
1325
  const temperedX = this.temperMovement(movementX / minDim);
1324
1326
  const temperedY = this.temperMovement(movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
1325
- this.model.orbitCoordinatesRequestProp.set((async () => {
1326
- const prevCoords = await this.model.orbitCoordinatesProp.get();
1327
+ this.model.orbitCoordinatesRequest.set((async () => {
1328
+ const prevCoords = await this.model.orbitCoordinates.get();
1327
1329
  const newCoords = {
1328
1330
  latitude: prevCoords.latitude + 2 * temperedY * DEGREES_PER_RADIAN * scale,
1329
1331
  longitude: prevCoords.longitude - 2 * temperedX * DEGREES_PER_RADIAN
@@ -1451,7 +1453,7 @@ var Twisty3DVantage = class extends ManagedCustomElement {
1451
1453
  return __privateGet(this, _cachedOrbitControls) ?? __privateSet(this, _cachedOrbitControls, (async () => {
1452
1454
  const orbitControls = new TwistyOrbitControls(this.model, !!this.options?.backView, (await this.canvasInfo()).canvas, await __privateMethod(this, _dragTracker, dragTracker_fn).call(this));
1453
1455
  if (this.model) {
1454
- this.addListener(this.model.orbitCoordinatesProp, async (orbitCoordinates) => {
1456
+ this.addListener(this.model.orbitCoordinates, async (orbitCoordinates) => {
1455
1457
  const camera = await this.camera();
1456
1458
  setCameraFromOrbitCoordinates(camera, orbitCoordinates, this.options?.backView);
1457
1459
  this.scheduleRender();
@@ -1497,7 +1499,7 @@ _setupBasicPresses = new WeakSet();
1497
1499
  setupBasicPresses_fn = async function() {
1498
1500
  const dragTracker = await __privateMethod(this, _dragTracker, dragTracker_fn).call(this);
1499
1501
  dragTracker.addEventListener("press", async (e) => {
1500
- const movePressInput = await this.model.movePressInputProp.get();
1502
+ const movePressInput = await this.model.movePressInput.get();
1501
1503
  if (movePressInput !== "basic") {
1502
1504
  return;
1503
1505
  }
@@ -1584,8 +1586,8 @@ var Twisty3DSceneWrapper = class extends ManagedCustomElement {
1584
1586
  const vantage = new Twisty3DVantage(this.model, this);
1585
1587
  this.addVantage(vantage);
1586
1588
  if (this.model) {
1587
- __privateGet(this, _freshListenerManager5).addMultiListener([this.model.puzzleLoaderProp, this.model.visualizationStrategyProp], this.onPuzzle.bind(this));
1588
- __privateGet(this, _freshListenerManager5).addListener(this.model.backViewProp, this.onBackView.bind(this));
1589
+ __privateGet(this, _freshListenerManager5).addMultiListener([this.model.puzzleLoader, this.model.visualizationStrategy], this.onPuzzle.bind(this));
1590
+ __privateGet(this, _freshListenerManager5).addListener(this.model.backView, this.onBackView.bind(this));
1589
1591
  }
1590
1592
  this.scheduleRender();
1591
1593
  }
@@ -1656,11 +1658,14 @@ var Twisty3DSceneWrapper = class extends ManagedCustomElement {
1656
1658
  }
1657
1659
  async setCurrentTwisty3DPuzzleWrapper(scene, twisty3DPuzzleWrapper) {
1658
1660
  const old = __privateGet(this, _currentTwisty3DPuzzleWrapper);
1659
- __privateSet(this, _currentTwisty3DPuzzleWrapper, twisty3DPuzzleWrapper);
1660
- old?.disconnect();
1661
- scene.add(await twisty3DPuzzleWrapper.twisty3DPuzzle());
1662
- if (old) {
1663
- scene.remove(await old.twisty3DPuzzle());
1661
+ try {
1662
+ __privateSet(this, _currentTwisty3DPuzzleWrapper, twisty3DPuzzleWrapper);
1663
+ old?.disconnect();
1664
+ scene.add(await twisty3DPuzzleWrapper.twisty3DPuzzle());
1665
+ } finally {
1666
+ if (old) {
1667
+ scene.remove(await old.twisty3DPuzzle());
1668
+ }
1664
1669
  }
1665
1670
  }
1666
1671
  async onPuzzle(inputs) {
@@ -1915,7 +1920,7 @@ var TwistyButtonsV2 = class extends ManagedCustomElement {
1915
1920
  this.addElement(button);
1916
1921
  }
1917
1922
  this.buttons = buttons;
1918
- this.model?.buttonAppearanceProp.addFreshListener(this.update.bind(this));
1923
+ this.model?.buttonAppearance.addFreshListener(this.update.bind(this));
1919
1924
  }
1920
1925
  async onFullscreenButton() {
1921
1926
  if (!this.fullscreenElement) {
@@ -2051,12 +2056,14 @@ input {
2051
2056
  var SLOW_DOWN_SCRUBBING = false;
2052
2057
  var isMouseDown = false;
2053
2058
  globalSafeDocument?.addEventListener("mousedown", function(event) {
2054
- if (event.which)
2059
+ if (event.which) {
2055
2060
  isMouseDown = true;
2061
+ }
2056
2062
  }, true);
2057
2063
  globalSafeDocument?.addEventListener("mouseup", function(event) {
2058
- if (event.which)
2064
+ if (event.which) {
2059
2065
  isMouseDown = false;
2066
+ }
2060
2067
  }, true);
2061
2068
  var y = 0;
2062
2069
  var clickNum = 0;
@@ -2095,7 +2102,7 @@ var TwistyScrubberV2 = class extends ManagedCustomElement {
2095
2102
  const elem = document.createElement("input");
2096
2103
  elem.type = "range";
2097
2104
  elem.disabled = true;
2098
- this.model?.detailedTimelineInfoProp.addFreshListener(this.onDetailedTimelineInfo.bind(this));
2105
+ this.model?.detailedTimelineInfo.addFreshListener(this.onDetailedTimelineInfo.bind(this));
2099
2106
  elem.addEventListener("input", this.onInput.bind(this));
2100
2107
  return elem;
2101
2108
  })());
@@ -2107,8 +2114,8 @@ var TwistyScrubberV2 = class extends ManagedCustomElement {
2107
2114
  const inputElem = await this.inputElem();
2108
2115
  await this.slowDown(e, inputElem);
2109
2116
  const value = parseInt(inputElem.value);
2110
- this.model?.playingInfoProp.set({ playing: false });
2111
- this.model?.timestampRequestProp.set(value);
2117
+ this.model?.playingInfo.set({ playing: false });
2118
+ this.model?.timestampRequest.set(value);
2112
2119
  }
2113
2120
  async slowDown(e, inputElem) {
2114
2121
  if (!SLOW_DOWN_SCRUBBING) {
@@ -2156,12 +2163,12 @@ async function screenshot(model, options) {
2156
2163
  })());
2157
2164
  const scene = new (await THREEJS).Scene();
2158
2165
  const twisty3DWrapper = new Twisty3DPuzzleWrapper(model, { scheduleRender: () => {
2159
- } }, await model.puzzleLoaderProp.get(), await model.visualizationStrategyProp.get());
2160
- await model.stickeringProp.get();
2166
+ } }, await model.puzzleLoader.get(), await model.visualizationStrategy.get());
2167
+ await model.stickering.get();
2161
2168
  await new Promise((resolve) => setTimeout(resolve, 1e3));
2162
- await model.legacyPositionProp.get();
2169
+ await model.legacyPosition.get();
2163
2170
  scene.add(await twisty3DWrapper.twisty3DPuzzle());
2164
- const orbitCoordinates = await model.orbitCoordinatesProp.get();
2171
+ const orbitCoordinates = await model.orbitCoordinates.get();
2165
2172
  await setCameraFromOrbitCoordinates(camera, orbitCoordinates);
2166
2173
  const renderer = new (await THREEJS).WebGLRenderer({
2167
2174
  antialias: true,
@@ -2180,8 +2187,8 @@ async function screenshot(model, options) {
2180
2187
  }
2181
2188
  async function getDefaultFilename(model) {
2182
2189
  const [puzzleID, algWithIssues] = await Promise.all([
2183
- model.puzzleIDProp.get(),
2184
- model.algProp.get()
2190
+ model.puzzleID.get(),
2191
+ model.alg.get()
2185
2192
  ]);
2186
2193
  return `[${puzzleID}]${algWithIssues.alg.experimentalNumUnits() === 0 ? "" : " " + algWithIssues.alg.toString()}`;
2187
2194
  }
@@ -2776,8 +2783,9 @@ var LocalSimulMoves = class extends TraversalUp {
2776
2783
  return [];
2777
2784
  }
2778
2785
  for (const unit of alg.units()) {
2779
- if (!unit.is(Move))
2786
+ if (!unit.is(Move)) {
2780
2787
  return this.traverseAlg(alg);
2788
+ }
2781
2789
  }
2782
2790
  const moves = Array.from(alg.units());
2783
2791
  let maxSimulDur = defaultDurationForAmount(moves[0].amount);
@@ -3433,10 +3441,13 @@ var IndexerConstructorProp = class extends TwistyPropDerived {
3433
3441
  };
3434
3442
 
3435
3443
  // src/cubing/twisty/model/props/puzzle/state/PuzzleAlgProp.ts
3444
+ var validate = true;
3436
3445
  var PuzzleAlgProp = class extends TwistyPropDerived {
3437
3446
  async derive(inputs) {
3438
3447
  try {
3439
- inputs.kpuzzle.algToTransformation(inputs.algWithIssues.alg);
3448
+ if (validate) {
3449
+ inputs.kpuzzle.algToTransformation(inputs.algWithIssues.alg);
3450
+ }
3440
3451
  return inputs.algWithIssues;
3441
3452
  } catch (e) {
3442
3453
  return {
@@ -3452,7 +3463,7 @@ var PuzzleAlgProp = class extends TwistyPropDerived {
3452
3463
  // src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts
3453
3464
  var AlgTransformationProp = class extends TwistyPropDerived {
3454
3465
  derive(input) {
3455
- return input.kpuzzle.algToTransformation(input.alg.alg);
3466
+ return input.kpuzzle.algToTransformation(input.setupAlg.alg);
3456
3467
  }
3457
3468
  };
3458
3469
 
@@ -3463,8 +3474,8 @@ var IndexerProp = class extends TwistyPropDerived {
3463
3474
  }
3464
3475
  };
3465
3476
 
3466
- // src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts
3467
- var AnchoredStartProp = class extends TwistyPropDerived {
3477
+ // src/cubing/twisty/model/props/puzzle/state/AnchorTransformationProp.ts
3478
+ var AnchorTransformationProp = class extends TwistyPropDerived {
3468
3479
  derive(inputs) {
3469
3480
  switch (inputs.setupAnchor) {
3470
3481
  case "start":
@@ -3707,123 +3718,135 @@ var FoundationDisplayProp = class extends SimpleTwistyPropSource {
3707
3718
  var TwistyPlayerModel = class {
3708
3719
  constructor() {
3709
3720
  this.userVisibleErrorTracker = new UserVisibleErrorTracker();
3710
- this.algProp = new AlgProp();
3711
- this.backgroundProp = new BackgroundProp();
3712
- this.backViewProp = new BackViewProp();
3713
- this.controlPanelProp = new ControlPanelProp();
3714
- this.catchUpMoveProp = new CatchUpMoveProp();
3715
- this.foundationDisplayProp = new FoundationDisplayProp();
3721
+ this.alg = new AlgProp();
3722
+ this.background = new BackgroundProp();
3723
+ this.backView = new BackViewProp();
3724
+ this.controlPanel = new ControlPanelProp();
3725
+ this.catchUpMove = new CatchUpMoveProp();
3726
+ this.foundationDisplay = new FoundationDisplayProp();
3716
3727
  this.foundationStickerSpriteURL = new URLProp();
3717
- this.hintFaceletProp = new HintFaceletProp();
3728
+ this.hintFacelet = new HintFaceletProp();
3718
3729
  this.hintStickerSpriteURL = new URLProp();
3719
- this.indexerConstructorRequestProp = new IndexerConstructorRequestProp();
3720
- this.latitudeLimitProp = new LatitudeLimitProp();
3721
- this.movePressInputProp = new MovePressInputProp();
3722
- this.orbitCoordinatesRequestProp = new OrbitCoordinatesRequestProp();
3723
- this.playingInfoProp = new PlayingInfoProp();
3724
- this.puzzleDescriptionRequestProp = new PGPuzzleDescriptionStringProp();
3725
- this.puzzleIDRequestProp = new PuzzleIDRequestProp();
3726
- this.setupAnchorProp = new SetupAnchorProp();
3727
- this.setupProp = new AlgProp();
3728
- this.stickeringProp = new StickeringProp();
3729
- this.tempoScaleProp = new TempoScaleProp();
3730
- this.timestampRequestProp = new TimestampRequestProp();
3731
- this.viewerLinkProp = new ViewerLinkProp();
3732
- this.visualizationFormatProp = new VisualizationFormatProp();
3730
+ this.indexerConstructorRequest = new IndexerConstructorRequestProp();
3731
+ this.latitudeLimit = new LatitudeLimitProp();
3732
+ this.movePressInput = new MovePressInputProp();
3733
+ this.orbitCoordinatesRequest = new OrbitCoordinatesRequestProp();
3734
+ this.playingInfo = new PlayingInfoProp();
3735
+ this.puzzleDescriptionRequest = new PGPuzzleDescriptionStringProp();
3736
+ this.puzzleIDRequest = new PuzzleIDRequestProp();
3737
+ this.setupAnchor = new SetupAnchorProp();
3738
+ this.setupAlg = new AlgProp();
3739
+ this.stickering = new StickeringProp();
3740
+ this.tempoScale = new TempoScaleProp();
3741
+ this.timestampRequest = new TimestampRequestProp();
3742
+ this.viewerLink = new ViewerLinkProp();
3743
+ this.visualizationFormat = new VisualizationFormatProp();
3733
3744
  this.foundationStickerSprite = new SpriteProp({
3734
3745
  spriteURL: this.foundationStickerSpriteURL
3735
3746
  });
3736
3747
  this.hintStickerSprite = new SpriteProp({
3737
3748
  spriteURL: this.hintStickerSpriteURL
3738
3749
  });
3739
- this.puzzleLoaderProp = new PuzzleLoaderProp({
3740
- puzzleIDRequest: this.puzzleIDRequestProp,
3741
- puzzleDescriptionRequest: this.puzzleDescriptionRequestProp
3750
+ this.puzzleLoader = new PuzzleLoaderProp({
3751
+ puzzleIDRequest: this.puzzleIDRequest,
3752
+ puzzleDescriptionRequest: this.puzzleDescriptionRequest
3742
3753
  }, this.userVisibleErrorTracker);
3743
- this.kpuzzleProp = new KPuzzleProp({ puzzleLoader: this.puzzleLoaderProp });
3744
- this.puzzleIDProp = new PuzzleIDProp({ puzzleLoader: this.puzzleLoaderProp });
3745
- this.puzzleAlgProp = new PuzzleAlgProp({
3746
- algWithIssues: this.algProp,
3747
- kpuzzle: this.kpuzzleProp
3754
+ this.kpuzzle = new KPuzzleProp({ puzzleLoader: this.puzzleLoader });
3755
+ this.puzzleID = new PuzzleIDProp({ puzzleLoader: this.puzzleLoader });
3756
+ this.puzzleAlg = new PuzzleAlgProp({
3757
+ algWithIssues: this.alg,
3758
+ kpuzzle: this.kpuzzle
3748
3759
  });
3749
- this.puzzleSetupProp = new PuzzleAlgProp({
3750
- algWithIssues: this.setupProp,
3751
- kpuzzle: this.kpuzzleProp
3760
+ this.puzzleSetupAlg = new PuzzleAlgProp({
3761
+ algWithIssues: this.setupAlg,
3762
+ kpuzzle: this.kpuzzle
3752
3763
  });
3753
- this.visualizationStrategyProp = new VisualizationStrategyProp({
3754
- visualizationRequest: this.visualizationFormatProp,
3755
- puzzleID: this.puzzleIDProp
3764
+ this.visualizationStrategy = new VisualizationStrategyProp({
3765
+ visualizationRequest: this.visualizationFormat,
3766
+ puzzleID: this.puzzleID
3756
3767
  });
3757
- this.indexerConstructorProp = new IndexerConstructorProp({
3758
- alg: this.algProp,
3759
- puzzle: this.puzzleIDProp,
3760
- visualizationStrategy: this.visualizationStrategyProp,
3761
- indexerConstructorRequest: this.indexerConstructorRequestProp
3768
+ this.indexerConstructor = new IndexerConstructorProp({
3769
+ alg: this.alg,
3770
+ puzzle: this.puzzleID,
3771
+ visualizationStrategy: this.visualizationStrategy,
3772
+ indexerConstructorRequest: this.indexerConstructorRequest
3762
3773
  });
3763
- this.moveCountProp = new NaiveMoveCountProp({ alg: this.puzzleAlgProp });
3764
- this.orbitCoordinatesProp = new OrbitCoordinatesProp({
3765
- orbitCoordinatesRequest: this.orbitCoordinatesRequestProp,
3766
- latitudeLimit: this.latitudeLimitProp,
3767
- puzzleID: this.puzzleIDProp,
3768
- strategy: this.visualizationStrategyProp
3774
+ this.moveCount = new NaiveMoveCountProp({ alg: this.puzzleAlg });
3775
+ this.orbitCoordinates = new OrbitCoordinatesProp({
3776
+ orbitCoordinatesRequest: this.orbitCoordinatesRequest,
3777
+ latitudeLimit: this.latitudeLimit,
3778
+ puzzleID: this.puzzleID,
3779
+ strategy: this.visualizationStrategy
3769
3780
  });
3770
- this.setupTransformationProp = new AlgTransformationProp({
3771
- alg: this.puzzleSetupProp,
3772
- kpuzzle: this.kpuzzleProp
3781
+ this.setupAlgTransformation = new AlgTransformationProp({
3782
+ setupAlg: this.puzzleSetupAlg,
3783
+ kpuzzle: this.kpuzzle
3773
3784
  });
3774
- this.indexerProp = new IndexerProp({
3775
- indexerConstructor: this.indexerConstructorProp,
3776
- algWithIssues: this.puzzleAlgProp,
3777
- kpuzzle: this.kpuzzleProp
3785
+ this.indexer = new IndexerProp({
3786
+ indexerConstructor: this.indexerConstructor,
3787
+ algWithIssues: this.puzzleAlg,
3788
+ kpuzzle: this.kpuzzle
3778
3789
  });
3779
- this.anchoredStartProp = new AnchoredStartProp({
3780
- setupAnchor: this.setupAnchorProp,
3781
- setupTransformation: this.setupTransformationProp,
3782
- indexer: this.indexerProp
3790
+ this.anchorTransformation = new AnchorTransformationProp({
3791
+ setupAnchor: this.setupAnchor,
3792
+ setupTransformation: this.setupAlgTransformation,
3793
+ indexer: this.indexer
3783
3794
  });
3784
- this.timeRangeProp = new TimeRangeProp({
3785
- indexer: this.indexerProp
3795
+ this.timeRange = new TimeRangeProp({
3796
+ indexer: this.indexer
3786
3797
  });
3787
- this.detailedTimelineInfoProp = new DetailedTimelineInfoProp({
3788
- timestampRequest: this.timestampRequestProp,
3789
- timeRange: this.timeRangeProp,
3790
- setupAnchor: this.setupAnchorProp
3798
+ this.detailedTimelineInfo = new DetailedTimelineInfoProp({
3799
+ timestampRequest: this.timestampRequest,
3800
+ timeRange: this.timeRange,
3801
+ setupAnchor: this.setupAnchor
3791
3802
  });
3792
- this.coarseTimelineInfoProp = new CoarseTimelineInfoProp({
3793
- detailedTimelineInfo: this.detailedTimelineInfoProp,
3794
- playingInfo: this.playingInfoProp
3803
+ this.coarseTimelineInfo = new CoarseTimelineInfoProp({
3804
+ detailedTimelineInfo: this.detailedTimelineInfo,
3805
+ playingInfo: this.playingInfo
3795
3806
  });
3796
- this.currentMoveInfoProp = new CurrentMoveInfoProp({
3797
- indexer: this.indexerProp,
3798
- detailedTimelineInfo: this.detailedTimelineInfoProp,
3799
- catchUpMove: this.catchUpMoveProp
3807
+ this.currentMoveInfo = new CurrentMoveInfoProp({
3808
+ indexer: this.indexer,
3809
+ detailedTimelineInfo: this.detailedTimelineInfo,
3810
+ catchUpMove: this.catchUpMove
3800
3811
  });
3801
- this.buttonAppearanceProp = new ButtonAppearanceProp({
3802
- coarseTimelineInfo: this.coarseTimelineInfoProp,
3803
- viewerLink: this.viewerLinkProp
3812
+ this.buttonAppearance = new ButtonAppearanceProp({
3813
+ coarseTimelineInfo: this.coarseTimelineInfo,
3814
+ viewerLink: this.viewerLink
3804
3815
  });
3805
- this.currentLeavesSimplifiedProp = new CurrentLeavesSimplifiedProp({
3806
- currentMoveInfo: this.currentMoveInfoProp
3816
+ this.currentLeavesSimplified = new CurrentLeavesSimplifiedProp({
3817
+ currentMoveInfo: this.currentMoveInfo
3807
3818
  });
3808
- this.currentStateProp = new CurrentStateProp({
3809
- anchoredStart: this.anchoredStartProp,
3810
- currentLeavesSimplified: this.currentLeavesSimplifiedProp,
3811
- indexer: this.indexerProp
3819
+ this.currentState = new CurrentStateProp({
3820
+ anchoredStart: this.anchorTransformation,
3821
+ currentLeavesSimplified: this.currentLeavesSimplified,
3822
+ indexer: this.indexer
3812
3823
  });
3813
- this.legacyPositionProp = new LegacyPositionProp({
3814
- currentMoveInfo: this.currentMoveInfoProp,
3815
- state: this.currentStateProp
3824
+ this.legacyPosition = new LegacyPositionProp({
3825
+ currentMoveInfo: this.currentMoveInfo,
3826
+ state: this.currentState
3816
3827
  });
3817
3828
  }
3818
3829
  async twizzleLink() {
3819
- const url = new URL("https://alpha.twizzle.net/edit/");
3820
- const [puzzle, alg, setup, anchor, experimentalStickering] = await Promise.all([
3821
- this.puzzleIDProp.get(),
3822
- this.algProp.get(),
3823
- this.setupProp.get(),
3824
- this.setupAnchorProp.get(),
3825
- this.stickeringProp.get()
3830
+ const [
3831
+ viewerLink,
3832
+ puzzleID,
3833
+ puzzleDescription,
3834
+ alg,
3835
+ setup,
3836
+ anchor,
3837
+ experimentalStickering
3838
+ ] = await Promise.all([
3839
+ this.viewerLink.get(),
3840
+ this.puzzleID.get(),
3841
+ this.puzzleDescriptionRequest.get(),
3842
+ this.alg.get(),
3843
+ this.setupAlg.get(),
3844
+ this.setupAnchor.get(),
3845
+ this.stickering.get()
3826
3846
  ]);
3847
+ const isExplorer = viewerLink === "experimental-twizzle-explorer";
3848
+ console.log({ isExplorer, viewerLink });
3849
+ const url = new URL(`https://alpha.twizzle.net/${isExplorer ? "explore" : "edit"}/`);
3827
3850
  if (!alg.alg.experimentalIsEmpty()) {
3828
3851
  url.searchParams.set("alg", alg.alg.toString());
3829
3852
  }
@@ -3836,27 +3859,33 @@ var TwistyPlayerModel = class {
3836
3859
  if (experimentalStickering !== "full") {
3837
3860
  url.searchParams.set("experimental-stickering", experimentalStickering);
3838
3861
  }
3839
- if (puzzle !== "3x3x3") {
3840
- url.searchParams.set("puzzle", puzzle);
3862
+ if (isExplorer && puzzleDescription !== NO_VALUE) {
3863
+ url.searchParams.set("puzzle-description", puzzleDescription);
3864
+ } else if (puzzleID !== "3x3x3") {
3865
+ url.searchParams.set("puzzle", puzzleID);
3841
3866
  }
3842
3867
  return url.toString();
3843
3868
  }
3844
3869
  experimentalAddMove(flexibleMove, options = {}) {
3845
3870
  const move = typeof flexibleMove === "string" ? new Move(flexibleMove) : flexibleMove;
3846
3871
  (async () => {
3847
- const alg = (await this.algProp.get()).alg;
3872
+ const alg = (await this.alg.get()).alg;
3848
3873
  const newAlg = experimentalAppendMove(alg, move, {
3849
3874
  coalesce: options?.coalesce,
3850
3875
  mod: options?.mod
3851
3876
  });
3852
- this.algProp.set(newAlg);
3853
- this.timestampRequestProp.set("end");
3854
- this.catchUpMoveProp.set({
3877
+ this.alg.set(newAlg);
3878
+ this.timestampRequest.set("end");
3879
+ this.catchUpMove.set({
3855
3880
  move,
3856
3881
  amount: 0
3857
3882
  });
3858
3883
  })();
3859
3884
  }
3885
+ get playingInfoProp() {
3886
+ console.warn("Using deprecated prop: `playingInfoProp`. Please switch to: `playingInfo`");
3887
+ return this.playingInfo;
3888
+ }
3860
3889
  };
3861
3890
 
3862
3891
  // src/cubing/twisty/views/TwistyPlayerSettable.ts
@@ -3870,121 +3899,121 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
3870
3899
  this.experimentalGet = new ExperimentalGetters(this.experimentalModel);
3871
3900
  }
3872
3901
  set alg(newAlg) {
3873
- this.experimentalModel.algProp.set(newAlg);
3902
+ this.experimentalModel.alg.set(newAlg);
3874
3903
  }
3875
3904
  get alg() {
3876
3905
  throw err("alg");
3877
3906
  }
3878
3907
  set experimentalSetupAlg(newSetup) {
3879
- this.experimentalModel.setupProp.set(newSetup);
3908
+ this.experimentalModel.setupAlg.set(newSetup);
3880
3909
  }
3881
3910
  get experimentalSetupAlg() {
3882
3911
  throw err("setup");
3883
3912
  }
3884
3913
  set experimentalSetupAnchor(anchor) {
3885
- this.experimentalModel.setupAnchorProp.set(anchor);
3914
+ this.experimentalModel.setupAnchor.set(anchor);
3886
3915
  }
3887
3916
  get experimentalSetupAnchor() {
3888
3917
  throw err("anchor");
3889
3918
  }
3890
3919
  set puzzle(puzzleID) {
3891
- this.experimentalModel.puzzleIDRequestProp.set(puzzleID);
3920
+ this.experimentalModel.puzzleIDRequest.set(puzzleID);
3892
3921
  }
3893
3922
  get puzzle() {
3894
3923
  throw err("puzzle");
3895
3924
  }
3896
3925
  set experimentalPuzzleDescription(puzzleDescription) {
3897
- this.experimentalModel.puzzleDescriptionRequestProp.set(puzzleDescription);
3926
+ this.experimentalModel.puzzleDescriptionRequest.set(puzzleDescription);
3898
3927
  }
3899
3928
  get experimentalPuzzleDescription() {
3900
3929
  throw err("experimentalPuzzleDescription");
3901
3930
  }
3902
3931
  set timestamp(timestamp) {
3903
- this.experimentalModel.timestampRequestProp.set(timestamp);
3932
+ this.experimentalModel.timestampRequest.set(timestamp);
3904
3933
  }
3905
3934
  get timestamp() {
3906
3935
  throw err("timestamp");
3907
3936
  }
3908
3937
  set hintFacelets(hintFaceletStyle) {
3909
- this.experimentalModel.hintFaceletProp.set(hintFaceletStyle);
3938
+ this.experimentalModel.hintFacelet.set(hintFaceletStyle);
3910
3939
  }
3911
3940
  get hintFacelets() {
3912
3941
  throw err("hintFacelets");
3913
3942
  }
3914
3943
  set experimentalStickering(stickering) {
3915
- this.experimentalModel.stickeringProp.set(stickering);
3944
+ this.experimentalModel.stickering.set(stickering);
3916
3945
  }
3917
3946
  get experimentalStickering() {
3918
3947
  throw err("stickering");
3919
3948
  }
3920
3949
  set backView(backView) {
3921
- this.experimentalModel.backViewProp.set(backView);
3950
+ this.experimentalModel.backView.set(backView);
3922
3951
  }
3923
3952
  get backView() {
3924
3953
  throw err("backView");
3925
3954
  }
3926
3955
  set background(backgroundTheme) {
3927
- this.experimentalModel.backgroundProp.set(backgroundTheme);
3956
+ this.experimentalModel.background.set(backgroundTheme);
3928
3957
  }
3929
3958
  get background() {
3930
3959
  throw err("background");
3931
3960
  }
3932
3961
  set controlPanel(newControlPanel) {
3933
- this.experimentalModel.controlPanelProp.set(newControlPanel);
3962
+ this.experimentalModel.controlPanel.set(newControlPanel);
3934
3963
  }
3935
3964
  get controlPanel() {
3936
3965
  throw err("controlPanel");
3937
3966
  }
3938
3967
  set visualization(visualizationFormat) {
3939
- this.experimentalModel.visualizationFormatProp.set(visualizationFormat);
3968
+ this.experimentalModel.visualizationFormat.set(visualizationFormat);
3940
3969
  }
3941
3970
  get visualization() {
3942
3971
  throw err("visualization");
3943
3972
  }
3944
3973
  set viewerLink(viewerLinkPage) {
3945
- this.experimentalModel.viewerLinkProp.set(viewerLinkPage);
3974
+ this.experimentalModel.viewerLink.set(viewerLinkPage);
3946
3975
  }
3947
3976
  get viewerLink() {
3948
3977
  throw err("viewerLink");
3949
3978
  }
3950
3979
  set experimentalMovePressInput(movePressInput) {
3951
- this.experimentalModel.movePressInputProp.set(movePressInput);
3980
+ this.experimentalModel.movePressInput.set(movePressInput);
3952
3981
  }
3953
3982
  get experimentalMovePressInput() {
3954
3983
  throw err("experimentalMovePressInput");
3955
3984
  }
3956
3985
  set cameraLatitude(latitude) {
3957
- this.experimentalModel.orbitCoordinatesRequestProp.set({ latitude });
3986
+ this.experimentalModel.orbitCoordinatesRequest.set({ latitude });
3958
3987
  }
3959
3988
  get cameraLatitude() {
3960
3989
  throw err("cameraLatitude");
3961
3990
  }
3962
3991
  set cameraLongitude(longitude) {
3963
- this.experimentalModel.orbitCoordinatesRequestProp.set({ longitude });
3992
+ this.experimentalModel.orbitCoordinatesRequest.set({ longitude });
3964
3993
  }
3965
3994
  get cameraLongitude() {
3966
3995
  throw err("cameraLongitude");
3967
3996
  }
3968
3997
  set cameraDistance(distance) {
3969
- this.experimentalModel.orbitCoordinatesRequestProp.set({ distance });
3998
+ this.experimentalModel.orbitCoordinatesRequest.set({ distance });
3970
3999
  }
3971
4000
  get cameraDistance() {
3972
4001
  throw err("cameraDistance");
3973
4002
  }
3974
4003
  set cameraLatitudeLimit(latitudeLimit) {
3975
- this.experimentalModel.latitudeLimitProp.set(latitudeLimit);
4004
+ this.experimentalModel.latitudeLimit.set(latitudeLimit);
3976
4005
  }
3977
4006
  get cameraLatitudeLimit() {
3978
4007
  throw err("cameraLatitudeLimit");
3979
4008
  }
3980
4009
  set indexer(indexer) {
3981
- this.experimentalModel.indexerConstructorRequestProp.set(indexer);
4010
+ this.experimentalModel.indexerConstructorRequest.set(indexer);
3982
4011
  }
3983
4012
  get indexer() {
3984
4013
  throw err("indexer");
3985
4014
  }
3986
4015
  set tempoScale(newTempoScale) {
3987
- this.experimentalModel.tempoScaleProp.set(newTempoScale);
4016
+ this.experimentalModel.tempoScale.set(newTempoScale);
3988
4017
  }
3989
4018
  get tempoScale() {
3990
4019
  throw err("tempoScale");
@@ -4007,16 +4036,16 @@ var ExperimentalGetters = class {
4007
4036
  this.model = model;
4008
4037
  }
4009
4038
  async alg() {
4010
- return (await this.model.algProp.get()).alg;
4039
+ return (await this.model.alg.get()).alg;
4011
4040
  }
4012
4041
  async setupAlg() {
4013
- return (await this.model.setupProp.get()).alg;
4042
+ return (await this.model.setupAlg.get()).alg;
4014
4043
  }
4015
4044
  puzzleID() {
4016
- return this.model.puzzleIDProp.get();
4045
+ return this.model.puzzleID.get();
4017
4046
  }
4018
4047
  async timestamp() {
4019
- return (await this.model.detailedTimelineInfoProp.get()).timestamp;
4048
+ return (await this.model.detailedTimelineInfo.get()).timestamp;
4020
4049
  }
4021
4050
  };
4022
4051
 
@@ -4086,14 +4115,14 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
4086
4115
  this.contentWrapper.appendChild(scrubber);
4087
4116
  this.buttons = new TwistyButtonsV2(this.experimentalModel, this.controller, this);
4088
4117
  this.contentWrapper.appendChild(this.buttons);
4089
- this.experimentalModel.backgroundProp.addFreshListener((backgroundTheme) => {
4118
+ this.experimentalModel.background.addFreshListener((backgroundTheme) => {
4090
4119
  this.contentWrapper.classList.toggle("checkered", backgroundTheme !== "none");
4091
4120
  });
4092
- this.experimentalModel.controlPanelProp.addFreshListener((controlPanel) => {
4121
+ this.experimentalModel.controlPanel.addFreshListener((controlPanel) => {
4093
4122
  __privateGet(this, _controlsManager).setValue(controlPanel);
4094
4123
  });
4095
- this.experimentalModel.visualizationStrategyProp.addFreshListener(__privateMethod(this, _setVisualizationWrapper, setVisualizationWrapper_fn).bind(this));
4096
- this.experimentalModel.puzzleIDProp.addFreshListener(this.flash.bind(this));
4124
+ this.experimentalModel.visualizationStrategy.addFreshListener(__privateMethod(this, _setVisualizationWrapper, setVisualizationWrapper_fn).bind(this));
4125
+ this.experimentalModel.puzzleID.addFreshListener(this.flash.bind(this));
4097
4126
  }
4098
4127
  flash() {
4099
4128
  __privateGet(this, _visualizationWrapper)?.animate([{ opacity: 0.25 }, { opacity: 1 }], {
@@ -4152,7 +4181,7 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
4152
4181
  return (await screenshot(this.experimentalModel, options)).dataURL;
4153
4182
  }
4154
4183
  async experimentalDownloadScreenshot(filename) {
4155
- if (["2D", "experimental-2D-LL"].includes(await this.experimentalModel.visualizationStrategyProp.get())) {
4184
+ if (["2D", "experimental-2D-LL"].includes(await this.experimentalModel.visualizationStrategy.get())) {
4156
4185
  const wrapper2D = __privateGet(this, _visualizationWrapper);
4157
4186
  const twisty2DPuzzle = await wrapper2D.currentTwisty2DPuzzleWrapper().twisty2DPuzzle();
4158
4187
  const str = new XMLSerializer().serializeToString(twisty2DPuzzle.svg.element);
@@ -4466,13 +4495,13 @@ var TwistyAlgViewer = class extends HTMLElementShim {
4466
4495
  return;
4467
4496
  }
4468
4497
  this.twistyPlayer = twistyPlayer;
4469
- this.twistyPlayer.experimentalModel.algProp.addFreshListener((algWithIssues) => {
4498
+ this.twistyPlayer.experimentalModel.alg.addFreshListener((algWithIssues) => {
4470
4499
  this.setAlg(algWithIssues.alg);
4471
4500
  });
4472
- const sourceAlg = (await this.twistyPlayer.experimentalModel.algProp.get()).alg;
4501
+ const sourceAlg = (await this.twistyPlayer.experimentalModel.alg.get()).alg;
4473
4502
  const parsedAlg = "startCharIndex" in sourceAlg ? sourceAlg : Alg.fromString(sourceAlg.toString());
4474
4503
  this.setAlg(parsedAlg);
4475
- twistyPlayer.experimentalModel.currentMoveInfoProp.addFreshListener((currentMoveInfo) => {
4504
+ twistyPlayer.experimentalModel.currentMoveInfo.addFreshListener((currentMoveInfo) => {
4476
4505
  let moveInfo = currentMoveInfo.currentMoves[0];
4477
4506
  moveInfo ?? (moveInfo = currentMoveInfo.movesStarting[0]);
4478
4507
  moveInfo ?? (moveInfo = currentMoveInfo.movesFinishing[0]);
@@ -4483,7 +4512,7 @@ var TwistyAlgViewer = class extends HTMLElementShim {
4483
4512
  this.highlighter.set(mainCurrentMove);
4484
4513
  }
4485
4514
  });
4486
- twistyPlayer.experimentalModel.detailedTimelineInfoProp.addFreshListener((detailedTimelineInfo) => {
4515
+ twistyPlayer.experimentalModel.detailedTimelineInfo.addFreshListener((detailedTimelineInfo) => {
4487
4516
  if (detailedTimelineInfo.timestamp !== this.lastClickTimestamp) {
4488
4517
  this.lastClickTimestamp = null;
4489
4518
  }
@@ -4494,11 +4523,11 @@ var TwistyAlgViewer = class extends HTMLElementShim {
4494
4523
  if (twistyPlayer) {
4495
4524
  twistyPlayer.pause();
4496
4525
  const timestampPromise = (async () => {
4497
- const indexer = await twistyPlayer.experimentalModel.indexerProp.get();
4526
+ const indexer = await twistyPlayer.experimentalModel.indexer.get();
4498
4527
  const offset = offsetIntoMove ? DEFAULT_OFFSET_MS : 0;
4499
4528
  return (indexer.indexToMoveStartTimestamp(index) ?? -offset) + offset;
4500
4529
  })();
4501
- twistyPlayer.experimentalModel.timestampRequestProp.set(await timestampPromise);
4530
+ twistyPlayer.experimentalModel.timestampRequest.set(await timestampPromise);
4502
4531
  if (this.lastClickTimestamp === await timestampPromise) {
4503
4532
  twistyPlayer.play();
4504
4533
  this.lastClickTimestamp = null;
@@ -4817,8 +4846,8 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
4817
4846
  if (options?.twistyPlayer) {
4818
4847
  this.twistyPlayer = options.twistyPlayer;
4819
4848
  }
4820
- __privateSet(this, _twistyPlayerProp, options?.twistyPlayerProp ?? "algProp");
4821
- if (options?.twistyPlayerProp === "algProp") {
4849
+ __privateSet(this, _twistyPlayerProp, options?.twistyPlayerProp ?? "alg");
4850
+ if (options?.twistyPlayerProp === "alg") {
4822
4851
  this.model.leafToHighlight.addFreshListener((highlightInfo) => {
4823
4852
  if (highlightInfo) {
4824
4853
  this.highlightLeaf(highlightInfo.leafInfo.leaf);
@@ -4847,7 +4876,7 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
4847
4876
  if (document.activeElement !== this || this.shadow.activeElement !== __privateGet(this, _textarea)) {
4848
4877
  return;
4849
4878
  }
4850
- if (__privateGet(this, _twistyPlayerProp) !== "algProp") {
4879
+ if (__privateGet(this, _twistyPlayerProp) !== "alg") {
4851
4880
  return;
4852
4881
  }
4853
4882
  const { selectionStart, selectionEnd } = __privateGet(this, _textarea);
@@ -4862,7 +4891,7 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
4862
4891
  __privateGet(this, _textareaClassListValidForPuzzleManager).setValue(issues);
4863
4892
  }
4864
4893
  highlightLeaf(leaf) {
4865
- if (__privateGet(this, _twistyPlayerProp) !== "algProp") {
4894
+ if (__privateGet(this, _twistyPlayerProp) !== "alg") {
4866
4895
  return;
4867
4896
  }
4868
4897
  if (leaf === null) {
@@ -4895,8 +4924,8 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
4895
4924
  (async () => {
4896
4925
  this.algString = __privateGet(this, _algProp, algProp_get) ? (await __privateGet(this, _algProp, algProp_get).get()).alg.toString() : "";
4897
4926
  })();
4898
- if (__privateGet(this, _twistyPlayerProp) === "algProp") {
4899
- __privateGet(this, _twistyPlayer)?.experimentalModel.puzzleAlgProp.addFreshListener((algWithIssues) => {
4927
+ if (__privateGet(this, _twistyPlayerProp) === "alg") {
4928
+ __privateGet(this, _twistyPlayer)?.experimentalModel.puzzleAlg.addFreshListener((algWithIssues) => {
4900
4929
  if (algWithIssues.issues.errors.length === 0) {
4901
4930
  this.setAlgIssueClassForPuzzle(algWithIssues.issues.warnings.length === 0 ? "none" : "warning");
4902
4931
  const newAlg = algWithIssues.alg;
@@ -4915,8 +4944,8 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
4915
4944
  return;
4916
4945
  }
4917
4946
  const [indexer, timestampRequest] = await Promise.all([
4918
- await twistyPlayer.experimentalModel.indexerProp.get(),
4919
- await twistyPlayer.experimentalModel.timestampRequestProp.get()
4947
+ await twistyPlayer.experimentalModel.indexer.get(),
4948
+ await twistyPlayer.experimentalModel.timestampRequest.get()
4920
4949
  ]);
4921
4950
  if (timestampRequest === "opposite-anchor" && !__privateGet(this, _onInputHasFired)) {
4922
4951
  return;
@@ -4941,11 +4970,11 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
4941
4970
  throw new Error("Invalid where!");
4942
4971
  }
4943
4972
  if (!this.debugNeverRequestTimestamp) {
4944
- twistyPlayer.experimentalModel.timestampRequestProp.set(newTimestamp);
4973
+ twistyPlayer.experimentalModel.timestampRequest.set(newTimestamp);
4945
4974
  }
4946
4975
  });
4947
- twistyPlayer.experimentalModel.currentLeavesSimplifiedProp.addFreshListener(async (currentLeavesSimplified) => {
4948
- const indexer = await twistyPlayer.experimentalModel.indexerProp.get();
4976
+ twistyPlayer.experimentalModel.currentLeavesSimplified.addFreshListener(async (currentLeavesSimplified) => {
4977
+ const indexer = await twistyPlayer.experimentalModel.indexer.get();
4949
4978
  const leaf = indexer.getAnimLeaf(currentLeavesSimplified.stateIndex);
4950
4979
  this.highlightLeaf(leaf);
4951
4980
  });
@@ -5009,6 +5038,175 @@ padSuffix_fn = function(s) {
5009
5038
  };
5010
5039
  _highlightedLeaf = new WeakMap();
5011
5040
  customElementsShim.define("twisty-alg-editor", TwistyAlgEditor);
5041
+
5042
+ // src/cubing/twisty/views/twizzle/TwizzleLink.css.ts
5043
+ var twizzleLinkCSS = new CSSSource(`
5044
+ .wrapper {
5045
+ background: rgb(255, 245, 235);
5046
+ display: grid;
5047
+ grid-template-columns: 1fr;
5048
+ border: 1px solid rgba(0, 0, 0, 0.25);
5049
+ }
5050
+
5051
+ .setup-alg, twisty-alg-viewer {
5052
+ padding: 0.5em 1em;
5053
+ }
5054
+
5055
+ .heading {
5056
+ background: rgba(255, 230, 210, 1);
5057
+ font-weight: bold;
5058
+ padding: 0.25em 0.5em;
5059
+ }
5060
+
5061
+ twisty-player {
5062
+ width: 100%;
5063
+ resize: vertical;
5064
+ overflow-y: hidden;
5065
+ }
5066
+
5067
+ twisty-player + .heading {
5068
+ padding-top: 0.5em;
5069
+ }
5070
+ `);
5071
+
5072
+ // src/cubing/twisty/views/twizzle/url-params.ts
5073
+ function updateURL(url) {
5074
+ window.history.replaceState("", "", url.toString());
5075
+ }
5076
+ var _prefix;
5077
+ var URLParamUpdater = class {
5078
+ constructor(model, options) {
5079
+ __privateAdd(this, _prefix, void 0);
5080
+ __privateSet(this, _prefix, options?.prefix ?? "");
5081
+ this.listenToAlgProp(model.alg, "alg");
5082
+ this.listenToAlgProp(model.setupAlg, "setup-alg");
5083
+ this.listenToStringSourceProp(model.stickering, "stickering");
5084
+ this.listenToStringSourceProp(model.setupAnchor, "setup-anchor");
5085
+ this.listenToStringOrNoValueProp(model.puzzleIDRequest, "puzzle", NO_VALUE);
5086
+ this.listenToStringOrNoValueProp(model.puzzleDescriptionRequest, "puzzle-description", NO_VALUE);
5087
+ }
5088
+ setURLParam(unprefixedKey, value, defaultString) {
5089
+ const prefixedKey = __privateGet(this, _prefix) + unprefixedKey;
5090
+ const url = new URL(location.href);
5091
+ if (value === defaultString) {
5092
+ url.searchParams.delete(prefixedKey);
5093
+ } else {
5094
+ url.searchParams.set(prefixedKey, value);
5095
+ }
5096
+ updateURL(url);
5097
+ }
5098
+ async listenToStringSourceProp(prop, key, defaultString) {
5099
+ const actualDefaultString = defaultString ?? await prop.getDefaultValue();
5100
+ prop.addFreshListener((s) => {
5101
+ this.setURLParam(key, s, actualDefaultString);
5102
+ });
5103
+ }
5104
+ async listenToStringOrNoValueProp(prop, key, defaultString) {
5105
+ prop.addFreshListener((s) => {
5106
+ if (s === NO_VALUE) {
5107
+ s = defaultString;
5108
+ }
5109
+ if (s === NO_VALUE) {
5110
+ this.setURLParam(key, "", "");
5111
+ } else {
5112
+ this.setURLParam(key, s, "");
5113
+ }
5114
+ });
5115
+ }
5116
+ listenToAlgProp(prop, key) {
5117
+ prop.addFreshListener((algWithIssues) => {
5118
+ this.setURLParam(key, algWithIssues.alg.toString(), "");
5119
+ });
5120
+ }
5121
+ };
5122
+ _prefix = new WeakMap();
5123
+ function getConfigFromURL(prefix = "", url = location.href) {
5124
+ const paramMapping = {
5125
+ "alg": "alg",
5126
+ "setup-alg": "experimental-setup-alg",
5127
+ "setup-anchor": "experimental-setup-anchor",
5128
+ "puzzle": "puzzle",
5129
+ "stickering": "experimental-stickering",
5130
+ "puzzle-description": "experimental-puzzle-description"
5131
+ };
5132
+ const params = new URL(url).searchParams;
5133
+ const config = {};
5134
+ for (const [ourParam, twistyPlayerParam] of Object.entries(paramMapping)) {
5135
+ const paramValue = params.get(prefix + ourParam);
5136
+ if (paramValue !== null) {
5137
+ const configKey = twistyPlayerAttributeMap[twistyPlayerParam];
5138
+ config[configKey] = paramValue;
5139
+ }
5140
+ }
5141
+ return config;
5142
+ }
5143
+
5144
+ // src/cubing/twisty/views/twizzle/TwizzleLink.ts
5145
+ var _cssElem;
5146
+ var TwizzleLink = class extends ManagedCustomElement {
5147
+ constructor() {
5148
+ super({ mode: "open" });
5149
+ this.twistyPlayer = null;
5150
+ this.a = null;
5151
+ __privateAdd(this, _cssElem, void 0);
5152
+ }
5153
+ fallback() {
5154
+ this.contentWrapper.textContent = "";
5155
+ if (this.a) {
5156
+ const span = this.contentWrapper.appendChild(document.createElement("span"));
5157
+ span.textContent = "\u2757\uFE0F";
5158
+ span.title = "Could not show a player for link";
5159
+ this.addElement(this.a);
5160
+ }
5161
+ if (__privateGet(this, _cssElem)) {
5162
+ __privateGet(this, _cssElem).remove();
5163
+ }
5164
+ }
5165
+ async connectedCallback() {
5166
+ __privateSet(this, _cssElem, this.addCSS(twizzleLinkCSS));
5167
+ this.a = this.querySelector("a");
5168
+ if (!this.a) {
5169
+ return;
5170
+ }
5171
+ const config = getConfigFromURL("", this.a.href);
5172
+ const href = this.a?.href;
5173
+ const { hostname, pathname } = new URL(href);
5174
+ if (hostname !== "alpha.twizzle.net") {
5175
+ this.fallback();
5176
+ return;
5177
+ }
5178
+ if (["/edit/", "/explore/"].includes(pathname)) {
5179
+ const isExplorer = pathname === "/explore/";
5180
+ if (config.puzzle && !(config.puzzle in puzzles)) {
5181
+ const puzzleDescription = (await import("../puzzle-geometry/index.js")).getPuzzleDescriptionString(config.puzzle);
5182
+ delete config.puzzle;
5183
+ config.experimentalPuzzleDescription = puzzleDescription;
5184
+ }
5185
+ this.twistyPlayer = this.addElement(new TwistyPlayer({
5186
+ ...config,
5187
+ viewerLink: isExplorer ? "experimental-twizzle-explorer" : "auto"
5188
+ }));
5189
+ if (config.experimentalSetupAlg) {
5190
+ this.addHeading("Setup");
5191
+ const setupAlgDiv = this.addElement(document.createElement("div"));
5192
+ setupAlgDiv.classList.add("setup-alg");
5193
+ setupAlgDiv.textContent = new Alg(config.experimentalSetupAlg).toString();
5194
+ }
5195
+ this.addHeading("Moves");
5196
+ const twistyAlgViewer = this.addElement(new TwistyAlgViewer({ twistyPlayer: this.twistyPlayer }));
5197
+ twistyAlgViewer.part.add("twisty-alg-viewer");
5198
+ } else {
5199
+ this.fallback();
5200
+ }
5201
+ }
5202
+ addHeading(text) {
5203
+ const headingDiv = this.addElement(document.createElement("div"));
5204
+ headingDiv.classList.add("heading");
5205
+ headingDiv.textContent = text;
5206
+ }
5207
+ };
5208
+ _cssElem = new WeakMap();
5209
+ customElementsShim.define("twizzle-link", TwizzleLink);
5012
5210
  export {
5013
5211
  NO_VALUE as EXPERIMENTAL_PROP_NO_VALUE,
5014
5212
  KPuzzleSVGWrapper as ExperimentalKPuzzleSVGWrapper,
@@ -5017,6 +5215,7 @@ export {
5017
5215
  TwistyAlgEditor,
5018
5216
  TwistyAlgViewer,
5019
5217
  TwistyPlayer,
5218
+ TwizzleLink,
5020
5219
  backViewLayouts,
5021
5220
  debugShowRenderStats as experimentalDebugShowRenderStats,
5022
5221
  experimentalForceNewRendererSharing