/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{isTypedArray as e,isUint32Array as t,isUint16Array as r}from"../../../../../core/typedArrayUtil.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import{unpackInterleavedBuffer as s}from"../../../support/buffer/workerHelper.js";import{extract as i}from"./edgeProcessing.js";class a extends n{constructor(e){super("EdgeProcessingWorker","extract",{extract:e=>[e.dataBuffer],extractComponentsEdgeLocations:e=>[e.dataBuffer],extractEdgeLocations:e=>[e.dataBuffer]},e)}async process(e,t,r){if(r)return i(e);return o(await this.invoke(new c(e),t))}async extractEdgeLocations(e,t){const r=await this.invokeMethod("extractEdgeLocations",new c(e),t);return s(r)}async extractComponentsEdgeLocations(e,t){const r=await this.invokeMethod("extractComponentsEdgeLocations",new c(e),t);return s(r)}}function o(e){return{regular:{instancesData:s(e.regular.instancesData),lodInfo:{lengths:new Float32Array(e.regular.lodInfo.lengths)}},silhouette:{instancesData:s(e.silhouette.instancesData),lodInfo:{lengths:new Float32Array(e.silhouette.lodInfo.lengths)}},averageEdgeLength:e.averageEdgeLength}}class c{constructor(n){this.dataBuffer=n.data.buffer,this.writerSettings=n.writerSettings,this.skipDeduplicate=n.skipDeduplicate,this.indices=e(n.indices)?n.indices.buffer:n.indices,this.indicesType=e(n.indices)?t(n.indices)?"Uint32Array":r(n.indices)?"Uint16Array":"Uint8Array":"Array",this.indicesLength=n.indicesLength}}export{a as EdgeWorkerHandle,c as PackedInput};
