@loaders.gl/images 4.0.0-alpha.4 → 4.0.0-alpha.5

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 (44) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/dist.min.js +2 -2
  4. package/dist/dist.min.js.map +7 -1
  5. package/dist/image-loader.d.ts +26 -0
  6. package/dist/image-loader.d.ts.map +1 -0
  7. package/dist/image-writer.d.ts +16 -0
  8. package/dist/image-writer.d.ts.map +1 -0
  9. package/dist/index.d.ts +10 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/lib/category-api/binary-image-api.d.ts +19 -0
  12. package/dist/lib/category-api/binary-image-api.d.ts.map +1 -0
  13. package/dist/lib/category-api/image-format.d.ts +5 -0
  14. package/dist/lib/category-api/image-format.d.ts.map +1 -0
  15. package/dist/lib/category-api/image-type.d.ts +12 -0
  16. package/dist/lib/category-api/image-type.d.ts.map +1 -0
  17. package/dist/lib/category-api/parsed-image-api.d.ts +10 -0
  18. package/dist/lib/category-api/parsed-image-api.d.ts.map +1 -0
  19. package/dist/lib/encoders/encode-image.d.ts +12 -0
  20. package/dist/lib/encoders/encode-image.d.ts.map +1 -0
  21. package/dist/lib/parsers/parse-image.d.ts +5 -0
  22. package/dist/lib/parsers/parse-image.d.ts.map +1 -0
  23. package/dist/lib/parsers/parse-to-image-bitmap.d.ts +10 -0
  24. package/dist/lib/parsers/parse-to-image-bitmap.d.ts.map +1 -0
  25. package/dist/lib/parsers/parse-to-image.d.ts +4 -0
  26. package/dist/lib/parsers/parse-to-image.d.ts.map +1 -0
  27. package/dist/lib/parsers/parse-to-node-image.d.ts +4 -0
  28. package/dist/lib/parsers/parse-to-node-image.d.ts.map +1 -0
  29. package/dist/lib/parsers/svg-utils.d.ts +4 -0
  30. package/dist/lib/parsers/svg-utils.d.ts.map +1 -0
  31. package/dist/lib/texture-api/async-deep-map.d.ts +3 -0
  32. package/dist/lib/texture-api/async-deep-map.d.ts.map +1 -0
  33. package/dist/lib/texture-api/deep-load.d.ts +3 -0
  34. package/dist/lib/texture-api/deep-load.d.ts.map +1 -0
  35. package/dist/lib/texture-api/generate-url.d.ts +2 -0
  36. package/dist/lib/texture-api/generate-url.d.ts.map +1 -0
  37. package/dist/lib/texture-api/load-image.d.ts +7 -0
  38. package/dist/lib/texture-api/load-image.d.ts.map +1 -0
  39. package/dist/lib/utils/version.d.ts +2 -0
  40. package/dist/lib/utils/version.d.ts.map +1 -0
  41. package/dist/lib/utils/version.js +1 -1
  42. package/dist/types.d.ts +18 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/package.json +5 -5
@@ -0,0 +1,2 @@
1
+ declare const moduleExports: any;
2
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,aAAa,KAAqB,CAAC"}
package/dist/dist.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){const r=n(4);globalThis.loaders=globalThis.loaders||{},e.exports=Object.assign(globalThis.loaders,r)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,s=[],f=!1,g=-1;function m(){f&&c&&(f=!1,c.length?s=c.concat(s):g=-1,s.length&&l())}function l(){if(!f){var e=u(m);f=!0;for(var t=s.length;t;){for(c=s,s=[];++g<t;)c&&c[g].run();g=-1,t=s.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new d(e,t)),1!==s.length||f||u(l)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t),n.d(t,"ImageLoader",(function(){return L})),n.d(t,"ImageWriter",(function(){return O})),n.d(t,"getBinaryImageMetadata",(function(){return x})),n.d(t,"isImageTypeSupported",(function(){return f})),n.d(t,"getDefaultImageType",(function(){return g})),n.d(t,"isImage",(function(){return m})),n.d(t,"getImageType",(function(){return l})),n.d(t,"getImageSize",(function(){return d})),n.d(t,"getImageData",(function(){return p})),n.d(t,"_isImageFormatSupported",(function(){return _})),n.d(t,"loadImage",(function(){return N}));function r(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var i=n(5);const{_parseImageNode:a}=globalThis,o="undefined"!=typeof Image,u="undefined"!=typeof ImageBitmap,c=Boolean(a),s=!!i.a||c;function f(e){switch(e){case"auto":return u||o||s;case"imagebitmap":return u;case"image":return o;case"data":return s;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function g(){if(u)return"imagebitmap";if(o)return"image";if(s)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function m(e){return Boolean(h(e))}function l(e){const t=h(e);if(!t)throw new Error("Not an image");return t}function d(e){return p(e)}function p(e){switch(l(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function h(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"image":e&&"object"==typeof e&&e.data&&e.width&&e.height?"data":null}const w=/^data:image\/svg\+xml/,y=/\.svg((\?|#).*)?$/;function b(e){return e&&(w.test(e)||y.test(e))}function v(e,t){if(b(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function I(e,t,n){const r=function(e,t){if(b(t)){let t=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,"+btoa(t)}return v(e,t)}(e,n),i=self.URL||self.webkitURL,a="string"!=typeof r&&i.createObjectURL(r);try{return await async function(e,t){const n=new Image;if(n.src=e,t.image&&t.image.decode&&n.decode)return await n.decode(),n;return await new Promise((t,r)=>{try{n.onload=()=>t(n),n.onerror=t=>r(new Error(`Could not load image ${e}: ${t}`))}catch(e){r(e)}})}(a||r,t)}finally{a&&i.revokeObjectURL(a)}}const T={};let j=!0;async function U(e,t,n){let r;if(b(n)){r=await I(e,t,n)}else r=v(e,n);const i=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||T)return!1;return!0}(t)&&j||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),j=!1}return await createImageBitmap(e)}(r,i)}function x(e){const t=B(e);return function(e){const t=B(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,!1)))return null;return{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}(t)||function(e){const t=B(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:r}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let i=2;for(;i+9<t.byteLength;){const e=t.getUint16(i,!1);if(r.has(e))return{mimeType:"image/jpeg",height:t.getUint16(i+5,!1),width:t.getUint16(i+7,!1)};if(!n.has(e))return null;i+=2,i+=t.getUint16(i,!1)}return null}(t)||function(e){const t=B(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}}(t)||function(e){const t=B(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}}(t)}function B(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function E(e,t,n){const i=((t=t||{}).image||{}).type||"auto",{url:a}=n||{};let o;switch(function(e){switch(e){case"auto":case"data":return g();default:return f(e),e}}(i)){case"imagebitmap":o=await U(e,t,a);break;case"image":o=await I(e,t,a);break;case"data":o=await async function(e,t){const{mimeType:n}=x(e)||{},i=globalThis._parseImageNode;return r(i),await i(e,n)}(e);break;default:r(!1)}return"data"===i&&(o=p(o)),o}const L={id:"image",module:"images",name:"Images",version:"4.0.0-alpha.4",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:E,tests:[e=>Boolean(x(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},{_encodeImageNode:D}=globalThis;let M=!0;const O={name:"Images",id:"image",module:"images",version:"4.0.0-alpha.4",extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:async function(e,t){return(t=t||{}).image=t.image||{},D?D(e,{type:t.image.mimeType}):async function(e,t){const{mimeType:n,jpegQuality:r}=t.image,{width:i,height:a}=d(e),o=document.createElement("canvas");o.width=i,o.height=a,function(e,t,n=0,r=0){if(0===n&&0===r&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const n=t.getContext("bitmaprenderer");if(n)return n.transferFromImageBitmap(e),t}const i=t.getContext("2d");if(e.data){const n=new Uint8ClampedArray(e.data),r=new ImageData(n,e.width,e.height);return i.putImageData(r,0,0),t}i.drawImage(e,0,0)}(e,o);const u=await new Promise(e=>{if(r&&M)try{return void o.toBlob(e,n,r)}catch(e){M=!1}o.toBlob(e,n)});if(!u)throw new Error("image encoding failed");return await u.arrayBuffer()}(e,t)}},S=["image/png","image/jpeg","image/gif"],k={};function _(e){return void 0===k[e]&&(k[e]=function(e){switch(e){case"image/webp":return function(){if(!i.a)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return i.a;default:if(!i.a){const{_parseImageNode:t}=globalThis;return Boolean(t)&&S.includes(e)}return!0}}(e)),k[e]}let $="";const P={};function A(e,t,n){let i=e;"function"==typeof e&&(i=e({...t,...n})),r("string"==typeof i);const{baseUrl:a}=t;return a&&(i="/"===a[a.length-1]?`${a}${i}`:`${a}/${i}`),function(e){for(const t in P)if(e.startsWith(t)){const n=P[t];e=e.replace(t,n)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${$}${e}`),e}(i)}async function C(e,t,n){if(Array.isArray(e))return await async function(e,t,n={}){const r=e.map(e=>C(e,t,n));return await Promise.all(r)}(e,t,n);if((r=e)&&"object"==typeof r)return await async function(e,t,n){const r=[],i={};for(const a in e){const o=C(e[a],t,n).then(e=>{i[a]=e});r.push(o)}return await Promise.all(r),i}(e,t,n);var r;const i=e;return await t(i,n)}async function R(e,t,n){return await async function(e,t,n={}){return await C(e,t,n)}(e,e=>V(e,t,n))}async function V(e,t,n){const r=await fetch(e,n.fetch),i=await r.arrayBuffer();return await t(i,n)}async function N(e,t={}){const n=await async function(e,t,n={}){const i=t&&t.image&&t.image.mipLevels||0;return 0!==i?await async function(e,t,n,i){const a=[];if("auto"===t){const r=A(e,n,{...i,lod:0}),o=await V(r,E,n),{width:u,height:c}=d(o);t=function({width:e,height:t}){return 1+Math.floor(Math.log2(Math.max(e,t)))}({width:u,height:c}),a.push(r)}r(t>0);for(let r=a.length;r<t;++r){const t=A(e,n,{...i,lod:r});a.push(t)}return a}(e,i,t,n):A(e,t,n)}(e,t);return await R(n,E,t)}},function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return i}));"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof document&&document;const i=Boolean("object"!=typeof r||"[object process]"!==String(r)||r.browser),a=void 0!==r&&r.version&&/v([0-9]*)/.exec(r.version);a&&parseFloat(a[1])}).call(this,n(2),n(3))}])}));
2
- //# sourceMappingURL=dist.min.js.map
1
+ (()=>{var J=Object.defineProperty;var Be=e=>J(e,"__esModule",{value:!0});var n=(e,t)=>()=>(e&&(t=e(e=0)),t);var De=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Pe=(e,t)=>{Be(e);for(var r in t)J(e,r,{get:t[r],enumerable:!0})};var B,S=n(()=>{B=typeof __VERSION__!="undefined"?__VERSION__:"latest"});function f(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var q=n(()=>{});var p,Ee,Le,Ae,Se,c,z,Oe,H=n(()=>{p={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Ee=p.self||p.window||p.global||{},Le=p.window||p.self||p.global||{},Ae=p.global||p.self||p.window||{},Se=p.document||{},c=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser),z=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Oe=z&&parseFloat(z[1])||0});function O(e){for(let t in Q)if(e.startsWith(t)){let r=Q[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${_e}${e}`),e}var _e,Q,Y=n(()=>{_e="",Q={}});var l=n(()=>{q();H();Y()});function D(e){switch(e){case"auto":return U||_||N;case"imagebitmap":return U;case"image":return _;case"data":return N;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function P(){if(U)return"imagebitmap";if(_)return"image";if(N)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}var Ue,_,U,Ne,N,k=n(()=>{l();({_parseImageNode:Ue}=globalThis),_=typeof Image!="undefined",U=typeof ImageBitmap!="undefined",Ne=Boolean(Ue),N=c?!0:Ne});function X(e){return Boolean(K(e))}function M(e){let t=K(e);if(!t)throw new Error("Not an image");return t}function d(e){return I(e)}function I(e){switch(M(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function K(e){return typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap?"imagebitmap":typeof Image!="undefined"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var w=n(()=>{});function E(e){return e&&(ke.test(e)||Me.test(e))}function Z(e,t){if(E(t)){let a=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(a=unescape(encodeURIComponent(a)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(a)}`}return V(e,t)}function V(e,t){if(E(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}var ke,Me,v=n(()=>{ke=/^data:image\/svg\+xml/,Me=/\.svg((\?|#).*)?$/});async function x(e,t,r){let a=Z(e,r),i=self.URL||self.webkitURL,o=typeof a!="string"&&i.createObjectURL(a);try{return await Ve(o||a,t)}finally{o&&i.revokeObjectURL(o)}}async function Ve(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((a,i)=>{try{r.onload=()=>a(r),r.onerror=o=>i(new Error(`Could not load image ${e}: ${o}`))}catch(o){i(o)}})}var R=n(()=>{v()});async function j(e,t,r){let a;E(r)?a=await x(e,t,r):a=V(e,r);let i=t&&t.imagebitmap;return await Re(a,i)}async function Re(e,t=null){if((je(t)||!ee)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),ee=!1}return await createImageBitmap(e)}function je(e){for(let t in e||ve)return!1;return!0}var ve,ee,te=n(()=>{v();R();ve={},ee=!0});function y(e){let t=T(e);return We(t)||Fe(t)||Ge(t)||Ce(t)}function We(e){let t=T(e);return t.byteLength>=24&&t.getUint32(0,g)===2303741511?{mimeType:"image/png",width:t.getUint32(16,g),height:t.getUint32(20,g)}:null}function Ge(e){let t=T(e);return t.byteLength>=10&&t.getUint32(0,g)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,h),height:t.getUint16(8,h)}:null}function Ce(e){let t=T(e);return t.byteLength>=14&&t.getUint16(0,g)===16973&&t.getUint32(2,h)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,h),height:t.getUint32(22,h)}:null}function Fe(e){let t=T(e);if(!(t.byteLength>=3&&t.getUint16(0,g)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:a,sofMarkers:i}=$e(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,g);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,g),width:t.getUint16(o+7,g)};if(!a.has(s))return null;o+=2,o+=t.getUint16(o,g)}return null}function $e(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);let t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}function T(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}var g,h,L=n(()=>{g=!1,h=!0});async function W(e,t){let{mimeType:r}=y(e)||{},a=globalThis._parseImageNode;return f(a),await a(e,r)}var re=n(()=>{l();L()});async function b(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=r||{},s=Je(i),m;switch(s){case"imagebitmap":m=await j(e,t,o);break;case"image":m=await x(e,t,o);break;case"data":m=await W(e,t);break;default:f(!1)}return i==="data"&&(m=I(m)),m}function Je(e){switch(e){case"auto":case"data":return P();default:return D(e),e}}var G=n(()=>{l();k();w();R();te();re()});var qe,ze,He,ae,oe=n(()=>{S();G();L();qe=["png","jpg","jpeg","gif","webp","bmp","ico","svg"],ze=["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],He={image:{type:"auto",decode:!0}},ae={id:"image",module:"images",name:"Images",version:B,mimeTypes:ze,extensions:qe,parse:b,tests:[e=>Boolean(y(new DataView(e)))],options:He}});async function ne(e,t){return t=t||{},t.image=t.image||{},ie?ie(e,{type:t.image.mimeType}):Qe(e,t)}async function Qe(e,t){let{mimeType:r,jpegQuality:a}=t.image,{width:i,height:o}=d(e),s=document.createElement("canvas");s.width=i,s.height=o,Ye(e,s);let m=await new Promise(u=>{if(a&&se)try{s.toBlob(u,r,a);return}catch{se=!1}s.toBlob(u,r)});if(!m)throw new Error("image encoding failed");return await m.arrayBuffer()}function Ye(e,t,r=0,a=0){if(r===0&&a===0&&typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let o=t.getContext("bitmaprenderer");if(o)return o.transferFromImageBitmap(e),t}let i=t.getContext("2d");if(e.data){let o=new Uint8ClampedArray(e.data),s=new ImageData(o,e.width,e.height);return i.putImageData(s,0,0),t}return i.drawImage(e,0,0),t}var ie,se,me=n(()=>{w();({_encodeImageNode:ie}=globalThis);se=!0});var pe,ge=n(()=>{S();me();pe={name:"Images",id:"image",module:"images",version:B,extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:ne}});function fe(e){return C[e]===void 0&&(C[e]=Ke(e)),C[e]}function Ke(e){switch(e){case"image/webp":return Ze();case"image/svg":return c;default:if(!c){let{_parseImageNode:t}=globalThis;return Boolean(t)&&Xe.includes(e)}return!0}}function Ze(){if(!c)return!1;try{return document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")===0}catch{return!1}}var Xe,C,ce=n(()=>{l();Xe=["image/png","image/jpeg","image/gif"],C={}});function A(e,t,r){let a=e;typeof e=="function"&&(a=e({...t,...r})),f(typeof a=="string");let{baseUrl:i}=t;return i&&(a=i[i.length-1]==="/"?`${i}${a}`:`${i}/${a}`),O(a)}var le=n(()=>{l()});async function ue(e,t,r={}){return await F(e,t,r)}async function F(e,t,r){return Array.isArray(e)?await rt(e,t,r):et(e)?await tt(e,t,r):await t(e,r)}async function tt(e,t,r){let a=[],i={};for(let o in e){let s=e[o],m=F(s,t,r).then(u=>{i[o]=u});a.push(m)}return await Promise.all(a),i}async function rt(e,t,r={}){let a=e.map(i=>F(i,t,r));return await Promise.all(a)}var et,de=n(()=>{et=e=>e&&typeof e=="object"});async function ye(e,t,r){return await ue(e,a=>$(a,t,r))}async function $(e,t,r){let i=await(await fetch(e,r.fetch)).arrayBuffer();return await t(i,r)}var be=n(()=>{de()});async function Ie(e,t={}){let r=await at(e,t);return await ye(r,b,t)}async function at(e,t,r={}){let a=t&&t.image&&t.image.mipLevels||0;return a!==0?await ot(e,a,t,r):A(e,t,r)}async function ot(e,t,r,a){let i=[];if(t==="auto"){let o=A(e,r,{...a,lod:0}),s=await $(o,b,r),{width:m,height:u}=d(s);t=it({width:m,height:u}),i.push(o)}f(t>0);for(let o=i.length;o<t;++o){let s=A(e,r,{...a,lod:o});i.push(s)}return i}function it({width:e,height:t}){return 1+Math.floor(Math.log2(Math.max(e,t)))}var we=n(()=>{l();G();w();le();be()});var xe={};Pe(xe,{ImageLoader:()=>ae,ImageWriter:()=>pe,_isImageFormatSupported:()=>fe,getBinaryImageMetadata:()=>y,getDefaultImageType:()=>P,getImageData:()=>I,getImageSize:()=>d,getImageType:()=>M,isImage:()=>X,isImageTypeSupported:()=>D,loadImage:()=>Ie});var he=n(()=>{oe();ge();L();k();w();ce();we()});var st=De((yr,Te)=>{var nt=(he(),xe);globalThis.loaders=globalThis.loaders||{};Te.exports=Object.assign(globalThis.loaders,nt)});st();})();
2
+ //# sourceMappingURL=dist.min.js.map
@@ -1 +1,7 @@
1
- {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/bundle.ts","webpack:///(webpack)/buildin/global.js","webpack:////home/user/apps/loaders.gl_duplicate/node_modules/process/browser.js","webpack:///../loader-utils/src/lib/env-utils/assert.ts","webpack:///./src/lib/category-api/image-type.ts","webpack:///./src/lib/category-api/parsed-image-api.ts","webpack:///./src/lib/parsers/svg-utils.ts","webpack:///./src/lib/parsers/parse-to-image.ts","webpack:///./src/lib/parsers/parse-to-image-bitmap.ts","webpack:///./src/lib/category-api/binary-image-api.ts","webpack:///./src/lib/parsers/parse-image.ts","webpack:///./src/lib/parsers/parse-to-node-image.ts","webpack:///./src/image-loader.ts","webpack:///./src/lib/utils/version.ts","webpack:///./src/lib/encoders/encode-image.ts","webpack:///./src/image-writer.ts","webpack:///./src/lib/category-api/image-format.ts","webpack:///../loader-utils/src/lib/path-utils/file-aliases.ts","webpack:///./src/lib/texture-api/generate-url.ts","webpack:///./src/lib/texture-api/async-deep-map.ts","webpack:///./src/lib/texture-api/deep-load.ts","webpack:///./src/lib/texture-api/load-image.ts","webpack:///../loader-utils/src/lib/env-utils/globals.ts"],"names":["root","factory","exports","module","define","amd","a","i","window","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","moduleExports","require","globalThis","loaders","assign","g","this","Function","e","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","Error","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","length","concat","drainQueue","timeout","len","run","marker","runClearTimeout","Item","array","noop","nextTick","args","Array","arguments","push","apply","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","assert","condition","message","_parseImageNode","IMAGE_SUPPORTED","Image","IMAGE_BITMAP_SUPPORTED","ImageBitmap","NODE_IMAGE_SUPPORTED","Boolean","DATA_SUPPORTED","isBrowser","isImageTypeSupported","type","getDefaultImageType","isImage","image","getImageTypeOrNull","getImageType","format","getImageSize","getImageData","canvas","document","createElement","context","getContext","width","height","drawImage","data","SVG_DATA_URL_PATTERN","SVG_URL_PATTERN","isSVG","url","test","getBlob","arrayBuffer","Blob","Uint8Array","async","parseToImage","options","blobOrDataUrl","xmlText","TextDecoder","decode","unescape","encodeURIComponent","error","btoa","getBlobOrSVGDataUrl","URL","self","webkitURL","objectUrl","createObjectURL","src","Promise","resolve","reject","onload","onerror","err","loadToImage","revokeObjectURL","EMPTY_OBJECT","imagebitmapOptionsSupported","parseToImageBitmap","blob","imagebitmapOptions","imagebitmap","isEmptyObject","createImageBitmap","console","warn","safeCreateImageBitmap","getBinaryImageMetadata","binaryData","dataView","toDataView","byteLength","getUint32","mimeType","getPngMetadata","getUint16","getUint8","tableMarkers","sofMarkers","Set","add","getJpegMarkers","has","getJpegMetadata","getGifMetadata","getBmpMetadata","DataView","ArrayBuffer","isView","buffer","parseImage","imageType","getLoadableImageType","parseToNodeImage","ImageLoader","id","mimeTypes","extensions","parse","tests","_encodeImageNode","qualityParamSupported","ImageWriter","jpegQuality","encode","x","y","transferFromImageBitmap","clampedArray","Uint8ClampedArray","imageData","ImageData","putImageData","drawImageToCanvas","toBlob","encodeImageInBrowser","NODE_FORMAT_SUPPORT","mimeTypeSupported","_isImageFormatSupported","undefined","toDataURL","indexOf","checkWebPSupport","includes","checkFormatSupport","pathPrefix","fileAliases","generateUrl","getUrl","urlOptions","baseUrl","filename","alias","startsWith","replacement","replace","resolvePath","mapSubtree","func","isArray","urlArray","promises","map","all","mapArray","values","promise","then","mapObject","deepLoad","urlTree","load","tree","asyncDeepMap","shallowLoad","response","fetch","loadImage","imageUrls","mipLevels","urls","lod","Math","floor","log2","max","getMipLevels","mipLevel","getMipmappedImageUrls","getImageUrls","String","matches","exec","parseFloat"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9C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AM+B,EAAiB,GAGvB,GAAkB,SAAdD,EAAsB,CACxB,MAAMvI,EAAMuG,EAAYC,EAAQhG,EAAS,IAAIiG,EAAYgC,IAAK,IACxD3J,QAAcoJ,EAAYlI,EAAKkE,EAAY1D,IAE3C,MAACf,EAAD,OAAQC,GAAUR,EAAaJ,GACrCyJ,EAkBG,UAAsB,MAAC9I,EAAD,OAAQC,IACnC,OAAO,EAAIgJ,KAAKC,MAAMD,KAAKE,KAAKF,KAAKG,IAAIpJ,EAAOC,KAnBlCoJ,CAAa,CAACrJ,QAAOC,WAGjC8I,EAAKjM,KAAKyD,GAIZlC,EAAOyK,EAAY,GAEnB,IAAK,IAAIQ,EAAWP,EAAKhN,OAAQuN,EAAWR,IAAaQ,EAAU,CACjE,MAAM/I,EAAMuG,EAAYC,EAAQhG,EAAS,IAAIiG,EAAYgC,IAAKM,IAC9DP,EAAKjM,KAAKyD,GAGZ,OAAOwI,EA3BGQ,CAAsBxC,EAAQ+B,EAAW/H,EAASiG,GACxDF,EAAYC,EAAQhG,EAASiG,GARTwC,CAAazC,EAAQhG,GAC7C,aAAaqH,EAASS,EAAWpE,EAAY1D,K,8BCR/C,gDAKwB,oBAATW,MAAwBA,KACX,oBAAXtJ,QAA0BA,OAEX,oBAAbwH,UAA4BA,SAJ/C,MAgBaZ,EAEXF,QAA2B,iBAAZ5D,GAA4C,qBAApBuO,OAAOvO,IAAmCA,EAAQ+B,SAMrFyM,OACe,IAAZxO,GAA2BA,EAAQkC,SAAW,YAAYuM,KAAKzO,EAAQkC,SAE5CsM,GAAWE,WAAWF,EAAQ,M","file":"dist.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n","import {isBrowser} from '@loaders.gl/loader-utils';\nimport type {ImageTypeEnum} from '../../types';\n\n// @ts-ignore TS2339: Property does not exist on type\nconst {_parseImageNode} = globalThis;\n\nconst IMAGE_SUPPORTED = typeof Image !== 'undefined'; // NOTE: \"false\" positives if jsdom is installed\nconst IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== 'undefined';\nconst NODE_IMAGE_SUPPORTED = Boolean(_parseImageNode);\nconst DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;\n\n/**\n * Checks if a loaders.gl image type is supported\n * @param type image type string\n */\nexport function isImageTypeSupported(type: string): boolean {\n switch (type) {\n case 'auto':\n // Should only ever be false in Node.js, if polyfills have not been installed...\n return IMAGE_BITMAP_SUPPORTED || IMAGE_SUPPORTED || DATA_SUPPORTED;\n\n case 'imagebitmap':\n return IMAGE_BITMAP_SUPPORTED;\n case 'image':\n return IMAGE_SUPPORTED;\n case 'data':\n return DATA_SUPPORTED;\n\n default:\n throw new Error(`@loaders.gl/images: image ${type} not supported in this environment`);\n }\n}\n\n/**\n * Returns the \"most performant\" supported image type on this platform\n * @returns image type string\n */\nexport function getDefaultImageType(): ImageTypeEnum {\n if (IMAGE_BITMAP_SUPPORTED) {\n return 'imagebitmap';\n }\n if (IMAGE_SUPPORTED) {\n return 'image';\n }\n if (DATA_SUPPORTED) {\n return 'data';\n }\n\n // This should only happen in Node.js\n throw new Error('Install \\'@loaders.gl/polyfills\\' to parse images under Node.js');\n}\n","import type {ImageType, ImageTypeEnum, ImageDataType} from '../../types';\n\nexport function isImage(image: ImageType): boolean {\n return Boolean(getImageTypeOrNull(image));\n}\n\nexport function deleteImage(image: ImageType): void {\n switch (getImageType(image)) {\n case 'imagebitmap':\n (image as ImageBitmap).close();\n break;\n default:\n // Nothing to do for images and image data objects\n }\n}\n\nexport function getImageType(image: ImageType): ImageTypeEnum {\n const format = getImageTypeOrNull(image);\n if (!format) {\n throw new Error('Not an image');\n }\n return format;\n}\n\nexport function getImageSize(image: ImageType): {width: number; height: number} {\n return getImageData(image);\n}\n\nexport function getImageData(image: ImageType): ImageDataType | ImageData {\n switch (getImageType(image)) {\n case 'data':\n return image as unknown as ImageData;\n\n case 'image':\n case 'imagebitmap':\n // Extract the image data from the image via a canvas\n const canvas = document.createElement('canvas');\n // TODO - reuse the canvas?\n const context = canvas.getContext('2d');\n if (!context) {\n throw new Error('getImageData');\n }\n // @ts-ignore\n canvas.width = image.width;\n // @ts-ignore\n canvas.height = image.height;\n // @ts-ignore\n context.drawImage(image, 0, 0);\n // @ts-ignore\n return context.getImageData(0, 0, image.width, image.height);\n\n default:\n throw new Error('getImageData');\n }\n}\n\n// PRIVATE\n\n// eslint-disable-next-line complexity\nfunction getImageTypeOrNull(image) {\n if (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n return 'imagebitmap';\n }\n if (typeof Image !== 'undefined' && image instanceof Image) {\n return 'image';\n }\n if (image && typeof image === 'object' && image.data && image.width && image.height) {\n return 'data';\n }\n return null;\n}\n","// SVG parsing has limitations, e.g:\n// https://bugs.chromium.org/p/chromium/issues/detail?id=606319\n\nconst SVG_DATA_URL_PATTERN = /^data:image\\/svg\\+xml/;\nconst SVG_URL_PATTERN = /\\.svg((\\?|#).*)?$/;\n\nexport function isSVG(url) {\n return url && (SVG_DATA_URL_PATTERN.test(url) || SVG_URL_PATTERN.test(url));\n}\n\nexport function getBlobOrSVGDataUrl(arrayBuffer: ArrayBuffer, url?: string): Blob | string {\n if (isSVG(url)) {\n // Prepare a properly tagged data URL, and load using normal mechanism\n const textDecoder = new TextDecoder();\n let xmlText = textDecoder.decode(arrayBuffer);\n // TODO Escape in browser to support e.g. Chinese characters\n try {\n if (typeof unescape === 'function' && typeof encodeURIComponent === 'function') {\n xmlText = unescape(encodeURIComponent(xmlText));\n }\n } catch (error) {\n throw new Error((error as Error).message);\n }\n // base64 encoding is safer. utf-8 fails in some browsers\n const src = `data:image/svg+xml;base64,${btoa(xmlText)}`;\n return src;\n }\n return getBlob(arrayBuffer, url);\n}\n\nexport function getBlob(arrayBuffer: ArrayBuffer, url?: string): Blob {\n if (isSVG(url)) {\n // https://bugs.chromium.org/p/chromium/issues/detail?id=606319\n // return new Blob([new Uint8Array(arrayBuffer)], {type: 'image/svg+xml'});\n throw new Error('SVG cannot be parsed directly to imagebitmap');\n }\n // TODO - how to determine mime type? Param? Sniff here?\n return new Blob([new Uint8Array(arrayBuffer)]); // MIME type not needed?\n}\n","import type {ImageLoaderOptions} from '../../image-loader';\nimport {getBlobOrSVGDataUrl} from './svg-utils';\n\n// Parses html image from array buffer\nexport default async function parseToImage(\n arrayBuffer: ArrayBuffer,\n options: ImageLoaderOptions,\n url?: string\n): Promise<HTMLImageElement> {\n // Note: image parsing requires conversion to Blob (for createObjectURL).\n // Potentially inefficient for not using `response.blob()` (and for File / Blob inputs)...\n // But presumably not worth adding 'blob' flag to loader objects?\n\n const blobOrDataUrl = getBlobOrSVGDataUrl(arrayBuffer, url);\n const URL = self.URL || self.webkitURL;\n const objectUrl = typeof blobOrDataUrl !== 'string' && URL.createObjectURL(blobOrDataUrl);\n try {\n return await loadToImage(objectUrl || blobOrDataUrl, options);\n } finally {\n if (objectUrl) {\n URL.revokeObjectURL(objectUrl);\n }\n }\n}\n\nexport async function loadToImage(url, options): Promise<HTMLImageElement> {\n const image = new Image();\n image.src = url;\n\n // The `image.onload()` callback does not guarantee that the image has been decoded\n // so a main thread \"freeze\" can be incurred when using the image for the first time.\n // `Image.decode()` returns a promise that completes when image is decoded.\n\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decode\n // Note: When calling `img.decode()`, we do not need to wait for `img.onload()`\n // Note: `HTMLImageElement.decode()` is not available in Edge and IE11\n if (options.image && options.image.decode && image.decode) {\n await image.decode();\n return image;\n }\n\n // Create a promise that tracks onload/onerror callbacks\n return await new Promise((resolve, reject) => {\n try {\n image.onload = () => resolve(image);\n image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));\n } catch (error) {\n reject(error);\n }\n });\n}\n","import type {ImageLoaderOptions} from '../../image-loader';\nimport {isSVG, getBlob} from './svg-utils';\nimport parseToImage from './parse-to-image';\n\nconst EMPTY_OBJECT = {};\n\nlet imagebitmapOptionsSupported = true;\n\n/**\n * Asynchronously parses an array buffer into an ImageBitmap - this contains the decoded data\n * ImageBitmaps are supported on worker threads, but not supported on Edge, IE11 and Safari\n * https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap#Browser_compatibility\n *\n * TODO - createImageBitmap supports source rect (5 param overload), pass through?\n */\nexport default async function parseToImageBitmap(\n arrayBuffer: ArrayBuffer,\n options: ImageLoaderOptions,\n url?: string\n): Promise<ImageBitmap> {\n let blob;\n\n // Cannot parse SVG directly to ImageBitmap, parse to Image first\n if (isSVG(url)) {\n // Note: this only works on main thread\n const image = await parseToImage(arrayBuffer, options, url);\n blob = image;\n } else {\n // Create blob from the array buffer\n blob = getBlob(arrayBuffer, url);\n }\n\n const imagebitmapOptions = options && options.imagebitmap;\n\n return await safeCreateImageBitmap(blob, imagebitmapOptions);\n}\n\n/**\n * Safely creates an imageBitmap with options\n * *\n * Firefox crashes if imagebitmapOptions is supplied\n * Avoid supplying if not provided or supported, remember if not supported\n */\nasync function safeCreateImageBitmap(\n blob: Blob,\n imagebitmapOptions: ImageBitmapOptions | null = null\n): Promise<ImageBitmap> {\n if (isEmptyObject(imagebitmapOptions) || !imagebitmapOptionsSupported) {\n imagebitmapOptions = null;\n }\n\n if (imagebitmapOptions) {\n try {\n // @ts-ignore Options\n return await createImageBitmap(blob, imagebitmapOptions);\n } catch (error) {\n console.warn(error); // eslint-disable-line\n imagebitmapOptionsSupported = false;\n }\n }\n\n return await createImageBitmap(blob);\n}\n\nfunction isEmptyObject(object) {\n // @ts-ignore\n for (const key in object || EMPTY_OBJECT) {\n return false;\n }\n return true;\n}\n","// Attributions\n// * Based on binary-gltf-utils under MIT license: Copyright (c) 2016-17 Karl Cheng\n\n// TODO: make these functions work for Node.js buffers?\n// Quarantine references to Buffer to prevent bundler from adding big polyfills\n// import {bufferToArrayBuffer} from '../node/buffer-to-array-buffer';\n// TODO - this should be handled in @loaders.gl/polyfills\n\n/** MIME type, width and height extracted from binary compressed image data */\nexport type BinaryImageMetadata = {\n mimeType: string;\n width: number;\n height: number;\n};\n\nconst BIG_ENDIAN = false;\nconst LITTLE_ENDIAN = true;\n\n/**\n * Extracts `{mimeType, width and height}` from a memory buffer containing a known image format\n * Currently supports `image/png`, `image/jpeg`, `image/bmp` and `image/gif`.\n * @param binaryData image file memory to parse\n * @returns metadata or null if memory is not a valid image file format layout.\n */\nexport function getBinaryImageMetadata(\n binaryData: DataView | ArrayBuffer\n): BinaryImageMetadata | null {\n const dataView = toDataView(binaryData);\n return (\n getPngMetadata(dataView) ||\n getJpegMetadata(dataView) ||\n getGifMetadata(dataView) ||\n getBmpMetadata(dataView)\n );\n}\n\n// PNG\n\nfunction getPngMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check file contains the first 4 bytes of the PNG signature.\n const isPng = dataView.byteLength >= 24 && dataView.getUint32(0, BIG_ENDIAN) === 0x89504e47;\n if (!isPng) {\n return null;\n }\n\n // Extract size from a binary PNG file\n return {\n mimeType: 'image/png',\n width: dataView.getUint32(16, BIG_ENDIAN),\n height: dataView.getUint32(20, BIG_ENDIAN)\n };\n}\n\n// GIF\n\n// Extract size from a binary GIF file\n// TODO: GIF is not this simple\nfunction getGifMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check first 4 bytes of the GIF signature (\"GIF8\").\n const isGif = dataView.byteLength >= 10 && dataView.getUint32(0, BIG_ENDIAN) === 0x47494638;\n if (!isGif) {\n return null;\n }\n\n // GIF is little endian.\n return {\n mimeType: 'image/gif',\n width: dataView.getUint16(6, LITTLE_ENDIAN),\n height: dataView.getUint16(8, LITTLE_ENDIAN)\n };\n}\n\n// BMP\n\n// TODO: BMP is not this simple\nexport function getBmpMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check magic number is valid (first 2 characters should be \"BM\").\n // The mandatory bitmap file header is 14 bytes long.\n const isBmp =\n dataView.byteLength >= 14 &&\n dataView.getUint16(0, BIG_ENDIAN) === 0x424d &&\n dataView.getUint32(2, LITTLE_ENDIAN) === dataView.byteLength;\n\n if (!isBmp) {\n return null;\n }\n\n // BMP is little endian.\n return {\n mimeType: 'image/bmp',\n width: dataView.getUint32(18, LITTLE_ENDIAN),\n height: dataView.getUint32(22, LITTLE_ENDIAN)\n };\n}\n\n// JPEG\n\n// Extract width and height from a binary JPEG file\nfunction getJpegMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check file contains the JPEG \"start of image\" (SOI) marker\n // followed by another marker.\n const isJpeg =\n dataView.byteLength >= 3 &&\n dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 &&\n dataView.getUint8(2) === 0xff;\n\n if (!isJpeg) {\n return null;\n }\n\n const {tableMarkers, sofMarkers} = getJpegMarkers();\n\n // Exclude the two byte SOI marker.\n let i = 2;\n while (i + 9 < dataView.byteLength) {\n const marker = dataView.getUint16(i, BIG_ENDIAN);\n\n // The frame that contains the width and height of the JPEG image.\n if (sofMarkers.has(marker)) {\n return {\n mimeType: 'image/jpeg',\n height: dataView.getUint16(i + 5, BIG_ENDIAN), // Number of lines\n width: dataView.getUint16(i + 7, BIG_ENDIAN) // Number of pixels per line\n };\n }\n\n // Miscellaneous tables/data preceding the frame header.\n if (!tableMarkers.has(marker)) {\n return null;\n }\n\n // Length includes size of length parameter but not the two byte header.\n i += 2;\n i += dataView.getUint16(i, BIG_ENDIAN);\n }\n\n return null;\n}\n\nfunction getJpegMarkers() {\n // Tables/misc header markers.\n // DQT, DHT, DAC, DRI, COM, APP_n\n const tableMarkers = new Set([0xffdb, 0xffc4, 0xffcc, 0xffdd, 0xfffe]);\n for (let i = 0xffe0; i < 0xfff0; ++i) {\n tableMarkers.add(i);\n }\n\n // SOF markers and DHP marker.\n // These markers are after tables/misc data.\n const sofMarkers = new Set([\n 0xffc0, 0xffc1, 0xffc2, 0xffc3, 0xffc5, 0xffc6, 0xffc7, 0xffc9, 0xffca, 0xffcb, 0xffcd, 0xffce,\n 0xffcf, 0xffde\n ]);\n\n return {tableMarkers, sofMarkers};\n}\n\n// TODO - move into image module?\nfunction toDataView(data) {\n if (data instanceof DataView) {\n return data;\n }\n if (ArrayBuffer.isView(data)) {\n return new DataView(data.buffer);\n }\n\n // TODO: make these functions work for Node.js buffers?\n // if (bufferToArrayBuffer) {\n // data = bufferToArrayBuffer(data);\n // }\n\n // Careful - Node Buffers will look like ArrayBuffers (keep after isBuffer)\n if (data instanceof ArrayBuffer) {\n return new DataView(data);\n }\n throw new Error('toDataView');\n}\n","import type {LoaderContext} from '@loaders.gl/loader-utils';\nimport {assert} from '@loaders.gl/loader-utils';\nimport type {ImageType} from '../../types';\nimport type {ImageLoaderOptions} from '../../image-loader';\nimport {isImageTypeSupported, getDefaultImageType} from '../category-api/image-type';\nimport {getImageData} from '../category-api/parsed-image-api';\nimport parseToImage from './parse-to-image';\nimport parseToImageBitmap from './parse-to-image-bitmap';\nimport parseToNodeImage from './parse-to-node-image';\n\n// Parse to platform defined image type (data on node, ImageBitmap or HTMLImage on browser)\n// eslint-disable-next-line complexity\nexport default async function parseImage(\n arrayBuffer: ArrayBuffer,\n options?: ImageLoaderOptions,\n context?: LoaderContext\n): Promise<ImageType> {\n options = options || {};\n const imageOptions = options.image || {};\n\n // The user can request a specific output format via `options.image.type`\n const imageType = imageOptions.type || 'auto';\n\n const {url} = context || {};\n\n // Note: For options.image.type === `data`, we may still need to load as `image` or `imagebitmap`\n const loadType = getLoadableImageType(imageType);\n\n let image;\n switch (loadType) {\n case 'imagebitmap':\n image = await parseToImageBitmap(arrayBuffer, options, url);\n break;\n case 'image':\n image = await parseToImage(arrayBuffer, options, url);\n break;\n case 'data':\n // Node.js loads imagedata directly\n image = await parseToNodeImage(arrayBuffer, options);\n break;\n default:\n assert(false);\n }\n\n // Browser: if options.image.type === 'data', we can now extract data from the loaded image\n if (imageType === 'data') {\n image = getImageData(image);\n }\n\n return image;\n}\n\n// Get a loadable image type from image type\nfunction getLoadableImageType(type) {\n switch (type) {\n case 'auto':\n case 'data':\n // Browser: For image data we need still need to load using an image format\n // Node: the default image type is `data`.\n return getDefaultImageType();\n default:\n // Throw an error if not supported\n isImageTypeSupported(type);\n return type;\n }\n}\n","import type {ImageLoaderOptions} from '../../image-loader';\nimport type {ImageDataType} from '../../types';\nimport {assert} from '@loaders.gl/loader-utils';\nimport {getBinaryImageMetadata} from '../category-api/binary-image-api';\n\n// Note: These types should be consistent with loaders.gl/polyfills\n\ntype NDArray = {\n shape: number[];\n data: Uint8Array;\n width: number;\n height: number;\n components: number;\n layers: number[];\n};\n\ntype ParseImageNode = (arrayBuffer: ArrayBuffer, mimeType: string) => Promise<NDArray>;\n\n// Use polyfills if installed to parsed image using get-pixels\nexport default async function parseToNodeImage(\n arrayBuffer: ArrayBuffer,\n options: ImageLoaderOptions\n): Promise<ImageDataType> {\n const {mimeType} = getBinaryImageMetadata(arrayBuffer) || {};\n\n // @ts-ignore\n const _parseImageNode: ParseImageNode = globalThis._parseImageNode;\n assert(_parseImageNode); // '@loaders.gl/polyfills not installed'\n\n // @ts-expect-error TODO should we throw error in this case?\n return await _parseImageNode(arrayBuffer, mimeType);\n}\n","import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport parseImage from './lib/parsers/parse-image';\nimport {getBinaryImageMetadata} from './lib/category-api/binary-image-api';\n\nconst EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'svg'];\nconst MIME_TYPES = [\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/bmp',\n 'image/vnd.microsoft.icon',\n 'image/svg+xml'\n];\n\nexport type ImageLoaderOptions = LoaderOptions & {\n image?: {\n type?: 'auto' | 'data' | 'imagebitmap' | 'image';\n decode?: boolean;\n };\n imagebitmap?: ImageBitmapOptions;\n};\n\nconst DEFAULT_IMAGE_LOADER_OPTIONS: ImageLoaderOptions = {\n image: {\n type: 'auto',\n decode: true // if format is HTML\n }\n // imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor\n};\n\n/**\n * Loads a platform-specific image type\n * Note: This type can be used as input data to WebGL texture creation\n */\nexport const ImageLoader = {\n id: 'image',\n module: 'images',\n name: 'Images',\n version: VERSION,\n mimeTypes: MIME_TYPES,\n extensions: EXTENSIONS,\n parse: parseImage,\n // TODO: byteOffset, byteLength;\n tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],\n options: DEFAULT_IMAGE_LOADER_OPTIONS\n};\n\nexport const _typecheckImageLoader: LoaderWithParser = ImageLoader;\n","// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n","// Image loading/saving for browser and Node.js\nimport {getImageSize} from '../category-api/parsed-image-api';\n\n// @ts-ignore TS2339: Property does not exist on type\nconst {_encodeImageNode} = globalThis;\n\n/**\n * Returns data bytes representing a compressed image in PNG or JPG format,\n * This data can be saved using file system (f) methods or used in a request.\n * @param image - ImageBitmap Image or Canvas\n * @param options\n * param opt.type='png' - png, jpg or image/png, image/jpg are valid\n * param mimeType= - Whether to include a data URI header\n */\nexport async function encodeImage(\n image: any,\n options?: {[key: string]: any}\n): Promise<ArrayBuffer> {\n options = options || {};\n options.image = options.image || ({} as {[key: string]: any});\n\n return _encodeImageNode\n ? _encodeImageNode(image, {type: options.image.mimeType})\n : encodeImageInBrowser(image, options);\n}\n\n// In case we get exceptions from canvas.toBlob(resolve, type, quality)\nlet qualityParamSupported = true;\n\n/**\n *\n * @param image\n * @param options\n * @note Based on canvas.toBlob\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob\n */\nasync function encodeImageInBrowser(image, options) {\n const {mimeType, jpegQuality} = options.image;\n\n const {width, height} = getImageSize(image);\n\n // create a canvas and resize it to the size of our image\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n drawImageToCanvas(image, canvas);\n\n // The actual encoding is done asynchronously with `canvas.toBlob()`\n const blob = await new Promise<Blob | null>((resolve) => {\n // get it back as a Blob\n if (jpegQuality && qualityParamSupported) {\n try {\n canvas.toBlob(resolve, mimeType, jpegQuality);\n return;\n } catch (error) {\n qualityParamSupported = false;\n }\n }\n canvas.toBlob(resolve, mimeType);\n });\n\n if (!blob) {\n throw new Error('image encoding failed');\n }\n\n return await blob.arrayBuffer();\n}\n\nfunction drawImageToCanvas(image, canvas, x = 0, y = 0) {\n // Try optimized path for ImageBitmaps via bitmaprenderer context\n if (x === 0 && y === 0 && typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n const context = canvas.getContext('bitmaprenderer');\n if (context) {\n // transfer the ImageBitmap to it\n context.transferFromImageBitmap(image);\n return canvas;\n }\n }\n\n // Available on most platforms, except IE11 and Andriod WebViews...\n const context = canvas.getContext('2d');\n if (image.data) {\n // ImageData constructor expects clamped array even though getImageData does not return a clamped array...\n const clampedArray = new Uint8ClampedArray(image.data);\n const imageData = new ImageData(clampedArray, image.width, image.height);\n context.putImageData(imageData, 0, 0);\n return canvas;\n }\n\n // Fall back to generic image/image bitmap rendering path\n context.drawImage(image, 0, 0);\n return canvas;\n}\n","// import type {Writer} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport {encodeImage} from './lib/encoders/encode-image';\n\nexport const ImageWriter = {\n name: 'Images',\n id: 'image',\n module: 'images',\n version: VERSION,\n extensions: ['jpeg'],\n options: {\n image: {\n mimeType: 'image/png',\n jpegQuality: null\n }\n },\n encode: encodeImage\n};\n","import {isBrowser} from '@loaders.gl/loader-utils';\n\n// The following formats are supported by loaders.gl polyfills\nconst NODE_FORMAT_SUPPORT = ['image/png', 'image/jpeg', 'image/gif'];\n\n/** Cache values for speed */\nconst mimeTypeSupported: {[mimeType: string]: boolean} = {};\n\n/**\n * Check if image MIME type is supported. Result is cached.\n */\nexport function _isImageFormatSupported(mimeType: string): boolean {\n if (mimeTypeSupported[mimeType] === undefined) {\n mimeTypeSupported[mimeType] = checkFormatSupport(mimeType);\n }\n return mimeTypeSupported[mimeType];\n}\n\n/**\n * Check if image MIME type is supported.\n */\nfunction checkFormatSupport(mimeType: string): boolean {\n switch (mimeType) {\n case 'image/webp':\n return checkWebPSupport();\n case 'image/svg':\n return isBrowser;\n default:\n if (!isBrowser) {\n // @ts-ignore\n const {_parseImageNode} = globalThis;\n return Boolean(_parseImageNode) && NODE_FORMAT_SUPPORT.includes(mimeType);\n }\n return true;\n }\n}\n\n/** Check WebPSupport synchronously */\nfunction checkWebPSupport() {\n if (!isBrowser) {\n return false;\n }\n try {\n const element = document.createElement('canvas');\n return element.toDataURL('image/webp').indexOf('data:image/webp') === 0;\n } catch {\n // Probably Safari...\n return false;\n }\n}\n\n// Note: better test but asynchronous\n\n// Lossy test image. Support for lossy images doesn't guarantee support for all WebP images.\n// https://stackoverflow.com/questions/5573096/detecting-webp-support\n// const WEBP_TEST_IMAGE = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';\n\n// Check WebPSupport asynchronously\n// async function isWebPSupported() {\n// return new Promise( resolve => {\n// const image = new Image();\n// image.src = WEBP_TEST_IMAGE;\n// image.onload = image.onerror = function () {\n// resolve( image.height === 1 );\n// }\n// }\n","// Simple file alias mechanisms for tests.\n\nlet pathPrefix = '';\nconst fileAliases: {[aliasPath: string]: string} = {};\n\n/*\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string): void {\n pathPrefix = prefix;\n}\n\n/*\n * Get the relative path prefix\n */\nexport function getPathPrefix(): string {\n return pathPrefix;\n}\n\n/**\n *\n * @param aliases\n *\n * Note: addAliases are an experimental export, they are only for testing of loaders.gl loaders\n * not intended as a generic aliasing mechanism\n */\nexport function addAliases(aliases: {[aliasPath: string]: string}): void {\n Object.assign(fileAliases, aliases);\n}\n\n/**\n * Resolves aliases and adds path-prefix to paths\n */\nexport function resolvePath(filename: string): string {\n for (const alias in fileAliases) {\n if (filename.startsWith(alias)) {\n const replacement = fileAliases[alias];\n filename = filename.replace(alias, replacement);\n }\n }\n if (!filename.startsWith('http://') && !filename.startsWith('https://')) {\n filename = `${pathPrefix}${filename}`;\n }\n return filename;\n}\n","import {resolvePath, assert} from '@loaders.gl/loader-utils';\n\n// Generate a url by calling getUrl with mix of options, applying options.baseUrl\nexport function generateUrl(getUrl, options, urlOptions) {\n // Get url\n let url = getUrl;\n if (typeof getUrl === 'function') {\n url = getUrl({...options, ...urlOptions});\n }\n assert(typeof url === 'string');\n\n // Apply options.baseUrl\n const {baseUrl} = options;\n if (baseUrl) {\n url = baseUrl[baseUrl.length - 1] === '/' ? `${baseUrl}${url}` : `${baseUrl}/${url}`;\n }\n\n return resolvePath(url);\n}\n","/*\nAsynchronously maps a deep structure of values (e.g. objects and arrays of urls).\n\nE.g. a mipmapped cubemap\n{\n [CUBE_FACE_FRONT]: [\n \"image-front-0.jpg\",\n \"image-front-1.jpg\",\n \"image-front-2.jpg\",\n ],\n [CUBE_MAP_BACK]: [\n ...\n ]\n}\n*/\n\nconst isObject = (value) => value && typeof value === 'object';\n\n// Loads a deep structure of urls (objects and arrays of urls)\n// Returns an object with six key-value pairs containing the images (or image mip arrays)\n// for each cube face\nexport async function asyncDeepMap(tree, func, options = {}) {\n return await mapSubtree(tree, func, options);\n}\n\nexport async function mapSubtree(object, func, options) {\n if (Array.isArray(object)) {\n return await mapArray(object, func, options);\n }\n\n if (isObject(object)) {\n return await mapObject(object, func, options);\n }\n\n // TODO - ignore non-urls, non-arraybuffers?\n const url = object;\n return await func(url, options);\n}\n\n// HELPERS\n\nasync function mapObject(object, func, options) {\n const promises: Promise<any>[] = [];\n const values = {};\n\n for (const key in object) {\n const url = object[key];\n const promise = mapSubtree(url, func, options).then((value) => {\n values[key] = value;\n });\n promises.push(promise);\n }\n\n await Promise.all(promises);\n\n return values;\n}\n\nasync function mapArray(urlArray, func, options = {}) {\n const promises = urlArray.map((url) => mapSubtree(url, func, options));\n return await Promise.all(promises);\n}\n","import {asyncDeepMap} from './async-deep-map';\n\nexport async function deepLoad(urlTree, load, options) {\n return await asyncDeepMap(urlTree, (url) => shallowLoad(url, load, options));\n}\n\nexport async function shallowLoad(url, load, options) {\n // console.error('loading', url);\n const response = await fetch(url, options.fetch);\n const arrayBuffer = await response.arrayBuffer();\n return await load(arrayBuffer, options);\n}\n","import {assert} from '@loaders.gl/loader-utils';\nimport parseImage from '../parsers/parse-image';\nimport {getImageSize} from '../category-api/parsed-image-api';\nimport {generateUrl} from './generate-url';\nimport {deepLoad, shallowLoad} from './deep-load';\n\nexport async function loadImage(getUrl, options = {}) {\n const imageUrls = await getImageUrls(getUrl, options);\n return await deepLoad(imageUrls, parseImage, options);\n}\n\nexport async function getImageUrls(getUrl, options, urlOptions = {}) {\n const mipLevels = (options && options.image && options.image.mipLevels) || 0;\n return mipLevels !== 0\n ? await getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions)\n : generateUrl(getUrl, options, urlOptions);\n}\n\nasync function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) {\n const urls: string[] = [];\n\n // If no mip levels supplied, we need to load the level 0 image and calculate based on size\n if (mipLevels === 'auto') {\n const url = generateUrl(getUrl, options, {...urlOptions, lod: 0});\n const image = await shallowLoad(url, parseImage, options);\n\n const {width, height} = getImageSize(image);\n mipLevels = getMipLevels({width, height});\n\n // TODO - push image and make `deepLoad` pass through non-url values, avoid loading twice?\n urls.push(url);\n }\n\n // We now know how many mipLevels we need, remaining image urls can now be constructed\n assert(mipLevels > 0);\n\n for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {\n const url = generateUrl(getUrl, options, {...urlOptions, lod: mipLevel});\n urls.push(url);\n }\n\n return urls;\n}\n\n// Calculates number of mipmaps based on texture size (log2)\nexport function getMipLevels({width, height}) {\n return 1 + Math.floor(Math.log2(Math.max(width, height)));\n}\n","// Purpose: include this in your module to avoid\n// dependencies on micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\ntype obj = {[key: string]: any};\nconst self_: obj = globals.self || globals.window || globals.global || {};\nconst window_: obj = globals.window || globals.self || globals.global || {};\nconst global_: obj = globals.global || globals.self || globals.window || {};\nconst document_: obj = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in a browser */\nexport const isBrowser: boolean =\n // @ts-ignore process does not exist on browser\n Boolean(typeof process !== 'object' || String(process) !== '[object process]' || process.browser);\n\n/** true if running in a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n/** Major Node version (as a number) */\nexport const nodeVersion: number = (matches && parseFloat(matches[1])) || 0;\n"],"sourceRoot":""}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/utils/version.ts", "../../loader-utils/src/lib/env-utils/assert.ts", "../../loader-utils/src/lib/env-utils/globals.ts", "../../loader-utils/src/lib/path-utils/file-aliases.ts", "../../loader-utils/src/index.ts", "../src/lib/category-api/image-type.ts", "../src/lib/category-api/parsed-image-api.ts", "../src/lib/parsers/svg-utils.ts", "../src/lib/parsers/parse-to-image.ts", "../src/lib/parsers/parse-to-image-bitmap.ts", "../src/lib/category-api/binary-image-api.ts", "../src/lib/parsers/parse-to-node-image.ts", "../src/lib/parsers/parse-image.ts", "../src/image-loader.ts", "../src/lib/encoders/encode-image.ts", "../src/image-writer.ts", "../src/lib/category-api/image-format.ts", "../src/lib/texture-api/generate-url.ts", "../src/lib/texture-api/async-deep-map.ts", "../src/lib/texture-api/deep-load.ts", "../src/lib/texture-api/load-image.ts", "../src/index.ts", "../src/bundle.ts"],
4
+ "sourcesContent": ["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n", "/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n", "// Purpose: include this in your module to avoid\n// dependencies on micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\ntype obj = {[key: string]: any};\nconst self_: obj = globals.self || globals.window || globals.global || {};\nconst window_: obj = globals.window || globals.self || globals.global || {};\nconst global_: obj = globals.global || globals.self || globals.window || {};\nconst document_: obj = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in a browser */\nexport const isBrowser: boolean =\n // @ts-ignore process does not exist on browser\n Boolean(typeof process !== 'object' || String(process) !== '[object process]' || process.browser);\n\n/** true if running in a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n/** Major Node version (as a number) */\nexport const nodeVersion: number = (matches && parseFloat(matches[1])) || 0;\n", "// Simple file alias mechanisms for tests.\n\nlet pathPrefix = '';\nconst fileAliases: {[aliasPath: string]: string} = {};\n\n/*\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string): void {\n pathPrefix = prefix;\n}\n\n/*\n * Get the relative path prefix\n */\nexport function getPathPrefix(): string {\n return pathPrefix;\n}\n\n/**\n *\n * @param aliases\n *\n * Note: addAliases are an experimental export, they are only for testing of loaders.gl loaders\n * not intended as a generic aliasing mechanism\n */\nexport function addAliases(aliases: {[aliasPath: string]: string}): void {\n Object.assign(fileAliases, aliases);\n}\n\n/**\n * Resolves aliases and adds path-prefix to paths\n */\nexport function resolvePath(filename: string): string {\n for (const alias in fileAliases) {\n if (filename.startsWith(alias)) {\n const replacement = fileAliases[alias];\n filename = filename.replace(alias, replacement);\n }\n }\n if (!filename.startsWith('http://') && !filename.startsWith('https://')) {\n filename = `${pathPrefix}${filename}`;\n }\n return filename;\n}\n", "// TYPES\nexport type {\n Loader,\n LoaderWithParser,\n LoaderContext,\n LoaderOptions,\n Writer,\n WriterOptions,\n DataType,\n SyncDataType,\n BatchableDataType,\n IFileSystem,\n IRandomAccessReadFileSystem\n} from './types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n isBrowser,\n isWorker,\n nodeVersion,\n self,\n window,\n global,\n document\n} from './lib/env-utils/globals';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n toArrayBuffer,\n sliceArrayBuffer,\n concatenateArrayBuffers,\n concatenateTypedArrays,\n compareArrayBuffers\n} from './lib/binary-utils/array-buffer-utils';\nexport {padToNBytes, copyToArray, copyArrayBuffer} from './lib/binary-utils/memory-copy-utils';\nexport {\n copyPaddedArrayBufferToDataView,\n copyPaddedStringToDataView\n} from './lib/binary-utils/binary-copy-utils';\nexport {\n padStringToByteAlignment,\n copyStringToDataView,\n copyBinaryToDataView\n} from './lib/binary-utils/encode-utils';\nexport {getFirstCharacters, getMagicString} from './lib/binary-utils/get-first-characters';\n\n// ITERATOR UTILS\nexport {\n makeTextEncoderIterator,\n makeTextDecoderIterator,\n makeLineIterator,\n makeNumberedLineIterator\n} from './lib/iterators/text-iterators';\nexport {forEach, concatenateArrayBuffersAsync} from './lib/iterators/async-iteration';\n\n// REQUEST UTILS\nexport {default as RequestScheduler} from './lib/request-utils/request-scheduler';\n\n// PATH HELPERS\nexport {setPathPrefix, getPathPrefix, resolvePath} from './lib/path-utils/file-aliases';\nexport {addAliases as _addAliases} from './lib/path-utils/file-aliases';\n\n// MICRO LOADERS\nexport {JSONLoader} from './json-loader';\n\n// NODE support\n\n// Node.js emulation (can be used in browser)\n\n// `path` replacement (avoids bundling big path polyfill)\nimport * as path from './lib/path-utils/path';\nexport {path};\n\n// Avoid direct use of `Buffer` which pulls in 50KB polyfill\nexport {isBuffer, toBuffer, bufferToArrayBuffer} from './lib/binary-utils/buffer-utils';\n\n// Note.js wrappers (can be safely imported, but not used in browser)\n\n// Use instead of importing 'util'\nimport * as util from './lib/node/util';\nexport {util};\n// TODO - remove\nexport {promisify} from './lib/node/util';\n\n// Use instead of importing 'fs';`\nimport * as fs from './lib/node/fs';\nexport {fs};\n\n// EXPERIMENTAL\nexport {default as _NodeFileSystem} from './lib/filesystems/node-filesystem';\n", "import {isBrowser} from '@loaders.gl/loader-utils';\nimport type {ImageTypeEnum} from '../../types';\n\n// @ts-ignore TS2339: Property does not exist on type\nconst {_parseImageNode} = globalThis;\n\nconst IMAGE_SUPPORTED = typeof Image !== 'undefined'; // NOTE: \"false\" positives if jsdom is installed\nconst IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== 'undefined';\nconst NODE_IMAGE_SUPPORTED = Boolean(_parseImageNode);\nconst DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;\n\n/**\n * Checks if a loaders.gl image type is supported\n * @param type image type string\n */\nexport function isImageTypeSupported(type: string): boolean {\n switch (type) {\n case 'auto':\n // Should only ever be false in Node.js, if polyfills have not been installed...\n return IMAGE_BITMAP_SUPPORTED || IMAGE_SUPPORTED || DATA_SUPPORTED;\n\n case 'imagebitmap':\n return IMAGE_BITMAP_SUPPORTED;\n case 'image':\n return IMAGE_SUPPORTED;\n case 'data':\n return DATA_SUPPORTED;\n\n default:\n throw new Error(`@loaders.gl/images: image ${type} not supported in this environment`);\n }\n}\n\n/**\n * Returns the \"most performant\" supported image type on this platform\n * @returns image type string\n */\nexport function getDefaultImageType(): ImageTypeEnum {\n if (IMAGE_BITMAP_SUPPORTED) {\n return 'imagebitmap';\n }\n if (IMAGE_SUPPORTED) {\n return 'image';\n }\n if (DATA_SUPPORTED) {\n return 'data';\n }\n\n // This should only happen in Node.js\n throw new Error('Install \\'@loaders.gl/polyfills\\' to parse images under Node.js');\n}\n", "import type {ImageType, ImageTypeEnum, ImageDataType} from '../../types';\n\nexport function isImage(image: ImageType): boolean {\n return Boolean(getImageTypeOrNull(image));\n}\n\nexport function deleteImage(image: ImageType): void {\n switch (getImageType(image)) {\n case 'imagebitmap':\n (image as ImageBitmap).close();\n break;\n default:\n // Nothing to do for images and image data objects\n }\n}\n\nexport function getImageType(image: ImageType): ImageTypeEnum {\n const format = getImageTypeOrNull(image);\n if (!format) {\n throw new Error('Not an image');\n }\n return format;\n}\n\nexport function getImageSize(image: ImageType): {width: number; height: number} {\n return getImageData(image);\n}\n\nexport function getImageData(image: ImageType): ImageDataType | ImageData {\n switch (getImageType(image)) {\n case 'data':\n return image as unknown as ImageData;\n\n case 'image':\n case 'imagebitmap':\n // Extract the image data from the image via a canvas\n const canvas = document.createElement('canvas');\n // TODO - reuse the canvas?\n const context = canvas.getContext('2d');\n if (!context) {\n throw new Error('getImageData');\n }\n // @ts-ignore\n canvas.width = image.width;\n // @ts-ignore\n canvas.height = image.height;\n // @ts-ignore\n context.drawImage(image, 0, 0);\n // @ts-ignore\n return context.getImageData(0, 0, image.width, image.height);\n\n default:\n throw new Error('getImageData');\n }\n}\n\n// PRIVATE\n\n// eslint-disable-next-line complexity\nfunction getImageTypeOrNull(image) {\n if (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n return 'imagebitmap';\n }\n if (typeof Image !== 'undefined' && image instanceof Image) {\n return 'image';\n }\n if (image && typeof image === 'object' && image.data && image.width && image.height) {\n return 'data';\n }\n return null;\n}\n", "// SVG parsing has limitations, e.g:\n// https://bugs.chromium.org/p/chromium/issues/detail?id=606319\n\nconst SVG_DATA_URL_PATTERN = /^data:image\\/svg\\+xml/;\nconst SVG_URL_PATTERN = /\\.svg((\\?|#).*)?$/;\n\nexport function isSVG(url) {\n return url && (SVG_DATA_URL_PATTERN.test(url) || SVG_URL_PATTERN.test(url));\n}\n\nexport function getBlobOrSVGDataUrl(arrayBuffer: ArrayBuffer, url?: string): Blob | string {\n if (isSVG(url)) {\n // Prepare a properly tagged data URL, and load using normal mechanism\n const textDecoder = new TextDecoder();\n let xmlText = textDecoder.decode(arrayBuffer);\n // TODO Escape in browser to support e.g. Chinese characters\n try {\n if (typeof unescape === 'function' && typeof encodeURIComponent === 'function') {\n xmlText = unescape(encodeURIComponent(xmlText));\n }\n } catch (error) {\n throw new Error((error as Error).message);\n }\n // base64 encoding is safer. utf-8 fails in some browsers\n const src = `data:image/svg+xml;base64,${btoa(xmlText)}`;\n return src;\n }\n return getBlob(arrayBuffer, url);\n}\n\nexport function getBlob(arrayBuffer: ArrayBuffer, url?: string): Blob {\n if (isSVG(url)) {\n // https://bugs.chromium.org/p/chromium/issues/detail?id=606319\n // return new Blob([new Uint8Array(arrayBuffer)], {type: 'image/svg+xml'});\n throw new Error('SVG cannot be parsed directly to imagebitmap');\n }\n // TODO - how to determine mime type? Param? Sniff here?\n return new Blob([new Uint8Array(arrayBuffer)]); // MIME type not needed?\n}\n", "import type {ImageLoaderOptions} from '../../image-loader';\nimport {getBlobOrSVGDataUrl} from './svg-utils';\n\n// Parses html image from array buffer\nexport default async function parseToImage(\n arrayBuffer: ArrayBuffer,\n options: ImageLoaderOptions,\n url?: string\n): Promise<HTMLImageElement> {\n // Note: image parsing requires conversion to Blob (for createObjectURL).\n // Potentially inefficient for not using `response.blob()` (and for File / Blob inputs)...\n // But presumably not worth adding 'blob' flag to loader objects?\n\n const blobOrDataUrl = getBlobOrSVGDataUrl(arrayBuffer, url);\n const URL = self.URL || self.webkitURL;\n const objectUrl = typeof blobOrDataUrl !== 'string' && URL.createObjectURL(blobOrDataUrl);\n try {\n return await loadToImage(objectUrl || blobOrDataUrl, options);\n } finally {\n if (objectUrl) {\n URL.revokeObjectURL(objectUrl);\n }\n }\n}\n\nexport async function loadToImage(url, options): Promise<HTMLImageElement> {\n const image = new Image();\n image.src = url;\n\n // The `image.onload()` callback does not guarantee that the image has been decoded\n // so a main thread \"freeze\" can be incurred when using the image for the first time.\n // `Image.decode()` returns a promise that completes when image is decoded.\n\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decode\n // Note: When calling `img.decode()`, we do not need to wait for `img.onload()`\n // Note: `HTMLImageElement.decode()` is not available in Edge and IE11\n if (options.image && options.image.decode && image.decode) {\n await image.decode();\n return image;\n }\n\n // Create a promise that tracks onload/onerror callbacks\n return await new Promise((resolve, reject) => {\n try {\n image.onload = () => resolve(image);\n image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));\n } catch (error) {\n reject(error);\n }\n });\n}\n", "import type {ImageLoaderOptions} from '../../image-loader';\nimport {isSVG, getBlob} from './svg-utils';\nimport parseToImage from './parse-to-image';\n\nconst EMPTY_OBJECT = {};\n\nlet imagebitmapOptionsSupported = true;\n\n/**\n * Asynchronously parses an array buffer into an ImageBitmap - this contains the decoded data\n * ImageBitmaps are supported on worker threads, but not supported on Edge, IE11 and Safari\n * https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap#Browser_compatibility\n *\n * TODO - createImageBitmap supports source rect (5 param overload), pass through?\n */\nexport default async function parseToImageBitmap(\n arrayBuffer: ArrayBuffer,\n options: ImageLoaderOptions,\n url?: string\n): Promise<ImageBitmap> {\n let blob;\n\n // Cannot parse SVG directly to ImageBitmap, parse to Image first\n if (isSVG(url)) {\n // Note: this only works on main thread\n const image = await parseToImage(arrayBuffer, options, url);\n blob = image;\n } else {\n // Create blob from the array buffer\n blob = getBlob(arrayBuffer, url);\n }\n\n const imagebitmapOptions = options && options.imagebitmap;\n\n return await safeCreateImageBitmap(blob, imagebitmapOptions);\n}\n\n/**\n * Safely creates an imageBitmap with options\n * *\n * Firefox crashes if imagebitmapOptions is supplied\n * Avoid supplying if not provided or supported, remember if not supported\n */\nasync function safeCreateImageBitmap(\n blob: Blob,\n imagebitmapOptions: ImageBitmapOptions | null = null\n): Promise<ImageBitmap> {\n if (isEmptyObject(imagebitmapOptions) || !imagebitmapOptionsSupported) {\n imagebitmapOptions = null;\n }\n\n if (imagebitmapOptions) {\n try {\n // @ts-ignore Options\n return await createImageBitmap(blob, imagebitmapOptions);\n } catch (error) {\n console.warn(error); // eslint-disable-line\n imagebitmapOptionsSupported = false;\n }\n }\n\n return await createImageBitmap(blob);\n}\n\nfunction isEmptyObject(object) {\n // @ts-ignore\n for (const key in object || EMPTY_OBJECT) {\n return false;\n }\n return true;\n}\n", "// Attributions\n// * Based on binary-gltf-utils under MIT license: Copyright (c) 2016-17 Karl Cheng\n\n// TODO: make these functions work for Node.js buffers?\n// Quarantine references to Buffer to prevent bundler from adding big polyfills\n// import {bufferToArrayBuffer} from '../node/buffer-to-array-buffer';\n// TODO - this should be handled in @loaders.gl/polyfills\n\n/** MIME type, width and height extracted from binary compressed image data */\nexport type BinaryImageMetadata = {\n mimeType: string;\n width: number;\n height: number;\n};\n\nconst BIG_ENDIAN = false;\nconst LITTLE_ENDIAN = true;\n\n/**\n * Extracts `{mimeType, width and height}` from a memory buffer containing a known image format\n * Currently supports `image/png`, `image/jpeg`, `image/bmp` and `image/gif`.\n * @param binaryData image file memory to parse\n * @returns metadata or null if memory is not a valid image file format layout.\n */\nexport function getBinaryImageMetadata(\n binaryData: DataView | ArrayBuffer\n): BinaryImageMetadata | null {\n const dataView = toDataView(binaryData);\n return (\n getPngMetadata(dataView) ||\n getJpegMetadata(dataView) ||\n getGifMetadata(dataView) ||\n getBmpMetadata(dataView)\n );\n}\n\n// PNG\n\nfunction getPngMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check file contains the first 4 bytes of the PNG signature.\n const isPng = dataView.byteLength >= 24 && dataView.getUint32(0, BIG_ENDIAN) === 0x89504e47;\n if (!isPng) {\n return null;\n }\n\n // Extract size from a binary PNG file\n return {\n mimeType: 'image/png',\n width: dataView.getUint32(16, BIG_ENDIAN),\n height: dataView.getUint32(20, BIG_ENDIAN)\n };\n}\n\n// GIF\n\n// Extract size from a binary GIF file\n// TODO: GIF is not this simple\nfunction getGifMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check first 4 bytes of the GIF signature (\"GIF8\").\n const isGif = dataView.byteLength >= 10 && dataView.getUint32(0, BIG_ENDIAN) === 0x47494638;\n if (!isGif) {\n return null;\n }\n\n // GIF is little endian.\n return {\n mimeType: 'image/gif',\n width: dataView.getUint16(6, LITTLE_ENDIAN),\n height: dataView.getUint16(8, LITTLE_ENDIAN)\n };\n}\n\n// BMP\n\n// TODO: BMP is not this simple\nexport function getBmpMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check magic number is valid (first 2 characters should be \"BM\").\n // The mandatory bitmap file header is 14 bytes long.\n const isBmp =\n dataView.byteLength >= 14 &&\n dataView.getUint16(0, BIG_ENDIAN) === 0x424d &&\n dataView.getUint32(2, LITTLE_ENDIAN) === dataView.byteLength;\n\n if (!isBmp) {\n return null;\n }\n\n // BMP is little endian.\n return {\n mimeType: 'image/bmp',\n width: dataView.getUint32(18, LITTLE_ENDIAN),\n height: dataView.getUint32(22, LITTLE_ENDIAN)\n };\n}\n\n// JPEG\n\n// Extract width and height from a binary JPEG file\nfunction getJpegMetadata(binaryData) {\n const dataView = toDataView(binaryData);\n // Check file contains the JPEG \"start of image\" (SOI) marker\n // followed by another marker.\n const isJpeg =\n dataView.byteLength >= 3 &&\n dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 &&\n dataView.getUint8(2) === 0xff;\n\n if (!isJpeg) {\n return null;\n }\n\n const {tableMarkers, sofMarkers} = getJpegMarkers();\n\n // Exclude the two byte SOI marker.\n let i = 2;\n while (i + 9 < dataView.byteLength) {\n const marker = dataView.getUint16(i, BIG_ENDIAN);\n\n // The frame that contains the width and height of the JPEG image.\n if (sofMarkers.has(marker)) {\n return {\n mimeType: 'image/jpeg',\n height: dataView.getUint16(i + 5, BIG_ENDIAN), // Number of lines\n width: dataView.getUint16(i + 7, BIG_ENDIAN) // Number of pixels per line\n };\n }\n\n // Miscellaneous tables/data preceding the frame header.\n if (!tableMarkers.has(marker)) {\n return null;\n }\n\n // Length includes size of length parameter but not the two byte header.\n i += 2;\n i += dataView.getUint16(i, BIG_ENDIAN);\n }\n\n return null;\n}\n\nfunction getJpegMarkers() {\n // Tables/misc header markers.\n // DQT, DHT, DAC, DRI, COM, APP_n\n const tableMarkers = new Set([0xffdb, 0xffc4, 0xffcc, 0xffdd, 0xfffe]);\n for (let i = 0xffe0; i < 0xfff0; ++i) {\n tableMarkers.add(i);\n }\n\n // SOF markers and DHP marker.\n // These markers are after tables/misc data.\n const sofMarkers = new Set([\n 0xffc0, 0xffc1, 0xffc2, 0xffc3, 0xffc5, 0xffc6, 0xffc7, 0xffc9, 0xffca, 0xffcb, 0xffcd, 0xffce,\n 0xffcf, 0xffde\n ]);\n\n return {tableMarkers, sofMarkers};\n}\n\n// TODO - move into image module?\nfunction toDataView(data) {\n if (data instanceof DataView) {\n return data;\n }\n if (ArrayBuffer.isView(data)) {\n return new DataView(data.buffer);\n }\n\n // TODO: make these functions work for Node.js buffers?\n // if (bufferToArrayBuffer) {\n // data = bufferToArrayBuffer(data);\n // }\n\n // Careful - Node Buffers will look like ArrayBuffers (keep after isBuffer)\n if (data instanceof ArrayBuffer) {\n return new DataView(data);\n }\n throw new Error('toDataView');\n}\n", "import type {ImageLoaderOptions} from '../../image-loader';\nimport type {ImageDataType} from '../../types';\nimport {assert} from '@loaders.gl/loader-utils';\nimport {getBinaryImageMetadata} from '../category-api/binary-image-api';\n\n// Note: These types should be consistent with loaders.gl/polyfills\n\ntype NDArray = {\n shape: number[];\n data: Uint8Array;\n width: number;\n height: number;\n components: number;\n layers: number[];\n};\n\ntype ParseImageNode = (arrayBuffer: ArrayBuffer, mimeType: string) => Promise<NDArray>;\n\n// Use polyfills if installed to parsed image using get-pixels\nexport default async function parseToNodeImage(\n arrayBuffer: ArrayBuffer,\n options: ImageLoaderOptions\n): Promise<ImageDataType> {\n const {mimeType} = getBinaryImageMetadata(arrayBuffer) || {};\n\n // @ts-ignore\n const _parseImageNode: ParseImageNode = globalThis._parseImageNode;\n assert(_parseImageNode); // '@loaders.gl/polyfills not installed'\n\n // @ts-expect-error TODO should we throw error in this case?\n return await _parseImageNode(arrayBuffer, mimeType);\n}\n", "import type {LoaderContext} from '@loaders.gl/loader-utils';\nimport {assert} from '@loaders.gl/loader-utils';\nimport type {ImageType} from '../../types';\nimport type {ImageLoaderOptions} from '../../image-loader';\nimport {isImageTypeSupported, getDefaultImageType} from '../category-api/image-type';\nimport {getImageData} from '../category-api/parsed-image-api';\nimport parseToImage from './parse-to-image';\nimport parseToImageBitmap from './parse-to-image-bitmap';\nimport parseToNodeImage from './parse-to-node-image';\n\n// Parse to platform defined image type (data on node, ImageBitmap or HTMLImage on browser)\n// eslint-disable-next-line complexity\nexport default async function parseImage(\n arrayBuffer: ArrayBuffer,\n options?: ImageLoaderOptions,\n context?: LoaderContext\n): Promise<ImageType> {\n options = options || {};\n const imageOptions = options.image || {};\n\n // The user can request a specific output format via `options.image.type`\n const imageType = imageOptions.type || 'auto';\n\n const {url} = context || {};\n\n // Note: For options.image.type === `data`, we may still need to load as `image` or `imagebitmap`\n const loadType = getLoadableImageType(imageType);\n\n let image;\n switch (loadType) {\n case 'imagebitmap':\n image = await parseToImageBitmap(arrayBuffer, options, url);\n break;\n case 'image':\n image = await parseToImage(arrayBuffer, options, url);\n break;\n case 'data':\n // Node.js loads imagedata directly\n image = await parseToNodeImage(arrayBuffer, options);\n break;\n default:\n assert(false);\n }\n\n // Browser: if options.image.type === 'data', we can now extract data from the loaded image\n if (imageType === 'data') {\n image = getImageData(image);\n }\n\n return image;\n}\n\n// Get a loadable image type from image type\nfunction getLoadableImageType(type) {\n switch (type) {\n case 'auto':\n case 'data':\n // Browser: For image data we need still need to load using an image format\n // Node: the default image type is `data`.\n return getDefaultImageType();\n default:\n // Throw an error if not supported\n isImageTypeSupported(type);\n return type;\n }\n}\n", "import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport parseImage from './lib/parsers/parse-image';\nimport {getBinaryImageMetadata} from './lib/category-api/binary-image-api';\n\nconst EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'svg'];\nconst MIME_TYPES = [\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/bmp',\n 'image/vnd.microsoft.icon',\n 'image/svg+xml'\n];\n\nexport type ImageLoaderOptions = LoaderOptions & {\n image?: {\n type?: 'auto' | 'data' | 'imagebitmap' | 'image';\n decode?: boolean;\n };\n imagebitmap?: ImageBitmapOptions;\n};\n\nconst DEFAULT_IMAGE_LOADER_OPTIONS: ImageLoaderOptions = {\n image: {\n type: 'auto',\n decode: true // if format is HTML\n }\n // imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor\n};\n\n/**\n * Loads a platform-specific image type\n * Note: This type can be used as input data to WebGL texture creation\n */\nexport const ImageLoader = {\n id: 'image',\n module: 'images',\n name: 'Images',\n version: VERSION,\n mimeTypes: MIME_TYPES,\n extensions: EXTENSIONS,\n parse: parseImage,\n // TODO: byteOffset, byteLength;\n tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],\n options: DEFAULT_IMAGE_LOADER_OPTIONS\n};\n\nexport const _typecheckImageLoader: LoaderWithParser = ImageLoader;\n", "// Image loading/saving for browser and Node.js\nimport {getImageSize} from '../category-api/parsed-image-api';\n\n// @ts-ignore TS2339: Property does not exist on type\nconst {_encodeImageNode} = globalThis;\n\n/**\n * Returns data bytes representing a compressed image in PNG or JPG format,\n * This data can be saved using file system (f) methods or used in a request.\n * @param image - ImageBitmap Image or Canvas\n * @param options\n * param opt.type='png' - png, jpg or image/png, image/jpg are valid\n * param mimeType= - Whether to include a data URI header\n */\nexport async function encodeImage(\n image: any,\n options?: {[key: string]: any}\n): Promise<ArrayBuffer> {\n options = options || {};\n options.image = options.image || ({} as {[key: string]: any});\n\n return _encodeImageNode\n ? _encodeImageNode(image, {type: options.image.mimeType})\n : encodeImageInBrowser(image, options);\n}\n\n// In case we get exceptions from canvas.toBlob(resolve, type, quality)\nlet qualityParamSupported = true;\n\n/**\n *\n * @param image\n * @param options\n * @note Based on canvas.toBlob\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob\n */\nasync function encodeImageInBrowser(image, options) {\n const {mimeType, jpegQuality} = options.image;\n\n const {width, height} = getImageSize(image);\n\n // create a canvas and resize it to the size of our image\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n drawImageToCanvas(image, canvas);\n\n // The actual encoding is done asynchronously with `canvas.toBlob()`\n const blob = await new Promise<Blob | null>((resolve) => {\n // get it back as a Blob\n if (jpegQuality && qualityParamSupported) {\n try {\n canvas.toBlob(resolve, mimeType, jpegQuality);\n return;\n } catch (error) {\n qualityParamSupported = false;\n }\n }\n canvas.toBlob(resolve, mimeType);\n });\n\n if (!blob) {\n throw new Error('image encoding failed');\n }\n\n return await blob.arrayBuffer();\n}\n\nfunction drawImageToCanvas(image, canvas, x = 0, y = 0) {\n // Try optimized path for ImageBitmaps via bitmaprenderer context\n if (x === 0 && y === 0 && typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n const context = canvas.getContext('bitmaprenderer');\n if (context) {\n // transfer the ImageBitmap to it\n context.transferFromImageBitmap(image);\n return canvas;\n }\n }\n\n // Available on most platforms, except IE11 and Andriod WebViews...\n const context = canvas.getContext('2d');\n if (image.data) {\n // ImageData constructor expects clamped array even though getImageData does not return a clamped array...\n const clampedArray = new Uint8ClampedArray(image.data);\n const imageData = new ImageData(clampedArray, image.width, image.height);\n context.putImageData(imageData, 0, 0);\n return canvas;\n }\n\n // Fall back to generic image/image bitmap rendering path\n context.drawImage(image, 0, 0);\n return canvas;\n}\n", "// import type {Writer} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\nimport {encodeImage} from './lib/encoders/encode-image';\n\nexport const ImageWriter = {\n name: 'Images',\n id: 'image',\n module: 'images',\n version: VERSION,\n extensions: ['jpeg'],\n options: {\n image: {\n mimeType: 'image/png',\n jpegQuality: null\n }\n },\n encode: encodeImage\n};\n", "import {isBrowser} from '@loaders.gl/loader-utils';\n\n// The following formats are supported by loaders.gl polyfills\nconst NODE_FORMAT_SUPPORT = ['image/png', 'image/jpeg', 'image/gif'];\n\n/** Cache values for speed */\nconst mimeTypeSupported: {[mimeType: string]: boolean} = {};\n\n/**\n * Check if image MIME type is supported. Result is cached.\n */\nexport function _isImageFormatSupported(mimeType: string): boolean {\n if (mimeTypeSupported[mimeType] === undefined) {\n mimeTypeSupported[mimeType] = checkFormatSupport(mimeType);\n }\n return mimeTypeSupported[mimeType];\n}\n\n/**\n * Check if image MIME type is supported.\n */\nfunction checkFormatSupport(mimeType: string): boolean {\n switch (mimeType) {\n case 'image/webp':\n return checkWebPSupport();\n case 'image/svg':\n return isBrowser;\n default:\n if (!isBrowser) {\n // @ts-ignore\n const {_parseImageNode} = globalThis;\n return Boolean(_parseImageNode) && NODE_FORMAT_SUPPORT.includes(mimeType);\n }\n return true;\n }\n}\n\n/** Check WebPSupport synchronously */\nfunction checkWebPSupport() {\n if (!isBrowser) {\n return false;\n }\n try {\n const element = document.createElement('canvas');\n return element.toDataURL('image/webp').indexOf('data:image/webp') === 0;\n } catch {\n // Probably Safari...\n return false;\n }\n}\n\n// Note: better test but asynchronous\n\n// Lossy test image. Support for lossy images doesn't guarantee support for all WebP images.\n// https://stackoverflow.com/questions/5573096/detecting-webp-support\n// const WEBP_TEST_IMAGE = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';\n\n// Check WebPSupport asynchronously\n// async function isWebPSupported() {\n// return new Promise( resolve => {\n// const image = new Image();\n// image.src = WEBP_TEST_IMAGE;\n// image.onload = image.onerror = function () {\n// resolve( image.height === 1 );\n// }\n// }\n", "import {resolvePath, assert} from '@loaders.gl/loader-utils';\n\n// Generate a url by calling getUrl with mix of options, applying options.baseUrl\nexport function generateUrl(getUrl, options, urlOptions) {\n // Get url\n let url = getUrl;\n if (typeof getUrl === 'function') {\n url = getUrl({...options, ...urlOptions});\n }\n assert(typeof url === 'string');\n\n // Apply options.baseUrl\n const {baseUrl} = options;\n if (baseUrl) {\n url = baseUrl[baseUrl.length - 1] === '/' ? `${baseUrl}${url}` : `${baseUrl}/${url}`;\n }\n\n return resolvePath(url);\n}\n", "/*\nAsynchronously maps a deep structure of values (e.g. objects and arrays of urls).\n\nE.g. a mipmapped cubemap\n{\n [CUBE_FACE_FRONT]: [\n \"image-front-0.jpg\",\n \"image-front-1.jpg\",\n \"image-front-2.jpg\",\n ],\n [CUBE_MAP_BACK]: [\n ...\n ]\n}\n*/\n\nconst isObject = (value) => value && typeof value === 'object';\n\n// Loads a deep structure of urls (objects and arrays of urls)\n// Returns an object with six key-value pairs containing the images (or image mip arrays)\n// for each cube face\nexport async function asyncDeepMap(tree, func, options = {}) {\n return await mapSubtree(tree, func, options);\n}\n\nexport async function mapSubtree(object, func, options) {\n if (Array.isArray(object)) {\n return await mapArray(object, func, options);\n }\n\n if (isObject(object)) {\n return await mapObject(object, func, options);\n }\n\n // TODO - ignore non-urls, non-arraybuffers?\n const url = object;\n return await func(url, options);\n}\n\n// HELPERS\n\nasync function mapObject(object, func, options) {\n const promises: Promise<any>[] = [];\n const values = {};\n\n for (const key in object) {\n const url = object[key];\n const promise = mapSubtree(url, func, options).then((value) => {\n values[key] = value;\n });\n promises.push(promise);\n }\n\n await Promise.all(promises);\n\n return values;\n}\n\nasync function mapArray(urlArray, func, options = {}) {\n const promises = urlArray.map((url) => mapSubtree(url, func, options));\n return await Promise.all(promises);\n}\n", "import {asyncDeepMap} from './async-deep-map';\n\nexport async function deepLoad(urlTree, load, options) {\n return await asyncDeepMap(urlTree, (url) => shallowLoad(url, load, options));\n}\n\nexport async function shallowLoad(url, load, options) {\n // console.error('loading', url);\n const response = await fetch(url, options.fetch);\n const arrayBuffer = await response.arrayBuffer();\n return await load(arrayBuffer, options);\n}\n", "import {assert} from '@loaders.gl/loader-utils';\nimport parseImage from '../parsers/parse-image';\nimport {getImageSize} from '../category-api/parsed-image-api';\nimport {generateUrl} from './generate-url';\nimport {deepLoad, shallowLoad} from './deep-load';\n\nexport async function loadImage(getUrl, options = {}) {\n const imageUrls = await getImageUrls(getUrl, options);\n return await deepLoad(imageUrls, parseImage, options);\n}\n\nexport async function getImageUrls(getUrl, options, urlOptions = {}) {\n const mipLevels = (options && options.image && options.image.mipLevels) || 0;\n return mipLevels !== 0\n ? await getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions)\n : generateUrl(getUrl, options, urlOptions);\n}\n\nasync function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) {\n const urls: string[] = [];\n\n // If no mip levels supplied, we need to load the level 0 image and calculate based on size\n if (mipLevels === 'auto') {\n const url = generateUrl(getUrl, options, {...urlOptions, lod: 0});\n const image = await shallowLoad(url, parseImage, options);\n\n const {width, height} = getImageSize(image);\n mipLevels = getMipLevels({width, height});\n\n // TODO - push image and make `deepLoad` pass through non-url values, avoid loading twice?\n urls.push(url);\n }\n\n // We now know how many mipLevels we need, remaining image urls can now be constructed\n assert(mipLevels > 0);\n\n for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {\n const url = generateUrl(getUrl, options, {...urlOptions, lod: mipLevel});\n urls.push(url);\n }\n\n return urls;\n}\n\n// Calculates number of mipmaps based on texture size (log2)\nexport function getMipLevels({width, height}) {\n return 1 + Math.floor(Math.log2(Math.max(width, height)));\n}\n", "// TYPES\nexport type {ImageDataType, ImageType, ImageTypeEnum} from './types';\nexport type {ImageLoaderOptions} from './image-loader';\n\n// LOADERS AND WRITERS\nexport {ImageLoader} from './image-loader';\nexport {ImageWriter} from './image-writer';\n\n// IMAGE CATEGORY API\n\n// Binary Image API\nexport {getBinaryImageMetadata} from './lib/category-api/binary-image-api';\n\n// Parsed Image API\nexport {isImageTypeSupported, getDefaultImageType} from './lib/category-api/image-type';\n\nexport {\n isImage,\n getImageType,\n getImageSize,\n getImageData\n} from './lib/category-api/parsed-image-api';\n\n// EXPERIMENTAL\nexport {_isImageFormatSupported} from './lib/category-api/image-format';\n\n// DEPRECATED - Remove in V3 (fix dependency in luma.gl)\nexport {loadImage} from './lib/texture-api/load-image';\n", "// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],
5
+ "mappings": "4OAAA,GAGa,GAHb,SAGO,AAAM,EAAU,MAAO,cAAgB,YAAc,YAAc,WCCnE,WAAgB,EAAgB,EAAwB,CAC7D,GAAI,CAAC,EACH,KAAM,IAAI,OAAM,GAAW,4BAN/B,gBCAA,GAIM,GAQA,GACA,GACA,GACA,GAKO,EAQP,EAGO,GA/Bb,SAIA,AAAM,EAAU,CACd,KAAM,MAAO,OAAS,aAAe,KACrC,OAAQ,MAAO,SAAW,aAAe,OACzC,OAAQ,MAAO,SAAW,aAAe,OACzC,SAAU,MAAO,WAAa,aAAe,UAIzC,GAAa,EAAQ,MAAQ,EAAQ,QAAU,EAAQ,QAAU,GACjE,GAAe,EAAQ,QAAU,EAAQ,MAAQ,EAAQ,QAAU,GACnE,GAAe,EAAQ,QAAU,EAAQ,MAAQ,EAAQ,QAAU,GACnE,GAAiB,EAAQ,UAAY,GAK9B,EAEX,QAAQ,MAAO,UAAY,UAAY,OAAO,WAAa,oBAAsB,QAAQ,SAMrF,EACJ,MAAO,UAAY,aAAe,QAAQ,SAAW,YAAY,KAAK,QAAQ,SAEnE,GAAuB,GAAW,WAAW,EAAQ,KAAQ,ICEnE,WAAqB,EAA0B,CACpD,OAAW,KAAS,GAClB,GAAI,EAAS,WAAW,GAAQ,CAC9B,GAAM,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E,GAAM,GAAa,GAAW,EAAQ,OAAS,EAAQ,MAAM,WAAc,EAC3E,MAAO,KAAc,EACjB,KAAM,IAAsB,EAAQ,EAAW,EAAS,GACxD,EAAY,EAAQ,EAAS,GAGnC,kBAAqC,EAAQ,EAAW,EAAS,EAAY,CAC3E,GAAM,GAAiB,GAGvB,GAAI,IAAc,OAAQ,CACxB,GAAM,GAAM,EAAY,EAAQ,EAAS,IAAI,EAAY,IAAK,IACxD,EAAQ,KAAM,GAAY,EAAK,EAAY,GAE3C,CAAC,QAAO,UAAU,EAAa,GACrC,EAAY,GAAa,CAAC,QAAO,WAGjC,EAAK,KAAK,GAIZ,EAAO,EAAY,GAEnB,OAAS,GAAW,EAAK,OAAQ,EAAW,EAAW,EAAE,EAAU,CACjE,GAAM,GAAM,EAAY,EAAQ,EAAS,IAAI,EAAY,IAAK,IAC9D,EAAK,KAAK,GAGZ,MAAO,GAIF,YAAsB,CAAC,QAAO,UAAS,CAC5C,MAAO,GAAI,KAAK,MAAM,KAAK,KAAK,KAAK,IAAI,EAAO,KA9ClD,kBACA,IACA,IACA,KACA,OCJA,gRAKA,KACA,KAKA,IAGA,IAEA,IAQA,KAGA,OC3BA,oBACA,GAAM,IAAgB,UACtB,WAAW,QAAU,WAAW,SAAW,GAC3C,GAAO,QAAU,OAAO,OAAO,WAAW,QAAS",
6
+ "names": []
7
+ }
@@ -0,0 +1,26 @@
1
+ import type { LoaderOptions, LoaderWithParser } from '@loaders.gl/loader-utils';
2
+ import parseImage from './lib/parsers/parse-image';
3
+ export declare type ImageLoaderOptions = LoaderOptions & {
4
+ image?: {
5
+ type?: 'auto' | 'data' | 'imagebitmap' | 'image';
6
+ decode?: boolean;
7
+ };
8
+ imagebitmap?: ImageBitmapOptions;
9
+ };
10
+ /**
11
+ * Loads a platform-specific image type
12
+ * Note: This type can be used as input data to WebGL texture creation
13
+ */
14
+ export declare const ImageLoader: {
15
+ id: string;
16
+ module: string;
17
+ name: string;
18
+ version: any;
19
+ mimeTypes: string[];
20
+ extensions: string[];
21
+ parse: typeof parseImage;
22
+ tests: ((arrayBuffer: any) => boolean)[];
23
+ options: ImageLoaderOptions;
24
+ };
25
+ export declare const _typecheckImageLoader: LoaderWithParser;
26
+ //# sourceMappingURL=image-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-loader.d.ts","sourceRoot":"","sources":["../src/image-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAcnD,oBAAY,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC;QACjD,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;CAWvB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,gBAA8B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { encodeImage } from './lib/encoders/encode-image';
2
+ export declare const ImageWriter: {
3
+ name: string;
4
+ id: string;
5
+ module: string;
6
+ version: any;
7
+ extensions: string[];
8
+ options: {
9
+ image: {
10
+ mimeType: string;
11
+ jpegQuality: null;
12
+ };
13
+ };
14
+ encode: typeof encodeImage;
15
+ };
16
+ //# sourceMappingURL=image-writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-writer.d.ts","sourceRoot":"","sources":["../src/image-writer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAExD,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAavB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export type { ImageDataType, ImageType, ImageTypeEnum } from './types';
2
+ export type { ImageLoaderOptions } from './image-loader';
3
+ export { ImageLoader } from './image-loader';
4
+ export { ImageWriter } from './image-writer';
5
+ export { getBinaryImageMetadata } from './lib/category-api/binary-image-api';
6
+ export { isImageTypeSupported, getDefaultImageType } from './lib/category-api/image-type';
7
+ export { isImage, getImageType, getImageSize, getImageData } from './lib/category-api/parsed-image-api';
8
+ export { _isImageFormatSupported } from './lib/category-api/image-format';
9
+ export { loadImage } from './lib/texture-api/load-image';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAC,aAAa,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AACrE,YAAY,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAK3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAG3E,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAExF,OAAO,EACL,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,YAAY,EACb,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAC,uBAAuB,EAAC,MAAM,iCAAiC,CAAC;AAGxE,OAAO,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** MIME type, width and height extracted from binary compressed image data */
2
+ export declare type BinaryImageMetadata = {
3
+ mimeType: string;
4
+ width: number;
5
+ height: number;
6
+ };
7
+ /**
8
+ * Extracts `{mimeType, width and height}` from a memory buffer containing a known image format
9
+ * Currently supports `image/png`, `image/jpeg`, `image/bmp` and `image/gif`.
10
+ * @param binaryData image file memory to parse
11
+ * @returns metadata or null if memory is not a valid image file format layout.
12
+ */
13
+ export declare function getBinaryImageMetadata(binaryData: DataView | ArrayBuffer): BinaryImageMetadata | null;
14
+ export declare function getBmpMetadata(binaryData: any): {
15
+ mimeType: string;
16
+ width: number;
17
+ height: number;
18
+ } | null;
19
+ //# sourceMappingURL=binary-image-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary-image-api.d.ts","sourceRoot":"","sources":["../../../src/lib/category-api/binary-image-api.ts"],"names":[],"mappings":"AAQA,8EAA8E;AAC9E,oBAAY,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAKF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,QAAQ,GAAG,WAAW,GACjC,mBAAmB,GAAG,IAAI,CAQ5B;AA2CD,wBAAgB,cAAc,CAAC,UAAU,KAAA;;;;SAmBxC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Check if image MIME type is supported. Result is cached.
3
+ */
4
+ export declare function _isImageFormatSupported(mimeType: string): boolean;
5
+ //# sourceMappingURL=image-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-format.d.ts","sourceRoot":"","sources":["../../../src/lib/category-api/image-format.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKjE"}
@@ -0,0 +1,12 @@
1
+ import type { ImageTypeEnum } from '../../types';
2
+ /**
3
+ * Checks if a loaders.gl image type is supported
4
+ * @param type image type string
5
+ */
6
+ export declare function isImageTypeSupported(type: string): boolean;
7
+ /**
8
+ * Returns the "most performant" supported image type on this platform
9
+ * @returns image type string
10
+ */
11
+ export declare function getDefaultImageType(): ImageTypeEnum;
12
+ //# sourceMappingURL=image-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-type.d.ts","sourceRoot":"","sources":["../../../src/lib/category-api/image-type.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAU/C;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgB1D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAanD"}
@@ -0,0 +1,10 @@
1
+ import type { ImageType, ImageTypeEnum, ImageDataType } from '../../types';
2
+ export declare function isImage(image: ImageType): boolean;
3
+ export declare function deleteImage(image: ImageType): void;
4
+ export declare function getImageType(image: ImageType): ImageTypeEnum;
5
+ export declare function getImageSize(image: ImageType): {
6
+ width: number;
7
+ height: number;
8
+ };
9
+ export declare function getImageData(image: ImageType): ImageDataType | ImageData;
10
+ //# sourceMappingURL=parsed-image-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-image-api.d.ts","sourceRoot":"","sources":["../../../src/lib/category-api/parsed-image-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAEzE,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEjD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAQlD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa,CAM5D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAE9E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,CA0BxE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns data bytes representing a compressed image in PNG or JPG format,
3
+ * This data can be saved using file system (f) methods or used in a request.
4
+ * @param image - ImageBitmap Image or Canvas
5
+ * @param options
6
+ * param opt.type='png' - png, jpg or image/png, image/jpg are valid
7
+ * param mimeType= - Whether to include a data URI header
8
+ */
9
+ export declare function encodeImage(image: any, options?: {
10
+ [key: string]: any;
11
+ }): Promise<ArrayBuffer>;
12
+ //# sourceMappingURL=encode-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode-image.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/encode-image.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,GAAG,EACV,OAAO,CAAC,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GAC7B,OAAO,CAAC,WAAW,CAAC,CAOtB"}
@@ -0,0 +1,5 @@
1
+ import type { LoaderContext } from '@loaders.gl/loader-utils';
2
+ import type { ImageType } from '../../types';
3
+ import type { ImageLoaderOptions } from '../../image-loader';
4
+ export default function parseImage(arrayBuffer: ArrayBuffer, options?: ImageLoaderOptions, context?: LoaderContext): Promise<ImageType>;
5
+ //# sourceMappingURL=parse-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-image.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAS3D,wBAA8B,UAAU,CACtC,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,SAAS,CAAC,CAkCpB"}
@@ -0,0 +1,10 @@
1
+ import type { ImageLoaderOptions } from '../../image-loader';
2
+ /**
3
+ * Asynchronously parses an array buffer into an ImageBitmap - this contains the decoded data
4
+ * ImageBitmaps are supported on worker threads, but not supported on Edge, IE11 and Safari
5
+ * https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap#Browser_compatibility
6
+ *
7
+ * TODO - createImageBitmap supports source rect (5 param overload), pass through?
8
+ */
9
+ export default function parseToImageBitmap(arrayBuffer: ArrayBuffer, options: ImageLoaderOptions, url?: string): Promise<ImageBitmap>;
10
+ //# sourceMappingURL=parse-to-image-bitmap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-to-image-bitmap.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-to-image-bitmap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAQ3D;;;;;;GAMG;AACH,wBAA8B,kBAAkB,CAC9C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,kBAAkB,EAC3B,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,WAAW,CAAC,CAgBtB"}
@@ -0,0 +1,4 @@
1
+ import type { ImageLoaderOptions } from '../../image-loader';
2
+ export default function parseToImage(arrayBuffer: ArrayBuffer, options: ImageLoaderOptions, url?: string): Promise<HTMLImageElement>;
3
+ export declare function loadToImage(url: any, options: any): Promise<HTMLImageElement>;
4
+ //# sourceMappingURL=parse-to-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-to-image.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-to-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAI3D,wBAA8B,YAAY,CACxC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,kBAAkB,EAC3B,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC,CAe3B;AAED,wBAAsB,WAAW,CAAC,GAAG,KAAA,EAAE,OAAO,KAAA,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyBzE"}
@@ -0,0 +1,4 @@
1
+ import type { ImageLoaderOptions } from '../../image-loader';
2
+ import type { ImageDataType } from '../../types';
3
+ export default function parseToNodeImage(arrayBuffer: ArrayBuffer, options: ImageLoaderOptions): Promise<ImageDataType>;
4
+ //# sourceMappingURL=parse-to-node-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-to-node-image.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-to-node-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAkB/C,wBAA8B,gBAAgB,CAC5C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,aAAa,CAAC,CASxB"}
@@ -0,0 +1,4 @@
1
+ export declare function isSVG(url: any): any;
2
+ export declare function getBlobOrSVGDataUrl(arrayBuffer: ArrayBuffer, url?: string): Blob | string;
3
+ export declare function getBlob(arrayBuffer: ArrayBuffer, url?: string): Blob;
4
+ //# sourceMappingURL=svg-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/svg-utils.ts"],"names":[],"mappings":"AAMA,wBAAgB,KAAK,CAAC,GAAG,KAAA,OAExB;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAkBzF;AAED,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAQpE"}
@@ -0,0 +1,3 @@
1
+ export declare function asyncDeepMap(tree: any, func: any, options?: {}): Promise<any>;
2
+ export declare function mapSubtree(object: any, func: any, options: any): Promise<any>;
3
+ //# sourceMappingURL=async-deep-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-deep-map.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/async-deep-map.ts"],"names":[],"mappings":"AAqBA,wBAAsB,YAAY,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAK,gBAE1D;AAED,wBAAsB,UAAU,CAAC,MAAM,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAA,gBAYrD"}
@@ -0,0 +1,3 @@
1
+ export declare function deepLoad(urlTree: any, load: any, options: any): Promise<any>;
2
+ export declare function shallowLoad(url: any, load: any, options: any): Promise<any>;
3
+ //# sourceMappingURL=deep-load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-load.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/deep-load.ts"],"names":[],"mappings":"AAEA,wBAAsB,QAAQ,CAAC,OAAO,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAA,gBAEpD;AAED,wBAAsB,WAAW,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAA,gBAKnD"}
@@ -0,0 +1,2 @@
1
+ export declare function generateUrl(getUrl: any, options: any, urlOptions: any): string;
2
+ //# sourceMappingURL=generate-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-url.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/generate-url.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,MAAM,KAAA,EAAE,OAAO,KAAA,EAAE,UAAU,KAAA,UAetD"}
@@ -0,0 +1,7 @@
1
+ export declare function loadImage(getUrl: any, options?: {}): Promise<any>;
2
+ export declare function getImageUrls(getUrl: any, options: any, urlOptions?: {}): Promise<string | string[]>;
3
+ export declare function getMipLevels({ width, height }: {
4
+ width: any;
5
+ height: any;
6
+ }): number;
7
+ //# sourceMappingURL=load-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-image.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/load-image.ts"],"names":[],"mappings":"AAMA,wBAAsB,SAAS,CAAC,MAAM,KAAA,EAAE,OAAO,KAAK,gBAGnD;AAED,wBAAsB,YAAY,CAAC,MAAM,KAAA,EAAE,OAAO,KAAA,EAAE,UAAU,KAAK,8BAKlE;AA6BD,wBAAgB,YAAY,CAAC,EAAC,KAAK,EAAE,MAAM,EAAC;;;CAAA,UAE3C"}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION: any;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/version.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,KAA8D,CAAC"}
@@ -1,2 +1,2 @@
1
- export const VERSION = typeof "4.0.0-alpha.4" !== 'undefined' ? "4.0.0-alpha.4" : 'latest';
1
+ export const VERSION = typeof "4.0.0-alpha.5" !== 'undefined' ? "4.0.0-alpha.5" : 'latest';
2
2
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * data images
3
+ */
4
+ export declare type ImageDataType = {
5
+ data: Uint8Array;
6
+ width: number;
7
+ height: number;
8
+ compressed?: boolean;
9
+ };
10
+ /**
11
+ * Supported Image Types
12
+ */
13
+ export declare type ImageType = ImageBitmap | typeof Image | ImageDataType;
14
+ /**
15
+ * Image type string used to control or determine the type of images returned from ImageLoader
16
+ */
17
+ export declare type ImageTypeEnum = 'imagebitmap' | 'image' | 'data';
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS,GAAG,WAAW,GAAG,OAAO,KAAK,GAAG,aAAa,CAAC;AAEnE;;GAEG;AACH,oBAAY,aAAa,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/images",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.5",
4
4
  "description": "Framework-independent loaders and writers for images (PNG, JPG, ...)",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -18,7 +18,7 @@
18
18
  "point cloud",
19
19
  "PLY"
20
20
  ],
21
- "types": "src/index.ts",
21
+ "types": "dist/index.d.ts",
22
22
  "main": "dist/index.js",
23
23
  "module": "dist/index.js",
24
24
  "sideEffects": false,
@@ -29,10 +29,10 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "pre-build": "npm run build-bundle",
32
- "build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js"
32
+ "build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap"
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/loader-utils": "4.0.0-alpha.4"
35
+ "@loaders.gl/loader-utils": "4.0.0-alpha.5"
36
36
  },
37
- "gitHead": "53026061b3c8871f7e96d3a5826125cc6613bddc"
37
+ "gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
38
38
  }