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-beta.4 to 4.0.0-beta.5

2

dist/draco-worker.js

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

"use strict";(()=>{var Y=Object.create;var R=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ee=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of J(e))!K.call(t,a)&&a!==r&&R(t,a,{get:()=>e[a],enumerable:!(o=X(e,a))||o.enumerable});return t};var te=(t,e,r)=>(r=t!=null?Y(H(t)):{},ee(e||!t||!t.__esModule?R(r,"default",{value:t,enumerable:!0}):r,t));var N=Z(()=>{"use strict"});function re(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.0.0-beta.4"),globalThis._loadersgl_.version}var S=re();function F(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var y={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Ee=y.self||y.window||y.global||{},we=y.window||y.self||y.global||{},Le=y.global||y.self||y.window||{},Ie=y.document||{};var D=typeof process!="object"||String(process)!=="[object process]"||process.browser,_=typeof importScripts=="function",Pe=typeof window<"u"&&typeof window.orientation<"u",C=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Re=C&&parseFloat(C[1])||0;function x(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)x(t[a],e,o)}}return r===void 0?Array.from(o):[]}function B(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}function g(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var M=new Map,l=class{static inWorkerThread(){return typeof self<"u"||Boolean(g())}static set onmessage(e){function r(a){let n=g(),{type:s,payload:i}=n?a:a.data;e(s,i)}let o=g();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=M.get(e);r||(r=a=>{if(!oe(a))return;let n=g(),{type:s,payload:i}=n?a:a.data;e(s,i)}),g()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=M.get(e);M.delete(e),g()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=x(r),n=g();n?n.postMessage(o,a):globalThis.postMessage(o,a)}};function oe(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var p=te(N(),1);var O={};async function h(t,e=null,r={},o=null){return e&&(t=k(t,e,r,o)),O[t]=O[t]||ae(t),await O[t]}function k(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?(F(r.CDN.startsWith("http")),`${r.CDN}/${e}@${S}/dist/libs/${o}`):_?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function ae(t){if(t.endsWith("wasm"))return await se(t);if(!D)try{return p&&void 0&&await(void 0)(t)}catch(r){return console.error(r),null}if(_)return importScripts(t);let e=await ie(t);return ne(e,t)}function ne(t,e){if(!D)return void 0&&(void 0)(t,e);if(_)return eval.call(globalThis,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 se(t){return!void 0||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await(void 0)(t)}async function ie(t){return!void 0||t.startsWith("http")?await(await fetch(t)).text():await(void 0)(t)}var ce=0;function E(t){l.inWorkerThread()&&(l.onmessage=async(e,r)=>{switch(e){case"process":try{let{input:o,options:a={},context:n={}}=r,s=await ue({loader:t,arrayBuffer:o,options:a,context:{...n,_parse:de}});l.postMessage("done",{result:s})}catch(o){let a=o instanceof Error?o.message:"";l.postMessage("error",{error:a})}break;default:}})}function de(t,e,r,o){return new Promise((a,n)=>{let s=ce++,i=(f,d)=>{if(d.id===s)switch(f){case"done":l.removeEventListener(i),a(d.result);break;case"error":l.removeEventListener(i),n(d.error);break;default:}};l.addEventListener(i);let c={id:s,input:t,options:r};l.postMessage("process",c)})}async function ue({loader:t,arrayBuffer:e,options:r,context:o}){let a,n;if(t.parseSync||t.parse)a=e,n=t.parseSync||t.parse;else if(t.parseTextSync)a=new TextDecoder().decode(e),n=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 n(a,{...r},o,t)}var W="4.0.0-beta.4";var le={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},v={name:"Draco",id:"draco",module:"draco",version:W,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:le};function z(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 w(t){let e=1/0,r=1/0,o=1/0,a=-1/0,n=-1/0,s=-1/0,i=t.POSITION?t.POSITION.value:[],c=i&&i.length;for(let f=0;f<c;f+=3){let d=i[f],m=i[f+1],A=i[f+2];e=d<e?d:e,r=m<r?m:r,o=A<o?A:o,a=d>a?d:a,n=m>n?m:n,s=A>s?A:s}return[[e,r,o],[a,n,s]]}function L(t,e,r){let o=z(e.value),a=r||V(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function V(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 U(t,e,r){let o=q(e.metadata),a=[],n=pe(e.attributes);for(let s in t){let i=t[s],c=G(s,i,n[s]);a.push(c)}if(r){let s=G("indices",r);a.push(s)}return{fields:a,metadata:o}}function pe(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?q(r.metadata):void 0;return L(t,e,o)}function q(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var $={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},fe={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},ye=4,b=class{draco;decoder;metadataQuerier;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),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let s;switch(a){case this.draco.TRIANGULAR_MESH:s=this.decoder.DecodeBufferToMesh(o,n);break;case this.draco.POINT_CLOUD:s=this.decoder.DecodeBufferToPointCloud(o,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!s.ok()||!n.ptr){let A=`DRACO decompression failed: ${s.error_msg()}`;throw new Error(A)}let i=this._getDracoLoaderData(n,a,r),c=this._getMeshData(n,i,r),f=w(c.attributes),d=U(c.attributes,i,c.indices);return{loader:"draco",loaderData:i,header:{vertexCount:n.num_points(),boundingBox:f},...c,schema:d}}finally{this.draco.destroy(o),n&&this.draco.destroy(n)}}_getDracoLoaderData(e,r,o){let a=this._getTopLevelMetadata(e),n=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:n}}_getDracoAttributes(e,r){let o={};for(let a=0;a<e.num_attributes();a++){let n=this.decoder.GetAttribute(e,a),s=this._getAttributeMetadata(e,a);o[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:s};let i=this._getQuantizationTransform(n,r);i&&(o[n.unique_id()].quantization_transform=i);let c=this._getOctahedronTransform(n,r);c&&(o[n.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 n of Object.values(e.attributes)){let s=this._deduceAttributeName(n,o);n.name=s;let{value:i,size:c}=this._getAttributeValues(r,n);a[s]={value:i,size:c,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(e){let o=e.num_faces()*3,a=o*ye,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(e,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,o).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),Ae(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let o=fe[r.data_type],a=r.num_components,s=e.num_points()*a,i=s*o.BYTES_PER_ELEMENT,c=me(this.draco,o),f,d=this.draco._malloc(i);try{let m=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,m,c,i,d),f=new o(this.draco.HEAPF32.buffer,d,s).slice()}finally{this.draco._free(d)}return{value:f,size:a}}_deduceAttributeName(e,r){let o=e.unique_id;for(let[s,i]of Object.entries(r.extraAttributes||{}))if(i===o)return s;let a=e.attribute_type;for(let s in $)if(this.draco[s]===a)return $[s];let n=r.attributeNameEntry||"name";return e.metadata[n]?e.metadata[n].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 n=this.metadataQuerier.GetEntryName(e,a);r[n]=this._getDracoMetadataField(e,n)}return r}_getDracoMetadataField(e,r){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,o);let a=ge(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 n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(e,r){let{quantizedAttributes:o=[]}=r,a=e.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits(),range:s.range(),min_values:new Float32Array([1,2,3]).map(i=>s.min_value(i))}}finally{this.draco.destroy(s)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:o=[]}=r,a=e.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits()}}finally{this.draco.destroy(s)}}return null}};function me(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 ge(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}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}var he="1.5.6",be="1.4.1",I=`https://www.gstatic.com/draco/versioned/decoders/${he}`,u={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},P={[u.DECODER]:`${I}/${u.DECODER}`,[u.DECODER_WASM]:`${I}/${u.DECODER_WASM}`,[u.FALLBACK_DECODER]:`${I}/${u.FALLBACK_DECODER}`,[u.ENCODER]:`https://raw.githubusercontent.com/google/draco/${be}/javascript/${u.ENCODER}`},T;async function Q(t){let e=t.modules||{};return e.draco3d?T=T||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):T=T||Te(t),await T}async function Te(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await h(P[u.FALLBACK_DECODER],"draco",t,u.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await h(P[u.DECODER],"draco",t,u.DECODER),await h(P[u.DECODER_WASM],"draco",t,u.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await De(e,r)}function De(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(o=>{t({...r,onModuleLoaded:a=>o({draco:a})})})}var j={...v,parse:_e};async function _e(t,e){let{draco:r}=await Q(e),o=new b(r);try{return o.parseSync(t,e?.draco)}finally{o.destroy()}}E(j);})();
"use strict";(()=>{var Y=Object.create;var R=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ee=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of J(e))!K.call(t,a)&&a!==r&&R(t,a,{get:()=>e[a],enumerable:!(o=X(e,a))||o.enumerable});return t};var te=(t,e,r)=>(r=t!=null?Y(H(t)):{},ee(e||!t||!t.__esModule?R(r,"default",{value:t,enumerable:!0}):r,t));var N=Z(()=>{"use strict"});function re(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.0.0-beta.5"),globalThis._loadersgl_.version}var S=re();function F(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var y={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Ee=y.self||y.window||y.global||{},we=y.window||y.self||y.global||{},Le=y.global||y.self||y.window||{},Ie=y.document||{};var D=typeof process!="object"||String(process)!=="[object process]"||process.browser,_=typeof importScripts=="function",Pe=typeof window<"u"&&typeof window.orientation<"u",C=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Re=C&&parseFloat(C[1])||0;function x(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)x(t[a],e,o)}}return r===void 0?Array.from(o):[]}function B(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}function g(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var M=new Map,l=class{static inWorkerThread(){return typeof self<"u"||Boolean(g())}static set onmessage(e){function r(a){let n=g(),{type:s,payload:i}=n?a:a.data;e(s,i)}let o=g();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=M.get(e);r||(r=a=>{if(!oe(a))return;let n=g(),{type:s,payload:i}=n?a:a.data;e(s,i)}),g()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=M.get(e);M.delete(e),g()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=x(r),n=g();n?n.postMessage(o,a):globalThis.postMessage(o,a)}};function oe(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var p=te(N(),1);var O={};async function h(t,e=null,r={},o=null){return e&&(t=k(t,e,r,o)),O[t]=O[t]||ae(t),await O[t]}function k(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?(F(r.CDN.startsWith("http")),`${r.CDN}/${e}@${S}/dist/libs/${o}`):_?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function ae(t){if(t.endsWith("wasm"))return await se(t);if(!D)try{return p&&void 0&&await(void 0)(t)}catch(r){return console.error(r),null}if(_)return importScripts(t);let e=await ie(t);return ne(e,t)}function ne(t,e){if(!D)return void 0&&(void 0)(t,e);if(_)return eval.call(globalThis,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 se(t){return!void 0||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await(void 0)(t)}async function ie(t){return!void 0||t.startsWith("http")?await(await fetch(t)).text():await(void 0)(t)}var ce=0;function E(t){l.inWorkerThread()&&(l.onmessage=async(e,r)=>{switch(e){case"process":try{let{input:o,options:a={},context:n={}}=r,s=await ue({loader:t,arrayBuffer:o,options:a,context:{...n,_parse:de}});l.postMessage("done",{result:s})}catch(o){let a=o instanceof Error?o.message:"";l.postMessage("error",{error:a})}break;default:}})}function de(t,e,r,o){return new Promise((a,n)=>{let s=ce++,i=(f,d)=>{if(d.id===s)switch(f){case"done":l.removeEventListener(i),a(d.result);break;case"error":l.removeEventListener(i),n(d.error);break;default:}};l.addEventListener(i);let c={id:s,input:t,options:r};l.postMessage("process",c)})}async function ue({loader:t,arrayBuffer:e,options:r,context:o}){let a,n;if(t.parseSync||t.parse)a=e,n=t.parseSync||t.parse;else if(t.parseTextSync)a=new TextDecoder().decode(e),n=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 n(a,{...r},o,t)}var W="4.0.0-beta.5";var le={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},v={name:"Draco",id:"draco",module:"draco",version:W,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:le};function z(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 w(t){let e=1/0,r=1/0,o=1/0,a=-1/0,n=-1/0,s=-1/0,i=t.POSITION?t.POSITION.value:[],c=i&&i.length;for(let f=0;f<c;f+=3){let d=i[f],m=i[f+1],A=i[f+2];e=d<e?d:e,r=m<r?m:r,o=A<o?A:o,a=d>a?d:a,n=m>n?m:n,s=A>s?A:s}return[[e,r,o],[a,n,s]]}function L(t,e,r){let o=z(e.value),a=r||V(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function V(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 U(t,e,r){let o=q(e.metadata),a=[],n=pe(e.attributes);for(let s in t){let i=t[s],c=G(s,i,n[s]);a.push(c)}if(r){let s=G("indices",r);a.push(s)}return{fields:a,metadata:o}}function pe(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?q(r.metadata):void 0;return L(t,e,o)}function q(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var $={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},fe={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},ye=4,b=class{draco;decoder;metadataQuerier;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),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let s;switch(a){case this.draco.TRIANGULAR_MESH:s=this.decoder.DecodeBufferToMesh(o,n);break;case this.draco.POINT_CLOUD:s=this.decoder.DecodeBufferToPointCloud(o,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!s.ok()||!n.ptr){let A=`DRACO decompression failed: ${s.error_msg()}`;throw new Error(A)}let i=this._getDracoLoaderData(n,a,r),c=this._getMeshData(n,i,r),f=w(c.attributes),d=U(c.attributes,i,c.indices);return{loader:"draco",loaderData:i,header:{vertexCount:n.num_points(),boundingBox:f},...c,schema:d}}finally{this.draco.destroy(o),n&&this.draco.destroy(n)}}_getDracoLoaderData(e,r,o){let a=this._getTopLevelMetadata(e),n=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:n}}_getDracoAttributes(e,r){let o={};for(let a=0;a<e.num_attributes();a++){let n=this.decoder.GetAttribute(e,a),s=this._getAttributeMetadata(e,a);o[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:s};let i=this._getQuantizationTransform(n,r);i&&(o[n.unique_id()].quantization_transform=i);let c=this._getOctahedronTransform(n,r);c&&(o[n.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 n of Object.values(e.attributes)){let s=this._deduceAttributeName(n,o);n.name=s;let{value:i,size:c}=this._getAttributeValues(r,n);a[s]={value:i,size:c,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(e){let o=e.num_faces()*3,a=o*ye,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(e,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,o).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),Ae(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let o=fe[r.data_type],a=r.num_components,s=e.num_points()*a,i=s*o.BYTES_PER_ELEMENT,c=me(this.draco,o),f,d=this.draco._malloc(i);try{let m=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,m,c,i,d),f=new o(this.draco.HEAPF32.buffer,d,s).slice()}finally{this.draco._free(d)}return{value:f,size:a}}_deduceAttributeName(e,r){let o=e.unique_id;for(let[s,i]of Object.entries(r.extraAttributes||{}))if(i===o)return s;let a=e.attribute_type;for(let s in $)if(this.draco[s]===a)return $[s];let n=r.attributeNameEntry||"name";return e.metadata[n]?e.metadata[n].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 n=this.metadataQuerier.GetEntryName(e,a);r[n]=this._getDracoMetadataField(e,n)}return r}_getDracoMetadataField(e,r){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,o);let a=ge(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 n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(e,r){let{quantizedAttributes:o=[]}=r,a=e.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits(),range:s.range(),min_values:new Float32Array([1,2,3]).map(i=>s.min_value(i))}}finally{this.draco.destroy(s)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:o=[]}=r,a=e.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits()}}finally{this.draco.destroy(s)}}return null}};function me(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 ge(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}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}var he="1.5.6",be="1.4.1",I=`https://www.gstatic.com/draco/versioned/decoders/${he}`,u={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},P={[u.DECODER]:`${I}/${u.DECODER}`,[u.DECODER_WASM]:`${I}/${u.DECODER_WASM}`,[u.FALLBACK_DECODER]:`${I}/${u.FALLBACK_DECODER}`,[u.ENCODER]:`https://raw.githubusercontent.com/google/draco/${be}/javascript/${u.ENCODER}`},T;async function Q(t){let e=t.modules||{};return e.draco3d?T=T||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):T=T||Te(t),await T}async function Te(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await h(P[u.FALLBACK_DECODER],"draco",t,u.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await h(P[u.DECODER],"draco",t,u.DECODER),await h(P[u.DECODER_WASM],"draco",t,u.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await De(e,r)}function De(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(o=>{t({...r,onModuleLoaded:a=>o({draco:a})})})}var j={...v,parse:_e};async function _e(t,e){let{draco:r}=await Q(e),o=new b(r);try{return o.parseSync(t,e?.draco)}finally{o.destroy()}}E(j);})();
//# sourceMappingURL=draco-worker.js.map

@@ -1,4 +0,4 @@

"use strict";(()=>{var S=Object.create;var w=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var V=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var G=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of F(e))!v.call(r,a)&&a!==t&&w(r,a,{get:()=>e[a],enumerable:!(o=N(e,a))||o.enumerable});return r};var j=(r,e,t)=>(t=r!=null?S($(r)):{},G(e||!r||!r.__esModule?w(t,"default",{value:r,enumerable:!0}):t,r));var C=V(()=>{"use strict"});function q(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.0.0-beta.4"),globalThis._loadersgl_.version}var b=q();function T(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}var u={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ie=u.self||u.window||u.global||{},de=u.window||u.self||u.global||{},ce=u.global||u.self||u.window||{},ue=u.document||{};var m=typeof process!="object"||String(process)!=="[object process]"||process.browser,E=typeof importScripts=="function",le=typeof window<"u"&&typeof window.orientation<"u",R=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),fe=R&&parseFloat(R[1])||0;function A(r,e=!0,t){let o=t||new Set;if(r){if(B(r))o.add(r);else if(B(r.buffer))o.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(let a in r)A(r[a],e,o)}}return t===void 0?Array.from(o):[]}function B(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function y(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var D=new Map,f=class{static inWorkerThread(){return typeof self<"u"||Boolean(y())}static set onmessage(e){function t(a){let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}let o=y();o?(o.on("message",t),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=t}static addEventListener(e){let t=D.get(e);t||(t=a=>{if(!z(a))return;let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}),y()?console.error("not implemented"):globalThis.addEventListener("message",t)}static removeEventListener(e){let t=D.get(e);D.delete(e),y()?console.error("not implemented"):globalThis.removeEventListener("message",t)}static postMessage(e,t){let o={source:"loaders.gl",type:e,payload:t},a=A(t),n=y();n?n.postMessage(o,a):globalThis.postMessage(o,a)}};function z(r){let{type:e,data:t}=r;return e==="message"&&t&&typeof t.source=="string"&&t.source.startsWith("loaders.gl")}var d=j(C(),1);var M={};async function _(r,e=null,t={},o=null){return e&&(r=P(r,e,t,o)),M[r]=M[r]||U(r),await M[r]}function P(r,e,t={},o=null){if(!t.useLocalLibraries&&r.startsWith("http"))return r;o=o||r;let a=t.modules||{};return a[o]?a[o]:m?t.CDN?(T(t.CDN.startsWith("http")),`${t.CDN}/${e}@${b}/dist/libs/${o}`):E?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function U(r){if(r.endsWith("wasm"))return await X(r);if(!m)try{return d&&void 0&&await(void 0)(r)}catch(t){return console.error(t),null}if(E)return importScripts(r);let e=await Q(r);return K(e,r)}function K(r,e){if(!m)return void 0&&(void 0)(r,e);if(E)return eval.call(globalThis,r),null;let t=document.createElement("script");t.id=e;try{t.appendChild(document.createTextNode(r))}catch{t.text=r}return document.body.appendChild(t),null}async function X(r){return!void 0||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await(void 0)(r)}async function Q(r){return!void 0||r.startsWith("http")?await(await fetch(r)).text():await(void 0)(r)}var W={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},H=()=>{},h=class{draco;dracoEncoder;dracoMeshBuilder;dracoMetadataBuilder;log;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,t={}){return this.log=H,this._setOptions(t),t.pointcloud?this._encodePointCloud(e,t):this._encodeMesh(e,t)}_getAttributesFromMesh(e){let t={...e,...e.attributes};return e.indices&&(t.indices=e.indices),t}_encodePointCloud(e,t){let o=new this.draco.PointCloud;t.metadata&&this._addGeometryMetadata(o,t.metadata);let a=this._getAttributesFromMesh(e);this._createDracoPointCloud(o,a,t);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
"use strict";(()=>{var S=Object.create;var w=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var V=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var G=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of F(e))!v.call(r,a)&&a!==t&&w(r,a,{get:()=>e[a],enumerable:!(o=N(e,a))||o.enumerable});return r};var j=(r,e,t)=>(t=r!=null?S($(r)):{},G(e||!r||!r.__esModule?w(t,"default",{value:r,enumerable:!0}):t,r));var C=V(()=>{"use strict"});function q(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.0.0-beta.5"),globalThis._loadersgl_.version}var b=q();function T(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}var u={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ie=u.self||u.window||u.global||{},de=u.window||u.self||u.global||{},ce=u.global||u.self||u.window||{},ue=u.document||{};var m=typeof process!="object"||String(process)!=="[object process]"||process.browser,E=typeof importScripts=="function",le=typeof window<"u"&&typeof window.orientation<"u",R=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),fe=R&&parseFloat(R[1])||0;function A(r,e=!0,t){let o=t||new Set;if(r){if(B(r))o.add(r);else if(B(r.buffer))o.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(let a in r)A(r[a],e,o)}}return t===void 0?Array.from(o):[]}function B(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function y(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var D=new Map,f=class{static inWorkerThread(){return typeof self<"u"||Boolean(y())}static set onmessage(e){function t(a){let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}let o=y();o?(o.on("message",t),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=t}static addEventListener(e){let t=D.get(e);t||(t=a=>{if(!z(a))return;let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}),y()?console.error("not implemented"):globalThis.addEventListener("message",t)}static removeEventListener(e){let t=D.get(e);D.delete(e),y()?console.error("not implemented"):globalThis.removeEventListener("message",t)}static postMessage(e,t){let o={source:"loaders.gl",type:e,payload:t},a=A(t),n=y();n?n.postMessage(o,a):globalThis.postMessage(o,a)}};function z(r){let{type:e,data:t}=r;return e==="message"&&t&&typeof t.source=="string"&&t.source.startsWith("loaders.gl")}var d=j(C(),1);var M={};async function _(r,e=null,t={},o=null){return e&&(r=P(r,e,t,o)),M[r]=M[r]||U(r),await M[r]}function P(r,e,t={},o=null){if(!t.useLocalLibraries&&r.startsWith("http"))return r;o=o||r;let a=t.modules||{};return a[o]?a[o]:m?t.CDN?(T(t.CDN.startsWith("http")),`${t.CDN}/${e}@${b}/dist/libs/${o}`):E?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function U(r){if(r.endsWith("wasm"))return await X(r);if(!m)try{return d&&void 0&&await(void 0)(r)}catch(t){return console.error(t),null}if(E)return importScripts(r);let e=await Q(r);return K(e,r)}function K(r,e){if(!m)return void 0&&(void 0)(r,e);if(E)return eval.call(globalThis,r),null;let t=document.createElement("script");t.id=e;try{t.appendChild(document.createTextNode(r))}catch{t.text=r}return document.body.appendChild(t),null}async function X(r){return!void 0||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await(void 0)(r)}async function Q(r){return!void 0||r.startsWith("http")?await(await fetch(r)).text():await(void 0)(r)}var W={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},H=()=>{},h=class{draco;dracoEncoder;dracoMeshBuilder;dracoMetadataBuilder;log;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,t={}){return this.log=H,this._setOptions(t),t.pointcloud?this._encodePointCloud(e,t):this._encodeMesh(e,t)}_getAttributesFromMesh(e){let t={...e,...e.attributes};return e.indices&&(t.indices=e.indices),t}_encodePointCloud(e,t){let o=new this.draco.PointCloud;t.metadata&&this._addGeometryMetadata(o,t.metadata);let a=this._getAttributesFromMesh(e);this._createDracoPointCloud(o,a,t);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`),I(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_encodeMesh(e,t){let o=new this.draco.Mesh;t.metadata&&this._addGeometryMetadata(o,t.metadata);let a=this._getAttributesFromMesh(e);this._createDracoMesh(o,a,t);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`),I(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let t=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(t)}if("quantization"in e)for(let t in e.quantization){let o=e.quantization[t],a=this.draco[t];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,t,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(t);if(!n)throw new Error("positions");let i=n.length/3;for(let s in t){let c=t[s];s=W[s]||s;let p=this._addAttributeToMesh(e,s,c,i);p!==-1&&this._addAttributeMetadata(e,p,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_createDracoPointCloud(e,t,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(t);if(!n)throw new Error("positions");let i=n.length/3;for(let s in t){let c=t[s];s=W[s]||s;let p=this._addAttributeToMesh(e,s,c,i);p!==-1&&this._addAttributeMetadata(e,p,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_addAttributeToMesh(e,t,o,a){if(!ArrayBuffer.isView(o))return-1;let n=this._getDracoAttributeType(t),i=o.length/a;if(n==="indices"){let p=o.length/3;return this.log(`Adding attribute ${t}, size ${p}`),this.dracoMeshBuilder.AddFacesToMesh(e,p,o),-1}this.log(`Adding attribute ${t}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:c}=o;switch(o.constructor){case Int8Array:return s.AddInt8Attribute(e,n,a,i,new Int8Array(c));case Int16Array:return s.AddInt16Attribute(e,n,a,i,new Int16Array(c));case Int32Array:return s.AddInt32Attribute(e,n,a,i,new Int32Array(c));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(e,n,a,i,new Uint8Array(c));case Uint16Array:return s.AddUInt16Attribute(e,n,a,i,new Uint16Array(c));case Uint32Array:return s.AddUInt32Attribute(e,n,a,i,new Uint32Array(c));case Float32Array:default:return s.AddFloatAttribute(e,n,a,i,new Float32Array(c))}}_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 t in e){let o=e[t];if(this._getDracoAttributeType(t)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,t){let o=new this.draco.Metadata;this._populateDracoMetadata(o,t),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,t,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,t,a)}_populateDracoMetadata(e,t){for(let[o,a]of J(t))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 I(r){let e=r.size(),t=new ArrayBuffer(e),o=new Int8Array(t);for(let a=0;a<e;++a)o[a]=r.GetValue(a);return t}function J(r){return r.entries&&!r.hasOwnProperty("entries")?r.entries():Object.entries(r)}var Y="1.5.6",Z="1.4.1",O=`https://www.gstatic.com/draco/versioned/decoders/${Y}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},ee={[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/${Z}/javascript/${l.ENCODER}`};var g;async function L(r){let e=r.modules||{};return e.draco3d?g=g||e.draco3d.createEncoderModule({}).then(t=>({draco:t})):g=g||te(r),await g}async function te(r){let e=await _(ee[l.ENCODER],"draco",r,l.ENCODER);return e=e||globalThis.DracoEncoderModule,new Promise(t=>{e({onModuleLoaded:o=>t({draco:o})})})}var k="4.0.0-beta.4";var re={pointcloud:!1,attributeNameEntry:"name"},x={name:"DRACO",id:"draco",module:"draco",version:k,extensions:["drc"],encode:oe,options:{draco:re}};async function oe(r,e={}){let{draco:t}=await L(e),o=new h(t);try{return o.encodeSync(r,e.draco)}finally{o.destroy()}}f.inWorkerThread()&&(f.onmessage=async(r,e)=>{switch(r){case"process":try{let{input:t,options:o}=e,a=await x.encode(t,o);f.postMessage("done",{result:a})}catch(t){let o=t instanceof Error?t.message:"";f.postMessage("error",{error:o})}break;default:}});})();
with ${o.num_attributes()} attributes into ${i} bytes`),I(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let t=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(t)}if("quantization"in e)for(let t in e.quantization){let o=e.quantization[t],a=this.draco[t];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,t,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(t);if(!n)throw new Error("positions");let i=n.length/3;for(let s in t){let c=t[s];s=W[s]||s;let p=this._addAttributeToMesh(e,s,c,i);p!==-1&&this._addAttributeMetadata(e,p,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_createDracoPointCloud(e,t,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(t);if(!n)throw new Error("positions");let i=n.length/3;for(let s in t){let c=t[s];s=W[s]||s;let p=this._addAttributeToMesh(e,s,c,i);p!==-1&&this._addAttributeMetadata(e,p,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_addAttributeToMesh(e,t,o,a){if(!ArrayBuffer.isView(o))return-1;let n=this._getDracoAttributeType(t),i=o.length/a;if(n==="indices"){let p=o.length/3;return this.log(`Adding attribute ${t}, size ${p}`),this.dracoMeshBuilder.AddFacesToMesh(e,p,o),-1}this.log(`Adding attribute ${t}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:c}=o;switch(o.constructor){case Int8Array:return s.AddInt8Attribute(e,n,a,i,new Int8Array(c));case Int16Array:return s.AddInt16Attribute(e,n,a,i,new Int16Array(c));case Int32Array:return s.AddInt32Attribute(e,n,a,i,new Int32Array(c));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(e,n,a,i,new Uint8Array(c));case Uint16Array:return s.AddUInt16Attribute(e,n,a,i,new Uint16Array(c));case Uint32Array:return s.AddUInt32Attribute(e,n,a,i,new Uint32Array(c));case Float32Array:default:return s.AddFloatAttribute(e,n,a,i,new Float32Array(c))}}_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 t in e){let o=e[t];if(this._getDracoAttributeType(t)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,t){let o=new this.draco.Metadata;this._populateDracoMetadata(o,t),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,t,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,t,a)}_populateDracoMetadata(e,t){for(let[o,a]of J(t))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 I(r){let e=r.size(),t=new ArrayBuffer(e),o=new Int8Array(t);for(let a=0;a<e;++a)o[a]=r.GetValue(a);return t}function J(r){return r.entries&&!r.hasOwnProperty("entries")?r.entries():Object.entries(r)}var Y="1.5.6",Z="1.4.1",O=`https://www.gstatic.com/draco/versioned/decoders/${Y}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},ee={[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/${Z}/javascript/${l.ENCODER}`};var g;async function L(r){let e=r.modules||{};return e.draco3d?g=g||e.draco3d.createEncoderModule({}).then(t=>({draco:t})):g=g||te(r),await g}async function te(r){let e=await _(ee[l.ENCODER],"draco",r,l.ENCODER);return e=e||globalThis.DracoEncoderModule,new Promise(t=>{e({onModuleLoaded:o=>t({draco:o})})})}var k="4.0.0-beta.5";var re={pointcloud:!1,attributeNameEntry:"name"},x={name:"DRACO",id:"draco",module:"draco",version:k,extensions:["drc"],encode:oe,options:{draco:re}};async function oe(r,e={}){let{draco:t}=await L(e),o=new h(t);try{return o.encodeSync(r,e.draco)}finally{o.destroy()}}f.inWorkerThread()&&(f.onmessage=async(r,e)=>{switch(r){case"process":try{let{input:t,options:o}=e,a=await x.encode(t,o);f.postMessage("done",{result:a})}catch(t){let o=t instanceof Error?t.message:"";f.postMessage("error",{error:o})}break;default:}});})();
//# sourceMappingURL=draco-writer-worker.js.map
{
"name": "@loaders.gl/draco",
"version": "4.0.0-beta.4",
"version": "4.0.0-beta.5",
"description": "Framework-independent loader and writer for Draco compressed meshes and point clouds",

@@ -54,11 +54,11 @@ "license": "MIT",

"@babel/runtime": "^7.3.1",
"@loaders.gl/loader-utils": "4.0.0-beta.4",
"@loaders.gl/schema": "4.0.0-beta.4",
"@loaders.gl/worker-utils": "4.0.0-beta.4",
"@loaders.gl/loader-utils": "4.0.0-beta.5",
"@loaders.gl/schema": "4.0.0-beta.5",
"@loaders.gl/worker-utils": "4.0.0-beta.5",
"draco3d": "1.5.5"
},
"devDependencies": {
"@loaders.gl/polyfills": "4.0.0-beta.4"
"@loaders.gl/polyfills": "4.0.0-beta.5"
},
"gitHead": "848c20b474532d301f2c3f8d4e1fb9bf262b86d4"
"gitHead": "a6f5a0d1a316cc22396e5a4d480c14329d1ef146"
}

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 too big to display

Sorry, the diff of this file is not supported yet

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