@arcgis/core 5.1.0-next.106 → 5.1.0-next.107

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 (131) hide show
  1. package/arcgisGlobal.d.ts +5 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{b7a81fd4994eabba1869.js → 0c8e6ccb5a8174718d62.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{be817be7c81fb630122f.js → 17604cbd4d24158e2c16.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{065dd2fdc834146423c7.js → 33ec193e6d7a0cb9d8dd.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{f9324420f2c6ac240f63.js → 37c63570c0b4981cd519.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{15920af0c4f46773b06e.js → 502c3da8c49bf885f51d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/518046d2b95a7590a092.js +1 -0
  9. package/assets/esri/core/workers/chunks/{aaad0d3e82ed917d3886.js → 547dc6ccb989bd962661.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{bd59cb5abc67e46f1b2c.js → 55334ad3618899cdbf78.js} +2 -2
  11. package/assets/esri/core/workers/chunks/{d859c046a3ea42530bff.js → 56d9d3f108ff6e719dd4.js} +1 -1
  12. package/assets/esri/core/workers/chunks/75a7de23c05435ec7649.js +1 -0
  13. package/assets/esri/core/workers/chunks/7b66691d133dabd87ce6.js +1 -0
  14. package/assets/esri/core/workers/chunks/{dcba6c766eee8b90381a.js → 8557dd9ef336b23f768f.js} +1 -1
  15. package/assets/esri/core/workers/chunks/9234a293d61e134f121f.js +1 -0
  16. package/assets/esri/core/workers/chunks/{a8ae00e06f98e04aee8e.js → ac408c62565e2c8b5975.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{f7fe17a22390a24d6df8.js → b69d1d528e271568cbd8.js} +2 -2
  18. package/assets/esri/core/workers/chunks/{0cc74bc3772be51cabc1.js → bbaf8baa3ca6195467e4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{b9850fe7dcdaed0c327c.js → cdb48d198145493f76f3.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{63ea4191d441efd2f146.js → d4014213c476bf8099af.js} +1 -1
  21. package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
  22. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  23. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  24. package/assets/esri/themes/base/widgets/_Sketch.scss +1 -24
  25. package/assets/esri/themes/dark/main.css +1 -1
  26. package/assets/esri/themes/light/main.css +1 -1
  27. package/assets/esri/themes/light/view.css +1 -1
  28. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  29. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  30. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  31. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  32. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  33. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  34. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  35. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  36. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  37. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  38. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  39. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  40. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  41. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  42. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  43. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  65. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  66. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  68. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  69. package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
  70. package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
  71. package/chunks/Fog.glsl.js +3 -3
  72. package/chunks/GlowComposition.glsl.js +38 -56
  73. package/chunks/OITDimOpaque.glsl.js +8 -3
  74. package/chunks/SimpleAtmosphere.glsl.js +3 -3
  75. package/chunks/lyr3DWorker.js +1 -1
  76. package/chunks/pe-wasm.js +1 -1
  77. package/config.js +1 -1
  78. package/geometry/support/WKIDUnitConversion.js +1 -1
  79. package/identity/IdentityManagerBase.js +1 -1
  80. package/kernel.js +1 -1
  81. package/layers/raster/datasets/MRFRaster.js +1 -1
  82. package/layers/video/VideoController.js +1 -1
  83. package/package.json +3 -3
  84. package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
  85. package/rest/networks/circuits/support/VerifyCircuitsResult.js +1 -1
  86. package/support/revision.js +1 -1
  87. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  88. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  89. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  90. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  91. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  92. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  93. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  94. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  95. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  96. package/views/3d/environment/FoggyWeather.js +1 -1
  97. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  98. package/views/3d/layers/i3s/Intersector.js +1 -1
  99. package/views/3d/support/ResourceController.js +1 -1
  100. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  101. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  102. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  103. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  104. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
  105. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  106. package/views/SceneView.js +1 -1
  107. package/views/draw/DrawTool.d.ts +77 -0
  108. package/views/draw/support/editingSessionUtils.js +1 -1
  109. package/views/draw/support/managers/PluginLifecycleManager.d.ts +10 -0
  110. package/views/interactive/InteractiveToolBase.d.ts +11 -0
  111. package/views/interactive/editGeometry/interfaces.d.ts +8 -0
  112. package/views/interactive/interfaces.d.ts +20 -0
  113. package/views/webgl/capabilities/load.js +1 -1
  114. package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +9 -1
  115. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  116. package/widgets/Sketch/SketchViewModel.d.ts +67 -2
  117. package/widgets/Sketch/SketchViewModel.js +1 -1
  118. package/widgets/Sketch/VisibleElements.d.ts +19 -1
  119. package/widgets/Sketch/VisibleElements.js +1 -1
  120. package/widgets/Sketch/support/OperationHandle.js +1 -1
  121. package/widgets/Sketch/support/PluginManager.d.ts +12 -0
  122. package/widgets/Sketch/support/PluginManager.js +1 -1
  123. package/widgets/Sketch.js +1 -1
  124. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +81 -0
  125. package/widgets/support/SelectionToolbar/types.d.ts +4 -0
  126. package/assets/esri/core/workers/chunks/2b3a8a53cd68f666676b.js +0 -1
  127. package/assets/esri/core/workers/chunks/2ecb21c402cdd8c82533.js +0 -1
  128. package/assets/esri/core/workers/chunks/7e02e5c6979090fe3ea7.js +0 -1
  129. package/assets/esri/core/workers/chunks/fae2c8f053927559fff0.js +0 -1
  130. /package/assets/esri/core/workers/chunks/{bd59cb5abc67e46f1b2c.js.LICENSE.txt → 55334ad3618899cdbf78.js.LICENSE.txt} +0 -0
  131. /package/assets/esri/core/workers/chunks/{f7fe17a22390a24d6df8.js.LICENSE.txt → b69d1d528e271568cbd8.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import o from"../../../geometry/Point.js";import a from"../../../geometry/SpatialReference.js";import n from"./BaseRaster.js";import{parseSpatialReference as l,parsePAMInfo as f}from"./pamParser.js";import{getElement as u,getElementValue as h}from"./xmlUtilities.js";import{isPlatformLittleEndian as c}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import g from"../../support/RasterInfo.js";import d from"../../support/RasterStorageInfo.js";const x=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),y=new Map;y.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),y.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),y.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),y.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),y.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let b=class extends n{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async fetchRawTile(t,e,r,s={}){const{blockWidth:i,blockHeight:o,blockBoundary:a}=this.rasterInfo.storageInfo,n=a[t];if(!n||n.maxRow<e||n.maxCol<r||n.minRow>e||n.minCol>r)return null;const{bandCount:l,pixelType:f}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(t,e,r);if(!u||0===u.length)return null;if(u.some(t=>t.from>t.to)){const t=new Uint8Array(i*o);return new m({width:i,height:o,pixels:void 0,mask:t,validPixelCount:0})}const{bandIds:p}=this.ioConfig,g=this._getBandSegmentCount(),d=[];let x=0;for(x=0;x<g;x++)p&&!p.includes(x)||d.push(this.request(this._files.data,{range:{from:u[x].from,to:u[x].to},responseType:"array-buffer",signal:s.signal}));const b=await Promise.all(d),w=b.map(t=>t.data.byteLength).reduce((t,e)=>t+e),I=new Uint8Array(w),A=[];let F=0;for(x=0;x<g;x++)A.push(F),I.set(new Uint8Array(b[x].data),F),F+=b[x].data.byteLength;const R=y.get(this.rasterInfo.storageInfo.compression).decoderFormat,_=await this.decodePixelBlock(I.buffer,{width:i,height:o,format:R,planes:p?.length||l,offsets:A,pixelType:f}).catch(()=>null);if(null==_)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==R&&!_.mask&&(S=S[0],null!=S)){const t=_.width*_.height,e=new Uint8Array(t);if(Math.abs(S)>1e24)for(x=0;x<t;x++)Math.abs((_.pixels[0][x]-S)/S)>1e-6&&(e[x]=1);else for(x=0;x<t;x++)_.pixels[0][x]!==S&&(e[x]=1);_.mask=e}let M=0,k=0;if(h!==i||c!==o){let t=_.mask;if(t)for(x=0;x<o;x++)if(k=x*i,x<c)for(M=h;M<i;M++)t[k+M]=0;else for(M=0;M<i;M++)t[k+M]=0;else for(t=new Uint8Array(i*o),_.mask=t,x=0;x<c;x++)for(k=x*i,M=0;M<h;M++)t[k+M]=1}return _}async _open(t){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const e=t?t.signal:null,r=await this.request(this.url,{responseType:"xml",signal:e}),{rasterInfo:s,files:i}=this._parseHeader(r.data),{skipMapInfo:o,skipExtensions:a=[]}=this.ioConfig;if(!a.includes("aux.xml")&&!o){const e=await this._fetchAuxiliaryData(t);null!=e&&(s.statistics=e.statistics??s.statistics,s.histograms=e.histograms,e.histograms&&null==s.statistics&&(s.statistics=p(e.histograms)))}o&&this.updateImageSpaceRasterInfo(s),this._set("rasterInfo",s),this._files=i;const n=await this.request(i.index,{responseType:"array-buffer",signal:e});this._storageIndex=w(n.data);const{blockWidth:l,blockHeight:f}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,m=[],g=this._getBandSegmentCount();let d=0,x=-1;for(;d<this._storageIndex.length;){x++;const t=Math.ceil(h/l/u**x)-1,e=Math.ceil(c/f/u**x)-1;d+=(t+1)*(e+1)*g*4,m.push({maxRow:e,maxCol:t,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,x>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=x),this.updateTileInfo()}_getBandSegmentCount(){return y.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(t,e,r){const{blockWidth:s,blockHeight:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:a,height:n}=this.rasterInfo,l=this._getBandSegmentCount();let f,u,h,c=0,p=0;for(h=0;h<t;h++)p=o**h,f=Math.ceil(a/s/p),u=Math.ceil(n/i/p),c+=f*u;p=o**t,f=Math.ceil(a/s/p),u=Math.ceil(n/i/p),c+=e*f+r,c*=4*l;const m=this._storageIndex.subarray(c,c+4*l);let g=0,d=0;const x=[];for(let y=0;y<l;y++)g=m[4*y]*2**32+m[4*y+1],d=g+m[4*y+2]*2**32+m[4*y+3]-1,x.push({from:g,to:d});return{ranges:x,actualTileWidth:r<f-1?s:Math.ceil(a/p)-s*(f-1),actualTileHeight:e<u-1?i:Math.ceil(n/p)-i*(u-1)}}_parseHeader(t){const r=u(t,"MRF_META/Raster");if(!r)throw new e("mrf:open","not a valid MRF format");const s=u(r,"Size"),n=parseInt(s.getAttribute("x"),10),f=parseInt(s.getAttribute("y"),10),c=parseInt(s.getAttribute("c"),10),p=(h(r,"Compression")||"none").toLowerCase();if(!y.has(p))throw new e("mrf:open","currently does not support compression "+p);const m=h(r,"DataType")||"UInt8",b=x.get(m.toLowerCase());if(null==b)throw new e("mrf:open","currently does not support pixel type "+m);const w=u(r,"PageSize"),I=parseInt(w.getAttribute("x"),10),A=parseInt(w.getAttribute("y"),10),F=u(r,"DataValues");let R,_;F&&(_=F.getAttribute("NoData"),null!=_&&(R=_.trim().split(" ").map(t=>parseFloat(t))));if(u(t,"MRF_META/CachedSource"))throw new e("mrf:open","currently does not support MRF referencing other data files");const S=u(t,"MRF_META/GeoTags"),M=u(S,"BoundingBox");let k,C=!1;if(null!=M){const t=parseFloat(M.getAttribute("minx")),e=parseFloat(M.getAttribute("miny")),r=parseFloat(M.getAttribute("maxx")),s=parseFloat(M.getAttribute("maxy")),o=h(S,"Projection")||"";let n=a.WGS84;if("LOCAL_CS[]"!==o)if(o.toLowerCase().startsWith("epsg:")){const t=Number(o.slice(5));isNaN(t)||0===t||(n=new a({wkid:t}))}else n=l(o)??a.WGS84;else C=!0,n=new a({wkid:3857});k=new i(t,e,r,s),k.spatialReference=n}else C=!0,k=new i({xmin:-.5,ymin:.5-f,xmax:n-.5,ymax:.5,spatialReference:new a({wkid:3857})});const T=u(t,"MRF_META/Rsets"),j=parseInt(T?.getAttribute("scale")||"2",10),L=k.spatialReference,B=new d({origin:new o({x:k.xmin,y:k.ymax,spatialReference:L}),blockWidth:I,blockHeight:A,pyramidBlockWidth:I,pyramidBlockHeight:A,compression:p,pyramidScalingFactor:j}),E=new o({x:k.width/n,y:k.height/f,spatialReference:L}),P=new g({width:n,height:f,extent:k,isPseudoSpatialReference:C,spatialReference:L,bandCount:c,pixelType:b,pixelSize:E,noDataValue:R,storageInfo:B}),U=this._getAuxFullPath(h(r,"DataFile")),W=this._getAuxFullPath(h(r,"IndexFile"));return{rasterInfo:P,files:{mrf:this.url,index:W||this.url.replace(".mrf",".idx"),data:U||this.url.replace(".mrf",y.get(p).blobExtension)}}}_getAuxFullPath(t){if(!t)return null;if(t.includes("\\"))return null;if(t.includes("/"))return t.startsWith(new URL(this.url).origin)?t:null;return`${this.url.slice(0,this.url.lastIndexOf("/"))}/${t}`}async _fetchAuxiliaryData(t){try{const{data:e}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:t?.signal});return f(e)}catch{return null}}};function w(t){if(t.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let e,r,s,i,o,a;if(c){for(r=new Uint8Array(t),i=new ArrayBuffer(t.byteLength),s=new Uint8Array(i),o=0;o<t.byteLength/4;o++)for(a=0;a<4;a++)s[4*o+a]=r[4*o+3-a];e=new Uint32Array(i)}else e=new Uint32Array(t);return e}t([r()],b.prototype,"_files",void 0),t([r()],b.prototype,"_storageIndex",void 0),t([r({type:String,json:{write:!0}})],b.prototype,"datasetFormat",void 0),b=t([s("esri.layers.raster.datasets.MRFRaster")],b);const I=b;export{I as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import o from"../../../geometry/Point.js";import n from"../../../geometry/SpatialReference.js";import a from"./BaseRaster.js";import{parseSpatialReference as l,parsePAMInfo as f}from"./pamParser.js";import{getElement as u,getElementValue as h}from"./xmlUtilities.js";import{isPlatformLittleEndian as c}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import g from"../../support/RasterInfo.js";import d from"../../support/RasterStorageInfo.js";const y=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),x=new Map;x.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),x.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),x.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),x.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),x.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let b=class extends a{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(t,e,s,r={}){const{blockWidth:i,blockHeight:o,blockBoundary:n}=this.rasterInfo.storageInfo,a=n[t];if(!a||a.maxRow<e||a.maxCol<s||a.minRow>e||a.minCol>s)return null;const{bandCount:l,pixelType:f}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(t,e,s);if(!u||0===u.length)return null;if(u.some(t=>t.from>t.to)){const t=new Uint8Array(i*o);return new m({width:i,height:o,pixels:void 0,mask:t,validPixelCount:0})}const{bandIds:p}=this.ioConfig,g=this._getBandSegmentCount(),d=[];let y=0;for(y=0;y<g;y++)p&&!p.includes(y)||d.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:r.signal}));const b=await Promise.all(d),w=b.map(t=>t.data.byteLength).reduce((t,e)=>t+e),I=new Uint8Array(w),_=[];let A=0;for(y=0;y<g;y++)_.push(A),I.set(new Uint8Array(b[y].data),A),A+=b[y].data.byteLength;const F=x.get(this.rasterInfo.storageInfo.compression).decoderFormat,R=await this.decodePixelBlock(I.buffer,{width:i,height:o,format:F,planes:p?.length||l,offsets:_,pixelType:f}).catch(()=>null);if(null==R)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==F&&!R.mask&&(S=S[0],null!=S)){const t=R.width*R.height,e=new Uint8Array(t);if(Math.abs(S)>1e24)for(y=0;y<t;y++)Math.abs((R.pixels[0][y]-S)/S)>1e-6&&(e[y]=1);else for(y=0;y<t;y++)R.pixels[0][y]!==S&&(e[y]=1);R.mask=e}let M=0,k=0;if(h!==i||c!==o){let t=R.mask;if(t)for(y=0;y<o;y++)if(k=y*i,y<c)for(M=h;M<i;M++)t[k+M]=0;else for(M=0;M<i;M++)t[k+M]=0;else for(t=new Uint8Array(i*o),R.mask=t,y=0;y<c;y++)for(k=y*i,M=0;M<h;M++)t[k+M]=1}return R}async _open(t){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const e=t?t.signal:null,s=await this.request(this.url,{responseType:"xml",signal:e}),{rasterInfo:r,files:i}=this._parseHeader(s.data),{skipMapInfo:o,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!o){const e=await this._fetchAuxiliaryData(t);null!=e&&(r.statistics=e.statistics??r.statistics,r.histograms=e.histograms,e.histograms&&null==r.statistics&&(r.statistics=p(e.histograms)))}o&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=i;const a=await this.request(i.index,{responseType:"array-buffer",signal:e});this._storageIndex=w(a.data);const{blockWidth:l,blockHeight:f}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,m=[],g=this._getBandSegmentCount();let d=0,y=-1;for(;d<this._storageIndex.length;){y++;const t=Math.ceil(h/l/u**y)-1,e=Math.ceil(c/f/u**y)-1;d+=(t+1)*(e+1)*g*4,m.push({maxRow:e,maxCol:t,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,y>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=y),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(t,e,s){const{blockWidth:r,blockHeight:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:n,height:a}=this.rasterInfo,l=this._getBandSegmentCount();let f,u,h,c=0,p=0;for(h=0;h<t;h++)p=o**h,f=Math.ceil(n/r/p),u=Math.ceil(a/i/p),c+=f*u;p=o**t,f=Math.ceil(n/r/p),u=Math.ceil(a/i/p),c+=e*f+s,c*=4*l;const m=this._storageIndex.subarray(c,c+4*l);let g=0,d=0;const y=[];for(let x=0;x<l;x++)g=m[4*x]*2**32+m[4*x+1],d=g+m[4*x+2]*2**32+m[4*x+3]-1,y.push({from:g,to:d});return{ranges:y,actualTileWidth:s<f-1?r:Math.ceil(n/p)-r*(f-1),actualTileHeight:e<u-1?i:Math.ceil(a/p)-i*(u-1)}}_parseHeader(t){const s=u(t,"MRF_META/Raster");if(!s)throw new e("mrf:open","not a valid MRF format");const r=u(s,"Size"),a=parseInt(r.getAttribute("x"),10),f=parseInt(r.getAttribute("y"),10),c=parseInt(r.getAttribute("c"),10),p=(h(s,"Compression")||"none").toLowerCase();if(!x.has(p))throw new e("mrf:open","currently does not support compression "+p);const m=h(s,"DataType")||"UInt8",b=y.get(m.toLowerCase());if(null==b)throw new e("mrf:open","currently does not support pixel type "+m);const w=u(s,"PageSize"),I=parseInt(w.getAttribute("x"),10),_=parseInt(w.getAttribute("y"),10),A=w.getAttribute("c"),F=A?A===String(c):x.get(p).isOneSegment;this._isBsq=!F;const R=u(s,"DataValues");let S;if(R){const t=R.getAttribute("NoData");null!=t&&(S=t.trim().split(" ").map(t=>parseFloat(t)))}if(u(t,"MRF_META/CachedSource"))throw new e("mrf:open","currently does not support MRF referencing other data files");const M=u(t,"MRF_META/GeoTags"),k=u(M,"BoundingBox");let C,T=!1;if(null!=k){const t=parseFloat(k.getAttribute("minx")),e=parseFloat(k.getAttribute("miny")),s=parseFloat(k.getAttribute("maxx")),r=parseFloat(k.getAttribute("maxy")),o=h(M,"Projection")||"";let a=n.WGS84;if("LOCAL_CS[]"!==o)if(o.toLowerCase().startsWith("epsg:")){const t=Number(o.slice(5));isNaN(t)||0===t||(a=new n({wkid:t}))}else a=l(o)??n.WGS84;else T=!0,a=new n({wkid:3857});C=new i(t,e,s,r),C.spatialReference=a}else T=!0,C=new i({xmin:-.5,ymin:.5-f,xmax:a-.5,ymax:.5,spatialReference:new n({wkid:3857})});const j=u(t,"MRF_META/Rsets"),B=parseInt(j?.getAttribute("scale")||"2",10),L=C.spatialReference,E=new d({origin:new o({x:C.xmin,y:C.ymax,spatialReference:L}),blockWidth:I,blockHeight:_,pyramidBlockWidth:I,pyramidBlockHeight:_,compression:p,pyramidScalingFactor:B}),P=new o({x:C.width/a,y:C.height/f,spatialReference:L}),U=new g({width:a,height:f,extent:C,isPseudoSpatialReference:T,spatialReference:L,bandCount:c,pixelType:b,pixelSize:P,noDataValue:S,storageInfo:E}),q=this._getAuxFullPath(h(s,"DataFile")),W=this._getAuxFullPath(h(s,"IndexFile"));return{rasterInfo:U,files:{mrf:this.url,index:W||this.url.replace(".mrf",".idx"),data:q||this.url.replace(".mrf",x.get(p).blobExtension)}}}_getAuxFullPath(t){if(!t)return null;if(t.includes("\\"))return null;if(t.includes("/"))return t.startsWith(new URL(this.url).origin)?t:null;return`${this.url.slice(0,this.url.lastIndexOf("/"))}/${t}`}async _fetchAuxiliaryData(t){try{const{data:e}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:t?.signal});return f(e)}catch{return null}}};function w(t){if(t.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let e;if(c){const s=new Uint8Array(t),r=new ArrayBuffer(t.byteLength),i=new Uint8Array(r);for(let e=0;e<t.byteLength/4;e++)for(let t=0;t<4;t++)i[4*e+t]=s[4*e+3-t];e=new Uint32Array(r)}else e=new Uint32Array(t);return e}t([s()],b.prototype,"_files",void 0),t([s()],b.prototype,"_storageIndex",void 0),t([s()],b.prototype,"_isBsq",void 0),t([s({type:String,json:{write:!0}})],b.prototype,"datasetFormat",void 0),b=t([r("esri.layers.raster.datasets.MRFRaster")],b);const I=b;export{I as default};