/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../../chunks/_rollupPluginBabelHelpers","../Utils","./VertexBuffer","../util/Writer"],(function(t,e,r,n,s){"use strict";let o=function(){function t(t,e){this.data=t,this.stride=e}return t.prototype.transfer=function(t,e){const r=this.data.buffer();t.vertexCount=this.vertexCount,t.data=r,t.stride=this.stride,e.push(r)},e._createClass(t,[{key:"vertexCount",get:function(){const t=this.stride/4,e=this.data.length/t;return e!==(0|e)&&console.debug("Corrupted stride"),e}}]),t}(),i=function(){function t(t,e,n){this.geometryType=t,this.indexVector=new s(Uint32Array,6*e),this.namedVectors={};const i=r.getStrides(t,n);for(const r in i){const t=i[r];let n;switch(t%4){case 0:case 2:n=new s(Uint32Array,t*e);break;case 1:case 3:n=new s(Uint8Array,t*e)}this.namedVectors[r]=new o(n,t)}}var e=t.prototype;return e.get=function(t){return this.namedVectors[t].data},e.getVector=function(t){return this.namedVectors[t]},e.transfer=function(t,e){const r=this.indexVector.buffer(),n={};e.push(r);for(const s in this.namedVectors){const t=this.namedVectors[s];n[s]={},t.transfer(n[s],e)}t.geometryType=this.geometryType,t.indexBuffer=r,t.namedBuffers=n,this.destroy()},e.intoBuffers=function(){const t=n.VertexBuffers.fromVertexVectors(this);return this.destroy(),t},e.destroy=function(){this.indexVector=null,this.namedVectors=null},t}();t.VertexVector=o,t.VertexVectors=i,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
