@basemaps/lambda-tiler 8.6.0 → 8.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/CHANGELOG.md +70 -20
  2. package/build/__tests__/config.data.js +14 -0
  3. package/build/__tests__/config.data.js.map +1 -1
  4. package/build/cli/render.tile.js +25 -9
  5. package/build/cli/render.tile.js.map +1 -1
  6. package/build/routes/tile.style.json.js +27 -5
  7. package/build/routes/tile.style.json.js.map +1 -1
  8. package/package.json +10 -10
  9. package/src/__tests__/config.data.ts +14 -0
  10. package/src/cli/render.tile.ts +27 -8
  11. package/src/routes/tile.style.json.ts +26 -5
  12. package/tsconfig.tsbuildinfo +1 -1
  13. package/dist/index.js +0 -92072
  14. package/dist/node_modules/.package-lock.json +0 -179
  15. package/dist/node_modules/@img/sharp-libvips-linux-arm64/README.md +0 -47
  16. package/dist/node_modules/@img/sharp-libvips-linux-arm64/lib/glib-2.0/include/glibconfig.h +0 -219
  17. package/dist/node_modules/@img/sharp-libvips-linux-arm64/lib/index.js +0 -1
  18. package/dist/node_modules/@img/sharp-libvips-linux-arm64/lib/libvips-cpp.so.42 +0 -0
  19. package/dist/node_modules/@img/sharp-libvips-linux-arm64/package.json +0 -45
  20. package/dist/node_modules/@img/sharp-libvips-linux-arm64/versions.json +0 -31
  21. package/dist/node_modules/@img/sharp-linux-arm64/LICENSE +0 -191
  22. package/dist/node_modules/@img/sharp-linux-arm64/README.md +0 -18
  23. package/dist/node_modules/@img/sharp-linux-arm64/lib/sharp-linux-arm64.node +0 -0
  24. package/dist/node_modules/@img/sharp-linux-arm64/package.json +0 -47
  25. package/dist/node_modules/color/LICENSE +0 -21
  26. package/dist/node_modules/color/README.md +0 -123
  27. package/dist/node_modules/color/index.js +0 -496
  28. package/dist/node_modules/color/package.json +0 -47
  29. package/dist/node_modules/color-convert/CHANGELOG.md +0 -54
  30. package/dist/node_modules/color-convert/LICENSE +0 -21
  31. package/dist/node_modules/color-convert/README.md +0 -68
  32. package/dist/node_modules/color-convert/conversions.js +0 -839
  33. package/dist/node_modules/color-convert/index.js +0 -81
  34. package/dist/node_modules/color-convert/package.json +0 -48
  35. package/dist/node_modules/color-convert/route.js +0 -97
  36. package/dist/node_modules/color-name/LICENSE +0 -8
  37. package/dist/node_modules/color-name/README.md +0 -11
  38. package/dist/node_modules/color-name/index.js +0 -152
  39. package/dist/node_modules/color-name/package.json +0 -28
  40. package/dist/node_modules/color-string/LICENSE +0 -21
  41. package/dist/node_modules/color-string/README.md +0 -62
  42. package/dist/node_modules/color-string/index.js +0 -242
  43. package/dist/node_modules/color-string/package.json +0 -39
  44. package/dist/node_modules/detect-libc/LICENSE +0 -201
  45. package/dist/node_modules/detect-libc/README.md +0 -163
  46. package/dist/node_modules/detect-libc/index.d.ts +0 -14
  47. package/dist/node_modules/detect-libc/lib/detect-libc.js +0 -267
  48. package/dist/node_modules/detect-libc/lib/filesystem.js +0 -41
  49. package/dist/node_modules/detect-libc/lib/process.js +0 -24
  50. package/dist/node_modules/detect-libc/package.json +0 -41
  51. package/dist/node_modules/is-arrayish/LICENSE +0 -21
  52. package/dist/node_modules/is-arrayish/README.md +0 -16
  53. package/dist/node_modules/is-arrayish/index.js +0 -9
  54. package/dist/node_modules/is-arrayish/package.json +0 -45
  55. package/dist/node_modules/is-arrayish/yarn-error.log +0 -1443
  56. package/dist/node_modules/lerc/CHANGELOG.md +0 -69
  57. package/dist/node_modules/lerc/LercDecode.d.ts +0 -61
  58. package/dist/node_modules/lerc/LercDecode.es.d.ts +0 -61
  59. package/dist/node_modules/lerc/LercDecode.es.js +0 -434
  60. package/dist/node_modules/lerc/LercDecode.es.min.js +0 -17
  61. package/dist/node_modules/lerc/LercDecode.js +0 -448
  62. package/dist/node_modules/lerc/LercDecode.min.js +0 -17
  63. package/dist/node_modules/lerc/README.md +0 -123
  64. package/dist/node_modules/lerc/lerc-wasm.wasm +0 -0
  65. package/dist/node_modules/lerc/package.json +0 -30
  66. package/dist/node_modules/semver/LICENSE +0 -15
  67. package/dist/node_modules/semver/README.md +0 -664
  68. package/dist/node_modules/semver/bin/semver.js +0 -191
  69. package/dist/node_modules/semver/classes/comparator.js +0 -143
  70. package/dist/node_modules/semver/classes/index.js +0 -7
  71. package/dist/node_modules/semver/classes/range.js +0 -556
  72. package/dist/node_modules/semver/classes/semver.js +0 -319
  73. package/dist/node_modules/semver/functions/clean.js +0 -8
  74. package/dist/node_modules/semver/functions/cmp.js +0 -54
  75. package/dist/node_modules/semver/functions/coerce.js +0 -62
  76. package/dist/node_modules/semver/functions/compare-build.js +0 -9
  77. package/dist/node_modules/semver/functions/compare-loose.js +0 -5
  78. package/dist/node_modules/semver/functions/compare.js +0 -7
  79. package/dist/node_modules/semver/functions/diff.js +0 -60
  80. package/dist/node_modules/semver/functions/eq.js +0 -5
  81. package/dist/node_modules/semver/functions/gt.js +0 -5
  82. package/dist/node_modules/semver/functions/gte.js +0 -5
  83. package/dist/node_modules/semver/functions/inc.js +0 -21
  84. package/dist/node_modules/semver/functions/lt.js +0 -5
  85. package/dist/node_modules/semver/functions/lte.js +0 -5
  86. package/dist/node_modules/semver/functions/major.js +0 -5
  87. package/dist/node_modules/semver/functions/minor.js +0 -5
  88. package/dist/node_modules/semver/functions/neq.js +0 -5
  89. package/dist/node_modules/semver/functions/parse.js +0 -18
  90. package/dist/node_modules/semver/functions/patch.js +0 -5
  91. package/dist/node_modules/semver/functions/prerelease.js +0 -8
  92. package/dist/node_modules/semver/functions/rcompare.js +0 -5
  93. package/dist/node_modules/semver/functions/rsort.js +0 -5
  94. package/dist/node_modules/semver/functions/satisfies.js +0 -12
  95. package/dist/node_modules/semver/functions/sort.js +0 -5
  96. package/dist/node_modules/semver/functions/valid.js +0 -8
  97. package/dist/node_modules/semver/index.js +0 -91
  98. package/dist/node_modules/semver/internal/constants.js +0 -37
  99. package/dist/node_modules/semver/internal/debug.js +0 -11
  100. package/dist/node_modules/semver/internal/identifiers.js +0 -25
  101. package/dist/node_modules/semver/internal/lrucache.js +0 -42
  102. package/dist/node_modules/semver/internal/parse-options.js +0 -17
  103. package/dist/node_modules/semver/internal/re.js +0 -223
  104. package/dist/node_modules/semver/package.json +0 -78
  105. package/dist/node_modules/semver/preload.js +0 -4
  106. package/dist/node_modules/semver/range.bnf +0 -16
  107. package/dist/node_modules/semver/ranges/gtr.js +0 -6
  108. package/dist/node_modules/semver/ranges/intersects.js +0 -9
  109. package/dist/node_modules/semver/ranges/ltr.js +0 -6
  110. package/dist/node_modules/semver/ranges/max-satisfying.js +0 -27
  111. package/dist/node_modules/semver/ranges/min-satisfying.js +0 -26
  112. package/dist/node_modules/semver/ranges/min-version.js +0 -63
  113. package/dist/node_modules/semver/ranges/outside.js +0 -82
  114. package/dist/node_modules/semver/ranges/simplify.js +0 -49
  115. package/dist/node_modules/semver/ranges/subset.js +0 -249
  116. package/dist/node_modules/semver/ranges/to-comparators.js +0 -10
  117. package/dist/node_modules/semver/ranges/valid.js +0 -13
  118. package/dist/node_modules/sharp/LICENSE +0 -191
  119. package/dist/node_modules/sharp/README.md +0 -118
  120. package/dist/node_modules/sharp/install/check.js +0 -36
  121. package/dist/node_modules/sharp/lib/channel.js +0 -174
  122. package/dist/node_modules/sharp/lib/colour.js +0 -182
  123. package/dist/node_modules/sharp/lib/composite.js +0 -210
  124. package/dist/node_modules/sharp/lib/constructor.js +0 -444
  125. package/dist/node_modules/sharp/lib/index.d.ts +0 -1717
  126. package/dist/node_modules/sharp/lib/index.js +0 -16
  127. package/dist/node_modules/sharp/lib/input.js +0 -657
  128. package/dist/node_modules/sharp/lib/is.js +0 -169
  129. package/dist/node_modules/sharp/lib/libvips.js +0 -171
  130. package/dist/node_modules/sharp/lib/operation.js +0 -919
  131. package/dist/node_modules/sharp/lib/output.js +0 -1561
  132. package/dist/node_modules/sharp/lib/resize.js +0 -582
  133. package/dist/node_modules/sharp/lib/sharp.js +0 -86
  134. package/dist/node_modules/sharp/lib/utility.js +0 -287
  135. package/dist/node_modules/sharp/package.json +0 -219
  136. package/dist/node_modules/sharp/src/binding.gyp +0 -277
  137. package/dist/node_modules/sharp/src/common.cc +0 -1090
  138. package/dist/node_modules/sharp/src/common.h +0 -393
  139. package/dist/node_modules/sharp/src/metadata.cc +0 -287
  140. package/dist/node_modules/sharp/src/metadata.h +0 -82
  141. package/dist/node_modules/sharp/src/operations.cc +0 -471
  142. package/dist/node_modules/sharp/src/operations.h +0 -125
  143. package/dist/node_modules/sharp/src/pipeline.cc +0 -1724
  144. package/dist/node_modules/sharp/src/pipeline.h +0 -385
  145. package/dist/node_modules/sharp/src/sharp.cc +0 -40
  146. package/dist/node_modules/sharp/src/stats.cc +0 -183
  147. package/dist/node_modules/sharp/src/stats.h +0 -59
  148. package/dist/node_modules/sharp/src/utilities.cc +0 -269
  149. package/dist/node_modules/sharp/src/utilities.h +0 -19
  150. package/dist/node_modules/simple-swizzle/LICENSE +0 -21
  151. package/dist/node_modules/simple-swizzle/README.md +0 -39
  152. package/dist/node_modules/simple-swizzle/index.js +0 -29
  153. package/dist/node_modules/simple-swizzle/package.json +0 -36
  154. package/dist/package-lock.json +0 -610
  155. package/dist/package.json +0 -40
  156. package/dist/static/expected_tile_2193_153_255_z7.png +0 -0
  157. package/dist/static/expected_tile_NZTM2000Quad_30_33_z6.png +0 -0
  158. package/dist/static/expected_tile_WebMercatorQuad_252_156_z8.png +0 -0
@@ -1,17 +0,0 @@
1
- /*! Lerc 4.0
2
- Copyright 2015 - 2023 Esri
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- A local copy of the license and additional notices are located with the
13
- source distribution at:
14
- http://github.com/Esri/lerc/
15
- Contributors: Thomas Maurer, Wenxue Ju
16
- */
17
- 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 n(a),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};
@@ -1,448 +0,0 @@
1
- /*! Lerc 4.0
2
- Copyright 2015 - 2023 Esri
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- A local copy of the license and additional notices are located with the
13
- source distribution at:
14
- http://github.com/Esri/lerc/
15
- Contributors: Thomas Maurer, Wenxue Ju
16
- */
17
-
18
- (function (global, factory) {
19
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
20
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
21
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Lerc = {}));
22
- })(this, (function (exports) { 'use strict';
23
-
24
- var Module = (() => {
25
- var _scriptDir = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('LercDecode.js', document.baseURI).href));
26
-
27
- return (
28
- function(Module) {
29
- Module = Module || {};
30
-
31
- var Module=typeof Module!="undefined"?Module:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject;});var moduleOverrides=Object.assign({},Module);var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/";}else {scriptDirectory=__dirname+"/";}requireNodeFS=()=>{if(!nodePath){fs=require("fs");nodePath=require("path");}};read_=function shell_read(filename,binary){requireNodeFS();filename=nodePath["normalize"](filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret);}return ret};readAsync=(filename,onload,onerror)=>{requireNodeFS();filename=nodePath["normalize"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer);});};if(process["argv"].length>1){process["argv"][1].replace(/\\/g,"/");}process["argv"].slice(2);process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});Module["inspect"]=function(){return "[Emscripten Module object]"};}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href;}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src;}if(_scriptDir){scriptDirectory=_scriptDir;}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1);}else {scriptDirectory="";}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)};}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror();};xhr.onerror=onerror;xhr.send(null);};}}else;Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"]);if(Module["thisProgram"]);if(Module["quit"]);var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected");}var wasmMemory;var ABORT=false;var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}else {var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2;}else {u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63;}if(u0<65536){str+=String.fromCharCode(u0);}else {var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023);}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}var buffer,HEAP8,HEAPU8,HEAP32,HEAPU32;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=new Float32Array(buf);Module["HEAPF64"]=new Float64Array(buf);}Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift());}}callRuntimeCallbacks(__ATPRERUN__);}function initRuntime(){callRuntimeCallbacks(__ATINIT__);}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift());}}callRuntimeCallbacks(__ATPOSTRUN__);}function addOnPreRun(cb){__ATPRERUN__.unshift(cb);}function addOnInit(cb){__ATINIT__.unshift(cb);}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb);}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies);}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies);}if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback();}}}function abort(what){{if(Module["onAbort"]){Module["onAbort"](what);}}what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;if(Module["locateFile"]){wasmBinaryFile="lerc-wasm.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile);}}else {wasmBinaryFile=new URL("lerc-wasm.wasm",(typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('LercDecode.js', document.baseURI).href))).toString();}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else {throw "both async and sync fetching of the wasm failed"}}catch(err){abort(err);}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw "failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else {if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response));},reject);})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["g"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["m"];addOnInit(Module["asm"]["h"]);removeRunDependency();}addRunDependency();function receiveInstantiationResult(result){receiveInstance(result["instance"]);}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason);})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else {return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync().catch(readyPromiseReject);return {}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func=="number"){if(callback.arg===undefined){getWasmTableEntry(func)();}else {getWasmTableEntry(func)(callback.arg);}}else {func(callback.arg===undefined?null:callback.arg);}}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr);}return func}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type;};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor;};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount;};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught;};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown;};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false);};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1;};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr;};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr};}function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);throw ptr}function _abort(){abort("");}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num);}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var asmLibraryArg={"a":___assert_fail,"c":___cxa_allocate_exception,"b":___cxa_throw,"d":_abort,"f":_emscripten_memcpy_big,"e":_emscripten_resize_heap};createWasm();Module["___wasm_call_ctors"]=function(){return (Module["___wasm_call_ctors"]=Module["asm"]["h"]).apply(null,arguments)};Module["_lerc_getBlobInfo"]=function(){return (Module["_lerc_getBlobInfo"]=Module["asm"]["i"]).apply(null,arguments)};Module["_lerc_getDataRanges"]=function(){return (Module["_lerc_getDataRanges"]=Module["asm"]["j"]).apply(null,arguments)};Module["_lerc_decode"]=function(){return (Module["_lerc_decode"]=Module["asm"]["k"]).apply(null,arguments)};Module["_lerc_decode_4D"]=function(){return (Module["_lerc_decode_4D"]=Module["asm"]["l"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return (_malloc=Module["_malloc"]=Module["asm"]["n"]).apply(null,arguments)};Module["_free"]=function(){return (Module["_free"]=Module["asm"]["o"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return (___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["p"]).apply(null,arguments)};var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status;}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller;};function run(args){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun();}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("");},1);doRun();},1);}else {doRun();}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()();}}run();
32
-
33
-
34
- return Module.ready
35
- }
36
- );
37
- })();
38
-
39
- const pixelTypeInfoMap = [
40
- {
41
- pixelType: "S8",
42
- size: 1,
43
- ctor: Int8Array,
44
- range: [-128, 128]
45
- },
46
- {
47
- pixelType: "U8",
48
- size: 1,
49
- ctor: Uint8Array,
50
- range: [0, 255]
51
- },
52
- {
53
- pixelType: "S16",
54
- size: 2,
55
- ctor: Int16Array,
56
- range: [-32768, 32767]
57
- },
58
- {
59
- pixelType: "U16",
60
- size: 2,
61
- ctor: Uint16Array,
62
- range: [0, 65536]
63
- },
64
- {
65
- pixelType: "S32",
66
- size: 4,
67
- ctor: Int32Array,
68
- range: [-2147483648, 2147483647]
69
- },
70
- {
71
- pixelType: "U32",
72
- size: 4,
73
- ctor: Uint32Array,
74
- range: [0, 4294967296]
75
- },
76
- {
77
- pixelType: "F32",
78
- size: 4,
79
- ctor: Float32Array,
80
- range: [-3.4027999387901484e38, 3.4027999387901484e38]
81
- },
82
- {
83
- pixelType: "F64",
84
- size: 8,
85
- ctor: Float64Array,
86
- range: [-1.7976931348623157e308, 1.7976931348623157e308]
87
- }
88
- ];
89
- let loadPromise = null;
90
- let loaded = false;
91
- function load(options = {}) {
92
- if (loadPromise) {
93
- return loadPromise;
94
- }
95
- const locateFile = options.locateFile || ((wasmFileName, scriptDir) => `${scriptDir}${wasmFileName}`);
96
- loadPromise = Module({ locateFile }).then((lercFactory) => lercFactory.ready.then(() => {
97
- initLercLib(lercFactory);
98
- loaded = true;
99
- }));
100
- return loadPromise;
101
- }
102
- function isLoaded() {
103
- return loaded;
104
- }
105
- const lercLib = {
106
- getBlobInfo: null,
107
- decode: null
108
- };
109
- function normalizeByteLength(n) {
110
- // extra buffer on top of 8 byte boundary: https://stackoverflow.com/questions/56019003/why-malloc-in-webassembly-requires-4x-the-memory
111
- return ((n >> 3) << 3) + 16;
112
- }
113
- function copyBytesFromWasm(wasmHeapU8, ptr_data, data) {
114
- data.set(wasmHeapU8.slice(ptr_data, ptr_data + data.length));
115
- }
116
- function initLercLib(lercFactory) {
117
- const { _malloc, _free, _lerc_getBlobInfo, _lerc_getDataRanges, _lerc_decode_4D, asm } = lercFactory;
118
- // do not use HeapU8 as memory dynamically grows from the initial 16MB
119
- // test case: landsat_6band_8bit.24
120
- let heapU8;
121
- const memory = Object.values(asm).find((val) => val && "buffer" in val && val.buffer === lercFactory.HEAPU8.buffer);
122
- // avoid pointer for detached memory, malloc once:
123
- const mallocMultiple = (byteLengths) => {
124
- const lens = byteLengths.map((len) => normalizeByteLength(len));
125
- const byteLength = lens.reduce((a, b) => a + b);
126
- const ret = _malloc(byteLength);
127
- heapU8 = new Uint8Array(memory.buffer);
128
- let prev = lens[0];
129
- lens[0] = ret;
130
- // pointers for each allocated block
131
- for (let i = 1; i < lens.length; i++) {
132
- const next = lens[i];
133
- lens[i] = lens[i - 1] + prev;
134
- prev = next;
135
- }
136
- return lens;
137
- };
138
- lercLib.getBlobInfo = (blob) => {
139
- // copy data to wasm. info: Uint32, range: F64
140
- const infoArrSize = 12;
141
- const rangeArrSize = 3;
142
- const infoArr = new Uint8Array(infoArrSize * 4);
143
- const rangeArr = new Uint8Array(rangeArrSize * 8);
144
- const [ptr, ptr_info, ptr_range] = mallocMultiple([blob.length, infoArr.length, rangeArr.length]);
145
- heapU8.set(blob, ptr);
146
- heapU8.set(infoArr, ptr_info);
147
- heapU8.set(rangeArr, ptr_range);
148
- // decode
149
- let hr = _lerc_getBlobInfo(ptr, blob.length, ptr_info, ptr_range, infoArrSize, rangeArrSize);
150
- if (hr) {
151
- _free(ptr);
152
- throw `lerc-getBlobInfo: error code is ${hr}`;
153
- }
154
- heapU8 = new Uint8Array(memory.buffer);
155
- copyBytesFromWasm(heapU8, ptr_info, infoArr);
156
- copyBytesFromWasm(heapU8, ptr_range, rangeArr);
157
- const lercInfoArr = new Uint32Array(infoArr.buffer);
158
- const statsArr = new Float64Array(rangeArr.buffer);
159
- // skip ndepth
160
- const [version, dataType, dimCount, width, height, bandCount, validPixelCount, blobSize, maskCount, depthCount, bandCountWithNoData] = lercInfoArr;
161
- const headerInfo = {
162
- version,
163
- dimCount,
164
- width,
165
- height,
166
- validPixelCount,
167
- bandCount,
168
- blobSize,
169
- maskCount,
170
- depthCount,
171
- dataType,
172
- minValue: statsArr[0],
173
- maxValue: statsArr[1],
174
- maxZerror: statsArr[2],
175
- statistics: [],
176
- bandCountWithNoData
177
- };
178
- if (bandCountWithNoData) {
179
- _free(ptr);
180
- return headerInfo;
181
- }
182
- if (depthCount === 1 && bandCount === 1) {
183
- _free(ptr);
184
- headerInfo.statistics.push({
185
- minValue: statsArr[0],
186
- maxValue: statsArr[1]
187
- });
188
- return headerInfo;
189
- }
190
- // get data ranges for nband / ndim blob
191
- // to reuse blob ptr we need to handle dynamic memory allocation
192
- const numStatsBytes = depthCount * bandCount * 8;
193
- const bandStatsMinArr = new Uint8Array(numStatsBytes);
194
- const bandStatsMaxArr = new Uint8Array(numStatsBytes);
195
- let ptr_blob = ptr, ptr_min = 0, ptr_max = 0, blob_freed = false;
196
- if (heapU8.byteLength < ptr + numStatsBytes * 2) {
197
- _free(ptr);
198
- blob_freed = true;
199
- [ptr_blob, ptr_min, ptr_max] = mallocMultiple([blob.length, numStatsBytes, numStatsBytes]);
200
- heapU8.set(blob, ptr_blob);
201
- }
202
- else {
203
- [ptr_min, ptr_max] = mallocMultiple([numStatsBytes, numStatsBytes]);
204
- }
205
- heapU8.set(bandStatsMinArr, ptr_min);
206
- heapU8.set(bandStatsMaxArr, ptr_max);
207
- hr = _lerc_getDataRanges(ptr_blob, blob.length, depthCount, bandCount, ptr_min, ptr_max);
208
- if (hr) {
209
- _free(ptr_blob);
210
- if (!blob_freed) {
211
- // we have two pointers in two wasm function calls
212
- _free(ptr_min);
213
- }
214
- throw `lerc-getDataRanges: error code is ${hr}`;
215
- }
216
- heapU8 = new Uint8Array(memory.buffer);
217
- copyBytesFromWasm(heapU8, ptr_min, bandStatsMinArr);
218
- copyBytesFromWasm(heapU8, ptr_max, bandStatsMaxArr);
219
- const allMinValues = new Float64Array(bandStatsMinArr.buffer);
220
- const allMaxValues = new Float64Array(bandStatsMaxArr.buffer);
221
- const statistics = headerInfo.statistics;
222
- for (let i = 0; i < bandCount; i++) {
223
- if (depthCount > 1) {
224
- const minValues = allMinValues.slice(i * depthCount, (i + 1) * depthCount);
225
- const maxValues = allMaxValues.slice(i * depthCount, (i + 1) * depthCount);
226
- const minValue = Math.min.apply(null, minValues);
227
- const maxValue = Math.max.apply(null, maxValues);
228
- statistics.push({
229
- minValue,
230
- maxValue,
231
- dimStats: { minValues, maxValues },
232
- depthStats: { minValues, maxValues }
233
- });
234
- }
235
- else {
236
- statistics.push({
237
- minValue: allMinValues[i],
238
- maxValue: allMaxValues[i]
239
- });
240
- }
241
- }
242
- _free(ptr_blob);
243
- if (!blob_freed) {
244
- // we have two pointers in two wasm function calls
245
- _free(ptr_min);
246
- }
247
- return headerInfo;
248
- };
249
- lercLib.decode = (blob, blobInfo) => {
250
- const { maskCount, depthCount, bandCount, width, height, dataType, bandCountWithNoData } = blobInfo;
251
- // if the heap is increased dynamically between raw data, mask, and data, the malloc pointer is invalid as it will raise error when accessing mask:
252
- // Cannot perform %TypedArray%.prototype.slice on a detached ArrayBuffer
253
- const pixelTypeInfo = pixelTypeInfoMap[dataType];
254
- const numPixels = width * height;
255
- const maskData = new Uint8Array(numPixels * bandCount);
256
- const numDataBytes = numPixels * depthCount * bandCount * pixelTypeInfo.size;
257
- const data = new Uint8Array(numDataBytes);
258
- const useNoDataArr = new Uint8Array(bandCount);
259
- const noDataArr = new Uint8Array(bandCount * 8);
260
- const [ptr, ptr_mask, ptr_data, ptr_useNoData, ptr_noData] = mallocMultiple([
261
- blob.length,
262
- maskData.length,
263
- data.length,
264
- useNoDataArr.length,
265
- noDataArr.length
266
- ]);
267
- heapU8.set(blob, ptr);
268
- heapU8.set(maskData, ptr_mask);
269
- heapU8.set(data, ptr_data);
270
- heapU8.set(useNoDataArr, ptr_useNoData);
271
- heapU8.set(noDataArr, ptr_noData);
272
- const hr = _lerc_decode_4D(ptr, blob.length, maskCount, ptr_mask, depthCount, width, height, bandCount, dataType, ptr_data, ptr_useNoData, ptr_noData);
273
- if (hr) {
274
- _free(ptr);
275
- throw `lerc-decode: error code is ${hr}`;
276
- }
277
- heapU8 = new Uint8Array(memory.buffer);
278
- copyBytesFromWasm(heapU8, ptr_data, data);
279
- copyBytesFromWasm(heapU8, ptr_mask, maskData);
280
- let noDataValues = null;
281
- if (bandCountWithNoData) {
282
- copyBytesFromWasm(heapU8, ptr_useNoData, useNoDataArr);
283
- copyBytesFromWasm(heapU8, ptr_noData, noDataArr);
284
- noDataValues = [];
285
- const noDataArr64 = new Float64Array(noDataArr.buffer);
286
- for (let i = 0; i < useNoDataArr.length; i++) {
287
- noDataValues.push(useNoDataArr[i] ? noDataArr64[i] : null);
288
- }
289
- }
290
- _free(ptr);
291
- return {
292
- data,
293
- maskData,
294
- noDataValues
295
- };
296
- };
297
- }
298
- function swapDepthValuesOrder(pixels, numPixels, depthCount, OutPixelTypeArray, inputIsBIP) {
299
- if (depthCount < 2) {
300
- return pixels;
301
- }
302
- const swap = new OutPixelTypeArray(numPixels * depthCount);
303
- if (inputIsBIP) {
304
- for (let i = 0, j = 0; i < numPixels; i++) {
305
- for (let iDim = 0, temp = i; iDim < depthCount; iDim++, temp += numPixels) {
306
- swap[temp] = pixels[j++];
307
- }
308
- }
309
- }
310
- else {
311
- for (let i = 0, j = 0; i < numPixels; i++) {
312
- for (let iDim = 0, temp = i; iDim < depthCount; iDim++, temp += numPixels) {
313
- swap[j++] = pixels[temp];
314
- }
315
- }
316
- }
317
- return swap;
318
- }
319
- /**
320
- * Decoding a LERC1/LERC2 byte stream and return an object containing the pixel data.
321
- *
322
- * @alias module:Lerc
323
- * @param {ArrayBuffer | Uint8Array} input The LERC input byte stream
324
- * @param {object} [options] The decoding options below are optional.
325
- * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.
326
- * @param {number} [options.noDataValue] It is recommended to use the returned mask instead of setting this value.
327
- * @param {boolean} [options.returnInterleaved] (ndepth LERC2 only) If true, returned depth values are pixel-interleaved, a.k.a [p1_dep1, p1_dep2, ..., p1_depN, p2_dep1...], default is [p1_dep1, p2_dep1, ..., p1_dep2, p2_dep2...]
328
- * @returns {{width, height, pixels, pixelType, mask, statistics}}
329
- * @property {number} width Width of decoded image.
330
- * @property {number} height Height of decoded image.
331
- * @property {number} depthCount Depth count.
332
- * @property {array} pixels [band1, band2, …] Each band is a typed array of width*height*depthCount.
333
- * @property {string} pixelType The type of pixels represented in the output: U8/S8/S16/U16/S32/U32/F32.
334
- * @property {mask} mask Typed array with a size of width*height, or null if all pixels are valid.
335
- * @property {array} statistics [statistics_band1, statistics_band2, …] Each element is a statistics object representing min and max values
336
- * @property {array} [bandMasks] [band1_mask, band2_mask, …] Each band is a Uint8Array of width * height * depthCount.
337
- **/
338
- function decode(input, options = {}) {
339
- var _a, _b;
340
- // get blob info
341
- const inputOffset = (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0;
342
- const blob = input instanceof Uint8Array ? input.subarray(inputOffset) : new Uint8Array(input, inputOffset);
343
- const blobInfo = lercLib.getBlobInfo(blob);
344
- // decode
345
- const { data, maskData } = lercLib.decode(blob, blobInfo);
346
- const { width, height, bandCount, dimCount, depthCount, dataType, maskCount, statistics } = blobInfo;
347
- // get pixels, per-band masks, and statistics
348
- const pixelTypeInfo = pixelTypeInfoMap[dataType];
349
- const data1 = new pixelTypeInfo.ctor(data.buffer);
350
- const pixels = [];
351
- const masks = [];
352
- const numPixels = width * height;
353
- const numElementsPerBand = numPixels * depthCount;
354
- // options.returnPixelInterleavedDims will be removed in next release
355
- const swap = (_b = options.returnInterleaved) !== null && _b !== void 0 ? _b : options.returnPixelInterleavedDims;
356
- for (let i = 0; i < bandCount; i++) {
357
- const band = data1.subarray(i * numElementsPerBand, (i + 1) * numElementsPerBand);
358
- if (swap) {
359
- pixels.push(band);
360
- }
361
- else {
362
- const bsq = swapDepthValuesOrder(band, numPixels, depthCount, pixelTypeInfo.ctor, true);
363
- pixels.push(bsq);
364
- }
365
- masks.push(maskData.subarray(i * numElementsPerBand, (i + 1) * numElementsPerBand));
366
- }
367
- // get unified mask
368
- const mask = maskCount === 0 ? null : maskCount === 1 ? masks[0] : new Uint8Array(numPixels);
369
- if (maskCount > 1) {
370
- mask.set(masks[0]);
371
- for (let i = 1; i < masks.length; i++) {
372
- const bandMask = masks[i];
373
- for (let j = 0; j < numPixels; j++) {
374
- mask[j] = mask[j] & bandMask[j];
375
- }
376
- }
377
- }
378
- // apply no data value
379
- const { noDataValue } = options;
380
- const applyNoDataValue = noDataValue != null && pixelTypeInfo.range[0] <= noDataValue && pixelTypeInfo.range[1] >= noDataValue;
381
- if (maskCount > 0 && applyNoDataValue) {
382
- for (let i = 0; i < bandCount; i++) {
383
- const band = pixels[i];
384
- const bandMask = masks[i] || mask;
385
- for (let j = 0; j < numPixels; j++) {
386
- if (bandMask[j] === 0) {
387
- band[j] = noDataValue;
388
- }
389
- }
390
- }
391
- }
392
- // only keep band masks when there's per-band unique mask
393
- const bandMasks = maskCount === bandCount && bandCount > 1 ? masks : null;
394
- const { pixelType } = pixelTypeInfo;
395
- return {
396
- width,
397
- height,
398
- pixelType,
399
- statistics,
400
- pixels,
401
- mask,
402
- dimCount,
403
- depthCount,
404
- bandMasks
405
- };
406
- }
407
- /**
408
- * Get the header information of a LERC1/LERC2 byte stream.
409
- *
410
- * @alias module:Lerc
411
- * @param {ArrayBuffer | Uint8Array} input The LERC input byte stream
412
- * @param {object} [options] The decoding options below are optional.
413
- * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.
414
- * @returns {{version, width, height, bandCount, dimCount, validPixelCount, blobSize, dataType, mask, minValue, maxValue, maxZerror, statistics}}
415
- * @property {number} version Compression algorithm version.
416
- * @property {number} width Width of decoded image.
417
- * @property {number} height Height of decoded image.
418
- * @property {number} bandCount Number of bands.
419
- * @property {number} depthCount Depth count.
420
- * @property {number} validPixelCount Number of valid pixels.
421
- * @property {number} blobSize Lerc blob size in bytes.
422
- * @property {number} dataType Data type represented in number.
423
- * @property {number} minValue Minimum pixel value.
424
- * @property {number} maxValue Maximum pixel value.
425
- * @property {number} maxZerror Maximum Z error.
426
- * @property {array} statistics [statistics_band1, statistics_band2, …] Each element is a statistics object representing min and max values
427
- **/
428
- function getBlobInfo(input, options = {}) {
429
- var _a;
430
- const inputOffset = (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0;
431
- const blob = input instanceof Uint8Array ? input.subarray(inputOffset) : new Uint8Array(input, inputOffset);
432
- return lercLib.getBlobInfo(blob);
433
- }
434
- function getBandCount(input, options = {}) {
435
- // this was available in the old JS version but not documented. Keep as is for backward compatibility.
436
- const info = getBlobInfo(input, options);
437
- return info.bandCount;
438
- }
439
-
440
- exports.decode = decode;
441
- exports.getBandCount = getBandCount;
442
- exports.getBlobInfo = getBlobInfo;
443
- exports.isLoaded = isLoaded;
444
- exports.load = load;
445
-
446
- Object.defineProperty(exports, '__esModule', { value: true });
447
-
448
- }));
@@ -1,17 +0,0 @@
1
- /*! Lerc 4.0
2
- Copyright 2015 - 2023 Esri
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- A local copy of the license and additional notices are located with the
13
- source distribution at:
14
- http://github.com/Esri/lerc/
15
- Contributors: Thomas Maurer, Wenxue Ju
16
- */
17
- !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 n(c),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})}));