Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/draco

Package Overview
Dependencies
Maintainers
9
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/draco - npm Package Compare versions

Comparing version 4.0.0-alpha.19 to 4.0.0-alpha.20

2

dist/draco-worker.js

@@ -1,2 +0,2 @@

(()=>{var X=Object.create;var w=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var H=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 K(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(H(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var B=te(()=>{});var x="4.0.0-alpha.19";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||{},C=f.global||f.self||f.window||{},ke=f.document||{};var D=typeof process!="object"||String(process)!=="[object process]"||process.browser,T=typeof importScripts=="function",Pe=typeof window!="undefined"&&typeof window.orientation!="undefined",F=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Se=F&&parseFloat(F[1])||0;function M(t,e=!0,r){let o=r||new Set;if(t){if(N(t))o.add(t);else if(N(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 N(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,d=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(B());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 le(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 ce(e,t)}function ce(t,e){if(!D)return y.requireFromString&&y.requireFromString(t,e);if(T)return eval.call(C,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 le(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){!d.inWorkerThread()||(d.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}});d.postMessage("done",{result:n})}catch(o){let a=o instanceof Error?o.message:"";d.postMessage("error",{error:a})}break;default:}})}function pe(t,e){return new Promise((r,o)=>{let a=ue++,s=(i,c)=>{if(c.id===a)switch(i){case"done":d.removeEventListener(s),r(c.result);break;case"error":d.removeEventListener(s),o(c.error);break;default:}};d.addEventListener(s);let n={id:a,input:t,options:e};d.postMessage("process",n)})}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.19";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:[],c=i&&i.length;for(let u=0;u<c;u+=3){let p=i[u],m=i[u+1],g=i[u+2];e=p<e?p:e,r=m<r?m:r,o=g<o?g:o,a=p>a?p: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],c=G(n,i,s[n]);a.push(c)}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),c=this._getMeshData(s,i,r),u=I(c.attributes),p=q(c.attributes,i,c.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:u},...c,schema:p}}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 c=this._getOctahedronTransform(s,r);c&&(o[s.unique_id()].octahedron_transform=c)}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:c}=this._getAttributeValues(r,s);a[n]={value:i,size:c,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,c=he(this.draco,o),u,p=this.draco._malloc(i);try{let m=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,m,c,i,p),u=new o(this.draco.HEAPF32.buffer,p,n).slice()}finally{this.draco._free(p)}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",k=`https://www.gstatic.com/draco/versioned/decoders/${Te}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},P={[l.DECODER]:`${k}/${l.DECODER}`,[l.DECODER_WASM]:`${k}/${l.DECODER_WASM}`,[l.FALLBACK_DECODER]:`${k}/${l.FALLBACK_DECODER}`,[l.ENCODER]:`https://raw.githubusercontent.com/google/draco/${_e}/javascript/${l.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(P[l.FALLBACK_DECODER],"draco",t,l.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await h(P[l.DECODER],"draco",t,l.DECODER),await h(P[l.DECODER_WASM],"draco",t,l.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 K=Object.getOwnPropertyNames;var H=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 K(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(H(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var B=te(()=>{});var x="4.0.0-alpha.20";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||{},C=f.global||f.self||f.window||{},ke=f.document||{};var D=typeof process!="object"||String(process)!=="[object process]"||process.browser,T=typeof importScripts=="function",Pe=typeof window!="undefined"&&typeof window.orientation!="undefined",F=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Se=F&&parseFloat(F[1])||0;function M(t,e=!0,r){let o=r||new Set;if(t){if(N(t))o.add(t);else if(N(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 N(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,d=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(B());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 le(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 ce(e,t)}function ce(t,e){if(!D)return y.requireFromString&&y.requireFromString(t,e);if(T)return eval.call(C,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 le(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){!d.inWorkerThread()||(d.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}});d.postMessage("done",{result:n})}catch(o){let a=o instanceof Error?o.message:"";d.postMessage("error",{error:a})}break;default:}})}function pe(t,e){return new Promise((r,o)=>{let a=ue++,s=(i,c)=>{if(c.id===a)switch(i){case"done":d.removeEventListener(s),r(c.result);break;case"error":d.removeEventListener(s),o(c.error);break;default:}};d.addEventListener(s);let n={id:a,input:t,options:e};d.postMessage("process",n)})}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.20";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:[],c=i&&i.length;for(let u=0;u<c;u+=3){let p=i[u],m=i[u+1],g=i[u+2];e=p<e?p:e,r=m<r?m:r,o=g<o?g:o,a=p>a?p: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],c=G(n,i,s[n]);a.push(c)}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),c=this._getMeshData(s,i,r),u=I(c.attributes),p=q(c.attributes,i,c.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:u},...c,schema:p}}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 c=this._getOctahedronTransform(s,r);c&&(o[s.unique_id()].octahedron_transform=c)}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:c}=this._getAttributeValues(r,s);a[n]={value:i,size:c,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,c=he(this.draco,o),u,p=this.draco._malloc(i);try{let m=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,m,c,i,p),u=new o(this.draco.HEAPF32.buffer,p,n).slice()}finally{this.draco._free(p)}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",k=`https://www.gstatic.com/draco/versioned/decoders/${Te}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},P={[l.DECODER]:`${k}/${l.DECODER}`,[l.DECODER_WASM]:`${k}/${l.DECODER_WASM}`,[l.FALLBACK_DECODER]:`${k}/${l.FALLBACK_DECODER}`,[l.ENCODER]:`https://raw.githubusercontent.com/google/draco/${_e}/javascript/${l.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(P[l.FALLBACK_DECODER],"draco",t,l.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await h(P[l.DECODER],"draco",t,l.DECODER),await h(P[l.DECODER_WASM],"draco",t,l.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.19";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.20";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.19";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.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.20";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

@@ -7,4 +7,4 @@ "use strict";

exports.VERSION = void 0;
var VERSION = typeof "4.0.0-alpha.19" !== 'undefined' ? "4.0.0-alpha.19" : 'latest';
var VERSION = typeof "4.0.0-alpha.20" !== 'undefined' ? "4.0.0-alpha.20" : 'latest';
exports.VERSION = VERSION;
//# sourceMappingURL=version.js.map

@@ -1,2 +0,2 @@

export const VERSION = typeof "4.0.0-alpha.19" !== 'undefined' ? "4.0.0-alpha.19" : 'latest';
export const VERSION = typeof "4.0.0-alpha.20" !== 'undefined' ? "4.0.0-alpha.20" : 'latest';
//# sourceMappingURL=version.js.map
{
"name": "@loaders.gl/draco",
"version": "4.0.0-alpha.19",
"version": "4.0.0-alpha.20",
"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.19",
"@loaders.gl/schema": "4.0.0-alpha.19",
"@loaders.gl/worker-utils": "4.0.0-alpha.19",
"@loaders.gl/loader-utils": "4.0.0-alpha.20",
"@loaders.gl/schema": "4.0.0-alpha.20",
"@loaders.gl/worker-utils": "4.0.0-alpha.20",
"draco3d": "1.5.5"
},
"devDependencies": {
"@loaders.gl/polyfills": "4.0.0-alpha.19"
"@loaders.gl/polyfills": "4.0.0-alpha.20"
},
"gitHead": "2ca50ec4e1d312c124eb7c93c60ab6fd17ee833e"
"gitHead": "ac122e83102657c38207d59c631a5ce4e7aa46bd"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc