@loaders.gl/draco
Advanced tools
Comparing version 4.0.0-alpha.23 to 4.0.0-alpha.24
@@ -1,4 +0,4 @@ | ||
(()=>{var bt=Object.create;var T=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var F=o=>T(o,"__esModule",{value:!0});var l=(o,t)=>()=>(o&&(t=o(o=0)),t);var k=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),_t=(o,t)=>{F(o);for(var e in t)T(o,e,{get:t[e],enumerable:!0})},Tt=(o,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of At(t))!Dt.call(o,r)&&r!=="default"&&T(o,r,{get:()=>t[r],enumerable:!(e=ht(t,r))||e.enumerable});return o},Ot=o=>Tt(F(T(o!=null?bt(gt(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var h,O=l(()=>{h=typeof __VERSION__!="undefined"?__VERSION__:"latest"});var Mt,x,W=l(()=>{O();Mt={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},x={name:"Draco",id:"draco",module:"draco",version:h,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Mt}});function z(o){switch(o.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var U=l(()=>{});function L(o){let t=1/0,e=1/0,r=1/0,a=-1/0,n=-1/0,i=-1/0,s=o.POSITION?o.POSITION.value:[],c=s&&s.length;for(let d=0;d<c;d+=3){let y=s[d],f=s[d+1],b=s[d+2];t=y<t?y:t,e=f<e?f:e,r=b<r?b:r,a=y>a?y:a,n=f>n?f:n,i=b>i?b:i}return[[t,e,r],[a,n,i]]}var v=l(()=>{});function C(o,t,e){let r=z(t.value),a=e||G(t);return{name:o,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:a}}function G(o){let t={};return"byteOffset"in o&&(t.byteOffset=o.byteOffset.toString(10)),"byteStride"in o&&(t.byteStride=o.byteStride.toString(10)),"normalized"in o&&(t.normalized=o.normalized.toString()),t}var j=l(()=>{U()});var S=l(()=>{v();j()});function q(o,t,e){let r=$(t.metadata),a=[],n=Et(t.attributes);for(let i in o){let s=o[i],c=V(i,s,n[i]);a.push(c)}if(e){let i=V("indices",e);a.push(i)}return{fields:a,metadata:r}}function Et(o){let t={};for(let e in o){let r=o[e];t[r.name||"undefined"]=r}return t}function V(o,t,e){let r=e?$(e.metadata):void 0;return C(o,t,r)}function $(o){Object.entries(o);let t={};for(let e in o)t[`${e}.string`]=JSON.stringify(o[e]);return t}var Q=l(()=>{S()});function Rt(o,t){switch(t){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32;default:return o.DT_INVALID}}function xt(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}function Lt(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}var X,wt,It,M,Y=l(()=>{S();Q();X={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},wt={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},It=4,M=class{constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);let a=this.decoder.GetEncodedGeometryType(r),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(a){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(r,n);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(r,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!n.ptr){let b=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(b)}let s=this._getDracoLoaderData(n,a,e),c=this._getMeshData(n,s,e),d=L(c.attributes),y=q(c.attributes,s,c.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:d},...c,schema:y}}finally{this.draco.destroy(r),n&&this.draco.destroy(n)}}_getDracoLoaderData(t,e,r){let a=this._getTopLevelMetadata(t),n=this._getDracoAttributes(t,r);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(t,e){let r={};for(let a=0;a<t.num_attributes();a++){let n=this.decoder.GetAttribute(t,a),i=this._getAttributeMetadata(t,a);r[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:i};let s=this._getQuantizationTransform(n,e);s&&(r[n.unique_id()].quantization_transform=s);let c=this._getOctahedronTransform(n,e);c&&(r[n.unique_id()].octahedron_transform=c)}return r}_getMeshData(t,e,r){let a=this._getMeshAttributes(e,t,r);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(t,e,r){let a={};for(let n of Object.values(t.attributes)){let i=this._deduceAttributeName(n,r);n.name=i;let{value:s,size:c}=this._getAttributeValues(e,n);a[i]={value:s,size:c,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(t){let r=t.num_faces()*3,a=r*It,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,r).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){let e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),Lt(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){let r=wt[e.data_type],a=e.num_components,i=t.num_points()*a,s=i*r.BYTES_PER_ELEMENT,c=Rt(this.draco,r),d,y=this.draco._malloc(s);try{let f=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,c,s,y),d=new r(this.draco.HEAPF32.buffer,y,i).slice()}finally{this.draco._free(y)}return{value:d,size:a}}_deduceAttributeName(t,e){let r=t.unique_id;for(let[i,s]of Object.entries(e.extraAttributes||{}))if(s===r)return i;let a=t.attribute_type;for(let i in X)if(this.draco[i]===a)return X[i];let n=e.attributeNameEntry||"name";return t.metadata[n]?t.metadata[n].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){let r=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let e={},r=this.metadataQuerier.NumEntries(t);for(let a=0;a<r;a++){let n=this.metadataQuerier.GetEntryName(t,a);e[n]=this._getDracoMetadataField(t,n)}return e}_getDracoMetadataField(t,e){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,r);let a=xt(r);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:a}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:e=[],octahedronAttributes:r=[]}=t,a=[...e,...r];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(t,e){let{quantizedAttributes:r=[]}=e,a=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(s=>i.min_value(s))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,e){let{octahedronAttributes:r=[]}=e,a=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}}});var Ct,B,H=l(()=>{Ct="beta",B=typeof __VERSION__!="undefined"?__VERSION__:Ct;typeof __VERSION__=="undefined"&&console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.")});function J(o,t){if(!o)throw new Error(t||"loaders.gl assertion failed.")}var K=l(()=>{});var p,ge,De,Z,_e,E,w,Te,tt,Oe,et=l(()=>{p={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},ge=p.self||p.window||p.global||{},De=p.window||p.self||p.global||{},Z=p.global||p.self||p.window||{},_e=p.document||{},E=typeof process!="object"||String(process)!=="[object process]"||process.browser,w=typeof importScripts=="function",Te=typeof window!="undefined"&&typeof window.orientation!="undefined",tt=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Oe=tt&&parseFloat(tt[1])||0});var rt=k(()=>{});async function A(o,t=null,e={},r=null){return t&&(o=ot(o,t,e,r)),N[o]=N[o]||Nt(o),await N[o]}function ot(o,t,e={},r=null){if(!e.useLocalLibraries&&o.startsWith("http"))return o;r=r||o;let a=e.modules||{};return a[r]?a[r]:E?e.CDN?(J(e.CDN.startsWith("http")),`${e.CDN}/${t}@${Bt}/dist/libs/${r}`):w?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function Nt(o){if(o.endsWith("wasm"))return await Ft(o);if(!E)try{return m&&m.requireFromFile&&await m.requireFromFile(o)}catch{return null}if(w)return importScripts(o);let t=await kt(o);return Pt(t,o)}function Pt(o,t){if(!E)return m.requireFromString&&m.requireFromString(o,t);if(w)return eval.call(Z,o),null;let e=document.createElement("script");e.id=t;try{e.appendChild(document.createTextNode(o))}catch{e.text=o}return document.body.appendChild(e),null}async function Ft(o){return!m.readFileAsArrayBuffer||o.startsWith("http")?await(await fetch(o)).arrayBuffer():await m.readFileAsArrayBuffer(o)}async function kt(o){return!m.readFileAsText||o.startsWith("http")?await(await fetch(o)).text():await m.readFileAsText(o)}var m,St,Bt,N,at=l(()=>{et();m=Ot(rt());K();H();St="beta",Bt=typeof B!="undefined"?B:St,N={}});var nt=l(()=>{at()});async function it(o){let t=o.modules||{};return t.draco3d?D=D||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):D=D||Ut(o),await D}async function st(o){let t=o.modules||{};return t.draco3d?_=_||t.draco3d.createEncoderModule({}).then(e=>({draco:e})):_=_||Gt(o),await _}async function Ut(o){let t,e;switch(o.draco&&o.draco.decoderType){case"js":t=await A(g[u.FALLBACK_DECODER],"draco",o,u.FALLBACK_DECODER);break;case"wasm":default:[t,e]=await Promise.all([await A(g[u.DECODER],"draco",o,u.DECODER),await A(g[u.DECODER_WASM],"draco",o,u.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await vt(t,e)}function vt(o,t){let e={};return t&&(e.wasmBinary=t),new Promise(r=>{o({...e,onModuleLoaded:a=>r({draco:a})})})}async function Gt(o){let t=await A(g[u.ENCODER],"draco",o,u.ENCODER);return t=t||globalThis.DracoEncoderModule,new Promise(e=>{t({onModuleLoaded:r=>e({draco:r})})})}var Wt,zt,P,u,g,D,_,I=l(()=>{nt();Wt="1.5.5",zt="1.4.1",P=`https://www.gstatic.com/draco/versioned/decoders/${Wt}`,u={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},g={[u.DECODER]:`${P}/${u.DECODER}`,[u.DECODER_WASM]:`${P}/${u.DECODER_WASM}`,[u.FALLBACK_DECODER]:`${P}/${u.FALLBACK_DECODER}`,[u.ENCODER]:`https://raw.githubusercontent.com/google/draco/${zt}/javascript/${u.ENCODER}`}});function dt(o){let t=o.size(),e=new ArrayBuffer(t),r=new Int8Array(e);for(let a=0;a<t;++a)r[a]=o.GetValue(a);return e}function qt(o){return o.entries&&!o.hasOwnProperty("entries")?o.entries():Object.entries(o)}var ct,jt,R,ut=l(()=>{ct={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},jt=()=>{},R=class{constructor(t){this.draco=t,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(t){t&&this.draco.destroy(t)}encodeSync(t,e={}){return this.log=jt,this._setOptions(e),e.pointcloud?this._encodePointCloud(t,e):this._encodeMesh(t,e)}_getAttributesFromMesh(t){let e={...t,...t.attributes};return t.indices&&(e.indices=t.indices),e}_encodePointCloud(t,e){let r=new this.draco.PointCloud;e.metadata&&this._addGeometryMetadata(r,e.metadata);let a=this._getAttributesFromMesh(t);this._createDracoPointCloud(r,a,e);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(r,!1,n);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${r.num_points()} points | ||
(()=>{var bt=Object.create;var T=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var F=o=>T(o,"__esModule",{value:!0});var l=(o,t)=>()=>(o&&(t=o(o=0)),t);var k=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),_t=(o,t)=>{F(o);for(var e in t)T(o,e,{get:t[e],enumerable:!0})},Tt=(o,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of At(t))!Dt.call(o,r)&&r!=="default"&&T(o,r,{get:()=>t[r],enumerable:!(e=ht(t,r))||e.enumerable});return o},Ot=o=>Tt(F(T(o!=null?bt(gt(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var h,O=l(()=>{h=typeof __VERSION__!="undefined"?__VERSION__:"latest"});var Mt,x,W=l(()=>{O();Mt={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},x={name:"Draco",id:"draco",module:"draco",version:h,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Mt}});function z(o){switch(o.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var U=l(()=>{});function L(o){let t=1/0,e=1/0,r=1/0,a=-1/0,n=-1/0,i=-1/0,s=o.POSITION?o.POSITION.value:[],c=s&&s.length;for(let d=0;d<c;d+=3){let y=s[d],f=s[d+1],b=s[d+2];t=y<t?y:t,e=f<e?f:e,r=b<r?b:r,a=y>a?y:a,n=f>n?f:n,i=b>i?b:i}return[[t,e,r],[a,n,i]]}var v=l(()=>{});function C(o,t,e){let r=z(t.value),a=e||G(t);return{name:o,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:a}}function G(o){let t={};return"byteOffset"in o&&(t.byteOffset=o.byteOffset.toString(10)),"byteStride"in o&&(t.byteStride=o.byteStride.toString(10)),"normalized"in o&&(t.normalized=o.normalized.toString()),t}var j=l(()=>{U()});var B=l(()=>{v();j()});function q(o,t,e){let r=$(t.metadata),a=[],n=Et(t.attributes);for(let i in o){let s=o[i],c=V(i,s,n[i]);a.push(c)}if(e){let i=V("indices",e);a.push(i)}return{fields:a,metadata:r}}function Et(o){let t={};for(let e in o){let r=o[e];t[r.name||"undefined"]=r}return t}function V(o,t,e){let r=e?$(e.metadata):void 0;return C(o,t,r)}function $(o){Object.entries(o);let t={};for(let e in o)t[`${e}.string`]=JSON.stringify(o[e]);return t}var Q=l(()=>{B()});function Rt(o,t){switch(t){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32;default:return o.DT_INVALID}}function xt(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}function Lt(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}var X,wt,It,M,Y=l(()=>{B();Q();X={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},wt={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},It=4,M=class{constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);let a=this.decoder.GetEncodedGeometryType(r),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(a){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(r,n);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(r,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!n.ptr){let b=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(b)}let s=this._getDracoLoaderData(n,a,e),c=this._getMeshData(n,s,e),d=L(c.attributes),y=q(c.attributes,s,c.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:d},...c,schema:y}}finally{this.draco.destroy(r),n&&this.draco.destroy(n)}}_getDracoLoaderData(t,e,r){let a=this._getTopLevelMetadata(t),n=this._getDracoAttributes(t,r);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(t,e){let r={};for(let a=0;a<t.num_attributes();a++){let n=this.decoder.GetAttribute(t,a),i=this._getAttributeMetadata(t,a);r[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:i};let s=this._getQuantizationTransform(n,e);s&&(r[n.unique_id()].quantization_transform=s);let c=this._getOctahedronTransform(n,e);c&&(r[n.unique_id()].octahedron_transform=c)}return r}_getMeshData(t,e,r){let a=this._getMeshAttributes(e,t,r);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(t,e,r){let a={};for(let n of Object.values(t.attributes)){let i=this._deduceAttributeName(n,r);n.name=i;let{value:s,size:c}=this._getAttributeValues(e,n);a[i]={value:s,size:c,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(t){let r=t.num_faces()*3,a=r*It,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,r).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){let e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),Lt(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){let r=wt[e.data_type],a=e.num_components,i=t.num_points()*a,s=i*r.BYTES_PER_ELEMENT,c=Rt(this.draco,r),d,y=this.draco._malloc(s);try{let f=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,c,s,y),d=new r(this.draco.HEAPF32.buffer,y,i).slice()}finally{this.draco._free(y)}return{value:d,size:a}}_deduceAttributeName(t,e){let r=t.unique_id;for(let[i,s]of Object.entries(e.extraAttributes||{}))if(s===r)return i;let a=t.attribute_type;for(let i in X)if(this.draco[i]===a)return X[i];let n=e.attributeNameEntry||"name";return t.metadata[n]?t.metadata[n].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){let r=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let e={},r=this.metadataQuerier.NumEntries(t);for(let a=0;a<r;a++){let n=this.metadataQuerier.GetEntryName(t,a);e[n]=this._getDracoMetadataField(t,n)}return e}_getDracoMetadataField(t,e){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,r);let a=xt(r);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:a}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:e=[],octahedronAttributes:r=[]}=t,a=[...e,...r];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(t,e){let{quantizedAttributes:r=[]}=e,a=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(s=>i.min_value(s))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,e){let{octahedronAttributes:r=[]}=e,a=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}}});var Ct,S,H=l(()=>{Ct="beta",S=typeof __VERSION__!="undefined"?__VERSION__:Ct;typeof __VERSION__=="undefined"&&console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.")});function J(o,t){if(!o)throw new Error(t||"loaders.gl assertion failed.")}var K=l(()=>{});var p,ge,De,Z,_e,E,w,Te,tt,Oe,et=l(()=>{p={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},ge=p.self||p.window||p.global||{},De=p.window||p.self||p.global||{},Z=p.global||p.self||p.window||{},_e=p.document||{},E=typeof process!="object"||String(process)!=="[object process]"||process.browser,w=typeof importScripts=="function",Te=typeof window!="undefined"&&typeof window.orientation!="undefined",tt=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Oe=tt&&parseFloat(tt[1])||0});var rt=k(()=>{});async function A(o,t=null,e={},r=null){return t&&(o=ot(o,t,e,r)),N[o]=N[o]||Nt(o),await N[o]}function ot(o,t,e={},r=null){if(!e.useLocalLibraries&&o.startsWith("http"))return o;r=r||o;let a=e.modules||{};return a[r]?a[r]:E?e.CDN?(J(e.CDN.startsWith("http")),`${e.CDN}/${t}@${St}/dist/libs/${r}`):w?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function Nt(o){if(o.endsWith("wasm"))return await Ft(o);if(!E)try{return m&&m.requireFromFile&&await m.requireFromFile(o)}catch{return null}if(w)return importScripts(o);let t=await kt(o);return Pt(t,o)}function Pt(o,t){if(!E)return m.requireFromString&&m.requireFromString(o,t);if(w)return eval.call(Z,o),null;let e=document.createElement("script");e.id=t;try{e.appendChild(document.createTextNode(o))}catch{e.text=o}return document.body.appendChild(e),null}async function Ft(o){return!m.readFileAsArrayBuffer||o.startsWith("http")?await(await fetch(o)).arrayBuffer():await m.readFileAsArrayBuffer(o)}async function kt(o){return!m.readFileAsText||o.startsWith("http")?await(await fetch(o)).text():await m.readFileAsText(o)}var m,Bt,St,N,at=l(()=>{et();m=Ot(rt());K();H();Bt="beta",St=typeof S!="undefined"?S:Bt,N={}});var nt=l(()=>{at()});async function it(o){let t=o.modules||{};return t.draco3d?D=D||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):D=D||Ut(o),await D}async function st(o){let t=o.modules||{};return t.draco3d?_=_||t.draco3d.createEncoderModule({}).then(e=>({draco:e})):_=_||Gt(o),await _}async function Ut(o){let t,e;switch(o.draco&&o.draco.decoderType){case"js":t=await A(g[u.FALLBACK_DECODER],"draco",o,u.FALLBACK_DECODER);break;case"wasm":default:[t,e]=await Promise.all([await A(g[u.DECODER],"draco",o,u.DECODER),await A(g[u.DECODER_WASM],"draco",o,u.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await vt(t,e)}function vt(o,t){let e={};return t&&(e.wasmBinary=t),new Promise(r=>{o({...e,onModuleLoaded:a=>r({draco:a})})})}async function Gt(o){let t=await A(g[u.ENCODER],"draco",o,u.ENCODER);return t=t||globalThis.DracoEncoderModule,new Promise(e=>{t({onModuleLoaded:r=>e({draco:r})})})}var Wt,zt,P,u,g,D,_,I=l(()=>{nt();Wt="1.5.6",zt="1.4.1",P=`https://www.gstatic.com/draco/versioned/decoders/${Wt}`,u={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},g={[u.DECODER]:`${P}/${u.DECODER}`,[u.DECODER_WASM]:`${P}/${u.DECODER_WASM}`,[u.FALLBACK_DECODER]:`${P}/${u.FALLBACK_DECODER}`,[u.ENCODER]:`https://raw.githubusercontent.com/google/draco/${zt}/javascript/${u.ENCODER}`}});function dt(o){let t=o.size(),e=new ArrayBuffer(t),r=new Int8Array(e);for(let a=0;a<t;++a)r[a]=o.GetValue(a);return e}function qt(o){return o.entries&&!o.hasOwnProperty("entries")?o.entries():Object.entries(o)}var ct,jt,R,ut=l(()=>{ct={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},jt=()=>{},R=class{constructor(t){this.draco=t,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(t){t&&this.draco.destroy(t)}encodeSync(t,e={}){return this.log=jt,this._setOptions(e),e.pointcloud?this._encodePointCloud(t,e):this._encodeMesh(t,e)}_getAttributesFromMesh(t){let e={...t,...t.attributes};return t.indices&&(e.indices=t.indices),e}_encodePointCloud(t,e){let r=new this.draco.PointCloud;e.metadata&&this._addGeometryMetadata(r,e.metadata);let a=this._getAttributesFromMesh(t);this._createDracoPointCloud(r,a,e);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(r,!1,n);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${r.num_points()} points | ||
with ${r.num_attributes()} attributes into ${i} bytes`),dt(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(r)}}_encodeMesh(t,e){let r=new this.draco.Mesh;e.metadata&&this._addGeometryMetadata(r,e.metadata);let a=this._getAttributesFromMesh(t);this._createDracoMesh(r,a,e);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodeMeshToDracoBuffer(r,n);if(i<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${r.num_points()} points | ||
with ${r.num_attributes()} attributes into ${i} bytes`),dt(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(r)}}_setOptions(t){if("speed"in t&&this.dracoEncoder.SetSpeedOptions(...t.speed),"method"in t){let e=this.draco[t.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(e)}if("quantization"in t)for(let e in t.quantization){let r=t.quantization[e],a=this.draco[e];this.dracoEncoder.SetAttributeQuantization(a,r)}}_createDracoMesh(t,e,r){let a=r.attributesMetadata||{};try{let n=this._getPositionAttribute(e);if(!n)throw new Error("positions");let i=n.length/3;for(let s in e){let c=e[s];s=ct[s]||s;let d=this._addAttributeToMesh(t,s,c,i);d!==-1&&this._addAttributeMetadata(t,d,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(t),n}return t}_createDracoPointCloud(t,e,r){let a=r.attributesMetadata||{};try{let n=this._getPositionAttribute(e);if(!n)throw new Error("positions");let i=n.length/3;for(let s in e){let c=e[s];s=ct[s]||s;let d=this._addAttributeToMesh(t,s,c,i);d!==-1&&this._addAttributeMetadata(t,d,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(t),n}return t}_addAttributeToMesh(t,e,r,a){if(!ArrayBuffer.isView(r))return-1;let n=this._getDracoAttributeType(e),i=r.length/a;if(n==="indices"){let d=r.length/3;return this.log(`Adding attribute ${e}, size ${d}`),this.dracoMeshBuilder.AddFacesToMesh(t,d,r),-1}this.log(`Adding attribute ${e}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:c}=r;switch(r.constructor){case Int8Array:return s.AddInt8Attribute(t,n,a,i,new Int8Array(c));case Int16Array:return s.AddInt16Attribute(t,n,a,i,new Int16Array(c));case Int32Array:return s.AddInt32Attribute(t,n,a,i,new Int32Array(c));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(t,n,a,i,new Uint8Array(c));case Uint16Array:return s.AddUInt16Attribute(t,n,a,i,new Uint16Array(c));case Uint32Array:return s.AddUInt32Attribute(t,n,a,i,new Uint32Array(c));case Float32Array:default:return s.AddFloatAttribute(t,n,a,i,new Float32Array(c))}}_getDracoAttributeType(t){switch(t.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(t){for(let e in t){let r=t[e];if(this._getDracoAttributeType(e)===this.draco.POSITION)return r}return null}_addGeometryMetadata(t,e){let r=new this.draco.Metadata;this._populateDracoMetadata(r,e),this.dracoMeshBuilder.AddMetadata(t,r)}_addAttributeMetadata(t,e,r){let a=new this.draco.Metadata;this._populateDracoMetadata(a,r),this.dracoMeshBuilder.SetMetadataForAttribute(t,e,a)}_populateDracoMetadata(t,e){for(let[r,a]of qt(e))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(t,r,a):this.dracoMetadataBuilder.AddDoubleEntry(t,r,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(t,r,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(t,r,a)}}}});async function $t(o,t={}){let{draco:e}=await st(t),r=new R(e);try{return r.encodeSync(o,t.draco)}finally{r.destroy()}}var Vt,lt,yt=l(()=>{ut();I();O();Vt={pointcloud:!1,attributeNameEntry:"name"},lt={name:"DRACO",id:"draco",module:"draco",version:h,extensions:["drc"],encode:$t,options:{draco:Vt}}});var pt={};_t(pt,{DRACO_EXTERNAL_LIBRARIES:()=>u,DRACO_EXTERNAL_LIBRARY_URLS:()=>g,DracoLoader:()=>Xt,DracoWorkerLoader:()=>x,DracoWriter:()=>lt,DracoWriterWorker:()=>Qt});async function Yt(o,t){let{draco:e}=await it(t),r=new M(e);try{return r.parseSync(o,t?.draco)}finally{r.destroy()}}var Qt,Xt,mt=l(()=>{W();Y();I();O();I();yt();Qt={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:h,worker:!0,options:{draco:{},source:null}},Xt={...x,parse:Yt}});var Jt=k(($e,ft)=>{var Ht=(mt(),pt);globalThis.loaders=globalThis.loaders||{};ft.exports=Object.assign(globalThis.loaders,Ht)});Jt();})(); | ||
//# sourceMappingURL=dist.min.js.map |
@@ -1,2 +0,2 @@ | ||
(()=>{var X=Object.create;var w=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=t=>w(t,"__esModule",{value:!0});var te=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var re=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of H(e))!Z.call(t,o)&&o!=="default"&&w(t,o,{get:()=>e[o],enumerable:!(r=J(e,o))||r.enumerable});return t},oe=t=>re(ee(w(t!=null?X(K(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var N=te(()=>{});var x="4.0.0-alpha.23";function S(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var f={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Ie=f.self||f.window||f.global||{},Re=f.window||f.self||f.global||{},F=f.global||f.self||f.window||{},Pe=f.document||{};var D=typeof process!="object"||String(process)!=="[object process]"||process.browser,T=typeof importScripts=="function",ke=typeof window!="undefined"&&typeof window.orientation!="undefined",C=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Se=C&&parseFloat(C[1])||0;function M(t,e=!0,r){let o=r||new Set;if(t){if(B(t))o.add(t);else if(B(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)M(t[a],e,o)}}return r===void 0?Array.from(o):[]}function B(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function b(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var O=new Map,p=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(b())}static set onmessage(e){function r(a){let s=b(),{type:n,payload:i}=s?a:a.data;e(n,i)}let o=b();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=O.get(e);r||(r=a=>{if(!ae(a))return;let s=b(),{type:n,payload:i}=s?a:a.data;e(n,i)}),b()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=O.get(e);O.delete(e),b()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=M(r),s=b();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function ae(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var y=oe(N());var se="beta",ne=typeof x!="undefined"?x:se,E={};async function h(t,e=null,r={},o=null){return e&&(t=W(t,e,r,o)),E[t]=E[t]||ie(t),await E[t]}function W(t,e,r={},o=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;o=o||t;let a=r.modules||{};return a[o]?a[o]:D?r.CDN?(S(r.CDN.startsWith("http")),`${r.CDN}/${e}@${ne}/dist/libs/${o}`):T?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function ie(t){if(t.endsWith("wasm"))return await ce(t);if(!D)try{return y&&y.requireFromFile&&await y.requireFromFile(t)}catch{return null}if(T)return importScripts(t);let e=await de(t);return le(e,t)}function le(t,e){if(!D)return y.requireFromString&&y.requireFromString(t,e);if(T)return eval.call(F,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function ce(t){return!y.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await y.readFileAsArrayBuffer(t)}async function de(t){return!y.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await y.readFileAsText(t)}var ue=0;function L(t){!p.inWorkerThread()||(p.onmessage=async(e,r)=>{switch(e){case"process":try{let{input:o,options:a={},context:s={}}=r,n=await fe({loader:t,arrayBuffer:o,options:a,context:{...s,_parse:pe}});p.postMessage("done",{result:n})}catch(o){let a=o instanceof Error?o.message:"";p.postMessage("error",{error:a})}break;default:}})}function pe(t,e,r,o){return new Promise((a,s)=>{let n=ue++,i=(u,c)=>{if(c.id===n)switch(u){case"done":p.removeEventListener(i),a(c.result);break;case"error":p.removeEventListener(i),s(c.error);break;default:}};p.addEventListener(i);let l={id:n,input:t,options:r};p.postMessage("process",l)})}async function fe({loader:t,arrayBuffer:e,options:r,context:o}){let a,s;if(t.parseSync||t.parse)a=e,s=t.parseSync||t.parse;else if(t.parseTextSync)a=new TextDecoder().decode(e),s=t.parseTextSync;else throw new Error(`Could not load data with ${t.name} loader`);return r={...r,modules:t&&t.options&&t.options.modules||{},worker:!1},await s(a,{...r},o,t)}var v="4.0.0-alpha.23";var ye={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},z={name:"Draco",id:"draco",module:"draco",version:v,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:ye};function V(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function I(t){let e=1/0,r=1/0,o=1/0,a=-1/0,s=-1/0,n=-1/0,i=t.POSITION?t.POSITION.value:[],l=i&&i.length;for(let u=0;u<l;u+=3){let c=i[u],m=i[u+1],g=i[u+2];e=c<e?c:e,r=m<r?m:r,o=g<o?g:o,a=c>a?c:a,s=m>s?m:s,n=g>n?g:n}return[[e,r,o],[a,s,n]]}function R(t,e,r){let o=V(e.value),a=r||U(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function U(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function q(t,e,r){let o=$(e.metadata),a=[],s=me(e.attributes);for(let n in t){let i=t[n],l=G(n,i,s[n]);a.push(l)}if(r){let n=G("indices",r);a.push(n)}return{fields:a,metadata:o}}function me(t){let e={};for(let r in t){let o=t[r];e[o.name||"undefined"]=o}return e}function G(t,e,r){let o=r?$(r.metadata):void 0;return R(t,e,o)}function $(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var Q={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},be={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},ge=4,_=class{constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,r={}){let o=new this.draco.DecoderBuffer;o.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let a=this.decoder.GetEncodedGeometryType(o),s=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let n;switch(a){case this.draco.TRIANGULAR_MESH:n=this.decoder.DecodeBufferToMesh(o,s);break;case this.draco.POINT_CLOUD:n=this.decoder.DecodeBufferToPointCloud(o,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!n.ok()||!s.ptr){let g=`DRACO decompression failed: ${n.error_msg()}`;throw new Error(g)}let i=this._getDracoLoaderData(s,a,r),l=this._getMeshData(s,i,r),u=I(l.attributes),c=q(l.attributes,i,l.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:u},...l,schema:c}}finally{this.draco.destroy(o),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,r,o){let a=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,o);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:a,attributes:s}}_getDracoAttributes(e,r){let o={};for(let a=0;a<e.num_attributes();a++){let s=this.decoder.GetAttribute(e,a),n=this._getAttributeMetadata(e,a);o[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:a,metadata:n};let i=this._getQuantizationTransform(s,r);i&&(o[s.unique_id()].quantization_transform=i);let l=this._getOctahedronTransform(s,r);l&&(o[s.unique_id()].octahedron_transform=l)}return o}_getMeshData(e,r,o){let a=this._getMeshAttributes(r,e,o);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(o.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(e,r,o){let a={};for(let s of Object.values(e.attributes)){let n=this._deduceAttributeName(s,o);s.name=n;let{value:i,size:l}=this._getAttributeValues(r,s);a[n]={value:i,size:l,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return a}_getTriangleListIndices(e){let o=e.num_faces()*3,a=o*ge,s=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(e,a,s),new Uint32Array(this.draco.HEAPF32.buffer,s,o).slice()}finally{this.draco._free(s)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),De(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let o=be[r.data_type],a=r.num_components,n=e.num_points()*a,i=n*o.BYTES_PER_ELEMENT,l=he(this.draco,o),u,c=this.draco._malloc(i);try{let m=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,m,l,i,c),u=new o(this.draco.HEAPF32.buffer,c,n).slice()}finally{this.draco._free(c)}return{value:u,size:a}}_deduceAttributeName(e,r){let o=e.unique_id;for(let[n,i]of Object.entries(r.extraAttributes||{}))if(i===o)return n;let a=e.attribute_type;for(let n in Q)if(this.draco[n]===a)return Q[n];let s=r.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:`CUSTOM_ATTRIBUTE_${o}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let o=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(o)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},o=this.metadataQuerier.NumEntries(e);for(let a=0;a<o;a++){let s=this.metadataQuerier.GetEntryName(e,a);r[s]=this._getDracoMetadataField(e,s)}return r}_getDracoMetadataField(e,r){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,o);let a=Ae(o);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:a}}finally{this.draco.destroy(o)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:o=[]}=e,a=[...r,...o];for(let s of a)this.decoder.SkipAttributeTransform(this.draco[s])}_getQuantizationTransform(e,r){let{quantizedAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits(),range:n.range(),min_values:new Float32Array([1,2,3]).map(i=>n.min_value(i))}}finally{this.draco.destroy(n)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits()}}finally{this.draco.destroy(n)}}return null}};function he(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function Ae(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}function De(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}var Te="1.5.5",_e="1.4.1",P=`https://www.gstatic.com/draco/versioned/decoders/${Te}`,d={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},k={[d.DECODER]:`${P}/${d.DECODER}`,[d.DECODER_WASM]:`${P}/${d.DECODER_WASM}`,[d.FALLBACK_DECODER]:`${P}/${d.FALLBACK_DECODER}`,[d.ENCODER]:`https://raw.githubusercontent.com/google/draco/${_e}/javascript/${d.ENCODER}`},A;async function j(t){let e=t.modules||{};return e.draco3d?A=A||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):A=A||we(t),await A}async function we(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await h(k[d.FALLBACK_DECODER],"draco",t,d.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await h(k[d.DECODER],"draco",t,d.DECODER),await h(k[d.DECODER_WASM],"draco",t,d.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await xe(e,r)}function xe(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(o=>{t({...r,onModuleLoaded:a=>o({draco:a})})})}var Y={...z,parse:Me};async function Me(t,e){let{draco:r}=await j(e),o=new _(r);try{return o.parseSync(t,e?.draco)}finally{o.destroy()}}L(Y);})(); | ||
(()=>{var X=Object.create;var w=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=t=>w(t,"__esModule",{value:!0});var te=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var re=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of H(e))!Z.call(t,o)&&o!=="default"&&w(t,o,{get:()=>e[o],enumerable:!(r=J(e,o))||r.enumerable});return t},oe=t=>re(ee(w(t!=null?X(K(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var N=te(()=>{});var x="4.0.0-alpha.24";function S(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var f={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Ie=f.self||f.window||f.global||{},Re=f.window||f.self||f.global||{},F=f.global||f.self||f.window||{},Pe=f.document||{};var D=typeof process!="object"||String(process)!=="[object process]"||process.browser,T=typeof importScripts=="function",ke=typeof window!="undefined"&&typeof window.orientation!="undefined",C=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Se=C&&parseFloat(C[1])||0;function M(t,e=!0,r){let o=r||new Set;if(t){if(B(t))o.add(t);else if(B(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)M(t[a],e,o)}}return r===void 0?Array.from(o):[]}function B(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function b(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var O=new Map,p=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(b())}static set onmessage(e){function r(a){let s=b(),{type:n,payload:i}=s?a:a.data;e(n,i)}let o=b();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=O.get(e);r||(r=a=>{if(!ae(a))return;let s=b(),{type:n,payload:i}=s?a:a.data;e(n,i)}),b()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=O.get(e);O.delete(e),b()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=M(r),s=b();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function ae(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var y=oe(N());var se="beta",ne=typeof x!="undefined"?x:se,E={};async function h(t,e=null,r={},o=null){return e&&(t=W(t,e,r,o)),E[t]=E[t]||ie(t),await E[t]}function W(t,e,r={},o=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;o=o||t;let a=r.modules||{};return a[o]?a[o]:D?r.CDN?(S(r.CDN.startsWith("http")),`${r.CDN}/${e}@${ne}/dist/libs/${o}`):T?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function ie(t){if(t.endsWith("wasm"))return await ce(t);if(!D)try{return y&&y.requireFromFile&&await y.requireFromFile(t)}catch{return null}if(T)return importScripts(t);let e=await de(t);return le(e,t)}function le(t,e){if(!D)return y.requireFromString&&y.requireFromString(t,e);if(T)return eval.call(F,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function ce(t){return!y.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await y.readFileAsArrayBuffer(t)}async function de(t){return!y.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await y.readFileAsText(t)}var ue=0;function L(t){!p.inWorkerThread()||(p.onmessage=async(e,r)=>{switch(e){case"process":try{let{input:o,options:a={},context:s={}}=r,n=await fe({loader:t,arrayBuffer:o,options:a,context:{...s,_parse:pe}});p.postMessage("done",{result:n})}catch(o){let a=o instanceof Error?o.message:"";p.postMessage("error",{error:a})}break;default:}})}function pe(t,e,r,o){return new Promise((a,s)=>{let n=ue++,i=(u,c)=>{if(c.id===n)switch(u){case"done":p.removeEventListener(i),a(c.result);break;case"error":p.removeEventListener(i),s(c.error);break;default:}};p.addEventListener(i);let l={id:n,input:t,options:r};p.postMessage("process",l)})}async function fe({loader:t,arrayBuffer:e,options:r,context:o}){let a,s;if(t.parseSync||t.parse)a=e,s=t.parseSync||t.parse;else if(t.parseTextSync)a=new TextDecoder().decode(e),s=t.parseTextSync;else throw new Error(`Could not load data with ${t.name} loader`);return r={...r,modules:t&&t.options&&t.options.modules||{},worker:!1},await s(a,{...r},o,t)}var v="4.0.0-alpha.24";var ye={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},z={name:"Draco",id:"draco",module:"draco",version:v,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:ye};function V(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function I(t){let e=1/0,r=1/0,o=1/0,a=-1/0,s=-1/0,n=-1/0,i=t.POSITION?t.POSITION.value:[],l=i&&i.length;for(let u=0;u<l;u+=3){let c=i[u],m=i[u+1],g=i[u+2];e=c<e?c:e,r=m<r?m:r,o=g<o?g:o,a=c>a?c:a,s=m>s?m:s,n=g>n?g:n}return[[e,r,o],[a,s,n]]}function R(t,e,r){let o=V(e.value),a=r||U(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function U(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function q(t,e,r){let o=$(e.metadata),a=[],s=me(e.attributes);for(let n in t){let i=t[n],l=G(n,i,s[n]);a.push(l)}if(r){let n=G("indices",r);a.push(n)}return{fields:a,metadata:o}}function me(t){let e={};for(let r in t){let o=t[r];e[o.name||"undefined"]=o}return e}function G(t,e,r){let o=r?$(r.metadata):void 0;return R(t,e,o)}function $(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var Q={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},be={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},ge=4,_=class{constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,r={}){let o=new this.draco.DecoderBuffer;o.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let a=this.decoder.GetEncodedGeometryType(o),s=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let n;switch(a){case this.draco.TRIANGULAR_MESH:n=this.decoder.DecodeBufferToMesh(o,s);break;case this.draco.POINT_CLOUD:n=this.decoder.DecodeBufferToPointCloud(o,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!n.ok()||!s.ptr){let g=`DRACO decompression failed: ${n.error_msg()}`;throw new Error(g)}let i=this._getDracoLoaderData(s,a,r),l=this._getMeshData(s,i,r),u=I(l.attributes),c=q(l.attributes,i,l.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:u},...l,schema:c}}finally{this.draco.destroy(o),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,r,o){let a=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,o);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:a,attributes:s}}_getDracoAttributes(e,r){let o={};for(let a=0;a<e.num_attributes();a++){let s=this.decoder.GetAttribute(e,a),n=this._getAttributeMetadata(e,a);o[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:a,metadata:n};let i=this._getQuantizationTransform(s,r);i&&(o[s.unique_id()].quantization_transform=i);let l=this._getOctahedronTransform(s,r);l&&(o[s.unique_id()].octahedron_transform=l)}return o}_getMeshData(e,r,o){let a=this._getMeshAttributes(r,e,o);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(o.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(e,r,o){let a={};for(let s of Object.values(e.attributes)){let n=this._deduceAttributeName(s,o);s.name=n;let{value:i,size:l}=this._getAttributeValues(r,s);a[n]={value:i,size:l,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return a}_getTriangleListIndices(e){let o=e.num_faces()*3,a=o*ge,s=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(e,a,s),new Uint32Array(this.draco.HEAPF32.buffer,s,o).slice()}finally{this.draco._free(s)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),De(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let o=be[r.data_type],a=r.num_components,n=e.num_points()*a,i=n*o.BYTES_PER_ELEMENT,l=he(this.draco,o),u,c=this.draco._malloc(i);try{let m=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,m,l,i,c),u=new o(this.draco.HEAPF32.buffer,c,n).slice()}finally{this.draco._free(c)}return{value:u,size:a}}_deduceAttributeName(e,r){let o=e.unique_id;for(let[n,i]of Object.entries(r.extraAttributes||{}))if(i===o)return n;let a=e.attribute_type;for(let n in Q)if(this.draco[n]===a)return Q[n];let s=r.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:`CUSTOM_ATTRIBUTE_${o}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let o=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(o)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},o=this.metadataQuerier.NumEntries(e);for(let a=0;a<o;a++){let s=this.metadataQuerier.GetEntryName(e,a);r[s]=this._getDracoMetadataField(e,s)}return r}_getDracoMetadataField(e,r){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,o);let a=Ae(o);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:a}}finally{this.draco.destroy(o)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:o=[]}=e,a=[...r,...o];for(let s of a)this.decoder.SkipAttributeTransform(this.draco[s])}_getQuantizationTransform(e,r){let{quantizedAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits(),range:n.range(),min_values:new Float32Array([1,2,3]).map(i=>n.min_value(i))}}finally{this.draco.destroy(n)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits()}}finally{this.draco.destroy(n)}}return null}};function he(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function Ae(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}function De(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}var Te="1.5.6",_e="1.4.1",P=`https://www.gstatic.com/draco/versioned/decoders/${Te}`,d={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},k={[d.DECODER]:`${P}/${d.DECODER}`,[d.DECODER_WASM]:`${P}/${d.DECODER_WASM}`,[d.FALLBACK_DECODER]:`${P}/${d.FALLBACK_DECODER}`,[d.ENCODER]:`https://raw.githubusercontent.com/google/draco/${_e}/javascript/${d.ENCODER}`},A;async function j(t){let e=t.modules||{};return e.draco3d?A=A||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):A=A||we(t),await A}async function we(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await h(k[d.FALLBACK_DECODER],"draco",t,d.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await h(k[d.DECODER],"draco",t,d.DECODER),await h(k[d.DECODER_WASM],"draco",t,d.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await xe(e,r)}function xe(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(o=>{t({...r,onModuleLoaded:a=>o({draco:a})})})}var Y={...z,parse:Me};async function Me(t,e){let{draco:r}=await j(e),o=new _(r);try{return o.parseSync(t,e?.draco)}finally{o.destroy()}}L(Y);})(); | ||
//# sourceMappingURL=draco-worker.js.map |
@@ -1,4 +0,4 @@ | ||
(()=>{var N=Object.create;var w=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var q=t=>w(t,"__esModule",{value:!0});var j=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var G=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!V.call(t,o)&&o!=="default"&&w(t,o,{get:()=>e[o],enumerable:!(r=F(e,o))||r.enumerable});return t},z=t=>G(q(w(t!=null?N($(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var C=j(()=>{});var A="4.0.0-alpha.23";function R(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var c={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},le=c.self||c.window||c.global||{},ue=c.window||c.self||c.global||{},k=c.global||c.self||c.window||{},fe=c.document||{};var g=typeof process!="object"||String(process)!=="[object process]"||process.browser,m=typeof importScripts=="function",pe=typeof window!="undefined"&&typeof window.orientation!="undefined",T=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),ye=T&&parseFloat(T[1])||0;function D(t,e=!0,r){let o=r||new Set;if(t){if(B(t))o.add(t);else if(B(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)D(t[a],e,o)}}return r===void 0?Array.from(o):[]}function B(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function y(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var b=new Map,p=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(y())}static set onmessage(e){function r(a){let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}let o=y();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=b.get(e);r||(r=a=>{if(!U(a))return;let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}),y()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=b.get(e);b.delete(e),y()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=D(r),n=y();n?n.postMessage(o,a):globalThis.postMessage(o,a)}};function U(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var u=z(C());var K="beta",X=typeof A!="undefined"?A:K,M={};async function _(t,e=null,r={},o=null){return e&&(t=W(t,e,r,o)),M[t]=M[t]||Q(t),await M[t]}function W(t,e,r={},o=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;o=o||t;let a=r.modules||{};return a[o]?a[o]:g?r.CDN?(R(r.CDN.startsWith("http")),`${r.CDN}/${e}@${X}/dist/libs/${o}`):m?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function Q(t){if(t.endsWith("wasm"))return await J(t);if(!g)try{return u&&u.requireFromFile&&await u.requireFromFile(t)}catch{return null}if(m)return importScripts(t);let e=await Y(t);return H(e,t)}function H(t,e){if(!g)return u.requireFromString&&u.requireFromString(t,e);if(m)return eval.call(k,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function J(t){return!u.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await u.readFileAsArrayBuffer(t)}async function Y(t){return!u.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await u.readFileAsText(t)}var I={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},Z=()=>{},E=class{constructor(e){this.draco=e,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(e){e&&this.draco.destroy(e)}encodeSync(e,r={}){return this.log=Z,this._setOptions(r),r.pointcloud?this._encodePointCloud(e,r):this._encodeMesh(e,r)}_getAttributesFromMesh(e){let r={...e,...e.attributes};return e.indices&&(r.indices=e.indices),r}_encodePointCloud(e,r){let o=new this.draco.PointCloud;r.metadata&&this._addGeometryMetadata(o,r.metadata);let a=this._getAttributesFromMesh(e);this._createDracoPointCloud(o,a,r);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,n);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
(()=>{var N=Object.create;var w=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var q=t=>w(t,"__esModule",{value:!0});var j=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var G=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!V.call(t,o)&&o!=="default"&&w(t,o,{get:()=>e[o],enumerable:!(r=F(e,o))||r.enumerable});return t},z=t=>G(q(w(t!=null?N($(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var C=j(()=>{});var A="4.0.0-alpha.24";function R(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var c={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},le=c.self||c.window||c.global||{},ue=c.window||c.self||c.global||{},k=c.global||c.self||c.window||{},fe=c.document||{};var g=typeof process!="object"||String(process)!=="[object process]"||process.browser,m=typeof importScripts=="function",pe=typeof window!="undefined"&&typeof window.orientation!="undefined",T=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),ye=T&&parseFloat(T[1])||0;function D(t,e=!0,r){let o=r||new Set;if(t){if(B(t))o.add(t);else if(B(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)D(t[a],e,o)}}return r===void 0?Array.from(o):[]}function B(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function y(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var b=new Map,p=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(y())}static set onmessage(e){function r(a){let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}let o=y();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=b.get(e);r||(r=a=>{if(!U(a))return;let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}),y()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=b.get(e);b.delete(e),y()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=D(r),n=y();n?n.postMessage(o,a):globalThis.postMessage(o,a)}};function U(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var u=z(C());var K="beta",X=typeof A!="undefined"?A:K,M={};async function _(t,e=null,r={},o=null){return e&&(t=W(t,e,r,o)),M[t]=M[t]||Q(t),await M[t]}function W(t,e,r={},o=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;o=o||t;let a=r.modules||{};return a[o]?a[o]:g?r.CDN?(R(r.CDN.startsWith("http")),`${r.CDN}/${e}@${X}/dist/libs/${o}`):m?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function Q(t){if(t.endsWith("wasm"))return await J(t);if(!g)try{return u&&u.requireFromFile&&await u.requireFromFile(t)}catch{return null}if(m)return importScripts(t);let e=await Y(t);return H(e,t)}function H(t,e){if(!g)return u.requireFromString&&u.requireFromString(t,e);if(m)return eval.call(k,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function J(t){return!u.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await u.readFileAsArrayBuffer(t)}async function Y(t){return!u.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await u.readFileAsText(t)}var I={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},Z=()=>{},E=class{constructor(e){this.draco=e,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(e){e&&this.draco.destroy(e)}encodeSync(e,r={}){return this.log=Z,this._setOptions(r),r.pointcloud?this._encodePointCloud(e,r):this._encodeMesh(e,r)}_getAttributesFromMesh(e){let r={...e,...e.attributes};return e.indices&&(r.indices=e.indices),r}_encodePointCloud(e,r){let o=new this.draco.PointCloud;r.metadata&&this._addGeometryMetadata(o,r.metadata);let a=this._getAttributesFromMesh(e);this._createDracoPointCloud(o,a,r);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,n);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),P(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_encodeMesh(e,r){let o=new this.draco.Mesh;r.metadata&&this._addGeometryMetadata(o,r.metadata);let a=this._getAttributesFromMesh(e);this._createDracoMesh(o,a,r);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodeMeshToDracoBuffer(o,n);if(i<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),P(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let r=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(r)}if("quantization"in e)for(let r in e.quantization){let o=e.quantization[r],a=this.draco[r];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,r,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(r);if(!n)throw new Error("positions");let i=n.length/3;for(let s in r){let d=r[s];s=I[s]||s;let f=this._addAttributeToMesh(e,s,d,i);f!==-1&&this._addAttributeMetadata(e,f,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_createDracoPointCloud(e,r,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(r);if(!n)throw new Error("positions");let i=n.length/3;for(let s in r){let d=r[s];s=I[s]||s;let f=this._addAttributeToMesh(e,s,d,i);f!==-1&&this._addAttributeMetadata(e,f,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_addAttributeToMesh(e,r,o,a){if(!ArrayBuffer.isView(o))return-1;let n=this._getDracoAttributeType(r),i=o.length/a;if(n==="indices"){let f=o.length/3;return this.log(`Adding attribute ${r}, size ${f}`),this.dracoMeshBuilder.AddFacesToMesh(e,f,o),-1}this.log(`Adding attribute ${r}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:d}=o;switch(o.constructor){case Int8Array:return s.AddInt8Attribute(e,n,a,i,new Int8Array(d));case Int16Array:return s.AddInt16Attribute(e,n,a,i,new Int16Array(d));case Int32Array:return s.AddInt32Attribute(e,n,a,i,new Int32Array(d));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(e,n,a,i,new Uint8Array(d));case Uint16Array:return s.AddUInt16Attribute(e,n,a,i,new Uint16Array(d));case Uint32Array:return s.AddUInt32Attribute(e,n,a,i,new Uint32Array(d));case Float32Array:default:return s.AddFloatAttribute(e,n,a,i,new Float32Array(d))}}_getDracoAttributeType(e){switch(e.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(e){for(let r in e){let o=e[r];if(this._getDracoAttributeType(r)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,r){let o=new this.draco.Metadata;this._populateDracoMetadata(o,r),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,r,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,r,a)}_populateDracoMetadata(e,r){for(let[o,a]of ee(r))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(e,o,a):this.dracoMetadataBuilder.AddDoubleEntry(e,o,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,o,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(e,o,a)}}};function P(t){let e=t.size(),r=new ArrayBuffer(e),o=new Int8Array(r);for(let a=0;a<e;++a)o[a]=t.GetValue(a);return r}function ee(t){return t.entries&&!t.hasOwnProperty("entries")?t.entries():Object.entries(t)}var re="1.5.5",te="1.4.1",O=`https://www.gstatic.com/draco/versioned/decoders/${re}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},oe={[l.DECODER]:`${O}/${l.DECODER}`,[l.DECODER_WASM]:`${O}/${l.DECODER_WASM}`,[l.FALLBACK_DECODER]:`${O}/${l.FALLBACK_DECODER}`,[l.ENCODER]:`https://raw.githubusercontent.com/google/draco/${te}/javascript/${l.ENCODER}`};var h;async function L(t){let e=t.modules||{};return e.draco3d?h=h||e.draco3d.createEncoderModule({}).then(r=>({draco:r})):h=h||ae(t),await h}async function ae(t){let e=await _(oe[l.ENCODER],"draco",t,l.ENCODER);return e=e||globalThis.DracoEncoderModule,new Promise(r=>{e({onModuleLoaded:o=>r({draco:o})})})}var S="4.0.0-alpha.23";var ne={pointcloud:!1,attributeNameEntry:"name"},x={name:"DRACO",id:"draco",module:"draco",version:S,extensions:["drc"],encode:se,options:{draco:ne}};async function se(t,e={}){let{draco:r}=await L(e),o=new E(r);try{return o.encodeSync(t,e.draco)}finally{o.destroy()}}(()=>{!p.inWorkerThread()||(p.onmessage=async(t,e)=>{switch(t){case"process":try{let{input:r,options:o}=e,a=await x.encode(r,o);p.postMessage("done",{result:a})}catch(r){let o=r instanceof Error?r.message:"";p.postMessage("error",{error:o})}break;default:}})})();})(); | ||
with ${o.num_attributes()} attributes into ${i} bytes`),P(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let r=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(r)}if("quantization"in e)for(let r in e.quantization){let o=e.quantization[r],a=this.draco[r];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,r,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(r);if(!n)throw new Error("positions");let i=n.length/3;for(let s in r){let d=r[s];s=I[s]||s;let f=this._addAttributeToMesh(e,s,d,i);f!==-1&&this._addAttributeMetadata(e,f,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_createDracoPointCloud(e,r,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(r);if(!n)throw new Error("positions");let i=n.length/3;for(let s in r){let d=r[s];s=I[s]||s;let f=this._addAttributeToMesh(e,s,d,i);f!==-1&&this._addAttributeMetadata(e,f,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_addAttributeToMesh(e,r,o,a){if(!ArrayBuffer.isView(o))return-1;let n=this._getDracoAttributeType(r),i=o.length/a;if(n==="indices"){let f=o.length/3;return this.log(`Adding attribute ${r}, size ${f}`),this.dracoMeshBuilder.AddFacesToMesh(e,f,o),-1}this.log(`Adding attribute ${r}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:d}=o;switch(o.constructor){case Int8Array:return s.AddInt8Attribute(e,n,a,i,new Int8Array(d));case Int16Array:return s.AddInt16Attribute(e,n,a,i,new Int16Array(d));case Int32Array:return s.AddInt32Attribute(e,n,a,i,new Int32Array(d));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(e,n,a,i,new Uint8Array(d));case Uint16Array:return s.AddUInt16Attribute(e,n,a,i,new Uint16Array(d));case Uint32Array:return s.AddUInt32Attribute(e,n,a,i,new Uint32Array(d));case Float32Array:default:return s.AddFloatAttribute(e,n,a,i,new Float32Array(d))}}_getDracoAttributeType(e){switch(e.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(e){for(let r in e){let o=e[r];if(this._getDracoAttributeType(r)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,r){let o=new this.draco.Metadata;this._populateDracoMetadata(o,r),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,r,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,r,a)}_populateDracoMetadata(e,r){for(let[o,a]of ee(r))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(e,o,a):this.dracoMetadataBuilder.AddDoubleEntry(e,o,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,o,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(e,o,a)}}};function P(t){let e=t.size(),r=new ArrayBuffer(e),o=new Int8Array(r);for(let a=0;a<e;++a)o[a]=t.GetValue(a);return r}function ee(t){return t.entries&&!t.hasOwnProperty("entries")?t.entries():Object.entries(t)}var re="1.5.6",te="1.4.1",O=`https://www.gstatic.com/draco/versioned/decoders/${re}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},oe={[l.DECODER]:`${O}/${l.DECODER}`,[l.DECODER_WASM]:`${O}/${l.DECODER_WASM}`,[l.FALLBACK_DECODER]:`${O}/${l.FALLBACK_DECODER}`,[l.ENCODER]:`https://raw.githubusercontent.com/google/draco/${te}/javascript/${l.ENCODER}`};var h;async function L(t){let e=t.modules||{};return e.draco3d?h=h||e.draco3d.createEncoderModule({}).then(r=>({draco:r})):h=h||ae(t),await h}async function ae(t){let e=await _(oe[l.ENCODER],"draco",t,l.ENCODER);return e=e||globalThis.DracoEncoderModule,new Promise(r=>{e({onModuleLoaded:o=>r({draco:o})})})}var S="4.0.0-alpha.24";var ne={pointcloud:!1,attributeNameEntry:"name"},x={name:"DRACO",id:"draco",module:"draco",version:S,extensions:["drc"],encode:se,options:{draco:ne}};async function se(t,e={}){let{draco:r}=await L(e),o=new E(r);try{return o.encodeSync(t,e.draco)}finally{o.destroy()}}(()=>{!p.inWorkerThread()||(p.onmessage=async(t,e)=>{switch(t){case"process":try{let{input:r,options:o}=e,a=await x.encode(r,o);p.postMessage("done",{result:a})}catch(r){let o=r instanceof Error?r.message:"";p.postMessage("error",{error:o})}break;default:}})})();})(); | ||
//# sourceMappingURL=draco-writer-worker.js.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
var DRACO_DECODER_VERSION = '1.5.5'; | ||
var DRACO_DECODER_VERSION = '1.5.6'; | ||
var DRACO_ENCODER_VERSION = '1.4.1'; | ||
@@ -21,0 +21,0 @@ var STATIC_DECODER_URL = "https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION); |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.VERSION = void 0; | ||
var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest'; | ||
var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest'; | ||
exports.VERSION = VERSION; | ||
//# sourceMappingURL=version.js.map |
import { loadLibrary } from '@loaders.gl/worker-utils'; | ||
const DRACO_DECODER_VERSION = '1.5.5'; | ||
const DRACO_DECODER_VERSION = '1.5.6'; | ||
const DRACO_ENCODER_VERSION = '1.4.1'; | ||
@@ -4,0 +4,0 @@ const STATIC_DECODER_URL = "https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION); |
@@ -1,2 +0,2 @@ | ||
export const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest'; | ||
export const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@loaders.gl/draco", | ||
"version": "4.0.0-alpha.23", | ||
"version": "4.0.0-alpha.24", | ||
"description": "Framework-independent loader and writer for Draco compressed meshes and point clouds", | ||
@@ -46,11 +46,11 @@ "license": "MIT", | ||
"@babel/runtime": "^7.3.1", | ||
"@loaders.gl/loader-utils": "4.0.0-alpha.23", | ||
"@loaders.gl/schema": "4.0.0-alpha.23", | ||
"@loaders.gl/worker-utils": "4.0.0-alpha.23", | ||
"@loaders.gl/loader-utils": "4.0.0-alpha.24", | ||
"@loaders.gl/schema": "4.0.0-alpha.24", | ||
"@loaders.gl/worker-utils": "4.0.0-alpha.24", | ||
"draco3d": "1.5.5" | ||
}, | ||
"devDependencies": { | ||
"@loaders.gl/polyfills": "4.0.0-alpha.23" | ||
"@loaders.gl/polyfills": "4.0.0-alpha.24" | ||
}, | ||
"gitHead": "e212f2a0c0e342f7cb65ce84fa2ff39f64b7d94b" | ||
"gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05" | ||
} |
@@ -7,3 +7,3 @@ // Dynamic DRACO module loading inspired by THREE.DRACOLoader | ||
const DRACO_DECODER_VERSION = '1.5.5'; | ||
const DRACO_DECODER_VERSION = '1.5.6'; | ||
const DRACO_ENCODER_VERSION = '1.4.1'; | ||
@@ -10,0 +10,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12648687
130
27064
+ Added@loaders.gl/loader-utils@4.0.0-alpha.24(transitive)
+ Added@loaders.gl/schema@4.0.0-alpha.24(transitive)
+ Added@loaders.gl/worker-utils@4.0.0-alpha.24(transitive)
- Removed@loaders.gl/loader-utils@4.0.0-alpha.23(transitive)
- Removed@loaders.gl/schema@4.0.0-alpha.23(transitive)
- Removed@loaders.gl/worker-utils@4.0.0-alpha.23(transitive)