const BYTES_PER_FLOAT64=8;let memoryManager;export function setMemoryManager(manager){memoryManager=manager}let usingFinalizationRegistry=true;export function useFinalizationRegistry(use){usingFinalizationRegistry=use}const registry=global.FinalizationRegistry&&new FinalizationRegistry(([ptr,size])=>memoryManager.free(ptr,size));function register(arr){usingFinalizationRegistry&®istry?.register(arr,[arr.byteOffset,arr.length],arr)}function unregister(arr){usingFinalizationRegistry&®istry?.unregister(arr)}export class ManagedFloat64Array{constructor(byteOffset){this.byteOffset=byteOffset;register(this)}*[Symbol.iterator](){if(!this.valid){return}const view=memoryManager.view;const offset=this.byteOffset/BYTES_PER_FLOAT64|0;for(let i=0;i=this.length){return}return memoryManager.view[this.byteOffset/BYTES_PER_FLOAT64+index|0]}setAt(index,value){if(index<0||index>=this.length){return}memoryManager.view[this.byteOffset/BYTES_PER_FLOAT64+index|0]=value}copy(from,dstOffset=0,srcOffset=0,length=Math.min(from.length-srcOffset,this.length-dstOffset)){const start=from.byteOffset/BYTES_PER_FLOAT64+srcOffset|0;memoryManager.view.copyWithin(this.byteOffset/BYTES_PER_FLOAT64+dstOffset|0,start,start+length)}set(array,offset=0){memoryManager.view.set(array,this.byteOffset/BYTES_PER_FLOAT64+offset|0)}free(){if(this.byteOffset>0){memoryManager.free(this.byteOffset,this.length);unregister(this);this.byteOffset=-Infinity}}get buffer(){return memoryManager.buffer}get byteLength(){return this.length*BYTES_PER_FLOAT64}get valid(){return this.byteOffset>=0}} //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJCWVRFU19QRVJfRkxPQVQ2NCIsIm1lbW9yeU1hbmFnZXIiLCJzZXRNZW1vcnlNYW5hZ2VyIiwibWFuYWdlciIsInVzaW5nRmluYWxpemF0aW9uUmVnaXN0cnkiLCJ1c2VGaW5hbGl6YXRpb25SZWdpc3RyeSIsInVzZSIsInJlZ2lzdHJ5IiwiZ2xvYmFsIiwiRmluYWxpemF0aW9uUmVnaXN0cnkiLCJwdH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