vim-web 0.5.0-dev.3 → 0.5.0-dev.5

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.
package/dist/vim-web.js CHANGED
@@ -50876,16 +50876,16 @@ class Validation {
50876
50876
  //= ===========================================================================
50877
50877
  // HANDLE VALIDATIONS
50878
50878
  //= ===========================================================================
50879
- static isComponentHandle(handle) {
50880
- if (!this.isPositiveInteger(handle)) return false;
50881
- if (handle === INVALID_HANDLE) {
50882
- console.warn(`Invalid handle ${handle}. Aborting operation.`);
50879
+ static isIndex(index2) {
50880
+ if (!this.isPositiveInteger(index2)) return false;
50881
+ if (index2 === INVALID_HANDLE) {
50882
+ console.warn(`Invalid index ${index2}. Aborting operation.`);
50883
50883
  return false;
50884
50884
  }
50885
50885
  return true;
50886
50886
  }
50887
- static areComponentHandles(handles) {
50888
- return handles.every((h) => this.isComponentHandle(h));
50887
+ static areIndices(indices) {
50888
+ return indices.every((h) => this.isIndex(h));
50889
50889
  }
50890
50890
  static isMaterialHandle(handle) {
50891
50891
  if (!materialHandles.includes(handle)) {
@@ -57529,7 +57529,7 @@ class Camera3 {
57529
57529
  * @returns Promise that resolves when the framing animation is complete
57530
57530
  */
57531
57531
  async frameAll(blendTime = this._defaultBlendTime) {
57532
- const segment = await this._rpc.RPCFrameAll(blendTime);
57532
+ const segment = await this._rpc.RPCFrameScene(blendTime);
57533
57533
  this._savedPosition = this._savedPosition ?? segment;
57534
57534
  return segment;
57535
57535
  }
@@ -57953,10 +57953,10 @@ class RpcClient {
57953
57953
  const ret = returnMarshal.readUInt();
57954
57954
  return ret;
57955
57955
  }
57956
- RPCDestroyMaterialInstances(materialInstanceHandle) {
57956
+ RPCDestroyMaterialInstances(materialInstanceHandles) {
57957
57957
  const marshal = new Marshal();
57958
57958
  marshal.writeString("RPCDestroyMaterialInstances");
57959
- marshal.writeArrayOfUInt(materialInstanceHandle);
57959
+ marshal.writeArrayOfUInt(materialInstanceHandles);
57960
57960
  this._socket.sendRPC(marshal);
57961
57961
  }
57962
57962
  RPCDestroyText(componentHandle) {
@@ -57980,53 +57980,53 @@ class RpcClient {
57980
57980
  const ret = returnMarshal.readSegment();
57981
57981
  return ret;
57982
57982
  }
57983
- async RPCFrameAll(blendTime) {
57983
+ async RPCFrameElements(vimIndex, elementIndices, blendTime) {
57984
57984
  const marshal = new Marshal();
57985
- marshal.writeString("RPCFrameAll");
57985
+ marshal.writeString("RPCFrameElements");
57986
+ marshal.writeUInt(vimIndex);
57987
+ marshal.writeArrayOfUInt(elementIndices);
57986
57988
  marshal.writeFloat(blendTime);
57987
57989
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
57988
57990
  const ret = returnMarshal.readSegment();
57989
57991
  return ret;
57990
57992
  }
57991
- async RPCFrameElements(componentHandle, elementIndices, blendTime) {
57993
+ async RPCFrameScene(blendTime) {
57992
57994
  const marshal = new Marshal();
57993
- marshal.writeString("RPCFrameElements");
57994
- marshal.writeUInt(componentHandle);
57995
- marshal.writeArrayOfUInt(elementIndices);
57995
+ marshal.writeString("RPCFrameScene");
57996
57996
  marshal.writeFloat(blendTime);
57997
57997
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
57998
57998
  const ret = returnMarshal.readSegment();
57999
57999
  return ret;
58000
58000
  }
58001
- async RPCFrameVim(componentHandle, blendTime) {
58001
+ async RPCFrameVim(vimIndex, blendTime) {
58002
58002
  const marshal = new Marshal();
58003
58003
  marshal.writeString("RPCFrameVim");
58004
- marshal.writeUInt(componentHandle);
58004
+ marshal.writeUInt(vimIndex);
58005
58005
  marshal.writeFloat(blendTime);
58006
58006
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58007
58007
  const ret = returnMarshal.readSegment();
58008
58008
  return ret;
58009
58009
  }
58010
- async RPCGetAABBForAll() {
58010
+ async RPCGetAABBForElements(vimIndex, elementIndices) {
58011
58011
  const marshal = new Marshal();
58012
- marshal.writeString("RPCGetAABBForAll");
58012
+ marshal.writeString("RPCGetAABBForElements");
58013
+ marshal.writeUInt(vimIndex);
58014
+ marshal.writeArrayOfUInt(elementIndices);
58013
58015
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58014
58016
  const ret = returnMarshal.readBox3();
58015
58017
  return ret;
58016
58018
  }
58017
- async RPCGetAABBForElements(componentHandle, elementIndices) {
58019
+ async RPCGetAABBForScene() {
58018
58020
  const marshal = new Marshal();
58019
- marshal.writeString("RPCGetAABBForElements");
58020
- marshal.writeUInt(componentHandle);
58021
- marshal.writeArrayOfUInt(elementIndices);
58021
+ marshal.writeString("RPCGetAABBForScene");
58022
58022
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58023
58023
  const ret = returnMarshal.readBox3();
58024
58024
  return ret;
58025
58025
  }
58026
- async RPCGetAABBForVim(componentHandle) {
58026
+ async RPCGetAABBForVim(vimIndex) {
58027
58027
  const marshal = new Marshal();
58028
58028
  marshal.writeString("RPCGetAABBForVim");
58029
- marshal.writeUInt(componentHandle);
58029
+ marshal.writeUInt(vimIndex);
58030
58030
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58031
58031
  const ret = returnMarshal.readBox3();
58032
58032
  return ret;
@@ -58045,25 +58045,25 @@ class RpcClient {
58045
58045
  const ret = returnMarshal.readSegment();
58046
58046
  return ret;
58047
58047
  }
58048
- async RpcGetElementCountForScene() {
58048
+ async RPCGetElementCountForScene() {
58049
58049
  const marshal = new Marshal();
58050
- marshal.writeString("RpcGetElementCountForScene");
58050
+ marshal.writeString("RPCGetElementCountForScene");
58051
58051
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58052
58052
  const ret = returnMarshal.readUInt();
58053
58053
  return ret;
58054
58054
  }
58055
- async RpcGetElementCountForVim(vimIndex) {
58055
+ async RPCGetElementCountForVim(vimIndex) {
58056
58056
  const marshal = new Marshal();
58057
- marshal.writeString("RpcGetElementCountForVim");
58057
+ marshal.writeString("RPCGetElementCountForVim");
58058
58058
  marshal.writeUInt(vimIndex);
58059
58059
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58060
58060
  const ret = returnMarshal.readUInt();
58061
58061
  return ret;
58062
58062
  }
58063
- async RPCGetElementIds(componentHandle) {
58063
+ async RPCGetElementIds(vimIndex) {
58064
58064
  const marshal = new Marshal();
58065
58065
  marshal.writeString("RPCGetElementIds");
58066
- marshal.writeUInt(componentHandle);
58066
+ marshal.writeUInt(vimIndex);
58067
58067
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58068
58068
  const ret = returnMarshal.readArrayOfUInt64();
58069
58069
  return ret;
@@ -58075,10 +58075,10 @@ class RpcClient {
58075
58075
  const ret = returnMarshal.readString();
58076
58076
  return ret;
58077
58077
  }
58078
- async RPCGetRoomElements(componentHandle) {
58078
+ async RPCGetRoomElements(vimIndex) {
58079
58079
  const marshal = new Marshal();
58080
58080
  marshal.writeString("RPCGetRoomElements");
58081
- marshal.writeUInt(componentHandle);
58081
+ marshal.writeUInt(vimIndex);
58082
58082
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58083
58083
  const ret = returnMarshal.readArrayOfUInt();
58084
58084
  return ret;
@@ -58090,10 +58090,10 @@ class RpcClient {
58090
58090
  const ret = returnMarshal.readSectionBoxState();
58091
58091
  return ret;
58092
58092
  }
58093
- async RPCGetVimLoadingState(componentHandle) {
58093
+ async RPCGetVimLoadingState(vimIndex) {
58094
58094
  const marshal = new Marshal();
58095
58095
  marshal.writeString("RPCGetVimLoadingState");
58096
- marshal.writeUInt(componentHandle);
58096
+ marshal.writeUInt(vimIndex);
58097
58097
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58098
58098
  const ret = returnMarshal.readVimStatus();
58099
58099
  return ret;
@@ -58227,10 +58227,10 @@ class RpcClient {
58227
58227
  marshal.writeRGBA(backgroundColor);
58228
58228
  this._socket.sendRPC(marshal);
58229
58229
  }
58230
- RPCSetMaterialOverrides(componentHandle, elementIndices, materialInstanceHandles) {
58230
+ RPCSetMaterialOverridesForElements(vimIndex, elementIndices, materialInstanceHandles) {
58231
58231
  const marshal = new Marshal();
58232
- marshal.writeString("RPCSetMaterialOverrides");
58233
- marshal.writeUInt(componentHandle);
58232
+ marshal.writeString("RPCSetMaterialOverridesForElements");
58233
+ marshal.writeUInt(vimIndex);
58234
58234
  marshal.writeArrayOfUInt(elementIndices);
58235
58235
  marshal.writeArrayOfUInt(materialInstanceHandles);
58236
58236
  this._socket.sendRPC(marshal);
@@ -58241,10 +58241,10 @@ class RpcClient {
58241
58241
  marshal.writeSectionBoxState(state);
58242
58242
  this._socket.sendRPC(marshal);
58243
58243
  }
58244
- RPCSetStateElements(componentHandle, elementIndices, state) {
58244
+ RPCSetStateElements(vimIndex, elementIndices, state) {
58245
58245
  const marshal = new Marshal();
58246
58246
  marshal.writeString("RPCSetStateElements");
58247
- marshal.writeUInt(componentHandle);
58247
+ marshal.writeUInt(vimIndex);
58248
58248
  marshal.writeArrayOfUInt(elementIndices);
58249
58249
  marshal.writeUInt(state);
58250
58250
  this._socket.sendRPC(marshal);
@@ -58255,17 +58255,17 @@ class RpcClient {
58255
58255
  marshal.writeUInt(state);
58256
58256
  this._socket.sendRPC(marshal);
58257
58257
  }
58258
- RPCSetStateVim(componentHandle, state) {
58258
+ RPCSetStateVim(vimIndex, state) {
58259
58259
  const marshal = new Marshal();
58260
58260
  marshal.writeString("RPCSetStateVim");
58261
- marshal.writeUInt(componentHandle);
58261
+ marshal.writeUInt(vimIndex);
58262
58262
  marshal.writeUInt(state);
58263
58263
  this._socket.sendRPC(marshal);
58264
58264
  }
58265
- RPCSetStatesElements(componentHandle, elementIndices, states) {
58265
+ RPCSetStatesElements(vimIndex, elementIndices, states) {
58266
58266
  const marshal = new Marshal();
58267
58267
  marshal.writeString("RPCSetStatesElements");
58268
- marshal.writeUInt(componentHandle);
58268
+ marshal.writeUInt(vimIndex);
58269
58269
  marshal.writeArrayOfUInt(elementIndices);
58270
58270
  marshal.writeArrayOfUInt(states);
58271
58271
  this._socket.sendRPC(marshal);
@@ -58293,12 +58293,6 @@ class RpcClient {
58293
58293
  marshal.writeString("RPCUnloadAll");
58294
58294
  this._socket.sendRPC(marshal);
58295
58295
  }
58296
- RPCUnloadVim(componentHandle) {
58297
- const marshal = new Marshal();
58298
- marshal.writeString("RPCUnloadVim");
58299
- marshal.writeUInt(componentHandle);
58300
- this._socket.sendRPC(marshal);
58301
- }
58302
58296
  }
58303
58297
  class RemoteColor {
58304
58298
  /**
@@ -59080,7 +59074,7 @@ const defaultSceneSettings = {
59080
59074
  hdrScale: 1.37,
59081
59075
  hdrBackgroundScale: 1,
59082
59076
  hdrBackgroundSaturation: 1,
59083
- backGroundBlur: 1,
59077
+ backgroundBlur: 1,
59084
59078
  backgroundColor: new RGBA(0.9, 0.9, 0.9, 1)
59085
59079
  };
59086
59080
  var VimLoadingStatus = /* @__PURE__ */ ((VimLoadingStatus2) => {
@@ -59093,15 +59087,26 @@ var VimLoadingStatus = /* @__PURE__ */ ((VimLoadingStatus2) => {
59093
59087
  return VimLoadingStatus2;
59094
59088
  })(VimLoadingStatus || {});
59095
59089
  class RpcSafeClient {
59090
+ /**
59091
+ * Creates a new RpcSafeClient instance.
59092
+ * @param rpc - The underlying RpcClient used for communication
59093
+ * @param batchSize - Maximum size of batched data for operations (default: 10000)
59094
+ */
59096
59095
  constructor(rpc, batchSize = defaultBatchSize) {
59097
59096
  __publicField(this, "rpc");
59098
59097
  __publicField(this, "batchSize");
59099
59098
  this.rpc = rpc;
59100
59099
  this.batchSize = batchSize;
59101
59100
  }
59101
+ /**
59102
+ * The URL used by the underlying RPC connection.
59103
+ */
59102
59104
  get url() {
59103
59105
  return this.rpc.url;
59104
59106
  }
59107
+ /**
59108
+ * Indicates whether the RPC client is currently connected.
59109
+ */
59105
59110
  get connected() {
59106
59111
  return this.rpc.connected;
59107
59112
  }
@@ -59111,9 +59116,10 @@ class RpcSafeClient {
59111
59116
  * and scene-wide settings.
59112
59117
  ******************************************************************************/
59113
59118
  /**
59114
- * Initializes and starts the scene with specified settings.
59119
+ * Initializes and starts the scene with the given settings.
59115
59120
  * @param settings - Optional partial scene settings to override defaults
59116
- * @remarks If no settings are provided, default values will be used
59121
+ * @returns Promise resolving to true if the scene started successfully, false otherwise
59122
+ * @remarks Missing values will be filled from {@link defaultSceneSettings}
59117
59123
  */
59118
59124
  async RPCStartScene(settings2) {
59119
59125
  const s = { ...defaultSceneSettings, ...settings2 ?? {} };
@@ -59123,15 +59129,15 @@ class RpcSafeClient {
59123
59129
  Validation.min0(s.hdrScale),
59124
59130
  Validation.clamp01(s.hdrBackgroundScale),
59125
59131
  Validation.clamp01(s.hdrBackgroundSaturation),
59126
- Validation.clamp01(s.backGroundBlur),
59132
+ Validation.clamp01(s.backgroundBlur),
59127
59133
  Validation.clampRGBA01(s.backgroundColor)
59128
59134
  ),
59129
59135
  false
59130
59136
  );
59131
59137
  }
59132
59138
  /**
59133
- * Sets the lighting settings for the scene.
59134
- * @param settings - The lighting settings to apply
59139
+ * Updates the scene’s lighting configuration.
59140
+ * @param settings - The complete lighting and background settings to apply
59135
59141
  */
59136
59142
  RPCSetLighting(settings2) {
59137
59143
  const s = settings2;
@@ -59140,55 +59146,80 @@ class RpcSafeClient {
59140
59146
  Validation.min0(s.hdrScale),
59141
59147
  Validation.clamp01(s.hdrBackgroundScale),
59142
59148
  Validation.clamp01(s.hdrBackgroundSaturation),
59143
- Validation.clamp01(s.backGroundBlur),
59149
+ Validation.clamp01(s.backgroundBlur),
59144
59150
  Validation.clampRGBA01(s.backgroundColor)
59145
59151
  );
59146
59152
  }
59147
- RpcGetElementCountForScene() {
59153
+ /**
59154
+ * Retrieves the total number of elements across the entire scene.
59155
+ * @returns Promise resolving to the total number of elements (0 on failure).
59156
+ */
59157
+ RPCGetElementCountForScene() {
59148
59158
  return this.safeCall(
59149
- () => this.rpc.RpcGetElementCountForScene(),
59159
+ () => this.rpc.RPCGetElementCountForScene(),
59150
59160
  0
59151
59161
  );
59152
59162
  }
59153
- RpcGetElementCountForVim(vimIndex) {
59163
+ /**
59164
+ * Retrieves the number of elements within a specific loaded vim.
59165
+ * @param vimIndex - Index of the loaded vim to query
59166
+ * @returns Promise resolving to the element count (0 on failure)
59167
+ */
59168
+ RPCGetElementCountForVim(vimIndex) {
59154
59169
  return this.safeCall(
59155
- () => this.rpc.RpcGetElementCountForVim(vimIndex),
59170
+ () => this.rpc.RPCGetElementCountForVim(vimIndex),
59156
59171
  0
59157
59172
  );
59158
59173
  }
59159
59174
  /*******************************************************************************
59160
- * NODE VISIBILITY METHODS
59161
- * Methods for controlling node visibility, including show/hide, ghosting,
59175
+ * ELEMENTS VISIBILITY METHODS
59176
+ * Methods for controlling element visibility, including show/hide, ghosting,
59162
59177
  * and highlighting functionality.
59163
59178
  ******************************************************************************/
59164
59179
  /**
59165
- * Highlights specified nodes in a component.
59166
- * Large node arrays are automatically processed in batches.
59167
- * @param componentHandle - The component containing the nodes
59168
- * @param nodes - Array of node indices to highlight
59169
- * @throws {Error} If the component handle is invalid or nodes array is invalid
59170
- */
59171
- RPCSetStateElements(componentHandle, elements, state) {
59172
- if (elements.length === 0) return;
59173
- if (!Validation.isComponentHandle(componentHandle)) return;
59174
- if (!Validation.areComponentHandles(elements)) return;
59175
- const batches = batchArray(elements, this.batchSize);
59180
+ * Sets a single visibility state for given elements within a loaded vim.
59181
+ * The operation is automatically split into batches if the array is large.
59182
+ *
59183
+ * @param vimIndex - The index of the loaded vim containing the elements
59184
+ * @param vimElementIndices - Array of vim-based element indices to apply the state to
59185
+ * @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
59186
+ */
59187
+ RPCSetStateElements(vimIndex, vimElementIndices, state) {
59188
+ if (vimElementIndices.length === 0) return;
59189
+ if (!Validation.isIndex(vimIndex)) return;
59190
+ if (!Validation.areIndices(vimElementIndices)) return;
59191
+ const batches = batchArray(vimElementIndices, this.batchSize);
59176
59192
  for (const batch of batches) {
59177
- this.rpc.RPCSetStateElements(componentHandle, batch, state);
59193
+ this.rpc.RPCSetStateElements(vimIndex, batch, state);
59178
59194
  }
59179
59195
  }
59180
- RPCSetStatesElements(componentHandle, elements, states) {
59181
- if (!Validation.isComponentHandle(componentHandle)) return;
59182
- if (!Validation.areComponentHandles(elements)) return;
59183
- if (!Validation.areSameLength(elements, states)) return;
59184
- const batches = batchArrays(elements, states, this.batchSize);
59196
+ /**
59197
+ * Sets individual visibility states for multiple elements in a vim.
59198
+ * Each element receives a corresponding visibility state from the input array.
59199
+ * The operation is automatically split into batches if the array is large.
59200
+ *
59201
+ * @param vimIndex - The index of the loaded vim
59202
+ * @param vimElementIndices - Array of vim-based element indices
59203
+ * @param states - Array of visibility states to apply, one per element
59204
+ */
59205
+ RPCSetStatesElements(vimIndex, vimElementIndices, states) {
59206
+ if (!Validation.isIndex(vimIndex)) return;
59207
+ if (!Validation.areIndices(vimElementIndices)) return;
59208
+ if (!Validation.areSameLength(vimElementIndices, states)) return;
59209
+ const batches = batchArrays(vimElementIndices, states, this.batchSize);
59185
59210
  for (const [batchedElements, batchedStates] of batches) {
59186
- this.rpc.RPCSetStatesElements(componentHandle, batchedElements, batchedStates);
59211
+ this.rpc.RPCSetStatesElements(vimIndex, batchedElements, batchedStates);
59187
59212
  }
59188
59213
  }
59189
- RPCSetStateVim(componentHandle, state) {
59190
- if (!Validation.isComponentHandle(componentHandle)) return;
59191
- this.rpc.RPCSetStateVim(componentHandle, state);
59214
+ /**
59215
+ * Applies a single visibility state to all elements of a loaded vim.
59216
+ *
59217
+ * @param vimIndex - The index of the loaded vim
59218
+ * @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
59219
+ */
59220
+ RPCSetStateVim(vimIndex, state) {
59221
+ if (!Validation.isIndex(vimIndex)) return;
59222
+ this.rpc.RPCSetStateVim(vimIndex, state);
59192
59223
  }
59193
59224
  /*******************************************************************************
59194
59225
  * TEXT AND UI METHODS
@@ -59200,7 +59231,6 @@ class RpcSafeClient {
59200
59231
  * @param color - The color of the text
59201
59232
  * @param text - The content to display
59202
59233
  * @returns Promise resolving to the handle of the created text component
59203
- * @throws {Error} If the text is empty
59204
59234
  */
59205
59235
  async RPCCreateText(position, color, text) {
59206
59236
  if (!Validation.isNonEmptyString(text)) return INVALID_HANDLE;
@@ -59213,19 +59243,26 @@ class RpcSafeClient {
59213
59243
  /**
59214
59244
  * Destroys a text component, removing it from the scene.
59215
59245
  * @param componentHandle - The handle of the text component to destroy
59216
- * @throws {Error} If the component handle is invalid
59217
59246
  */
59218
59247
  RPCDestroyText(componentHandle) {
59219
- if (!Validation.isComponentHandle(componentHandle)) return;
59248
+ if (!Validation.isIndex(componentHandle)) return;
59220
59249
  this.rpc.RPCDestroyText(componentHandle);
59221
59250
  }
59222
59251
  /*******************************************************************************
59223
59252
  * SECTION BOX METHODS
59224
59253
  * Methods for controlling section box visibility and position.
59225
59254
  ******************************************************************************/
59255
+ /**
59256
+ * Enables or disables the section box.
59257
+ * @param enable - True to enable the section box, false to disable it
59258
+ */
59226
59259
  RPCEnableSectionBox(enable) {
59227
59260
  this.rpc.RPCEnableSectionBox(enable);
59228
59261
  }
59262
+ /**
59263
+ * Sets the parameters of the section box.
59264
+ * @param state - The new section box state, including visibility and bounding box
59265
+ */
59229
59266
  RPCSetSectionBox(state) {
59230
59267
  this.rpc.RPCSetSectionBox(
59231
59268
  {
@@ -59234,6 +59271,10 @@ class RpcSafeClient {
59234
59271
  }
59235
59272
  );
59236
59273
  }
59274
+ /**
59275
+ * Retrieves the current section box state.
59276
+ * @returns Promise resolving to the section box state or undefined on failure
59277
+ */
59237
59278
  async RPCGetSectionBox() {
59238
59279
  return await this.safeCall(
59239
59280
  () => this.rpc.RPCGetSectionBox(),
@@ -59290,52 +59331,52 @@ class RpcSafeClient {
59290
59331
  }
59291
59332
  /**
59292
59333
  * Retrieves the axis-aligned bounding box (AABB) that encompasses the entire scene.
59293
- * This includes all loaded geometry across all VIM components.
59334
+ * This includes all loaded geometry across all loaded vims.
59294
59335
  *
59295
59336
  * @returns Promise resolving to the global AABB of the scene, or undefined on failure
59296
59337
  */
59297
- RPCGetAABBForAll() {
59338
+ RPCGetAABBForScene() {
59298
59339
  return this.safeCall(
59299
- () => this.rpc.RPCGetAABBForAll(),
59340
+ () => this.rpc.RPCGetAABBForScene(),
59300
59341
  void 0
59301
59342
  );
59302
59343
  }
59303
59344
  /**
59304
- * Retrieves the axis-aligned bounding box (AABB) for a specific VIM component.
59305
- * This bounding box represents the spatial bounds of all geometry within the given component.
59345
+ * Retrieves the axis-aligned bounding box (AABB) for a specific loaded vim.
59346
+ * This bounding box represents the spatial bounds of all geometry within the given loaded vim.
59306
59347
  *
59307
- * @param componentHandle - The handle of the VIM component to query
59308
- * @returns Promise resolving to the component’s bounding box, or undefined on failure
59348
+ * @param vimIndex - The index of the loaded vim to query
59349
+ * @returns Promise resolving to the vim bounding box, or undefined on failure
59309
59350
  */
59310
- async RPCGetAABBForVim(componentHandle) {
59351
+ async RPCGetAABBForVim(vimIndex) {
59352
+ if (!Validation.isIndex(vimIndex)) return void 0;
59311
59353
  return await this.safeCall(
59312
- () => this.rpc.RPCGetAABBForVim(componentHandle),
59354
+ () => this.rpc.RPCGetAABBForVim(vimIndex),
59313
59355
  void 0
59314
59356
  );
59315
59357
  }
59316
59358
  /**
59317
- * Calculates the bounding box for specified nodes in a component.
59318
- * Large node arrays are automatically processed in batches for better performance.
59319
- * @param componentHandle - The component containing the nodes
59320
- * @param elements - Array of node indices to calculate bounds for
59321
- * @returns Promise resolving to the combined bounding box
59322
- * @throws {Error} If the component handle is invalid or nodes array is invalid
59359
+ * Calculates the bounding box for specified elements of a loaded vim.
59360
+ * Large element arrays are automatically processed in batches.
59361
+ * @param vimIndex - The index of the loaded vim
59362
+ * @param vimElementIndices - Array of vim-based element indices to calculate bounds for
59363
+ * @returns Promise resolving to the combined bounding box or undefined on failure
59323
59364
  */
59324
- async RPCGetAABBForElements(componentHandle, elements) {
59325
- if (!Validation.isComponentHandle(componentHandle)) return;
59326
- if (!Validation.areComponentHandles(elements)) return;
59365
+ async RPCGetAABBForElements(vimIndex, vimElementIndices) {
59366
+ if (!Validation.isIndex(vimIndex)) return;
59367
+ if (!Validation.areIndices(vimElementIndices)) return;
59327
59368
  return await this.safeCall(
59328
- () => this.RPCGetAABBForElementsBatched(componentHandle, elements),
59369
+ () => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
59329
59370
  void 0
59330
59371
  );
59331
59372
  }
59332
- async RPCGetAABBForElementsBatched(componentHandle, elements) {
59333
- if (elements.length === 0) {
59373
+ async RPCGetAABBForElementsBatched(vimIndex, vimElementIndices) {
59374
+ if (vimElementIndices.length === 0) {
59334
59375
  return new Box3();
59335
59376
  }
59336
- const batches = batchArray(elements, this.batchSize);
59377
+ const batches = batchArray(vimElementIndices, this.batchSize);
59337
59378
  const promises = batches.map(async (batch) => {
59338
- const aabb = await this.rpc.RPCGetAABBForElements(componentHandle, batch);
59379
+ const aabb = await this.rpc.RPCGetAABBForElements(vimIndex, batch);
59339
59380
  const v1 = new Vector3(aabb.min.x, aabb.min.y, aabb.min.z);
59340
59381
  const v2 = new Vector3(aabb.max.x, aabb.max.y, aabb.max.z);
59341
59382
  return new Box3(v1, v2);
@@ -59346,53 +59387,51 @@ class RpcSafeClient {
59346
59387
  return box;
59347
59388
  }
59348
59389
  /**
59349
- * Frames the camera to show all components in the scene.
59390
+ * Frames the camera to show all elements in the scene.
59350
59391
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59351
59392
  * @returns Promise resolving to camera segment representing the final position
59352
59393
  */
59353
- async RPCFrameAll(blendTime) {
59394
+ async RPCFrameScene(blendTime) {
59354
59395
  blendTime = Validation.clamp01(blendTime);
59355
59396
  return await this.safeCall(
59356
- () => this.rpc.RPCFrameAll(blendTime),
59397
+ () => this.rpc.RPCFrameScene(blendTime),
59357
59398
  void 0
59358
59399
  );
59359
59400
  }
59360
59401
  /**
59361
- * Frames a specific VIM component in the scene.
59362
- * @param componentHandle - The handle of the VIM component to frame
59402
+ * Frames a specific vim in the scene.
59403
+ * @param vimIndex - The index of the loaded vim to frame
59363
59404
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59364
59405
  * @returns Promise resolving to camera segment representing the final position
59365
- * @throws {Error} If the component handle is invalid
59366
59406
  */
59367
- async RPCFrameVim(componentHandle, blendTime) {
59368
- if (!Validation.isComponentHandle(componentHandle)) return;
59407
+ async RPCFrameVim(vimIndex, blendTime) {
59408
+ if (!Validation.isIndex(vimIndex)) return;
59369
59409
  blendTime = Validation.clamp01(blendTime);
59370
59410
  return await this.safeCall(
59371
- () => this.rpc.RPCFrameVim(componentHandle, blendTime),
59411
+ () => this.rpc.RPCFrameVim(vimIndex, blendTime),
59372
59412
  void 0
59373
59413
  );
59374
59414
  }
59375
59415
  /**
59376
- * Frames specific instances within a component. For large numbers of instances,
59377
- * automatically switches to bounding box framing for better performance.
59378
- * @param componentHandle - The component containing the instances
59379
- * @param elements - Array of node indices to frame
59416
+ * Frames specific elements of a loaded vim.
59417
+ * Automatically batches large arrays of elements.
59418
+ * @param vimIndex - The index of the loaded vim
59419
+ * @param vimElementIndices - Array of vim-based element indices to frame
59380
59420
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59381
59421
  * @returns Promise resolving to camera segment representing the final position
59382
- * @throws {Error} If the component handle is invalid or nodes array is empty
59383
59422
  */
59384
- async RPCFrameElements(componentHandle, elements, blendTime) {
59385
- if (!Validation.isComponentHandle(componentHandle)) return;
59386
- if (!Validation.areComponentHandles(elements)) return;
59423
+ async RPCFrameElements(vimIndex, vimElementIndices, blendTime) {
59424
+ if (!Validation.isIndex(vimIndex)) return;
59425
+ if (!Validation.areIndices(vimElementIndices)) return;
59387
59426
  blendTime = Validation.clamp01(blendTime);
59388
- if (elements.length < this.batchSize) {
59427
+ if (vimElementIndices.length < this.batchSize) {
59389
59428
  return await this.safeCall(
59390
- () => this.rpc.RPCFrameElements(componentHandle, elements, blendTime),
59429
+ () => this.rpc.RPCFrameElements(vimIndex, vimElementIndices, blendTime),
59391
59430
  void 0
59392
59431
  );
59393
59432
  } else {
59394
59433
  const box = await this.safeCall(
59395
- () => this.RPCGetAABBForElementsBatched(componentHandle, elements),
59434
+ () => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
59396
59435
  void 0
59397
59436
  );
59398
59437
  if (!box) return void 0;
@@ -59406,7 +59445,6 @@ class RpcSafeClient {
59406
59445
  * Frames the camera to show a specific bounding box.
59407
59446
  * @param box - The bounding box to frame
59408
59447
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59409
- * @throws {Error} If the box is invalid (min values must be less than max values)
59410
59448
  */
59411
59449
  async RPCFrameAABB(box, blendTime) {
59412
59450
  if (!Validation.isValidBox(box)) return;
@@ -59423,12 +59461,15 @@ class RpcSafeClient {
59423
59461
  /**
59424
59462
  * Sets the camera movement speed.
59425
59463
  * @param speed - The desired movement speed (must be positive)
59426
- * @throws {Error} If speed is not positive
59427
59464
  */
59428
59465
  RPCSetCameraSpeed(speed) {
59429
59466
  speed = Validation.min0(speed);
59430
59467
  this.rpc.RPCSetCameraSpeed(speed);
59431
59468
  }
59469
+ /**
59470
+ * Sets the camera control mode.
59471
+ * @param mode - The desired input mode (e.g., {@link InputMode.Orbit} or {@link InputMode.Free})
59472
+ */
59432
59473
  RPCSetCameraMode(mode) {
59433
59474
  this.rpc.RPCSetCameraMode(
59434
59475
  mode === "orbit"
@@ -59437,9 +59478,8 @@ class RpcSafeClient {
59437
59478
  }
59438
59479
  /**
59439
59480
  * Sets the viewer's aspect ratio.
59440
- * @param width - The width component of the aspect ratio
59441
- * @param height - The height component of the aspect ratio
59442
- * @throws {Error} If width or height are not positive integers
59481
+ * @param width - The width of the desired aspect ratio
59482
+ * @param height - The height of the desired aspect ratio
59443
59483
  */
59444
59484
  RPCSetCameraAspectRatio(width, height) {
59445
59485
  if (!Validation.isPositiveInteger(width)) return;
@@ -59448,13 +59488,12 @@ class RpcSafeClient {
59448
59488
  }
59449
59489
  /*******************************************************************************
59450
59490
  * VIM FILE MANAGEMENT METHODS
59451
- * Methods for loading, unloading, and managing VIM files and components.
59491
+ * Methods for loading, unloading, and managing VIM files.
59452
59492
  ******************************************************************************/
59453
59493
  /**
59454
59494
  * Loads a VIM file from the local filesystem.
59455
59495
  * @param source - The path to the VIM file (supports file:// protocol)
59456
- * @returns Promise resolving to the handle of the loaded VIM component
59457
- * @throws {Error} If the filename is invalid or empty
59496
+ * @returns Promise resolving to the index of the loaded vim
59458
59497
  */
59459
59498
  async RPCLoadVim(source) {
59460
59499
  if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
@@ -59466,9 +59505,8 @@ class RpcSafeClient {
59466
59505
  }
59467
59506
  /**
59468
59507
  * Loads a VIM file from a remote URL.
59469
- * @param url - The URL of the VIM file to load
59470
- * @returns Promise resolving to the handle of the loaded VIM component
59471
- * @throws {Error} If the URL is invalid
59508
+ * @param source - The URL or file path of the VIM file to load
59509
+ * @returns Promise resolving to the index of the loaded vim
59472
59510
  */
59473
59511
  async RPCLoadVimURL(source) {
59474
59512
  if (!Validation.isURL(source.url)) return INVALID_HANDLE;
@@ -59478,17 +59516,16 @@ class RpcSafeClient {
59478
59516
  );
59479
59517
  }
59480
59518
  /**
59481
- * Retrieves the current loading state and progress of a VIM component.
59482
- * @param componentHandle - The handle of the VIM component
59519
+ * Retrieves the current loading state and progress of a vim.
59520
+ * @param vimIndex - The index of the vim being loaded
59483
59521
  * @returns Promise resolving to the current loading state and progress
59484
- * @throws {Error} If the component handle is invalid
59485
59522
  */
59486
- async RPCGetVimLoadingState(componentHandle) {
59487
- if (!Validation.isComponentHandle(componentHandle)) {
59523
+ async RPCGetVimLoadingState(vimIndex) {
59524
+ if (!Validation.isIndex(vimIndex)) {
59488
59525
  return { status: 0, progress: 0 };
59489
59526
  }
59490
59527
  const result = await this.safeCall(
59491
- () => this.rpc.RPCGetVimLoadingState(componentHandle),
59528
+ () => this.rpc.RPCGetVimLoadingState(vimIndex),
59492
59529
  { status: 0, progress: 0 }
59493
59530
  );
59494
59531
  if (!(result.status in VimLoadingStatus)) {
@@ -59497,16 +59534,7 @@ class RpcSafeClient {
59497
59534
  return result;
59498
59535
  }
59499
59536
  /**
59500
- * Unloads a VIM component and frees associated resources.
59501
- * @param componentHandle - The handle of the component to unload
59502
- * @throws {Error} If the component handle is invalid
59503
- */
59504
- RPCUnloadVim(componentHandle) {
59505
- if (!Validation.isComponentHandle(componentHandle)) return;
59506
- this.rpc.RPCUnloadVim(componentHandle);
59507
- }
59508
- /**
59509
- * Clears the entire scene, removing all components and resetting to initial state.
59537
+ * Clears the entire scene, unloading all vims and resetting to initial state.
59510
59538
  */
59511
59539
  RPCUnloadAll() {
59512
59540
  this.rpc.RPCUnloadAll();
@@ -59522,7 +59550,7 @@ class RpcSafeClient {
59522
59550
  /**
59523
59551
  * Performs hit testing at a specified screen position.
59524
59552
  * @param pos - Normalized screen coordinates (0-1, 0-1)
59525
- * @returns Promise resolving to hit test result if something was hit, undefined otherwise
59553
+ * @returns Promise resolving to hit test result if a valid hit was detected, undefined otherwise
59526
59554
  */
59527
59555
  async RPCPerformHitTest(pos) {
59528
59556
  if (!Validation.isRelativeVector2(pos)) return;
@@ -59530,7 +59558,7 @@ class RpcSafeClient {
59530
59558
  () => this.rpc.RPCPerformHitTest(pos),
59531
59559
  void 0
59532
59560
  );
59533
- if (!result || result.nodeIndex < 0) {
59561
+ if (!result || result.vimIndex === INVALID_HANDLE) {
59534
59562
  return void 0;
59535
59563
  }
59536
59564
  return result;
@@ -59540,7 +59568,6 @@ class RpcSafeClient {
59540
59568
  * @param position - The normalized screen coordinates (0-1, 0-1)
59541
59569
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59542
59570
  * @param down - True if button is pressed down, false if released
59543
- * @throws {Error} If mouseButton is not a valid positive integer
59544
59571
  */
59545
59572
  RPCMouseButtonEvent(position, mouseButton, down) {
59546
59573
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59551,7 +59578,6 @@ class RpcSafeClient {
59551
59578
  * Sends a mouse double-click event to the viewer.
59552
59579
  * @param position - The normalized screen coordinates (0-1, 0-1)
59553
59580
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59554
- * @throws {Error} If mouseButton is not a valid positive integer
59555
59581
  */
59556
59582
  RPCMouseDoubleClickEvent(position, mouseButton) {
59557
59583
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59578,7 +59604,6 @@ class RpcSafeClient {
59578
59604
  * Sends a mouse selection event to the viewer.
59579
59605
  * @param position - The normalized screen coordinates (0-1, 0-1)
59580
59606
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59581
- * @throws {Error} If mouseButton is not a valid positive integer
59582
59607
  */
59583
59608
  RPCMouseSelectEvent(position, mouseButton) {
59584
59609
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59605,7 +59630,6 @@ class RpcSafeClient {
59605
59630
  * @param smoothness - The smoothness value to apply (clamped between 0 and 1)
59606
59631
  * @param colors - Array of colors for each material instance
59607
59632
  * @returns Array of handles for the created material instances
59608
- * @throws {Error} If the material handle is invalid or smoothness is out of range
59609
59633
  */
59610
59634
  async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
59611
59635
  if (!Validation.isMaterialHandle(materialHandle)) return;
@@ -59628,42 +59652,38 @@ class RpcSafeClient {
59628
59652
  }
59629
59653
  /**
59630
59654
  * Destroys multiple material instances, freeing associated resources.
59631
- * @param materialInstanceHandle - Array of handles for material instances to destroy
59632
- * @throws {Error} If any handle in the array is invalid
59655
+ * @param materialInstanceHandles - Array of handles for material instances to destroy
59633
59656
  */
59634
- RPCDestroyMaterialInstances(materialInstanceHandle) {
59635
- if (!Validation.areComponentHandles(materialInstanceHandle)) return;
59636
- this.rpc.RPCDestroyMaterialInstances(materialInstanceHandle);
59657
+ RPCDestroyMaterialInstances(materialInstanceHandles) {
59658
+ if (!Validation.areIndices(materialInstanceHandles)) return;
59659
+ this.rpc.RPCDestroyMaterialInstances(materialInstanceHandles);
59637
59660
  }
59638
59661
  /**
59639
- * Sets material overrides for specific nodes in a component.
59640
- * Large arrays are automatically processed in batches for better performance.
59641
- * @param componentHandle - The component containing the nodes
59642
- * @param nodes - Array of node indices to override
59643
- * @param materialInstanceHandles - Array of material instance handles to apply (must match nodes length)
59644
- * @throws {Error} If arrays have different lengths or any handle is invalid
59662
+ * Sets material overrides for specific elements in a loaded vim.
59663
+ * Large arrays are automatically processed in batches.
59664
+ * @param vimIndex - The index of the loaded vim
59665
+ * @param vimElementIndices - Array of vim-based element indices to override
59666
+ * @param materialInstanceHandles - Array of material instance handles to apply (must match element length)
59645
59667
  */
59646
- RPCSetMaterialOverrides(componentHandle, nodes, materialInstanceHandles) {
59647
- if (!Validation.areSameLength(nodes, materialInstanceHandles)) return;
59648
- if (!Validation.isComponentHandle(componentHandle)) return;
59649
- if (!Validation.areComponentHandles(nodes)) return;
59668
+ RPCSetMaterialOverridesForElements(vimIndex, vimElementIndices, materialInstanceHandles) {
59669
+ if (!Validation.areSameLength(vimElementIndices, materialInstanceHandles)) return;
59670
+ if (!Validation.isIndex(vimIndex)) return;
59671
+ if (!Validation.areIndices(vimElementIndices)) return;
59650
59672
  if (!Validation.areIntegers(materialInstanceHandles)) return;
59651
59673
  this.setMaterialOverridesBatched(
59652
- componentHandle,
59653
- nodes,
59674
+ vimIndex,
59675
+ vimElementIndices,
59654
59676
  materialInstanceHandles
59655
59677
  );
59656
59678
  }
59657
- setMaterialOverridesBatched(componentHandle, nodes, materialInstanceHandles) {
59658
- const batches = batchArrays(nodes, materialInstanceHandles, this.batchSize);
59659
- for (const [batchedNodes, batchedMaterials] of batches) {
59660
- this.rpc.RPCSetMaterialOverrides(componentHandle, batchedNodes, batchedMaterials);
59679
+ setMaterialOverridesBatched(vimIndex, vimElementIndices, materialInstanceHandles) {
59680
+ const batches = batchArrays(vimElementIndices, materialInstanceHandles, this.batchSize);
59681
+ for (const [batchedElements, batchedMaterials] of batches) {
59682
+ this.rpc.RPCSetMaterialOverridesForElements(vimIndex, batchedElements, batchedMaterials);
59661
59683
  }
59662
59684
  }
59663
59685
  /**
59664
- * Clears all material overrides for the specified component, restoring default materials.
59665
- * @param componentHandle - The unique identifier of the component
59666
- * @throws {Error} If the component handle is invalid or INVALID_HANDLE
59686
+ * Clears all material overrides for the entire scene.
59667
59687
  */
59668
59688
  RPCClearMaterialOverrides() {
59669
59689
  this.rpc.RPCClearMaterialOverrides();
@@ -59816,7 +59836,7 @@ class Renderer2 {
59816
59836
  * @returns Current background blur
59817
59837
  */
59818
59838
  get backgroundBlur() {
59819
- return this._settings.backGroundBlur;
59839
+ return this._settings.backgroundBlur;
59820
59840
  }
59821
59841
  /**
59822
59842
  * Gets the background color
@@ -59887,8 +59907,8 @@ class Renderer2 {
59887
59907
  */
59888
59908
  set backgroundBlur(value) {
59889
59909
  value = Validation.clamp01(value);
59890
- if (this._settings.backGroundBlur === value) return;
59891
- this._settings.backGroundBlur = value;
59910
+ if (this._settings.backgroundBlur === value) return;
59911
+ this._settings.backgroundBlur = value;
59892
59912
  this._updateLighting = true;
59893
59913
  this.requestSettingsUpdate();
59894
59914
  }
@@ -59904,7 +59924,7 @@ class Renderer2 {
59904
59924
  this.requestSettingsUpdate();
59905
59925
  }
59906
59926
  getBoundingBox() {
59907
- return this._rpc.RPCGetAABBForAll();
59927
+ return this._rpc.RPCGetAABBForScene();
59908
59928
  }
59909
59929
  /**
59910
59930
  * Requests an update to be performed on the next animation frame.
@@ -60019,7 +60039,7 @@ class SectionBox2 {
60019
60039
  * Fits the given box, invalid dimensions will be reversed.
60020
60040
  * @param box - The new bounding box.
60021
60041
  */
60022
- fitBox(box) {
60042
+ setBox(box) {
60023
60043
  box = safeBox(box);
60024
60044
  this._box = box;
60025
60045
  this.scheduleUpdate();
@@ -60043,7 +60063,7 @@ var VisibilityState$1 = /* @__PURE__ */ ((VisibilityState2) => {
60043
60063
  VisibilityState2[VisibilityState2["GHOSTED_HIGHLIGHTED"] = 18] = "GHOSTED_HIGHLIGHTED";
60044
60064
  return VisibilityState2;
60045
60065
  })(VisibilityState$1 || {});
60046
- class StateSynchronizer {
60066
+ class VisibilitySynchronizer {
60047
60067
  /**
60048
60068
  * Creates a new StateSynchronizer instance.
60049
60069
  *
@@ -60061,7 +60081,7 @@ class StateSynchronizer {
60061
60081
  __publicField(this, "_onUpdate");
60062
60082
  __publicField(this, "_isConnected");
60063
60083
  __publicField(this, "_animationFrame");
60064
- this._tracker = new StateTracker(defaultState);
60084
+ this._tracker = new VisibilityTracker(defaultState);
60065
60085
  this._rpc = rpc;
60066
60086
  this._onUpdate = onUpdate;
60067
60087
  this._getHandle = getHandle;
@@ -60110,7 +60130,7 @@ class StateSynchronizer {
60110
60130
  * @param elementIndex - The element index to update
60111
60131
  * @param state - The new state to apply
60112
60132
  */
60113
- setElementState(elementIndex, state) {
60133
+ setStateForElement(elementIndex, state) {
60114
60134
  this._tracker.setState(elementIndex, state);
60115
60135
  this.scheduleUpdate();
60116
60136
  }
@@ -60174,7 +60194,7 @@ class StateSynchronizer {
60174
60194
  this._onUpdate();
60175
60195
  }
60176
60196
  }
60177
- class StateTracker {
60197
+ class VisibilityTracker {
60178
60198
  /**
60179
60199
  * Creates a new StateTracker instance.
60180
60200
  *
@@ -60811,7 +60831,7 @@ class Element3D2 {
60811
60831
  return this.vim.visibility.getElementState(this.element);
60812
60832
  }
60813
60833
  set state(state) {
60814
- this.vim.visibility.setElementState(this.element, state);
60834
+ this.vim.visibility.setStateForElement(this.element, state);
60815
60835
  }
60816
60836
  /**
60817
60837
  * Gets or sets the color override of the element.
@@ -60841,6 +60861,7 @@ class Vim2 {
60841
60861
  __publicField(this, "_renderer");
60842
60862
  __publicField(this, "_logger");
60843
60863
  // The StateSynchronizer wraps a StateTracker and handles RPC synchronization.
60864
+ // Should be private
60844
60865
  __publicField(this, "visibility");
60845
60866
  // Color tracking remains unchanged.
60846
60867
  __publicField(this, "_nodeColors", /* @__PURE__ */ new Map());
@@ -60854,7 +60875,7 @@ class Vim2 {
60854
60875
  this._colors = color;
60855
60876
  this._renderer = renderer;
60856
60877
  this._logger = logger;
60857
- this.visibility = new StateSynchronizer(
60878
+ this.visibility = new VisibilitySynchronizer(
60858
60879
  this._rpc,
60859
60880
  () => this._handle,
60860
60881
  () => this.connected,
@@ -60915,7 +60936,6 @@ class Vim2 {
60915
60936
  (_a3 = this._request) == null ? void 0 : _a3.error("cancelled", "The request was cancelled");
60916
60937
  this._request = void 0;
60917
60938
  if (this.connected) {
60918
- this._rpc.RPCUnloadVim(this._handle);
60919
60939
  this._handle = -1;
60920
60940
  }
60921
60941
  }
@@ -60937,13 +60957,12 @@ class Vim2 {
60937
60957
  case VimLoadingStatus.FailedToDownload:
60938
60958
  case VimLoadingStatus.FailedToLoad:
60939
60959
  case VimLoadingStatus.Unknown:
60940
- this._rpc.RPCUnloadVim(handle);
60941
60960
  const details = await this._rpc.RPCGetLastError();
60942
60961
  const error = this.getErrorType(state.status);
60943
60962
  return result.error(error, details);
60944
60963
  case VimLoadingStatus.Done:
60945
60964
  this._handle = handle;
60946
- this._elementCount = await this._rpc.RpcGetElementCountForVim(handle);
60965
+ this._elementCount = await this._rpc.RPCGetElementCountForVim(handle);
60947
60966
  return result.success(this);
60948
60967
  }
60949
60968
  } catch (e) {
@@ -61035,7 +61054,7 @@ class Vim2 {
61035
61054
  this._rpc.RPCClearMaterialOverrides();
61036
61055
  } else {
61037
61056
  const ids = new Array(elements.length).fill(MaterialHandles.Invalid);
61038
- this._rpc.RPCSetMaterialOverrides(this._handle, elements, ids);
61057
+ this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, ids);
61039
61058
  }
61040
61059
  }
61041
61060
  reapplyColors() {
@@ -61060,7 +61079,7 @@ class Vim2 {
61060
61079
  const colors = nodes.map((n) => this._nodeColors.get(n));
61061
61080
  const remoteColors = await this._colors.getColors(colors);
61062
61081
  const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
61063
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, colorIds);
61082
+ this._rpc.RPCSetMaterialOverridesForElements(this._handle, nodes, colorIds);
61064
61083
  this._updatedColors.clear();
61065
61084
  }
61066
61085
  }
@@ -61362,7 +61381,7 @@ let Viewer$2 = class Viewer2 {
61362
61381
  this._vims.clear();
61363
61382
  }
61364
61383
  getElement3Ds() {
61365
- return this.rpc.RpcGetElementCountForScene();
61384
+ return this.rpc.RPCGetElementCountForScene();
61366
61385
  }
61367
61386
  /**
61368
61387
  * Disposes all resources used by the viewer and disconnects from the server.
@@ -76178,7 +76197,7 @@ function useUltraSectionBox(viewer) {
76178
76197
  viewer.sectionBox.interactive = b;
76179
76198
  },
76180
76199
  getBox: () => viewer.sectionBox.getBox(),
76181
- setBox: (box) => viewer.sectionBox.fitBox(box),
76200
+ setBox: (box) => viewer.sectionBox.setBox(box),
76182
76201
  onSelectionChanged: viewer.selection.onSelectionChanged,
76183
76202
  getSelectionBox: () => viewer.selection.getBoundingBox(),
76184
76203
  getSceneBox: () => viewer.renderer.getBoundingBox()