import{g as f,s as E,aY as D}from"./index.6c049565.js";import{O as U}from"./VertexAttribute.42396f25.js";function V(){const e=new Float32Array(4);return e[3]=1,e}function Y(e){const t=new Float32Array(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function $(e,t,r,i){const o=new Float32Array(4);return o[0]=e,o[1]=t,o[2]=r,o[3]=i,o}function k(e,t){return new Float32Array(e,t,4)}Object.freeze(Object.defineProperty({__proto__:null,create:V,clone:Y,fromValues:$,createView:k},Symbol.toStringTag,{value:"Module"}));const d=!0,m={identifierOffset:0,identifierLength:10,versionOffset:10,checksumOffset:12,byteCount:16};function F(e,t,r){return{identifier:String.fromCharCode.apply(null,new Uint8Array(e,r+m.identifierOffset,m.identifierLength)),version:t.getUint16(r+m.versionOffset,d),checksum:t.getUint32(r+m.checksumOffset,d)}}const y={sizeLo:0,sizeHi:4,minX:8,minY:16,minZ:24,maxX:32,maxY:40,maxZ:48,errorX:56,errorY:64,errorZ:72,count:80,reserved:84,byteCount:88};function X(e,t){return{sizeLo:e.getUint32(t+y.sizeLo,d),sizeHi:e.getUint32(t+y.sizeHi,d),minX:e.getFloat64(t+y.minX,d),minY:e.getFloat64(t+y.minY,d),minZ:e.getFloat64(t+y.minZ,d),maxX:e.getFloat64(t+y.maxX,d),maxY:e.getFloat64(t+y.maxY,d),maxZ:e.getFloat64(t+y.maxZ,d),errorX:e.getFloat64(t+y.errorX,d),errorY:e.getFloat64(t+y.errorY,d),errorZ:e.getFloat64(t+y.errorZ,d),count:e.getUint32(t+y.count,d),reserved:e.getUint32(t+y.reserved,d)}}function Q(e){const t=new DataView(e,0);let r=0;const{identifier:i,version:o}=F(e,t,r);if(r+=m.byteCount,i!=="LEPCC ")throw new f("lepcc-decode-error","Bad identifier");if(o>1)throw new f("lepcc-decode-error","Unknown version");const n=X(t,r);if(r+=y.byteCount,n.sizeHi*2**32+n.sizeLo!==e.byteLength)throw new f("lepcc-decode-error","Bad size");const s=new Float64Array(3*n.count),u=[],c=[],a=[],l=[];if(r=A(e,r,u),r=A(e,r,c),r=A(e,r,a),r=A(e,r,l),r!==e.byteLength)throw new f("lepcc-decode-error","Bad length");let w=0,g=0;for(let b=0;b>6;let c=0;if(u===0)c=i.getUint32(1,d),t+=5;else if(u===1)c=i.getUint16(1,d),t+=3;else{if(u!==2)throw new f("lepcc-decode-error","Bad count type");c=i.getUint8(1),t+=2}if(s)throw new f("lepcc-decode-error","LUT not implemented");const a=Math.ceil(c*n/8),l=new Uint8Array(e,t,a);let w=0,g=0,b=0;const v=-1>>>32-n;for(let C=0;C>>=n,g-=n,g+n>32&&(w|=l[b-1]>>8-g)}return t+b}const h={sizeLo:0,sizeHi:4,count:8,colorMapCount:12,lookupMethod:14,compressionMethod:15,byteCount:16};function Z(e,t){return{sizeLo:e.getUint32(t+h.sizeLo,d),sizeHi:e.getUint32(t+h.sizeHi,d),count:e.getUint32(t+h.count,d),colorMapCount:e.getUint16(t+h.colorMapCount,d),lookupMethod:e.getUint8(t+h.lookupMethod),compressionMethod:e.getUint8(t+h.compressionMethod)}}function H(e){const t=new DataView(e,0);let r=0;const{identifier:i,version:o}=F(e,t,r);if(r+=m.byteCount,i!=="ClusterRGB")throw new f("lepcc-decode-error","Bad identifier");if(o>1)throw new f("lepcc-decode-error","Unknown version");const n=Z(t,r);if(r+=h.byteCount,n.sizeHi*2**32+n.sizeLo!==e.byteLength)throw new f("lepcc-decode-error","Bad size");if((n.lookupMethod===2||n.lookupMethod===1)&&n.compressionMethod===0){if(3*n.colorMapCount+n.count+r!==e.byteLength||n.colorMapCount>256)throw new f("lepcc-decode-error","Bad count");const s=new Uint8Array(e,r,3*n.colorMapCount),u=new Uint8Array(e,r+3*n.colorMapCount,n.count),c=new Uint8Array(3*n.count);for(let a=0;a1)throw new f("lepcc-decode-error","Unknown version");const n=j(t,r);if(r+=p.byteCount,n.sizeHi*2**32+n.sizeLo!==e.byteLength)throw new f("lepcc-decode-error","Bad size");const s=new Uint16Array(n.count);if(n.bitsPerPoint===8){if(n.count+r!==e.byteLength)throw new f("lepcc-decode-error","Bad size");const u=new Uint8Array(e,r,n.count);for(let c=0;c=192&&n<224){if(o+1>=r)throw new f("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const s=(31&n)<<6|63&e[t+o+1];i+=String.fromCharCode(s),o+=2}else if(n>=224&&n<240){if(o+2>=r)throw new f("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const s=(15&n)<<12|(63&e[t+o+1])<<6|63&e[t+o+2];i+=String.fromCharCode(s),o+=3}else{if(!(n>=240&&n<248))throw new f("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(o+3>=r)throw new f("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const s=(7&n)<<18|(63&e[t+o+1])<<12|(63&e[t+o+2])<<6|63&e[t+o+3];if(s>=65536){const u=55296+(s-65536>>10),c=56320+(1023&s);i+=String.fromCharCode(u,c)}else i+=String.fromCharCode(s);o+=4}}}return i}function T(e,t){const r={byteOffset:0,byteCount:0,fields:Object.create(null)};let i=0;for(let o=0;o0){if(i.push(R(r,s,o-1)),r[s+o-1]!==0)throw new f("string-array-error","Invalid string array: missing null termination.")}else i.push(null);s+=o}return i}function L(e,t){return new I[t.valueType](e,t.byteOffset,t.count*t.valuesPerElement)}function G(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function W(e,t,r){const i=t.header!=null?T(e,t.header):{byteOffset:0,byteCount:0,fields:{count:r}},o={header:i,byteOffset:i.byteCount,byteCount:0,entries:Object.create(null)};let n=i.byteCount;for(let s=0;snew DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function x(e){return I.hasOwnProperty(e)}function O(e){return x(e)?I[e].BYTES_PER_ELEMENT:0}export{te as I,Q as c,V as e,L as f,ee as g,Y as r};