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

lerc

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lerc - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

lerc-4.0.1.tgz

16

LercDecode.d.ts

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

type PixelTypedArray =
export type PixelTypedArray =
| Int8Array

@@ -12,5 +12,5 @@ | Uint8Array

type LercPixelType = "S8" | "U8" | "S16" | "U16" | "S32" | "U32" | "F32" | "F64";
export type LercPixelType = "S8" | "U8" | "S16" | "U16" | "S32" | "U32" | "F32" | "F64";
interface BandStats {
export interface BandStats {
minValue: number;

@@ -24,3 +24,3 @@ maxValue: number;

interface LercHeaderInfo {
export interface LercHeaderInfo {
version: number;

@@ -42,3 +42,3 @@ width: number;

interface DecodeOptions {
export interface DecodeOptions {
inputOffset?: number;

@@ -49,3 +49,3 @@ returnInterleaved?: boolean;

interface LercData {
export interface LercData {
width: number;

@@ -63,4 +63,4 @@ height: number;

export function isLoaded(): boolean;
export function decode(input: ArrayBuffer, options?: DecodeOptions): LercData;
export function getBlobInfo(input: ArrayBuffer, options?: { inputOffset?: number }): LercHeaderInfo;
export function decode(input: ArrayBuffer | Uint8Array, options?: DecodeOptions): LercData;
export function getBlobInfo(input: ArrayBuffer | Uint8Array, options?: { inputOffset?: number }): LercHeaderInfo;
export function getBandCount(input: ArrayBuffer | Uint8Array, options?: { inputOffset?: number }): number;

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

type PixelTypedArray =
export type PixelTypedArray =
| Int8Array

@@ -12,5 +12,5 @@ | Uint8Array

type LercPixelType = "S8" | "U8" | "S16" | "U16" | "S32" | "U32" | "F32" | "F64";
export type LercPixelType = "S8" | "U8" | "S16" | "U16" | "S32" | "U32" | "F32" | "F64";
interface BandStats {
export interface BandStats {
minValue: number;

@@ -24,3 +24,3 @@ maxValue: number;

interface LercHeaderInfo {
export interface LercHeaderInfo {
version: number;

@@ -42,3 +42,3 @@ width: number;

interface DecodeOptions {
export interface DecodeOptions {
inputOffset?: number;

@@ -49,3 +49,3 @@ returnInterleaved?: boolean;

interface LercData {
export interface LercData {
width: number;

@@ -63,4 +63,4 @@ height: number;

export function isLoaded(): boolean;
export function decode(input: ArrayBuffer, options?: DecodeOptions): LercData;
export function getBlobInfo(input: ArrayBuffer, options?: { inputOffset?: number }): LercHeaderInfo;
export function decode(input: ArrayBuffer | Uint8Array, options?: DecodeOptions): LercData;
export function getBlobInfo(input: ArrayBuffer | Uint8Array, options?: { inputOffset?: number }): LercHeaderInfo;
export function getBandCount(input: ArrayBuffer | Uint8Array, options?: { inputOffset?: number }): number;

@@ -316,3 +316,3 @@ /*! Lerc 4.0

* @alias module:Lerc
* @param {ArrayBuffer} input The LERC input byte stream
* @param {ArrayBuffer | Uint8Array} input The LERC input byte stream
* @param {object} [options] The decoding options below are optional.

@@ -405,3 +405,3 @@ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.

* @alias module:Lerc
* @param {ArrayBuffer} input The LERC input byte stream
* @param {ArrayBuffer | Uint8Array} input The LERC input byte stream
* @param {object} [options] The decoding options below are optional.

@@ -425,3 +425,4 @@ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.

var _a;
const blob = new Uint8Array(input, (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0);
const inputOffset = (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0;
const blob = input instanceof Uint8Array ? input.subarray(inputOffset) : new Uint8Array(input, inputOffset);
return lercLib.getBlobInfo(blob);

@@ -428,0 +429,0 @@ }

@@ -17,2 +17,2 @@ /*! Lerc 4.0

*/
var Module=(()=>{var t=import.meta.url;return function(e){var n,r;(e=void 0!==(e=e||{})?e:{}).ready=new Promise((function(t,e){n=t,r=e}));var i,o,a,s,u,c,l=Object.assign({},e),f="object"==typeof window,p="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,d="";h?(d=p?require("path").dirname(d)+"/":__dirname+"/",c=()=>{u||(s=require("fs"),u=require("path"))},i=function(t,e){return c(),t=u.normalize(t),s.readFileSync(t,e?void 0:"utf8")},a=t=>{var e=i(t,!0);return e.buffer||(e=new Uint8Array(e)),e},o=(t,e,n)=>{c(),t=u.normalize(t),s.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof X))throw t})),process.on("unhandledRejection",(function(t){throw t})),e.inspect=function(){return"[Emscripten Module object]"}):(f||p)&&(p?d=self.location.href:"undefined"!=typeof document&&document.currentScript&&(d=document.currentScript.src),t&&(d=t),d=0!==d.indexOf("blob:")?d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},p&&(a=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}),e.print||console.log.bind(console);var y,m,g=e.printErr||console.warn.bind(console);Object.assign(e,l),l=null,e.arguments,e.thisProgram,e.quit,e.wasmBinary&&(y=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&D("no native wasm support detected");var b,w,_,A,v,x,I=!1,U="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e){return t?function(t,e,n){for(var r=e+n,i=e;t[i]&&!(i>=r);)++i;if(i-e>16&&t.buffer&&U)return U.decode(t.subarray(e,i));for(var o="";e<i;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var u=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[e++])<65536)o+=String.fromCharCode(a);else{var c=a-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}(_,t,e):""}function B(t){b=t,e.HEAP8=w=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=A=new Int32Array(t),e.HEAPU8=_=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=v=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}e.INITIAL_MEMORY;var F=[],T=[],C=[];var P=0,S=null;function D(t){e.onAbort&&e.onAbort(t),g(t="Aborted("+t+")"),I=!0,t+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(t);throw r(n),n}var W,L;function E(t){return t.startsWith("data:application/octet-stream;base64,")}function M(t){return t.startsWith("file://")}function z(t){try{if(t==W&&y)return new Uint8Array(y);if(a)return a(t);throw"both async and sync fetching of the wasm failed"}catch(t){D(t)}}function V(t){for(;t.length>0;){var n=t.shift();if("function"!=typeof n){var r=n.func;"number"==typeof r?void 0===n.arg?k(r)():k(r)(n.arg):r(void 0===n.arg?null:n.arg)}else n(e)}}e.locateFile?E(W="lerc-wasm.wasm")||(L=W,W=e.locateFile?e.locateFile(L,d):d+L):W=new URL("lerc-wasm.wasm",import.meta.url).toString();var j=[];function k(t){var e=j[t];return e||(t>=j.length&&(j.length=t+1),j[t]=e=x.get(t)),e}function H(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){v[this.ptr+4>>2]=t},this.get_type=function(){return v[this.ptr+4>>2]},this.set_destructor=function(t){v[this.ptr+8>>2]=t},this.get_destructor=function(){return v[this.ptr+8>>2]},this.set_refcount=function(t){A[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,w[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,w[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=A[this.ptr>>2];A[this.ptr>>2]=t+1},this.release_ref=function(){var t=A[this.ptr>>2];return A[this.ptr>>2]=t-1,1===t},this.set_adjusted_ptr=function(t){v[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return v[this.ptr+16>>2]},this.get_exception_ptr=function(){if(G(this.get_type()))return v[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function O(t){try{return m.grow(t-b.byteLength+65535>>>16),B(m.buffer),1}catch(t){}}var q={a:function(t,e,n,r){D("Assertion failed: "+R(t)+", at: "+[e?R(e):"unknown filename",n,r?R(r):"unknown function"])},c:function(t){return $(t+24)+24},b:function(t,e,n){throw new H(t).init(e,n),t},d:function(){D("")},f:function(t,e,n){_.copyWithin(t,e,e+n)},e:function(t){var e,n,r=_.length,i=2147483648;if((t>>>=0)>i)return!1;for(var o=1;o<=4;o*=2){var a=r*(1+.2/o);if(a=Math.min(a,t+100663296),O(Math.min(i,(e=Math.max(t,a))+((n=65536)-e%n)%n)))return!0}return!1}};!function(){var t={a:q};function n(t,n){var r,i=t.exports;e.asm=i,B((m=e.asm.g).buffer),x=e.asm.m,r=e.asm.h,T.unshift(r),function(t){if(P--,e.monitorRunDependencies&&e.monitorRunDependencies(P),0==P&&S){var n=S;S=null,n()}}()}function i(t){n(t.instance)}function a(e){return function(){if(!y&&(f||p)){if("function"==typeof fetch&&!M(W))return fetch(W,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+W+"'";return t.arrayBuffer()})).catch((function(){return z(W)}));if(o)return new Promise((function(t,e){o(W,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return z(W)}))}().then((function(e){return WebAssembly.instantiate(e,t)})).then((function(t){return t})).then(e,(function(t){g("failed to asynchronously prepare wasm: "+t),D(t)}))}if(P++,e.monitorRunDependencies&&e.monitorRunDependencies(P),e.instantiateWasm)try{return e.instantiateWasm(t,n)}catch(t){return g("Module.instantiateWasm callback failed with error: "+t),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||E(W)||M(W)||h||"function"!=typeof fetch?a(i):fetch(W,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(i,(function(t){return g("wasm streaming compile failed: "+t),g("falling back to ArrayBuffer instantiation"),a(i)}))}))).catch(r)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.h).apply(null,arguments)},e._lerc_getBlobInfo=function(){return(e._lerc_getBlobInfo=e.asm.i).apply(null,arguments)},e._lerc_getDataRanges=function(){return(e._lerc_getDataRanges=e.asm.j).apply(null,arguments)},e._lerc_decode=function(){return(e._lerc_decode=e.asm.k).apply(null,arguments)},e._lerc_decode_4D=function(){return(e._lerc_decode_4D=e.asm.l).apply(null,arguments)};var $=e._malloc=function(){return($=e._malloc=e.asm.n).apply(null,arguments)};e._free=function(){return(e._free=e.asm.o).apply(null,arguments)};var N,G=e.___cxa_is_pointer_type=function(){return(G=e.___cxa_is_pointer_type=e.asm.p).apply(null,arguments)};function X(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Y(t){function r(){N||(N=!0,e.calledRun=!0,I||(V(T),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),C.unshift(t);var t;V(C)}()))}P>0||(!function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),F.unshift(t);var t;V(F)}(),P>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),r()}),1)):r()))}if(S=function t(){N||Y(),N||(S=t)},e.run=Y,e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return Y(),e.ready}})();const pixelTypeInfoMap=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let loadPromise=null,loaded=!1;function load(t={}){if(loadPromise)return loadPromise;const e=t.locateFile||((t,e)=>`${e}${t}`);return loadPromise=Module({locateFile:e}).then((t=>t.ready.then((()=>{initLercLib(t),loaded=!0})))),loadPromise}function isLoaded(){return loaded}const lercLib={getBlobInfo:null,decode:null};function normalizeByteLength(t){return 16+(t>>3<<3)}function copyBytesFromWasm(t,e,n){n.set(t.slice(e,e+n.length))}function initLercLib(t){const{_malloc:e,_free:n,_lerc_getBlobInfo:r,_lerc_getDataRanges:i,_lerc_decode_4D:o,asm:a}=t;let s;const u=Object.values(a).find((e=>e&&"buffer"in e&&e.buffer===t.HEAPU8.buffer)),c=t=>{const n=t.map((t=>normalizeByteLength(t))),r=n.reduce(((t,e)=>t+e)),i=e(r);s=new Uint8Array(u.buffer);let o=n[0];n[0]=i;for(let t=1;t<n.length;t++){const e=n[t];n[t]=n[t-1]+o,o=e}return n};lercLib.getBlobInfo=t=>{const e=new Uint8Array(48),o=new Uint8Array(24),[a,l,f]=c([t.length,e.length,o.length]);s.set(t,a),s.set(e,l),s.set(o,f);let p=r(a,t.length,l,f,12,3);if(p)throw n(a),`lerc-getBlobInfo: error code is ${p}`;s=new Uint8Array(u.buffer),copyBytesFromWasm(s,l,e),copyBytesFromWasm(s,f,o);const h=new Uint32Array(e.buffer),d=new Float64Array(o.buffer),[y,m,g,b,w,_,A,v,x,I,U]=h,R={version:y,dimCount:g,width:b,height:w,validPixelCount:A,bandCount:_,blobSize:v,maskCount:x,depthCount:I,dataType:m,minValue:d[0],maxValue:d[1],maxZerror:d[2],statistics:[],bandCountWithNoData:U};if(U)return R;if(1===I&&1===_)return n(a),R.statistics.push({minValue:d[0],maxValue:d[1]}),R;const B=I*_*8,F=new Uint8Array(B),T=new Uint8Array(B);let C=a,P=0,S=0,D=!1;if(s.byteLength<a+2*B?(n(a),D=!0,[C,P,S]=c([t.length,B,B]),s.set(t,C)):[P,S]=c([B,B]),s.set(F,P),s.set(T,S),p=i(C,t.length,I,_,P,S),p)throw n(C),D||n(P),`lerc-getDataRanges: error code is ${p}`;s=new Uint8Array(u.buffer),copyBytesFromWasm(s,P,F),copyBytesFromWasm(s,S,T);const W=new Float64Array(F.buffer),L=new Float64Array(T.buffer),E=R.statistics;for(let t=0;t<_;t++)if(I>1){const e=W.slice(t*I,(t+1)*I),n=L.slice(t*I,(t+1)*I),r=Math.min.apply(null,e),i=Math.max.apply(null,n);E.push({minValue:r,maxValue:i,dimStats:{minValues:e,maxValues:n},depthStats:{minValues:e,maxValues:n}})}else E.push({minValue:W[t],maxValue:L[t]});return n(C),D||n(P),R},lercLib.decode=(t,e)=>{const{maskCount:r,depthCount:i,bandCount:a,width:l,height:f,dataType:p,bandCountWithNoData:h}=e,d=pixelTypeInfoMap[p],y=l*f,m=new Uint8Array(y*a),g=y*i*a*d.size,b=new Uint8Array(g),w=new Uint8Array(a),_=new Uint8Array(8*a),[A,v,x,I,U]=c([t.length,m.length,b.length,w.length,_.length]);s.set(t,A),s.set(m,v),s.set(b,x),s.set(w,I),s.set(_,U);const R=o(A,t.length,r,v,i,l,f,a,p,x,I,U);if(R)throw n(A),`lerc-decode: error code is ${R}`;s=new Uint8Array(u.buffer),copyBytesFromWasm(s,x,b),copyBytesFromWasm(s,v,m);let B=null;if(h){copyBytesFromWasm(s,I,w),copyBytesFromWasm(s,U,_),B=[];const t=new Float64Array(_.buffer);for(let e=0;e<w.length;e++)B.push(w[e]?t[e]:null)}return n(A),{data:b,maskData:m,noDataValues:B}}}function swapDepthValuesOrder(t,e,n,r,i){if(n<2)return t;const o=new r(e*n);if(i)for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[s]=t[i++];else for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[i++]=t[s];return o}function decode(t,e={}){var n,r;const i=null!==(n=e.inputOffset)&&void 0!==n?n:0,o=t instanceof Uint8Array?t.subarray(i):new Uint8Array(t,i),a=lercLib.getBlobInfo(o),{data:s,maskData:u}=lercLib.decode(o,a),{width:c,height:l,bandCount:f,dimCount:p,depthCount:h,dataType:d,maskCount:y,statistics:m}=a,g=pixelTypeInfoMap[d],b=new g.ctor(s.buffer),w=[],_=[],A=c*l,v=A*h,x=null!==(r=e.returnInterleaved)&&void 0!==r?r:e.returnPixelInterleavedDims;for(let t=0;t<f;t++){const e=b.subarray(t*v,(t+1)*v);if(x)w.push(e);else{const t=swapDepthValuesOrder(e,A,h,g.ctor,!0);w.push(t)}_.push(u.subarray(t*v,(t+1)*v))}const I=0===y?null:1===y?_[0]:new Uint8Array(A);if(y>1){I.set(_[0]);for(let t=1;t<_.length;t++){const e=_[t];for(let t=0;t<A;t++)I[t]=I[t]&e[t]}}const{noDataValue:U}=e,R=null!=U&&g.range[0]<=U&&g.range[1]>=U;if(y>0&&R)for(let t=0;t<f;t++){const e=w[t],n=_[t]||I;for(let t=0;t<A;t++)0===n[t]&&(e[t]=U)}const B=y===f&&f>1?_:null,{pixelType:F}=g;return{width:c,height:l,pixelType:F,statistics:m,pixels:w,mask:I,dimCount:p,depthCount:h,bandMasks:B}}function getBlobInfo(t,e={}){var n;const r=new Uint8Array(t,null!==(n=e.inputOffset)&&void 0!==n?n:0);return lercLib.getBlobInfo(r)}function getBandCount(t,e={}){return getBlobInfo(t,e).bandCount}export{decode,getBandCount,getBlobInfo,isLoaded,load};
var Module=(()=>{var t=import.meta.url;return function(e){var n,r;(e=void 0!==(e=e||{})?e:{}).ready=new Promise((function(t,e){n=t,r=e}));var i,o,a,s,u,c,l=Object.assign({},e),f="object"==typeof window,p="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,d="";h?(d=p?require("path").dirname(d)+"/":__dirname+"/",c=()=>{u||(s=require("fs"),u=require("path"))},i=function(t,e){return c(),t=u.normalize(t),s.readFileSync(t,e?void 0:"utf8")},a=t=>{var e=i(t,!0);return e.buffer||(e=new Uint8Array(e)),e},o=(t,e,n)=>{c(),t=u.normalize(t),s.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof X))throw t})),process.on("unhandledRejection",(function(t){throw t})),e.inspect=function(){return"[Emscripten Module object]"}):(f||p)&&(p?d=self.location.href:"undefined"!=typeof document&&document.currentScript&&(d=document.currentScript.src),t&&(d=t),d=0!==d.indexOf("blob:")?d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},p&&(a=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}),e.print||console.log.bind(console);var y,m,g=e.printErr||console.warn.bind(console);Object.assign(e,l),l=null,e.arguments,e.thisProgram,e.quit,e.wasmBinary&&(y=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&D("no native wasm support detected");var b,w,_,A,v,x,U=!1,I="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e){return t?function(t,e,n){for(var r=e+n,i=e;t[i]&&!(i>=r);)++i;if(i-e>16&&t.buffer&&I)return I.decode(t.subarray(e,i));for(var o="";e<i;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var u=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[e++])<65536)o+=String.fromCharCode(a);else{var c=a-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}(_,t,e):""}function B(t){b=t,e.HEAP8=w=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=A=new Int32Array(t),e.HEAPU8=_=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=v=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}e.INITIAL_MEMORY;var F=[],T=[],C=[];var P=0,S=null;function D(t){e.onAbort&&e.onAbort(t),g(t="Aborted("+t+")"),U=!0,t+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(t);throw r(n),n}var W,L;function E(t){return t.startsWith("data:application/octet-stream;base64,")}function M(t){return t.startsWith("file://")}function z(t){try{if(t==W&&y)return new Uint8Array(y);if(a)return a(t);throw"both async and sync fetching of the wasm failed"}catch(t){D(t)}}function V(t){for(;t.length>0;){var n=t.shift();if("function"!=typeof n){var r=n.func;"number"==typeof r?void 0===n.arg?k(r)():k(r)(n.arg):r(void 0===n.arg?null:n.arg)}else n(e)}}e.locateFile?E(W="lerc-wasm.wasm")||(L=W,W=e.locateFile?e.locateFile(L,d):d+L):W=new URL("lerc-wasm.wasm",import.meta.url).toString();var j=[];function k(t){var e=j[t];return e||(t>=j.length&&(j.length=t+1),j[t]=e=x.get(t)),e}function H(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){v[this.ptr+4>>2]=t},this.get_type=function(){return v[this.ptr+4>>2]},this.set_destructor=function(t){v[this.ptr+8>>2]=t},this.get_destructor=function(){return v[this.ptr+8>>2]},this.set_refcount=function(t){A[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,w[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,w[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=A[this.ptr>>2];A[this.ptr>>2]=t+1},this.release_ref=function(){var t=A[this.ptr>>2];return A[this.ptr>>2]=t-1,1===t},this.set_adjusted_ptr=function(t){v[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return v[this.ptr+16>>2]},this.get_exception_ptr=function(){if(G(this.get_type()))return v[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function O(t){try{return m.grow(t-b.byteLength+65535>>>16),B(m.buffer),1}catch(t){}}var q={a:function(t,e,n,r){D("Assertion failed: "+R(t)+", at: "+[e?R(e):"unknown filename",n,r?R(r):"unknown function"])},c:function(t){return $(t+24)+24},b:function(t,e,n){throw new H(t).init(e,n),t},d:function(){D("")},f:function(t,e,n){_.copyWithin(t,e,e+n)},e:function(t){var e,n,r=_.length,i=2147483648;if((t>>>=0)>i)return!1;for(var o=1;o<=4;o*=2){var a=r*(1+.2/o);if(a=Math.min(a,t+100663296),O(Math.min(i,(e=Math.max(t,a))+((n=65536)-e%n)%n)))return!0}return!1}};!function(){var t={a:q};function n(t,n){var r,i=t.exports;e.asm=i,B((m=e.asm.g).buffer),x=e.asm.m,r=e.asm.h,T.unshift(r),function(t){if(P--,e.monitorRunDependencies&&e.monitorRunDependencies(P),0==P&&S){var n=S;S=null,n()}}()}function i(t){n(t.instance)}function a(e){return function(){if(!y&&(f||p)){if("function"==typeof fetch&&!M(W))return fetch(W,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+W+"'";return t.arrayBuffer()})).catch((function(){return z(W)}));if(o)return new Promise((function(t,e){o(W,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return z(W)}))}().then((function(e){return WebAssembly.instantiate(e,t)})).then((function(t){return t})).then(e,(function(t){g("failed to asynchronously prepare wasm: "+t),D(t)}))}if(P++,e.monitorRunDependencies&&e.monitorRunDependencies(P),e.instantiateWasm)try{return e.instantiateWasm(t,n)}catch(t){return g("Module.instantiateWasm callback failed with error: "+t),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||E(W)||M(W)||h||"function"!=typeof fetch?a(i):fetch(W,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(i,(function(t){return g("wasm streaming compile failed: "+t),g("falling back to ArrayBuffer instantiation"),a(i)}))}))).catch(r)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.h).apply(null,arguments)},e._lerc_getBlobInfo=function(){return(e._lerc_getBlobInfo=e.asm.i).apply(null,arguments)},e._lerc_getDataRanges=function(){return(e._lerc_getDataRanges=e.asm.j).apply(null,arguments)},e._lerc_decode=function(){return(e._lerc_decode=e.asm.k).apply(null,arguments)},e._lerc_decode_4D=function(){return(e._lerc_decode_4D=e.asm.l).apply(null,arguments)};var $=e._malloc=function(){return($=e._malloc=e.asm.n).apply(null,arguments)};e._free=function(){return(e._free=e.asm.o).apply(null,arguments)};var N,G=e.___cxa_is_pointer_type=function(){return(G=e.___cxa_is_pointer_type=e.asm.p).apply(null,arguments)};function X(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Y(t){function r(){N||(N=!0,e.calledRun=!0,U||(V(T),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),C.unshift(t);var t;V(C)}()))}P>0||(!function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),F.unshift(t);var t;V(F)}(),P>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),r()}),1)):r()))}if(S=function t(){N||Y(),N||(S=t)},e.run=Y,e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return Y(),e.ready}})();const pixelTypeInfoMap=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let loadPromise=null,loaded=!1;function load(t={}){if(loadPromise)return loadPromise;const e=t.locateFile||((t,e)=>`${e}${t}`);return loadPromise=Module({locateFile:e}).then((t=>t.ready.then((()=>{initLercLib(t),loaded=!0})))),loadPromise}function isLoaded(){return loaded}const lercLib={getBlobInfo:null,decode:null};function normalizeByteLength(t){return 16+(t>>3<<3)}function copyBytesFromWasm(t,e,n){n.set(t.slice(e,e+n.length))}function initLercLib(t){const{_malloc:e,_free:n,_lerc_getBlobInfo:r,_lerc_getDataRanges:i,_lerc_decode_4D:o,asm:a}=t;let s;const u=Object.values(a).find((e=>e&&"buffer"in e&&e.buffer===t.HEAPU8.buffer)),c=t=>{const n=t.map((t=>normalizeByteLength(t))),r=n.reduce(((t,e)=>t+e)),i=e(r);s=new Uint8Array(u.buffer);let o=n[0];n[0]=i;for(let t=1;t<n.length;t++){const e=n[t];n[t]=n[t-1]+o,o=e}return n};lercLib.getBlobInfo=t=>{const e=new Uint8Array(48),o=new Uint8Array(24),[a,l,f]=c([t.length,e.length,o.length]);s.set(t,a),s.set(e,l),s.set(o,f);let p=r(a,t.length,l,f,12,3);if(p)throw n(a),`lerc-getBlobInfo: error code is ${p}`;s=new Uint8Array(u.buffer),copyBytesFromWasm(s,l,e),copyBytesFromWasm(s,f,o);const h=new Uint32Array(e.buffer),d=new Float64Array(o.buffer),[y,m,g,b,w,_,A,v,x,U,I]=h,R={version:y,dimCount:g,width:b,height:w,validPixelCount:A,bandCount:_,blobSize:v,maskCount:x,depthCount:U,dataType:m,minValue:d[0],maxValue:d[1],maxZerror:d[2],statistics:[],bandCountWithNoData:I};if(I)return R;if(1===U&&1===_)return n(a),R.statistics.push({minValue:d[0],maxValue:d[1]}),R;const B=U*_*8,F=new Uint8Array(B),T=new Uint8Array(B);let C=a,P=0,S=0,D=!1;if(s.byteLength<a+2*B?(n(a),D=!0,[C,P,S]=c([t.length,B,B]),s.set(t,C)):[P,S]=c([B,B]),s.set(F,P),s.set(T,S),p=i(C,t.length,U,_,P,S),p)throw n(C),D||n(P),`lerc-getDataRanges: error code is ${p}`;s=new Uint8Array(u.buffer),copyBytesFromWasm(s,P,F),copyBytesFromWasm(s,S,T);const W=new Float64Array(F.buffer),L=new Float64Array(T.buffer),E=R.statistics;for(let t=0;t<_;t++)if(U>1){const e=W.slice(t*U,(t+1)*U),n=L.slice(t*U,(t+1)*U),r=Math.min.apply(null,e),i=Math.max.apply(null,n);E.push({minValue:r,maxValue:i,dimStats:{minValues:e,maxValues:n},depthStats:{minValues:e,maxValues:n}})}else E.push({minValue:W[t],maxValue:L[t]});return n(C),D||n(P),R},lercLib.decode=(t,e)=>{const{maskCount:r,depthCount:i,bandCount:a,width:l,height:f,dataType:p,bandCountWithNoData:h}=e,d=pixelTypeInfoMap[p],y=l*f,m=new Uint8Array(y*a),g=y*i*a*d.size,b=new Uint8Array(g),w=new Uint8Array(a),_=new Uint8Array(8*a),[A,v,x,U,I]=c([t.length,m.length,b.length,w.length,_.length]);s.set(t,A),s.set(m,v),s.set(b,x),s.set(w,U),s.set(_,I);const R=o(A,t.length,r,v,i,l,f,a,p,x,U,I);if(R)throw n(A),`lerc-decode: error code is ${R}`;s=new Uint8Array(u.buffer),copyBytesFromWasm(s,x,b),copyBytesFromWasm(s,v,m);let B=null;if(h){copyBytesFromWasm(s,U,w),copyBytesFromWasm(s,I,_),B=[];const t=new Float64Array(_.buffer);for(let e=0;e<w.length;e++)B.push(w[e]?t[e]:null)}return n(A),{data:b,maskData:m,noDataValues:B}}}function swapDepthValuesOrder(t,e,n,r,i){if(n<2)return t;const o=new r(e*n);if(i)for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[s]=t[i++];else for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[i++]=t[s];return o}function decode(t,e={}){var n,r;const i=null!==(n=e.inputOffset)&&void 0!==n?n:0,o=t instanceof Uint8Array?t.subarray(i):new Uint8Array(t,i),a=lercLib.getBlobInfo(o),{data:s,maskData:u}=lercLib.decode(o,a),{width:c,height:l,bandCount:f,dimCount:p,depthCount:h,dataType:d,maskCount:y,statistics:m}=a,g=pixelTypeInfoMap[d],b=new g.ctor(s.buffer),w=[],_=[],A=c*l,v=A*h,x=null!==(r=e.returnInterleaved)&&void 0!==r?r:e.returnPixelInterleavedDims;for(let t=0;t<f;t++){const e=b.subarray(t*v,(t+1)*v);if(x)w.push(e);else{const t=swapDepthValuesOrder(e,A,h,g.ctor,!0);w.push(t)}_.push(u.subarray(t*v,(t+1)*v))}const U=0===y?null:1===y?_[0]:new Uint8Array(A);if(y>1){U.set(_[0]);for(let t=1;t<_.length;t++){const e=_[t];for(let t=0;t<A;t++)U[t]=U[t]&e[t]}}const{noDataValue:I}=e,R=null!=I&&g.range[0]<=I&&g.range[1]>=I;if(y>0&&R)for(let t=0;t<f;t++){const e=w[t],n=_[t]||U;for(let t=0;t<A;t++)0===n[t]&&(e[t]=I)}const B=y===f&&f>1?_:null,{pixelType:F}=g;return{width:c,height:l,pixelType:F,statistics:m,pixels:w,mask:U,dimCount:p,depthCount:h,bandMasks:B}}function getBlobInfo(t,e={}){var n;const r=null!==(n=e.inputOffset)&&void 0!==n?n:0,i=t instanceof Uint8Array?t.subarray(r):new Uint8Array(t,r);return lercLib.getBlobInfo(i)}function getBandCount(t,e={}){return getBlobInfo(t,e).bandCount}export{decode,getBandCount,getBlobInfo,isLoaded,load};

@@ -322,3 +322,3 @@ /*! Lerc 4.0

* @alias module:Lerc
* @param {ArrayBuffer} input The LERC input byte stream
* @param {ArrayBuffer | Uint8Array} input The LERC input byte stream
* @param {object} [options] The decoding options below are optional.

@@ -411,3 +411,3 @@ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.

* @alias module:Lerc
* @param {ArrayBuffer} input The LERC input byte stream
* @param {ArrayBuffer | Uint8Array} input The LERC input byte stream
* @param {object} [options] The decoding options below are optional.

@@ -431,3 +431,4 @@ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.

var _a;
const blob = new Uint8Array(input, (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0);
const inputOffset = (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0;
const blob = input instanceof Uint8Array ? input.subarray(inputOffset) : new Uint8Array(input, inputOffset);
return lercLib.getBlobInfo(blob);

@@ -434,0 +435,0 @@ }

@@ -17,2 +17,2 @@ /*! Lerc 4.0

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Lerc={})}(this,(function(t){"use strict";var e,n=(e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("LercDecode.js",document.baseURI).href,function(t){var n,r;(t=void 0!==(t=t||{})?t:{}).ready=new Promise((function(t,e){n=t,r=e}));var i,o,a,s,u,c,f=Object.assign({},t),l="object"==typeof window,p="function"==typeof importScripts,d="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";d?(h=p?require("path").dirname(h)+"/":__dirname+"/",c=()=>{u||(s=require("fs"),u=require("path"))},i=function(t,e){return c(),t=u.normalize(t),s.readFileSync(t,e?void 0:"utf8")},a=t=>{var e=i(t,!0);return e.buffer||(e=new Uint8Array(e)),e},o=(t,e,n)=>{c(),t=u.normalize(t),s.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof X))throw t})),process.on("unhandledRejection",(function(t){throw t})),t.inspect=function(){return"[Emscripten Module object]"}):(l||p)&&(p?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),e&&(h=e),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},p&&(a=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}),t.print||console.log.bind(console);var y,m,g=t.printErr||console.warn.bind(console);Object.assign(t,f),f=null,t.arguments,t.thisProgram,t.quit,t.wasmBinary&&(y=t.wasmBinary),t.noExitRuntime,"object"!=typeof WebAssembly&&B("no native wasm support detected");var _,w,b,A,v,x,U=!1,R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function I(t,e){return t?function(t,e,n){for(var r=e+n,i=e;t[i]&&!(i>=r);)++i;if(i-e>16&&t.buffer&&R)return R.decode(t.subarray(e,i));for(var o="";e<i;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var u=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[e++])<65536)o+=String.fromCharCode(a);else{var c=a-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}(b,t,e):""}function S(e){_=e,t.HEAP8=w=new Int8Array(e),t.HEAP16=new Int16Array(e),t.HEAP32=A=new Int32Array(e),t.HEAPU8=b=new Uint8Array(e),t.HEAPU16=new Uint16Array(e),t.HEAPU32=v=new Uint32Array(e),t.HEAPF32=new Float32Array(e),t.HEAPF64=new Float64Array(e)}t.INITIAL_MEMORY;var T,C,D=[],E=[],P=[],F=0,j=null;function B(e){t.onAbort&&t.onAbort(e),g(e="Aborted("+e+")"),U=!0,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw r(n),n}function L(t){return t.startsWith("data:application/octet-stream;base64,")}function z(t){return t.startsWith("file://")}function M(t){try{if(t==T&&y)return new Uint8Array(y);if(a)return a(t);throw"both async and sync fetching of the wasm failed"}catch(t){B(t)}}function V(e){for(;e.length>0;){var n=e.shift();if("function"!=typeof n){var r=n.func;"number"==typeof r?void 0===n.arg?W(r)():W(r)(n.arg):r(void 0===n.arg?null:n.arg)}else n(t)}}t.locateFile?L(T="lerc-wasm.wasm")||(C=T,T=t.locateFile?t.locateFile(C,h):h+C):T=new URL("lerc-wasm.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("LercDecode.js",document.baseURI).href).toString();var k=[];function W(t){var e=k[t];return e||(t>=k.length&&(k.length=t+1),k[t]=e=x.get(t)),e}function H(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){v[this.ptr+4>>2]=t},this.get_type=function(){return v[this.ptr+4>>2]},this.set_destructor=function(t){v[this.ptr+8>>2]=t},this.get_destructor=function(){return v[this.ptr+8>>2]},this.set_refcount=function(t){A[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,w[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,w[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=A[this.ptr>>2];A[this.ptr>>2]=t+1},this.release_ref=function(){var t=A[this.ptr>>2];return A[this.ptr>>2]=t-1,1===t},this.set_adjusted_ptr=function(t){v[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return v[this.ptr+16>>2]},this.get_exception_ptr=function(){if(G(this.get_type()))return v[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function O(t){try{return m.grow(t-_.byteLength+65535>>>16),S(m.buffer),1}catch(t){}}var q={a:function(t,e,n,r){B("Assertion failed: "+I(t)+", at: "+[e?I(e):"unknown filename",n,r?I(r):"unknown function"])},c:function(t){return $(t+24)+24},b:function(t,e,n){throw new H(t).init(e,n),t},d:function(){B("")},f:function(t,e,n){b.copyWithin(t,e,e+n)},e:function(t){var e,n,r=b.length,i=2147483648;if((t>>>=0)>i)return!1;for(var o=1;o<=4;o*=2){var a=r*(1+.2/o);if(a=Math.min(a,t+100663296),O(Math.min(i,(e=Math.max(t,a))+((n=65536)-e%n)%n)))return!0}return!1}};!function(){var e={a:q};function n(e,n){var r,i=e.exports;t.asm=i,S((m=t.asm.g).buffer),x=t.asm.m,r=t.asm.h,E.unshift(r),function(e){if(F--,t.monitorRunDependencies&&t.monitorRunDependencies(F),0==F&&j){var n=j;j=null,n()}}()}function i(t){n(t.instance)}function a(t){return function(){if(!y&&(l||p)){if("function"==typeof fetch&&!z(T))return fetch(T,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+T+"'";return t.arrayBuffer()})).catch((function(){return M(T)}));if(o)return new Promise((function(t,e){o(T,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return M(T)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(t,(function(t){g("failed to asynchronously prepare wasm: "+t),B(t)}))}if(F++,t.monitorRunDependencies&&t.monitorRunDependencies(F),t.instantiateWasm)try{return t.instantiateWasm(e,n)}catch(t){return g("Module.instantiateWasm callback failed with error: "+t),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||L(T)||z(T)||d||"function"!=typeof fetch?a(i):fetch(T,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(i,(function(t){return g("wasm streaming compile failed: "+t),g("falling back to ArrayBuffer instantiation"),a(i)}))}))).catch(r)}(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.h).apply(null,arguments)},t._lerc_getBlobInfo=function(){return(t._lerc_getBlobInfo=t.asm.i).apply(null,arguments)},t._lerc_getDataRanges=function(){return(t._lerc_getDataRanges=t.asm.j).apply(null,arguments)},t._lerc_decode=function(){return(t._lerc_decode=t.asm.k).apply(null,arguments)},t._lerc_decode_4D=function(){return(t._lerc_decode_4D=t.asm.l).apply(null,arguments)};var $=t._malloc=function(){return($=t._malloc=t.asm.n).apply(null,arguments)};t._free=function(){return(t._free=t.asm.o).apply(null,arguments)};var N,G=t.___cxa_is_pointer_type=function(){return(G=t.___cxa_is_pointer_type=t.asm.p).apply(null,arguments)};function X(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Y(e){function r(){N||(N=!0,t.calledRun=!0,U||(V(E),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)e=t.postRun.shift(),P.unshift(e);var e;V(P)}()))}F>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)e=t.preRun.shift(),D.unshift(e);var e;V(D)}(),F>0||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),r()}),1)):r()))}if(j=function t(){N||Y(),N||(j=t)},t.run=Y,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Y(),t.ready});const r=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let i=null,o=!1;const a={getBlobInfo:null,decode:null};function s(t,e,n){n.set(t.slice(e,e+n.length))}function u(t,e,n,r,i){if(n<2)return t;const o=new r(e*n);if(i)for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[s]=t[i++];else for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[i++]=t[s];return o}function c(t,e={}){var n;const r=new Uint8Array(t,null!==(n=e.inputOffset)&&void 0!==n?n:0);return a.getBlobInfo(r)}t.decode=function(t,e={}){var n,i;const o=null!==(n=e.inputOffset)&&void 0!==n?n:0,s=t instanceof Uint8Array?t.subarray(o):new Uint8Array(t,o),c=a.getBlobInfo(s),{data:f,maskData:l}=a.decode(s,c),{width:p,height:d,bandCount:h,dimCount:y,depthCount:m,dataType:g,maskCount:_,statistics:w}=c,b=r[g],A=new b.ctor(f.buffer),v=[],x=[],U=p*d,R=U*m,I=null!==(i=e.returnInterleaved)&&void 0!==i?i:e.returnPixelInterleavedDims;for(let t=0;t<h;t++){const e=A.subarray(t*R,(t+1)*R);if(I)v.push(e);else{const t=u(e,U,m,b.ctor,!0);v.push(t)}x.push(l.subarray(t*R,(t+1)*R))}const S=0===_?null:1===_?x[0]:new Uint8Array(U);if(_>1){S.set(x[0]);for(let t=1;t<x.length;t++){const e=x[t];for(let t=0;t<U;t++)S[t]=S[t]&e[t]}}const{noDataValue:T}=e,C=null!=T&&b.range[0]<=T&&b.range[1]>=T;if(_>0&&C)for(let t=0;t<h;t++){const e=v[t],n=x[t]||S;for(let t=0;t<U;t++)0===n[t]&&(e[t]=T)}const D=_===h&&h>1?x:null,{pixelType:E}=b;return{width:p,height:d,pixelType:E,statistics:w,pixels:v,mask:S,dimCount:y,depthCount:m,bandMasks:D}},t.getBandCount=function(t,e={}){return c(t,e).bandCount},t.getBlobInfo=c,t.isLoaded=function(){return o},t.load=function(t={}){if(i)return i;const e=t.locateFile||((t,e)=>`${e}${t}`);return i=n({locateFile:e}).then((t=>t.ready.then((()=>{!function(t){const{_malloc:e,_free:n,_lerc_getBlobInfo:i,_lerc_getDataRanges:o,_lerc_decode_4D:u,asm:c}=t;let f;const l=Object.values(c).find((e=>e&&"buffer"in e&&e.buffer===t.HEAPU8.buffer)),p=t=>{const n=t.map((t=>16+(t>>3<<3))),r=n.reduce(((t,e)=>t+e)),i=e(r);f=new Uint8Array(l.buffer);let o=n[0];n[0]=i;for(let t=1;t<n.length;t++){const e=n[t];n[t]=n[t-1]+o,o=e}return n};a.getBlobInfo=t=>{const e=12,r=3,a=new Uint8Array(4*e),u=new Uint8Array(8*r),[c,d,h]=p([t.length,a.length,u.length]);f.set(t,c),f.set(a,d),f.set(u,h);let y=i(c,t.length,d,h,e,r);if(y)throw n(c),`lerc-getBlobInfo: error code is ${y}`;f=new Uint8Array(l.buffer),s(f,d,a),s(f,h,u);const m=new Uint32Array(a.buffer),g=new Float64Array(u.buffer),[_,w,b,A,v,x,U,R,I,S,T]=m,C={version:_,dimCount:b,width:A,height:v,validPixelCount:U,bandCount:x,blobSize:R,maskCount:I,depthCount:S,dataType:w,minValue:g[0],maxValue:g[1],maxZerror:g[2],statistics:[],bandCountWithNoData:T};if(T)return C;if(1===S&&1===x)return n(c),C.statistics.push({minValue:g[0],maxValue:g[1]}),C;const D=S*x*8,E=new Uint8Array(D),P=new Uint8Array(D);let F=c,j=0,B=0,L=!1;if(f.byteLength<c+2*D?(n(c),L=!0,[F,j,B]=p([t.length,D,D]),f.set(t,F)):[j,B]=p([D,D]),f.set(E,j),f.set(P,B),y=o(F,t.length,S,x,j,B),y)throw n(F),L||n(j),`lerc-getDataRanges: error code is ${y}`;f=new Uint8Array(l.buffer),s(f,j,E),s(f,B,P);const z=new Float64Array(E.buffer),M=new Float64Array(P.buffer),V=C.statistics;for(let t=0;t<x;t++)if(S>1){const e=z.slice(t*S,(t+1)*S),n=M.slice(t*S,(t+1)*S),r=Math.min.apply(null,e),i=Math.max.apply(null,n);V.push({minValue:r,maxValue:i,dimStats:{minValues:e,maxValues:n},depthStats:{minValues:e,maxValues:n}})}else V.push({minValue:z[t],maxValue:M[t]});return n(F),L||n(j),C},a.decode=(t,e)=>{const{maskCount:i,depthCount:o,bandCount:a,width:c,height:d,dataType:h,bandCountWithNoData:y}=e,m=r[h],g=c*d,_=new Uint8Array(g*a),w=g*o*a*m.size,b=new Uint8Array(w),A=new Uint8Array(a),v=new Uint8Array(8*a),[x,U,R,I,S]=p([t.length,_.length,b.length,A.length,v.length]);f.set(t,x),f.set(_,U),f.set(b,R),f.set(A,I),f.set(v,S);const T=u(x,t.length,i,U,o,c,d,a,h,R,I,S);if(T)throw n(x),`lerc-decode: error code is ${T}`;f=new Uint8Array(l.buffer),s(f,R,b),s(f,U,_);let C=null;if(y){s(f,I,A),s(f,S,v),C=[];const t=new Float64Array(v.buffer);for(let e=0;e<A.length;e++)C.push(A[e]?t[e]:null)}return n(x),{data:b,maskData:_,noDataValues:C}}}(t),o=!0})))),i},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Lerc={})}(this,(function(t){"use strict";var e,n=(e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("LercDecode.js",document.baseURI).href,function(t){var n,r;(t=void 0!==(t=t||{})?t:{}).ready=new Promise((function(t,e){n=t,r=e}));var i,o,a,s,u,c,f=Object.assign({},t),l="object"==typeof window,p="function"==typeof importScripts,d="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";d?(h=p?require("path").dirname(h)+"/":__dirname+"/",c=()=>{u||(s=require("fs"),u=require("path"))},i=function(t,e){return c(),t=u.normalize(t),s.readFileSync(t,e?void 0:"utf8")},a=t=>{var e=i(t,!0);return e.buffer||(e=new Uint8Array(e)),e},o=(t,e,n)=>{c(),t=u.normalize(t),s.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof X))throw t})),process.on("unhandledRejection",(function(t){throw t})),t.inspect=function(){return"[Emscripten Module object]"}):(l||p)&&(p?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),e&&(h=e),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},p&&(a=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}),t.print||console.log.bind(console);var y,m,g=t.printErr||console.warn.bind(console);Object.assign(t,f),f=null,t.arguments,t.thisProgram,t.quit,t.wasmBinary&&(y=t.wasmBinary),t.noExitRuntime,"object"!=typeof WebAssembly&&B("no native wasm support detected");var _,w,b,A,v,U,x=!1,R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function I(t,e){return t?function(t,e,n){for(var r=e+n,i=e;t[i]&&!(i>=r);)++i;if(i-e>16&&t.buffer&&R)return R.decode(t.subarray(e,i));for(var o="";e<i;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var u=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[e++])<65536)o+=String.fromCharCode(a);else{var c=a-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}(b,t,e):""}function S(e){_=e,t.HEAP8=w=new Int8Array(e),t.HEAP16=new Int16Array(e),t.HEAP32=A=new Int32Array(e),t.HEAPU8=b=new Uint8Array(e),t.HEAPU16=new Uint16Array(e),t.HEAPU32=v=new Uint32Array(e),t.HEAPF32=new Float32Array(e),t.HEAPF64=new Float64Array(e)}t.INITIAL_MEMORY;var T,C,D=[],E=[],P=[],F=0,j=null;function B(e){t.onAbort&&t.onAbort(e),g(e="Aborted("+e+")"),x=!0,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw r(n),n}function L(t){return t.startsWith("data:application/octet-stream;base64,")}function z(t){return t.startsWith("file://")}function M(t){try{if(t==T&&y)return new Uint8Array(y);if(a)return a(t);throw"both async and sync fetching of the wasm failed"}catch(t){B(t)}}function V(e){for(;e.length>0;){var n=e.shift();if("function"!=typeof n){var r=n.func;"number"==typeof r?void 0===n.arg?W(r)():W(r)(n.arg):r(void 0===n.arg?null:n.arg)}else n(t)}}t.locateFile?L(T="lerc-wasm.wasm")||(C=T,T=t.locateFile?t.locateFile(C,h):h+C):T=new URL("lerc-wasm.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("LercDecode.js",document.baseURI).href).toString();var k=[];function W(t){var e=k[t];return e||(t>=k.length&&(k.length=t+1),k[t]=e=U.get(t)),e}function H(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){v[this.ptr+4>>2]=t},this.get_type=function(){return v[this.ptr+4>>2]},this.set_destructor=function(t){v[this.ptr+8>>2]=t},this.get_destructor=function(){return v[this.ptr+8>>2]},this.set_refcount=function(t){A[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,w[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,w[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=A[this.ptr>>2];A[this.ptr>>2]=t+1},this.release_ref=function(){var t=A[this.ptr>>2];return A[this.ptr>>2]=t-1,1===t},this.set_adjusted_ptr=function(t){v[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return v[this.ptr+16>>2]},this.get_exception_ptr=function(){if(G(this.get_type()))return v[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function O(t){try{return m.grow(t-_.byteLength+65535>>>16),S(m.buffer),1}catch(t){}}var q={a:function(t,e,n,r){B("Assertion failed: "+I(t)+", at: "+[e?I(e):"unknown filename",n,r?I(r):"unknown function"])},c:function(t){return $(t+24)+24},b:function(t,e,n){throw new H(t).init(e,n),t},d:function(){B("")},f:function(t,e,n){b.copyWithin(t,e,e+n)},e:function(t){var e,n,r=b.length,i=2147483648;if((t>>>=0)>i)return!1;for(var o=1;o<=4;o*=2){var a=r*(1+.2/o);if(a=Math.min(a,t+100663296),O(Math.min(i,(e=Math.max(t,a))+((n=65536)-e%n)%n)))return!0}return!1}};!function(){var e={a:q};function n(e,n){var r,i=e.exports;t.asm=i,S((m=t.asm.g).buffer),U=t.asm.m,r=t.asm.h,E.unshift(r),function(e){if(F--,t.monitorRunDependencies&&t.monitorRunDependencies(F),0==F&&j){var n=j;j=null,n()}}()}function i(t){n(t.instance)}function a(t){return function(){if(!y&&(l||p)){if("function"==typeof fetch&&!z(T))return fetch(T,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+T+"'";return t.arrayBuffer()})).catch((function(){return M(T)}));if(o)return new Promise((function(t,e){o(T,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return M(T)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(t,(function(t){g("failed to asynchronously prepare wasm: "+t),B(t)}))}if(F++,t.monitorRunDependencies&&t.monitorRunDependencies(F),t.instantiateWasm)try{return t.instantiateWasm(e,n)}catch(t){return g("Module.instantiateWasm callback failed with error: "+t),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||L(T)||z(T)||d||"function"!=typeof fetch?a(i):fetch(T,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(i,(function(t){return g("wasm streaming compile failed: "+t),g("falling back to ArrayBuffer instantiation"),a(i)}))}))).catch(r)}(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.h).apply(null,arguments)},t._lerc_getBlobInfo=function(){return(t._lerc_getBlobInfo=t.asm.i).apply(null,arguments)},t._lerc_getDataRanges=function(){return(t._lerc_getDataRanges=t.asm.j).apply(null,arguments)},t._lerc_decode=function(){return(t._lerc_decode=t.asm.k).apply(null,arguments)},t._lerc_decode_4D=function(){return(t._lerc_decode_4D=t.asm.l).apply(null,arguments)};var $=t._malloc=function(){return($=t._malloc=t.asm.n).apply(null,arguments)};t._free=function(){return(t._free=t.asm.o).apply(null,arguments)};var N,G=t.___cxa_is_pointer_type=function(){return(G=t.___cxa_is_pointer_type=t.asm.p).apply(null,arguments)};function X(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Y(e){function r(){N||(N=!0,t.calledRun=!0,x||(V(E),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)e=t.postRun.shift(),P.unshift(e);var e;V(P)}()))}F>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)e=t.preRun.shift(),D.unshift(e);var e;V(D)}(),F>0||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),r()}),1)):r()))}if(j=function t(){N||Y(),N||(j=t)},t.run=Y,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Y(),t.ready});const r=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,128]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let i=null,o=!1;const a={getBlobInfo:null,decode:null};function s(t,e,n){n.set(t.slice(e,e+n.length))}function u(t,e,n,r,i){if(n<2)return t;const o=new r(e*n);if(i)for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[s]=t[i++];else for(let r=0,i=0;r<e;r++)for(let a=0,s=r;a<n;a++,s+=e)o[i++]=t[s];return o}function c(t,e={}){var n;const r=null!==(n=e.inputOffset)&&void 0!==n?n:0,i=t instanceof Uint8Array?t.subarray(r):new Uint8Array(t,r);return a.getBlobInfo(i)}t.decode=function(t,e={}){var n,i;const o=null!==(n=e.inputOffset)&&void 0!==n?n:0,s=t instanceof Uint8Array?t.subarray(o):new Uint8Array(t,o),c=a.getBlobInfo(s),{data:f,maskData:l}=a.decode(s,c),{width:p,height:d,bandCount:h,dimCount:y,depthCount:m,dataType:g,maskCount:_,statistics:w}=c,b=r[g],A=new b.ctor(f.buffer),v=[],U=[],x=p*d,R=x*m,I=null!==(i=e.returnInterleaved)&&void 0!==i?i:e.returnPixelInterleavedDims;for(let t=0;t<h;t++){const e=A.subarray(t*R,(t+1)*R);if(I)v.push(e);else{const t=u(e,x,m,b.ctor,!0);v.push(t)}U.push(l.subarray(t*R,(t+1)*R))}const S=0===_?null:1===_?U[0]:new Uint8Array(x);if(_>1){S.set(U[0]);for(let t=1;t<U.length;t++){const e=U[t];for(let t=0;t<x;t++)S[t]=S[t]&e[t]}}const{noDataValue:T}=e,C=null!=T&&b.range[0]<=T&&b.range[1]>=T;if(_>0&&C)for(let t=0;t<h;t++){const e=v[t],n=U[t]||S;for(let t=0;t<x;t++)0===n[t]&&(e[t]=T)}const D=_===h&&h>1?U:null,{pixelType:E}=b;return{width:p,height:d,pixelType:E,statistics:w,pixels:v,mask:S,dimCount:y,depthCount:m,bandMasks:D}},t.getBandCount=function(t,e={}){return c(t,e).bandCount},t.getBlobInfo=c,t.isLoaded=function(){return o},t.load=function(t={}){if(i)return i;const e=t.locateFile||((t,e)=>`${e}${t}`);return i=n({locateFile:e}).then((t=>t.ready.then((()=>{!function(t){const{_malloc:e,_free:n,_lerc_getBlobInfo:i,_lerc_getDataRanges:o,_lerc_decode_4D:u,asm:c}=t;let f;const l=Object.values(c).find((e=>e&&"buffer"in e&&e.buffer===t.HEAPU8.buffer)),p=t=>{const n=t.map((t=>16+(t>>3<<3))),r=n.reduce(((t,e)=>t+e)),i=e(r);f=new Uint8Array(l.buffer);let o=n[0];n[0]=i;for(let t=1;t<n.length;t++){const e=n[t];n[t]=n[t-1]+o,o=e}return n};a.getBlobInfo=t=>{const e=12,r=3,a=new Uint8Array(4*e),u=new Uint8Array(8*r),[c,d,h]=p([t.length,a.length,u.length]);f.set(t,c),f.set(a,d),f.set(u,h);let y=i(c,t.length,d,h,e,r);if(y)throw n(c),`lerc-getBlobInfo: error code is ${y}`;f=new Uint8Array(l.buffer),s(f,d,a),s(f,h,u);const m=new Uint32Array(a.buffer),g=new Float64Array(u.buffer),[_,w,b,A,v,U,x,R,I,S,T]=m,C={version:_,dimCount:b,width:A,height:v,validPixelCount:x,bandCount:U,blobSize:R,maskCount:I,depthCount:S,dataType:w,minValue:g[0],maxValue:g[1],maxZerror:g[2],statistics:[],bandCountWithNoData:T};if(T)return C;if(1===S&&1===U)return n(c),C.statistics.push({minValue:g[0],maxValue:g[1]}),C;const D=S*U*8,E=new Uint8Array(D),P=new Uint8Array(D);let F=c,j=0,B=0,L=!1;if(f.byteLength<c+2*D?(n(c),L=!0,[F,j,B]=p([t.length,D,D]),f.set(t,F)):[j,B]=p([D,D]),f.set(E,j),f.set(P,B),y=o(F,t.length,S,U,j,B),y)throw n(F),L||n(j),`lerc-getDataRanges: error code is ${y}`;f=new Uint8Array(l.buffer),s(f,j,E),s(f,B,P);const z=new Float64Array(E.buffer),M=new Float64Array(P.buffer),V=C.statistics;for(let t=0;t<U;t++)if(S>1){const e=z.slice(t*S,(t+1)*S),n=M.slice(t*S,(t+1)*S),r=Math.min.apply(null,e),i=Math.max.apply(null,n);V.push({minValue:r,maxValue:i,dimStats:{minValues:e,maxValues:n},depthStats:{minValues:e,maxValues:n}})}else V.push({minValue:z[t],maxValue:M[t]});return n(F),L||n(j),C},a.decode=(t,e)=>{const{maskCount:i,depthCount:o,bandCount:a,width:c,height:d,dataType:h,bandCountWithNoData:y}=e,m=r[h],g=c*d,_=new Uint8Array(g*a),w=g*o*a*m.size,b=new Uint8Array(w),A=new Uint8Array(a),v=new Uint8Array(8*a),[U,x,R,I,S]=p([t.length,_.length,b.length,A.length,v.length]);f.set(t,U),f.set(_,x),f.set(b,R),f.set(A,I),f.set(v,S);const T=u(U,t.length,i,x,o,c,d,a,h,R,I,S);if(T)throw n(U),`lerc-decode: error code is ${T}`;f=new Uint8Array(l.buffer),s(f,R,b),s(f,x,_);let C=null;if(y){s(f,I,A),s(f,S,v),C=[];const t=new Float64Array(v.buffer);for(let e=0;e<A.length;e++)C.push(A[e]?t[e]:null)}return n(U),{data:b,maskData:_,noDataValues:C}}}(t),o=!0})))),i},Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "lerc",
"version": "4.0.0",
"version": "4.0.1",
"browser": "LercDecode.js",

@@ -22,2 +22,3 @@ "bugs": {

"main": "LercDecode.js",
"module": "LercDecode.es.js",
"readmeFilename": "README.md",

@@ -24,0 +25,0 @@ "repository": {

@@ -14,11 +14,35 @@ [![npm version][npm-img]][npm-url]

## Browser
## Get started
```html
<script type="text/javascript" src="https://unpkg.com/lerc"></script>
```js
npm install lerc
// es module
import * as Lerc from 'lerc';
// commonJS
const Lerc = require('lerc');
```
```js
// use umd via a script tag
<script type="text/javascript" src="https://unpkg.com/lerc@latest/LercDecode.min.js"></script>
```
## Sample usage
```js
await Lerc.load();
const arrayBuffer = await fetch('http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/0/0/0')
.then(response => response.arrayBuffer());
const pixelBlock = Lerc.decode(arrayBuffer);
const { height, width, pixels, mask } = pixelBlock;
for (let i = 0; i < height; i++) {
for (let j = 0; j < width; j++) {
if (!mask || mask[i * width + j]) {
// do something with valid pixel (i,j)
}
}
}

@@ -28,24 +52,7 @@ // use options

inputOffset: 10, // start from the 10th byte (default is 0)
returnInterleaved: true // only applicable to n-depth lerc2 blobs (default is false)
returnInterleaved: true // only applicable to n-depth lerc blobs (default is false)
});
```
## Node
```js
npm install lerc && npm install node-fetch-commonjs
```
```js
const fetch = require('node-fetch-commonjs');
const Lerc = require('lerc');
fetch('http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer/tile/0/0/0')
.then(response => response.arrayBuffer())
.then(async (body) => {
// on demand load here (internally it's only loading once)
const image = await Lerc.load().then(() => Lerc.decode(body));
console.log(image.width); // 257
});
```
## API Reference

@@ -61,3 +68,3 @@

### load([options]) ⇒ <code>Promise<void></code> ⏏
Load the depencies (web assembly). Check whether dependencies has been loaded using <code>Lerc.isLoaded</code>. The loading promise is cached so it can be invoked multiple times if needed.
Load the dependencies (web assembly). Check whether dependencies has been loaded using <code>Lerc.isLoaded()</code>. The loading promise is cached so it can be invoked multiple times if needed.

@@ -64,0 +71,0 @@

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