cubing 0.28.1 → 0.28.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 (98) hide show
  1. package/dist/esm/.DS_Store +0 -0
  2. package/dist/esm/alg/index.js +2 -2
  3. package/dist/esm/bluetooth/index.js +219 -83
  4. package/dist/esm/bluetooth/index.js.map +3 -3
  5. package/dist/esm/{chunk-F4WWCPVE.js → chunk-2IZUSAXQ.js} +2 -2
  6. package/dist/esm/{chunk-F4WWCPVE.js.map → chunk-2IZUSAXQ.js.map} +1 -1
  7. package/dist/esm/{chunk-ZY3RTFFS.js → chunk-5744RHHG.js} +143 -56
  8. package/dist/esm/{chunk-ZY3RTFFS.js.map → chunk-5744RHHG.js.map} +2 -2
  9. package/dist/esm/{chunk-WAL36PO3.js → chunk-76H7SSCY.js} +28 -12
  10. package/dist/esm/{chunk-WAL36PO3.js.map → chunk-76H7SSCY.js.map} +1 -1
  11. package/dist/esm/{chunk-LSVR2HCG.js → chunk-76UZ2QTB.js} +389 -363
  12. package/dist/esm/{chunk-LSVR2HCG.js.map → chunk-76UZ2QTB.js.map} +1 -1
  13. package/dist/esm/{chunk-YSVFZVG4.js → chunk-D4YYXJDB.js} +175 -72
  14. package/dist/esm/{chunk-YSVFZVG4.js.map → chunk-D4YYXJDB.js.map} +3 -3
  15. package/dist/esm/{chunk-NPHUBFZ6.js → chunk-FEIKQ7FV.js} +2 -2
  16. package/dist/esm/{chunk-NPHUBFZ6.js.map → chunk-FEIKQ7FV.js.map} +1 -1
  17. package/dist/esm/{chunk-7D7LW3WQ.js → chunk-LOTZ7ZO7.js} +8 -4
  18. package/dist/esm/{chunk-7D7LW3WQ.js.map → chunk-LOTZ7ZO7.js.map} +1 -1
  19. package/dist/esm/{chunk-GVPTO3OF.js → chunk-OX6O2ZO5.js} +1 -1
  20. package/dist/esm/{chunk-GVPTO3OF.js.map → chunk-OX6O2ZO5.js.map} +1 -1
  21. package/dist/esm/{chunk-CSBUJ64Q.js → chunk-PCR6JT2W.js} +373 -238
  22. package/dist/esm/chunk-PCR6JT2W.js.map +7 -0
  23. package/dist/esm/{chunk-32FWPPTW.js → chunk-PTUPP5AW.js} +22 -8
  24. package/dist/esm/{chunk-32FWPPTW.js.map → chunk-PTUPP5AW.js.map} +1 -1
  25. package/dist/esm/{chunk-MWKALF6W.js → chunk-RTFKKZPH.js} +21 -12
  26. package/dist/esm/{chunk-MWKALF6W.js.map → chunk-RTFKKZPH.js.map} +2 -2
  27. package/dist/esm/{chunk-MGJA5U5O.js → chunk-SBZRVSPK.js} +1 -12
  28. package/dist/esm/{chunk-MGJA5U5O.js.map → chunk-SBZRVSPK.js.map} +0 -0
  29. package/dist/esm/{chunk-67VJZGH2.js → chunk-TX2AQ4XW.js} +35 -13
  30. package/dist/esm/{chunk-67VJZGH2.js.map → chunk-TX2AQ4XW.js.map} +2 -2
  31. package/dist/esm/{chunk-V55YSWJY.js → chunk-WXCNEGW3.js} +10 -4
  32. package/dist/esm/{chunk-V55YSWJY.js.map → chunk-WXCNEGW3.js.map} +1 -1
  33. package/dist/esm/{chunk-ALBEW4DJ.js → chunk-ZB3P5AZN.js} +1 -1
  34. package/dist/esm/{chunk-ALBEW4DJ.js.map → chunk-ZB3P5AZN.js.map} +1 -1
  35. package/dist/esm/kpuzzle/index.js +3 -3
  36. package/dist/esm/notation/index.js +3 -3
  37. package/dist/esm/protocol/index.js +5 -5
  38. package/dist/esm/puzzle-geometry/index.js +271 -71
  39. package/dist/esm/puzzle-geometry/index.js.map +2 -2
  40. package/dist/esm/puzzles/index.js +5 -5
  41. package/dist/esm/{puzzles-dynamic-3x3x3-NB2PEZTV.js → puzzles-dynamic-3x3x3-KIG5A6QR.js} +2 -2
  42. package/dist/esm/{puzzles-dynamic-3x3x3-NB2PEZTV.js.map → puzzles-dynamic-3x3x3-KIG5A6QR.js.map} +0 -0
  43. package/dist/esm/puzzles-dynamic-4x4x4-PEDAPUZK.js +126 -0
  44. package/dist/esm/puzzles-dynamic-4x4x4-PEDAPUZK.js.map +7 -0
  45. package/dist/esm/{puzzles-dynamic-side-events-WZI4Y3N6.js → puzzles-dynamic-side-events-5C7LMBWX.js} +2 -2
  46. package/dist/esm/{puzzles-dynamic-side-events-WZI4Y3N6.js.map → puzzles-dynamic-side-events-5C7LMBWX.js.map} +0 -0
  47. package/dist/esm/{puzzles-dynamic-unofficial-FUG3JBMH.js → puzzles-dynamic-unofficial-WWJ4NJMX.js} +2 -2
  48. package/dist/esm/{puzzles-dynamic-unofficial-FUG3JBMH.js.map → puzzles-dynamic-unofficial-WWJ4NJMX.js.map} +0 -0
  49. package/dist/esm/scramble/index.js +5 -5
  50. package/dist/esm/search/index.js +10 -10
  51. package/dist/esm/{search-dynamic-sgs-side-events-R3HDJ5XQ.js → search-dynamic-sgs-side-events-X62KI7ZV.js} +35 -17
  52. package/dist/esm/{search-dynamic-sgs-side-events-R3HDJ5XQ.js.map → search-dynamic-sgs-side-events-X62KI7ZV.js.map} +2 -2
  53. package/dist/esm/{search-dynamic-sgs-unofficial-FQNKGHVO.js → search-dynamic-sgs-unofficial-YAPJYTMF.js} +35 -14
  54. package/dist/esm/{search-dynamic-sgs-unofficial-FQNKGHVO.js.map → search-dynamic-sgs-unofficial-YAPJYTMF.js.map} +2 -2
  55. package/dist/esm/{search-dynamic-solve-3x3x3-K42IWMQV.js → search-dynamic-solve-3x3x3-7XZTYQMO.js} +795 -142
  56. package/dist/esm/{search-dynamic-solve-3x3x3-K42IWMQV.js.map → search-dynamic-solve-3x3x3-7XZTYQMO.js.map} +1 -1
  57. package/dist/esm/{search-dynamic-solve-4x4x4-XRV4NBMQ.js → search-dynamic-solve-4x4x4-5HST67LZ.js} +135 -29
  58. package/dist/esm/{search-dynamic-solve-4x4x4-XRV4NBMQ.js.map → search-dynamic-solve-4x4x4-5HST67LZ.js.map} +1 -1
  59. package/dist/esm/{search-dynamic-solve-fto-O6UXF7EC.js → search-dynamic-solve-fto-4LI23P6K.js} +253 -69
  60. package/dist/esm/{search-dynamic-solve-fto-O6UXF7EC.js.map → search-dynamic-solve-fto-4LI23P6K.js.map} +2 -2
  61. package/dist/esm/{search-dynamic-solve-kilominx-G4MLGWNS.js → search-dynamic-solve-kilominx-PIS3T2P4.js} +32 -8
  62. package/dist/esm/{search-dynamic-solve-kilominx-G4MLGWNS.js.map → search-dynamic-solve-kilominx-PIS3T2P4.js.map} +2 -2
  63. package/dist/esm/{search-dynamic-solve-master_tetraminx-3RKD3IAN.js → search-dynamic-solve-master_tetraminx-UB32C7MM.js} +111 -42
  64. package/dist/esm/{search-dynamic-solve-master_tetraminx-3RKD3IAN.js.map → search-dynamic-solve-master_tetraminx-UB32C7MM.js.map} +2 -2
  65. package/dist/esm/{search-dynamic-solve-sq1-WIJEGVLP.js → search-dynamic-solve-sq1-HA72TYF2.js} +54 -9
  66. package/dist/esm/{search-dynamic-solve-sq1-WIJEGVLP.js.map → search-dynamic-solve-sq1-HA72TYF2.js.map} +2 -2
  67. package/dist/esm/{search-worker-inside-generated-string-IZCKWXUA.js → search-worker-inside-generated-string-HMA547DJ.js} +146 -28
  68. package/dist/esm/search-worker-inside-generated-string-HMA547DJ.js.map +7 -0
  69. package/dist/esm/{search-worker-js-entry-WBEKNBB7.js → search-worker-js-entry-3QMPUE4B.js} +147 -53
  70. package/dist/esm/{search-worker-js-entry-WBEKNBB7.js.map → search-worker-js-entry-3QMPUE4B.js.map} +2 -2
  71. package/dist/esm/{search-worker-ts-entry-XQWMEOC4.js → search-worker-ts-entry-3RHWJNVQ.js} +5 -5
  72. package/dist/esm/{search-worker-ts-entry-XQWMEOC4.js.map → search-worker-ts-entry-3RHWJNVQ.js.map} +1 -1
  73. package/dist/esm/stream/index.js +12 -8
  74. package/dist/esm/stream/index.js.map +1 -1
  75. package/dist/esm/twisty/index.js +1140 -746
  76. package/dist/esm/twisty/index.js.map +3 -3
  77. package/dist/esm/{twisty-dynamic-3d-QOX7IEXC.js → twisty-dynamic-3d-2KRJEHAN.js} +352 -175
  78. package/dist/esm/{twisty-dynamic-3d-QOX7IEXC.js.map → twisty-dynamic-3d-2KRJEHAN.js.map} +2 -2
  79. package/dist/types/{Alg-e2a80975.d.ts → Alg-137fb0d5.d.ts} +19 -16
  80. package/dist/types/{KState-a2f0e651.d.ts → KState-d5f04c9a.d.ts} +1 -1
  81. package/dist/types/{TwizzleLink-dcf51446.d.ts → TwizzleLink-43d94aca.d.ts} +46 -8
  82. package/dist/types/alg/index.d.ts +4 -4
  83. package/dist/types/bluetooth/index.d.ts +4 -4
  84. package/dist/types/{bluetooth-puzzle-3670a6a1.d.ts → bluetooth-puzzle-7e1a2576.d.ts} +9 -9
  85. package/dist/types/kpuzzle/index.d.ts +2 -2
  86. package/dist/types/notation/index.d.ts +1 -1
  87. package/dist/types/{outside-0ce1b145.d.ts → outside-f83e819a.d.ts} +2 -2
  88. package/dist/types/{parseAlg-db0dec6c.d.ts → parseAlg-a28f7568.d.ts} +1 -1
  89. package/dist/types/protocol/index.d.ts +2 -2
  90. package/dist/types/puzzle-geometry/index.d.ts +3 -3
  91. package/dist/types/puzzles/index.d.ts +5 -5
  92. package/dist/types/scramble/index.d.ts +3 -3
  93. package/dist/types/search/index.d.ts +3 -3
  94. package/dist/types/stream/index.d.ts +5 -5
  95. package/dist/types/twisty/index.d.ts +5 -5
  96. package/package.json +7 -4
  97. package/dist/esm/chunk-CSBUJ64Q.js.map +0 -7
  98. package/dist/esm/search-worker-inside-generated-string-IZCKWXUA.js.map +0 -7
@@ -1,13 +1,6 @@
1
1
  import {
2
2
  from
3
- } from "./chunk-GVPTO3OF.js";
4
- import {
5
- __privateAdd,
6
- __privateGet,
7
- __privateMethod,
8
- __privateSet,
9
- __privateWrapper
10
- } from "./chunk-MGJA5U5O.js";
3
+ } from "./chunk-OX6O2ZO5.js";
11
4
 
12
5
  // src/cubing/twisty/debug.ts
13
6
  var twistyDebugGlobals = {
@@ -24,41 +17,16 @@ function setTwistyDebug(options) {
24
17
  }
25
18
 
26
19
  // src/cubing/twisty/model/PromiseFreshener.ts
27
- var _latestAssignedIdx, _latestResolvedIdx;
28
- var PromiseFreshener = class {
29
- constructor() {
30
- __privateAdd(this, _latestAssignedIdx, 0);
31
- __privateAdd(this, _latestResolvedIdx, 0);
32
- }
33
- async queue(p) {
34
- const idx = ++__privateWrapper(this, _latestAssignedIdx)._;
35
- const result = await p;
36
- if (idx > __privateGet(this, _latestResolvedIdx)) {
37
- __privateSet(this, _latestResolvedIdx, idx);
38
- return {
39
- fresh: true,
40
- result
41
- };
42
- } else {
43
- return { fresh: false };
44
- }
45
- }
46
- };
47
- _latestAssignedIdx = new WeakMap();
48
- _latestResolvedIdx = new WeakMap();
49
- var _latestAssignedIdx2, _latestResolvedIdx2;
50
20
  var StaleDropper = class {
51
- constructor() {
52
- __privateAdd(this, _latestAssignedIdx2, 0);
53
- __privateAdd(this, _latestResolvedIdx2, 0);
54
- }
21
+ #latestAssignedIdx = 0;
22
+ #latestResolvedIdx = 0;
55
23
  queue(p) {
56
24
  return new Promise(async (resolve, reject) => {
57
25
  try {
58
- const idx = ++__privateWrapper(this, _latestAssignedIdx2)._;
26
+ const idx = ++this.#latestAssignedIdx;
59
27
  const result = await p;
60
- if (idx > __privateGet(this, _latestResolvedIdx2)) {
61
- __privateSet(this, _latestResolvedIdx2, idx);
28
+ if (idx > this.#latestResolvedIdx) {
29
+ this.#latestResolvedIdx = idx;
62
30
  resolve(result);
63
31
  }
64
32
  } catch (e) {
@@ -67,21 +35,16 @@ var StaleDropper = class {
67
35
  });
68
36
  }
69
37
  };
70
- _latestAssignedIdx2 = new WeakMap();
71
- _latestResolvedIdx2 = new WeakMap();
72
38
 
73
39
  // src/cubing/twisty/model/props/TwistyProp.ts
74
40
  var globalSourceGeneration = 0;
75
- var _children, _rawListeners, _scheduleRawDispatch, scheduleRawDispatch_fn, _rawDispatchPending, _dispatchRawListeners, dispatchRawListeners_fn, _freshListeners;
76
41
  var TwistyPropParent = class {
77
42
  constructor() {
78
- __privateAdd(this, _scheduleRawDispatch);
79
- __privateAdd(this, _dispatchRawListeners);
80
- __privateAdd(this, _children, /* @__PURE__ */ new Set());
43
+ this.#children = /* @__PURE__ */ new Set();
81
44
  this.lastSourceGeneration = 0;
82
- __privateAdd(this, _rawListeners, /* @__PURE__ */ new Set());
83
- __privateAdd(this, _rawDispatchPending, false);
84
- __privateAdd(this, _freshListeners, /* @__PURE__ */ new Map());
45
+ this.#rawListeners = /* @__PURE__ */ new Set();
46
+ this.#rawDispatchPending = false;
47
+ this.#freshListeners = /* @__PURE__ */ new Map();
85
48
  }
86
49
  canReuse(v1, v2) {
87
50
  return v1 === v2 || this.canReuseValue(v1, v2);
@@ -90,13 +53,14 @@ var TwistyPropParent = class {
90
53
  return false;
91
54
  }
92
55
  debugGetChildren() {
93
- return Array.from(__privateGet(this, _children).values());
56
+ return Array.from(this.#children.values());
94
57
  }
58
+ #children;
95
59
  addChild(child) {
96
- __privateGet(this, _children).add(child);
60
+ this.#children.add(child);
97
61
  }
98
62
  removeChild(child) {
99
- __privateGet(this, _children).delete(child);
63
+ this.#children.delete(child);
100
64
  }
101
65
  markStale(sourceEvent) {
102
66
  if (sourceEvent.detail.generation !== globalSourceGeneration) {
@@ -106,20 +70,38 @@ var TwistyPropParent = class {
106
70
  return;
107
71
  }
108
72
  this.lastSourceGeneration = sourceEvent.detail.generation;
109
- for (const child of __privateGet(this, _children)) {
73
+ for (const child of this.#children) {
110
74
  child.markStale(sourceEvent);
111
75
  }
112
- __privateMethod(this, _scheduleRawDispatch, scheduleRawDispatch_fn).call(this);
76
+ this.#scheduleRawDispatch();
113
77
  }
78
+ #rawListeners;
114
79
  addRawListener(listener, options) {
115
- __privateGet(this, _rawListeners).add(listener);
80
+ this.#rawListeners.add(listener);
116
81
  if (options?.initial) {
117
82
  listener();
118
83
  }
119
84
  }
120
85
  removeRawListener(listener) {
121
- __privateGet(this, _rawListeners).delete(listener);
86
+ this.#rawListeners.delete(listener);
87
+ }
88
+ #scheduleRawDispatch() {
89
+ if (!this.#rawDispatchPending) {
90
+ this.#rawDispatchPending = true;
91
+ setTimeout(() => this.#dispatchRawListeners(), 0);
92
+ }
122
93
  }
94
+ #rawDispatchPending;
95
+ #dispatchRawListeners() {
96
+ if (!this.#rawDispatchPending) {
97
+ throw new Error("Invalid dispatch state!");
98
+ }
99
+ for (const listener of this.#rawListeners) {
100
+ listener();
101
+ }
102
+ this.#rawDispatchPending = false;
103
+ }
104
+ #freshListeners;
123
105
  addFreshListener(listener) {
124
106
  const staleDropper = new StaleDropper();
125
107
  let lastResult = null;
@@ -131,142 +113,114 @@ var TwistyPropParent = class {
131
113
  lastResult = result;
132
114
  listener(result);
133
115
  };
134
- __privateGet(this, _freshListeners).set(listener, callback);
116
+ this.#freshListeners.set(listener, callback);
135
117
  this.addRawListener(callback, { initial: true });
136
118
  }
137
119
  removeFreshListener(listener) {
138
- this.removeRawListener(__privateGet(this, _freshListeners).get(listener));
139
- __privateGet(this, _freshListeners).delete(listener);
140
- }
141
- };
142
- _children = new WeakMap();
143
- _rawListeners = new WeakMap();
144
- _scheduleRawDispatch = new WeakSet();
145
- scheduleRawDispatch_fn = function() {
146
- if (!__privateGet(this, _rawDispatchPending)) {
147
- __privateSet(this, _rawDispatchPending, true);
148
- setTimeout(() => __privateMethod(this, _dispatchRawListeners, dispatchRawListeners_fn).call(this), 0);
120
+ this.removeRawListener(this.#freshListeners.get(listener));
121
+ this.#freshListeners.delete(listener);
149
122
  }
150
123
  };
151
- _rawDispatchPending = new WeakMap();
152
- _dispatchRawListeners = new WeakSet();
153
- dispatchRawListeners_fn = function() {
154
- if (!__privateGet(this, _rawDispatchPending)) {
155
- throw new Error("Invalid dispatch state!");
156
- }
157
- for (const listener of __privateGet(this, _rawListeners)) {
158
- listener();
159
- }
160
- __privateSet(this, _rawDispatchPending, false);
161
- };
162
- _freshListeners = new WeakMap();
163
- var _value;
164
124
  var TwistyPropSource = class extends TwistyPropParent {
125
+ #value;
165
126
  constructor(initialValue) {
166
127
  super();
167
- __privateAdd(this, _value, void 0);
168
- __privateSet(this, _value, from(() => this.getDefaultValue()));
128
+ this.#value = from(() => this.getDefaultValue());
169
129
  if (initialValue) {
170
- __privateSet(this, _value, this.deriveFromPromiseOrValue(initialValue, __privateGet(this, _value)));
130
+ this.#value = this.deriveFromPromiseOrValue(initialValue, this.#value);
171
131
  }
172
132
  }
173
133
  set(input) {
174
- __privateSet(this, _value, this.deriveFromPromiseOrValue(input, __privateGet(this, _value)));
134
+ this.#value = this.deriveFromPromiseOrValue(input, this.#value);
175
135
  const sourceEventDetail = {
176
136
  sourceProp: this,
177
- value: __privateGet(this, _value),
137
+ value: this.#value,
178
138
  generation: ++globalSourceGeneration
179
139
  };
180
- this.markStale(new CustomEvent("stale", {
181
- detail: sourceEventDetail
182
- }));
140
+ this.markStale(
141
+ new CustomEvent("stale", {
142
+ detail: sourceEventDetail
143
+ })
144
+ );
183
145
  }
184
146
  async get() {
185
- return __privateGet(this, _value);
147
+ return this.#value;
186
148
  }
187
149
  async deriveFromPromiseOrValue(input, oldValuePromise) {
188
150
  return this.derive(await input, oldValuePromise);
189
151
  }
190
152
  };
191
- _value = new WeakMap();
192
153
  var SimpleTwistyPropSource = class extends TwistyPropSource {
193
154
  derive(input) {
194
155
  return input;
195
156
  }
196
157
  };
197
158
  var NO_VALUE = Symbol("no value");
198
- var _parents, _cachedLastSuccessfulCalculation, _cachedLatestGenerationCalculation, _getParents, getParents_fn, _cacheDerive, cacheDerive_fn;
199
159
  var TwistyPropDerived = class extends TwistyPropParent {
200
160
  constructor(parents, userVisibleErrorTracker) {
201
161
  super();
202
162
  this.userVisibleErrorTracker = userVisibleErrorTracker;
203
- __privateAdd(this, _getParents);
204
- __privateAdd(this, _cacheDerive);
205
- __privateAdd(this, _parents, void 0);
206
- __privateAdd(this, _cachedLastSuccessfulCalculation, null);
207
- __privateAdd(this, _cachedLatestGenerationCalculation, null);
208
- __privateSet(this, _parents, parents);
163
+ this.#parents = parents;
209
164
  for (const parent of Object.values(parents)) {
210
165
  parent.addChild(this);
211
166
  }
212
167
  }
168
+ #parents;
169
+ #cachedLastSuccessfulCalculation = null;
170
+ #cachedLatestGenerationCalculation = null;
213
171
  async get() {
214
172
  const generation = this.lastSourceGeneration;
215
- if (__privateGet(this, _cachedLatestGenerationCalculation)?.generation === generation) {
216
- return __privateGet(this, _cachedLatestGenerationCalculation).output;
173
+ if (this.#cachedLatestGenerationCalculation?.generation === generation) {
174
+ return this.#cachedLatestGenerationCalculation.output;
217
175
  }
218
176
  const latestGenerationCalculation = {
219
177
  generation,
220
- output: __privateMethod(this, _cacheDerive, cacheDerive_fn).call(this, __privateMethod(this, _getParents, getParents_fn).call(this), generation, __privateGet(this, _cachedLastSuccessfulCalculation))
178
+ output: this.#cacheDerive(
179
+ this.#getParents(),
180
+ generation,
181
+ this.#cachedLastSuccessfulCalculation
182
+ )
221
183
  };
222
- __privateSet(this, _cachedLatestGenerationCalculation, latestGenerationCalculation);
184
+ this.#cachedLatestGenerationCalculation = latestGenerationCalculation;
223
185
  this.userVisibleErrorTracker?.reset();
224
186
  return latestGenerationCalculation.output;
225
187
  }
226
- };
227
- _parents = new WeakMap();
228
- _cachedLastSuccessfulCalculation = new WeakMap();
229
- _cachedLatestGenerationCalculation = new WeakMap();
230
- _getParents = new WeakSet();
231
- getParents_fn = async function() {
232
- const inputValuePromises = {};
233
- for (const [key, parent] of Object.entries(__privateGet(this, _parents))) {
234
- inputValuePromises[key] = parent.get();
235
- }
236
- const inputs = {};
237
- for (const key in __privateGet(this, _parents)) {
238
- inputs[key] = await inputValuePromises[key];
239
- }
240
- return inputs;
241
- };
242
- _cacheDerive = new WeakSet();
243
- cacheDerive_fn = async function(inputsPromise, generation, cachedLatestGenerationCalculation = null) {
244
- const inputs = await inputsPromise;
245
- const cache = (output) => {
246
- __privateSet(this, _cachedLastSuccessfulCalculation, {
247
- inputs,
248
- output: Promise.resolve(output),
249
- generation
250
- });
251
- return output;
252
- };
253
- if (!cachedLatestGenerationCalculation) {
254
- return cache(await this.derive(inputs));
255
- }
256
- const cachedInputs = cachedLatestGenerationCalculation.inputs;
257
- for (const key in __privateGet(this, _parents)) {
258
- const parent = __privateGet(this, _parents)[key];
259
- if (!parent.canReuse(inputs[key], cachedInputs[key])) {
188
+ async #getParents() {
189
+ const inputValuePromises = {};
190
+ for (const [key, parent] of Object.entries(this.#parents)) {
191
+ inputValuePromises[key] = parent.get();
192
+ }
193
+ const inputs = {};
194
+ for (const key in this.#parents) {
195
+ inputs[key] = await inputValuePromises[key];
196
+ }
197
+ return inputs;
198
+ }
199
+ async #cacheDerive(inputsPromise, generation, cachedLatestGenerationCalculation = null) {
200
+ const inputs = await inputsPromise;
201
+ const cache = (output) => {
202
+ this.#cachedLastSuccessfulCalculation = {
203
+ inputs,
204
+ output: Promise.resolve(output),
205
+ generation
206
+ };
207
+ return output;
208
+ };
209
+ if (!cachedLatestGenerationCalculation) {
260
210
  return cache(await this.derive(inputs));
261
211
  }
212
+ const cachedInputs = cachedLatestGenerationCalculation.inputs;
213
+ for (const key in this.#parents) {
214
+ const parent = this.#parents[key];
215
+ if (!parent.canReuse(inputs[key], cachedInputs[key])) {
216
+ return cache(await this.derive(inputs));
217
+ }
218
+ }
219
+ return cachedLatestGenerationCalculation.output;
262
220
  }
263
- return cachedLatestGenerationCalculation.output;
264
221
  };
265
- var _disconnectionFunctions;
266
222
  var FreshListenerManager = class {
267
- constructor() {
268
- __privateAdd(this, _disconnectionFunctions, []);
269
- }
223
+ #disconnectionFunctions = [];
270
224
  addListener(prop, listener) {
271
225
  let disconnected = false;
272
226
  const wrappedListener = (value) => {
@@ -276,7 +230,7 @@ var FreshListenerManager = class {
276
230
  listener(value);
277
231
  };
278
232
  prop.addFreshListener(wrappedListener);
279
- __privateGet(this, _disconnectionFunctions).push(() => {
233
+ this.#disconnectionFunctions.push(() => {
280
234
  prop.removeFreshListener(wrappedListener);
281
235
  disconnected = true;
282
236
  });
@@ -295,14 +249,16 @@ var FreshListenerManager = class {
295
249
  if (disconnected) {
296
250
  return;
297
251
  }
298
- const promises = props.map((prop) => prop.get());
252
+ const promises = props.map(
253
+ (prop) => prop.get()
254
+ );
299
255
  const values = await Promise.all(promises);
300
256
  listener(values);
301
257
  };
302
258
  for (const prop of props) {
303
259
  prop.addFreshListener(wrappedListener);
304
260
  }
305
- __privateGet(this, _disconnectionFunctions).push(() => {
261
+ this.#disconnectionFunctions.push(() => {
306
262
  for (const prop of props) {
307
263
  prop.removeFreshListener(wrappedListener);
308
264
  }
@@ -310,12 +266,11 @@ var FreshListenerManager = class {
310
266
  });
311
267
  }
312
268
  disconnect() {
313
- for (const disconnectionFunction of __privateGet(this, _disconnectionFunctions)) {
269
+ for (const disconnectionFunction of this.#disconnectionFunctions) {
314
270
  disconnectionFunction();
315
271
  }
316
272
  }
317
273
  };
318
- _disconnectionFunctions = new WeakMap();
319
274
 
320
275
  // src/cubing/twisty/controllers/RenderScheduler.ts
321
276
  var RenderScheduler = class {
@@ -388,34 +343,34 @@ var CSSSource = class {
388
343
  return this.sourceText;
389
344
  }
390
345
  };
391
- var _cssSourceMap;
392
346
  var ManagedCustomElement = class extends HTMLElementShim {
393
347
  constructor(options) {
394
348
  super();
395
- __privateAdd(this, _cssSourceMap, /* @__PURE__ */ new Map());
349
+ this.#cssSourceMap = /* @__PURE__ */ new Map();
396
350
  this.shadow = this.attachShadow({ mode: options?.mode ?? "closed" });
397
351
  this.contentWrapper = document.createElement("div");
398
352
  this.contentWrapper.classList.add("wrapper");
399
353
  this.shadow.appendChild(this.contentWrapper);
400
354
  }
355
+ #cssSourceMap;
401
356
  addCSS(cssSource) {
402
- const existing = __privateGet(this, _cssSourceMap).get(cssSource);
357
+ const existing = this.#cssSourceMap.get(cssSource);
403
358
  if (existing) {
404
359
  return existing;
405
360
  }
406
361
  const cssElem = document.createElement("style");
407
362
  cssElem.textContent = cssSource.getAsString();
408
- __privateGet(this, _cssSourceMap).set(cssSource, cssElem);
363
+ this.#cssSourceMap.set(cssSource, cssElem);
409
364
  this.shadow.appendChild(cssElem);
410
365
  return cssElem;
411
366
  }
412
367
  removeCSS(cssSource) {
413
- const cssElem = __privateGet(this, _cssSourceMap).get(cssSource);
368
+ const cssElem = this.#cssSourceMap.get(cssSource);
414
369
  if (!cssElem) {
415
370
  return;
416
371
  }
417
372
  this.shadow.removeChild(cssElem);
418
- __privateGet(this, _cssSourceMap).delete(cssSource);
373
+ this.#cssSourceMap.delete(cssSource);
419
374
  }
420
375
  addElement(element) {
421
376
  return this.contentWrapper.appendChild(element);
@@ -427,8 +382,10 @@ var ManagedCustomElement = class extends HTMLElementShim {
427
382
  return this.contentWrapper.removeChild(element);
428
383
  }
429
384
  };
430
- _cssSourceMap = new WeakMap();
431
- customElementsShim.define("twisty-managed-custom-element", ManagedCustomElement);
385
+ customElementsShim.define(
386
+ "twisty-managed-custom-element",
387
+ ManagedCustomElement
388
+ );
432
389
 
433
390
  // src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts
434
391
  var performance = globalThis.performance;
@@ -444,10 +401,14 @@ var Stats = class {
444
401
  this.memPanel = performance?.memory ? this.addPanel(new StatsPanel("MB", "#f08", "#201")) : null;
445
402
  this.REVISION = 16;
446
403
  this.dom.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";
447
- this.dom.addEventListener("click", (event) => {
448
- event.preventDefault();
449
- this.showPanel(++this.mode % this.dom.children.length);
450
- }, false);
404
+ this.dom.addEventListener(
405
+ "click",
406
+ (event) => {
407
+ event.preventDefault();
408
+ this.showPanel(++this.mode % this.dom.children.length);
409
+ },
410
+ false
411
+ );
451
412
  this.showPanel(0);
452
413
  }
453
414
  addPanel(panel) {
@@ -473,7 +434,10 @@ var Stats = class {
473
434
  this.frames = 0;
474
435
  if (this.memPanel) {
475
436
  const memory = performance.memory;
476
- this.memPanel.update(memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576);
437
+ this.memPanel.update(
438
+ memory.usedJSHeapSize / 1048576,
439
+ memory.jsHeapSizeLimit / 1048576
440
+ );
477
441
  }
478
442
  }
479
443
  return time;
@@ -521,21 +485,47 @@ var StatsPanel = class {
521
485
  this.context.globalAlpha = 1;
522
486
  this.context.fillRect(0, 0, WIDTH, GRAPH_Y);
523
487
  this.context.fillStyle = this.fg;
524
- this.context.fillText(Math.round(value) + " " + this.name + " (" + Math.round(this.min) + "-" + Math.round(this.max) + ")", TEXT_X, TEXT_Y);
525
- this.context.drawImage(this.dom, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT);
526
- this.context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT);
488
+ this.context.fillText(
489
+ Math.round(value) + " " + this.name + " (" + Math.round(this.min) + "-" + Math.round(this.max) + ")",
490
+ TEXT_X,
491
+ TEXT_Y
492
+ );
493
+ this.context.drawImage(
494
+ this.dom,
495
+ GRAPH_X + PR,
496
+ GRAPH_Y,
497
+ GRAPH_WIDTH - PR,
498
+ GRAPH_HEIGHT,
499
+ GRAPH_X,
500
+ GRAPH_Y,
501
+ GRAPH_WIDTH - PR,
502
+ GRAPH_HEIGHT
503
+ );
504
+ this.context.fillRect(
505
+ GRAPH_X + GRAPH_WIDTH - PR,
506
+ GRAPH_Y,
507
+ PR,
508
+ GRAPH_HEIGHT
509
+ );
527
510
  this.context.fillStyle = this.bg;
528
511
  this.context.globalAlpha = 0.9;
529
- this.context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, Math.round((1 - value / maxValue) * GRAPH_HEIGHT));
512
+ this.context.fillRect(
513
+ GRAPH_X + GRAPH_WIDTH - PR,
514
+ GRAPH_Y,
515
+ PR,
516
+ Math.round((1 - value / maxValue) * GRAPH_HEIGHT)
517
+ );
530
518
  }
531
519
  };
532
520
 
533
521
  // src/cubing/twisty/heavy-code-imports/3d.ts
534
522
  var cachedConstructorProxy = null;
535
523
  async function proxy3D() {
536
- return cachedConstructorProxy ?? (cachedConstructorProxy = import("./twisty-dynamic-3d-QOX7IEXC.js"));
524
+ return cachedConstructorProxy ?? (cachedConstructorProxy = import("./twisty-dynamic-3d-2KRJEHAN.js"));
537
525
  }
538
- var THREEJS = from(async () => (await proxy3D()).T3I);
526
+ var THREEJS = from(
527
+ async () => (await proxy3D()).T3I
528
+ );
539
529
 
540
530
  // src/cubing/twisty/views/canvas.ts
541
531
  var globalPixelRatioOverride = null;
@@ -608,18 +598,12 @@ var twisty3DVantageCSS = new CSSSource(`
608
598
 
609
599
  // src/cubing/twisty/views/3D/DragTracker.ts
610
600
  var MOVEMENT_EPSILON = 0.1;
611
- var _dragInfoMap, _targetListeners, _lazyListenersRegistered, _registerLazyListeners, registerLazyListeners_fn, _clear, clear_fn, _trackDrag, trackDrag_fn;
612
601
  var DragTracker = class extends EventTarget {
613
602
  constructor(target) {
614
603
  super();
615
604
  this.target = target;
616
- __privateAdd(this, _registerLazyListeners);
617
- __privateAdd(this, _clear);
618
- __privateAdd(this, _trackDrag);
619
- __privateAdd(this, _dragInfoMap, /* @__PURE__ */ new Map());
620
- __privateAdd(this, _targetListeners, /* @__PURE__ */ new Map());
621
- __privateAdd(this, _lazyListenersRegistered, false);
622
605
  }
606
+ #dragInfoMap = /* @__PURE__ */ new Map();
623
607
  start() {
624
608
  this.addTargetListener("pointerdown", this.onPointerDown.bind(this));
625
609
  this.addTargetListener("contextmenu", (e) => {
@@ -629,20 +613,64 @@ var DragTracker = class extends EventTarget {
629
613
  this.addTargetListener("dblclick", (e) => e.preventDefault());
630
614
  }
631
615
  stop() {
632
- for (const [eventType, listener] of __privateGet(this, _targetListeners).entries()) {
616
+ for (const [eventType, listener] of this.#targetListeners.entries()) {
633
617
  this.target.removeEventListener(eventType, listener);
634
618
  }
635
- __privateGet(this, _targetListeners).clear();
636
- __privateSet(this, _lazyListenersRegistered, false);
619
+ this.#targetListeners.clear();
620
+ this.#lazyListenersRegistered = false;
637
621
  }
622
+ #targetListeners = /* @__PURE__ */ new Map();
638
623
  addTargetListener(eventType, listener) {
639
- if (!__privateGet(this, _targetListeners).has(eventType)) {
624
+ if (!this.#targetListeners.has(eventType)) {
640
625
  this.target.addEventListener(eventType, listener);
641
- __privateGet(this, _targetListeners).set(eventType, listener);
626
+ this.#targetListeners.set(eventType, listener);
627
+ }
628
+ }
629
+ #lazyListenersRegistered = false;
630
+ #registerLazyListeners() {
631
+ if (this.#lazyListenersRegistered) {
632
+ return;
633
+ }
634
+ this.addTargetListener("pointermove", this.onPointerMove.bind(this));
635
+ this.addTargetListener("pointerup", this.onPointerUp.bind(this));
636
+ this.#lazyListenersRegistered = true;
637
+ }
638
+ #clear(e) {
639
+ this.#dragInfoMap.delete(e.pointerId);
640
+ }
641
+ #trackDrag(e) {
642
+ const existing = this.#dragInfoMap.get(e.pointerId);
643
+ if (!existing) {
644
+ return { movementInfo: null, hasMoved: false };
645
+ }
646
+ let movementInfo;
647
+ if ((e.movementX ?? 0) !== 0 || (e.movementY ?? 0) !== 0) {
648
+ movementInfo = {
649
+ attachedInfo: existing.attachedInfo,
650
+ movementX: e.movementX,
651
+ movementY: e.movementY,
652
+ elapsedMs: e.timeStamp - existing.lastTimeStamp
653
+ };
654
+ } else {
655
+ movementInfo = {
656
+ attachedInfo: existing.attachedInfo,
657
+ movementX: e.clientX - existing.lastClientX,
658
+ movementY: e.clientY - existing.lastClientY,
659
+ elapsedMs: e.timeStamp - existing.lastTimeStamp
660
+ };
661
+ }
662
+ existing.lastClientX = e.clientX;
663
+ existing.lastClientY = e.clientY;
664
+ existing.lastTimeStamp = e.timeStamp;
665
+ if (Math.abs(movementInfo.movementX) < MOVEMENT_EPSILON && Math.abs(movementInfo.movementY) < MOVEMENT_EPSILON) {
666
+ return { movementInfo: null, hasMoved: existing.hasMoved };
667
+ } else {
668
+ existing.hasMoved = true;
669
+ return { movementInfo, hasMoved: existing.hasMoved };
642
670
  }
643
671
  }
644
672
  onPointerDown(e) {
645
- __privateMethod(this, _registerLazyListeners, registerLazyListeners_fn).call(this);
673
+ this.#registerLazyListeners();
646
674
  const newDragInfo = {
647
675
  attachedInfo: {},
648
676
  hasMoved: false,
@@ -650,22 +678,24 @@ var DragTracker = class extends EventTarget {
650
678
  lastClientY: e.clientY,
651
679
  lastTimeStamp: e.timeStamp
652
680
  };
653
- __privateGet(this, _dragInfoMap).set(e.pointerId, newDragInfo);
681
+ this.#dragInfoMap.set(e.pointerId, newDragInfo);
654
682
  this.target.setPointerCapture(e.pointerId);
655
683
  }
656
684
  onPointerMove(e) {
657
- const movementInfo = __privateMethod(this, _trackDrag, trackDrag_fn).call(this, e).movementInfo;
685
+ const movementInfo = this.#trackDrag(e).movementInfo;
658
686
  if (movementInfo) {
659
687
  e.preventDefault();
660
- this.dispatchEvent(new CustomEvent("move", {
661
- detail: movementInfo
662
- }));
688
+ this.dispatchEvent(
689
+ new CustomEvent("move", {
690
+ detail: movementInfo
691
+ })
692
+ );
663
693
  }
664
694
  }
665
695
  onPointerUp(e) {
666
- const trackDragResult = __privateMethod(this, _trackDrag, trackDrag_fn).call(this, e);
667
- const existing = __privateGet(this, _dragInfoMap).get(e.pointerId);
668
- __privateMethod(this, _clear, clear_fn).call(this, e);
696
+ const trackDragResult = this.#trackDrag(e);
697
+ const existing = this.#dragInfoMap.get(e.pointerId);
698
+ this.#clear(e);
669
699
  this.target.releasePointerCapture(e.pointerId);
670
700
  let event;
671
701
  if (trackDragResult.hasMoved) {
@@ -690,54 +720,6 @@ var DragTracker = class extends EventTarget {
690
720
  this.dispatchEvent(event);
691
721
  }
692
722
  };
693
- _dragInfoMap = new WeakMap();
694
- _targetListeners = new WeakMap();
695
- _lazyListenersRegistered = new WeakMap();
696
- _registerLazyListeners = new WeakSet();
697
- registerLazyListeners_fn = function() {
698
- if (__privateGet(this, _lazyListenersRegistered)) {
699
- return;
700
- }
701
- this.addTargetListener("pointermove", this.onPointerMove.bind(this));
702
- this.addTargetListener("pointerup", this.onPointerUp.bind(this));
703
- __privateSet(this, _lazyListenersRegistered, true);
704
- };
705
- _clear = new WeakSet();
706
- clear_fn = function(e) {
707
- __privateGet(this, _dragInfoMap).delete(e.pointerId);
708
- };
709
- _trackDrag = new WeakSet();
710
- trackDrag_fn = function(e) {
711
- const existing = __privateGet(this, _dragInfoMap).get(e.pointerId);
712
- if (!existing) {
713
- return { movementInfo: null, hasMoved: false };
714
- }
715
- let movementInfo;
716
- if ((e.movementX ?? 0) !== 0 || (e.movementY ?? 0) !== 0) {
717
- movementInfo = {
718
- attachedInfo: existing.attachedInfo,
719
- movementX: e.movementX,
720
- movementY: e.movementY,
721
- elapsedMs: e.timeStamp - existing.lastTimeStamp
722
- };
723
- } else {
724
- movementInfo = {
725
- attachedInfo: existing.attachedInfo,
726
- movementX: e.clientX - existing.lastClientX,
727
- movementY: e.clientY - existing.lastClientY,
728
- elapsedMs: e.timeStamp - existing.lastTimeStamp
729
- };
730
- }
731
- existing.lastClientX = e.clientX;
732
- existing.lastClientY = e.clientY;
733
- existing.lastTimeStamp = e.timeStamp;
734
- if (Math.abs(movementInfo.movementX) < MOVEMENT_EPSILON && Math.abs(movementInfo.movementY) < MOVEMENT_EPSILON) {
735
- return { movementInfo: null, hasMoved: existing.hasMoved };
736
- } else {
737
- existing.hasMoved = true;
738
- return { movementInfo, hasMoved: existing.hasMoved };
739
- }
740
- };
741
723
 
742
724
  // src/cubing/twisty/views/3D/RendererPool.ts
743
725
  var renderers = [];
@@ -785,7 +767,10 @@ var Inertia = class {
785
767
  }
786
768
  render(now) {
787
769
  const progressBefore = (this.lastTimestamp - this.startTimestamp) / INERTIA_DURATION_MS;
788
- const progressAfter = Math.min(1, (now - this.startTimestamp) / INERTIA_DURATION_MS);
770
+ const progressAfter = Math.min(
771
+ 1,
772
+ (now - this.startTimestamp) / INERTIA_DURATION_MS
773
+ );
789
774
  if (progressBefore === 0 && progressAfter > INERTIA_TIMEOUT_MS / INERTIA_DURATION_MS) {
790
775
  return;
791
776
  }
@@ -815,7 +800,10 @@ var TwistyOrbitControls = class {
815
800
  onMove(e) {
816
801
  var _a;
817
802
  (_a = e.detail).attachedInfo ?? (_a.attachedInfo = {});
818
- const { temperedX, temperedY } = this.onMovement(e.detail.movementX, e.detail.movementY);
803
+ const { temperedX, temperedY } = this.onMovement(
804
+ e.detail.movementX,
805
+ e.detail.movementY
806
+ );
819
807
  const attachedInfo = e.detail.attachedInfo;
820
808
  attachedInfo.lastTemperedX = temperedX * 10;
821
809
  attachedInfo.lastTemperedY = temperedY * 10;
@@ -825,28 +813,41 @@ var TwistyOrbitControls = class {
825
813
  const scale = this.mirror ? -1 : 1;
826
814
  const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
827
815
  const temperedX = this.temperMovement(movementX / minDim);
828
- const temperedY = this.temperMovement(movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
829
- this.model.twistySceneModel.orbitCoordinatesRequest.set((async () => {
830
- const prevCoords = await this.model.twistySceneModel.orbitCoordinates.get();
831
- const newCoords = {
832
- latitude: prevCoords.latitude + 2 * temperedY * DEGREES_PER_RADIAN * scale,
833
- longitude: prevCoords.longitude - 2 * temperedX * DEGREES_PER_RADIAN
834
- };
835
- return newCoords;
836
- })());
816
+ const temperedY = this.temperMovement(
817
+ movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE
818
+ );
819
+ this.model.twistySceneModel.orbitCoordinatesRequest.set(
820
+ (async () => {
821
+ const prevCoords = await this.model.twistySceneModel.orbitCoordinates.get();
822
+ const newCoords = {
823
+ latitude: prevCoords.latitude + 2 * temperedY * DEGREES_PER_RADIAN * scale,
824
+ longitude: prevCoords.longitude - 2 * temperedX * DEGREES_PER_RADIAN
825
+ };
826
+ return newCoords;
827
+ })()
828
+ );
837
829
  return { temperedX, temperedY };
838
830
  }
839
831
  onUp(e) {
840
832
  e.preventDefault();
841
833
  if ("lastTemperedX" in e.detail.attachedInfo && "lastTemperedY" in e.detail.attachedInfo && "timestamp" in e.detail.attachedInfo && e.timeStamp - e.detail.attachedInfo.timestamp < 60) {
842
- new Inertia(e.timeStamp, e.detail.attachedInfo.lastTemperedX, e.detail.attachedInfo.lastTemperedY, this.onMovementBound);
834
+ new Inertia(
835
+ e.timeStamp,
836
+ e.detail.attachedInfo.lastTemperedX,
837
+ e.detail.attachedInfo.lastTemperedY,
838
+ this.onMovementBound
839
+ );
843
840
  }
844
841
  }
845
842
  };
846
843
 
847
844
  // src/cubing/twisty/views/3D/Twisty3DVantage.ts
848
845
  async function setCameraFromOrbitCoordinates(camera, orbitCoordinates, backView = false) {
849
- const spherical = new (await THREEJS).Spherical(orbitCoordinates.distance, (90 - (backView ? -1 : 1) * orbitCoordinates.latitude) / DEGREES_PER_RADIAN, ((backView ? 180 : 0) + orbitCoordinates.longitude) / DEGREES_PER_RADIAN);
846
+ const spherical = new (await THREEJS).Spherical(
847
+ orbitCoordinates.distance,
848
+ (90 - (backView ? -1 : 1) * orbitCoordinates.latitude) / DEGREES_PER_RADIAN,
849
+ ((backView ? 180 : 0) + orbitCoordinates.longitude) / DEGREES_PER_RADIAN
850
+ );
850
851
  spherical.makeSafe();
851
852
  camera.position.setFromSpherical(spherical);
852
853
  camera.lookAt(0, 0, 0);
@@ -872,30 +873,26 @@ function shareRenderer() {
872
873
  function haveStartedSharingRenderers() {
873
874
  return sharingRenderers;
874
875
  }
875
- var _setupBasicPresses, setupBasicPresses_fn, _onResizeStaleDropper, _width, _height, _onResize, onResize_fn, _cachedRenderer, _cachedCanvas, _cachedDragTracker, _dragTracker, dragTracker_fn, _cachedCamera, _cachedOrbitControls, _disconnectionFunctions2, _experimentalNextRenderFinishedCallback, _scheduler;
876
876
  var Twisty3DVantage = class extends ManagedCustomElement {
877
877
  constructor(model, scene, options) {
878
878
  super();
879
879
  this.model = model;
880
880
  this.options = options;
881
- __privateAdd(this, _setupBasicPresses);
882
- __privateAdd(this, _onResize);
883
- __privateAdd(this, _dragTracker);
884
881
  this.scene = null;
885
882
  this.stats = null;
886
883
  this.rendererIsShared = shareRenderer();
887
884
  this.loadingElement = null;
888
- __privateAdd(this, _onResizeStaleDropper, new StaleDropper());
889
- __privateAdd(this, _width, 0);
890
- __privateAdd(this, _height, 0);
891
- __privateAdd(this, _cachedRenderer, null);
892
- __privateAdd(this, _cachedCanvas, null);
893
- __privateAdd(this, _cachedDragTracker, null);
894
- __privateAdd(this, _cachedCamera, null);
895
- __privateAdd(this, _cachedOrbitControls, null);
896
- __privateAdd(this, _disconnectionFunctions2, []);
897
- __privateAdd(this, _experimentalNextRenderFinishedCallback, null);
898
- __privateAdd(this, _scheduler, new RenderScheduler(this.render.bind(this)));
885
+ this.#onResizeStaleDropper = new StaleDropper();
886
+ this.#width = 0;
887
+ this.#height = 0;
888
+ this.#cachedRenderer = null;
889
+ this.#cachedCanvas = null;
890
+ this.#cachedDragTracker = null;
891
+ this.#cachedCamera = null;
892
+ this.#cachedOrbitControls = null;
893
+ this.#disconnectionFunctions = [];
894
+ this.#experimentalNextRenderFinishedCallback = null;
895
+ this.#scheduler = new RenderScheduler(this.render.bind(this));
899
896
  this.scene = scene ?? null;
900
897
  this.loadingElement = this.addElement(document.createElement("div"));
901
898
  this.loadingElement.classList.add("loading");
@@ -908,31 +905,87 @@ var Twisty3DVantage = class extends ManagedCustomElement {
908
905
  async connectedCallback() {
909
906
  this.addCSS(twisty3DVantageCSS);
910
907
  this.addElement((await this.canvasInfo()).canvas);
911
- __privateMethod(this, _onResize, onResize_fn).call(this);
912
- const observer = new ResizeObserver(__privateMethod(this, _onResize, onResize_fn).bind(this));
908
+ this.#onResize();
909
+ const observer = new ResizeObserver(this.#onResize.bind(this));
913
910
  observer.observe(this.contentWrapper);
914
911
  this.orbitControls();
915
- __privateMethod(this, _setupBasicPresses, setupBasicPresses_fn).call(this);
912
+ this.#setupBasicPresses();
916
913
  this.scheduleRender();
917
914
  }
915
+ async #setupBasicPresses() {
916
+ const dragTracker = await this.#dragTracker();
917
+ dragTracker.addEventListener("press", async (e) => {
918
+ const movePressInput = await this.model.twistySceneModel.movePressInput.get();
919
+ if (movePressInput !== "basic") {
920
+ return;
921
+ }
922
+ this.dispatchEvent(
923
+ new CustomEvent("press", {
924
+ detail: {
925
+ pressInfo: e.detail,
926
+ cameraPromise: this.camera()
927
+ }
928
+ })
929
+ );
930
+ });
931
+ }
932
+ #onResizeStaleDropper;
918
933
  async clearCanvas() {
919
934
  if (this.rendererIsShared) {
920
935
  const canvasInfo = await this.canvasInfo();
921
- canvasInfo.context.clearRect(0, 0, canvasInfo.canvas.width, canvasInfo.canvas.height);
936
+ canvasInfo.context.clearRect(
937
+ 0,
938
+ 0,
939
+ canvasInfo.canvas.width,
940
+ canvasInfo.canvas.height
941
+ );
922
942
  } else {
923
943
  const renderer = await this.renderer();
924
944
  const context = renderer.getContext();
925
945
  context.clear(context.COLOR_BUFFER_BIT);
926
946
  }
927
947
  }
948
+ #width;
949
+ #height;
950
+ async #onResize() {
951
+ const camera = await this.#onResizeStaleDropper.queue(this.camera());
952
+ const w = this.contentWrapper.clientWidth;
953
+ const h = this.contentWrapper.clientHeight;
954
+ this.#width = w;
955
+ this.#height = h;
956
+ const off = 0;
957
+ let yoff = 0;
958
+ let excess = 0;
959
+ if (h > w) {
960
+ excess = h - w;
961
+ yoff = -Math.floor(0.5 * excess);
962
+ }
963
+ camera.aspect = w / h;
964
+ camera.setViewOffset(w, h - excess, off, yoff, w, h);
965
+ camera.updateProjectionMatrix();
966
+ this.clearCanvas();
967
+ if (this.rendererIsShared) {
968
+ const canvasInfo = await this.canvasInfo();
969
+ canvasInfo.canvas.width = w * pixelRatio();
970
+ canvasInfo.canvas.height = h * pixelRatio();
971
+ canvasInfo.canvas.style.width = w.toString();
972
+ canvasInfo.canvas.style.height = h.toString();
973
+ } else {
974
+ const renderer = await this.renderer();
975
+ renderer.setSize(w, h, true);
976
+ }
977
+ this.scheduleRender();
978
+ }
979
+ #cachedRenderer;
928
980
  async renderer() {
929
981
  if (this.rendererIsShared) {
930
982
  throw new Error("renderer expected to be shared.");
931
983
  }
932
- return __privateGet(this, _cachedRenderer) ?? __privateSet(this, _cachedRenderer, newRenderer());
984
+ return this.#cachedRenderer ?? (this.#cachedRenderer = newRenderer());
933
985
  }
986
+ #cachedCanvas;
934
987
  async canvasInfo() {
935
- return __privateGet(this, _cachedCanvas) ?? __privateSet(this, _cachedCanvas, (async () => {
988
+ return this.#cachedCanvas ?? (this.#cachedCanvas = (async () => {
936
989
  let canvas;
937
990
  if (this.rendererIsShared) {
938
991
  canvas = this.addElement(document.createElement("canvas"));
@@ -945,44 +998,93 @@ var Twisty3DVantage = class extends ManagedCustomElement {
945
998
  return { canvas, context };
946
999
  })());
947
1000
  }
1001
+ #cachedDragTracker;
1002
+ async #dragTracker() {
1003
+ return this.#cachedDragTracker ?? (this.#cachedDragTracker = (async () => {
1004
+ const dragTracker = new DragTracker((await this.canvasInfo()).canvas);
1005
+ this.model?.twistySceneModel.dragInput.addFreshListener(
1006
+ (dragInputMode) => {
1007
+ let dragInputEnabled = false;
1008
+ switch (dragInputMode) {
1009
+ case "auto":
1010
+ dragTracker.start();
1011
+ dragInputEnabled = true;
1012
+ break;
1013
+ case "none":
1014
+ dragTracker.stop();
1015
+ break;
1016
+ }
1017
+ this.contentWrapper.classList.toggle(
1018
+ "drag-input-enabled",
1019
+ dragInputEnabled
1020
+ );
1021
+ }
1022
+ );
1023
+ return dragTracker;
1024
+ })());
1025
+ }
1026
+ #cachedCamera;
948
1027
  async camera() {
949
- return __privateGet(this, _cachedCamera) ?? __privateSet(this, _cachedCamera, (async () => {
950
- const camera = new (await THREEJS).PerspectiveCamera(20, 1, 0.1, 20);
951
- camera.position.copy(new (await THREEJS).Vector3(2, 4, 4).multiplyScalar(this.options?.backView ? -1 : 1));
1028
+ return this.#cachedCamera ?? (this.#cachedCamera = (async () => {
1029
+ const camera = new (await THREEJS).PerspectiveCamera(
1030
+ 20,
1031
+ 1,
1032
+ 0.1,
1033
+ 20
1034
+ );
1035
+ camera.position.copy(
1036
+ new (await THREEJS).Vector3(2, 4, 4).multiplyScalar(
1037
+ this.options?.backView ? -1 : 1
1038
+ )
1039
+ );
952
1040
  camera.lookAt(0, 0, 0);
953
1041
  return camera;
954
1042
  })());
955
1043
  }
1044
+ #cachedOrbitControls;
956
1045
  async orbitControls() {
957
- return __privateGet(this, _cachedOrbitControls) ?? __privateSet(this, _cachedOrbitControls, (async () => {
958
- const orbitControls = new TwistyOrbitControls(this.model, !!this.options?.backView, (await this.canvasInfo()).canvas, await __privateMethod(this, _dragTracker, dragTracker_fn).call(this));
1046
+ return this.#cachedOrbitControls ?? (this.#cachedOrbitControls = (async () => {
1047
+ const orbitControls = new TwistyOrbitControls(
1048
+ this.model,
1049
+ !!this.options?.backView,
1050
+ (await this.canvasInfo()).canvas,
1051
+ await this.#dragTracker()
1052
+ );
959
1053
  if (this.model) {
960
- this.addListener(this.model.twistySceneModel.orbitCoordinates, async (orbitCoordinates) => {
961
- const camera = await this.camera();
962
- setCameraFromOrbitCoordinates(camera, orbitCoordinates, this.options?.backView);
963
- this.scheduleRender();
964
- });
1054
+ this.addListener(
1055
+ this.model.twistySceneModel.orbitCoordinates,
1056
+ async (orbitCoordinates) => {
1057
+ const camera = await this.camera();
1058
+ setCameraFromOrbitCoordinates(
1059
+ camera,
1060
+ orbitCoordinates,
1061
+ this.options?.backView
1062
+ );
1063
+ this.scheduleRender();
1064
+ }
1065
+ );
965
1066
  }
966
1067
  return orbitControls;
967
1068
  })());
968
1069
  }
969
1070
  addListener(prop, listener) {
970
1071
  prop.addFreshListener(listener);
971
- __privateGet(this, _disconnectionFunctions2).push(() => {
1072
+ this.#disconnectionFunctions.push(() => {
972
1073
  prop.removeFreshListener(listener);
973
1074
  });
974
1075
  }
1076
+ #disconnectionFunctions;
975
1077
  disconnect() {
976
- for (const fn of __privateGet(this, _disconnectionFunctions2)) {
1078
+ for (const fn of this.#disconnectionFunctions) {
977
1079
  fn();
978
1080
  }
979
- __privateSet(this, _disconnectionFunctions2, []);
1081
+ this.#disconnectionFunctions = [];
980
1082
  }
1083
+ #experimentalNextRenderFinishedCallback;
981
1084
  experimentalNextRenderFinishedCallback(callback) {
982
- __privateSet(this, _experimentalNextRenderFinishedCallback, callback);
1085
+ this.#experimentalNextRenderFinishedCallback = callback;
983
1086
  }
984
1087
  async render() {
985
- var _a;
986
1088
  if (!this.scene) {
987
1089
  throw new Error("Attempted to render without a scene");
988
1090
  }
@@ -993,95 +1095,19 @@ var Twisty3DVantage = class extends ManagedCustomElement {
993
1095
  this.canvasInfo()
994
1096
  ]);
995
1097
  if (this.rendererIsShared) {
996
- renderPooled(__privateGet(this, _width), __privateGet(this, _height), canvas.canvas, scene, camera);
1098
+ renderPooled(this.#width, this.#height, canvas.canvas, scene, camera);
997
1099
  } else {
998
1100
  (await this.renderer()).render(scene, camera);
999
1101
  }
1000
1102
  this.stats?.end();
1001
- (_a = __privateGet(this, _experimentalNextRenderFinishedCallback)) == null ? void 0 : _a.call(this);
1002
- __privateSet(this, _experimentalNextRenderFinishedCallback, null);
1103
+ this.#experimentalNextRenderFinishedCallback?.();
1104
+ this.#experimentalNextRenderFinishedCallback = null;
1003
1105
  }
1106
+ #scheduler;
1004
1107
  scheduleRender() {
1005
- __privateGet(this, _scheduler).requestAnimFrame();
1108
+ this.#scheduler.requestAnimFrame();
1006
1109
  }
1007
1110
  };
1008
- _setupBasicPresses = new WeakSet();
1009
- setupBasicPresses_fn = async function() {
1010
- const dragTracker = await __privateMethod(this, _dragTracker, dragTracker_fn).call(this);
1011
- dragTracker.addEventListener("press", async (e) => {
1012
- const movePressInput = await this.model.twistySceneModel.movePressInput.get();
1013
- if (movePressInput !== "basic") {
1014
- return;
1015
- }
1016
- this.dispatchEvent(new CustomEvent("press", {
1017
- detail: {
1018
- pressInfo: e.detail,
1019
- cameraPromise: this.camera()
1020
- }
1021
- }));
1022
- });
1023
- };
1024
- _onResizeStaleDropper = new WeakMap();
1025
- _width = new WeakMap();
1026
- _height = new WeakMap();
1027
- _onResize = new WeakSet();
1028
- onResize_fn = async function() {
1029
- const camera = await __privateGet(this, _onResizeStaleDropper).queue(this.camera());
1030
- const w = this.contentWrapper.clientWidth;
1031
- const h = this.contentWrapper.clientHeight;
1032
- __privateSet(this, _width, w);
1033
- __privateSet(this, _height, h);
1034
- const off = 0;
1035
- let yoff = 0;
1036
- let excess = 0;
1037
- if (h > w) {
1038
- excess = h - w;
1039
- yoff = -Math.floor(0.5 * excess);
1040
- }
1041
- camera.aspect = w / h;
1042
- camera.setViewOffset(w, h - excess, off, yoff, w, h);
1043
- camera.updateProjectionMatrix();
1044
- this.clearCanvas();
1045
- if (this.rendererIsShared) {
1046
- const canvasInfo = await this.canvasInfo();
1047
- canvasInfo.canvas.width = w * pixelRatio();
1048
- canvasInfo.canvas.height = h * pixelRatio();
1049
- canvasInfo.canvas.style.width = w.toString();
1050
- canvasInfo.canvas.style.height = h.toString();
1051
- } else {
1052
- const renderer = await this.renderer();
1053
- renderer.setSize(w, h, true);
1054
- }
1055
- this.scheduleRender();
1056
- };
1057
- _cachedRenderer = new WeakMap();
1058
- _cachedCanvas = new WeakMap();
1059
- _cachedDragTracker = new WeakMap();
1060
- _dragTracker = new WeakSet();
1061
- dragTracker_fn = async function() {
1062
- return __privateGet(this, _cachedDragTracker) ?? __privateSet(this, _cachedDragTracker, (async () => {
1063
- const dragTracker = new DragTracker((await this.canvasInfo()).canvas);
1064
- this.model?.twistySceneModel.dragInput.addFreshListener((dragInputMode) => {
1065
- let dragInputEnabled = false;
1066
- switch (dragInputMode) {
1067
- case "auto":
1068
- dragTracker.start();
1069
- dragInputEnabled = true;
1070
- break;
1071
- case "none":
1072
- dragTracker.stop();
1073
- break;
1074
- }
1075
- this.contentWrapper.classList.toggle("drag-input-enabled", dragInputEnabled);
1076
- });
1077
- return dragTracker;
1078
- })());
1079
- };
1080
- _cachedCamera = new WeakMap();
1081
- _cachedOrbitControls = new WeakMap();
1082
- _disconnectionFunctions2 = new WeakMap();
1083
- _experimentalNextRenderFinishedCallback = new WeakMap();
1084
- _scheduler = new WeakMap();
1085
1111
  customElementsShim.define("twisty-3d-vantage", Twisty3DVantage);
1086
1112
 
1087
1113
  export {
@@ -1108,4 +1134,4 @@ export {
1108
1134
  proxy3D,
1109
1135
  THREEJS
1110
1136
  };
1111
- //# sourceMappingURL=chunk-LSVR2HCG.js.map
1137
+ //# sourceMappingURL=chunk-76UZ2QTB.js.map