/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../chunks/Jpg","../../../chunks/Zlib"],(function(t,e){"use strict";return function(){function n(){}return n.decode=function(n,r=!1){const i=new Uint8Array(n),o=new t.JpegImage;o.parse(i);const{width:s,height:c,numComponents:u,eof:f}=o,h=o.getData(s,c,!0);let l;const a=s*c;let g=0,w=0,p=0;if(!r&&f<i.length-1)try{const t=new e.Zlib(i.subarray(f)).getBytes();l=new Uint8Array(a);let n=0;for(g=0;g<t.length;g++)for(p=7;p>=0;p--)l[n++]=t[g]>>p&1}catch{}let y,d=null;if(1===u&&h.length===s*c)d=[h,h,h];else{for(d=[],g=0;g<3;g++)y=new Uint8Array(a),d.push(y);for(p=0,w=0;w<a;w++)for(g=0;g<3;g++)d[g][w]=h[p++]}return{width:s,height:c,pixels:d,mask:l}},n}()}));
