/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{J as t}from"../../../chunks/Jpg.js";import{F as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),o=new t;o.parse(s);const{width:a,height:l,numComponents:i,eof:f}=o,h=o.getData(a,l,1!==i),c=a*l;let u,g=null;if(n&&f<s.length-1)try{const t=new e(s.subarray(f)).getBytes();g=new Uint8Array(c);for(let e=0,r=0;e<t.length;e++)for(let n=7;n>=0;n--)g[r++]=t[e]>>n&1}catch{}if(1===i&&h.length===a*l){const t=new Uint8Array(h.buffer);u=[t,t,t]}else{u=[];for(let t=0;t<3;t++)u.push(new Uint8Array(c));for(let t=0,e=0;t<c;t++)for(let r=0;r<3;r++)u[r][t]=h[e++]}return{width:a,height:l,pixels:u,mask:g}}}export{r as default};
