@arcgis/core 5.2.9 → 5.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/026d7f015393f6738b44.js +1 -0
  3. package/assets/esri/core/workers/chunks/{6694e2b27fd6ddf44e21.js → 09fc38ba2c1509ee3403.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{0f7455dbe8c2ee464194.js → 0a75d01eae8721bd6160.js} +1 -1
  5. package/assets/esri/core/workers/chunks/199f11addadcd606fe23.js +2 -0
  6. package/assets/esri/core/workers/chunks/1e9c6fc26f34077da9d5.js +1 -0
  7. package/assets/esri/core/workers/chunks/266f19253d1d6610e0a4.js +2 -0
  8. package/assets/esri/core/workers/chunks/{900c8569596609183f19.js → 316fb4f9c8618b4c7a22.js} +2 -2
  9. package/assets/esri/core/workers/chunks/{46071e59290bf06bb614.js → 3c13bdcc04757e728ef5.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{35f8896b52adaf952657.js → 46092b5ec3031fec3816.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{b54ba2bd6b1b90dcc0cc.js → 714ec1911429b9152663.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{46d91cd99558304da0c7.js → 71b433530ea68fc6334d.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{5bf7de2e2faa55e53629.js → 86a907f692dac05d92df.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{d05665ddc8d31403aed3.js → 9236a9cf9f2a15a05190.js} +1 -1
  15. package/assets/esri/core/workers/chunks/aaceac7f1274e89f4279.js +2 -0
  16. package/assets/esri/core/workers/chunks/{4cf72dcccf2be353a701.js → b7e32fe735235c1ec9d1.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{f79494829a5b65b5b4c9.js → b81f31aecaec53470fa8.js} +1 -1
  18. package/assets/esri/core/workers/chunks/bcf49bdab7e095e0459d.js +2 -0
  19. package/assets/esri/core/workers/chunks/{c4c55d8a98ba3f51f63c.js → bd6543269a1f656eed0e.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{8ac4a043a4f185db271f.js → c107c922caa8e92db600.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{648d5cdfc3e92be3db55.js → ce8e107b1b4ce8d64397.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{983b85727e09c54bede0.js → d1505a963c22270794df.js} +1 -1
  23. package/assets/esri/core/workers/chunks/ddaabd6d01a17815cc55.js +2 -0
  24. package/assets/esri/core/workers/chunks/{26261b21d1edf476ea49.js → f7ec3b7f2eccd9c4c2e5.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{20ee2f36f0fd0ae01e15.js → f88cbf9b1d1d7400c060.js} +1 -1
  26. package/assets/esri/core/workers/chunks/fe724bef7956fe12752f.js +1 -0
  27. package/config.js +1 -1
  28. package/kernel.js +1 -1
  29. package/package.json +3 -3
  30. package/assets/esri/core/workers/chunks/2529f12fc16e98c014ca.js +0 -1
  31. package/assets/esri/core/workers/chunks/2b4dd42920d37b1ff0a9.js +0 -2
  32. package/assets/esri/core/workers/chunks/43aef67452fa6ff8d8f9.js +0 -2
  33. package/assets/esri/core/workers/chunks/85b63811ae7bcb6f74b6.js +0 -2
  34. package/assets/esri/core/workers/chunks/8d01dd92f5c897193ab5.js +0 -1
  35. package/assets/esri/core/workers/chunks/a17fb26d6ac4895e51a3.js +0 -2
  36. package/assets/esri/core/workers/chunks/c25ae83fd790f181bb42.js +0 -1
  37. package/assets/esri/core/workers/chunks/c2cbe0f5e8958cf18e58.js +0 -2
  38. /package/assets/esri/core/workers/chunks/{c2cbe0f5e8958cf18e58.js.LICENSE.txt → 199f11addadcd606fe23.js.LICENSE.txt} +0 -0
  39. /package/assets/esri/core/workers/chunks/{2b4dd42920d37b1ff0a9.js.LICENSE.txt → 266f19253d1d6610e0a4.js.LICENSE.txt} +0 -0
  40. /package/assets/esri/core/workers/chunks/{900c8569596609183f19.js.LICENSE.txt → 316fb4f9c8618b4c7a22.js.LICENSE.txt} +0 -0
  41. /package/assets/esri/core/workers/chunks/{43aef67452fa6ff8d8f9.js.LICENSE.txt → aaceac7f1274e89f4279.js.LICENSE.txt} +0 -0
  42. /package/assets/esri/core/workers/chunks/{85b63811ae7bcb6f74b6.js.LICENSE.txt → bcf49bdab7e095e0459d.js.LICENSE.txt} +0 -0
  43. /package/assets/esri/core/workers/chunks/{a17fb26d6ac4895e51a3.js.LICENSE.txt → ddaabd6d01a17815cc55.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1137],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...s){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(s,r)||(i=e.apply(this,s),t=this,r=s,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{Qf:()=>l,Qh:()=>s,lM:()=>a});var r=i(34275);function a(e){if(!e)return 0;let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return l(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return o(e,8);let i=f;for(let r=0;r<t;r++)i+=n(e[r]);return i}(e);let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i]));return t}function n(e,t=!0){switch(typeof e){case"object":return t?s(e):u;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function l(...e){return e.reduce((e,t)=>e+(t?(0,r.iu)(t)?t.byteLength+h:Array.isArray(t)?o(t,16):0:0),0)}function o(e,t){return f+e.length*t}const u=32,f=16,h=145},5359(e,t,i){i.d(t,{Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}i.d(t,["H",0,r])},11137(e,t,i){i.r(t),i.d(t,{default:()=>rt});var r,a=i(32198),s=i(40124),n=i(69540),l=i(49186),o=i(53966),u=i(97768),f=i(25728),h=i(17676),c=i(36708),p=i(91429),d=i(78888),m=i(41910),g=i(60950),y=i(89808),w=i(99959),v=i(5359);class x extends w.A{get[(r=v.H,g.ym)](){return this.layer}get[y.Q](){return this.layer}get[m.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var b=i(4146),I=i(18768),C=i(63074),S=i(69208),A=i(34287),T=i(8303),R=i(72545),_=i(56551),O=i(54310),M=i(25036),F=i(82935),P=i(82806),k=i(7548),D=i(23636),N=i(49859),L=i(68197),B=i(5443),E=i(16930),J=i(73444),z=i(94778),H=i(14140);function U(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function j(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function Z(e){let t=(0,J.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function $(){return Math.round(255*Math.random())}function q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:s,categoryEncoding:n,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Z(a)),s&&(t[e].unit=s.label?Z(s.label):null,t[e].symbol=s.symbol?.value),n)){let i=Object.entries(n).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Z(e.label):null,e.preferredColor)){let t=L.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=$(),e.Green=$(),e.Blue=$())}));let a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map(e=>({attributes:e}))};r&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=a}}return t}function V(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,z.X1)(t,i)}function G(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),s=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),n=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);n+=s[l]*(i%t[a]),i=Math.floor(i/t[a])}return n}var W=i(4366),X=i(47520),K=i(51927),Y=i(45617),Q=i(87186);let ee=class extends N.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,s=this._pixelBlockTiles.get(a);if(s)return s;if(!this.source)return null;let{rasterInfo:n}=this,[l,o]=n.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let s=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return s&&this._pixelBlockTiles.set(a,s),s}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let p={pixelBlock:c,useBilinear:"thematic"!==n.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(p,r):(0,X.J$)(p)}async _open(e){if(!this.source)throw new l.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:s,nativeExtent:n,transform:o,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:p}=f??t.imageInfo,d=t.extent??new B.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new E.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:d.width/h,y:d.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new Q.A({width:h,height:c,pixelType:p,extent:d,nativeExtent:n,attributeTable:r,colormap:u,transform:o,pixelSize:g,spatialReference:d.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,s="thematic"!==r.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:s},i):Promise.resolve((0,X.lD)(e,t,a,s)),o=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,K.f4)(e)),c=await(0,h.Lx)([n,f]);if(!c[0].value)throw new l.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,o||(r.statistics=c[1].value?.statistics),u||(r.histograms=c[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let s=a.dimensions.map(e=>new Y.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,W.NG)(s,t),l=null==n?null:e[n];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,K.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],ee.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"source",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"url",null),ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.InMemoryRaster")],ee);const te=ee;var ie=i(22671);let re=class extends N.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,K.eH)(i[0]),o=s?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new te({source:{extent:t,pixelBlocks:i,attributeTable:a?ie.A.fromJSON(a):null,multidimensionalInfo:r,statistics:n,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.rasterInfo)}async _fetchData(e){let t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new l.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new l.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new l.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:a,type:s,values:n}=r[e];if(!("ndarray"===s.toLowerCase()&&n?.length&&t?.length&&a?.length))throw new l.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!U(t[t.length-1])||!j(t[t.length-2]))throw new l.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:r,dimensions:a}=function(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];U(o)?s=e:j(o)&&(n=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,s=(t-e)/(i-1);r.push([e-.5*s,t+.5*s]),a.push(s);for(let t=0;t<i;t++)f.push(e+s*t)}l.push({name:o,values:f,extent:[f[0],f[f.length-1]]})}s>-1&&-1===n?n=+(0===s):n>-1&&-1===s?s=+(0===n):-1===n&&-1===s&&(s=0,n=1),l=l.filter((e,t)=>t!==s&&t!==n);let{referencing:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[s])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new E.A({wkid:h}),[p,d]=r[s],[m,g]=r[n],y=new B.A({xmin:p,xmax:d,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[s]),height:Math.round(y.height/a[n]),extent:y,dimensions:l}}(e),{ranges:s}=e,n=Object.keys(s).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<n.length;e++){let t=n[e];a?.length&&l.push({name:t,dimensions:a})}let o=q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<n.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=s[n[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),p=u.slice(0,-2),d="float"===l?"f32":V(r),m=t*i,g=r.length/m;for(let s=0;s<g;s++){let n=H.A.createEmptyBand(d,m),l=new Uint8Array(m).fill(255),o=!1,u=s*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||a?.length){let e=new H.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:d});e.updateStatistics(),a?.length?f[G(c,p,s)+h]=e:f.push(e)}else{let e=f[s];e.pixels.push(n),o?e.mask&&=H.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:n}}(t)}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],re.prototype,"source",void 0),re=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.CovJSONRaster")],re);const ae=re;var se=i(4576),ne=i(21325),le=i(330),oe=i(43163);function ue(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function fe(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new E.A({wkid:t});if(e=String(e).trim(),(0,ne.jp)(e))return new E.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),s=a>-1?a:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=he(n);let o=t?new E.A({wkid:t}):new E.A({wkt:n}),u=he(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=he(e),0===t?new E.A({wkt:e}):new E.A({wkid:t})):null}function he(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ce(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,le.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,le.mX)(e);t.spatialReference=fe(i)}}else if((0,le.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,le.V6)(e,"GeodataXform"),i=fe((0,le.v7)(t,"SpatialReference/WKID")||(0,le.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,le.v7)(t,"PolynomialOrder")??1,a=(0,le.Ui)(t,"CoeffX/Double"),s=(0,le.Ui)(t,"CoeffY/Double"),n=(0,le.Ui)(t,"InverseCoeffX/Double"),l=(0,le.Ui)(t,"InverseCoeffY/Double"),o=ue(a,s),u=ue(n,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new oe.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,le.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,le.mX)(e));else if((0,le.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,s=(0,le.v7)(e,"NoDataValue"),n=(0,le.V6)(e,"Histograms/HistItem"),l=(0,le.v7)(n,"HistMin"),o=(0,le.v7)(n,"HistMax"),u=(0,le.v7)(n,"BucketCount"),f=(0,le.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,le.IC)(e,"Metadata/MDI").forEach(e=>{let s=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=s;break;case"STATISTICS_MAXIMUM":i=s;break;case"STATISTICS_MEAN":r=s;break;case"STATISTICS_STDDEV":a=s}});let h=(0,le.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(se.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(se.Ru):null),t}var pe=i(85951),de=i(96381);const me="image-aux-raster:open",ge="The data is not a supported format.";let ye=class extends N.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,s="immediate"===a||"jpg"!==r;if(s){let a=await this._decodeFullImage(i,r,e);if(!a)throw new l.A(me,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,pe.R)(i);if(!r)throw new l.A(me,ge);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:n,ioConfig:o}=this,u=new te({preGenerateTiles:s,rasterJobHandler:n,source:t,ioConfig:{...o,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:s}=await this._fetchAuxiliaryData(t),n=!i;n&&(i=new E.A({wkid:3857})),a?.length&&null==r&&(r=(0,K.Pg)(a));let{width:l,height:o}=e,u=new B.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=s?s.forwardTransform(u):u,h=!0;if(s){let e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:s,statistics:r,histograms:a,isPseudoSpatialReference:n,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,de.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new l.A(me,ge);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,h.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),s=this.datasetFormat,n="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,l=r||null==n||i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,h.Lx)([a,l]);if(t?.aborted)throw(0,h.NK)();let u=ce(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],ye.prototype,"rasterJobHandler",null),ye=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageAuxRaster")],ye);const we=ye;var ve=i(84952),xe=i(86738),be=i(75414),Ie=i(20223),Ce=i(87045),Se=i(25943),Ae=i(82371);let Te=class extends N.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,r={}){let{storageInfo:a,extent:s}=this.rasterInfo,{transposeInfo:n}=a,l=null!=n&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let s=0;for(let{data:e}of t)u.push(s),a.set(new Uint8Array(e),s),s+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:p}=a,d=l?n.tileSize:p.size,m=/^(mixed|jp)/i.test(p.format),g=await this.decodePixelBlock(o,{width:d[0],height:d[1],planes:u?.length,offsets:u,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==g)return null;let y=a.blockBoundary[e];if("jpg"!==a.compression||i>y.minCol&&i<y.maxCol&&t>y.minRow&&t<y.maxRow)return g;let{origin:w,blockWidth:v,blockHeight:x}=a,{x:b,y:I}=this.getPyramidPixelSize(e),C=Math.round((s.xmin-w.x)/b)%v,S=Math.round((s.xmax-w.x)/b)%v||v,A=Math.round((w.y-s.ymax)/I)%x,T=Math.round((w.y-s.ymin)/I)%x||x,R=i===y.minCol?C:0,_=t===y.minRow?A:0,O=i===y.maxCol?S:v,M=t===y.maxRow?T:x;return(0,X.z$)(g,{x:R,y:_},{width:O-R,height:M-_}),g}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let 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){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[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 r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,s=a-r+this._levelOffset,n=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,r++,i=this.identifyPixelLocation(n,r,t.datumTransformation),null===i)return null}return-1===s||null==i?null:r}async _open(e){let t=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:"));let r=i.data;if(this.sourceJSON=r,!r)throw new l.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new l.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new l.A("image-server-raster:open","cannot initialize image service");(0,Ae.E9)(a,r);let s="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:s}=t;if(null!=a&&null!=s)return Ce.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=s)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,s=r?t(r):-1/0;return Ce.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=s})})}return Ce.A.fromJSON(e)}(r.tileInfo,r):Ce.A.fromJSON(r.tileInfo);(0,u.Lw)(s);let[n,o]=this._computeMinMaxLOD(a,s),{extent:f,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(n.resolution-h.x)>c)&&(h.x=h.y=n.resolution,a.width=Math.ceil((f.xmax-f.xmin)/h.x-.1),a.height=Math.ceil((f.ymax-f.ymin)/h.y-.1));let p=n.level-o.level,[d,m]=s.size,g=[],y=[],{lods:w}=s;w.forEach((e,t)=>{e.level>=o.level&&e.level<=n.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(f,d,m,s.origin,g,p),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(o.resolution/n.resolution)**(-1/p))/10,C=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Ie.A({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,isBsqTile:C,transposeInfo:v,blockBoundary:x}),function(e){let{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new be.A,e.extent=e.transform.forwardTransform(t))}(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,ve.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Se.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=E.A.fromJSON(t.spatialReference||e.spatialReference),s=new xe.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new Q.A({width:i,height:r,bandCount:3,extent:B.A.fromJSON(e),spatialReference:a,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,Ae.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([r,a]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,r=.5/e.width*i.x,{lods:a}=t,s=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[s,n];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:u}=this.sourceJSON,f=s;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??n,this._levelOffset=h.level-n.level),[f,h]}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],Te.prototype,"tileType",void 0),Te=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageServerRaster")],Te);const Re=Te;var _e=i(10713);const Oe=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Me=new Map;Me.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Me.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Me.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Me.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Me.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Fe=class extends N.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,blockHeight:s,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*s);return new H.A({width:a,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<d;g++)(!p||p.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<d;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Me.get(this.rasterInfo.storageInfo.compression).decoderFormat,C="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:s,format:I,planes:p?.length||o,offsets:x,pixelType:u,canvasUsage:C?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==I&&!S.mask&&(A=A[0],null!=A)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-A)/A)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==A&&(t[g]=1);S.mask=t}let T=0,R=0;if(h!==a||c!==s){let e=S.mask;if(e)for(g=0;g<s;g++)if(R=g*a,g<c)for(T=h;T<a;T++)e[R+T]=0;else for(T=0;T<a;T++)e[R+T]=0;else for(e=new Uint8Array(a*s),S.mask=e,g=0;g<c;g++)for(R=g*a,T=0;T<h;T++)e[R+T]=1}return S}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:r,files:a}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,K.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(_e.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,p=[],d=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/f**g)-1,t=Math.ceil(c/u/f**g)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let r,a,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=r*a;p=o**e,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=t*r+i,c*=4*h;let d=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=d[4*e]*2**32+d[4*e+1],g=m+d[4*e+2]*2**32+d[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<r-1?n:Math.ceil(u/p)-n*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/p)-l*(a-1)}}_parseHeader(e){let t=(0,le.V6)(e,"MRF_META/Raster");if(!t)throw new l.A("mrf:open","not a valid MRF format");let i=(0,le.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),n=((0,le.mX)(t,"Compression")||"none").toLowerCase();if(!Me.has(n))throw new l.A("mrf:open","currently does not support compression "+n);let o=(0,le.mX)(t,"DataType")||"UInt8",u=Oe.get(o.toLowerCase());if(null==u)throw new l.A("mrf:open","currently does not support pixel type "+o);let f=(0,le.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),p=f.getAttribute("c"),d=p?p===String(s):Me.get(n).isOneSegment;this._isBsq=!d;let m,g=(0,le.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,le.V6)(e,"MRF_META/CachedSource"))throw new l.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,le.V6)(e,"MRF_META/GeoTags"),v=(0,le.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,le.mX)(w,"Projection")||"",s=E.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(s=new E.A({wkid:e}))}else s=fe(a)??E.A.WGS84;else x=!0,s=new E.A({wkid:3857});y=new B.A(e,t,i,r),y.spatialReference=s}else x=!0,y=new B.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new E.A({wkid:3857})});let b=(0,le.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),C=y.spatialReference,S=new Ie.A({origin:new xe.A({x:y.xmin,y:y.ymax,spatialReference:C}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:n,pyramidScalingFactor:I}),A=new xe.A({x:y.width/r,y:y.height/a,spatialReference:C}),T=new Q.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:C,bandCount:s,pixelType:u,pixelSize:A,noDataValue:m,storageInfo:S}),R=this._getAuxFullPath((0,le.mX)(t,"DataFile")),_=this._getAuxFullPath((0,le.mX)(t,"IndexFile"));return{rasterInfo:T,files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",Me.get(n).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Fe.prototype,"datasetFormat",void 0),Fe=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.MRFRaster")],Fe);const Pe=Fe;i(44208);var ke=i(9334);function De(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=a.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:a,features:n}}function Ne(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:r,headerByteCount:a,recordByteCount:s},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,ke.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;u.length<r&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,ke.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=s}return{header:n,fields:o,records:u,recordSet:De({fields:o,records:u})}}var Le=i(44094),Be=i(94213);const Ee="none-tiled tiff is not optimized for access, convert to COG and retry.";let Je=class extends N.A{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this._headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,r);null!=s&&s.pixels[0]instanceof Uint8Array&&(a.mask=s.pixels[0])}return a}async _open(e){let 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 l.A("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));let{littleEndian:r,firstIFDPos:a,isBigTiff:s}=(0,Le.uT)(i),n=[],u={fileChunk:i,posIFD:a,fileOffset:0};await this._readIFDs(n,u,r,s?8:4,t);let{imageInfo:f,rasterInfo:h}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:s,planes:n,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:p,tileBoundary:d,affine:m,metadata:g,colormap:y}=t,w=fe(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new E.A({wkid:3857}));let x=new B.A({...t.extent,spatialReference:w}),b=x?new xe.A({x:x.xmin,y:x.ymax,spatialReference:w}):new xe.A({x:0,y:0}),I=new Ie.A({blockWidth:a,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:p,blockBoundary:d}),C=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},A=new Q.A({width:i,height:r,bandCount:n,pixelType:l,pixelSize:C,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(A.nativeExtent=new B.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),A.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),p){let{x:e,y:t}=A.pixelSize;p.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:A}}(n),c=(0,Le.zS)(n),p=(0,Le.r9)(n);if(this._headerInfo={littleEndian:r,isBigTiff:s,ifds:n,pyramidIFDs:c,maskIFDs:p,...f},this._set("rasterInfo",h),!f.isSupported)throw new l.A("tiffraster:open","this tiff is not supported: "+f.message);if(!f.tileWidth||!f.tileHeight)throw new l.A("tiffraster:open",Ee);h.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let d=n[0].get("PREDICTOR")?.values?.[0];if(3===n[0].get("SAMPLEFORMAT")?.values?.[0]&&2===d)throw new l.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");let{skipMapInfo:m,skipExtensions:g=[]}=this.ioConfig;if(!g.includes("aux.xml")&&!m){let t=await this._fetchAuxiliaryMetaData(e);null!=t&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,K.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new xe.A({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)}(t,h)}!g.includes("vat.dbf")&&1===h.bandCount&&"u8"===h.pixelType&&!m&&(h.attributeTable=await this._fetchAuxiliaryTable(e),null!=h.attributeTable&&(h.keyProperties.DataType="thematic")),m&&this.updateImageSpaceRasterInfo(h),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;return(a+8>=i.byteLength||a<0)&&(r=a+r,i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,a=0),{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let s=await this._readIFD(t,i,Be.NB,r,a);if(!s?.ifd)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(s.ifd),!s.nextIFD)return null;t.posIFD=s.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Be.NB,r=4,a){let{fileChunk:s,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(s,t,n,o,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Be.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new l.A("tiffraster:open",Ee);let r=[];if(e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),e.has("GEOKEYDIRECTORY")){let i=e.get("GEOKEYDIRECTORY"),r=i?.values;if(r&&r.length>4){let e=r[0]+"."+r[1]+"."+r[2];n=i.valueOffset+6-o;let l=await this._validateOrFetchHeaderBuffer({fileChunk:s,posIFD:n,fileOffset:o},a);i.data=(await this._readIFD(l,t,Be.YC,2,a))?.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return u}return u.requiredBufferSize?(s=(await this.request(this.url,{range:{from:o,to:o+n+u.requiredBufferSize+8},responseType:"array-buffer",signal:a})).data,s.byteLength<n+u.requiredBufferSize?null:(e.fileChunk=s,e.fileOffset=o,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let s=a.map(e=>e.offlineOffsetSize),n=Math.min.apply(null,s.map(e=>e[0])),l=Math.max.apply(null,s.map(e=>e[0]+e[1])),o=1===s.length||l-n<=this._bufferSize;if(!o&&s.length>1&&(s.sort((e,t)=>e[0]-t[0]),o=s.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,s[0][0])===l),o){let e=await this._fetchOffsets(n,Math.max(l,n+this._bufferSize),r);return void a.forEach(i=>(0,Le.Cr)(e,t,i,n))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchOffsets(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize,s=Math.ceil((t-e)/a),n=e;for(let e=0;e<s;e++)r.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+a-1},responseType:"array-buffer",signal:i})),n+=a;let l=await Promise.all(r);if(1===s)return l[0].data;let o=new Uint8Array(t-e+1);for(let e=0;e<s;e++)o.set(new Uint8Array(l[e].data),e*a);return o.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let s=this._getTileLocation(e,t,i,r);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:u}=s,f=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=1===h.length?h[0].data:new ArrayBuffer(c),d=[0],m=[0];if(h.length>1){let e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){let r=h[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:u,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),w.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(a-1),{_headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let u=(0,Le.XO)(o,l),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.length||!h?.length)return null;let{minRow:c,minCol:p,maxRow:d,maxCol:m}=s[n];if(t>d||i>m||t<c||i<p)return null;let g=(0,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),v=(0,Le.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(d+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===d&&y%v||v}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Ne(t);return i?.recordSet?ie.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_headerInfo",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Je.prototype,"datasetFormat",void 0),Je=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.TIFFRaster")],Je);const ze=Je,He=new Map;He.set("MRF",{desc:"Meta Raster Format",constructor:Pe}),He.set("TIFF",{desc:"GeoTIFF",constructor:ze}),He.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Re}),He.set("JPG",{desc:"JPG Raster Format",constructor:we}),He.set("PNG",{desc:"PNG Raster Format",constructor:we}),He.set("GIF",{desc:"GIF Raster Format",constructor:we}),He.set("BMP",{desc:"BMP Raster Format",constructor:we}),He.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ae}),He.set("MEMORY",{desc:"In Memory Raster Format",constructor:te});class Ue{static get supportedFormats(){let e=new Set;return He.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,s=e.datasetFormat??i?.datasetFormat;s??(t.includes(".")?s=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?s="CovJSON":r?.extent&&r.pixelblocks&&(s="MEMORY")),"OVR"===s||"TIF"===s||"DM"===s?s="TIFF":"JPG"===s||"JPEG"===s||"JFIF"===s?s="JPG":"COVJSON"===s&&(s="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(s="RasterTileServer");let n={url:t,source:r,sourceJSON:a,datasetFormat:s,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(n).forEach(e=>{n[e]??delete n[e]}),s){if(!this.supportedFormats.has(s))throw new l.A("rasterfactory:open","not a supported format "+s);if("CRF"===s)throw new l.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,He.get(s).constructor)(n);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(He.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(s=o[u++],!s||"CRF"===s)return null;let t=new(0,He.get(s).constructor)(n);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){He.has(e.toUpperCase())||He.set(e.toUpperCase(),{desc:t,constructor:i})}}var je=i(99235),Ze=i(10873),$e=i(20437),qe=i(74797),Ve=i(22796),Ge=i(69409);const We={instance:null,refCount:0,connectionPromise:null};async function Xe(){if(We.refCount++,We.instance)return We.instance;if(!We.connectionPromise){let e=new Ge.A;We.connectionPromise=e.initialize().then(()=>{We.instance=e})}return await We.connectionPromise,We.instance}function Ke(){We.refCount--,!(We.refCount>0)&&(We.instance?.destroy(),We.instance=null,We.connectionPromise=null,We.refCount=0)}var Ye=i(24212),Qe=i(30291),et=i(88625),tt=i(59923);let it=class extends((0,C.dM)((0,M.j)((0,A.q)((0,T.A)((0,_.H)((0,S.d)((0,P.b)((0,R.G)((0,F.e)((0,I.b)((0,O.J)((0,f.M)((0,n.OU)(b.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),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.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,h.sg)(async(e,t,r)=>{let{save:a,saveAs:s}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return s(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(h.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,u.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,qe.rZ)("Pixel Value"),(0,qe.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,qe.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,qe.DV)(t),r=(0,qe.y6)();e.push(i,r)}if(a){let t=(0,qe.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==qe.F_.rawServicePixelValue)),r=(0,Qe.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,qe.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,d.PZ)(Ve.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof l.A?e:new l.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,tt.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,k.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new l.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new l.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let 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"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,k.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,je.UD)(t.toJSON(),a),a.some(e=>at(e,this.ioConfig))&&(r=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let s=await Promise.all(a.map(e=>Ue.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),n=s.findIndex(e=>null==e);if(n>-1)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${a[n]}`);return this._primaryRasters=s,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;at(e,this.ioConfig)&&(i=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let r=await Ue.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new l.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await Ue.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new l.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,je.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new D.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof l.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,Ye.XF)(o.A.getLogger(this),(0,Ye.$7)("ImageryTile layers","relative-to-scene",e)),(0,Ye.XF)(o.A.getLogger(this),(0,Ye.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],it.prototype,"charts",void 0),(0,a.Cg)([(0,p.MZ)({type:et.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],it.prototype,"elevationInfo",null),(0,a.Cg)([(0,p.MZ)({type:Ce.A})],it.prototype,"tileInfo",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,clonable:!1})],it.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,p.MZ)(Ze.fV)],it.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],it.prototype,"isReference",void 0),(0,a.Cg)([(0,p.MZ)({type:["show","hide"]})],it.prototype,"listMode",void 0),(0,a.Cg)([(0,p.MZ)({json:{read:!0,write:!0}})],it.prototype,"blendMode",void 0),(0,a.Cg)([(0,p.MZ)({type:Ve.A,json:{name:"renderingRule",write:!0}})],it.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,p.MZ)()],it.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],it.prototype,"version",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],it.prototype,"type",void 0),(0,a.Cg)([(0,p.MZ)({type:["ArcGISTiledImageServiceLayer"]})],it.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,p.MZ)({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}}}})],it.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],it.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0})],it.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,p.MZ)(Ze.PY)],it.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"fields",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"rasterFields",null),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],it.prototype,"source",void 0),it=(0,a.Cg)([(0,p.$K)("esri.layers.ImageryTileLayer")],it);const rt=it;function at(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(53966),s=i(91429),n=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,n.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,n.Jf)(e,a.A.getLogger(this)))}};return(0,r.Cg)([(0,s.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,s.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),s=i(69540),n=i(25482),l=i(78888),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},10333(e,t,i){i.d(t,{A:()=>n});var r=i(32198),a=i(25482),s=i(91429);let n=class extends a.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,r.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var r,a=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=r=class extends n.A{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}clone(){return new r({tolerance:this.tolerance})}};(0,a.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,a.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var r,a=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,s=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=r*r,n=a*a,l=r*a,o=s*r,u=s*a,f=r*n,h=a*n;return{x:e[0]+r*e[2]+a*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function p(e,t,i){let{xmin:r,ymin:a,xmax:s,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:s,y:l}),u.push({x:r,y:a}),u.push({x:s,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:s,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(s-r)*t/e,y:a}),u.push({x:r+(s-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,s,n]=e,l=r*n-s*a,o=s*a-r*n;return[(s*i-t*n)/l,(r*i-t*a)/o,n/l,a/o,-s/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),s=i(56507),n=i(69622),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),p=i(76030),d=i(84952),m=i(91429),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,s=!0,n=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(n=!1,o[u]|=1<<t):s=!1,31===t&&++u}n?(this._availability="unavailable",this.byteSize=40):s?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,s=this._availability;return a<0||a>s.length?"unknown":s[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||s.A,{row:r,col:a,width:n,height:o}=e,u={query:{f:"json"}};return t=t?{...u,...t}:u,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:o},valid:!0,data:Array(n*o).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:o}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=s.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let s=this.layer.tileInfo;s.updateTileInfo(r);let n=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,n),n}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,s){if(!this._prefetchingEnabled)return;let n=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(n))return;let l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,n),await(0,p.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(n)),(0,h.G4)(l))return;let c=new g.U(e,t,i),d={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,d);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,a);if(s)return Promise.resolve(s);let n=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(n,()=>t((0,h.NK)()));let i=x(a),s=this._pendingTilemapRequests[i];if(!s){s=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,d.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,m.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>d,Tw:()=>c,X6:()=>p});var r=i(56507),a=i(5443),s=i(86738),n=i(16930),l=i(87186),o=i(20223),u=i(2272),f=i(22671);async function h(e,t,i){let h=(0,u.Dl)(e),{rasterFunction:c,sourceJSON:p}=t||{},d=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,u.lF)({...h.query,renderingRule:d,f:"json"}),g=(0,u.jV)(m,i);e=h.path;let y=p||await(0,r.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,r.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,r.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,r.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,r.A)(`${e}/keyProperties`,g):null,C=y.hasMultidimensions?(0,r.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,r.A)(`${e}/statistics`,g):null,A=await Promise.allSettled([v,x,b,I,C,S]),T=a.A.fromJSON(y.extent),R=Math.ceil(T.width/y.pixelSizeX-.1),_=Math.ceil(T.height/y.pixelSizeY-.1),O=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),M="fulfilled"===A[0].status?A[0].value?.data:null,F=M?.features?.length?f.A.fromJSON(M):null,P="fulfilled"===A[1].status?A[1].value?.data.colormap:null,k=P?.length?P:null,D="fulfilled"===A[2].status?A[2].value?.data.histograms:null,N=D?.[0]?.counts?.length?D:null,L="fulfilled"===A[3].status?A[3].value?.data??{}:{},B="fulfilled"===A[4].status?A[4].value?.data.multidimensionalInfo:null,E=B?.variables?.length?B:null;var J;(J=E)&&J.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let z=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===A[5].status?A[5].value?.data.statistics:null),{defaultVariable:H,serviceDataType:U}=y;H&&H!==L.DefaultVariable&&(L.DefaultVariable=H),U?.includes("esriImageServiceDataTypeVector")&&!U.includes(L.DataType)&&(L.DataType=U.replace("esriImageServiceDataType",""));let j=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==j)&&(j=y.noDataValues);let Z=y.transposeInfo?new o.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new s.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:O}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(R,_))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new l.A({width:R,height:_,bandCount:y.bandCount,extent:a.A.fromJSON(y.extent),spatialReference:O,pixelSize:new s.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:O}),pixelType:y.pixelType.toLowerCase(),statistics:z,attributeTable:F,colormap:k,histograms:N,keyProperties:L,noDataValue:j,multidimensionalInfo:E,storageInfo:Z})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function p(e,t,i){return h(e,{rasterFunction:t},i)}function d(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(70333),s=i(4718),n=i(84952),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,s.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let s=e[a];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))r[a]=s.map(e=>f(e));else if("object"==typeof s)if(s.toJSON){let e=s.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?s:JSON.stringify(s);else r[a]=s}return r}async function h(e,t,s){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??a.id?.findCredential(e)?.token:null}(e,t)||(!a.id&&r.A.request.useIdentity&&await Promise.all([i.e(8673),i.e(7956),i.e(7715)]).then(()=>i(50148)),(await a.id.getCredential(e,s))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>n});var r=i(56512),a=i(86211),s=i(16271);function n(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:p}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,s.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",s=(0,a.mq)(i);return s?(0,a.oU)(e,r,s):0});const c={mode:"absolute-height",offset:0},p={mode:"on-the-ground",offset:null}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1137],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...s){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(s,r)||(i=e.apply(this,s),t=this,r=s,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{Qf:()=>l,Qh:()=>s,lM:()=>a});var r=i(34275);function a(e){if(!e)return 0;let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return l(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return o(e,8);let i=f;for(let r=0;r<t;r++)i+=n(e[r]);return i}(e);let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i]));return t}function n(e,t=!0){switch(typeof e){case"object":return t?s(e):u;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function l(...e){return e.reduce((e,t)=>e+(t?(0,r.iu)(t)?t.byteLength+h:Array.isArray(t)?o(t,16):0:0),0)}function o(e,t){return f+e.length*t}const u=32,f=16,h=145},5359(e,t,i){i.d(t,{Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}i.d(t,["H",0,r])},11137(e,t,i){i.r(t),i.d(t,{default:()=>rt});var r,a=i(32198),s=i(40124),n=i(69540),l=i(49186),o=i(53966),u=i(97768),f=i(25728),h=i(17676),c=i(36708),p=i(91429),d=i(78888),m=i(41910),g=i(60950),y=i(89808),w=i(99959),v=i(5359);class x extends w.A{get[(r=v.H,g.ym)](){return this.layer}get[y.Q](){return this.layer}get[m.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var b=i(4146),I=i(18768),C=i(63074),S=i(69208),A=i(34287),T=i(8303),R=i(72545),_=i(56551),O=i(54310),M=i(25036),F=i(82935),P=i(82806),k=i(7548),D=i(23636),N=i(49859),L=i(68197),B=i(5443),E=i(16930),J=i(73444),z=i(94778),H=i(14140);function U(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function j(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function Z(e){let t=(0,J.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function $(){return Math.round(255*Math.random())}function q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:s,categoryEncoding:n,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Z(a)),s&&(t[e].unit=s.label?Z(s.label):null,t[e].symbol=s.symbol?.value),n)){let i=Object.entries(n).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Z(e.label):null,e.preferredColor)){let t=L.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=$(),e.Green=$(),e.Blue=$())}));let a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map(e=>({attributes:e}))};r&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=a}}return t}function V(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,z.X1)(t,i)}function G(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),s=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),n=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);n+=s[l]*(i%t[a]),i=Math.floor(i/t[a])}return n}var W=i(4366),X=i(47520),K=i(51927),Y=i(45617),Q=i(87186);let ee=class extends N.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,s=this._pixelBlockTiles.get(a);if(s)return s;if(!this.source)return null;let{rasterInfo:n}=this,[l,o]=n.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let s=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return s&&this._pixelBlockTiles.set(a,s),s}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let p={pixelBlock:c,useBilinear:"thematic"!==n.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(p,r):(0,X.J$)(p)}async _open(e){if(!this.source)throw new l.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:s,nativeExtent:n,transform:o,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:p}=f??t.imageInfo,d=t.extent??new B.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new E.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:d.width/h,y:d.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new Q.A({width:h,height:c,pixelType:p,extent:d,nativeExtent:n,attributeTable:r,colormap:u,transform:o,pixelSize:g,spatialReference:d.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,s="thematic"!==r.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:s},i):Promise.resolve((0,X.lD)(e,t,a,s)),o=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,K.f4)(e)),c=await(0,h.Lx)([n,f]);if(!c[0].value)throw new l.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,o||(r.statistics=c[1].value?.statistics),u||(r.histograms=c[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let s=a.dimensions.map(e=>new Y.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,W.NG)(s,t),l=null==n?null:e[n];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,K.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],ee.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"source",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"url",null),ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.InMemoryRaster")],ee);const te=ee;var ie=i(22671);let re=class extends N.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,K.eH)(i[0]),o=s?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new te({source:{extent:t,pixelBlocks:i,attributeTable:a?ie.A.fromJSON(a):null,multidimensionalInfo:r,statistics:n,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.rasterInfo)}async _fetchData(e){let t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new l.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new l.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new l.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:a,type:s,values:n}=r[e];if(!("ndarray"===s.toLowerCase()&&n?.length&&t?.length&&a?.length))throw new l.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!U(t[t.length-1])||!j(t[t.length-2]))throw new l.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:r,dimensions:a}=function(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];U(o)?s=e:j(o)&&(n=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,s=(t-e)/(i-1);r.push([e-.5*s,t+.5*s]),a.push(s);for(let t=0;t<i;t++)f.push(e+s*t)}l.push({name:o,values:f,extent:[f[0],f[f.length-1]]})}s>-1&&-1===n?n=+(0===s):n>-1&&-1===s?s=+(0===n):-1===n&&-1===s&&(s=0,n=1),l=l.filter((e,t)=>t!==s&&t!==n);let{referencing:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[s])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new E.A({wkid:h}),[p,d]=r[s],[m,g]=r[n],y=new B.A({xmin:p,xmax:d,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[s]),height:Math.round(y.height/a[n]),extent:y,dimensions:l}}(e),{ranges:s}=e,n=Object.keys(s).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<n.length;e++){let t=n[e];a?.length&&l.push({name:t,dimensions:a})}let o=q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<n.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=s[n[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),p=u.slice(0,-2),d="float"===l?"f32":V(r),m=t*i,g=r.length/m;for(let s=0;s<g;s++){let n=H.A.createEmptyBand(d,m),l=new Uint8Array(m).fill(255),o=!1,u=s*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||a?.length){let e=new H.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:d});e.updateStatistics(),a?.length?f[G(c,p,s)+h]=e:f.push(e)}else{let e=f[s];e.pixels.push(n),o?e.mask&&=H.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:n}}(t)}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],re.prototype,"source",void 0),re=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.CovJSONRaster")],re);const ae=re;var se=i(4576),ne=i(21325),le=i(330),oe=i(43163);function ue(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function fe(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new E.A({wkid:t});if(e=String(e).trim(),(0,ne.jp)(e))return new E.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),s=a>-1?a:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=he(n);let o=t?new E.A({wkid:t}):new E.A({wkt:n}),u=he(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=he(e),0===t?new E.A({wkt:e}):new E.A({wkid:t})):null}function he(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ce(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,le.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,le.mX)(e);t.spatialReference=fe(i)}}else if((0,le.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,le.V6)(e,"GeodataXform"),i=fe((0,le.v7)(t,"SpatialReference/WKID")||(0,le.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,le.v7)(t,"PolynomialOrder")??1,a=(0,le.Ui)(t,"CoeffX/Double"),s=(0,le.Ui)(t,"CoeffY/Double"),n=(0,le.Ui)(t,"InverseCoeffX/Double"),l=(0,le.Ui)(t,"InverseCoeffY/Double"),o=ue(a,s),u=ue(n,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new oe.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,le.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,le.mX)(e));else if((0,le.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,s=(0,le.v7)(e,"NoDataValue"),n=(0,le.V6)(e,"Histograms/HistItem"),l=(0,le.v7)(n,"HistMin"),o=(0,le.v7)(n,"HistMax"),u=(0,le.v7)(n,"BucketCount"),f=(0,le.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,le.IC)(e,"Metadata/MDI").forEach(e=>{let s=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=s;break;case"STATISTICS_MAXIMUM":i=s;break;case"STATISTICS_MEAN":r=s;break;case"STATISTICS_STDDEV":a=s}});let h=(0,le.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(se.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(se.Ru):null),t}var pe=i(85951),de=i(96381);const me="image-aux-raster:open",ge="The data is not a supported format.";let ye=class extends N.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,s="immediate"===a||"jpg"!==r;if(s){let a=await this._decodeFullImage(i,r,e);if(!a)throw new l.A(me,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,pe.R)(i);if(!r)throw new l.A(me,ge);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:n,ioConfig:o}=this,u=new te({preGenerateTiles:s,rasterJobHandler:n,source:t,ioConfig:{...o,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:s}=await this._fetchAuxiliaryData(t),n=!i;n&&(i=new E.A({wkid:3857})),a?.length&&null==r&&(r=(0,K.Pg)(a));let{width:l,height:o}=e,u=new B.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=s?s.forwardTransform(u):u,h=!0;if(s){let e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:s,statistics:r,histograms:a,isPseudoSpatialReference:n,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,de.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new l.A(me,ge);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,h.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),s=this.datasetFormat,n="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,l=r||null==n||i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,h.Lx)([a,l]);if(t?.aborted)throw(0,h.NK)();let u=ce(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],ye.prototype,"rasterJobHandler",null),ye=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageAuxRaster")],ye);const we=ye;var ve=i(84952),xe=i(86738),be=i(75414),Ie=i(20223),Ce=i(87045),Se=i(25943),Ae=i(82371);let Te=class extends N.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,r={}){let{storageInfo:a,extent:s}=this.rasterInfo,{transposeInfo:n}=a,l=null!=n&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let s=0;for(let{data:e}of t)u.push(s),a.set(new Uint8Array(e),s),s+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:p}=a,d=l?n.tileSize:p.size,m=/^(mixed|jp)/i.test(p.format),g=await this.decodePixelBlock(o,{width:d[0],height:d[1],planes:u?.length,offsets:u,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==g)return null;let y=a.blockBoundary[e];if("jpg"!==a.compression||i>y.minCol&&i<y.maxCol&&t>y.minRow&&t<y.maxRow)return g;let{origin:w,blockWidth:v,blockHeight:x}=a,{x:b,y:I}=this.getPyramidPixelSize(e),C=Math.round((s.xmin-w.x)/b)%v,S=Math.round((s.xmax-w.x)/b)%v||v,A=Math.round((w.y-s.ymax)/I)%x,T=Math.round((w.y-s.ymin)/I)%x||x,R=i===y.minCol?C:0,_=t===y.minRow?A:0,O=i===y.maxCol?S:v,M=t===y.maxRow?T:x;return(0,X.z$)(g,{x:R,y:_},{width:O-R,height:M-_}),g}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let 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){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[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 r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,s=a-r+this._levelOffset,n=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,r++,i=this.identifyPixelLocation(n,r,t.datumTransformation),null===i)return null}return-1===s||null==i?null:r}async _open(e){let t=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:"));let r=i.data;if(this.sourceJSON=r,!r)throw new l.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new l.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new l.A("image-server-raster:open","cannot initialize image service");(0,Ae.E9)(a,r);let s="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:s}=t;if(null!=a&&null!=s)return Ce.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=s)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,s=r?t(r):-1/0;return Ce.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=s})})}return Ce.A.fromJSON(e)}(r.tileInfo,r):Ce.A.fromJSON(r.tileInfo);(0,u.Lw)(s);let[n,o]=this._computeMinMaxLOD(a,s),{extent:f,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(n.resolution-h.x)>c)&&(h.x=h.y=n.resolution,a.width=Math.ceil((f.xmax-f.xmin)/h.x-.1),a.height=Math.ceil((f.ymax-f.ymin)/h.y-.1));let p=n.level-o.level,[d,m]=s.size,g=[],y=[],{lods:w}=s;w.forEach((e,t)=>{e.level>=o.level&&e.level<=n.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(f,d,m,s.origin,g,p),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(o.resolution/n.resolution)**(-1/p))/10,C=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Ie.A({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,isBsqTile:C,transposeInfo:v,blockBoundary:x}),function(e){let{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new be.A,e.extent=e.transform.forwardTransform(t))}(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,ve.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Se.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=E.A.fromJSON(t.spatialReference||e.spatialReference),s=new xe.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new Q.A({width:i,height:r,bandCount:3,extent:B.A.fromJSON(e),spatialReference:a,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,Ae.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([r,a]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,r=.5/e.width*i.x,{lods:a}=t,s=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[s,n];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:u}=this.sourceJSON,f=s;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??n,this._levelOffset=h.level-n.level),[f,h]}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],Te.prototype,"tileType",void 0),Te=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageServerRaster")],Te);const Re=Te;var _e=i(10713);const Oe=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Me=new Map;Me.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Me.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Me.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Me.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Me.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Fe=class extends N.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,blockHeight:s,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*s);return new H.A({width:a,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<d;g++)(!p||p.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<d;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Me.get(this.rasterInfo.storageInfo.compression).decoderFormat,C="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:s,format:I,planes:p?.length||o,offsets:x,pixelType:u,canvasUsage:C?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==I&&!S.mask&&(A=A[0],null!=A)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-A)/A)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==A&&(t[g]=1);S.mask=t}let T=0,R=0;if(h!==a||c!==s){let e=S.mask;if(e)for(g=0;g<s;g++)if(R=g*a,g<c)for(T=h;T<a;T++)e[R+T]=0;else for(T=0;T<a;T++)e[R+T]=0;else for(e=new Uint8Array(a*s),S.mask=e,g=0;g<c;g++)for(R=g*a,T=0;T<h;T++)e[R+T]=1}return S}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:r,files:a}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,K.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(_e.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,p=[],d=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/f**g)-1,t=Math.ceil(c/u/f**g)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let r,a,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=r*a;p=o**e,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=t*r+i,c*=4*h;let d=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=d[4*e]*2**32+d[4*e+1],g=m+d[4*e+2]*2**32+d[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<r-1?n:Math.ceil(u/p)-n*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/p)-l*(a-1)}}_parseHeader(e){let t=(0,le.V6)(e,"MRF_META/Raster");if(!t)throw new l.A("mrf:open","not a valid MRF format");let i=(0,le.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),n=((0,le.mX)(t,"Compression")||"none").toLowerCase();if(!Me.has(n))throw new l.A("mrf:open","currently does not support compression "+n);let o=(0,le.mX)(t,"DataType")||"UInt8",u=Oe.get(o.toLowerCase());if(null==u)throw new l.A("mrf:open","currently does not support pixel type "+o);let f=(0,le.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),p=f.getAttribute("c"),d=p?p===String(s):Me.get(n).isOneSegment;this._isBsq=!d;let m,g=(0,le.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,le.V6)(e,"MRF_META/CachedSource"))throw new l.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,le.V6)(e,"MRF_META/GeoTags"),v=(0,le.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,le.mX)(w,"Projection")||"",s=E.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(s=new E.A({wkid:e}))}else s=fe(a)??E.A.WGS84;else x=!0,s=new E.A({wkid:3857});y=new B.A(e,t,i,r),y.spatialReference=s}else x=!0,y=new B.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new E.A({wkid:3857})});let b=(0,le.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),C=y.spatialReference,S=new Ie.A({origin:new xe.A({x:y.xmin,y:y.ymax,spatialReference:C}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:n,pyramidScalingFactor:I}),A=new xe.A({x:y.width/r,y:y.height/a,spatialReference:C}),T=new Q.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:C,bandCount:s,pixelType:u,pixelSize:A,noDataValue:m,storageInfo:S}),R=this._getAuxFullPath((0,le.mX)(t,"DataFile")),_=this._getAuxFullPath((0,le.mX)(t,"IndexFile"));return{rasterInfo:T,files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",Me.get(n).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Fe.prototype,"datasetFormat",void 0),Fe=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.MRFRaster")],Fe);const Pe=Fe;i(44208);var ke=i(9334);function De(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=a.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:a,features:n}}function Ne(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:r,headerByteCount:a,recordByteCount:s},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,ke.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;u.length<r&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,ke.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=s}return{header:n,fields:o,records:u,recordSet:De({fields:o,records:u})}}var Le=i(44094),Be=i(94213);const Ee="none-tiled tiff is not optimized for access, convert to COG and retry.";let Je=class extends N.A{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this._headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,r);null!=s&&s.pixels[0]instanceof Uint8Array&&(a.mask=s.pixels[0])}return a}async _open(e){let 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 l.A("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));let{littleEndian:r,firstIFDPos:a,isBigTiff:s}=(0,Le.uT)(i),n=[],u={fileChunk:i,posIFD:a,fileOffset:0};await this._readIFDs(n,u,r,s?8:4,t);let{imageInfo:f,rasterInfo:h}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:s,planes:n,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:p,tileBoundary:d,affine:m,metadata:g,colormap:y}=t,w=fe(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new E.A({wkid:3857}));let x=new B.A({...t.extent,spatialReference:w}),b=x?new xe.A({x:x.xmin,y:x.ymax,spatialReference:w}):new xe.A({x:0,y:0}),I=new Ie.A({blockWidth:a,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:p,blockBoundary:d}),C=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},A=new Q.A({width:i,height:r,bandCount:n,pixelType:l,pixelSize:C,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(A.nativeExtent=new B.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),A.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),p){let{x:e,y:t}=A.pixelSize;p.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:A}}(n),c=(0,Le.zS)(n),p=(0,Le.r9)(n);if(this._headerInfo={littleEndian:r,isBigTiff:s,ifds:n,pyramidIFDs:c,maskIFDs:p,...f},this._set("rasterInfo",h),!f.isSupported)throw new l.A("tiffraster:open","this tiff is not supported: "+f.message);if(!f.tileWidth||!f.tileHeight)throw new l.A("tiffraster:open",Ee);h.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let d=n[0].get("PREDICTOR")?.values?.[0];if(3===n[0].get("SAMPLEFORMAT")?.values?.[0]&&2===d)throw new l.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");let{skipMapInfo:m,skipExtensions:g=[]}=this.ioConfig;if(!g.includes("aux.xml")&&!m){let t=await this._fetchAuxiliaryMetaData(e);null!=t&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,K.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new xe.A({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)}(t,h)}!g.includes("vat.dbf")&&1===h.bandCount&&"u8"===h.pixelType&&!m&&(h.attributeTable=await this._fetchAuxiliaryTable(e),null!=h.attributeTable&&(h.keyProperties.DataType="thematic")),m&&this.updateImageSpaceRasterInfo(h),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;return(a+8>=i.byteLength||a<0)&&(r=a+r,i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,a=0),{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let s=await this._readIFD(t,i,Be.NB,r,a);if(!s?.ifd)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(s.ifd),!s.nextIFD)return null;t.posIFD=s.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Be.NB,r=4,a){let{fileChunk:s,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(s,t,n,o,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Be.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new l.A("tiffraster:open",Ee);let r=[];if(e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),e.has("GEOKEYDIRECTORY")){let i=e.get("GEOKEYDIRECTORY"),r=i?.values;if(r&&r.length>4){let e=r[0]+"."+r[1]+"."+r[2];n=i.valueOffset+6-o;let l=await this._validateOrFetchHeaderBuffer({fileChunk:s,posIFD:n,fileOffset:o},a);i.data=(await this._readIFD(l,t,Be.YC,2,a))?.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return u}return u.requiredBufferSize?(s=(await this.request(this.url,{range:{from:o,to:o+n+u.requiredBufferSize+8},responseType:"array-buffer",signal:a})).data,s.byteLength<n+u.requiredBufferSize?null:(e.fileChunk=s,e.fileOffset=o,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let s=a.map(e=>e.offlineOffsetSize),n=Math.min.apply(null,s.map(e=>e[0])),l=Math.max.apply(null,s.map(e=>e[0]+e[1])),o=1===s.length||l-n<=this._bufferSize;if(!o&&s.length>1&&(s.sort((e,t)=>e[0]-t[0]),o=s.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,s[0][0])===l),o){let e=await this._fetchOffsets(n,Math.max(l,n+this._bufferSize),r);return void a.forEach(i=>(0,Le.Cr)(e,t,i,n))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchOffsets(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize,s=Math.ceil((t-e)/a),n=e;for(let e=0;e<s;e++)r.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+a-1},responseType:"array-buffer",signal:i})),n+=a;let l=await Promise.all(r);if(1===s)return l[0].data;let o=new Uint8Array(t-e+1);for(let e=0;e<s;e++)o.set(new Uint8Array(l[e].data),e*a);return o.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let s=this._getTileLocation(e,t,i,r);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:u}=s,f=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=1===h.length?h[0].data:new ArrayBuffer(c),d=[0],m=[0];if(h.length>1){let e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){let r=h[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:u,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),w.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(a-1),{_headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let u=(0,Le.XO)(o,l),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.length||!h?.length)return null;let{minRow:c,minCol:p,maxRow:d,maxCol:m}=s[n];if(t>d||i>m||t<c||i<p)return null;let g=(0,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),v=(0,Le.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(d+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===d&&y%v||v}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Ne(t);return i?.recordSet?ie.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_headerInfo",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Je.prototype,"datasetFormat",void 0),Je=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.TIFFRaster")],Je);const ze=Je,He=new Map;He.set("MRF",{desc:"Meta Raster Format",constructor:Pe}),He.set("TIFF",{desc:"GeoTIFF",constructor:ze}),He.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Re}),He.set("JPG",{desc:"JPG Raster Format",constructor:we}),He.set("PNG",{desc:"PNG Raster Format",constructor:we}),He.set("GIF",{desc:"GIF Raster Format",constructor:we}),He.set("BMP",{desc:"BMP Raster Format",constructor:we}),He.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ae}),He.set("MEMORY",{desc:"In Memory Raster Format",constructor:te});class Ue{static get supportedFormats(){let e=new Set;return He.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,s=e.datasetFormat??i?.datasetFormat;s??(t.includes(".")?s=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?s="CovJSON":r?.extent&&r.pixelblocks&&(s="MEMORY")),"OVR"===s||"TIF"===s||"DM"===s?s="TIFF":"JPG"===s||"JPEG"===s||"JFIF"===s?s="JPG":"COVJSON"===s&&(s="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(s="RasterTileServer");let n={url:t,source:r,sourceJSON:a,datasetFormat:s,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(n).forEach(e=>{n[e]??delete n[e]}),s){if(!this.supportedFormats.has(s))throw new l.A("rasterfactory:open","not a supported format "+s);if("CRF"===s)throw new l.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,He.get(s).constructor)(n);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(He.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(s=o[u++],!s||"CRF"===s)return null;let t=new(0,He.get(s).constructor)(n);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){He.has(e.toUpperCase())||He.set(e.toUpperCase(),{desc:t,constructor:i})}}var je=i(99235),Ze=i(10873),$e=i(20437),qe=i(74797),Ve=i(22796),Ge=i(69409);const We={instance:null,refCount:0,connectionPromise:null};async function Xe(){if(We.refCount++,We.instance)return We.instance;if(!We.connectionPromise){let e=new Ge.A;We.connectionPromise=e.initialize().then(()=>{We.instance=e})}return await We.connectionPromise,We.instance}function Ke(){We.refCount--,!(We.refCount>0)&&(We.instance?.destroy(),We.instance=null,We.connectionPromise=null,We.refCount=0)}var Ye=i(24212),Qe=i(30291),et=i(88625),tt=i(59923);let it=class extends((0,C.dM)((0,M.j)((0,A.q)((0,T.A)((0,_.H)((0,S.d)((0,P.b)((0,R.G)((0,F.e)((0,I.b)((0,O.J)((0,f.M)((0,n.OU)(b.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),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.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,h.sg)(async(e,t,r)=>{let{save:a,saveAs:s}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return s(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(h.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,u.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,qe.rZ)("Pixel Value"),(0,qe.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,qe.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,qe.DV)(t),r=(0,qe.y6)();e.push(i,r)}if(a){let t=(0,qe.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==qe.F_.rawServicePixelValue)),r=(0,Qe.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,qe.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,d.PZ)(Ve.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof l.A?e:new l.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,tt.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,k.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new l.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new l.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let 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"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,k.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,je.UD)(t.toJSON(),a),a.some(e=>at(e,this.ioConfig))&&(r=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let s=await Promise.all(a.map(e=>Ue.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),n=s.findIndex(e=>null==e);if(n>-1)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${a[n]}`);return this._primaryRasters=s,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;at(e,this.ioConfig)&&(i=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let r=await Ue.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new l.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await Ue.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new l.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,je.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new D.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof l.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,Ye.XF)(o.A.getLogger(this),(0,Ye.$7)("ImageryTile layers","relative-to-scene",e)),(0,Ye.XF)(o.A.getLogger(this),(0,Ye.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],it.prototype,"charts",void 0),(0,a.Cg)([(0,p.MZ)({type:et.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],it.prototype,"elevationInfo",null),(0,a.Cg)([(0,p.MZ)({type:Ce.A})],it.prototype,"tileInfo",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,clonable:!1})],it.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,p.MZ)(Ze.fV)],it.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],it.prototype,"isReference",void 0),(0,a.Cg)([(0,p.MZ)({type:["show","hide"]})],it.prototype,"listMode",void 0),(0,a.Cg)([(0,p.MZ)({json:{read:!0,write:!0}})],it.prototype,"blendMode",void 0),(0,a.Cg)([(0,p.MZ)({type:Ve.A,json:{name:"renderingRule",write:!0}})],it.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,p.MZ)()],it.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],it.prototype,"version",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],it.prototype,"type",void 0),(0,a.Cg)([(0,p.MZ)({type:["ArcGISTiledImageServiceLayer"]})],it.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,p.MZ)({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}}}})],it.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],it.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0})],it.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,p.MZ)(Ze.PY)],it.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"fields",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"rasterFields",null),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],it.prototype,"source",void 0),it=(0,a.Cg)([(0,p.$K)("esri.layers.ImageryTileLayer")],it);const rt=it;function at(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(53966),s=i(91429),n=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,n.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,n.Jf)(e,a.A.getLogger(this)))}};return(0,r.Cg)([(0,s.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,s.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),s=i(69540),n=i(25482),l=i(78888),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},10333(e,t,i){i.d(t,{A:()=>n});var r=i(32198),a=i(25482),s=i(91429);let n=class extends a.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,r.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var r,a=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=r=class extends n.A{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}clone(){return new r({tolerance:this.tolerance})}};(0,a.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,a.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var r,a=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,s=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=r*r,n=a*a,l=r*a,o=s*r,u=s*a,f=r*n,h=a*n;return{x:e[0]+r*e[2]+a*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function p(e,t,i){let{xmin:r,ymin:a,xmax:s,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:s,y:l}),u.push({x:r,y:a}),u.push({x:s,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:s,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(s-r)*t/e,y:a}),u.push({x:r+(s-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,s,n]=e,l=r*n-s*a,o=s*a-r*n;return[(s*i-t*n)/l,(r*i-t*a)/o,n/l,a/o,-s/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),s=i(56507),n=i(69622),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),p=i(76030),d=i(84952),m=i(91429),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,s=!0,n=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(n=!1,o[u]|=1<<t):s=!1,31===t&&++u}n?(this._availability="unavailable",this.byteSize=40):s?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,s=this._availability;return a<0||a>s.length?"unknown":s[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||s.A,{row:r,col:a,width:n,height:o}=e,u={query:{f:"json"}};return t=t?{...u,...t}:u,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:o},valid:!0,data:Array(n*o).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:o}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=s.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let s=this.layer.tileInfo;s.updateTileInfo(r);let n=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,n),n}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,s){if(!this._prefetchingEnabled)return;let n=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(n))return;let l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,n),await(0,p.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(n)),(0,h.G4)(l))return;let c=new g.U(e,t,i),d={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,d);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,a);if(s)return Promise.resolve(s);let n=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(n,()=>t((0,h.NK)()));let i=x(a),s=this._pendingTilemapRequests[i];if(!s){s=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,d.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,m.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>d,Tw:()=>c,X6:()=>p});var r=i(56507),a=i(5443),s=i(86738),n=i(16930),l=i(87186),o=i(20223),u=i(2272),f=i(22671);async function h(e,t,i){let h=(0,u.Dl)(e),{rasterFunction:c,sourceJSON:p}=t||{},d=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,u.lF)({...h.query,renderingRule:d,f:"json"}),g=(0,u.jV)(m,i);e=h.path;let y=p||await(0,r.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,r.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,r.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,r.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,r.A)(`${e}/keyProperties`,g):null,C=y.hasMultidimensions?(0,r.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,r.A)(`${e}/statistics`,g):null,A=await Promise.allSettled([v,x,b,I,C,S]),T=a.A.fromJSON(y.extent),R=Math.ceil(T.width/y.pixelSizeX-.1),_=Math.ceil(T.height/y.pixelSizeY-.1),O=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),M="fulfilled"===A[0].status?A[0].value?.data:null,F=M?.features?.length?f.A.fromJSON(M):null,P="fulfilled"===A[1].status?A[1].value?.data.colormap:null,k=P?.length?P:null,D="fulfilled"===A[2].status?A[2].value?.data.histograms:null,N=D?.[0]?.counts?.length?D:null,L="fulfilled"===A[3].status?A[3].value?.data??{}:{},B="fulfilled"===A[4].status?A[4].value?.data.multidimensionalInfo:null,E=B?.variables?.length?B:null;var J;(J=E)&&J.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let z=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===A[5].status?A[5].value?.data.statistics:null),{defaultVariable:H,serviceDataType:U}=y;H&&H!==L.DefaultVariable&&(L.DefaultVariable=H),U?.includes("esriImageServiceDataTypeVector")&&!U.includes(L.DataType)&&(L.DataType=U.replace("esriImageServiceDataType",""));let j=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==j)&&(j=y.noDataValues);let Z=y.transposeInfo?new o.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new s.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:O}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(R,_))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new l.A({width:R,height:_,bandCount:y.bandCount,extent:a.A.fromJSON(y.extent),spatialReference:O,pixelSize:new s.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:O}),pixelType:y.pixelType.toLowerCase(),statistics:z,attributeTable:F,colormap:k,histograms:N,keyProperties:L,noDataValue:j,multidimensionalInfo:E,storageInfo:Z})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function p(e,t,i){return h(e,{rasterFunction:t},i)}function d(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(70333),s=i(4718),n=i(84952),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,s.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let s=e[a];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))r[a]=s.map(e=>f(e));else if("object"==typeof s)if(s.toJSON){let e=s.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?s:JSON.stringify(s);else r[a]=s}return r}async function h(e,t,s){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??a.id?.findCredential(e)?.token:null}(e,t)||(!a.id&&r.A.request.useIdentity&&await Promise.all([i.e(8673),i.e(37),i.e(7715)]).then(()=>i(50148)),(await a.id.getCredential(e,s))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>n});var r=i(56512),a=i(86211),s=i(16271);function n(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:p}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,s.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",s=(0,a.mq)(i);return s?(0,a.oU)(e,r,s):0});const c={mode:"absolute-height",offset:0},p={mode:"on-the-ground",offset:null}}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see aaceac7f1274e89f4279.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4059,5884,6440],{77173(e,t,i){i.d(t,{t:()=>c});var a=i(12664);function o(e){return function(e){return void 0!==e.openProp}(e)?e[e.openProp]:e.open}async function c(e){await e.updateComplete,o(e)?e.onBeforeOpen():e.onBeforeClose(),await e.updateComplete;const t=e.transitionRef?.value??e.transitionEl;t&&await(0,a.w)(t,e.transitionProp),o(e)?e.onOpen():e.onClose()}},13584(e,t,i){function a(e){return t=>t?.localName===e}i.d(t,{i:()=>a}),i.d(t,["K",0,{brand:"lightbulb",danger:"exclamationMarkTriangle",info:"information",success:"checkCircle",warning:"exclamationMarkTriangle"},"a",0,{danger:"exclamationMarkTriangleF",info:"informationF",success:"checkCircleF",warning:"exclamationMarkTriangleF"}])},30437(e,t,i){var a=i(13584);const o="calcite-action",c={button:e=>`${o}-${e}-button`,indicator:e=>`${o}-${e}-indicator`},n=(0,a.i)("calcite-action");i.d(t,["C",0,{button:"button",buttonTextVisible:"button--text-visible",buttonCompact:"button--compact",iconContainer:"icon-container",slotContainer:"slot-container",slotContainerHidden:"slot-container--hidden",textContainer:"text-container",textContainerVisible:"text-container--visible",indicatorWithIcon:"indicator-with-icon",indicatorWithoutIcon:"indicator-without-icon"},"I",0,c,"i",0,n])},10820(e,t,i){i(2709),i(19919);var a=i(27080),o=i(58933),c=i(41656),n=i(83435),r=i(32012),l=i(87555),s=i(55907),d=i(40967),h=i(57108),u=i(47387),p=i(8415),v=i(30005),b=i(30437);const g=o.AH`.screen-reader-text{position:absolute;inline-size:var(--calcite-border-width-sm);block-size:var(--calcite-border-width-sm);padding:0;margin:calc(-1 * var(--calcite-border-width-sm));overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}`;var m=i(24543);const f=o.AH`:host{box-sizing:border-box;background-color:var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1));color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host([scale=s]){--calcite-internal-action-font-size: var(--calcite-font-size--2);--calcite-internal-action-min-height: var(--calcite-size-sm);--calcite-internal-action-line-height: 1rem;--calcite-internal-action-spacing: var(--calcite-theme-space-2xs, var(--calcite-spacing-xxs))}:host([scale=m]){--calcite-internal-action-font-size: var(--calcite-font-size--1);--calcite-internal-action-min-height: var(--calcite-size-md);--calcite-internal-action-line-height: 1rem;--calcite-internal-action-spacing: var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=l]){--calcite-internal-action-font-size: var(--calcite-font-size-0);--calcite-internal-action-min-height: var(--calcite-size-lg);--calcite-internal-action-line-height: 1.25rem;--calcite-internal-action-spacing: var(--calcite-theme-space-sm-plus, var(--calcite-spacing-sm-plus))}:host{display:flex;cursor:pointer;background-color:transparent;--calcite-internal-action-text-color: var(--calcite-color-text-3);border-radius:var(--calcite-action-corner-radius, var(--calcite-action-corner-radius-start-start, var(--calcite-corner-radius-xs)) var(--calcite-action-corner-radius-start-end, var(--calcite-corner-radius-xs)) var(--calcite-action-corner-radius-end-end, var(--calcite-corner-radius-xs)) var(--calcite-action-corner-radius-end-start, var(--calcite-corner-radius-xs)))}.interaction-container{border-radius:inherit}:host([width=full]){flex:1 0 auto}:host([width=full]) .button{justify-content:center}:host([width=full]) .button .text-container--visible{flex:none}:host([drag-handle]){cursor:move;--calcite-internal-action-text-color: var(--calcite-color-border-input);--calcite-internal-action-padding-inline: var(--calcite-theme-space-2xs, var(--calcite-spacing-xxs))}.button{position:relative;margin:0;display:flex;inline-size:auto;align-items:center;justify-content:flex-start;border-style:none;outline-color:transparent;box-sizing:border-box;background-color:var(--calcite-action-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)));border-radius:inherit;color:var(--calcite-action-text-color, var(--calcite-internal-action-text-color));cursor:inherit;flex:1 0 auto;font-family:inherit;font-size:var(--calcite-internal-action-font-size);font-weight:var(--calcite-theme-font-weight-regular, var(--calcite-font-weight-normal));line-height:var(--calcite-internal-action-line-height);min-block-size:var(--calcite-internal-action-height, var(--calcite-internal-action-min-height));max-block-size:var(--calcite-internal-action-height, none);padding-block:var(--calcite-internal-action-padding-block, var(--calcite-internal-action-spacing));padding-inline:var(--calcite-internal-action-padding-inline, var(--calcite-internal-action-spacing));text-align:start}.button:hover{background-color:var(--calcite-action-background-color-hover, var(--calcite-theme-color-surface-3, var(--calcite-color-foreground-2)));color:var(--calcite-action-text-color-press, var(--calcite-action-text-color-pressed, var(--calcite-color-text-1)))}.button:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.button:active{background-color:var(--calcite-action-background-color-press, var(--calcite-action-background-color-pressed, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3))))}.button--text-visible{gap:var(--calcite-internal-action-spacing);inline-size:100%}.icon-container{pointer-events:none;margin:0;display:flex;align-items:center;justify-content:center}.text-container{margin:0;inline-size:0px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:0;transition-property:opacity;transition-duration:var(--calcite-animation-timing);transition-timing-function:cubic-bezier(.4,0,.2,1);transition-property:inline-size}.text-container--visible{inline-size:auto;flex:1 1 auto;opacity:1}:host([active]) .button{background-color:var(--calcite-action-background-color, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3)));color:var(--calcite-action-text-color-press, var(--calcite-action-text-color-pressed, var(--calcite-color-text-1)))}:host([active]) .button:hover{background-color:var(--calcite-action-background-color-hover, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3)))}:host([active]) .button:active{background-color:var(--calcite-action-background-color-press, var(--calcite-action-background-color-pressed, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3))))}:host([loading]) .button:hover,:host([loading]) .button:focus{background-color:var(--calcite-action-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([loading]) calcite-loader[inline]{margin-inline-end:0px;--calcite-loader-progress-color-inline: var(--calcite-action-loader-color)}:host([appearance=transparent]):host([active]) .button{background-color:var(--calcite-action-background-color-press, var(--calcite-action-background-color-pressed, var(--calcite-color-transparent-press)))}:host([appearance=transparent]) .button{transition-property:box-shadow;transition-duration:var(--calcite-animation-timing);transition-timing-function:cubic-bezier(.4,0,.2,1);background-color:var(--calcite-action-background-color, var(--calcite-color-transparent))}:host([appearance=transparent]) .button:hover{background-color:var(--calcite-action-background-color-hover, var(--calcite-color-transparent-hover))}:host([appearance=transparent]) .button:active{background-color:var(--calcite-action-background-color-press, var(--calcite-action-background-color-pressed, var(--calcite-color-transparent-press)))}:host([selection-appearance=highlight]):host([active]) .button{background-color:var(--calcite-color-surface-highlight);color:var(--calcite-color-text-highlight)}:host([active-descendant]) .button{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}:host([alignment=center]) .button{justify-content:center}:host([alignment=end]) .button{justify-content:flex-end}:host([alignment=center]) .button .text-container--visible,:host([alignment=end]) .button .text-container--visible{flex:0 1 auto}:host([scale=s][compact]) .button,:host([scale=m][compact]) .button,:host([scale=l][compact]) .button{padding-inline:0px}.slot-container{display:flex}.slot-container--hidden{display:none}.indicator-with-icon{position:relative}.indicator-with-icon:after{content:"";position:absolute;block-size:.5rem;inline-size:.5rem;border-radius:9999px;inset-block-end:-.275rem;inset-inline-end:-.275rem;background-color:var(--calcite-action-indicator-color, var(--calcite-color-brand))}.indicator-without-icon{margin-inline:.25rem;inline-size:1rem;position:relative}.indicator-without-icon:after{content:"";position:absolute;block-size:.5rem;inline-size:.5rem;border-radius:9999px;inset-block-end:-.275rem;inset-inline-end:-.275rem;background-color:var(--calcite-action-indicator-color, var(--calcite-color-brand))}:host([scale=s]) .indicator-with-icon{position:relative}:host([scale=s]) .indicator-with-icon:after{content:"";position:absolute;block-size:.5rem;inline-size:.5rem;border-radius:9999px;inset-block-end:-.125rem;inset-inline-end:-.125rem;background-color:var(--calcite-action-indicator-color, var(--calcite-color-brand));block-size:.375rem;inline-size:.375rem}:host([scale=s]) .indicator-without-icon{position:relative}:host([scale=s]) .indicator-without-icon:after{content:"";position:absolute;block-size:.5rem;inline-size:.5rem;border-radius:9999px;inset-block-end:-.175rem;inset-inline-end:-.175rem;background-color:var(--calcite-action-indicator-color, var(--calcite-color-brand));block-size:.375rem;inline-size:.375rem}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}`;class k extends r.WF{constructor(){super(),this.guid=(0,l.g)(),this.buttonRef=(0,n._)(),this.buttonId=b.I.button(this.guid),this.mutationObserver=(0,s.c)("mutation",()=>this.requestUpdate()),this.messages=(0,h.u)({blocking:!0}),this.focusSetter=(0,u.u)()(this),this.indicatorRef=(0,n._)(),this.interactiveContainer=(0,p.u)(this),this.labelElRef=(0,n._)(),this.active=!1,this.activeDescendant=!1,this.appearance="transparent",this.compact=!1,this.disabled=!1,this.dragHandle=!1,this.iconFlipRtl=!1,this.indicator=!1,this.loading=!1,this.overflowDisabled=!1,this.scale="m",this.width="auto",this.textEnabled=!1,this.type="button",(0,v.u)()(this)}static{this.properties={aria:[0,{},{attribute:!1}],active:[7,{},{reflect:!0,type:Boolean}],activeDescendant:[7,{},{reflect:!0,type:Boolean}],alignment:[3,{},{reflect:!0}],appearance:[3,{},{reflect:!0}],compact:[7,{},{reflect:!0,type:Boolean}],disabled:[7,{},{reflect:!0,type:Boolean}],dragHandle:[7,{},{reflect:!0,type:Boolean}],form:[3,{},{reflect:!0}],icon:[3,{},{reflect:!0}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],indicator:[7,{},{reflect:!0,type:Boolean}],label:1,loading:[7,{},{reflect:!0,type:Boolean}],messageOverrides:[0,{},{attribute:!1}],overflowDisabled:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],width:[3,{},{reflect:!0}],text:1,textEnabled:[7,{},{reflect:!0,type:Boolean}],type:[3,{},{reflect:!0}],selectionAppearance:[3,{},{reflect:!0}]}}static{this.formAssociated=!0}static{this.styles=[f,g]}async setFocus(e){return this.focusSetter(()=>this.buttonRef.value,e)}connectedCallback(){super.connectedCallback(),this.mutationObserver?.observe(this.el,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.mutationObserver?.disconnect()}getAccessibleLabel(){const e=this.label||this.text||"";return this.indicator?this.messages.indicatorLabel.replace("{label}",e):e}getLabelledByElements(){const e=[...this.labelElRef.value?[this.labelElRef.value]:[],...this.aria?.labelledByElements??[]];return e.length?e:void 0}renderTextContainer(){const{text:e,textEnabled:t}=this,i={[b.C.textContainer]:!0,[b.C.textContainerVisible]:t};return e?(0,c.D)("text-container",o.qy`<div aria-hidden=true class=${(0,r.CP)(i)}>${e}</div>`):null}renderIndicatorText(){const{indicator:e,messages:t,buttonId:i}=this;return o.qy`<div aria-labelledby=${i??r.s6} aria-live=polite class=${(0,r.CP)(a.C.screenReaderText)} role=region ${(0,n.K)(this.indicatorRef)}>${e?t.indicator:null}</div>`}renderIconContainer(){const{loading:e,icon:t,scale:i,el:a,iconFlipRtl:n,indicator:l}=this,s="l"===i?"l":"m",h=e?o.qy`<calcite-loader inline .label=${this.messages.loading} .scale=${s}></calcite-loader>`:null,u=t?o.qy`<calcite-icon class=${(0,r.CP)({[b.C.indicatorWithIcon]:l})} .flipRtl=${n} .icon=${t} .scale=${(0,d.g)(this.scale)}></calcite-icon>`:null,p=h||u,v=p||a.children?.length,g=o.qy`<div class=${(0,r.CP)({[b.C.slotContainer]:!0,[b.C.slotContainerHidden]:e})}><slot></slot></div>`;return v?(0,c.D)("icon-container",o.qy`<div aria-hidden=true class=${(0,r.CP)(b.C.iconContainer)}>${p}${g}</div>`):null}renderLabel(){const e=this.getAccessibleLabel();return e?o.qy`<span class=${(0,r.CP)(a.C.screenReaderText)} ${(0,n.K)(this.labelElRef)}>${e}</span>`:null}renderButton(){const{compact:e,disabled:t,icon:i,loading:a,textEnabled:l,indicator:s,indicatorRef:d,buttonId:h}=this,u=this.getLabelledByElements(),p={[b.C.button]:!0,[b.C.buttonTextVisible]:l,[b.C.buttonCompact]:e},v=o.qy`${this.renderIconContainer()}${this.renderTextContainer()}${!i&&s&&(0,c.D)("indicator-no-icon",o.qy`<div class=${(0,r.CP)(b.C.indicatorWithoutIcon)}></div>`)||""}${this.renderLabel()}`,g=s&&d.value?[d.value]:[],f=[...this.aria?.controlsElements??[],...g];return this.dragHandle?o.qy`<span .ariaBusy=${(0,m.t)(a,void 0)} .ariaControlsElements=${f} .ariaDescribedByElements=${this.aria?.describedByElements} .ariaExpanded=${this.aria?.expanded} .ariaHasPopup=${this.aria?.hasPopup} .ariaLabelledByElements=${u} .ariaOwnsElements=${this.aria?.ownsElements} .ariaPressed=${this.aria?.pressed} class=${(0,r.CP)(p)} id=${h??r.s6} role=button tabindex=${(this.disabled?void 0:0)??r.s6} ${(0,n.K)(this.buttonRef)}>${v}</span>`:o.qy`<button .ariaBusy=${(0,m.t)(a,void 0)} .ariaChecked=${this.aria?.checked} .ariaControlsElements=${f} .ariaDescribedByElements=${this.aria?.describedByElements} .ariaExpanded=${this.aria?.expanded} .ariaHasPopup=${this.aria?.hasPopup} .ariaLabelledByElements=${u} .ariaOwnsElements=${this.aria?.ownsElements} .ariaPressed=${this.aria?.pressed} class=${(0,r.CP)(p)} .disabled=${t} id=${h??r.s6} .role=${this.aria?.role} type=${this.type??r.s6} ${(0,n.K)(this.buttonRef)}>${v}</button>`}render(){return this.interactiveContainer({disabled:this.disabled,children:o.qy`${this.renderButton()}${this.renderIndicatorText()}`})}}(0,a.c)("calcite-action",k)},45204(e,t,i){i.r(t),i.d(t,{Notice:()=>b}),i(10820),i(19919);var a=i(27080),o=i(58933),c=i(83435),n=i(32012),r=i(64336),l=i(12664),s=i(13584),d=i(77173),h=i(40967),u=i(57108),p=i(47387);const v=o.AH`:host([scale=s]){--calcite-notice-spacing-token-small: .5rem;--calcite-notice-spacing-token-large: .75rem}:host([scale=s]) .container slot[name=title]::slotted(*),:host([scale=s]) .container *::slotted([slot=title]){font-size:var(--calcite-font-size-relative-base);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=s]) .container slot[name=message]::slotted(*),:host([scale=s]) .container *::slotted([slot=message]){font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=s]) ::slotted(calcite-link){font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=m]){--calcite-notice-spacing-token-small: .75rem;--calcite-notice-spacing-token-large: 1rem}:host([scale=m]) .container slot[name=title]::slotted(*),:host([scale=m]) .container *::slotted([slot=title]){font-size:var(--calcite-font-size-relative-md);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=m]) .container slot[name=message]::slotted(*),:host([scale=m]) .container *::slotted([slot=message]){font-size:var(--calcite-font-size-relative-base);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=m]) ::slotted(calcite-link){font-size:var(--calcite-font-size-relative-base);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=l]){--calcite-notice-spacing-token-small: 1rem;--calcite-notice-spacing-token-large: 1.25rem}:host([scale=l]) .container slot[name=title]::slotted(*),:host([scale=l]) .container *::slotted([slot=title]){font-size:var(--calcite-font-size-relative-lg);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=l]) .container slot[name=message]::slotted(*),:host([scale=l]) .container *::slotted([slot=message]){font-size:var(--calcite-font-size-relative-md);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=l]) ::slotted(calcite-link){font-size:var(--calcite-font-size-relative-md);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=l]) .notice-close{margin-inline-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=l]) .actions-end{margin-inline-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm));gap:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([width=auto]){--calcite-notice-width: auto}:host([width=half]){--calcite-notice-width: 50%}:host([width=full]){--calcite-notice-width: 100%}:host{margin-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}.container{pointer-events:none;margin-block:0px;box-sizing:border-box;display:flex;inline-size:100%;opacity:0;overflow:hidden;max-block-size:0;transition-property:opacity,max-block-size;transition-duration:var(--calcite-animation-timing);text-align:start;border-radius:var(--calcite-notice-corner-radius, var(--calcite-corner-radius-sm));box-shadow:var(--calcite-notice-shadow, var(--calcite-shadow-none))}:host{display:flex}:host([open]) .container{pointer-events:auto;max-block-size:100%;align-items:center;opacity:1;overflow:visible}@starting-style{:host([open]) .container{opacity:0;max-block-size:0}}:host([open][appearance=outline-fill]) .container{border:var(--calcite-border-width-sm) solid}.container slot[name=title]::slotted(*),.container *::slotted([slot=title]){margin:0;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-notice-title-text-color, var(--calcite-color-text-1))}.container slot[name=message]::slotted(*),.container *::slotted([slot=message]){margin:0;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-notice-content-text-color, var(--calcite-color-text-2))}:host(:not([kind=neutral])[appearance=solid]) .container slot[name=title]::slotted(*),:host(:not([kind=neutral])[appearance=solid]) .container *::slotted([slot=title]){color:var(--calcite-notice-title-text-color, var(--calcite-color-text-inverse))}:host(:not([kind=neutral])[appearance=solid]) .container slot[name=message]::slotted(*),:host(:not([kind=neutral])[appearance=solid]) .container *::slotted([slot=message]){color:var(--calcite-notice-content-text-color, var(--calcite-color-text-inverse))}.notice-content{transition-property:background-color,block-size,border-color,box-shadow,color,inset-block-end,inset-block-start,inset-inline-end,inset-inline-start,inset-size,opacity,outline-color,transform;transition-duration:var(--calcite-animation-timing);transition-timing-function:ease-in-out;box-sizing:border-box;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-large)}.notice-content:first-of-type:not(:only-child){padding-inline-start:var(--calcite-notice-spacing-token-large)}.notice-content:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}.notice-icon{display:flex;align-items:center;transition-property:background-color,block-size,border-color,box-shadow,color,inset-block-end,inset-block-start,inset-inline-end,inset-inline-start,inset-size,opacity,outline-color,transform;transition-duration:var(--calcite-animation-timing);transition-timing-function:ease-in-out;box-sizing:border-box;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;padding-inline:var(--calcite-notice-spacing-token-small)}.notice-close{transition-property:background-color,block-size,border-color,box-shadow,color,inset-block-end,inset-block-start,inset-inline-end,inset-inline-start,inset-size,opacity,outline-color,transform;transition-duration:var(--calcite-animation-timing);transition-timing-function:ease-in-out;box-sizing:border-box;display:flex;cursor:pointer;align-items:center;flex:0 0 auto;margin-inline-end:var(--calcite-theme-space-xs, var(--calcite-spacing-xs));--calcite-action-background-color: var(--calcite-notice-close-background-color);--calcite-action-background-color-hover: var( --calcite-notice-close-background-color-hover, var(--calcite-notice-close-background-color-focus) );--calcite-action-background-color-press: var(--calcite-notice-close-background-color-press);--calcite-action-text-color: var(--calcite-notice-close-icon-color, var(--calcite-color-text-3));--calcite-action-text-color-press: var(--calcite-notice-close-icon-color-hover)}.actions-end{display:flex;align-items:center;flex:0 0 auto;margin-inline-end:var(--calcite-theme-space-xs, var(--calcite-spacing-xs));gap:var(--calcite-theme-space-xs, var(--calcite-spacing-xs))}:host([kind=brand][appearance=outline-fill]) .container{border-color:var(--calcite-notice-border-color, rgb(from var(--calcite-color-brand) r g b/var(--calcite-opacity-half)));background-color:var(--calcite-notice-background-color, color-mix(in srgb, var(--calcite-color-brand) 5%, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1))))}:host([kind=brand][appearance=outline-fill]) .notice-icon,:host([kind=brand][appearance=transparent]) .notice-icon{color:var(--calcite-color-brand)}:host([kind=info][appearance=outline-fill]) .container{border-color:var(--calcite-notice-border-color, rgb(from var(--calcite-color-status-info) r g b/var(--calcite-opacity-half)));background-color:var(--calcite-notice-background-color, color-mix(in srgb, var(--calcite-color-status-info) 5%, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1))))}:host([kind=info][appearance=outline-fill]) .notice-icon,:host([kind=info][appearance=transparent]) .notice-icon{color:var(--calcite-color-status-info)}:host([kind=danger][appearance=outline-fill]) .container{border-color:var(--calcite-notice-border-color, rgb(from var(--calcite-color-status-danger) r g b/var(--calcite-opacity-half)));background-color:var(--calcite-notice-background-color, color-mix(in srgb, var(--calcite-color-status-danger) 5%, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1))))}:host([kind=danger][appearance=outline-fill]) .notice-icon,:host([kind=danger][appearance=transparent]) .notice-icon{color:var(--calcite-color-status-danger)}:host([kind=success][appearance=outline-fill]) .container{border-color:var(--calcite-notice-border-color, rgb(from var(--calcite-color-status-success) r g b/var(--calcite-opacity-half)));background-color:var(--calcite-notice-background-color, color-mix(in srgb, var(--calcite-color-status-success) 5%, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1))))}:host([kind=success][appearance=outline-fill]) .notice-icon,:host([kind=success][appearance=transparent]) .notice-icon{color:var(--calcite-color-status-success)}:host([kind=warning][appearance=outline-fill]) .container{border-color:var(--calcite-notice-border-color, rgb(from var(--calcite-color-status-warning) r g b/var(--calcite-opacity-half)));background-color:var(--calcite-notice-background-color, color-mix(in srgb, var(--calcite-color-status-warning) 5%, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1))))}:host([kind=warning][appearance=outline-fill]) .notice-icon,:host([kind=warning][appearance=transparent]) .notice-icon{color:var(--calcite-color-status-warning)}:host([kind=neutral][appearance=outline-fill]) .container{border-color:var(--calcite-color-border-2);background-color:var(--calcite-notice-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([kind=neutral]) .notice-icon{color:var(--calcite-color-text-3)}:host([appearance=transparent]) .container{background-color:transparent}:host([hidden]){display:none}[hidden]{display:none}`;class b extends n.WF{constructor(){super(...arguments),this.closeButtonRef=(0,c._)(),this.transitionProp="opacity",this.transitionRef=(0,c._)(),this.messages=(0,u.u)(),this.focusSetter=(0,p.u)()(this),this.hasActionEnd=!1,this.appearance="outline-fill",this.closable=!1,this.iconFlipRtl=!1,this.kind="brand",this.open=!1,this.scale="m",this.width="auto",this.calciteNoticeBeforeClose=(0,r.b)({cancelable:!1}),this.calciteNoticeBeforeOpen=(0,r.b)({cancelable:!1}),this.calciteNoticeClose=(0,r.b)({cancelable:!1}),this.calciteNoticeOpen=(0,r.b)({cancelable:!1})}static{this.properties={hasActionEnd:[16,{},{state:!0}],appearance:[3,{},{reflect:!0}],closable:[7,{},{reflect:!0,type:Boolean}],icon:[3,{converter:n.pf},{reflect:!0}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],kind:[3,{},{reflect:!0}],messageOverrides:[0,{},{attribute:!1}],open:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],width:[3,{},{reflect:!0}]}}static{this.styles=v}async setFocus(e){return this.focusSetter(()=>this.el.querySelector("calcite-link")||this.closeButtonRef.value,e)}async load(){this.kindIcons={...s.a,brand:s.K.brand},this.requestedIcon=(0,l.v)(this.kindIcons,this.icon,this.kind)}willUpdate(e){e.has("open")&&(this.hasUpdated||!1!==this.open)&&(0,d.t)(this),(e.has("icon")||e.has("kind")&&(this.hasUpdated||"brand"!==this.kind))&&(this.requestedIcon=(0,l.v)(this.kindIcons,this.icon,this.kind))}onBeforeClose(){this.calciteNoticeBeforeClose.emit()}onBeforeOpen(){this.calciteNoticeBeforeOpen.emit()}onClose(){this.calciteNoticeClose.emit()}onOpen(){this.calciteNoticeOpen.emit()}close(){this.open=!1}handleActionsEndSlotChange(e){this.hasActionEnd=(0,l.s)(e)}render(){const e=o.qy`<calcite-action class=${(0,n.CP)("notice-close")} icon=x @click=${this.close} .scale=${this.scale} .text=${this.messages.close} ${(0,c.K)(this.closeButtonRef)}></calcite-action>`;return o.qy`<div class=${(0,n.CP)("container")} ${(0,c.K)(this.transitionRef)}>${this.requestedIcon?o.qy`<div class=${(0,n.CP)("notice-icon")}><calcite-icon .flipRtl=${this.iconFlipRtl} .icon=${this.requestedIcon} .scale=${(0,h.g)(this.scale)}></calcite-icon></div>`:null}<div class=${(0,n.CP)("notice-content")}><slot name=${"title"}></slot><slot name=${"message"}></slot><slot name=${"link"}></slot></div><div class=${(0,n.CP)("actions-end")} .hidden=${!this.hasActionEnd}><slot name=${"actions-end"} @slotchange=${this.handleActionsEndSlotChange}></slot></div>${this.closable?e:null}</div>`}}(0,a.c)("calcite-notice",b)},41656(e,t,i){i.d(t,{D:()=>n});var a=i(7261),o=i(66567),c=i(58887);const n=(0,o.u$)(class extends o.WL{constructor(){super(...arguments),this.key=a.s6}render(e,t){return this.key=e,t}update(e,[t,i]){return t!==this.key&&((0,c.mY)(e),this.key=t),i}})},74059(e,t,i){i.d(t,{Dk:()=>f,aK:()=>k,yr:()=>E,jH:()=>C,oW:()=>$});var a=i(64336),o=i(59231);var c=i(58933),n=i(14246),r=i(44613);const l=e=>{const t=(0,n.a)(e,"lang",globalThis.navigator?.language||u);return{lang:t,t9nLocale:m(t)}},s=async(e,t,i=e.localName.split("-").slice(1).join("-"))=>{const{lang:a,t9nLocale:o}=l(e),c=`${t}/${i}/t9n`;return{lang:a,t9nLocale:o,t9nStrings:null===i?{}:await v(o,c,"messages.")}},d="ar,bg,bs,ca,cs,da,de,el,en,es,et,fi,fr,he,hr,hu,id,it,ja,ko,lt,lv,nl,nb,no,pl,pt-BR,pt-PT,ro,ru,sk,sl,sr,sv,th,tr,uk,vi,zh-CN,zh-HK,zh-TW".split(","),h=new Set(d),u="en",p={pt:"pt-BR",nb:"no",nn:"no",zh:"zh-CN"},v=async(e,t,i="")=>{const a=`${t}/${i}`,o=`${a}${e}.json`;return b[o]??=g(e,a),await b[o]},b={},g=async(e,t)=>{const i=`${t}${e}.json`;try{const e=await fetch(i);if(e.ok)return await e.json()}catch(e){return(0,r.Rm)("error","intl",`An unknown error occurred while fetching localization strings at ${i}`,{detail:{error:e}}),{}}return e===u?{}:await g(u,t)},m=e=>{const[t,i]=e.split("-"),a=t.toLowerCase();let o=a;return i&&(o=`${a}-${i.toUpperCase()}`),o=p[o]??o,h.has(o)?o:i?m(a):u},f=e=>y(void 0,e),k=e=>t=>y(t,e);class x extends a.C{constructor(e,t){super(e);const i=this.exports;try{(0,o.s)(this.component);const e=t(this.component,this),a=this.exports!==i;if((0,o.i)(e)){a||this.setProvisionalExports(e);const t=e.then(e=>{this.exports=e,super.catchUpLifecycle()}).catch(e=>{this.P.reject(e)});this.onLoad(async()=>await t)}else a&&void 0===e||(this.exports=e),queueMicrotask(()=>super.catchUpLifecycle())}catch(e){this.P.reject(e)}}catchUpLifecycle(){}}const y=(w=x,(...e)=>{const t=(0,o.b)(),i=new w(...e),c=i.exports;(0,o.a)(t.at(-1));const n=i.component.manager;n.W(i,c),i.watchExports(n.W.bind(n,i)),(0,o.f)(i);const r=[i.component,...t].reverse();return(0,a.a)(r,e=>void 0===e?void 0:((e,{host:t,key:i,isReactive:a},c)=>{const n=t,r=n[i]!==e.exports,l=n[i]!==c,s=c!==e.exports;if(r&&!l&&s&&(n[i]=e.exports),t===e.component){if(a){const t=e.component.manager;l&&t.W(e,n[i]),e.onUpdate(a=>{if(a.has(i)){const a=n[i];a!==e.exports&&t.W(e,a)}})}e.O=a?void 0:i}const d=e.component.constructor.elementProperties.get(i)?.readOnly;e.watchExports(()=>{n[i]!==e.exports&&(d?(0,o.c)(()=>{n[i]=e.exports}):n[i]=e.exports)})})(i,e,c),c)});var w;const $=(e,t)=>new z(e,t);class z extends a.C{#e;#t;#i;constructor(e,t){super(),c.S$||(this.#t=e,this.#i=t,this.#e=new MutationObserver(i=>{i.forEach(i=>{e.includes(i.attributeName)&&t.call(this.component,this.component.el.getAttribute(i.attributeName),i.oldValue,i.attributeName)})}))}hostConnected(){this.#t.forEach(e=>{this.component.el.hasAttribute(e)&&this.#i.call(this.component,this.component.el.getAttribute(e),null,e)}),this.#e.observe(this.component.el,{attributes:!0,attributeOldValue:!0,attributeFilter:this.#t})}hostDisconnected(){this.#e.disconnect()}}const C=()=>f((e,t)=>{t.exports="ltr",t.onLifecycle(()=>{const i=()=>{const i=(0,n.a)(e.el,"dir","ltr");t.exports="rtl"===i?"rtl":"ltr"};return i(),(0,n.o)(e.el,["dir"],i)})}),E=e=>(t={})=>f((i,a)=>{const o=l(i.el),c={_lang:o.lang,_t9nLocale:o.t9nLocale,_loading:!0},d=i;a.onLifecycle(()=>((e,t,i,a)=>{let o;const c=()=>s(e,t(),a).then(e=>{o?.lang===e.lang&&o.t9nLocale===e.t9nLocale&&o.t9nStrings===e.t9nStrings||i(e),o=e}).catch(e=>{(0,r.Rm)("error","intl","Error updating component locale state",{detail:{error:e}})});return queueMicrotask(c),(0,n.o)(e,["lang"],c)})(i.el,()=>e("./assets"),({t9nLocale:e,t9nStrings:t,lang:o})=>{const c={...t,_lang:o,_t9nLocale:e,_loading:!1};a.exports=c;const n=t.componentLabel;"string"==typeof n&&"label"in i&&null==i.label&&(i.label??=n),h(d.messageOverrides)},t.name));const h=e=>{const t=a.exports,i=t._original??t,o=B(i,e);e&&(o._original=i),a.exports=o};return"messageOverrides"in d&&a.onUpdate(e=>{e.has("messageOverrides")&&h(d.messageOverrides)}),t.blocking?(a.setProvisionalExports(c,!1),a.ready):c}),B=(e,t)=>{if(!t)return e;const i={...e};return Object.entries(t).forEach(([t,a])=>{void 0!==e[t]&&(i[t]="object"==typeof a?B(e[t],a):a??e[t])}),i}}}]);