2 lines
116 KiB
JavaScript
2 lines
116 KiB
JavaScript
import{ax as _t,s as pe,g$ as ur,h0 as cr,_ as hr,eQ as fr,$ as $e,A as D,B as N,C as Oe,a6 as De,a8 as dr,a9 as pr,aH as mr,bb as Q,ab as Ct,f as gr,a1 as jt,jZ as yr,ey as bt,z as wt}from"./index-b5c8f851.js";import{c as ht,u as te,o as Se,h as Cr,i as Je,j as br,k as vt,n as Re}from"./dataUtils-c2b057a0.js";import{A as St,z as _e,j as Tt,y as wr}from"./colorUtils-23771bca.js";var qe,kt,It,et={exports:{}};et.exports,kt=et,qe=function(){function e(){this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=null}return e.prototype={ensureBuffer:function(t){var r=this.buffer,o=r?r.byteLength:0;if(t<o)return r;for(var u=512;u<t;)u<<=1;for(var a=new Uint8Array(u),f=0;f<o;++f)a[f]=r[f];return this.buffer=a},getByte:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return this.buffer[this.pos++]},getBytes:function(t){var r=this.pos;if(t){this.ensureBuffer(r+t);for(var o=r+t;!this.eof&&this.bufferLength<o;)this.readBlock();var u=this.bufferLength;o>u&&(o=u)}else{for(;!this.eof;)this.readBlock();o=this.bufferLength}return this.pos=o,this.buffer.subarray(r,o)},lookChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(t,r,o){for(var u=t+r;this.bufferLength<=u&&!this.eof;)this.readBlock();return new Stream(this.buffer,t,r,o)},skip:function(t){t||(t=1),this.pos+=t},reset:function(){this.pos=0}},e}(),(It=function(){if(!self||!self.Uint32Array)return null;var e=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),r=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),o=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],u=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];function a(n){throw new Error(n)}function f(n){var i=0,l=n[i++],s=n[i++];l!=-1&&s!=-1||a("Invalid header in flate stream"),(15&l)!=8&&a("Unknown compression method in flate stream"),((l<<8)+s)%31!=0&&a("Bad FCHECK in flate stream"),32&s&&a("FDICT bit set in flate stream"),this.bytes=n,this.bytesPos=i,this.codeSize=0,this.codeBuf=0,qe.call(this)}return f.prototype=Object.create(qe.prototype),f.prototype.getBits=function(n){for(var i,l=this.codeSize,s=this.codeBuf,c=this.bytes,d=this.bytesPos;l<n;)(i=c[d++])===void 0&&a("Bad encoding in flate stream"),s|=i<<l,l+=8;return i=s&(1<<n)-1,this.codeBuf=s>>n,this.codeSize=l-=n,this.bytesPos=d,i},f.prototype.getCode=function(n){for(var i=n[0],l=n[1],s=this.codeSize,c=this.codeBuf,d=this.bytes,C=this.bytesPos;s<l;){var g;(g=d[C++])===void 0&&a("Bad encoding in flate stream"),c|=g<<s,s+=8}var b=i[c&(1<<l)-1],S=b>>16,h=65535&b;return(s==0||s<S||S==0)&&a("Bad encoding in flate stream"),this.codeBuf=c>>S,this.codeSize=s-S,this.bytesPos=C,h},f.prototype.generateHuffmanTable=function(n){for(var i=n.length,l=0,s=0;s<i;++s)n[s]>l&&(l=n[s]);for(var c=1<<l,d=new Uint32Array(c),C=1,g=0,b=2;C<=l;++C,g<<=1,b<<=1)for(var S=0;S<i;++S)if(n[S]==C){var h=0,p=g;for(s=0;s<C;++s)h=h<<1|1&p,p>>=1;for(s=h;s<c;s+=b)d[s]=C<<16|S;++g}return[d,l]},f.prototype.readBlock=function(){function n(M,W,$,F,j){for(var q=M.getBits($)+F;q-- >0;)W[b++]=j}var i=this.getBits(3);if(1&i&&(this.eof=!0),(i>>=1)!=0){var l,s;if(i==1)l=o,s=u;else if(i==2){for(var c=this.getBits(5)+257,d=this.getBits(5)+1,C=this.getBits(4)+4,g=Array(e.length),b=0;b<C;)g[e[b++]]=this.getBits(3);for(var S=this.generateHuffmanTable(g),h=0,p=(b=0,c+d),m=new Array(p);b<p;){var y=this.getCode(S);y==16?n(this,m,2,3,h):y==17?n(this,m,3,3,h=0):y==18?n(this,m,7,11,h=0):m[b++]=h=y}l=this.generateHuffmanTable(m.slice(0,c)),s=this.generateHuffmanTable(m.slice(c,p))}else a("Unknown block type in flate stream");for(var w=(R=this.buffer)?R.length:0,k=this.bufferLength;;){var v=this.getCode(l);if(v<256)k+1>=w&&(w=(R=this.ensureBuffer(k+1)).length),R[k++]=v;else{if(v==256)return void(this.bufferLength=k);var I=(v=t[v-=257])>>16;I>0&&(I=this.getBits(I)),h=(65535&v)+I,v=this.getCode(s),(I=(v=r[v])>>16)>0&&(I=this.getBits(I));var T=(65535&v)+I;k+h>=w&&(w=(R=this.ensureBuffer(k+h)).length);for(var A=0;A<h;++A,++k)R[k]=R[k-T]}}}else{var x,E=this.bytes,P=this.bytesPos;(x=E[P++])===void 0&&a("Bad block header in flate stream");var O=x;(x=E[P++])===void 0&&a("Bad block header in flate stream"),O|=x<<8,(x=E[P++])===void 0&&a("Bad block header in flate stream");var L=x;(x=E[P++])===void 0&&a("Bad block header in flate stream"),(L|=x<<8)!=(65535&~O)&&a("Bad uncompressed block length in flate stream"),this.codeBuf=0,this.codeSize=0;var B=this.bufferLength,R=this.ensureBuffer(B+O),_=B+O;this.bufferLength=_;for(var G=B;G<_;++G){if((x=E[P++])===void 0){this.eof=!0;break}R[G]=x}this.bytesPos=P}},f}())!==void 0&&(kt.exports=It);const Ue=_t(et.exports);let vr=class zt{constructor(t){this._canvas=null,this._ctx=null,t&&(this._canvas=t.canvas,this._ctx=t.ctx||t.canvas&&t.canvas.getContext("2d"))}decode(t,r,o){if(!t||t.byteLength<10)throw new pe("imagecanvasdecoder: decode","required a valid encoded data as input.");let{width:u=0,height:a=0,format:f}=r;const{applyJpegMask:n}=r;if(n&&(!u||!a))throw new pe("imagecanvasdecoder: decode","image width and height are needed to apply jpeg mask directly to canvas");return new Promise((i,l)=>{let s=null;f==="jpg"&&n&&(s=zt._getMask(t,{width:u,height:a}));const c=new Blob([new Uint8Array(t)],{type:"image/"+f=="jpg"?"jpeg":f}),d=URL.createObjectURL(c),C=new Image;let g;C.src=d,C.onload=()=>{if(URL.revokeObjectURL(d),ur(o))return void l(cr());u=C.width,a=C.height,this._canvas&&this._ctx?(this._canvas.width===u&&this._canvas.height===a||(this._canvas.width=u,this._canvas.height=a),this._ctx.clearRect(0,0,u,a)):(this._canvas=document.createElement("canvas"),this._canvas.width=u,this._canvas.height=a,this._ctx=this._canvas.getContext("2d")),this._ctx.drawImage(C,0,0);const b=this._ctx.getImageData(0,0,u,a);let S;if(g=b.data,r.renderOnCanvas){if(s)for(S=0;S<s.length;S++)s[S]?g[4*S+3]=255:g[4*S+3]=0;return this._ctx.putImageData(b,0,0),void i(null)}const h=u*a,p=new Uint8Array(h),m=new Uint8Array(h),y=new Uint8Array(h);if(s)for(S=0;S<h;S++)p[S]=g[4*S],m[S]=g[4*S+1],y[S]=g[4*S+2];else for(s=new Uint8Array(h),S=0;S<h;S++)p[S]=g[4*S],m[S]=g[4*S+1],y[S]=g[4*S+2],s[S]=g[4*S+3];i({width:u,height:a,pixels:[p,m,y],mask:s,pixelType:"u8"})},C.onerror=()=>{URL.revokeObjectURL(d),l("cannot load image")}})}static _getMask(t,r){let o=null;try{const u=new Uint8Array(t),a=Math.ceil(u.length/2);let f=0;const n=u.length-2;for(f=a;f<n&&(u[f]!==255||u[f+1]!==217);f++);if(f+=2,f<u.length-1){const i=new Ue(u.subarray(f)).getBytes();o=new Uint8Array(r.width*r.height);let l=0;for(let s=0;s<i.length;s++)for(let c=7;c>=0;c--)o[l++]=i[s]>>c&1}}catch{}return o}};var xt,At,Et,tt={exports:{}};tt.exports,xt=tt,At=function(){var e=function(){function t(r){this.message="JPEG error: "+r}return t.prototype=new Error,t.prototype.name="JpegError",t.constructor=t,t}();return function(){if(!self||!self.Uint8ClampedArray)return null;var t=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),r=4017,o=799,u=3406,a=2276,f=1567,n=3784,i=5793,l=2896;function s(){this.decodeTransform=null,this.colorTransform=-1}function c(h,p){for(var m,y,w=0,k=[],v=16;v>0&&!h[v-1];)v--;k.push({children:[],index:0});var I,T=k[0];for(m=0;m<v;m++){for(y=0;y<h[m];y++){for((T=k.pop()).children[T.index]=p[w];T.index>0;)T=k.pop();for(T.index++,k.push(T);k.length<=m;)k.push(I={children:[],index:0}),T.children[T.index]=I.children,T=I;w++}m+1<v&&(k.push(I={children:[],index:0}),T.children[T.index]=I.children,T=I)}return k[0].children}function d(h,p,m){return 64*((h.blocksPerLine+1)*p+m)}function C(h,p,m,y,w,k,v,I,T){var A=m.mcusPerLine,x=m.progressive,E=p,P=0,O=0;function L(){if(O>0)return O--,P>>O&1;if((P=h[p++])===255){var U=h[p++];if(U)throw new e("unexpected marker "+(P<<8|U).toString(16))}return O=7,P>>>7}function B(U){for(var z=U;;){if(typeof(z=z[L()])=="number")return z;if(typeof z!="object")throw new e("invalid huffman sequence")}}function R(U){for(var z=0;U>0;)z=z<<1|L(),U--;return z}function _(U){if(U===1)return L()===1?1:-1;var z=R(U);return z>=1<<U-1?z:z+(-1<<U)+1}function G(U,z){var H=B(U.huffmanTableDC),Y=H===0?0:_(H);U.blockData[z]=U.pred+=Y;for(var re=1;re<64;){var le=B(U.huffmanTableAC),X=15&le,ne=le>>4;if(X!==0){var lr=t[re+=ne];U.blockData[z+lr]=_(X),re++}else{if(ne<15)break;re+=16}}}function M(U,z){var H=B(U.huffmanTableDC),Y=H===0?0:_(H)<<T;U.blockData[z]=U.pred+=Y}function W(U,z){U.blockData[z]|=L()<<T}var $=0;function F(U,z){if($>0)$--;else for(var H=k,Y=v;H<=Y;){var re=B(U.huffmanTableAC),le=15&re,X=re>>4;if(le!==0){var ne=t[H+=X];U.blockData[z+ne]=_(le)*(1<<T),H++}else{if(X<15){$=R(X)+(1<<X)-1;break}H+=16}}}var j,q=0;function oe(U,z){for(var H,Y,re=k,le=v,X=0;re<=le;){var ne=t[re];switch(q){case 0:if(X=(Y=B(U.huffmanTableAC))>>4,(H=15&Y)==0)X<15?($=R(X)+(1<<X),q=4):(X=16,q=1);else{if(H!==1)throw new e("invalid ACn encoding");j=_(H),q=X?2:3}continue;case 1:case 2:U.blockData[z+ne]?U.blockData[z+ne]+=L()<<T:--X==0&&(q=q===2?3:0);break;case 3:U.blockData[z+ne]?U.blockData[z+ne]+=L()<<T:(U.blockData[z+ne]=j<<T,q=0);break;case 4:U.blockData[z+ne]&&(U.blockData[z+ne]+=L()<<T)}re++}q===4&&--$==0&&(q=0)}function Te(U,z,H,Y,re){var le=H%A;z(U,d(U,(H/A|0)*U.v+Y,le*U.h+re))}function ke(U,z,H){z(U,d(U,H/U.blocksPerLine|0,H%U.blocksPerLine))}var ce,ie,he,me,J,Pe,ge=y.length;Pe=x?k===0?I===0?M:W:I===0?F:oe:G;var se,ye,Ge,Ne,fe=0;for(ye=ge===1?y[0].blocksPerLine*y[0].blocksPerColumn:A*m.mcusPerColumn;fe<ye;){var Be=w?Math.min(ye-fe,w):ye;for(ie=0;ie<ge;ie++)y[ie].pred=0;if($=0,ge===1)for(ce=y[0],J=0;J<Be;J++)ke(ce,Pe,fe),fe++;else for(J=0;J<Be;J++){for(ie=0;ie<ge;ie++)for(Ge=(ce=y[ie]).h,Ne=ce.v,he=0;he<Ne;he++)for(me=0;me<Ge;me++)Te(ce,Pe,fe,he,me);fe++}O=0,(se=S(h,p))&&se.invalid&&(console.log("decodeScan - unexpected MCU data, next marker is: "+se.invalid),p=se.offset);var Ce=se&&se.marker;if(!Ce||Ce<=65280)throw new e("marker was not found");if(!(Ce>=65488&&Ce<=65495))break;p+=2}return(se=S(h,p))&&se.invalid&&(console.log("decodeScan - unexpected Scan data, next marker is: "+se.invalid),p=se.offset),p-E}function g(h,p,m){var y,w,k,v,I,T,A,x,E,P,O,L,B,R,_,G,M,W=h.quantizationTable,$=h.blockData;if(!W)throw new e("missing required Quantization Table.");for(var F=0;F<64;F+=8)E=$[p+F],P=$[p+F+1],O=$[p+F+2],L=$[p+F+3],B=$[p+F+4],R=$[p+F+5],_=$[p+F+6],G=$[p+F+7],E*=W[F],P|O|L|B|R|_|G?(P*=W[F+1],O*=W[F+2],L*=W[F+3],B*=W[F+4],R*=W[F+5],_*=W[F+6],G*=W[F+7],w=(y=(y=i*E+128>>8)+(w=i*B+128>>8)+1>>1)-w,M=(k=O)*n+(v=_)*f+128>>8,k=k*f-v*n+128>>8,A=(I=(I=l*(P-G)+128>>8)+(A=R<<4)+1>>1)-A,T=(x=(x=l*(P+G)+128>>8)+(T=L<<4)+1>>1)-T,v=(y=y+(v=M)+1>>1)-v,k=(w=w+k+1>>1)-k,M=I*a+x*u+2048>>12,I=I*u-x*a+2048>>12,x=M,M=T*o+A*r+2048>>12,T=T*r-A*o+2048>>12,A=M,m[F]=y+x,m[F+7]=y-x,m[F+1]=w+A,m[F+6]=w-A,m[F+2]=k+T,m[F+5]=k-T,m[F+3]=v+I,m[F+4]=v-I):(M=i*E+512>>10,m[F]=M,m[F+1]=M,m[F+2]=M,m[F+3]=M,m[F+4]=M,m[F+5]=M,m[F+6]=M,m[F+7]=M);for(var j=0;j<8;++j)E=m[j],(P=m[j+8])|(O=m[j+16])|(L=m[j+24])|(B=m[j+32])|(R=m[j+40])|(_=m[j+48])|(G=m[j+56])?(w=(y=4112+((y=i*E+2048>>12)+(w=i*B+2048>>12)+1>>1))-w,M=(k=O)*n+(v=_)*f+2048>>12,k=k*f-v*n+2048>>12,v=M,A=(I=(I=l*(P-G)+2048>>12)+(A=R)+1>>1)-A,T=(x=(x=l*(P+G)+2048>>12)+(T=L)+1>>1)-T,M=I*a+x*u+2048>>12,I=I*u-x*a+2048>>12,x=M,M=T*o+A*r+2048>>12,T=T*r-A*o+2048>>12,E=(E=(y=y+v+1>>1)+x)<16?0:E>=4080?255:E>>4,P=(P=(w=w+k+1>>1)+(A=M))<16?0:P>=4080?255:P>>4,O=(O=(k=w-k)+T)<16?0:O>=4080?255:O>>4,L=(L=(v=y-v)+I)<16?0:L>=4080?255:L>>4,B=(B=v-I)<16?0:B>=4080?255:B>>4,R=(R=k-T)<16?0:R>=4080?255:R>>4,_=(_=w-A)<16?0:_>=4080?255:_>>4,G=(G=y-x)<16?0:G>=4080?255:G>>4,$[p+j]=E,$[p+j+8]=P,$[p+j+16]=O,$[p+j+24]=L,$[p+j+32]=B,$[p+j+40]=R,$[p+j+48]=_,$[p+j+56]=G):(M=(M=i*E+8192>>14)<-2040?0:M>=2024?255:M+2056>>4,$[p+j]=M,$[p+j+8]=M,$[p+j+16]=M,$[p+j+24]=M,$[p+j+32]=M,$[p+j+40]=M,$[p+j+48]=M,$[p+j+56]=M)}function b(h,p){for(var m=p.blocksPerLine,y=p.blocksPerColumn,w=new Int16Array(64),k=0;k<y;k++)for(var v=0;v<m;v++)g(p,d(p,k,v),w);return p.blockData}function S(h,p,m){function y(T){return h[T]<<8|h[T+1]}var w=h.length-1,k=m<p?m:p;if(p>=w)return null;var v=y(p);if(v>=65472&&v<=65534)return{invalid:null,marker:v,offset:p};for(var I=y(k);!(I>=65472&&I<=65534);){if(++k>=w)return null;I=y(k)}return{invalid:v.toString(16),marker:I,offset:k}}return s.prototype={parse:function(h){function p(){var U=h[v]<<8|h[v+1];return v+=2,U}function m(){var U=p(),z=v+U-2,H=S(h,z,v);H&&H.invalid&&(console.log("readDataBlock - incorrect length, next marker is: "+H.invalid),z=H.offset);var Y=h.subarray(v,z);return v+=Y.length,Y}function y(U){for(var z=Math.ceil(U.samplesPerLine/8/U.maxH),H=Math.ceil(U.scanLines/8/U.maxV),Y=0;Y<U.components.length;Y++){J=U.components[Y];var re=Math.ceil(Math.ceil(U.samplesPerLine/8)*J.h/U.maxH),le=Math.ceil(Math.ceil(U.scanLines/8)*J.v/U.maxV),X=z*J.h,ne=H*J.v*64*(X+1);J.blockData=new Int16Array(ne),J.blocksPerLine=re,J.blocksPerColumn=le}U.mcusPerLine=z,U.mcusPerColumn=H}var w,k,v=0,I=null,T=null,A=[],x=[],E=[],P=p();if(P!==65496)throw new e("SOI not found");for(P=p();P!==65497;){var O,L,B;switch(P){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var R=m();P===65504&&R[0]===74&&R[1]===70&&R[2]===73&&R[3]===70&&R[4]===0&&(I={version:{major:R[5],minor:R[6]},densityUnits:R[7],xDensity:R[8]<<8|R[9],yDensity:R[10]<<8|R[11],thumbWidth:R[12],thumbHeight:R[13],thumbData:R.subarray(14,14+3*R[12]*R[13])}),P===65518&&R[0]===65&&R[1]===100&&R[2]===111&&R[3]===98&&R[4]===101&&(T={version:R[5]<<8|R[6],flags0:R[7]<<8|R[8],flags1:R[9]<<8|R[10],transformCode:R[11]});break;case 65499:for(var _=p()+v-2;v<_;){var G=h[v++],M=new Uint16Array(64);if(G>>4){if(G>>4!=1)throw new e("DQT - invalid table spec");for(L=0;L<64;L++)M[t[L]]=p()}else for(L=0;L<64;L++)M[t[L]]=h[v++];A[15&G]=M}break;case 65472:case 65473:case 65474:if(w)throw new e("Only single frame JPEGs supported");p(),(w={}).extended=P===65473,w.progressive=P===65474,w.precision=h[v++],w.scanLines=p(),w.samplesPerLine=p(),w.components=[],w.componentIds={};var W,$=h[v++],F=0,j=0;for(O=0;O<$;O++){W=h[v];var q=h[v+1]>>4,oe=15&h[v+1];F<q&&(F=q),j<oe&&(j=oe);var Te=h[v+2];B=w.components.push({h:q,v:oe,quantizationId:Te,quantizationTable:null}),w.componentIds[W]=B-1,v+=3}w.maxH=F,w.maxV=j,y(w);break;case 65476:var ke=p();for(O=2;O<ke;){var ce=h[v++],ie=new Uint8Array(16),he=0;for(L=0;L<16;L++,v++)he+=ie[L]=h[v];var me=new Uint8Array(he);for(L=0;L<he;L++,v++)me[L]=h[v];O+=17+he,(ce>>4?x:E)[15&ce]=c(ie,me)}break;case 65501:p(),k=p();break;case 65498:p();var J,Pe=h[v++],ge=[];for(O=0;O<Pe;O++){var se=w.componentIds[h[v++]];J=w.components[se];var ye=h[v++];J.huffmanTableDC=E[ye>>4],J.huffmanTableAC=x[15&ye],ge.push(J)}var Ge=h[v++],Ne=h[v++],fe=h[v++],Be=C(h,v,w,ge,k,Ge,Ne,fe>>4,15&fe);v+=Be;break;case 65535:h[v]!==255&&v--;break;default:if(h[v-3]===255&&h[v-2]>=192&&h[v-2]<=254){v-=3;break}throw new e("unknown marker "+P.toString(16))}P=p()}for(this.width=w.samplesPerLine,this.height=w.scanLines,this.jfif=I,this.eof=v,this.adobe=T,this.components=[],O=0;O<w.components.length;O++){var Ce=A[(J=w.components[O]).quantizationId];Ce&&(J.quantizationTable=Ce),this.components.push({output:b(w,J),scaleX:J.h/w.maxH,scaleY:J.v/w.maxV,blocksPerLine:J.blocksPerLine,blocksPerColumn:J.blocksPerColumn})}this.numComponents=this.components.length},_getLinearizedBlockData:function(h,p){var m,y,w,k,v,I,T,A,x,E,P,O=this.width/h,L=this.height/p,B=0,R=this.components.length,_=h*p*R,G=new Uint8ClampedArray(_),M=new Uint32Array(h),W=4294967288;for(T=0;T<R;T++){for(y=(m=this.components[T]).scaleX*O,w=m.scaleY*L,B=T,P=m.output,k=m.blocksPerLine+1<<3,v=0;v<h;v++)A=0|v*y,M[v]=(A&W)<<3|7&A;for(I=0;I<p;I++)for(E=k*((A=0|I*w)&W)|(7&A)<<3,v=0;v<h;v++)G[B]=P[E+M[v]],B+=R}var $=this.decodeTransform;if($)for(T=0;T<_;)for(A=0,x=0;A<R;A++,T++,x+=2)G[T]=(G[T]*$[x]>>8)+$[x+1];return G},_isColorConversionNeeded:function(){return this.adobe?!!this.adobe.transformCode:this.numComponents===3?this.colorTransform!==0:this.colorTransform===1},_convertYccToRgb:function(h){for(var p,m,y,w=0,k=h.length;w<k;w+=3)p=h[w],m=h[w+1],y=h[w+2],h[w]=p-179.456+1.402*y,h[w+1]=p+135.459-.344*m-.714*y,h[w+2]=p-226.816+1.772*m;return h},_convertYcckToRgb:function(h){for(var p,m,y,w,k=0,v=0,I=h.length;v<I;v+=4)p=h[v],m=h[v+1],y=h[v+2],w=h[v+3],h[k++]=m*(-660635669420364e-19*m+.000437130475926232*y-54080610064599e-18*p+.00048449797120281*w-.154362151871126)-122.67195406894+y*(-.000957964378445773*y+.000817076911346625*p-.00477271405408747*w+1.53380253221734)+p*(.000961250184130688*p-.00266257332283933*w+.48357088451265)+w*(-.000336197177618394*w+.484791561490776),h[k++]=107.268039397724+m*(219927104525741e-19*m-.000640992018297945*y+.000659397001245577*p+.000426105652938837*w-.176491792462875)+y*(-.000778269941513683*y+.00130872261408275*p+.000770482631801132*w-.151051492775562)+p*(.00126935368114843*p-.00265090189010898*w+.25802910206845)+w*(-.000318913117588328*w-.213742400323665),h[k++]=m*(-.000570115196973677*m-263409051004589e-19*y+.0020741088115012*p-.00288260236853442*w+.814272968359295)-20.810012546947+y*(-153496057440975e-19*y-.000132689043961446*p+.000560833691242812*w-.195152027534049)+p*(.00174418132927582*p-.00255243321439347*w+.116935020465145)+w*(-.000343531996510555*w+.24165260232407);return h},_convertYcckToCmyk:function(h){for(var p,m,y,w=0,k=h.length;w<k;w+=4)p=h[w],m=h[w+1],y=h[w+2],h[w]=434.456-p-1.402*y,h[w+1]=119.541-p+.344*m+.714*y,h[w+2]=481.816-p-1.772*m;return h},_convertCmykToRgb:function(h){for(var p,m,y,w,k=0,v=1/255,I=0,T=h.length;I<T;I+=4)p=h[I]*v,m=h[I+1]*v,y=h[I+2]*v,w=h[I+3]*v,h[k++]=255+p*(-4.387332384609988*p+54.48615194189176*m+18.82290502165302*y+212.25662451639585*w-285.2331026137004)+m*(1.7149763477362134*m-5.6096736904047315*y-17.873870861415444*w-5.497006427196366)+y*(-2.5217340131683033*y-21.248923337353073*w+17.5119270841813)-w*(21.86122147463605*w+189.48180835922747),h[k++]=255+p*(8.841041422036149*p+60.118027045597366*m+6.871425592049007*y+31.159100130055922*w-79.2970844816548)+m*(-15.310361306967817*m+17.575251261109482*y+131.35250912493976*w-190.9453302588951)+y*(4.444339102852739*y+9.8632861493405*w-24.86741582555878)-w*(20.737325471181034*w+187.80453709719578),h[k++]=255+p*(.8842522430003296*p+8.078677503112928*m+30.89978309703729*y-.23883238689178934*w-14.183576799673286)+m*(10.49593273432072*m+63.02378494754052*y+50.606957656360734*w-112.23884253719248)+y*(.03296041114873217*y+115.60384449646641*w-193.58209356861505)-w*(22.33816807309886*w+180.12613974708367);return h},getData:function(h,p,m){if(this.numComponents>4)throw new e("Unsupported color mode");var y=this._getLinearizedBlockData(h,p);if(this.numComponents===1&&m){for(var w=y.length,k=new Uint8ClampedArray(3*w),v=0,I=0;I<w;I++){var T=y[I];k[v++]=T,k[v++]=T,k[v++]=T}return k}if(this.numComponents===3&&this._isColorConversionNeeded())return this._convertYccToRgb(y);if(this.numComponents===4){if(this._isColorConversionNeeded())return m?this._convertYcckToRgb(y):this._convertYcckToCmyk(y);if(m)return this._convertCmykToRgb(y)}return y}},s}()},(Et=At())!==void 0&&(xt.exports=Et);const Wt=_t(tt.exports);let Sr=class{static decode(t,r=!1){const o=new Uint8Array(t),u=new Wt;u.parse(o);const{width:a,height:f,numComponents:n,eof:i}=u,l=u.getData(a,f,!0),s=a*f;let c,d=null,C=0,g=0,b=0;if(!r&&i<o.length-1)try{const S=new Ue(o.subarray(i)).getBytes();d=new Uint8Array(s);let h=0;for(C=0;C<S.length;C++)for(b=7;b>=0;b--)d[h++]=S[C]>>b&1}catch{}if(n===1&&l.length===a*f){const S=new Uint8Array(l.buffer);c=[S,S,S]}else{for(c=[],C=0;C<3;C++)c.push(new Uint8Array(s));for(b=0,g=0;g<s;g++)for(C=0;C<3;C++)c[C][g]=l[b++]}return{width:a,height:f,pixels:c,mask:d}}};const Ht=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,127]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34027999387901484e22,34027999387901484e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let Ye=null;function Kt(){return Ye||(Ye=hr(()=>import("./lerc-wasm-9604db8c.js"),["assets/lerc-wasm-9604db8c.js","assets/index-b5c8f851.js","assets/index-86716609.css"]).then(e=>e.l).then(({default:e})=>e({locateFile:t=>fr(`esri/layers/support/rasterFormats/${t}`)})).then(e=>{kr(e)}),Ye)}const je={getBlobInfo:null,decode:null};function Tr(e){return 16+(e>>3<<3)}function de(e,t,r){r.set(e.slice(t,t+r.length))}function kr(e){const{_malloc:t,_free:r,_lerc_getBlobInfo:o,_lerc_getDataRanges:u,_lerc_decode_4D:a,asm:f}=e;let n;const i=Object.values(f).find(s=>s&&"buffer"in s&&s.buffer===e.HEAPU8.buffer),l=s=>{const c=s.map(b=>Tr(b)),d=c.reduce((b,S)=>b+S),C=t(d);n=new Uint8Array(i.buffer);let g=c[0];c[0]=C;for(let b=1;b<c.length;b++){const S=c[b];c[b]=c[b-1]+g,g=S}return c};je.getBlobInfo=s=>{const C=new Uint8Array(48),g=new Uint8Array(8*3),[b,S,h]=l([s.length,C.length,g.length]);n.set(s,b),n.set(C,S),n.set(g,h);let p=o(b,s.length,S,h,12,3);if(p)throw r(b),new Error(`lerc-getBlobInfo: error code is ${p}`);n=new Uint8Array(i.buffer),de(n,S,C),de(n,h,g);const m=new Uint32Array(C.buffer),y=new Float64Array(g.buffer),[w,k,,v,I,T,A,x,E,P,O]=m,L={version:w,depthCount:P,width:v,height:I,validPixelCount:A,bandCount:T,blobSize:x,maskCount:E,dataType:k,minValue:y[0],maxValue:y[1],maxZerror:y[2],statistics:[],bandCountWithNoData:O};if(O&&P>1)return r(b),L;if(P===1&&T===1)return r(b),L.statistics.push({minValue:y[0],maxValue:y[1]}),L;const B=P*T*8,R=new Uint8Array(B),_=new Uint8Array(B);let G=b,M=0,W=0,$=!1;if(n.byteLength<b+2*B?(r(b),$=!0,[G,M,W]=l([s.length,B,B]),n.set(s,G)):[M,W]=l([B,B]),n.set(R,M),n.set(_,W),p=u(G,s.length,P,T,M,W),p)throw r(G),$||r(M),new Error(`lerc-getDataRanges: error code is ${p}`);n=new Uint8Array(i.buffer),de(n,M,R),de(n,W,_);const F=new Float64Array(R.buffer),j=new Float64Array(_.buffer),q=L.statistics;for(let oe=0;oe<T;oe++)if(P>1){const Te=F.slice(oe*P,(oe+1)*P),ke=j.slice(oe*P,(oe+1)*P),ce=Math.min.apply(null,Te),ie=Math.max.apply(null,ke);q.push({minValue:ce,maxValue:ie,depthStats:{minValues:Te,maxValues:ke}})}else q.push({minValue:F[oe],maxValue:j[oe]});return r(G),$||r(M),L},je.decode=(s,c)=>{const{maskCount:d,depthCount:C,bandCount:g,width:b,height:S,dataType:h,bandCountWithNoData:p}=c,m=Ht[h],y=b*S,w=new Uint8Array(y*g),k=y*C*g*m.size,v=new Uint8Array(k),I=new Uint8Array(g),T=new Uint8Array(8*g),[A,x,E,P,O]=l([s.length,w.length,v.length,I.length,T.length]);n.set(s,A),n.set(w,x),n.set(v,E),n.set(I,P),n.set(T,O);const L=a(A,s.length,d,x,C,b,S,g,h,E,P,O);if(L)throw r(A),new Error(`lerc-decode: error code is ${L}`);n=new Uint8Array(i.buffer),de(n,E,v),de(n,x,w);let B=null;if(p){de(n,P,I),de(n,O,T),B=[];const R=new Float64Array(T.buffer);for(let _=0;_<I.length;_++)B.push(I[_]?R[_]:null)}return r(A),{data:v,maskData:w,noDataValues:B}}}function Ir(e,t,r,o,u){if(r<2)return e;const a=new o(t*r);if(u)for(let f=0,n=0;f<t;f++)for(let i=0,l=f;i<r;i++,l+=t)a[l]=e[n++];else for(let f=0,n=0;f<t;f++)for(let i=0,l=f;i<r;i++,l+=t)a[n++]=e[l];return a}function Jt(e,t={}){const r=t.inputOffset??0,o=e instanceof Uint8Array?e.subarray(r):new Uint8Array(e,r),u=je.getBlobInfo(o),{data:a,maskData:f,noDataValues:n}=je.decode(o,u),{width:i,height:l,bandCount:s,depthCount:c,dataType:d,maskCount:C,statistics:g}=u,b=Ht[d],S=new b.ctor(a.buffer),h=[],p=[],m=i*l,y=m*c;for(let A=0;A<s;A++){const x=S.subarray(A*y,(A+1)*y);if(t.returnInterleaved)h.push(x);else{const E=Ir(x,m,c,b.ctor,!0);h.push(E)}p.push(f.subarray(A*y,(A+1)*y))}const w=C===0?null:C===1?p[0]:new Uint8Array(m);if(C>1){w.set(p[0]);for(let A=1;A<p.length;A++){const x=p[A];for(let E=0;E<m;E++)w[E]=w[E]&x[E]}}const{noDataValue:k}=t,v=k!=null&&b.range[0]<=k&&b.range[1]>=k;if(C>0&&v)for(let A=0;A<s;A++){const x=h[A],E=p[A]||w;for(let P=0;P<m;P++)E[P]===0&&(x[P]=k)}const I=C===s&&s>1?p:null,{pixelType:T}=b;return{width:i,height:l,bandCount:s,pixelType:T,depthCount:c,statistics:g,pixels:h,mask:w,bandMasks:I,noDataValues:n}}function xr(e,t,r,o=!0){if(t%4!=0||r%4!=0){const u=new ArrayBuffer(4*Math.ceil(r/4)),a=new Uint8Array(u),f=new Uint8Array(e,t,r);if(o)for(let n=0;n<a.length;n+=4)a[n]=f[n+3],a[n+1]=f[n+2],a[n+2]=f[n+1],a[n+3]=f[n];else a.set(f);return new Uint32Array(a.buffer)}if(o){const u=new Uint8Array(e,t,r),a=new Uint8Array(u.length);for(let f=0;f<a.length;f+=4)a[f]=u[f+3],a[f+1]=u[f+2],a[f+2]=u[f+1],a[f+3]=u[f];return new Uint32Array(a.buffer)}return new Uint32Array(e,t,r/4)}function Pt(){const e=[];for(let t=0;t<=257;t++)e[t]=[t];return e}function Rt(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}const Ie=new Set;function ft(e,t,r,o=!0){const u=xr(e,t,r,o);let a=9,f=Pt(),n=32,i=f.length,l=[],s=1,c=u[0],d=0;const C=u.length,g=8*(4*C-r),b=[];for(;c!=null;){if(n>=a)n-=a,d=c>>>32-a,c<<=a;else{d=c>>>32-n,c=u[s++];const h=a-n;n=32-h,d=(d<<h)+(c>>>n),c<<=h}if(d===257)break;if(d===256){a=9,f=Pt(),i=f.length,l=[];continue}const S=f[d];if(S==null){if(d>f.length)throw new Error("data integrity issue: code does not exist on code page");l.push(l[0]),f[i++]=l.slice(),Rt(b,l)}else Rt(b,S),l.push(S[0]),l.length>1&&(f[i++]=l.slice()),l=S.slice();if(Ie.has(i)&&a++,n===0&&(c=u[s++],n=32),s>C||s===C&&n<=g)break}return new Uint8Array(b)}Ie.add(511),Ie.add(1023),Ie.add(2047),Ie.add(4095),Ie.add(8191);const Mt=(e,t)=>{const r=t.width*t.height,o=t.pixelType;return Math.floor(e.byteLength/(r*qt(o)))},qt=e=>{let t=1;switch(e){case Uint8Array:case Int8Array:t=1;break;case Uint16Array:case Int16Array:t=2;break;case Uint32Array:case Int32Array:case Float32Array:t=4;break;case Float64Array:t=8}return t},Ar=(e,t)=>{if(8*e.byteLength<t)return null;const r=new Uint8Array(e,0,Math.ceil(t/8)),o=new Uint8Array(t);let u=0,a=0,f=0,n=0;for(f=0;f<r.length-1;f++)for(a=r[f],n=7;n>=0;n--)o[u++]=a>>n&1;for(n=7;u<t-1;)a=r[r.length-1],o[u++]=a>>n&1,n--;return o};let Er=class{static decode(t,r){const o=r.pixelType,u=[],a=r.width*r.height,f=Mt(t,r),{bandIds:n,format:i}=r,l=(n==null?void 0:n.length)||Mt(t,r),s=t.byteLength-t.byteLength%(a*qt(o)),c=new o(t,0,a*f);let d,C,g,b,S=null;if(i==="bip")for(d=0;d<l;d++){for(g=new o(a),b=n?n[d]:d,C=0;C<a;C++)g[C]=c[C*f+b];u.push(g)}else if(i==="bsq")for(d=0;d<l;d++)b=n?n[d]:d,u.push(c.subarray(b*a,(b+1)*a));return s<t.byteLength-1&&(S=Ar(t.slice(s),a)),{pixels:u,mask:S}}};function Pr(e,t){let r=0,o="",u=0,a=0;const f=e.length;for(;r<f;)a=e[r++],u=a>>4,u<8?u=1:u===15?(u=4,a=(7&a)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++]):u===14?(u=3,a=(15&a)<<12|(63&e[r++])<<6|63&e[r++]):(u=2,a=(31&a)<<6|63&e[r++]),(a!==0||t)&&(o+=String.fromCharCode(a));return o}const dt=(()=>{const e=[];return e[254]="NEWSUBFILETYPE",e[255]="SUBFILETYPE",e[256]="IMAGEWIDTH",e[257]="IMAGELENGTH",e[258]="BITSPERSAMPLE",e[259]="COMPRESSION",e[262]="PHOTOMETRICINTERPRETATION",e[263]="THRESHHOLDING",e[264]="CELLWIDTH",e[265]="CELLLENGTH",e[266]="FILLORDER",e[269]="DOCUMENTNAME",e[270]="IMAGEDESCRIPTION",e[271]="MAKE",e[272]="MODEL",e[273]="STRIPOFFSETS",e[274]="ORIENTATION",e[277]="SAMPLESPERPIXEL",e[278]="ROWSPERSTRIP",e[279]="STRIPBYTECOUNTS",e[280]="MINSAMPLEVALUE",e[281]="MAXSAMPLEVALUE",e[282]="XRESOLUTION",e[283]="YRESOLUTION",e[284]="PLANARCONFIGURATION",e[285]="PAGENAME",e[286]="XPOSITION",e[287]="YPOSITION",e[288]="FREEOFFSETS",e[289]="FREEBYTECOUNTS",e[290]="GRAYRESPONSEUNIT",e[291]="GRAYRESPONSECURVE",e[292]="T4OPTIONS",e[293]="T6OPTIONS",e[296]="RESOLUTIONUNIT",e[297]="PAGENUMBER",e[300]="COLORRESPONSEUNIT",e[301]="TRANSFERFUNCTION",e[305]="SOFTWARE",e[306]="DATETIME",e[315]="ARTIST",e[316]="HOSTCOMPUTER",e[317]="PREDICTOR",e[318]="WHITEPOINT",e[319]="PRIMARYCHROMATICITIES",e[320]="COLORMAP",e[321]="HALFTONEHINTS",e[322]="TILEWIDTH",e[323]="TILELENGTH",e[324]="TILEOFFSETS",e[325]="TILEBYTECOUNTS",e[326]="BADFAXLINES",e[327]="CLEANFAXDATA",e[328]="CONSECUTIVEBADFAXLINES",e[330]="SUBIFD",e[332]="INKSET",e[333]="INKNAMES",e[334]="NUMBEROFINKS",e[336]="DOTRANGE",e[337]="TARGETPRINTER",e[338]="EXTRASAMPLES",e[339]="SAMPLEFORMAT",e[340]="SMINSAMPLEVALUE",e[341]="SMAXSAMPLEVALUE",e[342]="TRANSFERRANGE",e[347]="JPEGTABLES",e[512]="JPEGPROC",e[513]="JPEGIFOFFSET",e[514]="JPEGIFBYTECOUNT",e[515]="JPEGRESTARTINTERVAL",e[517]="JPEGLOSSLESSPREDICTORS",e[518]="JPEGPOINTTRANSFORM",e[519]="JPEGQTABLES",e[520]="JPEGDCTABLES",e[521]="JPEGACTABLES",e[529]="YCBCRCOEFFICIENTS",e[530]="YCBCRSUBSAMPLING",e[531]="YCBCRPOSITIONING",e[532]="REFERENCEBLACKWHITE",e[700]="XMP",e[33550]="GEOPIXELSCALE",e[33922]="GEOTIEPOINTS",e[33432]="COPYRIGHT",e[42112]="GDAL_METADATA",e[42113]="GDAL_NODATA",e[50844]="RPCCOEFFICIENT",e[34264]="GEOTRANSMATRIX",e[34735]="GEOKEYDIRECTORY",e[34736]="GEODOUBLEPARAMS",e[34737]="GEOASCIIPARAMS",e[34665]="EXIFIFD",e[34853]="GPSIFD",e[40965]="INTEROPERABILITYIFD",e})(),Rr=(()=>{const e=dt.slice();return e[36864]="ExifVersion",e[40960]="FlashpixVersion",e[40961]="ColorSpace",e[42240]="Gamma",e[37121]="ComponentsConfiguration",e[37122]="CompressedBitsPerPixel",e[40962]="PixelXDimension",e[40963]="PixelYDimension",e[37500]="MakerNote",e[37510]="UserComment",e[40964]="RelatedSoundFile",e[36867]="DateTimeOriginal",e[36868]="DateTimeDigitized",e[36880]="OffsetTime",e[36881]="OffsetTimeOriginal",e[36882]="OffsetTimeDigitized",e[37520]="SubSecTime",e[37521]="SubSecTimeOriginal",e[37522]="SubSecTimeDigitized",e[37888]="Temperature",e[37889]="Humidity",e[37890]="Pressure",e[37891]="WaterDepth",e[37892]="Acceleration",e[37893]="CameraElevationAngle",e[42016]="ImageUniqueID",e[42032]="CameraOwnerName",e[42033]="BodySerialNumber",e[42034]="LensSpecification",e[42035]="LensMake",e[42036]="LensModel",e[42037]="LensSerialNumber",e[33434]="ExposureTime",e[33437]="FNumber",e[34850]="ExposureProgram",e[34852]="SpectralSensitivity",e[34855]="PhotographicSensitivity",e[34856]="OECF",e[34864]="SensitivityType",e[34865]="StandardOutputSensitivity",e[34866]="RecommendedExposureIndex",e[34867]="ISOSpeed",e[34868]="ISOSpeedLatitudeyyy",e[34869]="ISOSpeedLatitudezzz",e[37377]="ShutterSpeedValue",e[37378]="ApertureValue",e[37379]="BrightnessValue",e[37380]="ExposureBiasValue",e[37381]="MaxApertureValue",e[37382]="SubjectDistance",e[37383]="MeteringMode",e[37384]="LightSource",e[37385]="Flash",e[37386]="FocalLength",e[37396]="SubjectArea",e[41483]="FlashEnergy",e[41484]="SpatialFrequencyResponse",e[41486]="FocalPlaneXResolution",e[41487]="FocalPlaneYResolution",e[41488]="FocalPlaneResolutionUnit",e[41492]="SubjectLocation",e[41493]="ExposureIndex",e[41495]="SensingMethod",e[41728]="FileSource",e[41729]="SceneType",e[41730]="CFAPattern",e[41985]="CustomRendered",e[41986]="ExposureMode",e[41987]="WhiteBalance",e[41988]="DigitalZoomRatio",e[41989]="FocalLengthIn35mmFilm",e[41990]="SceneCaptureType",e[41991]="GainControl",e[41992]="Contrast",e[41993]="Saturation",e[41994]="Sharpness",e[41995]="DeviceSettingDescription",e[41996]="SubjectDistanceRange",e})(),Mr=["GPSVersionID","GPSLatitudeRef","GPSLatitude","GPSLongitudeRef","GPSLongitude","GPSAltitudeRef","GPSAltitude","GPSTimeStamp","GPSSatellites","GPSStatus","GPSMeasureMode","GPSDOP","GPSSpeedRef","GPSSpeed","GPSTrackRef","GPSTrack","GPSImgDirectionRef","GPSImgDirection","GPSMapDatum","GPSDestLatitudeRef","GPSDestLatitude","GPSDestLongitudeRef","GPSDestLongitude","GPSDestBearingRef","GPSDestBearing","GPSDestDistanceRef","GPSDestDistance","GPSProcessingMethod","GPSAreaInformation","GPSDateStamp","GPSDifferential","GPSHPositioningError"],Lr=(()=>{const e=[];return e[1024]="GTModelTypeGeoKey",e[1025]="GTRasterTypeGeoKey",e[1026]="GTCitationGeoKey",e[2048]="GeographicTypeGeoKey",e[2049]="GeogCitationGeoKey",e[2050]="GeogGeodeticDatumGeoKey",e[2051]="GeogPrimeMeridianGeoKey",e[2052]="GeogLinearUnitsGeoKey",e[2053]="GeogLinearUnitSizeGeoKey",e[2054]="GeogAngularUnitsGeoKey",e[2055]="GeogAngularUnitSizeGeoKey",e[2056]="GeogEllipsoidGeoKey",e[2057]="GeogSemiMajorAxisGeoKey",e[2058]="GeogSemiMinorAxisGeoKey",e[2059]="GeogInvFlatteningGeoKey",e[2061]="GeogPrimeMeridianLongGeoKey",e[2060]="GeogAzimuthUnitsGeoKey",e[3072]="ProjectedCSTypeGeoKey",e[3073]="PCSCitationGeoKey",e[3074]="ProjectionGeoKey",e[3075]="ProjCoordTransGeoKey",e[3076]="ProjLinearUnitsGeoKey",e[3077]="ProjLinearUnitSizeGeoKey",e[3078]="ProjStdParallel1GeoKey",e[3079]="ProjStdParallel2GeoKey",e[3080]="ProjNatOriginLongGeoKey",e[3081]="ProjNatOriginLatGeoKey",e[3082]="ProjFalseEastingGeoKey",e[3083]="ProjFalseNorthingGeoKey",e[3084]="ProjFalseOriginLongGeoKey",e[3085]="ProjFalseOriginLatGeoKey",e[3086]="ProjFalseOriginEastingGeoKey",e[3087]="ProjFalseOriginNorthingGeoKey",e[3088]="ProjCenterLongGeoKey",e[3090]="ProjCenterEastingGeoKey",e[3091]="ProjCenterNorthingGeoKey",e[3092]="ProjScaleAtNatOriginGeoKey",e[3093]="ProjScaleAtCenterGeoKey",e[3094]="ProjAzimuthAngleGeoKey",e[3095]="ProjStraightVertPoleLongGeoKey",e[4096]="VerticalCSTypeGeoKey",e[4097]="VerticalCitationGeoKey",e[4098]="VerticalDatumGeoKey",e[4099]="VerticalUnitsGeoKey",e})(),Or=(e,t)=>{let r=(t||dt)[e];return r===void 0&&(r="unknown"+String(e)),r},rt=new Map;rt.set("EXIFIFD",Rr),rt.set("GPSIFD",Mr);const Ae={tiffTags:dt,ifdTags:rt,geoKeys:Lr,getTagName:Or},pt=(()=>{const e=new ArrayBuffer(4),t=new Uint8Array(e);return new Uint32Array(e)[0]=1,t[0]===1})(),Lt=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],Ee=4294967296,Dr=new Set([1,5,6,7,8,34712,34887]);function mt(e,t){let r="unknown";return e===3?r=t===64?"f64":"f32":e===1?t===1?r="u1":t===2?r="u2":t===4?r="u4":t<=8?r="u8":t<=16?r="u16":t<=32&&(r="u32"):e===2&&(t<=8?r="s8":t<=16?r="s16":t<=32&&(r="s32")),r}function ze(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function Ur(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function Yt(e,t){var r;return(r=e.get(t))==null?void 0:r.values}function ve(e,t){var r;return(r=e.get(t))==null?void 0:r.values}function Ot(e,t){var r,o;return(o=(r=e.get(t))==null?void 0:r.values)==null?void 0:o[0]}function V(e,t){var r,o;return(o=(r=e.get(t))==null?void 0:r.values)==null?void 0:o[0]}function Xe(e,t,r,o=0,u=Ae.tiffTags,a=4){const f=a===8,n=f?yt(new DataView(e,r,8),0,t):new DataView(e,r,2).getUint16(0,t),i=4+2*a,l=f?8:2,s=l+n*i;if(r+s>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:s};const c=r+s+4<=e.byteLength?Ve(new DataView(e,r+s,a===8?8:4),0,t,a===8):null,d=r+l,C=new Map;let g,b,S,h,p,m=0,y=0;for(let w=0;w<n;w++){b=new DataView(e,d+i*w,i),S=b.getUint16(0,t),p=b.getUint16(2,t),h=Ae.getTagName(S,u);const k=[];a===2?(m=b.getUint16(4,t),y=b.getUint16(6,t)):a===4?(m=b.getUint32(4,t),y=b.getUint32(8,t)):a===8&&(m=Ve(b,4,t,!0),y=Ve(b,12,t,!0),k.push(b.getUint32(12,t)),k.push(b.getUint32(16,t))),g={id:S,type:p,valueCount:m,valueOffset:y,valueOffsets:k,values:null},Vr(e,t,g,o,!1,a),C.set(h,g)}return{success:!0,ifd:C,nextIFD:c,requiredBufferSize:s}}const Gr=(e,t)=>Jt(e,{inputOffset:t}).pixels[0];function ot(e,t){if(t!==1&&t!==2&&t!==4)return e;const r=new Uint8Array(e),o=8/t,u=new Uint8Array(e.byteLength*o);let a=0;const f=2**t-1;for(let n=0;n<r.length;n++){const i=r[n];for(let l=0;l<o;l++)u[a++]=i<<t*l>>>8-t&f}return u.buffer}function nt(e,t,r){const o=new Wt;o.parse(e),o.colorTransform=r===6?-1:0;const u=o.getData(o.width,o.height,t!==1&&t!==4);return new Uint8Array(u.buffer)}function it(e){const t=new Ue(e).getBytes(),r=new ArrayBuffer(t.length),o=new Uint8Array(r);return o.set(t),o}async function at(e,t,r,o,u){const a=pt===t,f=V(r,"BITSPERSAMPLE"),n=V(r,"SAMPLESPERPIXEL")??1,i=V(r,"PHOTOMETRICINTERPRETATION"),l=V(r,"SAMPLEFORMAT")??1,s=mt(l,f),c=V(r,"COMPRESSION")??1,d=ze(s);let C,g,b;if(c===34887)return await Kt(),Gr(e,o);if(c===1)C=e.slice(o,o+u),g=new Uint8Array(C);else if(c===8||c===32946)g=new Uint8Array(e,o,u),g=it(g),C=g.buffer;else if(c===6)g=new Uint8Array(e,o,u),g=nt(g,n,i),C=g.buffer;else if(c===7){const m=r.get("JPEGTABLES").values,y=m.length-2;g=new Uint8Array(y+u-2);for(let k=0;k<y;k++)g[k]=m[k];const w=new Uint8Array(e,o+2,u-2);for(let k=0;k<w.length;k++)g[y+k]=w[k];g=nt(g,n,i),C=g.buffer}else{if(c!==5)throw new Error("tiff-decode: unsupport compression "+c);g=ft(e,o,u,t),C=g.buffer}if(C=ot(C,f),s==="u8"||s==="s8"||a)b=new d(C);else{C=new ArrayBuffer(g.length);const m=new Uint8Array(C);switch(s){case"u16":case"s16":for(let y=0;y<g.length;y+=2)m[y]=g[y+1],m[y+1]=g[y];break;case"u32":case"s32":case"f32":for(let y=0;y<g.length;y+=4)m[y]=g[y+3],m[y+1]=g[y+2],m[y+2]=g[y+1],m[y+3]=g[y]}b=new d(C)}const S=V(r,"PREDICTOR")??1,h=V(r,"TILEWIDTH"),p=V(r,"TILELENGTH");if(S>1&&(c===5||c===8||c===32946)&&h&&p){const m=We(r),y=new d(b.length);y.set(b),b=Hr(y,p,h,l===3&&S===3,m?1:n)}return b}async function Nr(e,t,r){const o=ve(r,"TILEOFFSETS");if(o===void 0)return null;const u=ve(r,"TILEBYTECOUNTS"),{width:a,height:f,pixelType:n,tileWidth:i,tileHeight:l}=gt([r]),s=We(r,t),c=V(r,"SAMPLESPERPIXEL")||t.planes,d=a*f,C=V(r,"BITSPERSAMPLE"),g=(V(r,"COMPRESSION")??1)===34887,b=ze(n),S=[];for(let R=0;R<c;R++)S.push(new b(d));let h,p,m,y,w,k,v,I,T,A,x,E,P;const O=Math.ceil(a/i),L=new Uint8Array(d).fill(255);let B=!1;if(C%8==0)if(g&&s&&c>1){const R=Math.round(o.length/c);for(h=0;h<R;h++){k=Math.floor(h/O)*l,v=h%O*i,I=k*a+v;for(let _=0;_<c;_++){const G=h*c+_;for(u[G]===0?(m=null,B=!0):m=await at(e,t.littleEndian,r,o[G],u[G]),A=0,T=I,E=Math.min(i,a-v),x=Math.min(l,f-k),P=S[_],y=0;y<x;y++)for(T=I+y*a,A=y*i,w=0;w<E;w++,T++,A++)m?P[T]=m[A]:L[T]=0}}}else for(h=0;h<o.length;h++)for(k=Math.floor(h/O)*l,v=h%O*i,I=k*a+v,u[h]===0?(m=null,B=!0):m=await at(e,t.littleEndian,r,o[h],u[h]),A=0,T=I,E=Math.min(i,a-v),x=Math.min(l,f-k),p=0;p<c;p++)if(P=S[p],s||g)for(y=0;y<x;y++)for(T=I+y*a,A=i*l*p+y*i,w=0;w<E;w++,T++,A++)m?P[T]=m[A]:L[T]=0;else for(y=0;y<x;y++)for(T=I+y*a,A=y*i*c+p,w=0;w<E;w++,T++,A+=c)m?P[T]=m[A]:L[T]=0;return{width:a,height:f,pixelType:n,pixels:S,mask:B?L:void 0}}const Br=(e,t,r)=>{const o=pt===t.littleEndian,u=ve(r,"STRIPOFFSETS");if(u===void 0)return null;const{width:a,height:f,pixelType:n}=gt([r]),i=V(r,"SAMPLESPERPIXEL")||t.planes,l=V(r,"PHOTOMETRICINTERPRETATION"),s=a*f,c=V(r,"BITSPERSAMPLE"),d=ze(n),C=new d(s*i),g=ve(r,"STRIPBYTECOUNTS"),b=V(r,"ROWSPERSTRIP"),S=V(r,"COMPRESSION")??1;let h,p,m,y,w,k,v,I,T,A=b;if(c%8==0)for(h=0;h<u.length;h++){if(w=h*(b*a)*i,A=(h+1)*b>f?f-h*b:b,n==="u8"||n==="s8"||o)S===8||S===32946?(v=new Uint8Array(e,u[h],g[h]),v=it(v),k=v.buffer):S===6?(v=new Uint8Array(e,u[h],g[h]),v=nt(v,i,l),k=v.buffer):S===5?(v=ft(e,u[h],g[h],t.littleEndian),k=v.buffer):(g[h]!==A*a*i*c/8&&console.log("strip byte counts is different than expected"),k=e.slice(u[h],u[h]+g[h])),k=ot(k,c),y=new d(k);else{switch(S===6||S===8||S===32946?(v=new Uint8Array(e,u[h],g[h]),I=it(v),k=I.buffer):(g[h]!==A*a*i*c/8&&console.log("strip byte counts is different than expected"),k=new ArrayBuffer(g[h]),v=new Uint8Array(e,u[h],g[h]),I=new Uint8Array(k)),n){case"u16":case"s16":for(m=0;m<v.length;m+=2)I[m]=v[m+1],I[m+1]=v[m];break;case"u32":case"s32":case"f32":for(m=0;m<v.length;m+=4)I[m]=v[m+3],I[m+1]=v[m+2],I[m+2]=v[m+1],I[m+3]=v[m]}k=ot(k,c),y=new d(k)}C.set(y,w)}const x=[];if(i===1)x.push(C);else for(h=0;h<i;h++){for(T=new d(s),p=0;p<s;p++)T[p]=C[p*i+h];x.push(T)}return{width:a,height:f,pixelType:n,pixels:x}},Fr=(e,t,r)=>{if(!(e&&e.length>0&&t&&r))return null;let o,u,a;const f=e[0].length,n=e.length,i=new Uint8Array(f);for(let l=0;l<n;l++)if(o=e[l],u=t[l],a=r[l],l===0)for(let s=0;s<f;s++)i[s]=o[s]<u||o[s]>a?0:1;else for(let s=0;s<f;s++)i[s]&&(i[s]=o[s]<u||o[s]>a?0:1);return i},$r=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||t.length===0)return null;const r=new Map;let o,u,a,f,n;for(let h=0;h<t.length;h++)o=t[h],u=o.slice(6,o.indexOf(">")),f=o.indexOf("sample="),f>-1&&(n=o.slice(f+8,o.indexOf('"',f+8))),f=o.indexOf("name="),f>-1&&(u=o.slice(f+6,o.indexOf('"',f+6))),u&&(a=o.slice(o.indexOf(">")+1,o.indexOf("</Item>")).trim(),n!=null?r.has(u)?r.get(u)[n]=a:r.set(u,[a]):r.set(u,a)),n=null;const i=r.get("STATISTICS_MINIMUM"),l=r.get("STATISTICS_MAXIMUM"),s=r.get("STATISTICS_MEAN"),c=r.get("STATISTICS_STDDEV");let d=null;if(i&&l){d=[];for(let h=0;h<i.length;h++)d.push({min:parseFloat(i[h]),max:parseFloat(l[h]),avg:s&&parseFloat(s[h]),stddev:c&&parseFloat(c[h])})}const C=r.get("BandName"),g=r.get("WavelengthMin"),b=r.get("WavelengthMax");let S=null;if(C){S=[];for(let h=0;h<C.length;h++)S.push({BandName:C[h],WavelengthMin:g&&parseFloat(g[h]),WavelengthMax:b&&parseFloat(b[h])})}return{statistics:d,bandProperties:S,dataType:r.get("DataType"),rawMetadata:r}};function Vr(e,t,r,o=0,u=!1,a=4){if(r.values)return!0;const f=r.type,n=r.valueCount;let i=r.valueOffset,l=[];const s=Lt[f],c=8*s,d=n*s,C=n*Lt[f]*8;let g,b;const S=a===8?64:32,h=r.valueOffsets;if(C>S&&d>(u?e.byteLength:e?e.byteLength-i+o:0))return r.offlineOffsetSize=[i,d],r.values=null,!1;if(C<=S){if(!t)if(S<=32)i>>>=32-C;else{const p=h!=null&&h.length?h[0]:i>>>0,m=h!=null&&h.length?h[1]:Math.round((i-p)/Ee);C<=32?(i=p>>>32-C,h[0]=i):(i=p*2**(32-C)+(m>>>32-C),h[0]=p,h[1]=m>>>32-C)}if(n===1&&c===S)l=[i];else if(S===64){const p=h!=null&&h.length?h[0]:i>>>0,m=h!=null&&h.length?h[1]:Math.round((i-p)/Ee);let y=p,w=32;for(b=1;b<=n;b++){const k=32-c*b%32;if(w<c){const v=y<<k>>>32-w,I=m<<32-w>>>32-w;y=m,l.push(v+I*2**(c-w)),w-=32-(c-w)}else l.push(y<<k>>>32-c),w-=c;w===0&&(w=32,y=m)}}else for(b=1;b<=n;b++){const p=32-c*b;l.push(i<<p>>>32-c)}}else{i-=o,u&&(i=0);for(let p=i;p<i+d;p+=s){switch(f){case 1:case 2:case 7:g=new DataView(e,p,1).getUint8(0);break;case 3:g=new DataView(e,p,2).getUint16(0,t);break;case 4:case 13:g=new DataView(e,p,4).getUint32(0,t);break;case 5:g=new DataView(e,p,4).getUint32(0,t)/new DataView(e,p+4,4).getUint32(0,t);break;case 6:g=new DataView(e,p,1).getInt8(0);break;case 8:g=new DataView(e,p,2).getInt16(0,t);break;case 9:g=new DataView(e,p,4).getInt32(0,t);break;case 10:g=new DataView(e,p,4).getInt32(0,t)/new DataView(e,p+4,4).getInt32(0,t);break;case 11:g=new DataView(e,p,4).getFloat32(0,t);break;case 12:g=new DataView(e,p,8).getFloat64(0,t);break;case 16:case 18:g=yt(new DataView(e,p,8),0,t);break;case 17:g=jr(new DataView(e,p,8),0,t);break;default:g=null}l.push(g)}}if(f===2){let p="";const m=l;for(l=[],b=0;b<m.length;b++)m[b]===0&&p!==""?(l.push(p),p=""):p+=String.fromCharCode(m[b]);p===""&&l.length!==0||l.push(p)}return r.values=l,!0}function gt(e){const t=e[0],r=V(t,"TILEWIDTH"),o=V(t,"TILELENGTH"),u=V(t,"IMAGEWIDTH"),a=V(t,"IMAGELENGTH"),f=V(t,"BITSPERSAMPLE"),n=V(t,"SAMPLESPERPIXEL"),i=V(t,"SAMPLEFORMAT")??1,l=mt(i,f),s=We(t),c=Yt(t,"GDAL_NODATA");let d=null;c!=null&&c.length&&(d=c.map(G=>parseFloat(G)),d.some(G=>isNaN(G))&&(d=null));const C=V(t,"COMPRESSION")??1;let g;switch(C){case 1:g="NONE";break;case 2:case 3:case 4:case 32771:g="CCITT";break;case 5:g="LZW";break;case 6:case 7:g="JPEG";break;case 32773:g="PACKBITS";break;case 8:case 32946:g="DEFLATE";break;case 34712:g="JPEG2000";break;case 34887:g="LERC";break;default:g=String(C)}let b=!0,S="";Dr.has(C)||(b=!1,S+="unsupported tag compression "+C),i>3&&(b=!1,S+="unsupported tag sampleFormat "+i),f!==1&&f!==2&&f!==4&&f%8!=0&&(b=!1,S+="unsupported tag bitsPerSample "+f);const h=Ot(t,"GEOASCIIPARAMS");let p;if(h){const G=h.split("|").find(W=>W.includes("ESRI PE String = ")),M=G?G.replace("ESRI PE String = ",""):"";p=M.startsWith("COMPD_CS")||M.startsWith("PROJCS")||M.startsWith("GEOGCS")?{wkid:null,wkt:M}:null}const m=ve(t,"GEOTIEPOINTS"),y=ve(t,"GEOPIXELSCALE"),w=ve(t,"GEOTRANSMATRIX"),k=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let v,I,T=!1,A=!1;if(k){T=V(k,"GTRasterTypeGeoKey")===2;const G=V(k,"GTModelTypeGeoKey");if(G===2){const M=V(k,"GeographicTypeGeoKey");M>=1024&&M<=32766&&(p={wkid:M}),p||M!==32767||(A=!0,p={wkid:4326})}else if(G===1){const M=V(k,"ProjectedCSTypeGeoKey");M>=1024&&M<=32766&&(p={wkid:M})}}if(y&&m&&m.length>=6?(v=[y[0],0,m[3]-m[0]*y[0],0,-Math.abs(y[1]),m[4]-m[1]*y[1]],T&&(v[2]-=.5*v[0]+.5*v[1],v[5]-=.5*v[3]+.5*v[4])):w&&w.length===16&&(v=T?[w[0],w[1],w[3]-.5*w[0],w[4],w[5],w[7]-.5*w[5]]:[w[0],w[1],w[3],w[4],w[5],w[7]]),v){const G=[{x:0,y:a},{x:0,y:0},{x:u,y:a},{x:u,y:0}];let M,W=Number.POSITIVE_INFINITY,$=Number.POSITIVE_INFINITY,F=Number.NEGATIVE_INFINITY,j=Number.NEGATIVE_INFINITY;for(let q=0;q<G.length;q++)M=Ur(G[q],v),W=M.x>W?W:M.x,F=M.x<F?F:M.x,$=M.y>$?$:M.y,j=M.y<j?j:M.y;I={xmin:W,xmax:F,ymin:$,ymax:j,spatialReference:p}}else I={xmin:-.5,ymin:.5-a,xmax:u-.5,ymax:.5,spatialReference:p};A&&(I.xmax-I.xmin>400||Math.max(Math.abs(I.xmin),Math.abs(I.xmax))>361)&&(p=null,I.spatialReference=null);const x=Xt(e);let E,P,O,L,B;if(x.length>0){O=Math.round(Math.log(u/V(x[0],"IMAGEWIDTH"))/Math.LN2);const G=x[x.length-1];L=Math.round(Math.log(u/V(G,"IMAGEWIDTH"))/Math.LN2),E=V(G,"TILEWIDTH"),P=V(G,"TILELENGTH")}E=L!=null&&L>0?E||r:null,P=L!=null&&L>0?P||o:null,r&&(B=[{maxCol:Math.ceil(u/r)-1,maxRow:Math.ceil(a/o)-1,minRow:0,minCol:0}],x.forEach(G=>{B.push({maxCol:Math.ceil(V(G,"IMAGEWIDTH")/V(G,"TILEWIDTH"))-1,maxRow:Math.ceil(V(G,"IMAGELENGTH")/V(G,"TILELENGTH"))-1,minRow:0,minCol:0})}));const R=Ot(e[0],"GDAL_METADATA"),_=$r(R);return S+=" "+Qt({width:u,height:a,tileWidth:r,tileHeight:o,planes:n,ifds:e}),{width:u,height:a,tileWidth:r,tileHeight:o,planes:n,isBSQ:s,pixelType:l,compression:g,noData:d,hasMaskBand:Zt(e).length===x.length+1,isSupported:b,message:S,extent:I,isPseudoGeographic:A,affine:y?null:v,firstPyramidLevel:O,maximumPyramidLevel:L,pyramidBlockWidth:E,pyramidBlockHeight:P,tileBoundary:B,metadata:_}}function We(e,t){const r=Yt(e,"PLANARCONFIGURATION");return r?r[0]===2:!!t&&t.isBSQ}function Xt(e){return e.filter(t=>V(t,"NEWSUBFILETYPE")===1)}function Zt(e){return e.filter(t=>{const r=(4&(V(t,"NEWSUBFILETYPE")??0))==4,o=V(t,"PHOTOMETRICINTERPRETATION")===4;return r&&o})}function _r(e){const{littleEndian:t,isBigTiff:r,firstIFDPos:o}=zr(e);let u=o;const a=[];do{const f=Wr(e,t,u,0,Ae.tiffTags,r?8:4);if(!f.success)break;a.push(f.ifd),u=f.nextIFD}while(u>0);return{...gt(a),littleEndian:t,isBigTiff:r,ifds:a,pyramidIFDs:Xt(a),maskIFDs:Zt(a)}}function yt(e,t,r){const o=e.getUint32(t,r),u=e.getUint32(t+4,r);return r?u*Ee+o:o*Ee+u}function jr(e,t,r){let o=r?e.getInt32(t,r):e.getUint32(t,r),u=r?e.getUint32(t+4,r):e.getInt32(t+4,r);const a=(r?o:u)>=0?1:-1;return r?o*=a:u*=a,a*(r?u*Ee+o:o*Ee+u)}function Ve(e,t,r,o){return o?yt(e,t,r):e.getUint32(t,r)}function zr(e){const t=new DataView(e,0,16),r=t.getUint16(0,!1);let o=null;if(r===18761)o=!0;else{if(r!==19789)throw new Error("unexpected endianess byte");o=!1}const u=t.getUint16(2,o);if(u!==42&&u!==43)throw new Error("unexpected tiff identifier");let a=4;const f=u===43;if(f){const n=t.getUint16(a,o);if(a+=2,n!==8)throw new Error("unsupported bigtiff version");if(t.getUint16(a,o)!==0)throw new Error("unsupported bigtiff version");a+=2}return{littleEndian:o,isBigTiff:f,firstIFDPos:Ve(t,a,o,f)}}function Wr(e,t,r,o=0,u=Ae.tiffTags,a=4){const f=Xe(e,t,r,o,u,a);let n;const i=f.ifd;if(i){if(Ae.ifdTags.forEach((l,s)=>{i.has(s)&&(n=i.get(s),n.data=Xe(e,t,n.valueOffset-o,o,l).ifd)}),i.has("GEOKEYDIRECTORY")){n=i.get("GEOKEYDIRECTORY");const l=n.values;if(l&&l.length>4){const s=l[0]+"."+l[1]+"."+l[2];n.data=Xe(e,t,n.valueOffset+6-o,o,Ae.geoKeys,2).ifd,n.data&&n.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[s]})}}if(i.has("XMP")){n=i.get("XMP");const l=n.values;typeof l[0]=="number"&&n.type===7&&(n.values=[Pr(new Uint8Array(l))])}}return f}function Qt(e){const{width:t,height:r,tileHeight:o,tileWidth:u}=e,a=e.planes,f=u?u*o:t*r,n=V(e.ifds[0],"BITSPERSAMPLE");let i="";return f*a>2**30/(n>8?n/8:1)&&(i=u?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),i}function Hr(e,t,r,o,u){const a=o?4:1,f=r*a*u;o&&(e=new Uint8Array(e.buffer));for(let l=0;l<t;l++){const s=l*f;for(let c=u;c<f;c++)e[s+c]+=e[s+c-u]}if(!o)return e;const n=new Uint8Array(e.length),i=r*u;for(let l=0;l<t;l++){const s=l*f;for(let c=0;c<i;c++)for(let d=0;d<a;d++)n[s+c*a+d]=e[s+c+(a-d-1)*i]}return new Float32Array(n.buffer)}async function Kr(e,t){const{headerInfo:r,ifd:o,offsets:u,sizes:a}=t,f=[];for(let T=0;T<u.length;T++){a[T];const A=await at(e,r.littleEndian,o,u[T],a[T]||e.byteLength);f.push(A)}const n=We(o,r),i=V(o,"BITSPERSAMPLE"),l=mt(V(o,"SAMPLEFORMAT")??1,i),s=V(o,"SAMPLESPERPIXEL")||r.planes,c=ze(l),d=V(o,"TILEWIDTH"),C=V(o,"TILELENGTH"),g=V(o,"COMPRESSION")??1,b=d*C;let S;const h=[];let p=f[0];const m=g===34887;for(let T=0;T<s;T++){if(S=new c(b),f.length===s)p=f[T],p.length===b&&(S=p);else if(p.length)if(n||m)S=p.length===b?p:p.slice(b*T,b*(T+1));else for(let A=0;A<b;A++)S[A]=p[A*s+T];h.push(S)}const y=r.noData?r.noData[0]:t.noDataValue,w=r.metadata?r.metadata.statistics:null,k=w?w.map(T=>T.min):null,v=w?w.map(T=>T.max):null,I={pixelType:l,width:d,height:C,pixels:h,noDataValue:y};return y!=null?ht(I,y):k&&v&&t.applyMinMaxConstraint&&(I.mask=Fr(h,k,v)),I}async function Jr(e,t={}){const r=t.pyramidLevel||0,o=t.headerInfo||_r(e),{ifds:u,noData:a}=o;if(u.length===0)throw new Error("no valid image file directory");const f=Qt(o);if(f)throw f;let n=null;const i=r===-1?u[u.length-1]:u[r],l=a??t.noDataValue;return n=o.tileWidth?await Nr(e,o,i):Br(e,o,i),n&&(l!=null&&ht(n,l),n)}var qr=function(e){var t,r,o,u,a,f;function n(i){var l,s,c,d,C,g,b,S,h,p,m,y,w;for(this.data=i,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},C=null;;){switch(l=this.readUInt32(),S=(function(){var k,v;for(v=[],k=0;k<4;++k)v.push(String.fromCharCode(this.data[this.pos++]));return v}).call(this).join(""),S){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(l);break;case"fcTL":C&&this.animation.frames.push(C),this.pos+=4,C={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},d=this.readUInt16(),c=this.readUInt16()||100,C.delay=1e3*d/c,C.disposeOp=this.data[this.pos++],C.blendOp=this.data[this.pos++],C.data=[];break;case"IDAT":case"fdAT":for(S==="fdAT"&&(this.pos+=4,l-=4),i=(C!=null?C.data:void 0)||this.imgData,m=0;0<=l?m<l:m>l;0<=l?++m:--m)i.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(l),(h=255-this.transparency.indexed.length)>0)for(y=0;0<=h?y<h:y>h;0<=h?++y:--y)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(l)[0];break;case 2:this.transparency.rgb=this.read(l)}break;case"tEXt":g=(p=this.read(l)).indexOf(0),b=String.fromCharCode.apply(String,p.slice(0,g)),this.text[b]=String.fromCharCode.apply(String,p.slice(g+1));break;case"IEND":return C&&this.animation.frames.push(C),this.colors=(function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}).call(this),this.hasAlphaChannel=(w=this.colorType)===4||w===6,s=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*s,this.colorSpace=(function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}).call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=l}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return n.load=function(i,l,s){var c;return typeof l=="function"&&(s=l),(c=new XMLHttpRequest).open("GET",i,!0),c.responseType="arraybuffer",c.onload=function(){var d;return d=new n(new Uint8Array(c.response||c.mozResponseArrayBuffer)),typeof(l!=null?l.getContext:void 0)=="function"&&d.render(l),typeof s=="function"?s(d):void 0},c.send(null)},r=1,o=2,t=0,n.prototype.read=function(i){var l,s;for(s=[],l=0;0<=i?l<i:l>i;0<=i?++l:--l)s.push(this.data[this.pos++]);return s},n.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.decodePixels=function(i){var l,s,c,d,C,g,b,S,h,p,m,y,w,k,v,I,T,A,x,E,P,O,L;if(i==null&&(i=this.imgData),i.length===0)return new Uint8Array(0);for(i=(i=new Ue(i)).getBytes(),I=(y=this.pixelBitlength/8)*this.width,w=new Uint8Array(I*this.height),g=i.length,v=0,k=0,s=0;k<g;){switch(i[k++]){case 0:for(d=x=0;x<I;d=x+=1)w[s++]=i[k++];break;case 1:for(d=E=0;E<I;d=E+=1)l=i[k++],C=d<y?0:w[s-y],w[s++]=(l+C)%256;break;case 2:for(d=P=0;P<I;d=P+=1)l=i[k++],c=(d-d%y)/y,T=v&&w[(v-1)*I+c*y+d%y],w[s++]=(T+l)%256;break;case 3:for(d=O=0;O<I;d=O+=1)l=i[k++],c=(d-d%y)/y,C=d<y?0:w[s-y],T=v&&w[(v-1)*I+c*y+d%y],w[s++]=(l+Math.floor((C+T)/2))%256;break;case 4:for(d=L=0;L<I;d=L+=1)l=i[k++],c=(d-d%y)/y,C=d<y?0:w[s-y],v===0?T=A=0:(T=w[(v-1)*I+c*y+d%y],A=c&&w[(v-1)*I+(c-1)*y+d%y]),b=C+T-A,S=Math.abs(b-C),p=Math.abs(b-T),m=Math.abs(b-A),h=S<=p&&S<=m?C:p<=m?T:A,w[s++]=(l+h)%256;break;default:throw new Error("Invalid filter algorithm: "+i[k-1])}v++}return w},n.prototype.decodePalette=function(){var i,l,s,c,d,C,g,b,S;for(s=this.palette,C=this.transparency.indexed||[],d=new Uint8Array((C.length||0)+s.length),c=0,s.length,i=0,l=g=0,b=s.length;g<b;l=g+=3)d[c++]=s[l],d[c++]=s[l+1],d[c++]=s[l+2],d[c++]=(S=C[i++])!=null?S:255;return d},n.prototype.copyToImageData=function(i,l){var s,c,d,C,g,b,S,h,p,m,y;if(c=this.colors,p=null,s=this.hasAlphaChannel,this.palette.length&&(p=(y=this._decodedPalette)!=null?y:this._decodedPalette=this.decodePalette(),c=4,s=!0),h=(d=i.data||i).length,g=p||l,C=b=0,c===1)for(;C<h;)S=p?4*l[C/4]:b,m=g[S++],d[C++]=m,d[C++]=m,d[C++]=m,d[C++]=s?g[S++]:this.transparency.grayscale&&this.transparency.grayscale===m?0:255,b=S;else for(;C<h;)S=p?4*l[C/4]:b,d[C++]=g[S++],d[C++]=g[S++],d[C++]=g[S++],d[C++]=s?g[S++]:this.transparency.rgb&&this.transparency.rgb[1]===g[S-3]&&this.transparency.rgb[3]===g[S-2]&&this.transparency.rgb[5]===g[S-1]?0:255,b=S},n.prototype.decode=function(){var i;return i=new Uint8Array(this.width*this.height*4),this.copyToImageData(i,this.decodePixels()),i},a=e.document&&e.document.createElement("canvas"),f=a&&a.getContext("2d"),u=function(i){var l;return f.width=i.width,f.height=i.height,f.clearRect(0,0,i.width,i.height),f.putImageData(i,0,0),(l=new Image).src=a.toDataURL(),l},n.prototype.decodeFrames=function(i){var l,s,c,d,C,g,b,S;if(this.animation){for(S=[],s=C=0,g=(b=this.animation.frames).length;C<g;s=++C)l=b[s],c=i.createImageData(l.width,l.height),d=this.decodePixels(new Uint8Array(l.data)),this.copyToImageData(c,d),l.imageData=c,S.push(l.image=u(c));return S}},n.prototype.renderFrame=function(i,l){var s,c,d;return s=(c=this.animation.frames)[l],d=c[l-1],l===0&&i.clearRect(0,0,this.width,this.height),(d!=null?d.disposeOp:void 0)===r?i.clearRect(d.xOffset,d.yOffset,d.width,d.height):(d!=null?d.disposeOp:void 0)===o&&i.putImageData(d.imageData,d.xOffset,d.yOffset),s.blendOp===t&&i.clearRect(s.xOffset,s.yOffset,s.width,s.height),i.drawImage(s.image,s.xOffset,s.yOffset)},n.prototype.animate=function(i){var l,s,c,d,C,g,b=this;return s=0,g=this.animation,d=g.numFrames,c=g.frames,C=g.numPlays,(l=function(){var S,h;if(S=s++%d,h=c[S],b.renderFrame(i,S),d>1&&s/d<C)return b.animation._timeout=setTimeout(l,h.delay)})()},n.prototype.stopAnimation=function(){var i;return clearTimeout((i=this.animation)!=null?i._timeout:void 0)},n.prototype.render=function(i){var l,s;return i._png&&i._png.stopAnimation(),i._png=this,i.width=this.width,i.height=this.height,l=i.getContext("2d"),this.animation?(this.decodeFrames(l),this.animate(l)):(s=l.createImageData(this.width,this.height),this.copyToImageData(s,this.decodePixels()),l.putImageData(s,0,0))},n}(self);const Yr=new Set(["jpg","png","bmp","gif"]);async function Xr(e,t){if(!pt)throw new pe("rasterCoded:decode","lerc decoder is not supported on big endian platform");await Kt();const{offset:r}=t,{width:o,height:u,pixelType:a,statistics:f,depthCount:n,noDataValues:i,bandMasks:l,pixels:s,mask:c}=Jt(e,{inputOffset:r,returnInterleaved:t.returnInterleaved}),d=new te({width:o,height:u,pixelType:a.toLowerCase(),pixels:s,mask:c,statistics:f,bandMasks:l,depthCount:n,noDataValues:i});return f!=null&&f.length||d.updateStatistics(),d}async function Zr(e,t){const r=await Jr(e,{...t,noDataValue:null});$e(r);const o=new te({width:r.width,height:r.height,pixels:r.pixels,pixelType:r.pixelType.toLowerCase(),mask:r.mask,bandMasks:r.bandMasks,statistics:null});return o.updateStatistics(),o}async function Qr(e,t){const r=await Kr(e,t.customOptions),o=new te({width:r.width,height:r.height,pixels:r.pixels,pixelType:r.pixelType.toLowerCase(),mask:r.mask,statistics:null});return o.updateStatistics(),o}function er(e,t){const r=t.pixelType||"u8",o=te.getPixelArrayConstructor(r),u=r==="u8"?e:new o(e.buffer),a=[],f=t.planes||1;if(f===1)a.push(u);else for(let i=0;i<f;i++){const l=(t.width||1)*(t.height||e.length),s=new o(l);for(let c=0;c<l;c++)s[c]=u[c*f+i];a.push(s)}const n=new te({width:t.width||1,height:t.height||e.length,pixels:a,pixelType:r,statistics:null});return n.updateStatistics(),n}function eo(e,t){return er(new Ue(new Uint8Array(e)).getBytes(),t)}function to(e,t){return er(ft(e,t.offset,t.eof,!t.isInputBigEndian),t)}function ro(e,t,r){const{pixelTypeCtor:o}=so(t.pixelType),u=(0,Er.decode)(e,{width:t.width,height:t.height,pixelType:o,format:r}),a=new te({width:t.width,height:t.height,pixels:u.pixels,pixelType:t.pixelType,mask:u.mask,statistics:null});return a.updateStatistics(),a}function oo(e,t){const r=Sr.decode(e,t.hasNoZlibMask??void 0),o=new te({width:r.width,height:r.height,pixels:r.pixels,pixelType:"U8",mask:r.mask,statistics:null});return o.updateStatistics(),o}function no(e,t){const r=new Uint8Array(e),o=new qr(r),{width:u,height:a}=t,f=u*a,n=o.decode();let i,l=0,s=0;const c=new Uint8Array(f);for(l=0;l<f;l++)c[l]=n[4*l+3];const d=new te({width:u,height:a,pixels:[],pixelType:"U8",mask:c,statistics:[]});for(l=0;l<3;l++){for(i=new Uint8Array(f),s=0;s<f;s++)i[s]=n[4*s+l];d.addData({pixels:i})}return d.updateStatistics(),d}async function io(e,t,r,o){const u=new vr,a={applyJpegMask:!1,format:t,...r},f=await u.decode(e,a,o),n=new te(f);return n.updateStatistics(),n}function tr(e){if(e==null)throw new pe("rasterCodec:decode","parameter encodeddata is required.");const t=new Uint8Array(e,0,10);let r="";return t[0]===255&&t[1]===216?r="jpg":t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71?r="png":t[0]===67&&t[1]===110&&t[2]===116&&t[3]===90&&t[4]===73&&t[5]===109&&t[6]===97&&t[7]===103&&t[8]===101&&t[9]===32?r="lerc":t[0]===76&&t[1]===101&&t[2]===114&&t[3]===99&&t[4]===50&&t[5]===32?r="lerc2":t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42||t[0]===73&&t[1]===73&&t[2]===43&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===43?r="tiff":t[0]===71&&t[1]===73&&t[2]===70?r="gif":t[0]===66&&t[1]===77?r="bmp":String.fromCharCode.apply(null,t).toLowerCase().includes("error")&&(r="error"),r}function ao(e){let t=null;switch(e){case"lerc":case"lerc2":t=Xr;break;case"jpg":t=oo;break;case"png":t=no;break;case"bsq":case"bip":t=(r,o)=>ro(r,o,e);break;case"tiff":t=Zr;break;case"deflate":t=eo;break;case"lzw":t=to;break;case"error":t=()=>{throw new pe("rasterCodec:decode","input data contains error")};break;default:t=()=>{throw new pe("rasterCodec:decode","unsupported raster format")}}return t}function so(e){let t=null,r=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":r=255,t=Uint8Array;break;case"u16":r=r||65535,t=Uint16Array;break;case"u32":r=r||2**32-1,t=Uint32Array;break;case"s8":r=r||-128,t=Int8Array;break;case"s16":r=r||-32768,t=Int16Array;break;case"s32":r=r||0-2**31,t=Int32Array;break;default:t=Float32Array}return{pixelTypeCtor:t,noDataValue:r}}function lo(e,t=1){if(!e)return;const{pixels:r,width:o,height:u,mask:a}=e;if(!r||r.length===0)return;const f=r.length,n=o-1,i=u-1,l=[];let s,c,d,C,g,b,S=null;const h=te.getPixelArrayConstructor(e.pixelType);if(t===0){for(s=0;s<f;s++){for(g=r[s],b=new h(n*i),c=0;c<i;c++)for(C=c*o,d=0;d<n;d++)b[c*n+d]=g[C+d];l.push(b)}if(a!=null)for(S=new Uint8Array(n*i),c=0;c<i;c++)for(C=c*o,d=0;d<n;d++)S[c*n+d]=a[C+d]}else{for(s=0;s<f;s++){for(g=r[s],b=new h(n*i),c=0;c<i;c++)for(C=c*o,d=0;d<n;d++)b[c*n+d]=(g[C+d]+g[C+d+1]+g[C+o+d]+g[C+o+d+1])/4;l.push(b)}if(a)for(S=new Uint8Array(n*i),c=0;c<i;c++)for(C=c*o,d=0;d<n;d++)S[c*n+d]=Math.min.apply(null,[a[C+d],a[C+d+1],a[C+o+d],a[C+o+d+1]])}e.width=n,e.height=i,e.mask=S,e.pixels=l}function Vo(e){let t=tr(e);return t==="lerc2"?t="lerc":t==="error"&&(t=""),t}async function _o(e,t={},r){var f;if(e==null)throw new pe("rasterCodec:decode","missing encodeddata parameter.");let o=(f=t.format)==null?void 0:f.toLowerCase();if(!(o!=="bsq"&&o!=="bip"||t.width!=null&&t.height!=null))throw new pe("rasterCodec:decode","requires width and height in options parameter.");if(o==="tiff"&&t.customOptions)return Qr(e,t);if((!o||o!=="bsq"&&o!=="bip"&&o!=="deflate"&&o!=="lzw")&&(o=tr(e)),t.useCanvas&&Yr.has(o))return io(e,o,t,r);const u=ao(o);t.isPoint&&((t={...t}).width!=null&&t.width++,t.height!=null&&t.height++);const a=await u(e,t);return a&&(o!=="jpg"&&t.noDataValue!=null&&a.depthCount===1&&ht(a,t.noDataValue,{customFloatTolerance:t.tolerance}),t.isPoint&&lo(a),a)}var st;function be(e){return e=Number(e),isNaN(e)?void 0:e}let ue=st=class extends De{constructor(){super(...arguments),this.name=null,this.minWavelength=void 0,this.maxWavelength=void 0,this.radianceBias=void 0,this.radianceGain=void 0,this.reflectanceBias=void 0,this.reflectanceGain=void 0,this.solarIrradiance=void 0}clone(){return new st({name:this.name,minWavelength:this.minWavelength,maxWavelength:this.maxWavelength,radianceBias:this.radianceBias,radianceGain:this.radianceGain,reflectanceBias:this.reflectanceBias,reflectanceGain:this.reflectanceGain,solarIrradiance:this.solarIrradiance})}};D([N({json:{name:"BandName",write:!0}})],ue.prototype,"name",void 0),D([N({json:{name:"WavelengthMin",read:{reader:be},write:!0}})],ue.prototype,"minWavelength",void 0),D([N({json:{name:"WavelengthMax",read:{reader:be},write:!0}})],ue.prototype,"maxWavelength",void 0),D([N({json:{name:"RadianceBias",read:{reader:be},write:!0}})],ue.prototype,"radianceBias",void 0),D([N({json:{name:"RadianceGain",read:{reader:be},write:!0}})],ue.prototype,"radianceGain",void 0),D([N({json:{name:"ReflectanceBias",read:{reader:be},write:!0}})],ue.prototype,"reflectanceBias",void 0),D([N({json:{name:"ReflectanceGain",read:{reader:be},write:!0}})],ue.prototype,"reflectanceGain",void 0),D([N({json:{name:"SolarIrradiance",read:{reader:be},write:!0}})],ue.prototype,"solarIrradiance",void 0),ue=st=D([Oe("esri.layers.support.RasterBandInfo")],ue);const Dt=ue;var lt;function Me(e){return e=Number(e),isNaN(e)?void 0:e}let ae=lt=class extends De{constructor(){super(...arguments),this.acquisitionDate=void 0,this.cloudCover=void 0,this.productName=void 0,this.sensorName=null,this.sensorAzimuth=void 0,this.sensorElevation=void 0,this.sunAzimuth=void 0,this.sunElevation=void 0}readAcquisitionDate(e){return new Date(e)}writeAcquisitionDate(e,t){t.AcquisitionDate=e.getTime()}clone(){return new lt({acquisitionDate:this.acquisitionDate,cloudCover:this.cloudCover,productName:this.productName,sensorName:this.sensorName,sensorAzimuth:this.sensorAzimuth,sensorElevation:this.sensorElevation,sunAzimuth:this.sunAzimuth,sunElevation:this.sunElevation})}};D([N({json:{name:"AcquisitionDate",write:!0}})],ae.prototype,"acquisitionDate",void 0),D([dr("acquisitionDate")],ae.prototype,"readAcquisitionDate",null),D([pr("acquisitionDate")],ae.prototype,"writeAcquisitionDate",null),D([N({json:{name:"CloudCover",read:{reader:Me},write:!0}})],ae.prototype,"cloudCover",void 0),D([N({json:{name:"ProductName",write:!0}})],ae.prototype,"productName",void 0),D([N({json:{name:"SensorName",write:!0}})],ae.prototype,"sensorName",void 0),D([N({json:{name:"SensorAzimuth",read:{reader:Me},write:!0}})],ae.prototype,"sensorAzimuth",void 0),D([N({json:{name:"SensorElevation",read:{reader:Me},write:!0}})],ae.prototype,"sensorElevation",void 0),D([N({json:{name:"SunAzimuth",read:{reader:Me},write:!0}})],ae.prototype,"sunAzimuth",void 0),D([N({json:{name:"SunElevation",read:{reader:Me},write:!0}})],ae.prototype,"sunElevation",void 0),ae=lt=D([Oe("esri.layers.support.RasterSensorInfo")],ae);const uo=ae;var ut;let Z=ut=class extends De{constructor(){super(...arguments),this.blockWidth=void 0,this.blockHeight=void 0,this.compression=null,this.origin=null,this.firstPyramidLevel=null,this.maximumPyramidLevel=null,this.pyramidScalingFactor=2,this.pyramidBlockWidth=null,this.pyramidBlockHeight=null,this.isVirtualTileInfo=!1,this.tileInfo=null,this.transposeInfo=null,this.blockBoundary=null}clone(){return new ut({blockWidth:this.blockWidth,blockHeight:this.blockHeight,compression:this.compression,origin:Q(this.origin),firstPyramidLevel:this.firstPyramidLevel,maximumPyramidLevel:this.maximumPyramidLevel,pyramidResolutions:Q(this.pyramidResolutions),pyramidScalingFactor:this.pyramidScalingFactor,pyramidBlockWidth:this.pyramidBlockWidth,pyramidBlockHeight:this.pyramidBlockHeight,isVirtualTileInfo:this.isVirtualTileInfo,tileInfo:Q(this.tileInfo),transposeInfo:Q(this.transposeInfo),blockBoundary:Q(this.blockBoundary)})}};D([N({type:Number,json:{write:!0}})],Z.prototype,"blockWidth",void 0),D([N({type:Number,json:{write:!0}})],Z.prototype,"blockHeight",void 0),D([N({type:String,json:{write:!0}})],Z.prototype,"compression",void 0),D([N({type:mr,json:{write:!0}})],Z.prototype,"origin",void 0),D([N({type:Number,json:{write:!0}})],Z.prototype,"firstPyramidLevel",void 0),D([N({type:Number,json:{write:!0}})],Z.prototype,"maximumPyramidLevel",void 0),D([N({json:{write:!0}})],Z.prototype,"pyramidResolutions",void 0),D([N({type:Number,json:{write:!0}})],Z.prototype,"pyramidScalingFactor",void 0),D([N({type:Number,json:{write:!0}})],Z.prototype,"pyramidBlockWidth",void 0),D([N({type:Number,json:{write:!0}})],Z.prototype,"pyramidBlockHeight",void 0),D([N({type:Boolean,json:{write:!0}})],Z.prototype,"isVirtualTileInfo",void 0),D([N({json:{write:!0}})],Z.prototype,"tileInfo",void 0),D([N()],Z.prototype,"transposeInfo",void 0),D([N()],Z.prototype,"blockBoundary",void 0),Z=ut=D([Oe("esri.layers.support.RasterStorageInfo")],Z);const co=Z;var ct;let K=ct=class extends De{constructor(e){super(e),this.attributeTable=null,this.bandCount=null,this.colormap=null,this.extent=null,this.format=void 0,this.height=null,this.width=null,this.histograms=null,this.keyProperties={},this.multidimensionalInfo=null,this.noDataValue=null,this.pixelSize=null,this.pixelType=null,this.isPseudoSpatialReference=!1,this.spatialReference=null,this.statistics=null,this.storageInfo=null,this.transform=null}get bandInfos(){const e=this.keyProperties.BandProperties,{bandCount:t}=this;if(!(e!=null&&e.length)||e.length<t){const o=[];for(let u=1;u<=t;u++)o.push(new Dt({name:"band_"+u}));return o}const r=e.map(o=>Dt.fromJSON(o));for(let o=0;o<r.length;o++)r[o].name=r[o].name||"band_"+(o+1);return r}get dataType(){var t,r;const e=((r=(t=this.keyProperties)==null?void 0:t.DataType)==null?void 0:r.toLowerCase())??"generic";return e==="stdtime"?"standard-time":e}get nativeExtent(){return this._get("nativeExtent")||this.extent}set nativeExtent(e){e&&this._set("nativeExtent",e)}get nativePixelSize(){if(this.transform==null||!this.transform.affectsPixelSize)return this.pixelSize;const e=this.nativeExtent;return{x:e.width/this.width,y:e.height/this.height}}get hasMultidimensionalTranspose(){var e;return!!((e=this.storageInfo)!=null&&e.transposeInfo)}get sensorInfo(){var e;if((e=this.keyProperties)!=null&&e.SensorName)return uo.fromJSON(this.keyProperties)}clone(){return new ct({attributeTable:Q(this.attributeTable),bandCount:this.bandCount,colormap:Q(this.colormap),extent:Q(this.extent),nativePixelSize:Q(this.nativePixelSize),format:this.format,height:this.height,width:this.width,histograms:Q(this.histograms),keyProperties:Q(this.keyProperties),multidimensionalInfo:Q(this.multidimensionalInfo),noDataValue:this.noDataValue,pixelSize:Q(this.pixelSize),pixelType:this.pixelType,isPseudoSpatialReference:this.isPseudoSpatialReference,spatialReference:Q(this.spatialReference),statistics:Q(this.statistics),storageInfo:Q(this.storageInfo),transform:Q(this.transform)})}};D([N({json:{write:!0}})],K.prototype,"attributeTable",void 0),D([N({json:{write:!0}})],K.prototype,"bandCount",void 0),D([N({readOnly:!0})],K.prototype,"bandInfos",null),D([N({json:{write:!0}})],K.prototype,"colormap",void 0),D([N({type:String,readOnly:!0})],K.prototype,"dataType",null),D([N({type:Ct,json:{write:!0}})],K.prototype,"extent",void 0),D([N({type:Ct,json:{write:!0}})],K.prototype,"nativeExtent",null),D([N({json:{write:!0}})],K.prototype,"nativePixelSize",null),D([N({json:{write:!0}})],K.prototype,"format",void 0),D([N({json:{write:!0}})],K.prototype,"height",void 0),D([N({json:{write:!0}})],K.prototype,"width",void 0),D([N({json:{write:!0}})],K.prototype,"hasMultidimensionalTranspose",null),D([N({json:{write:!0}})],K.prototype,"histograms",void 0),D([N({json:{write:!0}})],K.prototype,"keyProperties",void 0),D([N({json:{write:!0}})],K.prototype,"multidimensionalInfo",void 0),D([N({json:{write:!0}})],K.prototype,"noDataValue",void 0),D([N({json:{write:!0}})],K.prototype,"pixelSize",void 0),D([N({json:{write:!0}})],K.prototype,"pixelType",void 0),D([N()],K.prototype,"isPseudoSpatialReference",void 0),D([N({readOnly:!0})],K.prototype,"sensorInfo",null),D([N({type:gr,json:{write:!0}})],K.prototype,"spatialReference",void 0),D([N({json:{write:!0}})],K.prototype,"statistics",void 0),D([N({type:co,json:{write:!0}})],K.prototype,"storageInfo",void 0),D([N({json:{write:!0}})],K.prototype,"transform",void 0),K=ct=D([Oe("esri.layers.support.RasterInfo")],K);const ho=K,ee=1,xe=1/111e3;function rr(e){let{altitude:t,azimuth:r}=e;const{hillshadeType:o,pixelSizePower:u=1,pixelSizeFactor:a=1,scalingType:f,isGCS:n,resolution:i}=e,l=o==="multi-directional"?2*e.zFactor:e.zFactor,{x:s,y:c}=i;let d=l/(8*s),C=l/(8*c);if(n&&l>.001&&(d/=xe,C/=xe),f==="adjusted")if(n){const E=s*xe,P=c*xe;d=(l+E**u*a)/(8*E),C=(l+P**u*a)/(8*P)}else d=(l+s**u*a)/(8*s),C=(l+c**u*a)/(8*c);let g=(90-t)*Math.PI/180,b=Math.cos(g),S=(360-r+90)*Math.PI/180,h=Math.sin(g)*Math.cos(S),p=Math.sin(g)*Math.sin(S);const m=[315,270,225,360,180,0],y=[60,60,60,60,60,90],w=new Float32Array([3,5,3,2,1,4]),k=w.reduce((E,P)=>E+P),v=w.map(E=>E/k),I=o==="multi-directional"?m.length:1,T=new Float32Array(6),A=new Float32Array(6),x=new Float32Array(6);if(o==="multi-directional")for(let E=0;E<I;E++)t=y[E],r=m[E],g=(90-t)*Math.PI/180,b=Math.cos(g),S=(360-r+90)*Math.PI/180,h=Math.sin(g)*Math.cos(S),p=Math.sin(g)*Math.sin(S),T[E]=b,A[E]=h,x[E]=p;else T.fill(b),A.fill(h),x.fill(p);return{resolution:i,factor:[d,C],sinZcosA:h,sinZsinA:p,cosZ:b,sinZcosAs:A,sinZsinAs:x,cosZs:T,weights:v,hillshadeType:["traditional","multi-directional"].indexOf(o)}}function He(e,t){const{width:r,height:o}=e,u=r*o,a=new Uint8Array(u),f=e.mask!=null;let n;if(f){n=new Uint8Array(e.mask);for(let k=0;k<n.length;k++)n[k]&&(a[k]=1,n[k]=1)}const i=e.pixels[0],l=new Float32Array(u),s=new Float32Array(u);let c,d=0;if(t){const{resolution:k}=t,v=k?(k.x+k.y)/2:1;d=200*t.zFactor/(v*v),c=new Float32Array(u)}const C=t==null?void 0:t.curvatureType;let g,b,S,h,p,m,y,w;for(let k=ee;k<o-ee;k++){const v=k*r;for(let I=ee;I<r-ee;I++){const T=v+I;if(!n||n[T]!==0){if(n){if(n[T-r-1]+n[T-r]+n[T-r+1]+n[T-1]+n[T+1]+n[T+r-1]+n[T+r]+n[T+r+1]<7){a[T]=0;continue}g=n[T-r-1]?i[T-r-1]:i[T],b=n[T-r]?i[T-r]:i[T],S=n[T-r+1]?i[T-r+1]:i[T],h=n[T-1]?i[T-1]:i[T],p=n[T+1]?i[T+1]:i[T],m=n[T+r-1]?i[T+r-1]:i[T],y=n[T+r]?i[T+r]:i[T],w=n[T+r+1]?i[T+r+1]:i[T]}else g=i[T-r-1],b=i[T-r],S=i[T-r+1],h=i[T-1],p=i[T+1],m=i[T+r-1],y=i[T+r],w=i[T+r+1];if(l[T]=S+p+p+w-(g+h+h+m),s[T]=m+y+y+w-(g+b+b+S),c!=null){const A=i[T],x=.5*(h+p)-A,E=.5*(b+y)-A;if(C==="standard")c[T]=-d*(x+E);else{const P=(-g+S+m-w)/4,O=(-h+p)/2,L=(b-y)/2,B=O*O,R=L*L,_=B+R;_&&(c[T]=C==="profile"?d*(x*B+E*R+P*O*L)/_:-d*(x*R+E*B-P*O*L)/_)}}}}}return{outMask:f?a:null,dzxs:l,dzys:s,curvatures:c}}function Ke(e,t,r){for(let o=0;o<r;o++)e[o*t]=e[o*t+1],e[(o+1)*t-1]=e[(o+1)*t-2];for(let o=1;o<t-1;o++)e[o]=e[o+t],e[o+(r-1)*t]=e[o+(r-2)*t]}function fo(e,t){if(!Se(e))return e;const{factor:r,sinZcosA:o,sinZsinA:u,cosZ:a,sinZcosAs:f,sinZsinAs:n,cosZs:i,weights:l}=rr(t),[s,c]=r,d=t.hillshadeType==="traditional",{width:C,height:g}=e,b=new Uint8Array(C*g),{dzxs:S,dzys:h,outMask:p}=He(e);for(let m=ee;m<g-ee;m++){const y=m*C;for(let w=ee;w<C-ee;w++){const k=y+w;if(!p||p[k]){const v=S[k]*s,I=h[k]*c,T=Math.sqrt(1+v*v+I*I);let A=0;if(d){let x=255*(a+u*I-o*v)/T;x<0&&(x=0),A=x}else{const x=n.length;for(let E=0;E<x;E++){let P=255*(i[E]+n[E]*I-f[E]*v)/T;P<0&&(P=0),A+=P*l[E]}}b[k]=255&A}}}return Ke(b,C,g),new te({width:C,height:g,pixels:[b],mask:p,pixelType:"u8",validPixelCount:e.validPixelCount,statistics:[{minValue:0,maxValue:255}]})}function po(e,t,r,o){if(!Se(e)||!Se(t))return;const{min:u,max:a}=o,f=e.pixels[0],{pixels:n,mask:i}=t,l=n[0],s=255.00001/(a-u),c=new Uint8ClampedArray(l.length),d=new Uint8ClampedArray(l.length),C=new Uint8ClampedArray(l.length),g=r.length-1;for(let b=0;b<l.length;b++){if(i&&i[b]===0)continue;const S=Math.floor((l[b]-u)*s),[h,p]=r[S<0?0:S>g?g:S],m=f[b],y=m*p,w=y*(1-Math.abs(h%2-1)),k=m-y;switch(Math.floor(h)){case 0:c[b]=y+k,d[b]=w+k,C[b]=k;break;case 1:c[b]=w+k,d[b]=y+k,C[b]=k;break;case 2:c[b]=k,d[b]=y+k,C[b]=w+k;break;case 3:c[b]=k,d[b]=w+k,C[b]=y+k;break;case 4:c[b]=w+k,d[b]=k,C[b]=y+k;break;case 5:case 6:c[b]=y+k,d[b]=k,C[b]=w+k}}e.pixels=[c,d,C],e.updateStatistics()}function jo(e,t){if(!Se(e))return e;const r=t.zFactor,o=t.pixelSizePower??1,u=t.pixelSizeFactor??1,a=t.slopeType,f=t.isGCS,{x:n,y:i}=t.resolution;let l=r/(8*n),s=r/(8*i);f&&Math.abs(r-1)<1e-4&&(l/=xe,s/=xe),a==="adjusted"&&(l=(r+n**o*u)/(8*n),s=(r+i**o*u)/(8*i));const{dzxs:c,dzys:d,outMask:C}=He(e),{width:g,height:b}=e,S=new Float32Array(g*b);for(let p=ee;p<b-ee;p++){const m=p*g;for(let y=ee;y<g-ee;y++){const w=m+y;if(!C||C[w]){const k=c[w]*l,v=d[w]*s,I=Math.sqrt(k*k+v*v);S[m+y]=a==="percent-rise"?100*I:57.2957795*Math.atan(I)}}}Ke(S,g,b);const h=new te({width:g,height:b,pixels:[S],mask:C,pixelType:"f32",validPixelCount:e.validPixelCount});return h.updateStatistics(),h}function zo(e,t={}){if(!Se(e))return e;const{resolution:r}=t,o=r?1/r.x:1,u=r?1/r.y:1,{dzxs:a,dzys:f,outMask:n}=He(e),{width:i,height:l}=e,s=new Float32Array(i*l);for(let c=ee;c<l-ee;c++){const d=c*i;for(let C=ee;C<i-ee;C++){const g=d+C;if(!n||n[g]){const b=a[g]*o,S=f[g]*u;let h=-1;b===0&&S===0||(h=90-57.29578*Math.atan2(S,-b),h<0&&(h+=360),h===360?h=0:h>360&&(h%=360)),s[d+C]=h}}}return Ke(s,i,l),new te({width:i,height:l,pixels:[s],mask:n,pixelType:"f32",validPixelCount:e.validPixelCount,statistics:[{minValue:-1,maxValue:360}]})}function Wo(e,t){if(!Se(e))return e;const{curvatures:r,outMask:o}=He(e,t),{width:u,height:a}=e;Ke(r,u,a);const f=new te({width:u,height:a,pixels:[r],mask:o,pixelType:"f32",validPixelCount:e.validPixelCount});return f.updateStatistics(),f}const Ho=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],or=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],mo=new jt({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function Fe(e,t){if(!e||!t||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]>t[r]+2||e[r]<t[r]-2)return!1;return!0}function Ut(e){const t=e.clone();return t.fromColor=e.toColor,t.toColor=e.fromColor,t.algorithm=e.algorithm,t}function go(e){var t;if(e.type==="multipart"){const r=e.clone();return(t=r.colorRamps)!=null&&t.length&&(r.colorRamps=r.colorRamps.reverse().map(o=>Ut(o))),r}return Ut(e)}function Gt(e,t){if(!e)return;const r=t??or;let o=null;return e.type==="algorithmic"?r.some(u=>{if(Fe(e.fromColor.toRgb(),u.fromColor)&&Fe(e.toColor.toRgb(),u.toColor))return o=u.id,!0}):e.type==="multipart"&&r.some(u=>{const a=e.colorRamps,f=u.colorRamps;if(a&&f&&a.length===f.length&&!f.some((n,i)=>{if(!Fe(a[i].fromColor.toRgb(),new bt(n.fromColor).toRgb())||!Fe(a[i].toColor.toRgb(),new bt(n.toColor).toRgb()))return!0})){if(o)return!0;o=u.id}}),o}function yo(e,t,r=!1){if(!e)return;let o=Gt(e,t);return o!=null||r||(o=Gt(e=go(e),t)),o}function Co(e,t=!1){const r=typeof e=="string"?e:yo(e,void 0,t);return r?mo.toJSON(r):null}function Ko(e,t="esriCIELabAlgorithm"){const r=or.find(({id:o})=>o===e);return r?r.colorRamps?{type:"multipart",colorRamps:r.colorRamps.map(o=>({type:"algorithmic",algorithm:t,fromColor:[...o.fromColor],toColor:[...o.toColor]}))}:{type:"algorithmic",algorithm:t,fromColor:[...r.fromColor],toColor:[...r.toColor]}:null}function nr(e){const t=(e=e||{}).numColors||256,r=e.distanceOffset||0,o=e.isCustomInterval!=null?e.isCustomInterval:e.distanceInterval!==null&&e.distanceInterval!==1/(t-1),u=e.distanceInterval||1/(t-1);return{...e,numColors:t,distanceOffset:r,interpolateAlpha:!!e.interpolateAlpha,distanceInterval:u,isCustomInterval:o,weights:e.weights}}function bo(e,t,r){const{numColors:o,distanceOffset:u,distanceInterval:a,isCustomInterval:f}=r,n=e.s===0,i=t.s===0;let l=e.h,s=t.h;n&&!i?l=s:i&&!n&&(t={...t,h:l},s=l);let c,d=Math.abs(s-l);const C=360;d<C/2?c=(s-l)*a:(d=C-d,c=l>s?d*a:-d*a);const g=(t.s-e.s)*a,b=(t.v-e.v)*a;let{s:S,v:h}=e,p=l;if(u){const y=u/a;p=(p+y*c+C)%C,S+=y*g,h+=y*b}const m=[];for(let y=0;y<o-1;y++)m.push({h:p,s:S,v:h}),p=(p+c+C)%C,S+=g,h+=b;return m.push(f?{h:p,s:S,v:h}:t),m}function wo(e,t,r){const{numColors:o,distanceOffset:u,distanceInterval:a,isCustomInterval:f}=r;let{l:n,a:i,b:l}=e;const s=(t.l-n)*a,c=(t.a-i)*a,d=(t.b-l)*a,C=[];if(u){const g=u/a;n+=g*s,i+=g*c,l+=g*d}for(let g=0;g<o-1;g++)C.push({l:n,a:i,b:l}),n+=s,i+=c,l+=d;return C.push(f?{l:n,a:i,b:l}:t),C}function vo(e,t,r){const{numColors:o,distanceOffset:u,distanceInterval:a,isCustomInterval:f}=r,n=e.h,i=t.h,l=2*Math.PI;let s;if(n<=i){const p=i-n,m=i-n-l;s=Math.abs(m)<Math.abs(p)?m:p}else{const p=i+l-n,m=i-n;s=Math.abs(m)<Math.abs(p)?m:p}const c=s*a,d=(t.l-e.l)*a,C=(t.c-e.c)*a;let{l:g,c:b,h:S}=e;if(u){const p=u/a;g+=p*d,b+=p*C,S=(S+p*c+l)%l}const h=[];for(let p=0;p<o-1;p++)h.push({l:g,c:b,h:S}),g+=d,b+=C,S=(S+c+l)%l;return h.push(f?{l:g,c:b,h:S}:t),h}function ir(e,t){let{fromColor:r,toColor:o}=e;r=[...r],o=[...o],r.length===3&&(r=r.concat([255])),o.length===3&&(o=o.concat([255]));const u=e.algorithm||"esriCIELabAlgorithm",a=nr(t),{numColors:f,distanceOffset:n,isCustomInterval:i,interpolateAlpha:l}=a;if(f===1&&n===0)return[r];if(f===2&&n===0&&!i)return[r,o];const s={r:r[0],g:r[1],b:r[2]},c={r:o[0],g:o[1],b:o[2]},d=u==="esriCIELabAlgorithm"?wo(St(s),St(c),a):u==="esriHSVAlgorithm"?bo(_e(s),_e(c),a):vo(Tt(s),Tt(c),a),C=[],g=r[3]??255,b=((o[3]??255)-g)/(f-1);for(let S=0;S<f;S++){const{r:h,g:p,b:m}=wr(d[S]),y=l?Math.round(g+b*S):255;C.push([h,p,m,y])}return C}function So(e,t){const{numColors:r,interpolateAlpha:o}=nr(t);let u=t==null?void 0:t.weights;const{colorRamps:a}=e;if(u){const d=u.reduce((C,g)=>C+g);u=u.map(C=>C/d)}else{u=[];for(let d=0;d<a.length;d++)u[d]=1/a.length}const f=[];let n=0,i=0;const l=1/(r-1);let s=!1;for(let d=0;d<a.length;d++){let C=s?0:n*l-i,g=d===a.length-1?r-1-n:(u[d]-C)/l;if(s=Math.ceil(g)===g,g=Math.ceil(g),g===0)continue;C/=u[d];const b=ir(a[d],{numColors:g,interpolateAlpha:o,distanceOffset:C,distanceInterval:l/u[d]});n+=b.length,f.push(...b),i+=u[d]}const c=[...a[a.length-1].toColor];return c.length===3&&c.push(255),f.push(c),f}function To(e,t){const r=yr(e)?e.toJSON():e;return r.type==="multipart"?So(r,t):ir(r,t)}function Nt(e,t){const r=To(e,t),o=t==null?void 0:t.interpolateAlpha;return r.forEach((u,a)=>{u.unshift(a),o||u.pop()}),r}function Bt(e){const t=_e(e);return{type:"HsvColor",Hue:t.h,Saturation:t.s,Value:t.v,AlphaValue:255}}function Ft(e){const t=e.toJSON();return{Algorithm:(t==null?void 0:t.Algorithm)||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:Bt(e.fromColor),ToColor:Bt(e.toColor)}}function Jo(e){const t=Co(e);if(!t)return null;if(e.type==="algorithmic")return{...Ft(e),Name:t};if(e.colorRamps){const r=e.colorRamps.map(Ft);return{type:"MultiPartColorRamp",NumColorRamps:r.length,ArrayOfColorRamp:r,Name:t}}return null}function qo(e){const t=e.reverse().map(r=>{const o=r.toString(16);return o.length<2?"0"+o:o});return 4294967295&Number.parseInt(t.join(""),16)}const Yo=new jt({none:"none",standardDeviation:"standard-deviation",histogramEqualization:"histogram-equalization",minMax:"min-max",percentClip:"percent-clip",sigmoid:"sigmoid"}),ko={0:"none",3:"standardDeviation",4:"histogramEqualization",5:"minMax",6:"percentClip",9:"sigmoid"},Ze=1,Io=[.299,.587,.114];function ar(e,t=256){t=Math.min(t,256);const{size:r,counts:o}=e,u=new Uint8Array(r),a=o.reduce((s,c)=>s+c/t,0);let f=0,n=0,i=0,l=a;for(let s=0;s<r;s++)if(i+=o[s],!(s<r-1&&i+o[s+1]<l)){for(;f<t-1&&l<i;)f++,l+=a;for(let c=n;c<=s;c++)u[c]=f;n=s+1}for(let s=n;s<r;s++)u[s]=t-1;return u}function $t(e){const{minCutOff:t,maxCutOff:r,gamma:o,pixelType:u,rounding:a}=e,f=e.outMin||0,n=e.outMax||255;if(!["u8","u16","s8","s16"].includes(u))return null;const i=t.length;let l,s,c=0;u==="s8"?c=-127:u==="s16"&&(c=-32767);let d=256;["u16","s16"].includes(u)&&(d=65536);const C=[],g=[],b=n-f;for(l=0;l<i;l++)g[l]=r[l]-t[l],C[l]=g[l]===0?0:b/g[l];let S;const h=[];let p,m,y;if(o&&o.length>=i){const w=sr(i,o);for(l=0;l<i;l++){for(y=[],s=0;s<d;s++)if(g[l]!==0)if(p=s+c,S=(p-t[l])/g[l],m=1,o[l]>1&&(m-=(1/b)**(S*w[l])),p<r[l]&&p>t[l]){const k=m*b*S**(1/o[l])+f;y[s]=a==="floor"?Math.floor(k):a==="round"?Math.round(k):k}else p>=r[l]?y[s]=n:y[s]=f;else y[s]=f;h[l]=y}}else for(l=0;l<i;l++){for(y=[],s=0;s<d;s++)if(p=s+c,p<=t[l])y[s]=f;else if(p>=r[l])y[s]=n;else{const w=(p-t[l])*C[l]+f;y[s]=a==="floor"?Math.floor(w):a==="round"?Math.round(w):w}h[l]=y}if(e.contrastOffset!=null){const w=xo(e.contrastOffset,e.brightnessOffset);for(l=0;l<i;l++)for(y=h[l],s=0;s<d;s++)y[s]=w[y[s]]}return{lut:h,offset:c}}function xo(e,t){const r=Math.min(Math.max(e,-100),100),o=Math.min(Math.max(t??0,-100),100),u=255,a=128;let f=0,n=0;const i=new Uint8Array(256);for(f=0;f<256;f++)r>0&&r<100?n=(200*f-100*u+2*u*o)/(2*(100-r))+a:r<=0&&r>-100?n=(200*f-100*u+2*u*o)*(100+r)/2e4+a:r===100?(n=200*f-100*u+(u+1)*(100-r)+2*u*o,n=n>0?u:0):r===-100&&(n=a),i[f]=n>u?u:n<0?0:n;return i}function Ao(e,t,r){const o=[];for(let u=0;u<t.length;u++){let a=0,f=0,n=0;"min"in t[u]?{min:a,max:f,avg:n}=t[u]:[a,f,n]=t[u];let i=n??0;e!=="u8"&&(i=255*(i-a)/(f-a)),r&&(i*=Io[u]),o.push(Eo(i))}return o}function Eo(e){if(e<=0||e>=255)return Ze;let t=0;e!==150&&(t=e<=150?45*Math.cos(.01047*e):17*Math.sin(.021*e));const r=255,o=e+t,u=Math.log(e/r),a=Math.log(o/r);if(a===0)return Ze;const f=u/a;return isNaN(f)?Ze:Math.min(9.9,Math.max(.01,f))}function Po(e,t,r,o){let u=1/0,a=-1/0,f=0,n=0,i=0,l=0;const s=e.length,c=new Map,d=[];for(let v=0;v<s;v++){const I=e[v];if(!t||t[v]){d.push(I);const T=(c.get(I)??0)+1;c.set(I,T),T>l&&(l=T,i=I),u=I<u?I:u,a=I>a?I:a,f+=I,n++}}if(n===0)return{statistics:{min:0,max:0,avg:0,stddev:0,mode:0,median:0},histogram:null};const C=f/n;let g=0;for(let v=0;v<s;v++)t&&!t[v]||(g+=(e[v]-C)**2);const b=t?t.filter(v=>v).length:s,S=b<=1?0:Math.sqrt(g/(b-1));d.sort((v,I)=>v-I);const h=n>>>1,p={min:u,max:a,avg:C,stddev:S,mode:i,median:n%2?d[Math.floor(h)]:(d[h-1]+d[h])/2};if(!o)return{statistics:p,histogram:null};if(["u8","s8","u4","u2","u1"].includes(r)){const v=a-u+1,I=new Uint32Array(v);for(let T=0;T<s;T++)t&&!t[T]||I[e[T]-u]++;return{statistics:p,histogram:{min:u-.5,max:a+.5,size:v,counts:I}}}const m=256,y=new Uint32Array(m),w=(a-u)/m;if(w===0)return{statistics:p,histogram:{min:u,max:a,size:1,counts:new Uint32Array(1).fill(n)}};const k=new Uint32Array(m+1);for(let v=0;v<s;v++)t&&!t[v]||k[Math.floor((e[v]-u)/w)]++;for(let v=0;v<m-1;v++)y[v]=k[v];return y[m-1]=k[m-1]+k[m],{statistics:p,histogram:{min:u,max:a,size:m,counts:y}}}function Xo(e){const{pixels:t,mask:r,pixelType:o,bandMasks:u}=e,a=t.map((f,n)=>Po(f,(u==null?void 0:u[n])??r,o,!0));return{statistics:a.map(({statistics:f})=>f),histograms:a.map(({histogram:f})=>f)}}function Ro(e){var T;if(!((T=e==null?void 0:e.pixels)!=null&&T.length))return null;const{pixels:t,mask:r,bandMasks:o,pixelType:u}=e,a=e.width*e.height,f=t.length;let n,i,l,s,c;const d=[],C=[];let g,b,S,h,p,m,y,w,k,v;const I=256;for(s=0;s<f;s++){g=new Uint32Array(I),S=t[s];const A=(o==null?void 0:o[s])??r;if(u==="u8")if(n=-.5,i=255.5,A)for(c=0;c<a;c++)A[c]&&g[S[c]]++;else for(c=0;c<a;c++)g[S[c]]++;else{let x=!1;e.statistics||(e.updateStatistics(),x=!0);const E=e.statistics;if(n=E[s].minValue,i=E[s].maxValue,l=(i-n)/I,l===0){!E||e.validPixelCount||x||e.updateStatistics();const P=(e.validPixelCount||e.width*e.height)/I;for(let O=0;O<I;O++)g[O]=Math.round(P*(O+1))-Math.round(P*O)}else{for(b=new Uint32Array(I+1),c=0;c<a;c++)A&&!A[c]||b[Math.floor((S[c]-n)/l)]++;for(c=0;c<I-1;c++)g[c]=b[c];g[I-1]=b[I-1]+b[I]}}for(d.push({min:n,max:i,size:I,counts:g}),h=0,p=0,w=0,c=0;c<I;c++)h+=g[c],p+=c*g[c];for(k=p/h,c=0;c<I;c++)w+=g[c]*(c-k)**2;v=Math.sqrt(w/(h-1)),l=(i-n)/I,m=(k+.5)*l+n,y=v*l,C.push({min:n,max:i,avg:m,stddev:y})}return{statistics:C,histograms:d}}function Zo(e){const t=[];for(let r=0;r<e.length;r++){const{min:o,max:u,size:a,counts:f}=e[r];let n=0,i=0;for(let g=0;g<a;g++)n+=f[g],i+=g*f[g];const l=i/n;let s=0;for(let g=0;g<a;g++)s+=f[g]*(g-l)**2;const c=(u-o)/a,d=(l+.5)*c+o,C=Math.sqrt(s/(n-1))*c;t.push({min:o,max:u,avg:d,stddev:C})}return t}function Le(e,t){var A;const{pixelBlock:r,bandIds:o,returnHistogramLut:u,rasterInfo:a}=t;let f=null,n=null,i=e.stretchType;if(typeof i=="number"&&(i=ko[i]),e.dra)if(i==="minMax"&&(r!=null&&r.statistics))f=r.statistics.map(x=>[x.minValue,x.maxValue,0,0]);else{const x=Ro(r);f=x!=null?x.statistics:null,n=x!=null?x.histograms:null}else f=(A=e.statistics)!=null&&A.length?e.statistics:a.statistics,n="histograms"in e?e.histograms:void 0,n||(n=a.histograms);i!=="percentClip"&&i!=="histogramEqualization"||n!=null&&n.length||(i="minMax");const l=(f==null?void 0:f.length)||(n==null?void 0:n.length)||a.bandCount,s=[],c=[];let d,C,g,b,S,h,p,m,y;f&&!Array.isArray(f[0])&&(f=f.map(x=>[x.min,x.max,x.avg,x.stddev]));const[w,k]=Cr(a.pixelType);if(!(f!=null&&f.length)){for(f=[],m=0;m<l;m++)f.push([w,k,1,1]);i==="standardDeviation"&&(i="minMax")}switch(i){case"none":for(m=0;m<l;m++)s[m]=w,c[m]=k;break;case"minMax":for(m=0;m<l;m++){const x=f[m];s[m]=x[0],c[m]=x[1]}break;case"standardDeviation":{const{numberOfStandardDeviations:x=2}=e;for(m=0;m<l;m++){const E=f[m];s[m]=E[2]-x*E[3],c[m]=E[2]+x*E[3],s[m]<E[0]&&(s[m]=E[0]),c[m]>E[1]&&(c[m]=E[1])}}break;case"histogramEqualization":for($e(n),m=0;m<l;m++)s[m]=n[m].min,c[m]=n[m].max;break;case"percentClip":for($e(n),m=0;m<n.length;m++){for(d=n[m],S=new Uint32Array(d.size),b=[...d.counts],b.length>=20&&(b[0]=b[1]=b[2]=b[b.length-1]=b[b.length-2]=0),g=0,C=(d.max-d.min)/d.size,p=d.min===-.5&&C===1?.5:0,y=0;y<d.size;y++)g+=b[y],S[y]=g;for(h=(e.minPercent||0)*g/100,s[m]=d.min+p,y=0;y<d.size;y++)if(S[y]>h){s[m]=d.min+C*(y+p);break}for(h=(1-(e.maxPercent||0)/100)*g,c[m]=d.max+p,y=d.size-2;y>=0;y--)if(S[y]<h){c[m]=d.min+C*(y+2-p);break}if(c[m]<s[m]){const x=s[m];s[m]=c[m],c[m]=x}}break;default:for(m=0;m<l;m++){const x=f[m];s[m]=x[0],c[m]=x[1]}}let v,I,T;return i==="histogramEqualization"?($e(n),I=n[0].size||256,v=0,u&&(T=n.map(x=>ar(x)))):(I=e.max||255,v=e.min||0),Mo({minCutOff:s,maxCutOff:c,outMax:I,outMin:v,histogramLut:T},o)}function Mo(e,t){if(t==null||t.length===0)return e;const r=Math.max.apply(null,t),{minCutOff:o,maxCutOff:u,outMin:a,outMax:f,histogramLut:n}=e;return o.length===t.length||o.length<=r?e:{minCutOff:t.map(i=>o[i]),maxCutOff:t.map(i=>u[i]),histogramLut:n?t.map(i=>n[i]):null,outMin:a,outMax:f}}function sr(e,t){const r=new Float32Array(e);for(let o=0;o<e;o++)t[o]>1?t[o]>2?r[o]=6.5+(t[o]-2)**2.5:r[o]=6.5+100*(2-t[o])**4:r[o]=1;return r}function Qe(e,t){var v;if(!((v=e==null?void 0:e.pixels)!=null&&v.length))return e;const{mask:r,bandMasks:o,width:u,height:a,pixels:f}=e,{minCutOff:n,maxCutOff:i,gamma:l}=t,s=t.outMin||0,c=t.outMax||255,d=u*a,C=t.outputPixelType||"u8",g=e.pixels.map(()=>te.createEmptyBand(C,d)),b=g.length,S=c-s,h=[],p=[];for(let I=0;I<b;I++)p[I]=i[I]-n[I],h[I]=p[I]===0?0:S/p[I];const m=C.startsWith("u")||C.startsWith("s"),y=l&&l.length>=b,w=!!t.isRenderer;if(y){const I=sr(b,l);for(let T=0;T<b;T++){const A=(o==null?void 0:o[T])??r;for(let x=0;x<d;x++)if(A==null||A[x]){if(p[T]===0){g[T][x]=s;continue}const E=f[T][x],P=(E-n[T])/p[T];let O=1;if(l[T]>1&&(O-=(1/S)**(P*I[T])),E<i[T]&&E>n[T]){const L=O*S*P**(1/l[T])+s;g[T][x]=w?Math.floor(L):m?Math.round(L):L}else E>=i[T]?g[T][x]=c:g[T][x]=s}}}else for(let I=0;I<b;I++){const T=(o==null?void 0:o[I])??r;for(let A=0;A<d;A++)if(T==null||T[A]){const x=f[I][A];if(x<i[I]&&x>n[I]){const E=(x-n[I])*h[I]+s;g[I][A]=w?Math.floor(E):m?Math.round(E):E}else x>=i[I]?g[I][A]=c:g[I][A]=s}}const k=new te({width:u,height:a,mask:r,bandMasks:o,pixels:g,pixelType:C});return k.updateStatistics(),k}function Lo(e){var t,r,o;return["u8","s8"].includes(e.pixelType)&&((r=(t=e.statistics)==null?void 0:t[0])==null?void 0:r.min)!=null&&((o=e.statistics[0])==null?void 0:o.max)!=null&&e.bandCount===1}function Oo(e,t){const{attributeTable:r,bandCount:o}=e;return r==null&&Lo(e)?!0:!(r==null||o>1||t&&r.fields.find(u=>u.name.toLowerCase()===t.toLowerCase())==null)}function Do(e){const{bandCount:t,dataType:r,pixelType:o}=e;return r==="elevation"||r==="generic"&&t===1&&(o==="s16"||o==="s32"||o==="f32"||o==="f64")}function Uo(e,t=!1){const{bandCount:r,colormap:o,pixelType:u}=e;return r===1&&(!!(o!=null&&o.length)||!t&&u==="u8")}function Qo(e,t=!1){const{attributeTable:r,bandCount:o}=e;return o===1&&(!t||r!=null||e.histograms!=null)}function en(e){const{dataType:t}=e;return t==="vector-uv"||t==="vector-magdir"}function tn(e){const{dataType:t}=e;return t==="vector-uv"||t==="vector-magdir"}let we=class extends De{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e==null?void 0:e.pixelBlock;if(!Vt(t))return t;if(e.simpleStretchParams&&this.rendererJSON.type==="rasterStretch")return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands([0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const o=e.extent,u=o.spatialReference.isGeographic,a={x:(o.xmax-o.xmin)/t.width,y:(o.ymax-o.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:u,resolution:a});break}}return r}catch(r){return wt.getLogger(this).error("symbolize",r.message),t}}simpleStretch(e,t){if(!Vt(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),Qe(e,{...t,isRenderer:!0})}catch(r){return wt.getLogger(this).error("symbolize",r.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:f,offset:n}=this.lookup.colormapLut||{};return{colormap:f,colormapOffset:n,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:o,bandIds:u}=e,{rendererJSON:a}=this;return a.type==="rasterStretch"?this._generateStretchWebGLParams(t,a,u):a.type==="rasterShadedRelief"?this._generateShadedReliefWebGLParams(a,r,o??void 0):a.type==="vectorField"?this._generateVectorFieldWebGLParams(a):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){return this._isLUTChanged()&&!this.bind().success?e:Je(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);return this._isLUTChanged()&&!this.bind().success?e:t?Je(e,this.lookup.colormapLut):br(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){var c,d;const{rasterInfo:r}=this,{pixelType:o,bandCount:u}=r,a=this.rendererJSON,f=["u8","u16","s8","s16"].includes(o);let n,i;const{dra:l}=a,{gamma:s}=this.lookup;if(a.stretchType==="histogramEqualization"){const C=l?null:(c=this.lookup)==null?void 0:c.histogramLut,g=Le(a,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!C}),b=Qe(e,{...g,gamma:s,isRenderer:!0});i=vt(b,{lut:l?g.histogramLut:C,offset:0})}else if(f){if(l){const C=Le(a,{rasterInfo:r,pixelBlock:e,bandIds:t});n=$t({pixelType:o,...C,gamma:s,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return e;n=this.lookup?this.lookup.stretchLut:null}else n=this.lookup?this.lookup.stretchLut:null;if(!n)return e;u>1&&t!=null&&t.length===(e==null?void 0:e.pixels.length)&&(n==null?void 0:n.lut.length)===u&&(n={lut:t.map(C=>n.lut[C]),offset:n.offset}),i=vt(e,n)}else{const C=Le(a,{rasterInfo:r,pixelBlock:e,bandIds:t});i=Qe(e,{...C,gamma:s,isRenderer:!0})}if(a.colorRamp){if(this._isLUTChanged(!0)&&!this.bind().success)return e;i=Je(i,(d=this.lookup)==null?void 0:d.colormapLut)}return i}_symbolizeShadedRelief(e,t){var n;const r=this.rendererJSON,o={...r,...t},u=fo(e,o);if(!r.colorRamp)return u;let a;if(this._isLUTChanged(!0)){if(!this.bind().success)return u;a=this.lookup?this.lookup.hsvMap:null}else a=this.lookup?this.lookup.hsvMap:null;if(!a)return u;const f=((n=this.rasterInfo.statistics)==null?void 0:n[0])??{min:0,max:8e3};return po(u,e,a,f),u}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return e===2&&(t==="vector-magdir"||t==="vector-uv")}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){var l;const{bandCount:t,attributeTable:r,pixelType:o}=this.rasterInfo,u=e.field1;if(!u)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const a=e.defaultSymbol,f=t===1&&["u8","s8"].includes(o);if(!Oo(this.rasterInfo,u)&&!f)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const n=[];if(r!=null){const s=r.fields.find(c=>c.name.toLowerCase()==="value");if(!s)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach(c=>{var g,b;const d=(g=e.uniqueValueInfos)==null?void 0:g.find(S=>String(S.value)===String(c.attributes[u])),C=(b=d==null?void 0:d.symbol)==null?void 0:b.color;C?n.push([c.attributes[s.name]].concat(C)):a&&n.push([c.attributes[s.name]].concat(a.color))})}else{if(u.toLowerCase()!=="value")return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.'};(l=e.uniqueValueInfos)==null||l.forEach(s=>{var d;const c=(d=s==null?void 0:s.symbol)==null?void 0:d.color;c?n.push([parseInt(""+s.value,10)].concat(c)):a&&n.push([parseInt(""+s.value,10)].concat(a==null?void 0:a.color))})}if(n.length===0)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const i=Re({colormap:n});return this.lookup={rendererJSON:e,colormapLut:i},this.canRenderInWebGL=this._isColormapSupportedByWebGL(i==null?void 0:i.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!Uo(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map(o=>[o.value].concat(o.color)).sort((o,u)=>o[0]-u[0]);if(!t||t.length===0)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=Re({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=this._isColormapSupportedByWebGL(r==null?void 0:r.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!Do(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const t=Nt(e.colorRamp,{interpolateAlpha:!0}),r=Re({colormap:t}),o=[],u=r.indexedColormap;for(let a=0;a<u.length;a+=4){const f=_e({r:u[a],g:u[a+1],b:u[a+2]});o.push([f.h/60,f.s/100,255*f.v/100])}this.lookup={rendererJSON:e,colormapLut:r,hsvMap:o}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,o=t!=null?t.fields.find(f=>f.name.toLowerCase()==="value"):null,u=t!=null?t.fields.find(f=>f.name.toLowerCase()===e.field.toLowerCase()):null,a=o!=null&&u!==null;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||a,tableValueField:o,tableBreakField:u}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:o,tableBreakField:u}=this._analyzeClassBreaks(e),a=e.classBreakInfos;if(!(a!=null&&a.length))return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const f=a.sort((c,d)=>c.classMaxValue-d.classMaxValue),n=f[f.length-1];let i=e.minValue;if(!r){const c=[];for(let d=0;d<f.length;d++)c.push({value:f[d].classMinValue??i,mappedColor:f[d].symbol.color}),i=f[d].classMaxValue;return c.push({value:n.classMaxValue,mappedColor:n.symbol.color}),this.lookup={rendererJSON:e,remapLut:c},this.canRenderInWebGL=!1,{success:!0}}const l=[];if(t!=null&&o!=null&&u!==null&&o!==u){const c=o.name,d=u.name,C=f[f.length-1],{classMaxValue:g}=C;i=e.minValue;for(const b of t.features){const S=b.attributes[c],h=b.attributes[d],p=h===g?C:h<i?null:f.find(({classMaxValue:m})=>m>h);p&&l.push([S].concat(p.symbol.color))}}else{i=Math.floor(e.minValue);for(let c=0;c<f.length;c++){const d=f[c];for(let C=i;C<d.classMaxValue;C++)l.push([C].concat(d.symbol.color));i=Math.ceil(d.classMaxValue)}n.classMaxValue===i&&l.push([n.classMaxValue].concat(n.symbol.color))}const s=Re({colormap:l,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:s},this.canRenderInWebGL=this._isColormapSupportedByWebGL(s==null?void 0:s.indexedColormap),{success:!0}}_isColormapSupportedByWebGL(e){return!!(e!=null&&e.length)&&e.length<=16384}_isHistogramRequired(e){return e==="percentClip"||e==="histogramEqualization"}_isValidRasterStatistics(e){return e!=null&&e.length>0&&e[0].min!=null&&e[0].max!=null}_updateStretchRenderer(e){var s,c;let{stretchType:t,dra:r}=e;if(!(t==="none"||(s=e.statistics)!=null&&s.length||this._isValidRasterStatistics(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const o=e.histograms||this.rasterInfo.histograms;!this._isHistogramRequired(e.stretchType)||o!=null&&o.length||r||(t="minMax");const{computeGamma:u,useGamma:a,colorRamp:f}=e;let{gamma:n}=e;if(a&&u&&!(n!=null&&n.length)){const d=(c=e.statistics)!=null&&c.length?e.statistics:this.rasterInfo.statistics;n=Ao(this.rasterInfo.pixelType,d)}const i=this.rasterInfo.pixelType,l=!r&&["u8","u16","s8","s16"].includes(i);if(t==="histogramEqualization"){const d=o.map(C=>ar(C));this.lookup={rendererJSON:e,histogramLut:d}}else if(l){const d=Le(e,{rasterInfo:this.rasterInfo}),C=$t({pixelType:i,...d,gamma:a?n:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:C}}if(f&&!this._isStretchColorRampNoop(f)){const d=Nt(f,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=Re({colormap:d}),this.lookup.rendererJSON=e}return this.lookup.gamma=a&&(n!=null&&n.length)?n:null,this.canRenderInWebGL=!0,{success:!0}}_isStretchColorRampNoop(e){return e.type==="algorithmic"&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}_generateStretchWebGLParams(e,t,r){var m;let o=null,u=null;const a=(m=this.lookup)==null?void 0:m.colormapLut;t.colorRamp&&a&&(o=a.indexedColormap,u=a.offset),t.stretchType==="histogramEqualization"&&(t={...t,stretchType:"minMax"});const{gamma:f}=this.lookup,n=!!(t.useGamma&&f&&f.some(y=>y!==1)),{minCutOff:i,maxCutOff:l,outMin:s,outMax:c}=Le(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let d=0;e!=null&&(d=e.getPlaneCount(),d===2&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:C}=this.rasterInfo,g=Math.min(3,(r==null?void 0:r.length)||d||C,C),b=new Float32Array(g),S=o||n?1:255;let h;for(h=0;h<i.length;h++)b[h]=l[h]===i[h]?0:(c-s)/(l[h]-i[h])/S;const p=new Float32Array(g);if(n&&f)for(h=0;h<g;h++)f[h]>1?f[h]>2?p[h]=6.5+(f[h]-2)**2.5:p[h]=6.5+100*(2-f[h])**4:p[h]=1;return{bandCount:g,outMin:s/S,outMax:c/S,minCutOff:i,maxCutOff:l,factor:b,useGamma:n,gamma:n?f:[1,1,1],gammaCorrection:n?p:[1,1,1],colormap:o,colormapOffset:u,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){var l,s;let o=null,u=null;const a=(l=this.lookup)==null?void 0:l.colormapLut;e.colorRamp&&a&&(o=a.indexedColormap,u=a.offset);const f={...e,isGCS:t,resolution:r},n=rr(f),i=(s=this.rasterInfo.statistics)==null?void 0:s[0];return{...n,minValue:(i==null?void 0:i.min)??0,maxValue:(i==null?void 0:i.max)??8e3,hillshadeType:e.hillshadeType==="traditional"?0:1,type:"hillshade",colormap:o,colormapOffset:u}}_generateVectorFieldWebGLParams(e){var h,p,m;const{style:t,inputUnit:r,outputUnit:o,visualVariables:u,symbolTileSize:a,flowRepresentation:f}=e;let n;const i=((h=this.rasterInfo.statistics)==null?void 0:h[0].min)??0,l=((p=this.rasterInfo.statistics)==null?void 0:p[0].max)??50,s=(u==null?void 0:u.find(y=>y.type==="sizeInfo"))??{type:"sizeInfo",field:"Magnitude",maxDataValue:l,maxSize:.8*a,minDataValue:i,minSize:.2*a},c=s.minDataValue??i,d=s.maxDataValue??l,C=s.maxSize!=null&&s.minSize!=null?[s.minSize/a,s.maxSize/a]:[.2,.8];if(t==="wind_speed"){const y=(C[0]+C[1])/2;C[0]=C[1]=y}const g=c!=null&&d!=null?[c,d]:null;if(t==="classified_arrow")if(c!=null&&d!=null&&s!=null){n=[];const y=(s.maxDataValue-s.minDataValue)/5;for(let w=0;w<6;w++)n.push(s.minDataValue+y*w)}else n=[0,1e-6,3.5,7,10.5,14];const b=f==="flow_to"==(t==="ocean_current_kn"||t==="ocean_current_m")?0:Math.PI,S=u==null?void 0:u.find(y=>y.type==="rotationInfo");return{breakValues:n,dataRange:g,inputUnit:r,outputUnit:o,symbolTileSize:a,symbolPercentRange:C,style:t||"single_arrow",rotation:b,rotationType:(m=this.rasterInfo.storageInfo)!=null&&m.tileInfo&&this.rasterInfo.dataType==="vector-uv"?"geographic":(S==null?void 0:S.rotationType)||e.rotationType,type:"vectorField"}}};function Vt(e){return Se(e)&&e.validPixelCount!==0}D([N({json:{write:!0}})],we.prototype,"rendererJSON",void 0),D([N({type:ho,json:{write:!0}})],we.prototype,"rasterInfo",void 0),D([N({json:{write:!0}})],we.prototype,"lookup",void 0),D([N()],we.prototype,"canRenderInWebGL",void 0),we=D([Oe("esri.renderers.support.RasterSymbolizer")],we);const rn=we;export{qo as A,Wr as B,Ho as C,We as D,xe as E,zr as F,Jo as G,Wo as H,jo as I,Le as J,$t as K,rn as L,Qe as M,Zt as N,sr as O,Vo as P,gt as R,Xt as U,ho as a,pt as b,Ae as c,Vr as d,Nt as e,Yo as f,Zo as g,Ro as h,ko as i,_o as j,or as k,Qo as l,Xo as m,co as n,en as o,Do as p,tn as q,Pr as r,Co as s,Oo as t,Uo as u,zo as v,mo as w,To as x,Ko as y,xo as z};
|