@arcgis/core 4.27.0-next.20230421 → 4.27.0-next.20230422
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/085e9a46ee3a8a1a5e20.js +1 -0
- package/assets/esri/core/workers/chunks/5f3899efbb967c6e8422.js +1 -0
- package/assets/esri/core/workers/chunks/f47046967c3b13996a14.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
- package/assets/esri/themes/base/widgets/_FeatureMedia.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_en.json +1 -1
- package/chunks/Button.js +5 -0
- package/chunks/ColorSet.js +5 -0
- package/chunks/DefaultTheme.js +5 -0
- package/chunks/Theme.js +5 -0
- package/chunks/Tick.js +5 -0
- package/chunks/Tooltip.js +5 -0
- package/interfaces.d.ts +6 -0
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureMedia/chartCommon.js +5 -0
- package/widgets/Feature/FeatureMedia/pieChart.js +5 -0
- package/widgets/Feature/FeatureMedia/xyChart.js +5 -0
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/support/chartUtilsAm5.js +5 -0
- package/assets/esri/core/workers/chunks/353e5b283e0f4416684a.js +0 -1
- package/assets/esri/core/workers/chunks/81529aee5e6efa3afc83.js +0 -1
- package/assets/esri/core/workers/chunks/bcd79124744cd3682c78.js +0 -1
- package/widgets/support/am5chartUtils.js +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3381],{13867:(e,t,i)=>{i.d(t,{Z:()=>r});var n=i(69801);class r{constructor(e,t){this._storage=new n.WJ,this._storage.maxSize=e,t&&this._storage.registerRemoveFunc("",t)}put(e,t,i){this._storage.put(e,t,i,1)}pop(e){return this._storage.pop(e)}get(e){return this._storage.get(e)}clear(){this._storage.clearAll()}destroy(){this._storage.destroy()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}}},16306:(e,t,i)=>{i.d(t,{aX:()=>_});var n=i(68773),r=i(20102),s=i(92604),a=i(38913),o=i(58901),l=i(73913),c=i(8744),u=i(40488),h=(i(66577),i(3172)),f=i(33955),d=i(11282),p=i(17452);async function m(e,t,i){const n="string"==typeof e?(0,p.mN)(e):e,r=t[0].spatialReference,s=(0,f.Ji)(t[0]),a={...i,query:{...n.query,f:"json",sr:r.wkid??JSON.stringify(r),geometries:JSON.stringify((l=t,{geometryType:(0,f.Ji)(l[0]),geometries:l.map((e=>e.toJSON()))}))}},{data:o}=await(0,h.default)(n.path+"/simplify",a);var l;return function(e,t,i){const n=(0,f.q9)(t);return e.map((e=>{const t=n.fromJSON(e);return t.spatialReference=i,t}))}(o.geometries,s,r)}const y=s.Z.getLogger("esri.geometry.support.normalizeUtils");function g(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof a.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y.error(e),new r.Z(e)}const i=(0,l.x3)(e),n=[];for(const e of i){const i=[];n.push(i),i.push([e[0][0],e[0][1]]);for(let n=0;n<e.length-1;n++){const r=e[n][0],s=e[n][1],a=e[n+1][0],o=e[n+1][1],l=Math.sqrt((a-r)*(a-r)+(o-s)*(o-s)),c=(o-s)/l,u=(a-r)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const n=e*t,a=u*n+r,o=c*n+s;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,n=u*e+r,a=c*e+s;i.push([n,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.Z({rings:n,spatialReference:e.spatialReference}):new o.Z({paths:n,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.Sx)(t,!0)}return i&&(e=(0,l.Sy)(e,i)),e}function b(e,t,i){if(Array.isArray(e)){const n=e[0];if(n>t){const i=(0,l.XZ)(n,t);e[0]=n+i*(-2*t)}else if(n<i){const t=(0,l.XZ)(n,i);e[0]=n+t*(-2*i)}}else{const n=e.x;if(n>t){const i=(0,l.XZ)(n,t);e=e.clone().offset(i*(-2*t),0)}else if(n<i){const t=(0,l.XZ)(n,i);e=e.clone().offset(t*(-2*i),0)}}return e}function I(e,t){let i=-1;for(let n=0;n<t.cutIndexes.length;n++){const r=t.cutIndexes[n],s=t.geometries[n],a=(0,l.x3)(s);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const n=t[e][0];i=n>i?n:i}i=Number(i.toFixed(9));const n=-360*(0,l.XZ)(i,180);for(let i=0;i<t.length;i++){const t=s.getPoint(e,i);s.setPoint(e,i,t.clone().offset(n,0))}return!0}}))}if(r===i){if(g(e))for(const t of(0,l.x3)(s))e[r]=e[r].addRing(t);else if(x(e))for(const t of(0,l.x3)(s))e[r]=e[r].addPath(t)}else i=r,e[r]=s}return e}async function _(e,t,i){if(!Array.isArray(e))return _([e],t);t&&"string"!=typeof t&&y.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const r="string"==typeof t?t:t?.url??n.default.geometryServiceUrl;let s,p,g,x,S,R,v,T,C=0;const k=[],F=[];for(const t of e)if(null!=t)if(s||(s=t.spatialReference,p=(0,c.C5)(s),g=s.isWebMercator,R=g?102100:4326,x=l.UZ[R].maxX,S=l.UZ[R].minX,v=l.UZ[R].plus180Line,T=l.UZ[R].minus180Line),p)if("mesh"===t.type)F.push(t);else if("point"===t.type)F.push(b(t.clone(),x,S));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>b(e,x,S))),F.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,p);F.push(e.rings?new a.Z(e):e)}else if(t.extent){const e=t.extent,i=(0,l.XZ)(e.xmin,S)*(2*x);let n=0===i?t.clone():(0,l.Sy)(t.clone(),i);e.offset(i,0),e.intersects(v)&&e.xmax!==x?(C=e.xmax>C?e.xmax:C,n=w(n,g),k.push(n),F.push("cut")):e.intersects(T)&&e.xmin!==S?(C=e.xmax*(2*x)>C?e.xmax*(2*x):C,n=w(n,g,360),k.push(n),F.push("cut")):F.push(n)}else F.push(t.clone());else F.push(t);else F.push(t);let M=(0,l.XZ)(C,x),P=-90;const O=M,D=new o.Z;for(;M>0;){const e=360*M-180;D.addPath([[e,P],[e,-1*P]]),P*=-1,M--}if(k.length>0&&O>0){const t=I(k,await async function(e,t,i,n){const r=(0,d.en)(e),s=t[0].spatialReference,a={...n,query:{...r.query,f:"json",sr:JSON.stringify(s),target:JSON.stringify({geometryType:(0,f.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.default)(r.path+"/cut",a),{cutIndexes:l,geometries:c=[]}=o.data;return{cutIndexes:l,geometries:c.map((e=>{const t=(0,f.im)(e);return t.spatialReference=s,t}))}}(r,k,D,i)),n=[],s=[];for(let i=0;i<F.length;i++){const r=F[i];if("cut"!==r)s.push(r);else{const r=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&r.rings.length>=a.rings.length?(n.push(r),s.push("simplify")):s.push(g?(0,u.$)(r):r)}}if(!n.length)return s;const a=await m(r,n,i),o=[];for(let e=0;e<s.length;e++){const t=s[e];"simplify"!==t?o.push(t):o.push(g?(0,u.$)(a.shift()):a.shift())}return o}const B=[];for(let e=0;e<F.length;e++){const t=F[e];if("cut"!==t)B.push(t);else{const e=k.shift();B.push(!0===g?(0,u.$)(e):e)}}return B}},73913:(e,t,i)=>{i.d(t,{Sy:()=>l,UZ:()=>a,XZ:()=>o,x3:()=>c});var n=i(58901),r=i(82971),s=i(33955);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new n.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:r.Z.WebMercator}),minus180Line:new n.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:r.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new n.Z({paths:[[[180,-180],[180,180]]],spatialReference:r.Z.WGS84}),minus180Line:new n.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:r.Z.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=c(e);for(const e of i)for(const i of e)i[0]+=t;return e}function c(e){return(0,s.oU)(e)?e.rings:e.paths}},74878:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ht});var n=i(43697),r=i(51773),s=i(30030),a=i(20102),o=i(92604),l=i(16453),c=i(95330),u=i(17445),h=i(5600),f=i(75215),d=i(67676),p=i(80442),m=i(36030),y=i(71715),g=i(52011),x=i(87085),w=i(17287),b=i(71612),I=i(17017),_=(i(66577),i(3172)),S=i(8744),R=i(66677),v=i(21506),T=i(35956),C=i(29876),k=i(40297),F=i(88281),M=i(11145),P=i(96674),O=i(70586),D=i(609),B=i(39450),Z=i(36679),z=i(99815),J=i(73506),N=i(94139);const A=new Map,E=new class{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.refCount--,e.refCount<=0&&(n.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.ts=Date.now(),e.refCount++,n.delete(i),n.set(i,e),e.block}return null}putBlock(e,t,i,n){const r=this._cachedBlocks,s=e+"/"+t;if(r.has(s)){const e=r.get(s);e.ts=Date.now(),e.refCount++}else r.set(s,{block:i,ts:Date.now(),refCount:1,controller:n});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,n=e+"/"+t;i.has(n)&&i.delete(n)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval((()=>{const t=Array.from(e),i=Date.now();for(let n=0;n<t.length&&t[n][1].ts<=i-this._duration;n++)e.delete(t[n][0]);0===e.size&&this._clearTimer()}),this._interval)}_trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}};function H(e,t){return null==t?e:`${e}?sliceId=${t}`}function L(e,t,i){const n=A.get(e);if(!n)return null==t?E.decreaseRefCount(e,i):0;if(null==t||null==n[t])return E.decreaseRefCount(e,i);const r=n[t]?.cache,s=r?.get(i);if(r&&s){if(s.refCount--,0===s.refCount){r.delete(i);for(let e=0;e<n.length;e++)n[e]?.cache.delete(i);s.controller&&s.controller.abort()}return s.refCount}return 0}function W(e,t,i){const n=A.get(e);if(!n)return null==t?E.getBlock(e,i):null;if(null==t||null==n[t]){for(let e=0;e<n.length;e++){const t=n[e]?.cache.get(i);if(t)return t.refCount++,t.block}return E.getBlock(e,i)}const r=n[t]?.cache.get(i);if(r)return r.refCount++,r.block;for(let e=0;e<n.length;e++){if(e===t||!n[e])continue;const r=n[e]?.cache,s=r?.get(i);if(r&&s)return s.refCount++,r.set(i,s),s.block}return null}function q(e,t,i,n,r=null){const s=A.get(e);if(!s)return void(null==t&&E.putBlock(e,i,n,r));if(null==t||null==s[t])return void E.putBlock(e,i,n,r);const a={refCount:1,block:n,isResolved:!1,isRejected:!1,controller:r};n.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),s[t]?.cache.set(i,a)}function j(e,t,i){const n=A.get(e);n?null!=t&&null!=n[t]?n[t]?.cache.delete(i):E.deleteBlock(e,i):null==t&&E.deleteBlock(e,i)}var G=i(81578),U=i(75993),$=i(55914),V=i(80676),X=i(6570);let Y=class extends((0,D.v)(P.wq)){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,J.zD)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:M.Z.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,J.ut)(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}set url(e){this._set("url",(0,R.Nm)(e,o.Z.getLogger(this.declaredClass)))}async open(e){throw new a.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,n={}){const r=n.tileInfo||this.rasterInfo.storageInfo.tileInfo,s=this.getTileExtentFromTileInfo(e,t,i,r);return this.fetchPixels(s,r.size[0],r.size[1],n)}async identify(e,t={}){e=(0,f.TJ)(N.Z,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:n}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:s,multidimensionalInfo:a}=r;let{transposedVariableName:o}=t;const l=null!=a&&s&&(null!=n||(0,z.WU)(i));l&&!o&&(o=null!=i&&i.length>0?i[0].variableName??void 0:a.variables[0].name,t={...t,transposedVariableName:o}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:c,extent:u}=r,{datumTransformation:h}=t;let d=(0,J.nF)(e,c,h);if(!u.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let p=0;const m=null!=o&&null!=a&&r.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(m)return e.identify(d,t);const{pixelSize:i}=r,n=3,s=i.x*n/2,a=i.y*n/2,o=new X.Z({xmin:d.x-s,xmax:d.x+s,ymin:d.y-a,ymax:d.y+a,spatialReference:c}),l={interpolation:"nearest"},{pixelBlock:u}=await e.fetchPixels(o,n,n,l),{pixelBlock:h}=await this.fetchPixels(o,n,n,l);if(null==u)return{location:d,value:null};const f=Math.floor(n*n*.5),p=!u.mask||u.mask[f]?u.pixels.map((e=>e[f])):null;let y;return null!=h&&(y=!h.mask||h.mask[f]?h.pixels.map((e=>e[f])):void 0),{location:d,value:p,processedValue:y,pyramidLevel:0}}if(!m)if(t.srcResolution)p=(0,J.kr)(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel;else if(p=await this.computeBestPyramidLevelForLocation(e,t),null==p)return{location:d,value:null};const y=this.identifyPixelLocation(d,p,null,m);if(null===y)return{location:d,value:null};const{row:g,col:x,rowOffset:w,colOffset:b,blockWidth:I}=y,_=o??t.sliceId,S=H(this.url,_),R=`${p}/${g}/${x}`;let v=W(S,null,R);null==v&&(v=this.fetchRawTile(p,g,x,t),q(S,null,R,v));const T=await v;if(null==T||!T.pixels?.length)return{location:d,value:null};const C=w*I+b;return this._processIdentifyResult(T,{srcLocation:d,position:C,pyramidLevel:p,useTransposedTile:!!m,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,n={}){e=(0,J.kZ)(e),n=this._getRequestOptionsWithSliceId(n);const{_hasNoneOrGCSShiftTransform:r}=this;if(n.requestRawData&&r)return this._fetchPixels(e,t,i,n);const s=(0,J.ut)(e.spatialReference),a=(0,J.Hq)(e);if(null==s||0===a||1===a&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,n);if(a>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:l,xmax:c}=e,u=Math.round(s/(c-l)*t),h=u-Math.round((s/2-l)/(c-l)*t);let f=0;const d=[];for(let r=0;r<=a;r++){const p=new X.Z({xmin:0===r?l:-s/2,xmax:r===a?c-s*r:s/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),m=0===r?u-h:r===a?t-f:u;f+=m,d.push(m);const y=n.disableWrapAround&&r>0?null:this._fetchPixels(p,m,i,n);o.push(y)}const p=(await Promise.all(o)).map((e=>e?.pixelBlock));let m=null;const y={width:t,height:i};return m=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:d},n)).pixelBlock:(0,$.us)(p,y,{blockWidths:d}),{extent:e,srcExtent:(0,J.tB)(e,this.rasterInfo.spatialReference,n.datumTransformation),pixelBlock:m}}async fetchRawPixels(e,t,i,n={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,n),{nativeExtent:s,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new X.Z({xmin:s.xmin+c*t.x,xmax:s.xmin+c*(t.x+i.width-1),ymin:s.ymax-u*(t.y+i.height-1),ymax:s.ymax-u*t.y,spatialReference:s.spatialReference});if(!r)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:d}=r;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:r.pixelBlocks[0]};const p=e>0?o.pyramidBlockWidth:o.blockWidth,m=e>0?o.pyramidBlockHeight:o.blockHeight,y={x:t.x%p,y:t.y%m};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:d,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:n.interpolation,alignmentInfo:null,blockWidths:null},n)).pixelBlock:(0,$.us)(f,d,{clipOffset:y,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:g}}fetchRawTile(e,t,i,n){throw new a.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,J.tB)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,U.J)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:n}=this.ioConfig,{range:r,query:s,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=r?{Range:`bytes=${r.from}-${r.to}`}:null;try{return await(0,_.default)(e,{...t,query:{...s,...n},headers:{...a,...o}})}catch(n){if(i>0)return i--,this.request(e,t,i);throw n}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,z.gk)(e,t)}getTileExtentFromTileInfo(e,t,i,n){const r=(0,O.s3)(n.lodAt(e));return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,n.origin,n.spatialReference,n.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:n}=this.rasterInfo;if(!e.tileInfo){const r=[],s=e.maximumPyramidLevel||0;let a=Math.max(n.x,n.y),o=1/.0254*96*a;for(let e=0;e<=s;e++)r.push(new B.Z({level:s-e,resolution:a,scale:o})),a*=2,o*=2;const l=new N.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new M.Z({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,n){const{width:r,height:s,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new N.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==n&&(n=Math.max(0,Math.round(Math.log(Math.max(r,s))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],n);e.storageInfo=new Z.Z({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:n,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,n,r,s=0,a=2){if(1===r.length&&s>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<s;i++)e*=a,t*=a,r.push({x:e,y:t})}const o=[],{x:l,y:c}=n;for(let n=0;n<r.length;n++){const{x:s,y:a}=r[n];o.push({minCol:Math.floor((e.xmin-l+.1*s)/t/s),maxCol:Math.floor((e.xmax-l-.1*s)/t/s),minRow:Math.floor((c-e.ymax+.1*a)/i/a),maxRow:Math.floor((c-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:n}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=n**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,n){const{spatialReference:r,nativeExtent:s,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=n&&null!=c?c.tileSize[0]:a.blockWidth,h=n&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,J.nF)(e,r,i);if(!s.intersects(f))return null;if(t<0||t>o)return null;const d=this.getPyramidPixelSize(t),{x:p,y:m}=d,y=(l.y-f.y)/m/h,g=(f.x-l.x)/p/u,x=Math.min(h-1,Math.floor((y-Math.floor(y))*h)),w=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(y),col:Math.floor(g),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,n,r,s){const[a,o]=s,l=n.x+i*a*e.x,c=l+a*e.x,u=n.y-t*o*e.y,h=u-o*e.y;return new X.Z({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const n=this.rasterInfo.storageInfo.blockBoundary[e];return!n||n.maxRow<t||n.maxCol<i||n.minRow>t||n.minCol>i}async _fetchPixels(e,t,i,n={}){let r=(0,J.Hq)(e);if(r>=2)return{extent:e,pixelBlock:null};const s=this._getSourceDataInfo(e,t,i,n),{pyramidLevel:a,srcResolution:o,srcExtent:l,srcWidth:c,srcHeight:u,ul:h}=s;if(0===c||0===u)return{extent:e,srcExtent:l,pixelBlock:null};const{rasterInfo:f}=this,d=f.transform,p="gcs-shift"===d?.type,m=null!=(0,J.ut)(e.spatialReference);!p&&m||(r=(0,J.Hq)(s.srcExtent,p));const y=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:r},n);if(!y)return{extent:e,srcExtent:l,pixelBlock:null};const g=f.storageInfo,x=a>0?g.pyramidBlockWidth:g.blockWidth,w=a>0?g.pyramidBlockHeight:g.blockHeight;let{x:b,y:I}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[a-1])({x:b,y:I}=e[a-1]);else{const e=t**a;b*=e,I*=e}}const _=f.spatialReference,S=new N.Z({x:b,y:I,spatialReference:_}),R=x===c&&w===u&&h.x%x==0&&h.y%w==0,v=new N.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),T=!e.spatialReference.equals(_),C=_.isGeographic?1e-9:1e-4,{datumTransformation:k}=n;if(!T&&R&&1===y.pixelBlocks.length&&x===t&&w===i&&this._isSameResolution(o,v,C))return{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:y.pixelBlocks[0]};const F=m&&null!=(0,J.ut)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,M=n.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");M&&!this.rasterJobHandler&&await(0,J.zD)();const P=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:v.toJSON(),datumTransformation:k,rasterTransform:d,hasWrapAround:r>0||F,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:M},n):(0,J.Qp)({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:v,datumTransformation:k,rasterTransform:d,hasWrapAround:r>0||F,isAdaptive:!1,includeGCSGrid:M});let O;const D=!n.requestRawData,B={rows:P.spacing[0],cols:P.spacing[1]},Z=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,y.extent.xmin):void 0,{pixelBlocks:z,mosaicSize:A,isPartiallyFilled:E}=y;let H=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:z,srcMosaicSize:A,destDimension:D?{width:t,height:i}:null,coefs:D?P.coefficients:null,sampleSpacing:D?B:null,projectDirections:M,gcsGrid:M?P.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:n.interpolation,alignmentInfo:Z,blockWidths:null},n);({pixelBlock:O,localNorthDirections:H}=e)}else{const e=(0,$.us)(z,A,{alignmentInfo:Z});O=D?(0,$.Uk)(e,{width:t,height:i},P.coefficients,B,n.interpolation):e,M&&P.gcsGrid&&(H=(0,$.Qh)({width:t,height:i},P.gcsGrid),O=(0,V.xQ)(O,this.rasterInfo.dataType,H))}return n.requestRawData||M?{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:O,transformGrid:P,localNorthDirections:H,isPartiallyFilled:E}:{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:O}}async _fetchRawTiles(e,t,i,n){const{origin:r,blockBoundary:s}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h,wrapCount:f}=i;const d=this._getRasterTileAlignmentInfo(e,0);n.buffer&&(l-=n.buffer.cols,c-=n.buffer.rows,u+=2*n.buffer.cols,h+=2*n.buffer.rows);let p=0,m=0,y=0;f&&null!=d&&(({worldColumnCountFromOrigin:m,originColumnOffset:y,rightPadding:p}=d),m*d.blockWidth-p>=l+u&&(p=0));const g=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+p-1)/a),b=Math.floor((c+h+p-1)/o),I=s[e];if(!I)return null;const{minRow:_,minCol:S,maxCol:R,maxRow:v}=I;if(0===f&&(b<_||w<S||x>v||g>R))return null;const T=new Array;let C=!1;const k=null==this.ioConfig.allowPartialFill?n.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=b;t++)for(let i=g;i<=w;i++){let r=i;if(!n.disableWrapAround&&f&&null!=d&&m<=i&&(r=i-m-y),t>=_&&r>=S&&v>=t&&R>=r){const i=this._fetchRawTile(e,t,r,n);k?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const F=await Promise.all(T),M={height:(b-x+1)*o,width:(w-g+1)*a},{spatialReference:P}=this.rasterInfo,O=this.getPyramidPixelSize(e),{x:D,y:B}=O;return{extent:new X.Z({xmin:r.x+g*a*D,xmax:r.x+(w+1)*a*D,ymin:r.y-(b+1)*o*B,ymax:r.y-x*o*B,spatialReference:P}),pixelBlocks:F,mosaicSize:M,isPartiallyFilled:C}}_isSameResolution(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}_fetchRawTile(e,t,i,n){const r=this.rasterInfo.storageInfo.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:s,minCol:a,maxCol:o,maxRow:l}=r;if(t<s||i<a||t>l||i>o)return Promise.resolve(null);const u=H(this.url,n.sliceId),h=`${e}/${t}/${i}`;let f=W(u,n.registryId,h);if(null==f){const r=new AbortController;f=this.fetchRawTile(e,t,i,{...n,signal:r.signal}),q(u,n.registryId,h,f,r),f.catch((()=>j(u,n.registryId,h)))}return n.signal&&(0,c.fu)(n,(()=>{L(u,n.registryId,h)})),f}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if((2!==t||"vector-magdir"!==i)&&"vector-uv"!==i||2!==e?.length||!e[0]?.length)return null;const n=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,s]=e,a=[],o=[];for(let e=0;e<n;e++){const[t,i]=(0,V.Tg)([r[e],s[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=(0,J.P_)(this.rasterInfo)),null==this._rasterTileAlighmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,n={}){const r={datumTransformation:n.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};n.srcResolution&&(r.srcResolution=n.srcResolution,this._updateSourceDataInfo(e,r));const s=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=r,c=a/t,u=o/i,h=l<s&&c*u>=16,f=l===s&&this._requireTooManySrcTiles(a,o,t,i);if(h||f||0===a||0===o){const a=new N.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,J.VO)(a,this.rasterInfo.spatialReference,e,r.datumTransformation);const f=!o||n.srcResolution&&o.x+o.y<n.srcResolution.x+n.srcResolution.y;if(h&&n.srcResolution&&f){const e=Math.round(Math.log(Math.max(c,u))/Math.LN2)-1;if(s-l+3>=e){const t=2**e;o={x:n.srcResolution.x*t,y:n.srcResolution.y*t}}}o&&(r.srcResolution=o,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,n){const{tileInfo:r}=this.rasterInfo.storageInfo;return Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1])>=256||e/i>8||t/n>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,n=i.spatialReference,{srcResolution:r,datumTransformation:s}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,J.kr)(r,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,J.tB)(e,n,s);if(null==c)return;const u=i.transform;u&&(c=u.inverseTransform(c)),t.srcExtent=c;const{x:h,y:f}=i.storageInfo.origin,d=Math.floor((c.xmin-h)/o.x+.1),p=Math.floor((f-c.ymax)/o.y+.1),m=Math.floor((c.xmax-h)/o.x-.1),y=Math.floor((f-c.ymin)/o.y-.1),g=c.width<.1*o.x?0:m-d+1,x=c.height<.1*o.y?0:y-p+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=g,t.srcHeight=x,t.ul={x:d,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:n,pyramidLevel:r,useTransposedTile:s}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[n])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!s){const t=e.pixels.map((e=>e[n])),s={location:i,value:t,pyramidLevel:r},a=this._computeMagDirValues(t.map((e=>[e])));return a?.length&&(s.magdirValue=a.map((e=>e[0]))),s}let l=e.pixels.map((e=>e.slice(n*a,n*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,z.MO)(o,h.transposedVariableName);if(u){const e=(0,z.Ur)(f,h.multidimensionalDefinition,h.timeExtent);l=l.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),f=e.map((e=>f[e]))}const d=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:l,pixelType:e.pixelType};let m;return null!=d&&((0,G.A)(p,d),m=p.mask),{location:i,value:null,dataSeries:f.map(((e,t)=>{const i={value:0===m?.[t]?null:l.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new T.Z({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};(0,n._)([(0,h.Cb)()],Y.prototype,"_rasterTileAlighmentInfo",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],Y.prototype,"_isGlobalWrappableSource",null),(0,n._)([(0,h.Cb)({readOnly:!0})],Y.prototype,"_hasNoneOrGCSShiftTransform",null),(0,n._)([(0,h.Cb)()],Y.prototype,"rasterJobHandler",null),(0,n._)([(0,h.Cb)(v.HQ)],Y.prototype,"url",null),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetName",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"hasUniqueSourceStorageInfo",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"sourceJSON",void 0),Y=(0,n._)([(0,g.j)("esri.layers.support.rasterDatasets.BaseRaster")],Y);const K=Y;let Q=class extends K{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){await this.init();const{rasterFunction:t}=this;this.primaryRasters?.rasters?.length?t.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=t.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((e=>e.rasterJobHandler=this.rasterJobHandler)));const{rasters:i,rasterIds:n}=this.primaryRasters,r=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(r);const s=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:s,rasterIds:n});if(!o.success||0===s.length)throw new a.Z("raster-function:open",`cannot bind the function: ${o.error??""}`);await this.syncJobHandler();const l=s[0];this.hasUniqueSourceStorageInfo=1===s.length||s.slice(1).every((e=>this._hasSameStorageInfo(e,l))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo)}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,n={}){const{rasters:r,rasterIds:s}=this.primaryRasters;let a=!1;const{interpolation:o}=n,l=this.rasterFunction.flatWebGLFunctionChain?.hasSurfaceFunction;!n.requestRawData&&"bilinear"!==o&&l&&(a=1===r.length&&!n.skipRasterFunction,n={...n,interpolation:"bilinear",requestRawData:a});const c=r.map((r=>r.fetchPixels(e,t,i,n))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||n.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(n.skipRasterFunction||h.every((e=>null==e)))return u[0];const d=u.find((e=>null!=e.pixelBlock))?.extent??e,p=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:s}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:s}),{transformGrid:m}=u[0];if(!a||null==p||null==m)return{...u[0],pixelBlock:p};const y={rows:m.spacing[0],cols:m.spacing[1]};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[p],srcMosaicSize:{width:p.width,height:p.height},destDimension:{width:t,height:i},coefs:m.coefficients,sampleSpacing:y,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},n)).pixelBlock:(0,$.Uk)(p,{width:t,height:i},m.coefficients,y,o),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:g}}_hasSameStorageInfo(e,t){const{storageInfo:i,pixelSize:n,spatialReference:r,extent:s}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return n.x===o.x&&n.y===o.y&&r.equals(l)&&s.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Q.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],Q.prototype,"tileType",void 0),(0,n._)([(0,h.Cb)()],Q.prototype,"rasterFunction",void 0),(0,n._)([(0,h.Cb)()],Q.prototype,"primaryRasters",void 0),Q=(0,n._)([(0,g.j)("esri.layers.support.rasterDatasets.FunctionRaster")],Q);const ee=Q;var te=i(67900),ie=i(5847);var ne=i(90036),re=i(15612),se=i(67058),ae=i(72758),oe=i(79681),le=i(23808),ce=i(82971);const ue=o.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),he=e=>{let t=class extends e{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterFunction=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}get tileInfo(){return this.rasterInfo?.storageInfo.tileInfo}set url(e){this._set("url",(0,R.Nm)(e,ue))}set renderer(e){this._set("renderer",e),this.updateRenderer()}async convertVectorFieldData(e,t){if(null==e||!this.rasterInfo)return null;const i=this._rasterJobHandler.instance,n=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:n},t):(0,V.KC)(e,n)}async computeStatisticsHistograms(e,t){e=(0,f.TJ)(oe.Z,e).clone();const{rasterInfo:n}=this,{geometry:r}=e;if(null==r)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let s=r;const{spatialReference:o}=n;r.spatialReference.equals(o)||(await(0,J.zD)(),s="extent"===r.type?(0,J.tB)(r,o):(0,J.Wt)(r,o));const l=e.pixelSize??new N.Z({x:n.pixelSize.x,y:n.pixelSize.y,spatialReference:o}),{extent:c,width:u,height:h}=function(e,t,i,n=!0){const{spatialReference:r}=e,{x:s,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,te.c9)(e.spatialReference),n=(0,te.c9)(t);if(i===n)return e;const r=i/n;return{x:e.x*r,y:e.y*r}}(i,r);let o,l,c;const u="extent"===t.type?t:t.extent;let{xmin:h,xmax:f,ymax:d,ymin:p}=u;const{xmin:m,ymax:y}=e.extent;return n?(h=m+(h>m?s*Math.round((h-m)/s):0),d=y-(d<y?a*Math.round((y-d)/a):0),f=m+(f>m?s*Math.round((f-m)/s):0),p=y-(p<y?a*Math.round((y-p)/a):0),o=new X.Z({xmin:h,ymax:d,xmax:f,ymin:p,spatialReference:r}),l=Math.round(o.width/s),c=Math.round(o.height/a)):(l=Math.floor((f-h)/s+.8),c=Math.floor((d-p)/a+.8),h=m+(h>m?s*Math.floor((h-m)/s+.1):0),d=y-(d<y?a*Math.floor((y-d)/a+.1):0),f=h+l*s,p=d-c*a,o=new X.Z({xmin:h,ymax:d,xmax:f,ymin:p,spatialReference:r})),{extent:o,width:l,height:c}}(n,s,l),d=await this.fetchPixels(c,u,h,{...t,interpolation:"nearest"});if(null==d.pixelBlock)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const p=await async function(e,t,n){if("extent"===n.type)return function(e,t,i){const{width:n,height:r}=e,s=new Uint8Array(n*r),a=t.width/n,o=t.height/r;if(i.width/a<.5||i.height/o<.5)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:d,ymin:p,ymax:m}=i,y=Math.max(l,f),g=Math.min(c,d),x=Math.max(u,p),w=Math.min(h,m),b=.5*a,I=.5*o;if(g-y<b||w-x<I||g<l+b||y>c-b||x>h-I||w<u+I)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});const _=Math.max(0,(y-l)/a),S=Math.min(n,Math.max(0,(g-l)/a)),R=Math.max(0,(h-w)/o),v=Math.min(r,Math.max(0,(h-x)/o)),T=Math.round(_),C=Math.round(S)-1,k=Math.round(R),F=Math.round(v)-1;if(T===C&&_%1>.5&&S%1<.5||k===F&&R%1>.5&&v%1<.5)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});if(0===T&&0===k&&C===n&&F===r)return e;const M=e.mask;for(let e=k;e<=F;e++)for(let t=T;t<=C;t++){const i=e*n+t;s[i]=M?M[i]:255}return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]})}(e,t,n);const{width:r,height:s}=e,a=new Uint8Array(r*s),{contains:o,intersects:l}=await Promise.all([i.e(5837),i.e(1433)]).then(i.bind(i,61433));return l(t,n)?"polyline"===n.type?function(e,t,i){const{width:n,height:r}=e,s=new Uint8Array(n*r),a=t.width/n,o=t.height/r,{xmin:l,ymax:c}=t,{paths:u}=i,h=e.mask;for(let e=0;e<u.length;e++){const t=u[e];for(let e=0;e<t.length-1;e++){const[i,u]=t[e],[f,d]=t[e+1];let p=Math.floor((c-u)/o),m=Math.floor((c-d)/o);if(m<p){const e=p;p=m,m=e}p=Math.max(0,p),m=Math.min(r-1,m);const y=(f-i)/(d-u);for(let e=p;e<=m;e++){const t=e===p?Math.max(u,d):(r+1-e)*o,c=e===m?Math.min(u,d):t-o;let g=d===u?Math.floor((i-l)/a):Math.floor((y*(t-u)+i-l)/a),x=d===u?Math.floor((f-l)/a):Math.floor((y*(c-u)+i-l)/a);if(x<g){const e=g;g=x,x=e}const w=e*n;g=Math.max(0,g),x=Math.min(n-1,x);for(let e=w+g;e<=w+x;e++)s[e]=h?h[e]:255}}}return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]})}(e,t,n):o(n,t)?e:function(e,t,i){if(!e)return e;const{width:n,height:r}=e,s=t.width/n,a=t.height/r,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/s,t=(i.xmax-o)/s,n=(l-i.ymax)/a,r=(l-i.ymin)/a;c=[[[e,n],[e,r],[t,r],[t,n],[e,n]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/s,(l-t)/a]))));const u=document.createElement("canvas");u.width=n,u.height=r;const h=u.getContext("2d");h.fillStyle="#f00",c.forEach((e=>{h.beginPath(),h.moveTo(e[0][0],e[0][1]);for(let t=0;t<e.length;t++)h.lineTo(e[t][0],e[t][1]);h.closePath(),h.fill()}));const f=h.getImageData(0,0,n,r).data,d=e.mask,p=n*r,m=new Uint8Array(p);for(let e=0;e<p;e++)d&&!d[e]||(m[e]=f[4*e+3]>127?255:0);return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:m,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,n):new ie.Z({pixelType:e.pixelType,width:r,height:s,mask:a,maskIsAlpha:!1,pixels:[...e.pixels]})}(d.pixelBlock,c,s),m=this._rasterJobHandler.instance;return m?m.computeStatisticsHistograms({pixelBlock:p},t):(0,re.js)(p)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,le.GE)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;null!=i&&i.length||(i=(0,z.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const n=e.timeExtent||this.timeExtent;if(null!=i&&null!=n&&(null!=n.start||null!=n.end)){i=i.map((e=>e.clone()));const r=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),s=i.find((({dimensionName:e})=>"StdTime"===e));if(!r||!s)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=n,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=r.values){const e=r.values.filter((e=>{if(Array.isArray(e)){if(u===h)return e[0]<=u&&e[1]>=u;const t=e[0]<=u&&e[1]>u||e[0]<h&&e[1]>=h,i=e[0]>=u&&e[1]<=h||e[0]<u&&e[1]>h;return t||i}return u===h?e===u:e>=u&&e<=h}));if(e.length){const t=e.sort(((e,t)=>{const i=Array.isArray(e)?e[0]:e,n=Array.isArray(e)?e[1]:e,r=Array.isArray(t)?t[0]:t,s=Array.isArray(t)?t[1]:t;return u===h?i-r:Math.abs(n-h)-Math.abs(s-h)}))[0];s.values=[t]}else i=null}else if(r.hasRegularIntervals&&r.extent){const[e,t]=r.extent;u>t||h<e?i=null:s.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,z.nb)(i,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:i}}async updateRasterFunction(){if("imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",k.Z.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,i=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:n}=this;if(n){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const r=(0,ne.Ue)(n.rasterFunctionDefinition??n.toJSON(),i),s=new ee({rasterFunction:r});s.rasterJobHandler=this._rasterJobHandler.instance,await s.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=s}else this.raster=t,this._cachedRasterFunctionJson=null;if(this._cachedRendererJson=null,!i&&!n)return;const{bandIds:r}=this,{bandCount:s}=this.raster.rasterInfo,a=r?.length?r.some((e=>e>=s)):s>=3;r&&(a||"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t)return;const{rasterInfo:i}=this.raster,n=(0,z.WY)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),r=n?.name,s=(0,se.ol)({...this.renderer.toJSON(),variableName:r});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(s))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,se.FI)(i,r),t.rendererJSON=s,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=s)}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let n;await this.updateRenderer();const r=this._rasterJobHandler.instance,s=this.bandIds??[];return n=r?await r.symbolize({...e,simpleStretchParams:t,bandIds:s}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:s}),n}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const n=(0,S.C5)(e);return M.Z.create({size:256,spatialReference:e,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,i,n={}){if(r(this),n.requestAsImageElement){const r=this.getTileUrl(e,t,i);return(0,_.default)(r,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then((e=>e.data))}const{rasterInfo:s}=this;if(null!=s.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition){const r=n.tileInfo||s.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,i,r),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer.type&&(n={...n,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,i,n)}async fetchPixels(e,t,i,n={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,n))}async identify(e,t={}){const{raster:i,rasterInfo:n}=this;if(null!=n.multidimensionalInfo&&!(n.hasMultidimensionalTranspose&&((0,z.WU)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const r=this.multidimensionalSubset?.areaOfInterest;if(r&&!r.contains(e))throw new a.Z("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.rasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.rasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.rasterInfo?.multidimensionalInfo;return(0,z.jj)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,z.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new F.Z;return this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{r(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,this.renderer&&this.updateRenderer(),"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){r(this);const{raster:e}=this,t=(0,se.In)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){r(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,se.YD)(t));const i=(0,z.WY)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=i?.name;if(!this.renderer||"override"===e){const e=(0,se.Ob)(t,{bandIds:this.bandIds,variableName:n}),i=t.statistics,r=i&&i.length>0?i[0]:null,s=r?.max??0,a=r?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(s>1e24||a<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const s=(0,se.ol)({...this.renderer.toJSON(),variableName:n}),a=(0,se.FI)(t,n);this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=a):this.symbolizer=new ae.Z({rendererJSON:s,rasterInfo:a});const o=this.symbolizer.bind();if(o.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e)if("raster-colormap"!==t.type)this._configDefaultRenderer("override");else{const e=(0,se.Ob)(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.statistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else ue.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function r(e){if(!e.raster||!e.rasterInfo)throw new a.Z("imagery-tile","no raster")}return(0,n._)([(0,h.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_cachedRasterFunctionJson",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_compatibleFullExtent",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,n._)([(0,h.Cb)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,n._)([(0,h.Cb)()],t.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)({type:[T.Z],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,n._)([(0,h.Cb)({type:C.Z,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"raster",void 0),(0,n._)([(0,h.Cb)({type:k.Z})],t.prototype,"rasterFunction",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:ce.Z,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,n._)([(0,h.Cb)({json:{read:!1}})],t.prototype,"tileInfo",null),(0,n._)([(0,h.Cb)(v.HQ)],t.prototype,"url",null),(0,n._)([(0,h.Cb)({types:s.dr})],t.prototype,"renderer",null),(0,n._)([(0,h.Cb)()],t.prototype,"symbolizer",void 0),t=(0,n._)([(0,g.j)("esri.layers.ImageryTileMixin")],t),t};var fe=i(38009),de=i(16859),pe=i(34760),me=i(72965),ye=i(28294),ge=i(1231),xe=i(69608),we=i(25972),be=i(20095);function Ie(e){const t=e.fields,i=e.records,n=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",r=[{name:n,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),s=r.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[n]=o++,l=1;l<s.length;l++)t[s[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:r,features:a}}class _e{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const n=t.getUint32(4,!0),r=t.getUint16(8,!0),s=t.getUint16(10,!0),a={version:i,recordCount:n,headerByteCount:r,recordByteCount:s};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,be.f)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<n&&e.byteLength-o>s;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,be.f)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const n=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(n.substring(0,4),10),parseInt(n.substring(4,6),10)-1,parseInt(n.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=s}}return{header:a,fields:l,records:c,recordSet:Ie({fields:l,records:c})}}}var Se=i(87521),Re=i(74889);const ve=new Map;ve.set("int16","esriFieldTypeSmallInteger"),ve.set("int32","esriFieldTypeInteger"),ve.set("int64","esriFieldTypeInteger"),ve.set("float32","esriFieldTypeSingle"),ve.set("float64","esriFieldTypeDouble"),ve.set("text","esriFieldTypeString");let Te=class extends K{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(t))throw new a.Z("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:n}=this._parseHeader(t);if("thematic"===n.dataType){const e=await this._fetchAuxiliaryInformation();n.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",n),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,n={}){const{transposeInfo:r}=this.rasterInfo.storageInfo,{transposedVariableName:s}=n,a=!(!r||!s),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,n.multidimensionalDefinition,s),c=this._getIndexRecordFromBundle(t,i,a),u=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:n.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,c);if(0===f.recordSize)return null;const d=await this.request(l,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:n.signal});if(!d)return null;const[p,m]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:p,height:m,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,histograms:n,colormap:r,blockWidth:s,blockHeight:a,firstPyramidLevel:o,maximumPyramidLevel:l}=e,c=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),u=e.extent.spatialReference,h=e.geodataXform?.spatialReference,f=new ce.Z(u?.wkid||u?.wkt?u:h);let d=new X.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const p=new N.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),m=Math.round((d.xmax-d.xmin)/p.x),y=Math.round((d.ymax-d.ymin)/p.y),g=this._parseTransform(e.geodataXform),x=g?d:null;g&&(d=g.forwardTransform(d),p.x=(d.xmax-d.xmin)/m,p.y=(d.ymax-d.ymin)/y);const w=e.properties??{},b=e.format.toLowerCase().replace("cache/",""),I=new N.Z(e.origin.x,e.origin.y,f);let _,S,R,v;if(r&&r.colors)for(_=[],S=0;S<r.colors.length;S++)R=r.colors[S],v=r.values?r.values[S]:S,_.push([v,255&R,R<<16>>>24,R<<8>>>24,R>>>24]);const T=e.LODInfos,C=[];for(S=0;S<T.levels.length;S++)C.push(new B.Z({level:T.levels[S],resolution:T.resolutions[S],scale:96/.0254*T.resolutions[S]}));const k=new M.Z({dpi:96,lods:C,format:b,origin:I,size:[s,a],spatialReference:f}),F={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},P=[{maxCol:Math.ceil(m/s)-1,maxRow:Math.ceil(y/a)-1,minCol:0,minRow:0}];let O=2;if(l>0)for(S=0;S<l;S++)P.push({maxCol:Math.ceil(m/O/s)-1,maxRow:Math.ceil(y/O/a)-1,minCol:0,minRow:0}),O*=2;const D=e.mdInfo;let z=null;if(D&&w._yxs){const e=w._yxs;z={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:F,rasterInfo:new we.Z({width:m,height:y,pixelType:t,bandCount:i,extent:d,nativeExtent:x,transform:g,spatialReference:f,pixelSize:p,keyProperties:w,statistics:c,histograms:n,multidimensionalInfo:D,colormap:_,storageInfo:new Z.Z({blockWidth:s,blockHeight:a,pyramidBlockWidth:s,pyramidBlockHeight:a,origin:I,tileInfo:k,transposeInfo:z,firstPyramidLevel:o,maximumPyramidLevel:l,blockBoundary:P})})}}_parseTransform(e){if(!(0,Se.j)(e))throw new a.Z("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,Se.c)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new a.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),n=await Promise.all([t,i]);let r;if(n[0]){let e=n[0].fields;const t=n[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":ve.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(r={fields:e,features:i})}}return!r&&n[1]&&(r=_e.parse(n[1]).recordSet),Re.Z.fromJSON(r)}_buildCacheFilePath(e,t,i,n,r){const s=this._getPackageSize(!!r),a=Math.floor(t/s)*s,o=Math.floor(i/s)*s,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=n?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!r){f=u.variables.find((e=>e.name===h.variableName)).dimensions[0].values.indexOf(h.values[0]).toString(16);const e=4-f.length;for(let t=0;t<e;t++)f="0"+f;f="S"+f}const d=this._getVariableFolderName(r||h.variableName);return`${this.url}/_alllayers/${d}/${f}/${c}/${l}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&null!=t?t.packetSize??0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:i}=t;return e&&null!=i?i.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replace(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,i=!1){const n=this._getPackageSize(i),r=n*(e%n)+t%n;if(r<0)throw new Error("Invalid level / row / col");return 20+r*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let n,r=0;for(n=0;n<5;n++)r|=(255&i[n])<<8*n;const s=0xffffffffff&r;for(r=0,n=5;n<8;n++)r|=(255&i[n])<<8*(n-5);return{position:s,recordSize:0xffffffffff&r}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,n._)([(0,h.Cb)({readOnly:!0})],Te.prototype,"storageInfo",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),Te=(0,n._)([(0,g.j)("esri.layers.support.rasterDatasets.CloudRaster")],Te);const Ce=Te;let ke=class extends K{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const t=this.data,{pixelBlock:i,statistics:n,histograms:r,name:s,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:h}=i,f=t.extent??new X.Z({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new ce.Z({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,p={x:f.width/c,y:f.height/u},m=new we.Z({width:c,height:u,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:p,spatialReference:f.spatialReference,bandCount:i.pixels.length,keyProperties:a||{},statistics:n,isPseudoSpatialReference:d,histograms:r});this.createRemoteDatasetStorageInfo(m,512,512),this._set("rasterInfo",m),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=s,this.url="/InMemory/"+s}fetchRawTile(e,t,i,n={}){const r=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(r)}async _buildInMemoryRaster(e,t,i){const n=this.rasterInfo.storageInfo.maximumPyramidLevel,r=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n},i):Promise.resolve((0,$.Vl)(e,t,n)),s=null!=this.rasterInfo.statistics,o=null!=this.rasterInfo.histograms,l=s?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,re.Hv)(e)),u=await(0,c.as)([r,l]);if(!u[0].value&&u[1].value)throw new a.Z("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=u[0].value,s||(this.rasterInfo.statistics=u[1].value?.statistics),o||(this.rasterInfo.histograms=u[1].value?.histograms)}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],ke.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],ke.prototype,"data",void 0),ke=(0,n._)([(0,g.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],ke);const Fe=ke;function Me(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=[];if(t){const r=Me(e,i);for(let e=0;e<r.length;e++)Me(r[e],t).forEach((e=>n.push(e)));return n}const r=e.getElementsByTagNameNS("*",i);if(!r||0===r.length)return[];for(let e=0;e<r.length;e++)n.push(r[e]||r.item(e));return n}function Pe(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=Me(e,i);return n.length>0?t?Pe(n[0],t):n[0]:null}function Oe(e,t=null){const i=t?Pe(e,t):e;let n;return i?(n=i.textContent||i.nodeValue,n?n.trim():null):null}function De(e,t){return function(e,t){const i=Me(e,t),n=[];let r;for(let e=0;e<i.length;e++)r=i[e].textContent||i[e].nodeValue,r&&(r=r.trim(),""!==r&&n.push(r));return n}(e,t).map((e=>Number(e)))}function Be(e,t){const i=Oe(e,t);return Number(i)}function Ze(e,t){const i=e?.nodeName?.toLowerCase(),n=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===n}var ze=i(87390);function Je(e,t){if(!e||!t)return null;const i=[];for(let n=0;n<e.length;n++)i.push(e[n]),i.push(t[n]);return i}function Ne(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new ce.Z({wkid:t});if((e=String(e)).startsWith("COMPD_CS")){if(!e.includes("VERTCS")||!e.includes("GEOGCS")&&!e.startsWith("PROJCS"))return null;const i=e.indexOf("VERTCS"),n=e.indexOf("PROJCS"),r=n>-1?n:e.indexOf("GEOGCS");if(-1===r)return null;const s=e.slice(r,e.lastIndexOf("]",i)+1).trim(),a=e.slice(i,e.lastIndexOf("]")).trim();t=Ae(s);const o=new ce.Z(t?{wkid:t}:{wkt:s}),l=Ae(a);return l&&(o.vcsWkid=l),o}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=Ae(e),new ce.Z(0!==t?{wkid:t}:{wkt:e})):null}function Ae(e){const t=e.replace(/\]/g,"[").replace(/\"/g,"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),n=i[0]?.toLowerCase();if(("epsg"===n||"esri"===n)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Ee(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(Ze(e,"SRS")){if(!t.spatialReference){const i=Oe(e);t.spatialReference=Ne(i)}}else if(Ze(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:n}=function(e){const t=Pe(e,"GeodataXform"),i=Ne(Be(t,"SpatialReference/WKID")||Oe(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const n=Be(t,"PolynomialOrder")??1,r=De(t,"CoeffX/Double"),s=De(t,"CoeffY/Double"),a=De(t,"InverseCoeffX/Double"),o=De(t,"InverseCoeffY/Double"),l=Je(r,s),c=Je(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new ze.Z({spatialReference:i,polynomialOrder:n,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=n,t.spatialReference||(t.spatialReference=i)}else Me(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=Oe(e)));else if(Ze(e,"PAMRasterBand")){const i=function(e){const t=Be(e,"NoDataValue"),i=Pe(e,"Histograms/HistItem"),n=Be(i,"HistMin"),r=Be(i,"HistMax"),s=Be(i,"BucketCount"),a=Oe(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;Me(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const h=Be(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=n&&null!=r?{min:n,max:r,size:s||a.length,counts:a}:null,sourceBandIndex:h,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(d.pC):null;const n=!!i[0].histogram;t.histograms=n?i.map((e=>e.histogram)).filter(d.pC):null}return t}let He=class extends K{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:n,histograms:r,transform:s}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new ce.Z({wkid:3857})),r?.length&&null==n&&(n=(0,re.Oh)(r));const{width:o,height:l}=t;let c=new X.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=s?s.forwardTransform(c):c;let h=!0;if(s){const e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,c=u)}const f=new Fe({data:{extent:u,nativeExtent:c,transform:s,pixelBlock:t,statistics:n,histograms:r,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),f.data=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,n={}){return this._inMemoryRaster.fetchRawTile(e,t,i,n)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,U.y)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new a.Z("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const n=i.toLowerCase(),r="gif"===n||"bmp"===n||!(0,p.Z)("ios"),s=await this.decodePixelBlock(t,{format:n,useCanvas:r,hasNoZlibMask:!0});if(null==s)throw new a.Z("image-aux-raster:open","the data cannot be decoded");return s}async _fetchAuxiliaryData(e){const t=e?.signal,i=this.ioConfig.skipExtensions??[],n=i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),r=this.datasetFormat,s="JPG"===r?"jgw":"PNG"===r?"pgw":"BMP"===r?"bpw":null,a=s&&i.includes(s)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+s,{responseType:"text",signal:t}),o=await(0,c.as)([n,a]);if(t?.aborted)throw(0,c.zE)();const l=Ee(o[0].value?.data);if(!l.transform){const e=o[1].value?o[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;l.transform=6===e?.length?new ze.Z({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return l}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),He=(0,n._)([(0,g.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],He);const Le=He;var We=i(17452),qe=i(45322),je=i(28589),Ge=i(29680),Ue=i(26059);let $e=class extends K{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const t=e&&e.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const n=i.data;if(this.sourceJSON=n,!n)throw new a.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!n.tileInfo)throw new a.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=n.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(n.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===n.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=n.name?.slice(n.name.indexOf("/")+1)??"";const r=await this._fetchRasterInfo({signal:t});if(null==r)throw new a.Z("image-server-raster:open","cannot initialize image service");const s="Map"===this.tileType?(0,qe.d)(n.tileInfo,n):M.Z.fromJSON(n.tileInfo);(0,O.O3)(s);const[o,l]=this._computeMinMaxLOD(r,s),{extent:c,pixelSize:u}=r,h=.5/r.width*u.x,f=Math.max(u.x,u.y),{lods:d}=s;("Map"!==this.tileType&&0!==n.maxScale||Math.abs(u.x-u.y)>h||!d.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,r.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),r.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const p=o.level-l.level,[m,y]=s.size,g=[],x=[];d.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&g.push({x:e.resolution,y:e.resolution}),t<d.length-1&&x.push(Math.round(10*e.resolution/d[t+1].resolution)/10)})),g.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,m,y,s.origin,g,p),b=g.length>1?g.slice(1):null;let I;n.transposeInfo&&(I={tileSize:[n.transposeInfo.rows,n.transposeInfo.cols],packetSize:r.keyProperties?._yxs.PacketSize??0});const _=x.length<=1||x.length>=3&&x.slice(0,x.length-1).every((e=>e===x[0]))?x[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/p))/10;if(r.storageInfo=new Z.Z({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:b,pyramidScalingFactor:_,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,transposeInfo:I,blockBoundary:w}),this._fixGCSShift(r),this._set("rasterInfo",r),n.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:r.storageInfo.tileInfo,parsedUrl:(0,We.mN)(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new je.y({layer:e})}}async fetchRawTile(e,t,i,n={}){const{storageInfo:r,extent:s}=this.rasterInfo,{transposeInfo:a}=r,o=null!=a&&!!n.transposedVariableName;if(this._slices&&!o&&null==n.sliceId)return null;const l=o?0:r.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:n.transposedVariableName}:{sliceId:n.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:n.signal});if(!h)return null;const f=o?a.tileSize:r.tileInfo.size,d=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==d)return null;const p=r.blockBoundary[e];if("jpg"!==r.compression||i>p.minCol&&i<p.maxCol&&t>p.minRow&&t<p.maxRow)return d;const{origin:m,blockWidth:y,blockHeight:g}=r,{x,y:w}=this.getPyramidPixelSize(e),b=Math.round((s.xmin-m.x)/x)%y,I=Math.round((s.xmax-m.x)/x)%y||y,_=Math.round((m.y-s.ymax)/w)%g,S=Math.round((m.y-s.ymin)/w)%g||g,R=i===p.minCol?b:0,v=t===p.minRow?_:0,T=i===p.maxCol?I:y,C=t===p.maxRow?S:g;return(0,$.pW)(d,{x:R,y:v},{width:T-R,height:C-v}),d}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),n=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,n]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let n=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let s=r-n+this._levelOffset;const a=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,n++,i=this.identifyPixelLocation(a,n,t.datumTransformation),null===i)return null}return-1===s||null==i?null:n}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),n=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=ce.Z.fromJSON(t.spatialReference||e.spatialReference),s=new N.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new we.Z({width:i,height:n,bandCount:3,extent:X.Z.fromJSON(e),spatialReference:r,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,n=(0,Ue.g)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,s=await Promise.all([n,r]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new Ge.Z,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,n=.5/e.width*i.x,{lods:r}=t,s=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=r[0].level,[s,a];if("Raster"===o)return[r.find((e=>e.resolution===i.x))??s,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=s;c>0&&(u=r.find((e=>Math.abs(e.scale-c)<n)),u||(u=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??s));let h=a;return l>0&&(h=r.find((e=>Math.abs(e.scale-l)<n))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],$e.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],$e.prototype,"tileType",void 0),$e=(0,n._)([(0,g.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],$e);const Ve=$e;var Xe=i(48279);const Ye=new Map;Ye.set("Int8","s8"),Ye.set("UInt8","u8"),Ye.set("Int16","s16"),Ye.set("UInt16","u16"),Ye.set("Int32","s32"),Ye.set("UInt32","u32"),Ye.set("Float32","f32"),Ye.set("Float64","f32"),Ye.set("Double64","f32");const Ke=new Map;Ke.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Ke.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Ke.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Ke.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let Qe=class extends K{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:n,files:r}=this._parseHeader(i.data);if(-1===this.ioConfig.skipExtensions?.indexOf("aux.xml")){const t=await this._fetchAuxiliaryData(e);null!=t&&(n.statistics=t.statistics??n.statistics,n.histograms=t.histograms,t.histograms&&null==n.statistics&&(n.statistics=(0,re.Oh)(t.histograms)))}this._set("rasterInfo",n),this._files=r;const s=await this.request(r.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(s.data);const{blockWidth:a,blockHeight:o}=this.rasterInfo.storageInfo,l=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,h=[],f=this._getBandSegmentCount();let d=0,p=-1;for(;d<this._storageIndex.length;){p++;const e=Math.ceil(c/a/l**p)-1,t=Math.ceil(u/o/l**p)-1;d+=(e+1)*(t+1)*f*4,h.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=h,p>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=p),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){const{blockWidth:r,blockHeight:s,blockBoundary:a}=this.rasterInfo.storageInfo,o=a[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(r*s);return new ie.Z({width:r,height:s,pixels:null,mask:e,validPixelCount:0})}const{bandIds:d}=this.ioConfig,p=this._getBandSegmentCount(),m=[];let y=0;for(y=0;y<p;y++)d&&!d.includes(y)||m.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:n.signal}));const g=await Promise.all(m),x=g.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x);let b=0;for(y=0;y<p;y++)w.set(new Uint8Array(g[y].data),b),b+=g[y].data.byteLength;const I=Ke.get(this.rasterInfo.storageInfo.compression).decoderFormat,_=await this.decodePixelBlock(w.buffer,{width:r,height:s,format:I,planes:d?.length||l,pixelType:c});if(null==_)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==I&&!_.mask&&(S=S[0],null!=S)){const e=_.width*_.height,t=new Uint8Array(e);if(Math.abs(S)>1e24)for(y=0;y<e;y++)Math.abs((_.pixels[0][y]-S)/S)>1e-6&&(t[y]=1);else for(y=0;y<e;y++)_.pixels[0][y]!==S&&(t[y]=1);_.mask=t}let R=0,v=0;if(h!==r||f!==s){let e=_.mask;if(e)for(y=0;y<s;y++)if(v=y*r,y<f)for(R=h;R<r;R++)e[v+R]=0;else for(R=0;R<r;R++)e[v+R]=0;else for(e=new Uint8Array(r*s),_.mask=e,y=0;y<f;y++)for(v=y*r,R=0;R<h;R++)e[v+R]=1}return _}_parseIndex(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,n,r,s,a;if(Xe.f){for(i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),n=new Uint8Array(r),s=0;s<e.byteLength/4;s++)for(a=0;a<4;a++)n[4*s+a]=i[4*s+3-a];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return Ke.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:n,blockHeight:r,pyramidScalingFactor:s}=this.rasterInfo.storageInfo,{width:a,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,h,f=0,d=0;for(h=0;h<e;h++)d=s**h,c=Math.ceil(a/n/d),u=Math.ceil(o/r/d),f+=c*u;d=s**e,c=Math.ceil(a/n/d),u=Math.ceil(o/r/d),f+=t*c+i,f*=4*l;const p=this._storageIndex.subarray(f,f+4*l);let m=0,y=0;const g=[];for(let e=0;e<l;e++)m=p[4*e]*2**32+p[4*e+1],y=m+p[4*e+2]*2**32+p[4*e+3],g.push({from:m,to:y});return{ranges:g,actualTileWidth:i<c-1?n:Math.ceil(a/d)-n*(c-1),actualTileHeight:t<u-1?r:Math.ceil(o/d)-r*(u-1)}}_parseHeader(e){const t=Pe(e,"MRF_META/Raster");if(!t)throw new a.Z("mrf:open","not a valid MRF format");const i=Pe(t,"Size"),n=parseInt(i.getAttribute("x"),10),r=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),o=(Oe(t,"Compression")||"none").toLowerCase();if(!Ke.has(o))throw new a.Z("mrf:open","currently does not support compression "+o);const l=Oe(t,"DataType")||"UInt8",c=Ye.get(l);if(null==c)throw new a.Z("mrf:open","currently does not support pixel type "+l);const u=Pe(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),d=Pe(t,"DataValues");let p,m;if(d&&(m=d.getAttribute("NoData"),null!=m&&(p=m.trim().split(" ").map((e=>parseFloat(e))))),Pe(e,"MRF_META/CachedSource"))throw new a.Z("mrf:open","currently does not support MRF referencing other data files");const y=Pe(e,"MRF_META/GeoTags"),g=Pe(y,"BoundingBox");let x,w=!1;if(null!=g){const e=parseFloat(g.getAttribute("minx")),t=parseFloat(g.getAttribute("miny")),i=parseFloat(g.getAttribute("maxx")),n=parseFloat(g.getAttribute("maxy")),r=Oe(y,"Projection")||"";let s=ce.Z.WGS84;if("LOCAL_CS[]"!==r)if(r.toLowerCase().startsWith("epsg:")){const e=Number(r.slice(5));isNaN(e)||0===e||(s=new ce.Z({wkid:e}))}else s=Ne(r)??ce.Z.WGS84;else w=!0,s=new ce.Z({wkid:3857});x=new X.Z(e,t,i,n),x.spatialReference=s}else w=!0,x=new X.Z({xmin:-.5,ymin:.5-r,xmax:n-.5,ymax:.5,spatialReference:new ce.Z({wkid:3857})});const b=Pe(e,"MRF_META/Rsets"),I=parseInt(b&&b.getAttribute("scale")||"2",10),_=x.spatialReference,S=new Z.Z({origin:new N.Z({x:x.xmin,y:x.ymax,spatialReference:_}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:I}),R=new N.Z({x:x.width/n,y:x.height/r,spatialReference:_}),v=new we.Z({width:n,height:r,extent:x,isPseudoSpatialReference:w,spatialReference:_,bandCount:s,pixelType:c,pixelSize:R,noDataValue:p,storageInfo:S}),T=Oe(e,"datafile"),C=Oe(e,"IndexFile");return{rasterInfo:v,files:{mrf:this.url,index:C||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Ke.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}};(0,n._)([(0,h.Cb)()],Qe.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],Qe.prototype,"_storageIndex",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Qe.prototype,"datasetFormat",void 0),Qe=(0,n._)([(0,g.j)("esri.layers.support.rasterIO.MRFRaster")],Qe);const et=Qe;var tt=i(94793),it=i(9832);const nt=(e,t)=>e.get(t)?.values,rt=(e,t)=>e.get(t)?.values?.[0];let st=class extends K{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new a.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:n,firstIFDPos:r,isBigTiff:s}=(0,tt.cK)(i),o=[];await this._readIFDs(o,i,n,r,0,s?8:4,t);const{imageInfo:l,rasterInfo:c}=this._parseIFDs(o),u=(0,tt.ee)(o),h=(0,tt.I7)(o);if(this._headerInfo={littleEndian:n,isBigTiff:s,ifds:o,pyramidIFDs:u,maskIFDs:h,...l},this._set("rasterInfo",c),!l.isSupported)throw new a.Z("tiffraster:open","this tiff is not supported: "+l.message);if(!l.tileWidth)throw new a.Z("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");const{skipExtensions:f=[]}=this.ioConfig;if(!f.includes("aux.xml")){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,c)}f.includes("vat.dbf")||1!==c.bandCount||"u8"!==c.pixelType||(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const r=await this._fetchRawTiffTile(e,t,i,!1,n);if(null!=r&&this._headerInfo.hasMaskBand){const s=await this._fetchRawTiffTile(e,t,i,!0,n);null!=s&&s.pixels[0]instanceof Uint8Array&&(r.mask=s.pixels[0])}return r}_parseIFDs(e){const t=(0,tt.FI)(e),{width:i,height:n,tileWidth:r,tileHeight:s,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:d,affine:p,metadata:m}=t;let y=Ne(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),g=!!t.isPseudoGeographic;null==y&&(g=!0,y=new ce.Z({wkid:3857}));const x=new X.Z({...t.extent,spatialReference:y}),w=new N.Z(x?{x:x.xmin,y:x.ymax,spatialReference:y}:{x:0,y:0}),b=new Z.Z({blockWidth:r,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:d}),I=new N.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),_=m?{BandProperties:m.bandProperties,DataType:m.dataType}:{};let S=null;const R=rt(e[0],"PHOTOMETRICINTERPRETATION"),v=nt(e[0],"COLORMAP");if(R<=3&&v?.length>3&&v.length%3==0){S=[];const e=v.length/3;for(let t=0;t<e;t++)S.push([t,v[t]>>>8,v[t+e]>>>8,v[t+2*e]>>>8])}const T=new we.Z({width:i,height:n,bandCount:a,pixelType:o,pixelSize:I,storageInfo:b,spatialReference:y,isPseudoSpatialReference:g,keyProperties:_,extent:x,colormap:S,statistics:m?m.statistics:null});return p?.length&&(T.nativeExtent=new X.Z({xmin:-.5,ymin:.5-n,xmax:i-.5,ymax:.5,spatialReference:y}),T.transform=new ze.Z({polynomialOrder:1,forwardCoefficients:[p[2]+p[0]/2,p[5]-p[3]/2,p[0],p[3],-p[1],-p[4]]}),T.extent=T.transform.forwardTransform(T.nativeExtent),T.pixelSize=new N.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),b.origin.x=-.5,b.origin.y=.5),{imageInfo:t,rasterInfo:T}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,re.Oh)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new N.Z({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}async _readIFDs(e,t,i,n,r,s=4,a){if(!n)return null;(n>=t.byteLength||n<0)&&(t=(await this.request(this.url,{range:{from:n+r,to:n+r+this._bufferSize},responseType:"array-buffer",signal:a})).data,r=n+r,n=0);const o=await this._readIFD(t,i,n,r,it.Z.TIFF_TAGS,s,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-r,r,s,a)}async _readIFD(e,t,i,n,r=it.Z.TIFF_TAGS,s=4,a){if(!e)return null;const o=(0,tt.vr)(e,t,i,n,r,s);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const r=i.map((e=>e.offlineOffsetSize)).filter(d.pC),s=Math.min.apply(null,r.map((e=>e[0])));if(Math.min.apply(null,r.map((e=>e[0]+e[1])))-s<=this._bufferSize){const{data:r}=await this.request(this.url,{range:{from:s,to:s+this._bufferSize},responseType:"array-buffer",signal:a});e=r,n=s,i.forEach((i=>(0,tt.Dq)(e,t,i,n)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),r=i?.values;if(r&&r.length>4){const s=r[0]+"."+r[1]+"."+r[2],o=await this._readIFD(e,t,i.valueOffset+6-n,n,it.Z.GEO_KEYS,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[s]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:n,to:n+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,n,it.Z.TIFF_TAGS,4,a)}}async _fetchRawTiffTile(e,t,i,n,r={}){const s=this._getTileLocation(e,t,i,n);if(!s)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=s,u=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:r.signal}))),h=await Promise.all(u),f=h.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),d=1===h.length?h[0].data:new ArrayBuffer(f),p=[0],m=[0];if(h.length>1){const e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){const n=h[t].data;e.set(new Uint8Array(n),i),p[t]=i,i+=n.byteLength,m[t]=n.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:p,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let w,b,I;if(o!==y||l!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(I=w*y,w<l)for(b=o;b<y;b++)e[I+b]=0;else for(b=0;b<y;b++)e[I+b]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<l;w++)for(I=w*y,b=0;b<o;b++)e[I+b]=1}return x}_getTileLocation(e,t,i,n=!1){const{firstPyramidLevel:r,blockBoundary:s}=this.rasterInfo.storageInfo,a=0===e?0:e-(r-1),{_headerInfo:o}=this;if(!o)return null;const l=n?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,tt.If)(l,o),u=nt(l,"TILEOFFSETS");if(void 0===u)return null;const h=nt(l,"TILEBYTECOUNTS"),{minRow:f,minCol:d,maxRow:p,maxCol:m}=s[a];if(t>p||i>m||t<f||i<d)return null;const y=rt(l,"IMAGEWIDTH"),g=rt(l,"IMAGELENGTH"),x=rt(l,"TILEWIDTH"),w=rt(l,"TILELENGTH"),b=c?this.rasterInfo.bandCount:1,I=b*t*(m+1)+i,_=[{from:u[I],to:u[I+b-1]+h[I+b-1]-1}];if(c){let e=!0;for(let t=0;t<b;t++)if(u[I+t]+h[I+t]!==u[I+t+1]){e=!1;break}if(!e)for(let e=0;e<b;e++)_[e]={from:u[I+e],to:u[I+e]+h[I+e]-1}}const S=u[I],R=h[I];return null==S||null==R?null:{ranges:_,ifd:l,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===p&&g%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=_e.parse(t);return i?.recordSet?Re.Z.fromJSON(i.recordSet):null}catch{return null}}};(0,n._)([(0,h.Cb)()],st.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],st.prototype,"_headerInfo",void 0),(0,n._)([(0,h.Cb)()],st.prototype,"_bufferSize",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],st.prototype,"datasetFormat",void 0),st=(0,n._)([(0,g.j)("esri.layers.support.rasterDatasets.TIFFRaster")],st);const at=st,ot=new Map;ot.set("CRF",{desc:"Cloud Raster Format",constructor:Ce}),ot.set("MRF",{desc:"Meta Raster Format",constructor:et}),ot.set("TIFF",{desc:"GeoTIFF",constructor:at}),ot.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Ve}),ot.set("JPG",{desc:"JPG Raster Format",constructor:Le}),ot.set("PNG",{desc:"PNG Raster Format",constructor:Le}),ot.set("GIF",{desc:"GIF Raster Format",constructor:Le}),ot.set("BMP",{desc:"BMP Raster Format",constructor:Le});class lt{static get supportedFormats(){const e=new Set;return ot.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:n}=e;let r=e.datasetFormat;null==r&&t.lastIndexOf(".")&&(r=t.slice(t.lastIndexOf(".")+1).toUpperCase()),"OVR"===r||"TIF"===r?r="TIFF":"JPG"!==r&&"JPEG"!==r&&"JFIF"!==r||(r="JPG"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(r="RasterTileServer");const s={url:t,sourceJSON:n,datasetFormat:r,ioConfig:i??{bandIds:null,sampling:null}};let o,l;if(r&&this.supportedFormats.has(r)){if("CRF"===r&&!i?.enableCRF)throw new a.Z("rasterfactory:open",`cannot open raster: ${t}`);return o=ot.get(r).constructor,l=new o(s),await l.open({signal:e.signal}),l}if(r)throw new a.Z("rasterfactory:open","not a supported format "+r);const c=Array.from(ot.keys());let u=0;const h=()=>(r=c[u++],r&&("CRF"!==r||i?.enableCRF)?(o=ot.get(r).constructor,l=new o(s),l.open({signal:e.signal}).then((()=>l)).catch((()=>h()))):null);return h()}static register(e,t,i){ot.has(e.toUpperCase())||ot.set(e.toUpperCase(),{desc:t,constructor:i})}}var ct=i(32163);let ut=class extends((0,b.h)((0,me.M)((0,fe.q)((0,de.I)((0,I.N)(he((0,ye.n)((0,w.Y)((0,pe.Q)((0,l.R)(x.Z))))))))))){constructor(...e){super(...e),this._primaryRasters=null,this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.r9).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[new ge.Z({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"})];const{rasterInfo:t}=this,i=t?.attributeTable,n=null!=i?i.fields:null;if(n){const t=n.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));e=e.concat(t)}const r=t?.dataType,s=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=s){const t=s.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new ge.Z({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new ge.Z({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}set renderer(e){this._set("renderer",e),this.updateRenderer()}readRenderer(e,t,i){const n=t&&t.layerDefinition&&t.layerDefinition.drawingInfo&&t.layerDefinition.drawingInfo.renderer,r=(0,s.ij)(n,i)||void 0;if(null!=r)return r}createPopupTemplate(e){return(0,ct.eZ)({fields:this.rasterFields,title:this.title},e)}async generateRasterInfo(e,t){if(!(e=(0,f.TJ)(k.Z,e)))return this._primaryRasters[0].rasterInfo;try{const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const n=(0,ne.Ue)(e.toJSON(),i),r=new ee({rasterFunction:n});return await r.open(t),r.rasterInfo}catch{return null}}write(e,t){const{raster:i}=this;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new a.Z("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(t=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:t}=this,i=[this.url];t&&(0,ne.G8)(t.toJSON(),i);const n=await Promise.all(i.map((t=>lt.open({url:t,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),r=n.findIndex((e=>null==e));if(r>-1)throw new a.Z("imagery-tile-layer:open",`cannot open raster: ${i[r]}`);if(this._primaryRasters=n,t){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((t=>e[t.url]=t));const i=(0,ne.Ue)(t.rasterFunctionDefinition??t.toJSON(),e),r=new ee({rasterFunction:i});try{await r.open(),this.raster=r}catch(e){const t=o.Z.getLogger(this.declaredClass);e instanceof a.Z&&t.error("imagery-tile-layer:open",e.message),t.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=n[0]}}else this.raster=n[0]}const i=this.raster.rasterInfo;if(!i)throw new a.Z("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,u.YP)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};(0,n._)([(0,h.Cb)()],ut.prototype,"_primaryRasters",void 0),(0,n._)([(0,h.Cb)({type:[f.z8],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],ut.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,m.J)(xe.c)],ut.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)(v.rn)],ut.prototype,"legendEnabled",void 0),(0,n._)([(0,h.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ut.prototype,"isReference",void 0),(0,n._)([(0,h.Cb)({type:["show","hide"]})],ut.prototype,"listMode",void 0),(0,n._)([(0,h.Cb)({json:{read:!0,write:!0}})],ut.prototype,"blendMode",void 0),(0,n._)([(0,h.Cb)()],ut.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],ut.prototype,"version",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{read:!1}})],ut.prototype,"type",void 0),(0,n._)([(0,h.Cb)({type:["ArcGISTiledImageServiceLayer"]})],ut.prototype,"operationalLayerType",void 0),(0,n._)([(0,h.Cb)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],ut.prototype,"popupEnabled",void 0),(0,n._)([(0,h.Cb)({type:r.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],ut.prototype,"popupTemplate",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],ut.prototype,"defaultPopupTemplate",null),(0,n._)([(0,h.Cb)({readOnly:!0,type:[ge.Z]})],ut.prototype,"fields",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:[ge.Z]})],ut.prototype,"rasterFields",null),(0,n._)([(0,h.Cb)({types:s.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:s.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],ut.prototype,"renderer",null),(0,n._)([(0,y.r)("renderer")],ut.prototype,"readRenderer",null),ut=(0,n._)([(0,g.j)("esri.layers.ImageryTileLayer")],ut);const ht=ut},11282:(e,t,i)=>{i.d(t,{cv:()=>o,en:()=>a,lA:()=>s}),i(68773),i(40330);var n=i(22974),r=i(17452);function s(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,r.mN)(e):(0,n.d9)(e)}function o(e,t,i){const n={};for(const r in e){if("declaredClass"===r)continue;const s=e[r];if(null!=s&&"function"!=typeof s)if(Array.isArray(s)){n[r]=[];for(let e=0;e<s.length;e++)n[r][e]=o(s[e])}else if("object"==typeof s)if(s.toJSON){const e=s.toJSON(i&&i[r]);n[r]=t?e:JSON.stringify(e)}else n[r]=t?s:JSON.stringify(s);else n[r]=s}return n}i(71058)}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5604],{90036:(t,e,n)=>{n.d(e,{Ue:()=>_n,G8:()=>vn});var s=n(3892),r=n(20102),o=n(22974),i=n(43697),a=n(5600),u=(n(75215),n(67676),n(80442),n(52011)),l=(n(92604),n(96674));let c=class extends l.wq{constructor(){super(...arguments),this.raster=void 0}};(0,i._)([(0,a.Cb)({json:{write:!0}})],c.prototype,"raster",void 0),c=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],c);const p=c;var f;let h=f=class extends p{clone(){return new f({raster:this.raster})}};h=f=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.AspectFunctionArguments")],h);const m=h;var d=n(90578),g=n(5847),y=n(25972);const x=new Set(["slope","aspect","curvature","hillshade","shadedrelief"]);let b=class extends l.wq{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:n}=t;let s=n.rasters||n.raster&&[n.raster];for(;s?.length;){e.unshift(...s);const t=[];for(let e=0;e<s.length;e++){const{parameters:n}=s[e],r=n.rasters||n.raster&&[n.raster];r?.length&&t.push(...r)}s=t}for(let t=e.length-1;t>=0;t--)e[t].isNoopProcess&&e.splice(t,1);let r=!1;for(let t=0;t<e.length;t++){const n=e[t];n.id=e.length-t-1;const{rasters:s}=n.parameters;r=r||null!=s&&s.length>1}const o=e.some((({name:t})=>x.has(t.toLowerCase())));return{functions:e,hasBranches:r,hasSurfaceFunction:o}}bind(t,e=!1,n=-1){this.id=n+1;const s=this._getRasterValues();let r=!0;for(let n=0;n<s.length;n++){const o=s[n];if(null!=o&&this._isRasterFunctionValue(o)){const s=o.bind(t,e,this.id+n);if(!s.success)return this._bindingResult=s,s;r=r&&s.supportsGPU}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.supportsGPU=r&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const e=this._getRasterValues(),n=0===e.length?t.pixelBlocks??t.primaryPixelBlocks:e.map((e=>this._readRasterValue(e,t)));return this._processPixels({...t,pixelBlocks:n})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let e;if(t.length>1){const e=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=e,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,e)=>t!==e));const n=t.filter((t=>"ExtractBand"===t.functionName));return n.length&&n.forEach(((t,e)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[e,e,e]})),this.rawInputBandIds}const n=t[0];if(n){if(e=n.processInputBandIds(),n.isInputBandIdsSwizzled)return this.rawInputBandIds=e,e}else{e=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let n=0;n<t;n++)e.push(n)}const s=this._getInputBandIds(e);return this.isInputBandIdsSwizzled=s.some(((t,e)=>t!==e)),this.rawInputBandIds=s,this.rawInputBandIds}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:n}=this.functionArguments;return n&&Array.isArray(n)&&n.length?(t.rasters=n.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_isOutputRoundingNeeded(){const{outputPixelType:t}=this;return(t?.startsWith("u")||t?.startsWith("s"))??!1}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.map((t=>this.functionArguments[t])).flat()}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:n,rasterIds:s}=t;if(0===e.length)return n;const r=e.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&s.includes(t)?n[s.indexOf(t)]:"number"!=typeof t?n[0]:void 0)),o=r.find((t=>t))??n[0];return r.forEach(((t,e)=>{void 0===t&&(r[e]=o)})),r}_getPrimaryRasterId(t){return t?.url}_getPrimaryRasters(t,e=[],n=[]){for(let s=0;s<t.sourceRasters.length;s++){const r=t.sourceRasters[s];if("number"!=typeof r)if("bind"in r)this._getPrimaryRasters(r,e,n);else{const t=r,s=this._getPrimaryRasterId(t);if(null==s)continue;n.includes(s)||(this.mainPrimaryRasterId===s?(e.unshift(t),n.unshift(s)):(e.push(t),n.push(s)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,e){const{primaryPixelBlocks:n}=e;if(null==t||"$$"===t){const t=n[0];return null==t?null:t.clone()}if("string"==typeof t){const s=e.primaryRasterIds.indexOf(t);return-1===s?null:n[s]}if("number"==typeof t){const e=n[0];if(null==e)return null;const{width:s,height:r,pixelType:o,mask:i}=e,a=i?new Uint8Array(i):null,u=new Float32Array(s*r);u.fill(t);const l=this.sourceRasterInfos[0].bandCount,c=new Array(l).fill(u);return new g.Z({width:s,height:r,pixelType:o,pixels:c,mask:a})}return t.process(e)}};(0,i._)([(0,a.Cb)({json:{write:!0}})],b.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],b.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}}),(0,d.p)((t=>t?.toLowerCase()))],b.prototype,"outputPixelType",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],b.prototype,"mainPrimaryRasterId",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"sourceRasters",void 0),(0,i._)([(0,a.Cb)({type:[y.Z],json:{write:!0}})],b.prototype,"sourceRasterInfos",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],b.prototype,"rasterInfo",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],b.prototype,"readingBufferSize",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],b.prototype,"id",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"supportsGPU",null),(0,i._)([(0,a.Cb)()],b.prototype,"rawInputBandIds",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"isInputBandIdsSwizzled",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"swizzledBandSelection",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"isBranch",void 0),(0,i._)([(0,a.Cb)()],b.prototype,"flatWebGLFunctionChain",null),(0,i._)([(0,a.Cb)()],b.prototype,"_bindingResult",void 0),b=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.BaseRasterFunction")],b);const w=b;var v=n(63342);let _=class extends w{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.histograms=null,e.colormap=null,e.attributeTable=null,e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{extent:n,primaryPixelSizes:s}=t,r=s?.[0],o=r??(n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1});return(0,v.M_)(e,{resolution:o})}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],_.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:m,json:{write:!0,name:"rasterFunctionArguments"}})],_.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],_.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],_.prototype,"isGCS",void 0),_=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.AspectFunction")],_);const C=_;var A=n(36030),R=n(35454);const P=new Set(["+","-","*","/","(",")"]);function N(t,e,n,s){if("number"==typeof n&&"number"==typeof s)return n+s;let r,o,i;"number"==typeof n?(i=s,r=i.length,o=new Float32Array(r),o.fill(n)):(r=n.length,o=n,s.constructor===Number?(i=new Float32Array(r),i.fill(s)):i=s);const a=new Float32Array(r);switch(e){case"+":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]+i[e]);break;case"-":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]-i[e]);break;case"*":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]*i[e]);break;case"/":for(let e=0;e<r;e++)(null==t||t[e])&&i[e]&&(a[e]=o[e]/i[e]);break;case"(":case")":throw new Error("encountered error with custom band index equation")}return a}function I(t,e){t.splice(e,1);let n=0,s=0;do{n=0,s=0;for(let e=0;e<t.length;e++)if("("===t[e])n=e;else if(")"===t[e]){s=e;break}s===n+1&&t.splice(n,2)}while(s===n+1);return t}function F(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,n=0;for(let s=0;s<t.length;s++)if("("===t[s])e=s;else if(")"===t[s]){n=s;break}const s=0===n?t:t.slice(e+1,n);let r=-1;for(let t=0;t<s.length;t++)if("*"===s[t]||"/"===s[t]){r=t;break}if(r>-1)n>0&&(r+=e+1);else{for(let t=0;t<s.length;t++)if("+"===s[t]||"-"===s[t]){r=t;break}n>0&&(r+=e+1)}let o=0;for(let e=0;e<r;e++)"("===t[e]&&o++;return{opIndex:r,numIndex:r-o}}var T=n(55914);const S=new R.X({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function k(t,e){if(!(0,T.nk)(t))return t;const{equation:n,method:s}=e,r=e.bandIndexes.map((t=>t-1)),{pixels:o,mask:i}=t;let a;switch(s){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":a=j(i,o[r[0]],o[r[1]]);break;case"ndwi":a=j(i,o[r[1]],o[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s)}return[r]}(i,o[r[0]],o[r[1]]);break;case"ci-g":case"ci-re":a=function(t,e,n){const s=e.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o];s&&(r[o]=t/s-1)}return[r]}(i,o[r[0]],o[r[1]]);break;case"savi":a=function(t,e,n,s){const r=n.length,o=new Float32Array(r);for(let i=0;i<r;i++)if(null==t||t[i]){const t=n[i],r=e[i],a=r+t+s;a&&(o[i]=(r-t)/a*(1+s))}return[o]}(i,o[r[0]],o[r[1]],r[2]+1);break;case"tsavi":a=function(t,e,n,s,r,o){const i=n.length,a=new Float32Array(i),u=-r*s+o*(1+s*s);for(let o=0;o<i;o++)if(null==t||t[o]){const t=n[o],i=e[o],l=r*i+t+u;l&&(a[o]=s*(i-s*t-r)/l)}return[a]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o];r[o]=.5*(2*(s+1)-Math.sqrt((2*s+1)**2-8*(s-t)))}return[r]}(i,o[r[0]],o[r[1]]);break;case"gemi":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=n[o],s=e[o];if(1!==t){const e=(2*(s*s-t*t)+1.5*s+.5*t)/(s+t+.5);r[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[r]}(i,o[r[0]],o[r[1]]);break;case"pvi":a=function(t,e,n,s,r){const o=n.length,i=new Float32Array(o),a=Math.sqrt(1+s*s);for(let u=0;u<o;u++)if(null==t||t[u]){const t=n[u],o=e[u];i[u]=(o-s*t-r)/a}return[i]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1);break;case"gvitm":a=function(t,e){const[n,s,r,o,i,a]=e,u=n.length,l=new Float32Array(u);for(let e=0;e<u;e++)(null==t||t[e])&&(l[e]=-.2848*n[e]-.2435*s[e]-.5436*r[e]+.7243*o[e]+.084*i[e]-1.18*a[e]);return[l]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"sultan":a=function(t,e){const[n,,s,r,o,i]=e,a=n.length,u=new Float32Array(a),l=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(u[e]=i[e]?o[e]/i[e]*100:0,l[e]=n[e]?o[e]/n[e]*100:0,c[e]=r[e]?s[e]/r[e]*(o[e]/r[e])*100:0);return[u,l,c]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"vari":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=o+t-r[e];a&&(i[e]=(o-t)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"mtvi2":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e],u=Math.sqrt((2*t+1)**2-6*t-5*Math.sqrt(o)-.5);i[e]=1.5*(1.2*(t-a)-2.5*(o-a))*u}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"rtvi-core":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=r[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"evi":a=function(t,e){const[n,s,r]=e,o=n.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=n[e],o=s[e],a=t+6*o-7.5*r[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"wndwi":a=function(t,e,n=.5){const[s,r,o]=e,i=r.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=s[e],i=r[e],u=o[e],l=t+n*i+(1-n)*u;l&&(a[e]=(t-n*i-(1-n)*u)/l)}return[a]}(i,[o[r[0]],o[r[1]],o[r[2]]],r[3]?r[3]+1:.5);break;case"bai":a=function(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o])for(o=0;o<s;o++){const t=(.1-e[o])**2+(.06-n[o])**2;t&&(r[o]=1/t)}return[r]}(i,o[r[0]],o[r[1]]);break;case"custom":a=function(t,e,n){let s,{ops:r,nums:o}=function(t,e){(t=t.replace(/ /g,"")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1,t.length));const n=t.split(""),s=[],r=[];let o="";for(let t=0;t<n.length;t++){const i=n[t];if(P.has(i))""!==o&&r.push(parseFloat(o)),s.push(i),o="";else{if("b"===i.toLowerCase()){t++,o=i.concat(n[t]),r.push(e[parseInt(o[1],10)-1]),o="";continue}o=o.concat(i),t===n.length-1&&r.push(parseFloat(o))}}return{ops:s,nums:r}}(n,e);if(0===r.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const n=new Float32Array(e[0].length);return"number"==typeof t?n.fill(t):n.set(t),[n]}for(;r.length>0;){const{numIndex:e,opIndex:n}=F(r);if(s=N(t,r[n],o[e],o[e+1]),1===r.length)break;r=I(r,n),o.splice(e,2,s)}return[s]}(i,o,n);break;default:return t}const u=null!=i?new Uint8Array(i.length):null;null!=i&&null!=u&&u.set(i);const l=new g.Z({width:t.width,height:t.height,pixelType:"f32",pixels:a,mask:u});return l.updateStatistics(),l}function M(t){const e=new Float32Array(9);return e[3*t[0]]=1,e[3*t[1]+1]=1,e[3*t[2]+2]=1,e}function j(t,e,n){const s=n.length,r=new Float32Array(s);for(let o=0;o<s;o++)if(null==t||t[o]){const t=e[o],s=n[o],i=t+s;i&&(r[o]=(t-s)/i)}return[r]}var B;let E=B=class extends p{constructor(){super(...arguments),this.method="custom"}clone(){return new B({method:this.method,bandIndexes:this.bandIndexes,raster:(0,o.d9)(this.raster)})}};(0,i._)([(0,a.Cb)({json:{type:String,write:!0}})],E.prototype,"bandIndexes",void 0),(0,i._)([(0,A.J)(S)],E.prototype,"method",void 0),E=B=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.BandArithmeticFunctionArguments")],E);const G=E,D=new Set(["vari","mtvi2","rtvi-core","evi"]);let z=class extends w{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0],e=t.clone();return e.pixelType=this.outputPixelType,e.statistics=null,e.histograms=null,e.bandCount="sultan"===this.functionArguments.method?t.bandCount:1,this.rasterInfo=e,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{method:n,bandIndexes:s}=this.functionArguments,r=s.split(" ").map((t=>parseFloat(t)));return k(e,{method:n,bandIndexes:r,equation:s})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1));2===t.length&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let n,s;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":n=M([e[0],e[1],0]),s="ndxi";break;case"ndwi":n=M([e[1],e[0],0]),s="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":n=M([e[0],e[1],0]),s="sr";break;case"ci-g":case"ci-re":n=M([e[0],e[1],0]),s="ci";break;case"savi":n=M([e[0],e[1],0]),s="savi",r[0]=t[2]+1;break;case"tsavi":n=M([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":n=M([e[0],e[1],0]),s="msavi";break;case"gemi":n=M([e[0],e[1],0]),s="gemi";break;case"pvi":n=M([e[0],e[1],0]),s="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":n=M([e[0],e[1],e[2]]),s="vari";break;case"mtvi2":n=M([e[0],e[1],e[2]]),s="mtvi2";break;case"rtvi-core":n=M([e[0],e[1],e[2]]),s="rtvicore";break;case"evi":n=M([e[0],e[1],e[2]]),s="evi";break;case"wndwi":n=M([e[0],e[1],0]),s="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":n=M([e[1],e[0],0]),s="bai";break;default:n=M([0,1,2]),s="custom"}return{bandIndexMat3:n,indexType:s,adjustments:r}}_getInputBandIds(t){if("custom"===this.functionArguments.method)return t;const e=this.functionArguments.bandIndexes.split(" ").map((t=>parseFloat(t)-1)),n=t.length,s=e.map((t=>t>=n?n-1:t)),r=D.has(this.functionArguments.method)?3:2,o=s.slice(0,r).map((e=>t[e]));return 2===o.length&&o.push(0),o}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],z.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:G,json:{write:!0,name:"rasterFunctionArguments"}})],z.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],z.prototype,"rasterArgumentNames",void 0),z=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.BandArithmeticFunction")],z);const O=z;var Z,V=n(71715),L=n(93010),U=n(94593);let W=Z=class extends p{castColormapName(t){if(!t)return null;const e=t.toLowerCase();return L.Oi.includes(e)?e:null}readColorRamp(t){return(0,U.i)(t)}readColorRampName(t,e){if(!t)return null;const n=L.H0.jsonValues.find((e=>e.toLowerCase()===t.toLowerCase()));return n?L.H0.fromJSON(n):null}clone(){return new Z({colormap:(0,o.d9)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,i._)([(0,a.Cb)({type:[[Number]],json:{write:!0}})],W.prototype,"colormap",void 0),(0,i._)([(0,a.Cb)({type:String,json:{write:!0}})],W.prototype,"colormapName",void 0),(0,i._)([(0,d.p)("colormapName")],W.prototype,"castColormapName",null),(0,i._)([(0,a.Cb)({types:U.V,json:{write:!0}})],W.prototype,"colorRamp",void 0),(0,i._)([(0,V.r)("colorRamp")],W.prototype,"readColorRamp",null),(0,i._)([(0,a.Cb)({type:L.H0.apiValues,json:{type:L.H0.jsonValues,write:L.H0.write}})],W.prototype,"colorRampName",void 0),(0,i._)([(0,V.r)("colorRampName")],W.prototype,"readColorRampName",null),W=Z=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],W);const q=W,X=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[112,75,3],[113,76,3],[114,77,3],[115,77,3],[116,78,3],[117,79,3],[118,79,3],[119,80,3],[121,81,4],[122,82,4],[123,82,4],[124,83,4],[125,84,4],[126,84,4],[127,85,4],[128,86,4],[129,86,4],[130,87,4],[131,88,4],[132,89,4],[133,89,4],[134,90,4],[135,91,4],[136,91,4],[137,92,4],[138,93,4],[139,94,4],[140,94,4],[142,95,5],[143,96,5],[144,96,5],[145,97,5],[146,98,5],[147,99,5],[148,99,5],[149,100,5],[150,101,5],[151,101,5],[152,102,5],[153,103,5],[154,104,5],[155,104,5],[156,105,5],[157,106,5],[158,106,5],[159,107,5],[160,108,5],[161,108,5],[162,109,5],[164,110,6],[165,111,6],[166,111,6],[167,112,6],[168,113,6],[169,113,6],[170,114,6],[171,115,6],[172,116,6],[173,116,6],[174,117,6],[245,0,0],[245,5,0],[245,10,0],[246,15,0],[246,20,0],[246,25,0],[246,30,0],[247,35,0],[247,40,0],[247,45,0],[247,50,0],[247,55,0],[248,60,0],[248,65,0],[248,70,0],[248,75,0],[249,81,0],[249,86,0],[249,91,0],[249,96,0],[250,101,0],[250,106,0],[250,111,0],[250,116,0],[250,121,0],[251,126,0],[251,131,0],[251,136,0],[251,141,0],[252,146,0],[252,151,0],[252,156,0],[252,156,0],[251,159,0],[250,162,0],[249,165,0],[248,168,0],[247,171,0],[246,174,0],[245,177,0],[245,179,0],[244,182,0],[243,185,0],[242,188,0],[241,191,0],[240,194,0],[239,197,0],[238,200,0],[237,203,0],[236,206,0],[235,209,0],[234,212,0],[233,215,0],[232,218,0],[231,221,0],[230,224,0],[230,226,0],[229,229,0],[228,232,0],[227,235,0],[226,238,0],[225,241,0],[224,244,0],[223,247,0],[165,247,0],[163,244,0],[161,240,0],[158,237,0],[156,233,1],[154,230,1],[152,227,1],[149,223,1],[147,220,1],[145,216,1],[143,213,1],[140,210,2],[138,206,2],[136,203,2],[134,200,2],[132,196,2],[129,193,2],[127,189,2],[125,186,3],[123,183,3],[120,179,3],[118,176,3],[116,172,3],[114,169,3],[111,166,3],[109,162,4],[107,159,4],[105,155,4],[103,152,4],[100,149,4],[98,145,4],[96,142,4],[94,138,5],[91,135,5],[89,132,5],[87,128,5],[85,125,5],[82,121,5],[80,118,5],[78,115,6],[76,111,6],[73,108,6],[71,105,6],[69,101,6],[67,98,6],[65,94,6],[62,91,7],[60,88,7],[58,84,7],[56,81,7],[53,77,7],[51,74,7],[49,71,7],[47,67,8],[44,64,8],[42,60,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8]],J=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[245,20,0],[245,24,0],[245,29,0],[245,31,0],[247,33,0],[247,33,0],[247,37,0],[247,41,0],[247,41,0],[247,41,0],[247,45,0],[247,45,0],[247,47,0],[247,49,0],[247,49,0],[247,54,0],[247,54,0],[247,56,0],[247,58,0],[247,58,0],[250,62,0],[250,62,0],[250,62,0],[250,67,0],[250,67,0],[250,67,0],[250,69,0],[250,71,0],[250,71,0],[250,75,0],[250,75,0],[250,78,0],[250,79,0],[250,79,0],[250,79,0],[250,81,0],[250,83,0],[250,83,0],[250,87,0],[250,87,0],[250,90,0],[250,92,0],[252,93,0],[252,93,0],[252,97,0],[252,97,0],[252,97,0],[252,97,0],[252,101,0],[252,101,0],[252,101,0],[252,101,0],[252,105,0],[252,105,0],[252,107,0],[252,109,0],[252,109,0],[252,113,13],[255,118,20],[255,119,23],[255,121,25],[255,126,33],[255,132,38],[255,133,40],[255,135,43],[255,141,48],[255,144,54],[255,150,59],[255,152,61],[255,153,64],[255,159,69],[255,163,77],[255,165,79],[255,168,82],[255,174,87],[255,176,92],[255,181,97],[255,183,99],[255,186,102],[255,191,107],[255,197,115],[255,201,120],[255,203,123],[255,205,125],[255,209,130],[255,214,138],[255,216,141],[255,218,143],[255,224,150],[255,228,156],[255,234,163],[255,236,165],[255,238,168],[255,243,173],[255,248,181],[255,252,186],[253,252,186],[250,252,187],[244,250,180],[238,247,176],[234,246,173],[231,245,169],[223,240,163],[217,237,157],[211,235,150],[205,233,146],[200,230,142],[195,227,136],[189,224,132],[184,222,126],[180,220,123],[174,217,119],[169,214,114],[163,212,108],[160,210,105],[154,207,101],[148,204,96],[143,201,93],[138,199,88],[134,197,84],[130,194,81],[126,191,77],[117,189,70],[115,186,68],[112,184,64],[106,181,60],[100,179,55],[94,176,49],[92,174,47],[90,173,45],[81,168,37],[75,166,33],[71,163,28],[66,160,24],[62,158,21],[56,156,14],[51,153,0],[51,153,0],[51,153,0],[50,150,0],[50,150,0],[50,150,0],[50,150,0],[49,148,0],[49,148,0],[49,148,0],[48,145,0],[48,145,0],[48,145,0],[48,145,0],[48,143,0],[48,143,0],[48,143,0],[48,143,0],[47,140,0],[47,140,0],[47,140,0],[47,140,0],[46,138,0],[46,138,0],[46,138,0],[46,138,0],[45,135,0],[45,135,0],[45,135,0],[45,135,0],[44,133,0],[44,133,0],[44,133,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[42,128,0],[42,128,0],[42,128,0],[42,125,0],[42,125,0],[42,125,0],[42,125,0],[41,122,0],[41,122,0],[41,122,0],[41,122,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[39,117,0],[39,117,0],[39,117,0],[39,117,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0]];function H(t,e){const n=[],s=[];for(let e=0;e<t.length-1;e++)n.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:t[e].slice(1),toColor:t[e+1].slice(1)}),s.push(t[e+1][0]-t[e][0]);const r=t[t.length-1][0];return(0,L.XL)({type:"multipart",colorRamps:n},{numColors:r,weights:e=e??s})}let Y=class extends w{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:n,colorRamp:s,colorRampName:r}=this.functionArguments;if(!e?.length)if(s)e=(0,L.Jw)(s,{interpolateAlpha:!0});else if(r){const t=(0,L.B4)(r);t&&(e=(0,L.Jw)(t))}else n&&(e=function(t){let e;switch(t){case"elevation":e=H([[0,0,191,191],[51,0,255,0],[102,255,255,0],[153,255,127,0],[204,191,127,63],[256,20,20,20]]);break;case"gray":e=(0,L.XL)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":e=H([[0,38,54,41],[69,79,90,82],[131,156,156,156],[256,253,241,253]],[.268,.238,.495]);break;case"ndvi":e=X;break;case"ndvi2":e=function(){const t=H([[0,255,255,255],[70,0,0,255],[80,205,193,173],[100,150,150,150],[110,120,100,51],[130,120,200,100],[140,28,144,3],[160,6,55,0],[180,10,30,25],[201,6,27,7]]);for(let e=t.length;e<256;e++)t.push([6,27,7]);return t}();break;case"ndvi3":e=J;break;case"random":e=function(){const t=[];for(let e=0;e<256;e++){const e=[];for(let t=0;t<3;t++)e.push(Math.round(255*Math.random()));t.push(e)}return t}()}return e?(e=e.map(((t,e)=>[e,...t])),e):null}(n));if(!e?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};this.outputPixelType=this._getOutputPixelType("u8");const o=t.clone();return o.pixelType=this.outputPixelType,o.colormap=e,o.bandCount=1,this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],Y.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:q,json:{write:!0,name:"rasterFunctionArguments"}})],Y.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],Y.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)()],Y.prototype,"isNoopProcess",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],Y.prototype,"indexedColormap",void 0),Y=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.ColormapFunction")],Y);const $=Y;var K,Q=n(30556);let tt=K=class extends p{constructor(){super(...arguments),this.rasters=[]}writeRasters(t,e){e.rasters=t.map((t=>"number"==typeof t||"string"==typeof t?t:t.toJSON()))}clone(){return new K({rasters:(0,o.d9)(this.rasters)})}};(0,i._)([(0,a.Cb)({json:{write:!0}})],tt.prototype,"rasters",void 0),(0,i._)([(0,Q.c)("rasters")],tt.prototype,"writeRasters",null),tt=K=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],tt);const et=tt;let nt=class extends w{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const n=e.clone();if(n.attributeTable=null,n.colormap=null,n.pixelType=this.outputPixelType,n.bandCount=t.map((({bandCount:t})=>t)).reduce(((t,e)=>t+e)),t.every((({statistics:t})=>null!=t&&t.length))){const e=[];t.forEach((({statistics:t})=>null!=t&&e.push(...t))),n.statistics=e}if(t.every((({histograms:t})=>null!=t&&t.length))){const e=[];t.forEach((({histograms:t})=>null!=t&&e.push(...t))),n.histograms=e}return n.bandCount>1&&(n.colormap=null,n.attributeTable=null),this.rasterInfo=n,{success:!0,supportsGPU:n.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;if(!e)return null;const n=e?.[0];return null==n?null:(0,T.Gd)(e)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],nt.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:et,json:{write:!0,name:"rasterFunctionArguments"}})],nt.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],nt.prototype,"rasterArgumentNames",void 0),nt=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.CompositeBandFunction")],nt);const st=nt,rt={userDefined:-1,lineDetectionHorizontal:0,lineDetectionVertical:1,lineDetectionLeftDiagonal:2,lineDetectionRightDiagonal:3,gradientNorth:4,gradientWest:5,gradientEast:6,gradientSouth:7,gradientNorthEast:8,gradientNorthWest:9,smoothArithmeticMean:10,smoothing3x3:11,smoothing5x5:12,sharpening3x3:13,sharpening5x5:14,laplacian3x3:15,laplacian5x5:16,sobelHorizontal:17,sobelVertical:18,sharpen:19,sharpen2:20,pointSpread:21,none:255},ot={bitwiseAnd:11,bitwiseLeftShift:12,bitwiseNot:13,bitwiseOr:14,bitwiseRightShift:15,bitwiseXOr:16,booleanAnd:17,booleanNot:18,booleanOr:19,booleanXOr:20,equalTo:24,greaterThan:28,greaterThanEqual:29,lessThan:33,lessThanEqual:34,isNull:31,notEqual:46},it={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},at={setNull:50,conditional:78},ut={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65,...ot,...it,majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75,...at};var lt=n(81578);const ct=new Map;function pt(t,e,n,s,r,o,i){const a=new Float32Array(e*n),u=o.length,l=i?0:s,c=i?s:0,p=i?1:e;for(let i=l;i<n-l;i++){const n=i*e;for(let i=c;i<e-c;i++){if(r&&!r[n+i])continue;let e=0;for(let r=0;r<u;r++)e+=t[n+i+(r-s)*p]*o[r];a[n+i]=e}}return a}function ft(t,e,n,s,r,o,i){const a=new Float32Array(e*n),u=Math.floor(s/2),l=Math.floor(r/2);for(let c=u;c<n-u;c++){const n=c*e;for(let c=l;c<e-l;c++){if(o&&!o[n+c])continue;let p=0;for(let o=0;o<s;o++)for(let s=0;s<r;s++)p+=t[n+c+(o-u)*e+s-l]*i[o*r+s];a[n+c]=p}}return a}function ht(t,e,n,s,r){const o=Math.floor(s/2);for(let s=0;s<o;s++)for(let o=0;o<e;o++)t[s*e+o]=t[(r-1-s)*e+o],t[(n-1-s)*e+o]=t[(n-r+s)*e+o];const i=Math.floor(r/2);for(let s=0;s<n;s++){const n=s*e;for(let s=0;s<i;s++)t[n+s]=t[n+r-1-s],t[n+e-s-1]=t[n+e+s-r]}}var mt;ct.set(rt.none,[0,0,0,0,1,0,0,0,0]),ct.set(rt.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),ct.set(rt.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),ct.set(rt.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),ct.set(rt.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),ct.set(rt.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),ct.set(rt.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),ct.set(rt.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),ct.set(rt.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),ct.set(rt.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),ct.set(rt.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),ct.set(rt.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),ct.set(rt.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),ct.set(rt.smoothing5x5,[1,1,1,1,1,1,4,4,4,1,1,4,12,4,1,1,4,4,4,1,1,1,1,1,1]),ct.set(rt.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),ct.set(rt.sharpening5x5,[-1,-3,-4,-3,-1,-3,0,6,0,-3,-4,6,21,6,-4,-3,0,6,0,-3,-1,-3,-4,-3,-1]),ct.set(rt.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),ct.set(rt.laplacian5x5,[0,0,-1,0,0,0,-1,-2,-1,0,-1,-2,17,-2,-1,0,-1,-2,-1,0,0,0,-1,0,0]),ct.set(rt.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),ct.set(rt.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),ct.set(rt.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),ct.set(rt.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),ct.set(rt.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);let dt=mt=class extends p{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const e=ct.get(t);if(!e||t===rt.userDefined||t===rt.none)return;const n=Math.sqrt(e.length);this._set("kernel",e),this._set("cols",n),this._set("rows",n)}clone(){return new mt({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:(0,o.d9)(this.raster)})}};(0,i._)([(0,a.Cb)({json:{type:Number,write:!0}})],dt.prototype,"rows",void 0),(0,i._)([(0,a.Cb)({json:{type:Number,write:!0}})],dt.prototype,"cols",void 0),(0,i._)([(0,a.Cb)({json:{name:"type",type:Number,write:!0}})],dt.prototype,"convolutionType",null),(0,i._)([(0,a.Cb)({json:{type:[Number],write:!0}})],dt.prototype,"kernel",void 0),dt=mt=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.ConvolutionFunctionArguments")],dt);const gt=dt;let yt=class extends w{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:n,kernel:s}=this.functionArguments;if(!Object.values(rt).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==rt.none&&e*n!==s.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const r=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(r.pixelType);const o=r.clone();o.pixelType=this.outputPixelType;const i=[rt.none,rt.sharpen,rt.sharpen2,rt.sharpening3x3,rt.sharpening5x5];return"u8"===this.outputPixelType||i.includes(t)||(o.statistics=null,o.histograms=null),o.colormap=null,o.attributeTable=null,this.rasterInfo=o,{success:!0,supportsGPU:s.length<=25}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===rt.none)return e;let{kernel:n,rows:s,cols:r}=this.functionArguments;const o=n.reduce(((t,e)=>t+e));return 0!==o&&1!==o&&(n=n.map((t=>t/o))),function(t,e){const n=function(t){const e=Math.sqrt(t.length),n=t.slice(0,e),s=[1];for(let n=1;n<e;n++){let r=null;for(let s=0;s<e;s++){const o=t[s+n*e],i=t[s];if(null==r)if(0===i){if(o)return{separable:!1,row:null,col:null}}else r=o/i;else if(o/i!==r)return{separable:!1,row:null,col:null}}if(null==r)return{separable:!1,row:null,col:null};s.push(r)}return{separable:!0,row:n,col:s}}(e.kernel),s=!1!==e.mirrorEdges,r=n.separable?function(t,e,n,s=!0){const{pixels:r,width:o,height:i,pixelType:a,mask:u}=t,l=r.length,c=[],p=e.length,f=n.length,h=Math.floor(p/2),m=Math.floor(f/2);for(let t=0;t<l;t++){let a=pt(r[t],o,i,h,u,e,!0);a=pt(a,o,i,m,u,n,!1),s&&ht(a,o,i,p,f),c.push(a)}return new g.Z({width:o,height:i,pixelType:a,pixels:c,mask:u})}(t,n.row,n.col,s):function(t,e,n=!0){const{pixels:s,width:r,height:o,pixelType:i,mask:a}=t,u=s.length,l=[],{kernel:c,rows:p,cols:f}=e;for(let t=0;t<u;t++){const e=ft(s[t],r,o,p,f,a,c);n&&ht(e,r,o,p,f),l.push(e)}return new g.Z({width:r,height:o,pixelType:i,pixels:l,mask:a})}(t,e,s),{outputPixelType:o}=e;return o&&r.clamp(o),r}(e,{kernel:n,rows:s,cols:r,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{kernel:t}=this.functionArguments;const e=t.reduce(((t,e)=>t+e));0!==e&&1!==e&&(t=t.map((t=>t/e)));const n=new Float32Array(25);return n.set(t),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:n,clampRange:(0,lt.r)(this.outputPixelType)}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],yt.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:gt,json:{write:!0,name:"rasterFunctionArguments"}})],yt.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],yt.prototype,"rasterArgumentNames",void 0),yt=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.ConvolutionFunction")],yt);const xt=yt;var bt;const wt=new R.X({0:"standard",1:"platform",2:"profile"},{useNumericKeys:!0});let vt=bt=class extends p{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(t,e){return wt.fromJSON(e.type??e.curvatureType??0)}clone(){return new bt({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};(0,i._)([(0,a.Cb)({json:{write:{target:"type"}}}),(0,A.J)(wt)],vt.prototype,"curvatureType",void 0),(0,i._)([(0,V.r)("curvatureType",["type","curvatureType"])],vt.prototype,"readCurvatureType",null),(0,i._)([(0,a.Cb)({type:Number,json:{write:!0}})],vt.prototype,"zFactor",void 0),vt=bt=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.CurvatureFunctionArguments")],vt);const _t=vt;let Ct=class extends w{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:n,curvatureType:s}=this.functionArguments,{extent:r,primaryPixelSizes:o}=t,i=o?.[0],a=i??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),u=this.isGCS&&n>=1?n*v.CX:n;return(0,v.Ne)(e,{zFactor:u,curvatureType:s,resolution:a})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*v.CX:t}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],Ct.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:_t,json:{write:!0,name:"rasterFunctionArguments"}})],Ct.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],Ct.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],Ct.prototype,"isGCS",void 0),Ct=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.CurvatureFunction")],Ct);const At=Ct;var Rt;let Pt=Rt=class extends p{constructor(){super(...arguments),this.bandIds=[],this.missingBandAction=T.CD.bestMatch}clone(){return new Rt({bandIds:[...this.bandIds],missingBandAction:this.missingBandAction})}};(0,i._)([(0,a.Cb)({json:{write:!0}})],Pt.prototype,"bandIds",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],Pt.prototype,"missingBandAction",void 0),Pt=Rt=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],Pt);const Nt=Pt;let It=class extends w{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:n}=e,{bandIds:s,missingBandAction:r}=this.functionArguments;if(r===T.CD.fail&&s.some((t=>t<0||t>=n)))return{success:!1,supportsGPU:!1,error:"extract-band-function: invalid bandIds"};this.outputPixelType=this._getOutputPixelType("f32");const o=e.clone();o.pixelType=this.outputPixelType,o.bandCount=s.length;const{statistics:i,histograms:a}=o;return null!=i&&i.length&&(o.statistics=s.map((t=>i[t]||i[i.length-1]))),null!=a&&a.length&&(o.histograms=s.map((t=>a[t]||a[a.length-1]))),this.rasterInfo=o,{success:!0,supportsGPU:o.bandCount<=3}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const n=e.pixels.length,s=this.functionArguments.bandIds.map((t=>t>=n?n-1:t));return e.extractBands(s)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],0===t.length?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:M(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map((t=>t>=e?e-1:t)).map((e=>t[e]))}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],It.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:Nt,json:{write:!0,name:"rasterFunctionArguments"}})],It.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],It.prototype,"rasterArgumentNames",void 0),It=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.ExtractBandFunction")],It);const Ft=It;var Tt;let St=Tt=class extends p{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(t,e){e.rasters=t.map((t=>"number"==typeof t||"string"==typeof t?t:t.toJSON()))}clone(){return new Tt({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,o.d9)(this.rasters)})}};(0,i._)([(0,a.Cb)({json:{write:!0}})],St.prototype,"operation",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],St.prototype,"rasters",void 0),(0,i._)([(0,Q.c)("rasters")],St.prototype,"writeRasters",null),(0,i._)([(0,a.Cb)({json:{write:!0}})],St.prototype,"processAsMultiband",void 0),St=Tt=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.LocalFunctionArguments")],St);const kt=St,Mt=new Map;Mt.set(it.acos,[0,Math.PI]),Mt.set(it.asin,[-Math.PI/2,Math.PI/2]),Mt.set(it.atan,[-Math.PI/2,Math.PI/2]),Mt.set(it.cos,[-1,1]),Mt.set(it.sin,[-1,1]),Mt.set(ot.booleanAnd,[0,1]),Mt.set(ot.booleanNot,[0,1]),Mt.set(ot.booleanOr,[0,1]),Mt.set(ot.booleanXOr,[0,1]),Mt.set(ot.equalTo,[0,1]),Mt.set(ot.notEqual,[0,1]),Mt.set(ot.greaterThan,[0,1]),Mt.set(ot.greaterThanEqual,[0,1]),Mt.set(ot.lessThan,[0,1]),Mt.set(ot.lessThanEqual,[0,1]),Mt.set(ot.isNull,[0,1]);const jt=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function Bt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]+r[t]);return i}function Et(t,e,n){const[s]=t,r=s.length,o=g.Z.createEmptyBand("f32",r);return o.set(s),o}function Gt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]-r[t]);return i}function Dt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]*r[t]);return i}function zt(t,e,n){const[s]=t,r=s.length,o=g.Z.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=Math.sign(s[t])*Math.floor(Math.abs(s[t])));return o}function Ot(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]/r[t]);return i}function Zt(t,e,n){return Ot(t,e,"f32")}function Vt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=Math.floor(s[t]/r[t]));return i}function Lt(t,e,n,s){const r=t[0],o=r.length,i=g.Z.createEmptyBand(n,o);if(s===it.atanh){for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>=1?e[t]=0:i[t]=Math.atanh(n)}return i}const a=s===it.asin?Math.asin:Math.acos;for(let t=0;t<o;t++)if(e[t]){const n=r[t];Math.abs(n)>1?e[t]=0:i[t]=a(n)}return i}function Ut(t,e,n,s){const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s(r[t]));return i}function Wt(t,e,n,s){const[r,o]=t,i=r.length,a=g.Z.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s(r[t],o[t]));return a}function qt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&r[t]);return i}function Xt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<<r[t]);return i}function Jt(t,e,n){const[s]=t,r=s.length,o=g.Z.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=~s[t]);return o}function Ht(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]|r[t]);return i}function Yt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>>r[t]);return i}function $t(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]^r[t]);return i}function Kt(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]&&r[t]?1:0);return i}function Qt(t,e,n){const[s]=t,r=s.length,o=g.Z.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=s[t]?0:1);return o}function te(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]||r[t]?1:0);return i}function ee(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(s[t]?1:0)^(r[t]?1:0));return i}function ne(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?1:0);return i}function se(t,e,n,s){const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o),a=s===Math.E;for(let t=0;t<o;t++)e&&!e[t]||(i[t]=a?Math.exp(r[t]):s**r[t]);return i}function re(t,e,n){return se(t,e,n,10)}function oe(t,e,n){return se(t,e,n,2)}function ie(t,e,n){return se(t,e,n,Math.E)}function ae(t,e,n,s){const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(r[t]<=0?e[t]=0:i[t]=s(r[t]));return i}function ue(t,e,n){return ae(t,e,n,Math.log10)}function le(t,e,n){return ae(t,e,n,Math.log2)}function ce(t,e,n){return ae(t,e,n,Math.log)}function pe(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>r[t]?1:0);return i}function fe(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]>=r[t]?1:0);return i}function he(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<r[t]?1:0);return i}function me(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]<=r[t]?1:0);return i}function de(t,e,n){const[s]=t,r=s.length,o=g.Z.createEmptyBand(n,r);if(!e)return o;for(let t=0;t<r;t++)o[t]=e[t]?0:1;return o}function ge(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]%r[t]);return i}function ye(t,e,n){const[s]=t,r=s.length,o=g.Z.createEmptyBand(n,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=-s[t]);return o}function xe(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=s[t]===r[t]?0:1);return i}function be(t,e,n){const[s,r]=t,o=s.length,i=g.Z.createEmptyBand(n,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==s[t]||(i[t]=r[t],a[t]=255);return{band:i,mask:a}}function we(t,e,n){const[s,r,o]=t,i=s.length,a=g.Z.createEmptyBand(n,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=s[t]?r[t]:o[t]);return a}function ve(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e<s&&(e=s)}i[n]=e}return i}function _e(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n];for(let r=1;r<s;r++){const s=t[r][n];e>s&&(e=s)}i[n]=e}return i}function Ce(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=r[n],o=e;for(let r=1;r<s;r++){const s=t[r][n];o<s?o=s:e>s&&(e=s)}i[n]=o-e}return i}function Ae(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){let e=0;for(let r=0;r<s;r++)e+=t[r][n];i[n]=e/s}return i}function Re(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n])for(let e=0;e<s;e++){const s=t[e];i[n]+=s[n]}return i}function Pe(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o);for(let n=0;n<o;n++)if(!e||e[n]){const e=new Float32Array(s);let r=0;for(let o=0;o<s;o++){const s=t[o];r+=s[n],e[o]=s[n]}r/=s;let o=0;for(let t=0;t<s;t++)o+=(e[t]-r)**2;i[n]=Math.sqrt(o/s)}return i}function Ne(t,e,n){const s=t.length;if(s<2)return t[0];const r=Math.floor(s/2),[o]=t,i=o.length,a=g.Z.createEmptyBand(n,i),u=new Float32Array(s),l=s%2==1;for(let n=0;n<i;n++)if(!e||e[n]){for(let e=0;e<s;e++)u[e]=t[e][n];u.sort(),a[n]=l?u[r]:(u[r]+u[r-1])/2}return a}function Ie(t,e,n){const[s,r]=t;if(null==r)return s;const o=s.length,i=g.Z.createEmptyBand(n,o);for(let t=0;t<o;t++)e[t]&&(s[t]===r[t]?i[t]=s[t]:e[t]=0);return i}function Fe(t,e,n){const s=t.length;if(s<=2)return Ie(t,e,n);const r=t[0].length,o=g.Z.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){let e;i.clear();for(let r=0;r<s;r++)e=t[r][n],i.set(e,i.has(e)?i.get(e)+1:1);let r=0,a=0;for(const t of i.keys())r=i.get(t),r>a&&(a=r,e=t);o[n]=e}return o}function Te(t,e,n){const s=t.length;if(s<=2)return Ie(t,e,n);const r=t[0].length,o=g.Z.createEmptyBand(n,r),i=new Map;for(let n=0;n<r;n++)if(!e||e[n]){let e;i.clear();for(let r=0;r<s;r++)e=t[r][n],i.set(e,i.has(e)?i.get(e)+1:1);let r=0,a=t.length;for(const t of i.keys())r=i.get(t),r<a&&(a=r,e=t);o[n]=e}return o}function Se(t,e,n){const s=t.length;if(s<2)return t[0];const[r]=t,o=r.length,i=g.Z.createEmptyBand(n,o),a=new Set;for(let n=0;n<o;n++)if(!e||e[n]){let e;a.clear();for(let r=0;r<s;r++)e=t[r][n],a.add(e);i[n]=a.size}return i}const ke=new Map,Me=new Map,je=new Map,Be=new Map;function Ee(t,e,n,s){let[r,o]=(0,lt.r)(n);const i=n.startsWith("u")||n.startsWith("s");i&&(r-=1e-5,o+=1e-5);for(let n=0;n<e.length;n++)if(e[n]){const a=t[n];isNaN(a)||a<r||a>o?e[n]=0:s[n]=i?Math.round(a):a}}let Ge=class extends w{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:n}=e,{processAsMultiband:s}=this.functionArguments;if(t.some((t=>t.bandCount!==n)))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:o}=this.functionArguments,i=jt[r];if(!(999===i||o.length===i||o.length<=1&&1===i))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${i}`};this.outputPixelType=this._getOutputPixelType("f32");const a=e.clone();a.pixelType=this.outputPixelType,a.statistics=null,a.histograms=null,a.colormap=null,a.attributeTable=null,a.bandCount=999!==i||s?n:1;const u=function(t){return Mt.get(t)}(r);if(u){a.statistics=[];for(let t=0;t<a.bandCount;t++)a.statistics[t]={min:u[0],max:u[1],avg:(u[0]+u[1])/2,stddev:(u[0]+u[1])/10}}return this.rasterInfo=a,{success:!0,supportsGPU:1===a.bandCount&&i<=3&&(r<11||r>16)}}_processPixels(t){const{pixelBlocks:e}=t;return null==e||e.some((t=>null==t))?null:function(t,e,n={}){ke.size||(ke.set(4,Math.sqrt),ke.set(6,Math.acos),ke.set(7,Math.asin),ke.set(8,Math.atan),ke.set(9,Math.atanh),ke.set(10,Math.abs),ke.set(21,Math.cos),ke.set(22,Math.cosh),ke.set(48,Math.floor),ke.set(49,Math.ceil),ke.set(51,Math.sin),ke.set(52,Math.sinh),ke.set(56,Math.tan),ke.set(57,Math.tanh),ke.set(59,Math.acosh),ke.set(60,Math.asinh),ke.set(65,Math.floor),Me.set(5,Math.pow),Me.set(61,Math.atan2),je.set(1,Bt),je.set(2,Gt),je.set(3,Dt),je.set(11,qt),je.set(12,Xt),je.set(12,Xt),je.set(13,Jt),je.set(14,Ht),je.set(15,Yt),je.set(16,$t),je.set(17,Kt),je.set(18,Qt),je.set(19,te),je.set(20,ee),je.set(23,Ot),je.set(24,ne),je.set(25,ie),je.set(26,re),je.set(27,oe),je.set(28,pe),je.set(29,fe),je.set(30,zt),je.set(31,de),je.set(32,Et),je.set(33,he),je.set(34,me),je.set(35,ce),je.set(36,ue),je.set(37,le),je.set(44,ge),je.set(45,ye),je.set(46,xe),je.set(64,Zt),je.set(65,Vt),je.set(76,we),je.set(78,we),Be.set(38,Fe),Be.set(39,ve),Be.set(40,Ae),Be.set(41,Ne),Be.set(42,_e),Be.set(43,Te),Be.set(47,Ce),Be.set(54,Pe),Be.set(55,Re),Be.set(58,Se),Be.set(66,Fe),Be.set(67,ve),Be.set(68,Ae),Be.set(69,Ne),Be.set(70,_e),Be.set(71,Te),Be.set(72,Ce),Be.set(73,Pe),Be.set(74,Re),Be.set(75,Se));let s=function(t,e=!1){const n=t.map((t=>t.mask)),s=n.filter((t=>null!=t)),r=t[0].pixels[0].length;if(0===s.length)return new Uint8Array(r).fill(255);const o=s[0],i=new Uint8Array(o);if(1===s.length)return i;if(!e){for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)i[t]&&(i[t]=e[t]?255:0)}return i}if(s.length!==n.length)return new Uint8Array(r).fill(255);for(let t=1;t<s.length;t++){const e=s[t];for(let t=0;t<i.length;t++)0===i[t]&&(i[t]=e[t]?255:0)}return i}(t,e>=66&&e<=75);const{outputPixelType:r="f32"}=n,o=!Be.has(e)||n.processAsMultiband,i=o?t[0].pixels.length:1,a=[];for(let n=0;n<i;n++){const i=Be.has(e)&&!o?t.flatMap((t=>t.pixels)):t.map((t=>t.pixels[n]));let u,l=!0;if(e===at.setNull){const t=be(i,s,r);u=t.band,s=t.mask,l=!1}else je.has(e)?u=je.get(e)(i,s,"f64"):ke.has(e)?u=e===it.asin||e===it.acos||e===it.atanh?Lt(i,s,"f64",e):Ut(i,s,"f64",ke.get(e)):Me.has(e)?u=Wt(i,s,"f64",Me.get(e)):Be.has(e)?u=Be.get(e)(i,s,"f64"):(u=i[0],l=!1);if(l&&e!==ot.isNull&&!Mt.has(e)){const t=g.Z.createEmptyBand(r,u.length);s||(s=new Uint8Array(u.length).fill(255)),Ee(u,s,r,t),u=t}a.push(u)}const u=t[0];return new g.Z({width:u.width,height:u.height,pixelType:r,mask:e===ot.isNull?null:s,pixels:a})}(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=jt[t],n=Object.keys(ut).find((e=>ut[e]===t))?.toLowerCase()??"undefined",s=this.outputPixelType??"f32";let[r,o]=(0,lt.r)(s);const i=s.startsWith("u")||s.startsWith("s");return i&&(r-=1e-4,o+=1e-4),{imageCount:e,operationName:n,domainRange:[r,o],isOutputRounded:i}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],Ge.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:kt,json:{write:!0,name:"rasterFunctionArguments"}})],Ge.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],Ge.prototype,"rasterArgumentNames",void 0),Ge=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.LocalFunction")],Ge);const De=Ge;var ze,Oe=n(22021);let Ze=ze=class extends p{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=T.DX.matchAny}get normalizedNoDataValues(){const{noDataValues:t}=this;if(!t?.length)return null;let e=!1;const n=t.map((t=>{if("number"==typeof t)return e=!0,[t];if("string"==typeof t){const n=t.trim().split(" ").filter((t=>""!==t.trim())).map((t=>Number(t)));return e=e||n.length>0,0===n.length?null:n}return null}));return e?n:null}clone(){return new ze({includedRanges:this.includedRanges?.slice()??[],noDataValues:this.noDataValues?.slice()??[],noDataInterpretation:this.noDataInterpretation})}};(0,i._)([(0,a.Cb)({json:{write:!0}})],Ze.prototype,"includedRanges",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],Ze.prototype,"noDataValues",void 0),(0,i._)([(0,a.Cb)()],Ze.prototype,"normalizedNoDataValues",null),(0,i._)([(0,a.Cb)({json:{write:!0}})],Ze.prototype,"noDataInterpretation",void 0),Ze=ze=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.MaskFunctionArguments")],Ze);const Ve=Ze;let Le=class extends w{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:n,normalizedNoDataValues:s}=this.functionArguments;if(!n?.length&&!s?.length)return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let o=0;o<t.bandCount;o++){const t=(0,T.nA)(e,n?.slice(2*o,2*o+2),s?.[o]);if(null==t){r=null;break}r.push(t)}this.lookups=r;const o=null!=s&&s.every((t=>t?.length===s[0]?.length));return{success:!0,supportsGPU:(!n||n.length<=2*T.hd)&&(!s||o&&s[0].length<=T.hd)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{outputPixelType:n,lookups:s}=this,{includedRanges:r,noDataInterpretation:o,normalizedNoDataValues:i}=this.functionArguments,a=o===T.DX.matchAll;return(0,T.sS)(e,{includedRanges:r,noDataValues:i,outputPixelType:n,matchAll:a,lookups:s})}_getWebGLParameters(){const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,n=new Float32Array(T.hd);n.fill(Oe._3),e?.[0]?.length&&n.set(e[0]);const s=new Float32Array(T.hd);for(let e=0;e<s.length;e+=2)s[e]=t?.[e]??-Oe._3,s[e+1]=t?.[e+1]??Oe._3;return t&&t.length&&s.set(t),{bandCount:this.sourceRasterInfos[0].bandCount,noDataValues:n,includedRanges:s}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],Le.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:Ve,json:{write:!0,name:"rasterFunctionArguments"}})],Le.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],Le.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],Le.prototype,"lookups",void 0),Le=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.MaskFunction")],Le);const Ue=Le;var We;let qe=We=class extends p{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scientificOutput=!1}clone(){const{visibleBandID:t,infraredBandID:e,scientificOutput:n}=this;return new We({visibleBandID:t,infraredBandID:e,scientificOutput:n})}};(0,i._)([(0,a.Cb)({json:{write:!0}})],qe.prototype,"visibleBandID",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],qe.prototype,"infraredBandID",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],qe.prototype,"scientificOutput",void 0),qe=We=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.NDVIFunctionArguments")],qe);const Xe=qe;let Je=class extends w{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const e=this.sourceRasterInfos[0].clone();e.pixelType=this.outputPixelType,e.colormap=null,e.histograms=null,e.bandCount=1;const[n,s,r,o]=t?[-1,1,0,.1]:[0,200,100,10];return e.statistics=[{min:n,max:s,avg:r,stddev:o}],this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{visibleBandID:n,infraredBandID:s,scientificOutput:r}=this.functionArguments;return function(t,e,n,s){const{mask:r,pixels:o,width:i,height:a}=t,u=o[n],l=o[e],c=l.length,p=s?new Uint8Array(c):new Float32Array(c),f=s?100:1,h=s?100.5:0;for(let t=0;t<c;t++)if(null==r||r[t]){const e=u[t],n=l[t],s=e+n;s&&(p[t]=(e-n)/s*f+h)}const m=new g.Z({width:i,height:a,mask:r,pixelType:s?"u8":"f32",pixels:[p]});return m.updateStatistics(),m}(e,n,s,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:n}=this.functionArguments;return{bandIndexMat3:M(this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0]),scaled:!n}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:n}=this.functionArguments;return[n,e,0].map((e=>t[e]))}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],Je.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:Xe,json:{write:!0,name:"rasterFunctionArguments"}})],Je.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],Je.prototype,"rasterArgumentNames",void 0),Je=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.NDVIFunction")],Je);const He=Je;var Ye;let $e=Ye=class extends p{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new Ye({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};(0,i._)([(0,a.Cb)({json:{write:!0}})],$e.prototype,"inputRanges",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],$e.prototype,"outputValues",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],$e.prototype,"noDataRanges",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],$e.prototype,"allowUnmatched",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],$e.prototype,"isLastInputRangeInclusive",void 0),$e=Ye=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.RemapFunctionArguments")],$e);const Ke=$e;let Qe=class extends w{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,t.colormap=null,t.histograms=null,t.bandCount=1,t.attributeTable=null;const{statistics:n}=t,{allowUnmatched:s,outputValues:r,inputRanges:o,noDataRanges:i,isLastInputRangeInclusive:a}=this.functionArguments;if(null!=n&&n.length&&r?.length)if(s){const e=Math.min.apply(null,[...r,n[0].min]),s=Math.max.apply(null,[...r,n[0].max]);t.statistics=[{...n[0],min:e,max:s}]}else{let e=r[0],s=e;for(let t=0;t<r.length;t++)e=e>r[t]?r[t]:e,s=s>r[t]?s:r[t];t.statistics=[{...n[0],min:e,max:s}]}return this.rasterInfo=t,this.lookup=s?null:(0,T.oB)({srcPixelType:e,inputRanges:o,outputValues:r,noDataRanges:i,allowUnmatched:s,isLastInputRangeInclusive:a,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!r||r.length<=T.hd)&&(!i||i.length<=T.hd)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:n,outputPixelType:s}=this;if(n){const t=(0,T.XV)(e,{lut:[n.lut],offset:n.offset,outputPixelType:s});return null!=t&&n.mask&&(t.mask=(0,T.wV)(e.pixels[0],e.mask,n.mask,n.offset,"u8")),t}const{inputRanges:r,outputValues:o,noDataRanges:i,allowUnmatched:a,isLastInputRangeInclusive:u}=this.functionArguments;return(0,T.a2)(e,{inputRanges:r,outputValues:o,noDataRanges:i,outputPixelType:s,allowUnmatched:a,isLastInputRangeInclusive:u})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:n}=this.functionArguments,s=new Float32Array(3*T.hd),r=1e-5,o=this.functionArguments.inputRanges??[],i=this.functionArguments.outputValues??[],a=i.length;for(let t=0;t<T.hd;t++)s[3*t]=o[2*t]??Oe._3-1,s[3*t+1]=o[2*t+1]??Oe._3,s[3*t+2]=i[t]??0,t<a&&(t>0&&(s[3*t]-=r),(t<a-1||!n)&&(s[3*t+1]-=r));const u=new Float32Array(2*T.hd);return u.fill(Oe._3),e?.length&&u.set(e),{allowUnmatched:t,rangeMaps:s,noDataRanges:u,clampRange:(0,lt.r)(this.outputPixelType)}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],Qe.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:Ke,json:{write:!0,name:"rasterFunctionArguments"}})],Qe.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],Qe.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],Qe.prototype,"lookup",void 0),Qe=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.RemapFunction")],Qe);const tn=Qe;var en;const nn=new R.X({1:"degree",2:"percent-rise",3:"adjusted"},{useNumericKeys:!0});let sn=en=class extends p{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.removeEdgeEffect=!1}clone(){return new en({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,i._)([(0,A.J)(nn)],sn.prototype,"slopeType",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{write:!0}})],sn.prototype,"zFactor",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{name:"psPower",write:!0}})],sn.prototype,"pixelSizePower",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{name:"psZFactor",write:!0}})],sn.prototype,"pixelSizeFactor",void 0),(0,i._)([(0,a.Cb)({type:Boolean,json:{write:!0}})],sn.prototype,"removeEdgeEffect",void 0),sn=en=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.SlopeFunctionArguments")],sn);const rn=sn;let on=class extends w{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:n,slopeType:s,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:i}=this,{extent:a,primaryPixelSizes:u}=t,l=u?.[0],c=l??(a?{x:a.width/e.width,y:a.height/e.height}:{x:1,y:1});return(0,v.yg)(e,{zFactor:n,slopeType:s,pixelSizePower:r,pixelSizeFactor:o,isGCS:i,resolution:c})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:n,pixelSizePower:s}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*v.CX:t,slopeType:e,pixelSizeFactor:n??0,pixelSizePower:s??0}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],on.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:rn,json:{write:!0,name:"rasterFunctionArguments"}})],on.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],on.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],on.prototype,"isGCS",void 0),on=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.SlopeFunction")],on);const an=on;var un;let ln=un=class extends p{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(t,e){if(!t?.length)return null;const n=[];return t.forEach((t=>{const e={min:t.min,max:t.max,avg:t.avg??t.mean,stddev:t.stddev??t.standardDeviation};n.push(e)})),n}writeStatistics(t,e,n){if(!t?.length)return;const s=[];t.forEach((t=>{const e={...t,mean:t.avg,standardDeviation:t.stddev};delete e.avg,delete e.stddev,s.push(e)})),e[n]=s}clone(){return new un({statistics:(0,o.d9)(this.statistics),histograms:(0,o.d9)(this.histograms)})}};(0,i._)([(0,a.Cb)({json:{write:!0}})],ln.prototype,"statistics",void 0),(0,i._)([(0,V.r)("statistics")],ln.prototype,"readStatistics",null),(0,i._)([(0,Q.c)("statistics")],ln.prototype,"writeStatistics",null),(0,i._)([(0,a.Cb)({json:{write:!0}})],ln.prototype,"histograms",void 0),ln=un=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.StatisticsHistogramFunctionArguments")],ln);const cn=ln;let pn=class extends w{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone(),{statistics:n,histograms:s}=this.functionArguments;return s&&(e.histograms=s),n&&(e.statistics=n),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],pn.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:cn,json:{write:!0,name:"rasterFunctionArguments"}})],pn.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],pn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],pn.prototype,"indexedColormap",void 0),(0,i._)([(0,a.Cb)()],pn.prototype,"isNoopProcess",void 0),pn=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.StatisticsHistogramFunction")],pn);const fn=pn;var hn;const mn=new R.X({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let dn=hn=class extends p{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(t,e,n){t?.length&&(Array.isArray(t[0])||(t=t.map((t=>[t.min,t.max,t.avg,t.stddev]))),e[n]=t)}clone(){return new hn({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,o.d9)(this.statistics),gamma:(0,o.d9)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,o.d9)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,i._)([(0,a.Cb)({type:Boolean,json:{write:!0}})],dn.prototype,"computeGamma",void 0),(0,i._)([(0,a.Cb)({type:Boolean,json:{name:"dra",write:!0}})],dn.prototype,"dynamicRangeAdjustment",void 0),(0,i._)([(0,a.Cb)({type:[Number],json:{write:!0}})],dn.prototype,"gamma",void 0),(0,i._)([(0,a.Cb)()],dn.prototype,"histograms",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{write:!0}})],dn.prototype,"maxPercent",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{write:!0}})],dn.prototype,"minPercent",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{write:!0}})],dn.prototype,"numberOfStandardDeviations",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{name:"max",write:!0}})],dn.prototype,"outputMax",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{name:"min",write:!0}})],dn.prototype,"outputMin",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{write:!0}})],dn.prototype,"sigmoidStrengthLevel",void 0),(0,i._)([(0,a.Cb)({json:{type:[[Number]],write:!0}})],dn.prototype,"statistics",void 0),(0,i._)([(0,Q.c)("statistics")],dn.prototype,"writeStatistics",null),(0,i._)([(0,A.J)(mn)],dn.prototype,"stretchType",void 0),(0,i._)([(0,a.Cb)({type:Boolean,json:{write:!0}})],dn.prototype,"useGamma",void 0),dn=hn=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.StretchFunctionArguments")],dn);const gn=dn;var yn=n(15612);let xn=class extends w{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:e}=t,{functionArguments:n}=this,{dynamicRangeAdjustment:s,gamma:r,useGamma:o}=n;if(!s&&["u8","u16","s8","s16"].includes(e)){const s=(0,yn.AV)(n.toJSON(),{rasterInfo:t}),i=this._isOutputRoundingNeeded()?"round":"float";this.lookup=(0,yn.hE)({pixelType:e,...s,gamma:o?r:null,rounding:i}),this.cutOffs=s}else s||(this.cutOffs=(0,yn.AV)(n.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const i=t.clone();return i.pixelType=this.outputPixelType,i.statistics=null,i.histograms=null,i.colormap=null,i.attributeTable=null,"u8"===this.outputPixelType&&(i.keyProperties.DataType="processed"),this.rasterInfo=i,{success:!0,supportsGPU:!s}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{lookup:n}=this;if(n)return(0,T.XV)(e,{...n,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:s}=this,r=this.cutOffs||(0,yn.AV)(s.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:e}),o=s.useGamma?s.gamma:null;return(0,yn.dy)(e,{...r,gamma:o,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:n,useGamma:s}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,o=s&&n&&n.length?(0,yn.um)(r,n):[1,1,1],{minCutOff:i,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===i.length&&(i[1]=i[2]=i[0],a[1]=a[2]=a[0]);const u=new Float32Array(r);let l;for(l=0;l<r;l++)u[l]=(e-t)/(a[l]-i[l]);const c=this._isOutputRoundingNeeded();return{bandCount:r,outMin:t,outMax:e,minCutOff:i,maxCutOff:a,factor:u,useGamma:s,gamma:s&&n?n:[1,1,1],gammaCorrection:s&&o?o:[1,1,1],stretchType:this.functionArguments.stretchType,isOutputRounded:c,type:"stretch"}}};(0,i._)([(0,a.Cb)({json:{write:!0,name:"rasterFunction"}})],xn.prototype,"functionName",void 0),(0,i._)([(0,a.Cb)({type:gn,json:{write:!0,name:"rasterFunctionArguments"}})],xn.prototype,"functionArguments",void 0),(0,i._)([(0,a.Cb)()],xn.prototype,"rasterArgumentNames",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],xn.prototype,"lookup",void 0),(0,i._)([(0,a.Cb)({json:{write:!0}})],xn.prototype,"cutOffs",void 0),xn=(0,i._)([(0,u.j)("esri.layers.support.rasterFunctions.StretchFunction")],xn);const bn=xn,wn=new Map;function vn(t,e){const{rasterFunctionArguments:n}=t;n&&(n.rasters||[n.raster]).forEach((t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&vn(t,e))}))}function _n(t,e){if(e=e??{},"function"in(t=(0,o.d9)(t))&&"arguments"in t&&t.arguments&&(t=function(t,e){e&&Pn(t,e);const n={};return Fn(t,n),n}(t,e)),"rasterFunction"in t)return Rn(t=An(t),e);throw new r.Z("raster-function-helper","unsupported raster function json.")}function Cn(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function An(t){const{rasterFunction:e,rasterFunctionArguments:n}=t,s={};for(const t in n){let e=n[t];const r=t.toLowerCase();if("rasters"===r&&Array.isArray(e))s.rasters=e.map((t=>Cn(t)?An(t):t));else switch(Cn(e)&&(e=An(e)),r){case"dra":s.dra=e;break;case"pspower":s.psPower=e;break;case"pszfactor":s.psZFactor=e;break;case"bandids":s.bandIds=e;break;default:s[t[0].toLowerCase()+t.slice(1)]=e}}return"Local"!==e||s.rasters?.length||(s.rasters=["$$"]),{...t,rasterFunctionArguments:s}}function Rn(t,e){const{rasterFunction:n,rasterFunctionArguments:s}=t,o=t.outputPixelType?.toLowerCase();if(null==n||!wn.has(n))throw new r.Z("raster-function-helper",`unsupported raster function: ${n}`);const i=wn.get(n),a=("function"==typeof i.ctor?i.ctor:i.ctor.default).fromJSON({...t,outputPixelType:o}),{rasterArgumentNames:u}=a,l=[],c=function(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map((e=>t[e]))}(s,u),p="rasters"===u[0],f=[];for(let t=0;t<c.length;t++){const n=c[t];let s;null==n||"string"==typeof n&&n.startsWith("$")?l.push(e?.raster):"string"==typeof n?e[n]&&l.push(e[n]):"number"!=typeof n&&"rasterFunction"in n&&(s=Rn(n,e),p||(a.functionArguments[u[t]]=s),l.push(s)),p&&f.push(s??n)}if(p&&(a.functionArguments.rasters=f),e){a.sourceRasters=l;const t=e.raster?.url;t&&(a.mainPrimaryRasterId=t)}return a}function Pn(t,e){if(!t||!e)return;let n;for(n in t){const s=t[n];s&&"object"==typeof s&&("function"in s&&s.function&&s.arguments?Pn(s.arguments,e):"type"in s&&"value"in s&&"RasterFunctionVariable"===s.type&&null!=e[s.name]&&(s.value=e[s.name]))}}function Nn(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t)&&0===t.length)return 0===t.length?null:["number","string"].includes(typeof t[0])?t:t.map((t=>Nn(t)));if("value"in t&&["number","string","boolean"].includes(typeof t.value))return t.value;if(!("type"in t))return t;switch(t.type){case"Scalar":return t.value;case"AlgorithmicColorRamp":return In(t);case"MultiPartColorRamp":return{type:"multipart",colorRamps:t.ArrayOfColorRamp.map(In)};case"ArgumentArray":return t.elements?.length?"RasterStatistics"===t.elements[0].type?t.elements:"RasterFunctionVariable"===t.elements[0].type?t.elements.map((t=>null!=t.value?Nn(t.value):t.name.toLowerCase().includes("raster")?"$$":null)):t:t.elements;default:return t}}function In(t){const e=t.algorithm??"esriHSVAlgorithm";let{FromColor:n,ToColor:r}=t;if(!Array.isArray(n)){const{r:t,g:e,b:r}=(0,s.xr)({h:n.Hue,s:n.Saturation,v:n.Value});n=[t,e,r,n.AlphaValue]}if(!Array.isArray(r)){const{r:t,g:e,b:n}=(0,s.xr)({h:r.Hue,s:r.Saturation,v:r.Value});r=[t,e,n,r.AlphaValue]}return{type:"algorithmic",algorithm:e,fromColor:n,toColor:r}}function Fn(t,e){if(!t||!e)return;const{function:n,arguments:s}=t;if(!n||!s)return;e.rasterFunction=n.type.replace("Function",""),e.outputPixelType=n.pixelType;const r={};e.rasterFunctionArguments=r;for(const t in s){const n=s[t];"object"==typeof n&&("function"in n&&n.function&&n.arguments?(e.rasterFunctionArguments[t]={},Fn(n,e.rasterFunctionArguments[t])):"value"in n&&(r[t]=Nn(n.value)))}switch(r.DEM&&!r.Raster&&(r.Raster=r.DEM,delete r.DEM),e.rasterFunction){case"Stretch":!function(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map((t=>[t.min,t.max,t.mean,t.standardDeviation]))),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}(r);break;case"Colormap":!function(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}(r);break;case"Convolution":!function(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}(r);break;case"Mask":!function(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter((t=>""!==t)).map((t=>Number(t))))}(r)}}wn.set("Aspect",{desc:"Aspect Function",ctor:C,rasterArgumentNames:["raster"]}),wn.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:O,rasterArgumentNames:["raster"]}),wn.set("Colormap",{desc:"Colormap Function",ctor:$,rasterArgumentNames:["raster"]}),wn.set("CompositeBand",{desc:"CompositeBand Function",ctor:st,rasterArgumentNames:["rasters"]}),wn.set("Convolution",{desc:"Convolution Function",ctor:xt,rasterArgumentNames:["raster"]}),wn.set("ExtractBand",{desc:"ExtractBand Function",ctor:Ft,rasterArgumentNames:["raster"]}),wn.set("Curvature",{desc:"Curvature Function",ctor:At,rasterArgumentNames:["raster"]}),wn.set("Local",{desc:"Local Function",ctor:De,rasterArgumentNames:["rasters"]}),wn.set("Mask",{desc:"Mask Function",ctor:Ue,rasterArgumentNames:["raster"]}),wn.set("NDVI",{desc:"NDVI Function",ctor:He,rasterArgumentNames:["raster"]}),wn.set("Remap",{desc:"Remap Function",ctor:tn,rasterArgumentNames:["raster"]}),wn.set("Slope",{desc:"Slope Function",ctor:an,rasterArgumentNames:["raster"]}),wn.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:fn,rasterArgumentNames:["raster"]}),wn.set("Stretch",{desc:"Stretch Function",ctor:bn,rasterArgumentNames:["raster"]})},73506:(t,e,n)=>{n.d(e,{Hq:()=>Z,Mk:()=>m,P_:()=>V,Qp:()=>L,VO:()=>R,Wt:()=>E,kZ:()=>q,kr:()=>X,nF:()=>N,tB:()=>B,ut:()=>D,zD:()=>A}),n(66577);var s,r,o=n(67676),i=n(20102),a=n(67900),u=n(83305),l=n(44547),c=n(6570),p=n(94139),f=n(38913),h=n(82971);function m(t,e,n){return!(0,l.Up)(t,e,n)}function d(t,e,n){const s=m(t,e,n);if(s&&!(0,l.kR)())throw new i.Z("rasterprojectionhelper-project","projection engine is not loaded");return s}(r=s||(s={}))[r.None=0]="None",r[r.North=1]="North",r[r.South=2]="South",r[r.Both=3]="Both";const g=(t,e,n,s=0)=>{if(1===n[0])return[0,0];let r=1,o=-1,i=1,a=-1;for(let e=0;e<t.length;e+=2)isNaN(t[e])||(r=r>t[e]?t[e]:r,o=o>t[e]?o:t[e],i=i>t[e+1]?t[e+1]:i,a=a>t[e+1]?a:t[e+1]);const{cols:u,rows:l}=e,c=(o-r)/u/n[0],p=(a-i)/l/n[1],f=2*s;let h=0,m=!1,d=[0,0];for(let e=0;e<u-3;e++){for(let n=0;n<l-3;n++){const s=e*l*2+2*n,r=(t[s]+t[s+4]+t[s+4*l]+t[s+4*l+4])/4,o=(t[s+1]+t[s+5]+t[s+4*l+1]+t[s+4*l+5])/4,i=Math.abs((r-t[s+2*l+2])/c),a=Math.abs((o-t[s+2*l+3])/p);if(i+a>h&&(h=i+a,d=[i,a]),f&&h>f){m=!0;break}}if(m)break}return d},y={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},x=32,b=4,w=b,v=new Map,_=new Map,C=500;async function A(){(0,l.kR)()||await(0,l.zD)()}function R(t,e,n,s=null){const r=t.spatialReference;if(r.equals(e))return t;d(r,e,s);const o=n.center,i=new c.Z({xmin:o.x-t.x/2,xmax:o.x+t.x/2,ymin:o.y-t.y/2,ymax:o.y+t.y/2,spatialReference:r}),u=(0,l.iV)(i,e,s),p=D(e);let f;if(null==u||null!=p&&u.width>=p){const n=(0,a.c9)(r)/(0,a.c9)(e);f={x:t.x*n,y:t.y*n}}else f={x:u.width,y:u.height};return f}function P(t,e=.01){return(0,a.c9)(t)?e/(0,a.c9)(t):0}function N(t,e,n=null,s=!0){const r=t.spatialReference;if(r.equals(e))return t;d(r,e,n);const o=(0,l.iV)(t,e,n);return s&&o?(I([t],[o],r,e),o):o}function I(t,e,n,s){const r=z(n,!0),o=z(s,!0),i=P(n,C),a=P(s,C);if(i&&null!=r&&null!=o)for(let n=0;n<t.length;n++){const s=e[n];if(!s)continue;const{x:u}=t[n],{x:l}=s;l>=o[1]-a&&Math.abs(u-r[0])<i?s.x-=o[1]-o[0]:l<=o[0]+a&&Math.abs(u-r[1])<i&&(s.x+=o[1]-o[0])}}function F(t){const{inSR:e,outSR:n,datumTransformation:s,preferPE:r}=t;if(e.equals(n)){const{points:e}=M(t,null);return e}if(e.isWebMercator&&n.isWGS84||e.isWGS84&&n.isWebMercator)return function(t){const{cols:e,rows:n,xres:s,yres:r,usePixelCenter:o,inSR:i,outSR:a}=t;let{xmin:u,ymax:c}=t;o&&(u+=s/2,c-=r/2);const f=[],h=[],m=Math.max(e,n);for(let t=0;t<m;t++){const o=u+s*Math.min(e,t),m=c-r*Math.min(n,t),d=(0,l.iV)(new p.Z({x:o,y:m,spatialReference:i}),a);t<=e&&f.push(d.x),t<=n&&h.push(d.y)}const d=[];for(let t=0;t<e;t++)for(let e=0;e<n;e++)d.push([f[t],h[e]]);return d}(t);if(d(e,n,s)&&r){if(e.isGeographic)return T(t);if(null!=S(e))return T(t)}return function(t){const{points:e}=M(t,null),{inSR:n,outSR:s,datumTransformation:r}=t,o=e.map((t=>new p.Z(t[0],t[1],n))),i=(0,l.iV)(o,s,r);return r&&I(o,i,n,s),i.map((t=>t?[t.x,t.y]:[NaN,NaN]))}(t)}function T(t){const{inSR:e,outSR:n,datumTransformation:s}=t,r=S(e),{points:o,mask:i}=M(t,r);if(!e.isGeographic){const t=e.wkid?u.e.coordsys(e.wkid):u.e.fromString(e.isGeographic?u.f.PE_TYPE_GEOGCS:u.f.PE_TYPE_PROJCS,e.wkt);u.g.projToGeog(t,o.length,o)}if(null!=s&&s.steps.length){let t;const e=179.9955;if(n.isGeographic&&(t=o.map((([t])=>t>e?1:t<-e?-1:0))),s.steps.forEach((t=>{const e=t.wkid?u.e.geogtran(t.wkid):u.e.fromString(u.f.PE_TYPE_GEOGTRAN,t.wkt);u.h.geogToGeog(e,o.length,o,null,t.isInverse?u.f.PE_TRANSFORM_2_TO_1:u.f.PE_TRANSFORM_1_TO_2)})),t)for(let n=0;n<o.length;n++){const s=t[n],r=o[n][0],i=r>e?1:r<-e?-1:0;s&&i&&s!==i&&(o[n][0]=s>0?r+360:r-360)}}if(!n.isGeographic){const t=S(n,!0),e=null!=t&&t.isEnvelope?[t.bbox[1],t.bbox[3]]:[-90,90];!function(t,e){const[n,s]=e;for(let e=0;e<t.length;e++){const r=t[e][1];(r<n||r>s)&&(t[e]=[NaN,NaN])}}(o,e);const s=n.wkid?u.e.coordsys(n.wkid):u.e.fromString(n.isGeographic?u.f.PE_TYPE_GEOGCS:u.f.PE_TYPE_PROJCS,n.wkt);u.g.geogToProj(s,o.length,o)}let a=o;if(i&&o.length!==i.length){a=[];for(let t=0,e=0;t<i.length;t++)i[t]?a.push(o[e++]):a.push([NaN,NaN])}return a}function S(t,e=!1){let n=t.wkid||t.wkt;if(!n||t.isGeographic)return null;if(n=String(n),v.has(n)){const t=v.get(n);return e?t?.gcs:t?.pcs}const s=t.wkid?u.e.coordsys(t.wkid):u.e.fromString(t.isGeographic?u.f.PE_TYPE_GEOGCS:u.f.PE_TYPE_PROJCS,t.wkt),r=k(s,P(t,1e-4)),o=k(s,0,!0);return v.set(n,{pcs:r,gcs:o}),e?o:r}function k(t,e=0,n=!1){const s=u.j.generate(t),r=n?t.horizonGcsGenerate():t.horizonPcsGenerate();if(!s||!r?.length)return null;let o=!1,i=r.find((t=>1===t.getInclusive()&&1===t.getKind()));if(!i){if(i=r.find((t=>1===t.getInclusive()&&0===t.getKind())),!i)return null;o=!0}const a=n?0:(2===s.getNorthPoleLocation()?1:0)|(2===s.getSouthPoleLocation()?2:0),l=s.isPannableRectangle(),c=i.getCoord();if(o)return{isEnvelope:o,isPannable:l,vertices:c,coef:null,bbox:[c[0][0]-e,c[0][1]-e,c[1][0]+e,c[1][1]+e],poleLocation:a};let p=0;const f=[];let[h,m]=c[0],[d,g]=c[0];for(let t=0,e=c.length;t<e;t++){p++,p===e&&(p=0);const[n,s]=c[t],[r,o]=c[p];if(o===s)f.push([n,r,s,o,2]);else{const t=(r-n)/(o-s||1e-4),e=n-t*s;s<o?f.push([t,e,s,o,0]):f.push([t,e,o,s,1])}h=h<n?h:n,m=m<s?m:s,d=d>n?d:n,g=g>s?g:s}return{isEnvelope:!1,isPannable:l,vertices:c,coef:f,bbox:[h,m,d,g],poleLocation:a}}function M(t,e){const n=[],{cols:s,rows:r,xres:o,yres:i,usePixelCenter:a}=t;let{xmin:u,ymax:l}=t;if(a&&(u+=o/2,l-=i/2),null==e){for(let t=0;t<s;t++)for(let e=0;e<r;e++)n.push([u+o*t,l-i*e]);return{points:n}}const c=new Uint8Array(s*r);if(e.isEnvelope){const{bbox:[t,a,p,f]}=e;for(let h=0,m=0;h<s;h++){const s=u+o*h,d=e.isPannable||s>=t&&s<=p;for(let t=0;t<r;t++,m++){const e=l-i*t;d&&e>=a&&e<=f&&(n.push([s,e]),c[m]=1)}}return{points:n,mask:c}}const p=e.coef,f=[];for(let t=0;t<r;t++){const e=l-i*t,n=[],s=[];for(let t=0;t<p.length;t++){const[r,o,i,a,u]=p[t];if(e===i&&i===a)n.push(r),n.push(o),s.push(2),s.push(2);else if(e>=i&&e<=a){const t=r*e+o;n.push(t),s.push(u)}}let r=n;if(n.length>2){let t=2===s[0]?0:s[0],e=n[0];r=[];for(let o=1;o<s.length;o++)2===s[o]&&o!==s.length-1||(s[o]!==t&&(r.push(0===t?Math.min(e,n[o-1]):Math.max(e,n[o-1])),t=s[o],e=n[o]),o===s.length-1&&r.push(0===s[o]?Math.min(e,n[o]):Math.max(e,n[o])));r.sort(((t,e)=>t-e))}else n[0]>n[1]&&(r=[n[1],n[0]]);f.push(r)}for(let t=0,e=0;t<s;t++){const s=u+o*t;for(let t=0;t<r;t++,e++){const r=l-i*t,o=f[t];if(2===o.length)s>=o[0]&&s<=o[1]&&(n.push([s,r]),c[e]=1);else if(o.length>2){let t=!1;for(let e=0;e<o.length;e+=2)if(s>=o[e]&&s<=o[e+1]){t=!0;break}t&&(n.push([s,r]),c[e]=1)}}}return{points:n,mask:c}}function j(t){const e=D(t[0].spatialReference);if(t.length<2||null==e)return t[0];const n=P(t[0].spatialReference);if(1===(t=t.filter((t=>t.width>n))).length)return t[0];let{xmin:s,xmax:r,ymin:o,ymax:i}=t[0];for(let n=1;n<t.length;n++){const s=t[n];r=s.xmax+e*n,o=Math.min(o,s.ymin),i=Math.max(i,s.ymax)}return new c.Z({xmin:s,xmax:r,ymin:o,ymax:i,spatialReference:t[0].spatialReference})}function B(t,e,n=null,r=!0){const i=t.spatialReference;if(i.equals(e))return t;const a=Z(t),u=D(i,!0),p=D(e);if(0===a||null==u||null==p){const o=G(t,e,n,r);if(null==u&&null!=p&&Math.abs(o.width-p)<P(e)&&(0,l.kR)()){const n=S(i);if(null!=n&&n.poleLocation===s.None&&t.width<(n.bbox[2]-n.bbox[0])/2)return function(t,e){const n=D(e);if(null==n)return null;let{xmin:s,ymin:r,xmax:o,ymax:i}=t;const a=t.spatialReference,u=new f.Z({spatialReference:a,rings:[[[s,r],[o,r],[o,i],[s,i],[s,r]]]}),p=(0,l.iV)(u,e);if(2!==p.rings.length||!p.rings[0].length||!p.rings[1].length)return null;const{rings:h}=p,m=P(a),d=new c.Z({spatialReference:e});for(let t=0;t<2;t++){s=o=h[t][0][0],r=i=h[t][0][1];for(let e=0;e<h[t].length;e++)s=s>h[t][e][0]?h[t][e][0]:s,o=o<h[t][e][0]?h[t][e][0]:o,r=r>h[t][e][1]?h[t][e][1]:r,i=i<h[t][e][1]?h[t][e][1]:i;if(0===t)d.ymin=r,d.ymax=i,d.xmin=s,d.xmax=o;else if(d.ymin=Math.min(d.ymin,r),d.ymax=Math.max(d.ymax,i),Math.abs(o-n/2)<m)d.xmin=s,d.xmax=d.xmax+n;else{if(!(Math.abs(s+n/2)<m))return null;d.xmax=o+n}}return d}(t,e)||o}return o}const h=t.clone().normalize();if(1===h.length&&t.xmax<u&&t.xmax-u/2>P(i)){const{xmin:e,xmax:n}=t;for(let s=0;s<=a;s++){const r=0===s?e:-u/2,o=s===a?n-u*s:u/2;h[s]=new c.Z({xmin:r,xmax:o,ymin:t.ymin,ymax:t.ymax,spatialReference:i})}}return j(h.map((t=>G(t,e,n,r))).filter(o.pC))}function E(t,e,n){if("extent"===t.type){const{xmin:e,ymin:n,xmax:s,ymax:r,spatialReference:o}=t;t=new f.Z({rings:[[[e,r],[s,r],[s,n],[e,n],[e,r]]],spatialReference:o})}return t.spatialReference.equals(e)?t:(d(t.spatialReference,e,n),(0,l.iV)(t,e,n))}function G(t,e,n=null,s=!0,r=!0){const o=t.spatialReference;if(o.equals(e)||!e)return t;d(o,e,n);const i=(0,l.iV)(t,e,n);if(r&&e.isWebMercator&&i&&(i.ymax=Math.min(20037508.342787,i.ymax),i.ymin=Math.max(-20037508.342787,i.ymin),i.ymin>=i.ymax))return null;if(!s||!i)return i;const a=z(o,!0),u=z(e,!0);if(null==a||null==u)return i;const c=P(o,.001),f=P(o,C),h=P(e,.001);if(Math.abs(i.xmin-u[0])<h&&Math.abs(i.xmax-u[1])<h){const s=Math.abs(t.xmin-a[0]),r=Math.abs(a[1]-t.xmax);if(s<c&&r>f){i.xmin=u[0];const s=[];s.push(new p.Z(t.xmax,t.ymin,o)),s.push(new p.Z(t.xmax,(t.ymin+t.ymax)/2,o)),s.push(new p.Z(t.xmax,t.ymax,o));const r=s.map((t=>N(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));i.xmax=Math.max.apply(null,r)}if(r<c&&s>f){i.xmax=u[1];const s=[];s.push(new p.Z(t.xmin,t.ymin,o)),s.push(new p.Z(t.xmin,(t.ymin+t.ymax)/2,o)),s.push(new p.Z(t.xmin,t.ymax,o));const r=s.map((t=>N(t,e,n))).filter((t=>!isNaN(t?.x))).map((t=>t.x));i.xmin=Math.min.apply(null,r)}}else{const t=P(e,.001);Math.abs(i.xmin-u[0])<t&&(i.xmin=u[0]),Math.abs(i.xmax-u[1])<t&&(i.xmax=u[1])}return i}function D(t,e=!1){if(!t)return null;const n=e?20037508.342787:20037508.342788905;return t.isWebMercator?2*n:t.wkid&&t.isGeographic?360:2*y[t.wkid]||null}function z(t,e=!1){if(t.isGeographic)return[-180,180];const n=D(t,e);return null!=n?[-n/2,n/2]:null}function O(t,e,n,s){let r=(t-e)/n;return r-Math.floor(r)!=0?r=Math.floor(r):s&&(r-=1),r}function Z(t,e=!1){const n=D(t.spatialReference);if(null==n)return 0;const s=e?0:-n/2,r=P(t.spatialReference),o=!e&&Math.abs(t.xmax-n/2)<r?n/2:t.xmax,i=!e&&Math.abs(t.xmin+n/2)<r?-n/2:t.xmin;return O(o,s,n,!0)-O(i,s,n,!1)}function V(t){const e=t.storageInfo.origin.x,n=D(t.spatialReference,!0);if(null==n)return{originX:e,halfWorldWidth:null,pyramidsInfo:null};const s=n/2,{nativePixelSize:r,storageInfo:o,extent:i}=t,{maximumPyramidLevel:a,blockWidth:u,pyramidScalingFactor:l}=o;let c=r.x;const p=[],f=null!=t.transform&&"gcs-shift"===t.transform.type,h=e+(f?0:s),m=f?n-e:s-e;for(let t=0;t<=a;t++){const t=(i.xmax-e)/c/u,n=t-Math.floor(t)==0?t:Math.ceil(t),s=m/c/u,r=s-Math.floor(s)==0?s:Math.ceil(s),o=Math.floor(h/c/u),a=Math.round(h/c)%u,f=(u-Math.round(m/c)%u)%u;p.push({resolutionX:c,blockWidth:u,datsetColumnCount:n,worldColumnCountFromOrigin:r,leftMargin:a,rightPadding:f,originColumnOffset:o}),c*=l}return{originX:e,halfWorldWidth:s,pyramidsInfo:p,hasGCSSShiftTransform:f}}function L(t){const e=t.isAdaptive&&null==t.spacing;let n=t.spacing||[x,x],s=U(t),r={cols:s.size[0]+1,rows:s.size[1]+1};const o=s.outofBoundPointCount>0&&s.outofBoundPointCount<s.offsets.length/2;let i=s.outofBoundPointCount===s.offsets.length/2||e&&o?[0,0]:g(s.offsets,r,n,w);const a=(i[0]+i[1])/2,l=t.projectedExtent.spatialReference,c=t.srcBufferExtent.spatialReference;if(e&&(o||a>w)&&(m(l,c,t.datumTransformation)&&(l.isGeographic||S(l)),n=[b,b],s=U({...t,spacing:n}),r={cols:s.size[0]+1,rows:s.size[1]+1},i=g(s.offsets,r,n,w)),s.error=i,n[0]>1&&(s.coefficients=W(s.offsets,r,o)),t.includeGCSGrid&&!l.isGeographic&&!l.isWebMercator)if(c.isGeographic)s.gcsGrid={offsets:s.offsets,coefficients:s.coefficients,spacing:n};else{const e=S(l);if(null!=e&&!e.isEnvelope){const e=function(t){if(!t||t.isGeographic)return t;const e=String(t.wkid||t.wkt);let n;return _.has(e)?n=_.get(e):(n=(t.wkid?u.e.coordsys(t.wkid):u.e.fromString(u.f.PE_TYPE_PROJCS,t.wkt)).getGeogcs().getCode(),_.set(e,n)),new h.Z({wkid:n})}(l),i=B(t.projectedExtent,e),{offsets:a}=U({...t,srcBufferExtent:i,spacing:n}),c=W(a,r,o);s.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return s}function U(t){const{projectedExtent:e,srcBufferExtent:n,pixelSize:s,datumTransformation:r,rasterTransform:o}=t,i=e.spatialReference,a=n.spatialReference,u=d(i,a),{xmin:l,ymin:c,xmax:f,ymax:h}=e,m=D(a),g=null!=m&&(t.hasWrapAround||"gcs-shift"===o?.type),y=t.spacing||[x,x],w=y[0]*s.x,v=y[1]*s.y,_=1===y[0],A=Math.ceil((f-l)/w-.1/y[0])+(_?0:1),R=Math.ceil((h-c)/v-.1/y[1])+(_?0:1),N=F({cols:A,rows:R,xmin:l,ymax:h,xres:w,yres:v,inSR:i,outSR:a,datumTransformation:r,preferPE:y[0]<=b,usePixelCenter:_}),I=[];let T,k=0;const M=_?-1:NaN,{xmin:j,xmax:B,ymax:E,width:G,height:z}=n,O=P(a,C),Z=null!=m&&j>0&&B>m/2;let V=!1;if(u){const t=S(i);V=null!=t&&t.poleLocation>0}for(let t=0;t<A;t++){const e=[];for(let n=0;n<R;n++){let s=N[t*R+n];if(g&&s[0]>B&&s[0]>m/2-O?s[0]-=m:g&&0===t&&s[0]<0&&Z&&!o&&(s[0]+=m),!s||isNaN(s[0])||isNaN(s[1]))I.push(M),I.push(M),e.push(null),k++;else{if(o){const t=o.inverseTransform(new p.Z({x:s[0],y:s[1],spatialReference:a}));s=[t.x,t.y]}e.push(s),t>0&&g&&T[n]&&s[0]<T[n][0]&&(s[0]+=m,V&&s[0]>B&&s[0]>m&&(s[0]-=m)),I.push((s[0]-j)/G),I.push((E-s[1])/z)}}T=e}return{offsets:I,error:null,coefficients:null,outofBoundPointCount:k,spacing:y,size:_?[A,R]:[A-1,R-1]}}function W(t,e,n){const{cols:s,rows:r}=e,o=new Float32Array((s-1)*(r-1)*2*6),i=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let e=0;e<s-1;e++){for(let n=0;n<r-1;n++){let u=e*r*2+2*n;const l=t[u],c=t[u+1],p=t[u+2],f=t[u+3];u+=2*r;const h=t[u],m=t[u+1],d=t[u+2],g=t[u+3];let y=0,x=12*(n*(s-1)+e);for(let t=0;t<3;t++)o[x++]=i[y++]*l+i[y++]*p+i[y++]*d;y=0;for(let t=0;t<3;t++)o[x++]=i[y++]*c+i[y++]*f+i[y++]*g;y=0;for(let t=0;t<3;t++)o[x++]=a[y++]*l+a[y++]*h+a[y++]*d;y=0;for(let t=0;t<3;t++)o[x++]=a[y++]*c+a[y++]*m+a[y++]*g}if(n)for(let t=0;t<o.length;t++)isNaN(o[t])&&(o[t]=-1)}return o}function q(t){const e=t.clone().normalize();return 1===e.length?e[0]:j(e)}function X(t,e,n){const{storageInfo:s,pixelSize:r}=e;let o=0,i=!1;const{pyramidResolutions:u}=s;if(null!=u&&u.length){const s=(t.x+t.y)/2,l=u[u.length-1],c=(l.x+l.y)/2,f=(r.x+r.y)/2;if(s<=f)o=0;else if(s>=c)o=u.length,i=s/c>8;else{let t,e=f;for(let r=1;r<=u.length;r++){if(t=(u[r-1].x+u[r-1].y)/2,s<=t){s===t?o=r:"down"===n?(o=r-1,i=s/e>8):o="up"===n||s-e>t-s||s/e>2?r:r-1;break}e=t}}const h=0===o?r:u[o-1];return i&&Math.min(h.x,h.y)*(0,a.c9)(e.spatialReference)>19567&&(i=!1),{pyramidLevel:o,pyramidResolution:new p.Z({x:h.x,y:h.y,spatialReference:e.spatialReference}),excessiveReading:i}}const l=Math.log(t.x/r.x)/Math.LN2,c=Math.log(t.y/r.y)/Math.LN2,f=e.storageInfo.maximumPyramidLevel||0;o="down"===n?Math.floor(Math.min(l,c)):"up"===n?Math.ceil(Math.max(l,c)):Math.round((l+c)/2),o<0?o=0:o>f&&(i=o>f+3,o=f);const h=2**o;return{pyramidLevel:o,pyramidResolution:new p.Z({x:h*e.nativePixelSize.x,y:h*e.nativePixelSize.y,spatialReference:e.spatialReference}),excessiveReading:i}}},48700:(t,e,n)=>{n.d(e,{Z:()=>u});var s=n(43697),r=n(96674),o=n(5600),i=(n(75215),n(67676),n(80442),n(52011));let a=class extends r.wq{get affectsPixelSize(){return!1}forwardTransform(t){return t}inverseTransform(t){return t}};(0,s._)([(0,o.Cb)()],a.prototype,"affectsPixelSize",null),(0,s._)([(0,o.Cb)({json:{write:!0}})],a.prototype,"spatialReference",void 0),a=(0,s._)([(0,i.j)("esri.layers.support.rasterTransforms.BaseRasterTransform")],a);const u=a},29680:(t,e,n)=>{n.d(e,{Z:()=>l});var s=n(43697),r=n(5600),o=(n(75215),n(67676),n(80442),n(36030)),i=n(52011),a=n(48700);let u=class extends a.Z{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(t){return"point"===(t=t.clone()).type?(t.x>180+this.tolerance&&(t.x-=360),t):(t.xmin>=180-this.tolerance?(t.xmax-=360,t.xmin-=360):t.xmax>180+this.tolerance&&(t.xmin=-180,t.xmax=180),t)}inverseTransform(t){return"point"===(t=t.clone()).type?(t.x<-this.tolerance&&(t.x+=360),t):(t.xmin<-this.tolerance&&(t.xmin+=360,t.xmax+=360),t)}};(0,s._)([(0,o.J)({GCSShiftXform:"gcs-shift"})],u.prototype,"type",void 0),(0,s._)([(0,r.Cb)()],u.prototype,"tolerance",void 0),u=(0,s._)([(0,i.j)("esri.layers.support.rasterTransforms.GCSShiftTransform")],u);const l=u},87390:(t,e,n)=>{n.d(e,{Z:()=>d});var s=n(43697),r=(n(66577),n(5600)),o=(n(75215),n(67676),n(80442),n(36030)),i=n(71715),a=n(52011),u=n(30556),l=n(48700),c=n(94139),p=n(6570);function f(t,e,n){const{x:s,y:r}=e;if(n<2)return{x:t[0]+s*t[2]+r*t[4],y:t[1]+s*t[3]+r*t[5]};if(2===n){const e=s*s,n=r*r,o=s*r;return{x:t[0]+s*t[2]+r*t[4]+e*t[6]+o*t[8]+n*t[10],y:t[1]+s*t[3]+r*t[5]+e*t[7]+o*t[9]+n*t[11]}}const o=s*s,i=r*r,a=s*r,u=o*s,l=o*r,c=s*i,p=r*i;return{x:t[0]+s*t[2]+r*t[4]+o*t[6]+a*t[8]+i*t[10]+u*t[12]+l*t[14]+c*t[16]+p*t[18],y:t[1]+s*t[3]+r*t[5]+o*t[7]+a*t[9]+i*t[11]+u*t[13]+l*t[15]+c*t[17]+p*t[19]}}function h(t,e,n){const{xmin:s,ymin:r,xmax:o,ymax:i,spatialReference:a}=e;let u=[];if(n<2)u.push({x:s,y:i}),u.push({x:o,y:i}),u.push({x:s,y:r}),u.push({x:o,y:r});else{let t=10;for(let e=0;e<t;e++)u.push({x:s,y:r+(i-r)*e/(t-1)}),u.push({x:o,y:r+(i-r)*e/(t-1)});t=8;for(let e=1;e<=t;e++)u.push({x:s+(o-s)*e/t,y:r}),u.push({x:s+(o-s)*e/t,y:i})}u=u.map((e=>f(t,e,n)));const l=u.map((t=>t.x)),c=u.map((t=>t.y));return new p.Z({xmin:Math.min.apply(null,l),xmax:Math.max.apply(null,l),ymin:Math.min.apply(null,c),ymax:Math.max.apply(null,c),spatialReference:a})}let m=class extends l.Z{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(t,e){const{coeffX:n,coeffY:s}=e;if(!n?.length||!s?.length||n.length!==s.length)return null;const r=[];for(let t=0;t<n.length;t++)r.push(n[t]),r.push(s[t]);return r}writeForwardCoefficients(t,e,n){const s=[],r=[];for(let e=0;e<t?.length;e++)e%2==0?s.push(t[e]):r.push(t[e]);e.coeffX=s,e.coeffY=r}get inverseCoefficients(){let t=this._get("inverseCoefficients");const e=this._get("forwardCoefficients");return!t&&e&&this.polynomialOrder<2&&(t=function(t){const[e,n,s,r,o,i]=t,a=s*i-o*r,u=o*r-s*i;return[(o*n-e*i)/a,(s*n-e*r)/u,i/a,r/u,-o/a,-s/u]}(e)),t}set inverseCoefficients(t){this._set("inverseCoefficients",t)}readInverseCoefficients(t,e){const{inverseCoeffX:n,inverseCoeffY:s}=e;if(!n?.length||!s?.length||n.length!==s.length)return null;const r=[];for(let t=0;t<n.length;t++)r.push(n[t]),r.push(s[t]);return r}writeInverseCoefficients(t,e,n){const s=[],r=[];for(let e=0;e<t?.length;e++)e%2==0?s.push(t[e]):r.push(t[e]);e.inverseCoeffX=s,e.inverseCoeffY=r}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(t){if("point"===t.type){const e=f(this.forwardCoefficients,t,this.polynomialOrder);return new c.Z({x:e.x,y:e.y,spatialReference:t.spatialReference})}return h(this.forwardCoefficients,t,this.polynomialOrder)}inverseTransform(t){if("point"===t.type){const e=f(this.inverseCoefficients,t,this.polynomialOrder);return new c.Z({x:e.x,y:e.y,spatialReference:t.spatialReference})}return h(this.inverseCoefficients,t,this.polynomialOrder)}};(0,s._)([(0,r.Cb)({json:{write:!0}})],m.prototype,"polynomialOrder",void 0),(0,s._)([(0,r.Cb)()],m.prototype,"forwardCoefficients",void 0),(0,s._)([(0,i.r)("forwardCoefficients",["coeffX","coeffY"])],m.prototype,"readForwardCoefficients",null),(0,s._)([(0,u.c)("forwardCoefficients")],m.prototype,"writeForwardCoefficients",null),(0,s._)([(0,r.Cb)({json:{write:!0}})],m.prototype,"inverseCoefficients",null),(0,s._)([(0,i.r)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],m.prototype,"readInverseCoefficients",null),(0,s._)([(0,u.c)("inverseCoefficients")],m.prototype,"writeInverseCoefficients",null),(0,s._)([(0,r.Cb)()],m.prototype,"affectsPixelSize",null),(0,s._)([(0,o.J)({PolynomialXform:"polynomial"})],m.prototype,"type",void 0),m=(0,s._)([(0,a.j)("esri.layers.support.rasterTransforms.PolynomialTransform")],m);const d=m},87521:(t,e,n)=>{n.d(e,{j:()=>h,c:()=>m});var s=n(29680),r=n(43697),o=(n(92604),n(75215),n(67676),n(80442),n(20102),n(36030)),i=n(52011),a=n(48700);let u=class extends a.Z{constructor(){super(...arguments),this.type="identity"}};(0,r._)([(0,o.J)({IdentityXform:"identity"})],u.prototype,"type",void 0),u=(0,r._)([(0,i.j)("esri.layers.support.rasterTransforms.IdentityTransform")],u);const l=u;var c=n(87390);const p={GCSShiftXform:s.Z,IdentityXform:l,PolynomialXform:c.Z},f=Object.keys(p);function h(t){const e=t?.type;return!t||f.includes(e)}function m(t){const e=t?.type;if(!e)return null;const n=p[t?.type];if(n){const e=new n;return e.read(t),e}return null}}}]);
|