@bldrs-ai/conway 1.373.1180 → 1.374.1181

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 (38) hide show
  1. package/compiled/examples/browser-bundled.cjs +358 -30
  2. package/compiled/examples/cli-bundled.cjs +358 -30
  3. package/compiled/examples/cli-step-bundled.cjs +358 -30
  4. package/compiled/examples/validator-bundled.cjs +358 -30
  5. package/compiled/src/compat/web-ifc/ap214_properties.d.ts +8 -0
  6. package/compiled/src/compat/web-ifc/ap214_properties.d.ts.map +1 -1
  7. package/compiled/src/compat/web-ifc/ap214_properties.js +10 -0
  8. package/compiled/src/compat/web-ifc/ifc_api.d.ts +20 -0
  9. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  10. package/compiled/src/compat/web-ifc/ifc_api.js +30 -0
  11. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +16 -0
  12. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  13. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts +32 -0
  14. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
  15. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +38 -0
  16. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +33 -0
  17. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  18. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +38 -0
  19. package/compiled/src/compat/web-ifc/ifc_properties.d.ts +8 -0
  20. package/compiled/src/compat/web-ifc/ifc_properties.d.ts.map +1 -1
  21. package/compiled/src/compat/web-ifc/ifc_properties.js +24 -0
  22. package/compiled/src/compat/web-ifc/ifc_spill_source.test.d.ts +2 -0
  23. package/compiled/src/compat/web-ifc/ifc_spill_source.test.d.ts.map +1 -0
  24. package/compiled/src/compat/web-ifc/ifc_spill_source.test.js +108 -0
  25. package/compiled/src/step/step_buffer_provider.d.ts +278 -0
  26. package/compiled/src/step/step_buffer_provider.d.ts.map +1 -0
  27. package/compiled/src/step/step_buffer_provider.js +382 -0
  28. package/compiled/src/step/step_buffer_provider.test.d.ts +2 -0
  29. package/compiled/src/step/step_buffer_provider.test.d.ts.map +1 -0
  30. package/compiled/src/step/step_buffer_provider.test.js +149 -0
  31. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  32. package/compiled/src/step/step_entity_base.js +41 -11
  33. package/compiled/src/step/step_model_base.d.ts +62 -2
  34. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  35. package/compiled/src/step/step_model_base.js +120 -18
  36. package/compiled/src/version/version.js +1 -1
  37. package/compiled/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
@@ -3635,6 +3635,240 @@ var EntityTypesIfc;
3635
3635
  var EntityTypesIfcCount = 909;
3636
3636
  var entity_types_ifc_gen_default = EntityTypesIfc;
3637
3637
 
3638
+ // compiled/src/step/step_buffer_provider.js
3639
+ var DEFAULT_CHUNK_BYTES = 4 * 1024 * 1024;
3640
+ var DEFAULT_MAX_RESIDENT_CHUNKS = 16;
3641
+ var STEP_BUFFER_BASE = Symbol("stepBufferBase");
3642
+ function stepBufferBase(buffer) {
3643
+ return buffer[STEP_BUFFER_BASE] ?? 0;
3644
+ }
3645
+ function tagBufferBase(buffer, base) {
3646
+ if (base !== 0) {
3647
+ Object.defineProperty(buffer, STEP_BUFFER_BASE, { value: base });
3648
+ }
3649
+ return buffer;
3650
+ }
3651
+ var StepBufferNotResidentError = class extends Error {
3652
+ /**
3653
+ * Construct this for a byte range.
3654
+ *
3655
+ * @param address Absolute start of the range.
3656
+ * @param length Length of the range.
3657
+ */
3658
+ constructor(address, length) {
3659
+ super(`STEP source range [${address}, ${address + length}) is not resident \u2014 call ensureResident before synchronous extraction`);
3660
+ this.address = address;
3661
+ this.length = length;
3662
+ this.name = "StepBufferNotResidentError";
3663
+ }
3664
+ };
3665
+ var ResidentStepBufferProvider = class {
3666
+ /**
3667
+ * Construct this over the resident source buffer.
3668
+ *
3669
+ * @param buffer_ The full source bytes.
3670
+ */
3671
+ constructor(buffer_) {
3672
+ this.buffer_ = buffer_;
3673
+ }
3674
+ /**
3675
+ * Total logical size of the source bytes.
3676
+ *
3677
+ * @return {number} The byte length.
3678
+ */
3679
+ get byteLength() {
3680
+ return this.buffer_.byteLength;
3681
+ }
3682
+ /**
3683
+ * Bytes currently held resident — the whole buffer.
3684
+ *
3685
+ * @return {number} The byte length.
3686
+ */
3687
+ get residentBytes() {
3688
+ return this.buffer_.byteLength;
3689
+ }
3690
+ /**
3691
+ * Acquire the whole buffer at offset 0.
3692
+ *
3693
+ * @return {StepBufferAcquisition} The acquisition.
3694
+ */
3695
+ acquire() {
3696
+ return { buffer: this.buffer_, offset: 0 };
3697
+ }
3698
+ /**
3699
+ * Always resident.
3700
+ *
3701
+ * @return {Promise< void >} Resolved promise.
3702
+ */
3703
+ ensureResident() {
3704
+ return Promise.resolve();
3705
+ }
3706
+ };
3707
+ var WindowedStepBufferProvider = class {
3708
+ /**
3709
+ * Construct this over an external byte store.
3710
+ *
3711
+ * @param store_ The store holding the source bytes.
3712
+ * @param chunkBytes Chunk size in bytes (default 4MiB).
3713
+ * @param maxResidentChunks LRU residency cap in chunks (default 16).
3714
+ */
3715
+ constructor(store_, chunkBytes = DEFAULT_CHUNK_BYTES, maxResidentChunks = DEFAULT_MAX_RESIDENT_CHUNKS) {
3716
+ this.store_ = store_;
3717
+ this.chunks_ = /* @__PURE__ */ new Map();
3718
+ this.loading_ = /* @__PURE__ */ new Map();
3719
+ this.ensurePins_ = /* @__PURE__ */ new Map();
3720
+ if (chunkBytes <= 0 || !Number.isInteger(chunkBytes)) {
3721
+ throw new Error(`Invalid chunkBytes ${chunkBytes}`);
3722
+ }
3723
+ this.chunkBytes_ = chunkBytes;
3724
+ this.maxResidentChunks_ = Math.max(1, maxResidentChunks);
3725
+ }
3726
+ /**
3727
+ * Total logical size of the source bytes.
3728
+ *
3729
+ * @return {number} The byte length.
3730
+ */
3731
+ get byteLength() {
3732
+ return this.store_.byteLength;
3733
+ }
3734
+ /**
3735
+ * Bytes currently held resident by the provider.
3736
+ *
3737
+ * @return {number} The resident byte count.
3738
+ */
3739
+ get residentBytes() {
3740
+ let total = 0;
3741
+ for (const chunk of this.chunks_.values()) {
3742
+ total += chunk.byteLength;
3743
+ }
3744
+ return total;
3745
+ }
3746
+ /**
3747
+ * Number of resident chunks (telemetry/tests).
3748
+ *
3749
+ * @return {number} The chunk count.
3750
+ */
3751
+ get residentChunkCount() {
3752
+ return this.chunks_.size;
3753
+ }
3754
+ /**
3755
+ * Touch a chunk for LRU recency.
3756
+ *
3757
+ * @param chunkIndex The chunk to touch.
3758
+ * @param chunk The chunk bytes.
3759
+ */
3760
+ touch_(chunkIndex, chunk) {
3761
+ this.chunks_.delete(chunkIndex);
3762
+ this.chunks_.set(chunkIndex, chunk);
3763
+ }
3764
+ /**
3765
+ * Synchronously acquire a view containing a byte range.
3766
+ *
3767
+ * Single-chunk ranges are served as the chunk itself (zero copy);
3768
+ * straddling ranges get a standalone merged copy spanning exactly
3769
+ * the requested range.
3770
+ *
3771
+ * @param address Absolute start of the range.
3772
+ * @param length Length of the range.
3773
+ * @throws { StepBufferNotResidentError } When any covering chunk isn't resident.
3774
+ * @return {StepBufferAcquisition} The view and its base address.
3775
+ */
3776
+ acquire(address, length) {
3777
+ const chunkBytes = this.chunkBytes_;
3778
+ const firstChunk = Math.floor(address / chunkBytes);
3779
+ const lastChunk = Math.floor((address + Math.max(length, 1) - 1) / chunkBytes);
3780
+ if (firstChunk === lastChunk) {
3781
+ const chunk = this.chunks_.get(firstChunk);
3782
+ if (chunk === void 0) {
3783
+ throw new StepBufferNotResidentError(address, length);
3784
+ }
3785
+ this.touch_(firstChunk, chunk);
3786
+ return { buffer: chunk, offset: firstChunk * chunkBytes };
3787
+ }
3788
+ const merged = tagBufferBase(new Uint8Array(length), address);
3789
+ for (let chunkIndex = firstChunk; chunkIndex <= lastChunk; ++chunkIndex) {
3790
+ const chunk = this.chunks_.get(chunkIndex);
3791
+ if (chunk === void 0) {
3792
+ throw new StepBufferNotResidentError(address, length);
3793
+ }
3794
+ this.touch_(chunkIndex, chunk);
3795
+ const chunkBase = chunkIndex * chunkBytes;
3796
+ const copyFrom = Math.max(address, chunkBase);
3797
+ const copyTo = Math.min(address + length, chunkBase + chunk.byteLength);
3798
+ if (copyTo > copyFrom) {
3799
+ merged.set(chunk.subarray(copyFrom - chunkBase, copyTo - chunkBase), copyFrom - address);
3800
+ }
3801
+ }
3802
+ return { buffer: merged, offset: address };
3803
+ }
3804
+ /**
3805
+ * Make a byte range resident, paging missing chunks from the store
3806
+ * and evicting least-recently-used chunks beyond the cap (never the
3807
+ * chunks needed by this call).
3808
+ *
3809
+ * @param address Absolute start of the range.
3810
+ * @param length Length of the range.
3811
+ * @return {Promise< void >} Resolves when resident.
3812
+ */
3813
+ async ensureResident(address, length) {
3814
+ const chunkBytes = this.chunkBytes_;
3815
+ const firstChunk = Math.floor(address / chunkBytes);
3816
+ const lastChunk = Math.floor((address + Math.max(length, 1) - 1) / chunkBytes);
3817
+ for (let chunkIndex = firstChunk; chunkIndex <= lastChunk; ++chunkIndex) {
3818
+ this.ensurePins_.set(chunkIndex, (this.ensurePins_.get(chunkIndex) ?? 0) + 1);
3819
+ }
3820
+ try {
3821
+ const loads = [];
3822
+ for (let chunkIndex = firstChunk; chunkIndex <= lastChunk; ++chunkIndex) {
3823
+ const resident = this.chunks_.get(chunkIndex);
3824
+ if (resident !== void 0) {
3825
+ this.touch_(chunkIndex, resident);
3826
+ continue;
3827
+ }
3828
+ let inflight = this.loading_.get(chunkIndex);
3829
+ if (inflight === void 0) {
3830
+ const chunkBase = chunkIndex * chunkBytes;
3831
+ const chunkLength = Math.min(chunkBytes, this.store_.byteLength - chunkBase);
3832
+ inflight = this.store_.read(chunkBase, chunkLength).then((chunk) => {
3833
+ tagBufferBase(chunk, chunkBase);
3834
+ this.chunks_.set(chunkIndex, chunk);
3835
+ this.loading_.delete(chunkIndex);
3836
+ return chunk;
3837
+ }, (error) => {
3838
+ this.loading_.delete(chunkIndex);
3839
+ throw error;
3840
+ });
3841
+ this.loading_.set(chunkIndex, inflight);
3842
+ }
3843
+ loads.push(inflight.then(() => void 0));
3844
+ }
3845
+ if (loads.length > 0) {
3846
+ await Promise.all(loads);
3847
+ }
3848
+ if (this.chunks_.size > this.maxResidentChunks_) {
3849
+ for (const candidate of this.chunks_.keys()) {
3850
+ if (this.chunks_.size <= this.maxResidentChunks_) {
3851
+ break;
3852
+ }
3853
+ if ((this.ensurePins_.get(candidate) ?? 0) > 0) {
3854
+ continue;
3855
+ }
3856
+ this.chunks_.delete(candidate);
3857
+ }
3858
+ }
3859
+ } finally {
3860
+ for (let chunkIndex = firstChunk; chunkIndex <= lastChunk; ++chunkIndex) {
3861
+ const pins = this.ensurePins_.get(chunkIndex) ?? 0;
3862
+ if (pins <= 1) {
3863
+ this.ensurePins_.delete(chunkIndex);
3864
+ } else {
3865
+ this.ensurePins_.set(chunkIndex, pins - 1);
3866
+ }
3867
+ }
3868
+ }
3869
+ }
3870
+ };
3871
+
3638
3872
  // compiled/src/step/parsing/step_vtable_builder.js
3639
3873
  var StepVtableBuilder = class {
3640
3874
  /**
@@ -4075,6 +4309,7 @@ var StepModelBase = class {
4075
4309
  this.descriptorCache_ = [];
4076
4310
  this.elementMemoization = true;
4077
4311
  this.nullOnErrors = true;
4312
+ this.bufferProvider_ = new ResidentStepBufferProvider(buffer_);
4078
4313
  const localElementIndex = elementIndex;
4079
4314
  let where = 0;
4080
4315
  const firstInlineElement = localElementIndex.length;
@@ -4190,6 +4425,16 @@ var StepModelBase = class {
4190
4425
  item.vtable = void 0;
4191
4426
  item.vtableCount = void 0;
4192
4427
  item.vtableIndex = void 0;
4428
+ item.multiEntity = void 0;
4429
+ if (item.multiMapping !== void 0) {
4430
+ for (const mapped of item.multiMapping) {
4431
+ mapped.buffer = void 0;
4432
+ mapped.entity = void 0;
4433
+ mapped.vtable = void 0;
4434
+ mapped.vtableCount = void 0;
4435
+ mapped.vtableIndex = void 0;
4436
+ }
4437
+ }
4193
4438
  }
4194
4439
  }
4195
4440
  } else {
@@ -4215,14 +4460,16 @@ var StepModelBase = class {
4215
4460
  if (element.vtableIndex !== void 0 || element.typeID === 0) {
4216
4461
  return true;
4217
4462
  }
4218
- const extratedEntry = this.schema.parser.extractDataEntry(this.buffer_, element.address, element.address + element.length, this.vtableBuilder_);
4463
+ const acquisition = this.bufferProvider_.acquire(element.address, element.length);
4464
+ const viewAddress = element.address - acquisition.offset;
4465
+ const extratedEntry = this.schema.parser.extractDataEntry(acquisition.buffer, viewAddress, viewAddress + element.length, this.vtableBuilder_);
4219
4466
  if (extratedEntry === void 0) {
4220
4467
  return false;
4221
4468
  }
4222
4469
  element.vtableIndex = extratedEntry[0];
4223
4470
  element.vtableCount = extratedEntry[1];
4224
4471
  element.endCursor = extratedEntry[2];
4225
- element.buffer = this.buffer_;
4472
+ element.buffer = acquisition.buffer;
4226
4473
  element.vtable = this.vtableBuilder_.buffer;
4227
4474
  return true;
4228
4475
  }
@@ -4239,19 +4486,7 @@ var StepModelBase = class {
4239
4486
  throw new Error(`Invalid localID ${localID}`);
4240
4487
  }
4241
4488
  const element = this.entry(localID);
4242
- if (element.vtableIndex !== void 0 || element.typeID === 0) {
4243
- return true;
4244
- }
4245
- const extratedEntry = this.schema.parser.extractDataEntry(this.buffer_, element.address, element.address + element.length, this.vtableBuilder_);
4246
- if (extratedEntry === void 0) {
4247
- return false;
4248
- }
4249
- element.vtableIndex = extratedEntry[0];
4250
- element.vtableCount = extratedEntry[1];
4251
- element.endCursor = extratedEntry[2];
4252
- element.buffer = this.buffer_;
4253
- element.vtable = this.vtableBuilder_.buffer;
4254
- return true;
4489
+ return this.populateVtableEntryRaw(element);
4255
4490
  }
4256
4491
  /**
4257
4492
  * Force the population of the the buffer entry for a particular element.
@@ -4264,7 +4499,7 @@ var StepModelBase = class {
4264
4499
  throw new Error(`Invalid localID ${localID}`);
4265
4500
  }
4266
4501
  const element = this.entry(localID);
4267
- element.buffer = this.buffer_;
4502
+ element.buffer = this.bufferProvider_.acquire(element.address, element.length).buffer;
4268
4503
  }
4269
4504
  /**
4270
4505
  * Get the size in bytes of the backing buffer for this.
@@ -4272,7 +4507,99 @@ var StepModelBase = class {
4272
4507
  * @return {number} The number of elements.
4273
4508
  */
4274
4509
  get bufferBytesize() {
4275
- return this.buffer_.byteLength;
4510
+ return this.bufferProvider_.byteLength;
4511
+ }
4512
+ /**
4513
+ * Are the source bytes held externally (spilled), i.e. windowed in
4514
+ * on demand rather than fully resident?
4515
+ *
4516
+ * @return {boolean} True after a successful `spillSourceToExternalStore`.
4517
+ */
4518
+ get isSourceExternal() {
4519
+ return this.buffer_ === void 0;
4520
+ }
4521
+ /**
4522
+ * Bytes of source currently held resident by the buffer provider
4523
+ * (the whole buffer before a spill; the windowed working set after).
4524
+ *
4525
+ * @return {number} The resident byte count.
4526
+ */
4527
+ get residentSourceBytes() {
4528
+ return this.bufferProvider_.residentBytes;
4529
+ }
4530
+ /**
4531
+ * Release the resident source buffer and serve subsequent record
4532
+ * reads from fixed-size windows paged in from an external store.
4533
+ *
4534
+ * The store must contain EXACTLY the model's source bytes (same
4535
+ * length; byte-identical content is the caller's responsibility —
4536
+ * typically the original file already sitting in OPFS). All cached
4537
+ * descriptors/entities are invalidated, since they hold views over
4538
+ * the released buffer; they rematerialise on demand through the
4539
+ * windowed provider.
4540
+ *
4541
+ * After this, synchronous extraction of a record whose range isn't
4542
+ * resident throws StepBufferNotResidentError — async API surfaces
4543
+ * must call `ensureResidentByExpressID` / `ensureResidentByLocalID`
4544
+ * first. Parse and geometry extraction always run before any spill,
4545
+ * so those paths are unaffected.
4546
+ *
4547
+ * @param store The external store holding the source bytes.
4548
+ * @param chunkBytes Optional window size in bytes.
4549
+ * @param maxResidentChunks Optional residency cap in windows.
4550
+ */
4551
+ spillSourceToExternalStore(store, chunkBytes, maxResidentChunks) {
4552
+ if (store.byteLength !== this.bufferProvider_.byteLength) {
4553
+ throw new Error(`External store byteLength ${store.byteLength} does not match source byteLength ${this.bufferProvider_.byteLength}`);
4554
+ }
4555
+ this.bufferProvider_ = new WindowedStepBufferProvider(store, chunkBytes, maxResidentChunks);
4556
+ this.buffer_ = void 0;
4557
+ this.invalidate(true);
4558
+ }
4559
+ /**
4560
+ * Page in the byte range(s) backing a record so following
4561
+ * synchronous extraction of it succeeds. Covers the record's own
4562
+ * range (which contains any inline elements) and, for complex /
4563
+ * external-mapped records, each mapped class record's range.
4564
+ *
4565
+ * No-op (fast resolved promise) while the source is fully resident.
4566
+ *
4567
+ * @param localID The local ID of the record.
4568
+ * @return {Promise< void >} Resolves when resident.
4569
+ */
4570
+ async ensureResidentByLocalID(localID) {
4571
+ if (!this.isSourceExternal) {
4572
+ return;
4573
+ }
4574
+ if (localID >= this.count_) {
4575
+ throw new Error(`Invalid localID ${localID}`);
4576
+ }
4577
+ await this.bufferProvider_.ensureResident(this.address_[localID], this.length_[localID]);
4578
+ const complex = this.complexEntries_?.get(localID);
4579
+ if (complex?.multiMapping !== void 0) {
4580
+ for (const mapped of complex.multiMapping) {
4581
+ await this.bufferProvider_.ensureResident(mapped.address, mapped.length);
4582
+ }
4583
+ }
4584
+ }
4585
+ /**
4586
+ * Page in the byte range(s) backing a record by express ID — see
4587
+ * `ensureResidentByLocalID`. Unknown express IDs resolve silently
4588
+ * (the following read will surface the miss the same way it does
4589
+ * for a fully-resident model).
4590
+ *
4591
+ * @param expressID The express ID of the record.
4592
+ * @return {Promise< void >} Resolves when resident.
4593
+ */
4594
+ async ensureResidentByExpressID(expressID) {
4595
+ if (!this.isSourceExternal) {
4596
+ return;
4597
+ }
4598
+ const localID = this.expressIDMap_.get(expressID);
4599
+ if (localID === void 0) {
4600
+ return;
4601
+ }
4602
+ await this.ensureResidentByLocalID(localID);
4276
4603
  }
4277
4604
  /**
4278
4605
  * Get the number of elements/entities in this model.
@@ -9210,6 +9537,10 @@ var IfcTokenType;
9210
9537
  IfcTokenType2[IfcTokenType2["SET_END"] = 8] = "SET_END";
9211
9538
  IfcTokenType2[IfcTokenType2["LINE_END"] = 9] = "LINE_END";
9212
9539
  })(IfcTokenType || (IfcTokenType = {}));
9540
+ function extractInlineElementAddress(buffer, cursor, endCursor) {
9541
+ const relative = stepExtractInlineElemement(buffer, cursor, endCursor);
9542
+ return relative === void 0 ? void 0 : relative + stepBufferBase(buffer);
9543
+ }
9213
9544
  function merge(to, from) {
9214
9545
  for (const key of Object.keys(from)) {
9215
9546
  if (!to.hasOwnProperty(key)) {
@@ -9327,8 +9658,7 @@ var StepEntityBase = class {
9327
9658
  if (!optional) {
9328
9659
  throw new Error("Value in STEP was incorrectly typed");
9329
9660
  }
9330
- const buffer2 = this.buffer;
9331
- if (!this.model.nullOnErrors && stepExtractOptional(buffer2, cursor, endCursor) !== null) {
9661
+ if (!this.model.nullOnErrors && stepExtractOptional(buffer, cursor, endCursor) !== null) {
9332
9662
  throw new Error("Value in STEP was incorrectly typed");
9333
9663
  }
9334
9664
  return null;
@@ -9364,11 +9694,9 @@ var StepEntityBase = class {
9364
9694
  return value;
9365
9695
  }
9366
9696
  extractReference(offset, baseOffset, depth, optional) {
9367
- const cursor = this.getOffsetCursor(offset, baseOffset, depth);
9368
- const buffer = this.buffer;
9369
- const endCursor = buffer.length;
9697
+ const [cursor, endCursor, buffer] = this.getOffsetAndEndCursor(offset, baseOffset, depth);
9370
9698
  const expressID = stepExtractReference(buffer, cursor, endCursor);
9371
- const value = expressID !== void 0 ? this.model.getElementByExpressID(expressID) : this.model.getInlineElementByAddress(stepExtractInlineElemement(buffer, cursor, endCursor));
9699
+ const value = expressID !== void 0 ? this.model.getElementByExpressID(expressID) : this.model.getInlineElementByAddress(extractInlineElementAddress(buffer, cursor, endCursor));
9372
9700
  if (value === void 0) {
9373
9701
  if (!optional) {
9374
9702
  throw new Error("Value in STEP was incorrectly typed");
@@ -9430,8 +9758,8 @@ var StepEntityBase = class {
9430
9758
  extractLineArguments() {
9431
9759
  this.guaranteeBuffer();
9432
9760
  const internalReference = this.internalReference_;
9433
- const cursor = internalReference.address;
9434
9761
  const buffer = internalReference.buffer;
9762
+ const cursor = internalReference.address - stepBufferBase(buffer);
9435
9763
  const endCursor = cursor + internalReference.length;
9436
9764
  const subArray = buffer.subarray(cursor, endCursor);
9437
9765
  return subArray;
@@ -9446,7 +9774,7 @@ var StepEntityBase = class {
9446
9774
  */
9447
9775
  extractBufferReference(buffer, cursor, endCursor) {
9448
9776
  const expressID = stepExtractReference(buffer, cursor, endCursor);
9449
- const value = expressID !== void 0 ? this.model.getElementByExpressID(expressID) : this.model.getInlineElementByAddress(stepExtractInlineElemement(buffer, cursor, endCursor));
9777
+ const value = expressID !== void 0 ? this.model.getElementByExpressID(expressID) : this.model.getInlineElementByAddress(extractInlineElementAddress(buffer, cursor, endCursor));
9450
9778
  return value;
9451
9779
  }
9452
9780
  /**
@@ -9517,7 +9845,7 @@ var StepEntityBase = class {
9517
9845
  const [cursor, endCursor, buffer] = this.getOffsetAndEndCursor(offset, baseOffset, depth);
9518
9846
  const model2 = this.model;
9519
9847
  const expressID = stepExtractReference(buffer, cursor, endCursor);
9520
- const value = expressID !== void 0 ? model2.getTypedElementByExpressID(expressID, entityConstructor) : model2.getTypedInlineElementByAddress(stepExtractInlineElemement(buffer, cursor, endCursor), entityConstructor);
9848
+ const value = expressID !== void 0 ? model2.getTypedElementByExpressID(expressID, entityConstructor) : model2.getTypedInlineElementByAddress(extractInlineElementAddress(buffer, cursor, endCursor), entityConstructor);
9521
9849
  if (value === void 0) {
9522
9850
  if (!optional) {
9523
9851
  throw new Error("Value in STEP was incorrectly typed");
@@ -9546,7 +9874,7 @@ var StepEntityBase = class {
9546
9874
  extractBufferElement(buffer, cursor, endCursor, entityConstructor) {
9547
9875
  const model2 = this.model;
9548
9876
  const expressID = stepExtractReference(buffer, cursor, endCursor);
9549
- const value = expressID !== void 0 ? model2.getTypedElementByExpressID(expressID, entityConstructor) : model2.getTypedInlineElementByAddress(stepExtractInlineElemement(buffer, cursor, endCursor), entityConstructor);
9877
+ const value = expressID !== void 0 ? model2.getTypedElementByExpressID(expressID, entityConstructor) : model2.getTypedInlineElementByAddress(extractInlineElementAddress(buffer, cursor, endCursor), entityConstructor);
9550
9878
  if (value === void 0) {
9551
9879
  return;
9552
9880
  }
@@ -9589,7 +9917,7 @@ var StepEntityBase = class {
9589
9917
  if (offset >= internalReference.vtableCount) {
9590
9918
  throw new Error("Couldn't read field due to too few fields in record");
9591
9919
  }
9592
- const buffer = this.buffer;
9920
+ const buffer = internalReference.buffer;
9593
9921
  const vtableSlot = internalReference.vtableIndex + offset;
9594
9922
  const cursor = internalReference.vtable[vtableSlot];
9595
9923
  const nextSlot = vtableSlot + 1;
@@ -9725,8 +10053,8 @@ var StepEntityBase = class {
9725
10053
  if (!populated) {
9726
10054
  throw new Error("Entity does not have matching table entry to read from model");
9727
10055
  }
9728
- this.internalReference_.buffer = classReference.buffer;
9729
10056
  }
10057
+ this.internalReference_.buffer = classReference.buffer;
9730
10058
  return classReference;
9731
10059
  }
9732
10060
  const internalReference = this.internalReference_;
@@ -69714,7 +70042,7 @@ IfcStepParser.Instance = new IfcStepParser();
69714
70042
  var ifc_step_parser_default = IfcStepParser;
69715
70043
 
69716
70044
  // compiled/src/version/version.js
69717
- var versionString = "Conway Web-Ifc Shim v1.373.1180";
70045
+ var versionString = "Conway Web-Ifc Shim v1.374.1181";
69718
70046
 
69719
70047
  // compiled/src/statistics/statistics.js
69720
70048
  var Statistics = class {